//Give credit where credit is due.
//The original superSleight code was written by:
//Jeffrey Barke <http://themechanism.com/>
//Drew McLellan <http://24ways.org/2007/supersleight-transparent-png-in-ie6>

//But this code has been highly customized for our site by us, so please go back to the originals
//if you wish to use.

var shim='/common/images/internal/x.gif';

var supersleight=function(){}

supersleight.prototype.FixPngs = function()
{
      for(var i=document.all.length-1,obj=null;(obj=document.all[i]);i--)
      {
		if(obj.currentStyle.backgroundImage.match(/\.png/i)!==null)
         	{
         		objSuperSleight.bg_fnFixPng(obj);
         	}

         	if(obj.tagName=='IMG'&&obj.src.match(/\.png$/i)!==null)
		{
			objSuperSleight.el_fnFixPng(obj);
		}

         	if((obj.tagName=='A'||obj.tagName=='INPUT')&&obj.style.position==='')
		{
			obj.style.position='relative';
		}
      }
}

supersleight.prototype.bg_fnFixPng=function(obj)
{
	var mode='scale';
	var bg=obj.currentStyle.backgroundImage;
	var src=bg.substring(5,bg.length-2);
	if(obj.currentStyle.backgroundRepeat=='no-repeat')
	{
		mode='crop';
	}

	obj.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"', sizingMethod='"+mode+"')";
	obj.style.backgroundImage='url('+shim+')';
}

supersleight.prototype.el_fnFixPng=function(img)
{
	var src=img.src;
	img.style.width=img.width+'px';
	img.style.height=img.height+'px';
	img.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"', sizingMethod='scale')";
	img.src=shim;
}

supersleight.prototype.AddLoadEvent=function(func)
{
	this.oldonload=window.onload;
	if(typeof window.onload != 'function')
	{
		window.onload=func;
	}
	else
	{
		window.onload=function()
		{
			if(oldonload)
			{
				oldonload();
			}

			func();
		};
	}
}

var objSuperSleight = new supersleight();
objSuperSleight.AddLoadEvent(objSuperSleight.FixPngs);
