var check_loaded;

function init_browser()
{
	userNavigator = navigator.userAgent.toLowerCase();
	if(userNavigator.match(/msie\s(5\.[5-9]|[6]\.[0-9]*).*(win)/i))
	{
	fix_png();
	}
}

function loaded()
{


	loaded = 0;
	for (i=0;i<document.images.length;++i)
	{
		if (document.images[i].complete == true)
		{
		loaded++;
	    }
	}
	
	if(i == loaded)
	{
	window.clearInterval(check_loaded);
	fix_png();
	}
}

function fix_png()
{
	// Image Tags
	is = document.getElementsByTagName("IMG");

		for(x=0; x<is.length; x++){
		file_name = is[x].src;

			if(is[x].src != null && !file_name.match("spacer.gif"))
			{
				var imgName = is[x].src.toUpperCase()
				if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
				{ 
				is[x].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, src=\'"+is[x].src+"\', sizingMethod=\'crop\')";
				is[x].src = "img/spacer.gif";
				}
			}
		}

	// Background Images
	var tags = "TD,TABLE";
	tag = tags.split(",");

	for(i=0;i<tag.length;i++)
	{
	is = document.getElementsByTagName(tag[i]);

		for(x=0; x<is.length; x++){
			if(is[x].background != null)
			{
				var imgName = is[x].background.toUpperCase()
				if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
				{ 
					if(is[x].background == null || is[x].background == "" || is[x].background != "none")
					{
					is[x].style.background = "none";
					is[x].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, src=\'"+is[x].background+"\', sizingMethod=\'scale\')";
					}
				}
			}
		}
	}

	var tags = "A,DIV";
	tag = tags.split(",");

	for(i=0;i<tag.length;i++)
	{
	is = document.getElementsByTagName(tag[i]);

		for(x=0; x<is.length; x++){
			if(is[x].href != null && is[x].href != "")
			{
				if(is[x].style.position == null || is[x].style.position == "")
				{
				is[x].style.position = "relative";
				}
			}
		}
	}

}