var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])

window.onload = function()
{
	
	
	
	var arrImages = document.getElementsByTagName("IMG");
		
	for(var i=0; i<arrImages.length; i++)
	{
		var img = arrImages[i]
		  
		if (img.className.indexOf("png-image") > -1)
		{
			var imgtmp = new Image();
			imgtmp.src = img.src;
			 
			if ((version >= 5.5 && version < 7) && (document.body.filters)) 
			{
			 var imgID = (img.id) ? "id='" + img.id + "' " : ""
			 var imgClass = (img.className) ? "class='" + img.className.replace("png-image","") + "' " : ""
			 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
			 var imgStyle = "display:inline-block;" + img.style.cssText 
			 if (img.align == "left") imgStyle = "float:left;" + imgStyle
			 if (img.align == "right") imgStyle = "float:right;" + imgStyle
			 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
			 var strNewHTML = "<span " + imgID + imgClass + imgTitle
			 + " style=\"" + "width:" + imgtmp.width + "px; height:" + imgtmp.height + "px;" + imgStyle + ";"
			 + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
			 + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
			 img.outerHTML = strNewHTML
			
			 i = i-1
			}
			else
			{
				img.className = "png-image-done";
			}
		}
	}
	checkWindowHeight();
}

function checkWindowHeight()
{
	if(document.body)
	{
		if(document.documentElement && navigator.appVersion.indexOf("MSIE") == -1)
		{
			if(document.documentElement.scrollHeight > document.documentElement.clientHeight)
			{
				document.getElementById("bg").style.height = document.documentElement.scrollHeight+"px";
			}
			else
			{
				document.getElementById("bg").style.height = '100%';
			}
			
			if(document.documentElement.scrollWidth > document.documentElement.clientWidth)
			{
				document.getElementById("bg").style.width = document.documentElement.scrollWidth+"px";
			}
			else
			{
				document.getElementById("bg").style.width = '100%';
			}
			
		}
		else
		{
			if(document.body.scrollHeight > document.body.clientHeight)
			{
				document.getElementById("bg").style.height = document.body.scrollHeight+"px";
			}
			else
			{
				document.getElementById("bg").style.height = '100%';
			}
			
			if(document.body.scrollWidth > document.body.clientWidth)
			{
				document.getElementById("bg").style.width = document.body.scrollWidth+"px";
			}
			else
			{
				document.getElementById("bg").style.width = '100%';
			}
		}
	}
}
