var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])

function fixPNG(myImage) 
{
    if ((version >= 5.5) && (version < 7) && (document.body.filters)) 
    {
       var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
	   var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
	   var imgTitle = (myImage.title) ? 
		             "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' "
	   var imgStyle = "display:inline-block;" + myImage.style.cssText
	   var strNewHTML = "<span " + imgID + imgClass + imgTitle
                  + " style=\"" + "width:" + myImage.width 
                  + "px; height:" + myImage.height 
                  + "px;" + imgStyle + ";"
                  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                  + "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>"
	   myImage.outerHTML = strNewHTML	  
    }
}

function autoScrollY (mouse, element, scrollBoxName, border) {
	mouseY = mouse.layerY ? mouse.layerY : mouse.offsetY;
	if (element.scrollHeight > element.offsetHeight) {
		scrollbox = document.getElementById (scrollBoxName);
		barmax = element.offsetHeight + scrollbox.offsetHeight;
		barlock = element.offsetHeight - scrollbox.offsetHeight;
		scrollmax = element.scrollHeight - element.offsetHeight + (border * 2);
		scrollcurr = scrollmax / element.scrollHeight * (mouseY - border);
		if (scrollcurr < 0) scrollcurr = 0;
		if (scrollcurr > scrollmax) scrollcurr = scrollmax;
		barcurr = barmax / scrollmax * scrollcurr;
		if (barcurr > barlock) barcurr = barlock;
		element.scrollTop = scrollcurr;
		scrollbox.style.top = barcurr + "px" ;
		// document.getElementById ("position").innerHTML = barcurr + "-" + barmax;
	}
}

function autoScrollX (mouse, element, scrollBoxName, border) {
	/* a mouse.offsetx nagyon nem azt adja amit kellene, főleg ha képek, divek, miegyebek is előfordulnak... */
	mouseX = mouse.layerX ? mouse.layerX : ((mouse.x - ((document.body.offsetWidth - element.offsetWidth) / 1.7)) * 16); /* fucking ie workaround kurvaélet aki tud jobbat szóljon grrr */
	if (element.scrollWidth > element.offsetWidth) {
		// document.getElementById ("position").innerHTML = (mouseX/element.offsetWidth) * document.body.offsetWidth;
		scrollbox = document.getElementById (scrollBoxName);
		barmax = element.offsetWidth + scrollbox.offsetWidth;
		barlock = element.offsetWidth - scrollbox.offsetWidth;
		scrollmax = element.scrollWidth - element.offsetWidth + (border * 2);
		scrollcurr = scrollmax / element.scrollWidth * (mouseX - border);
		if (scrollcurr < 0) scrollcurr = 0;
		if (scrollcurr > scrollmax) scrollcurr = scrollmax;
		barcurr = barmax / scrollmax * scrollcurr;
		if (barcurr > barlock) barcurr = barlock;
		element.scrollLeft = scrollcurr;
		scrollbox.style.left = barcurr + "px" ;
		// document.getElementById ("position").innerHTML = scrollcurr + "-" + scrollmax;
	}
	
}
