var PNGAlpha={
	siteRoot:"/",//for smartsite, use <img src="*.png" longdesc="~"> to define absolute path of the root of the site. This is only needed once
	transparencyImage:"local/images/global/transparent.gif",
	info:new Array(),
	all:function() {
		//document.runtimeStyle.behavior="expression(function(e) {PNGAlpha.set()}(this))"
		var images=document.getElementsByTagName("img");
		for (var i=0;i<images.length;i++) this.set(images[i]);
		images=null;
	},
	set:function(image) {
		if (image.src.match(/\.png$/i)) {
			if (navigator.appName =="Microsoft Internet Explorer" ) {
				var found=false;
				var backupSrc;
				var backupWidth;
				var backupHeight;
				for (var i=0;i<this.info.length;i++) if (this.info[i].src==image.src) found=this.info[i];
				if (!found) {
					backupSrc=image.src;
					backupWidth=image.offsetWidth+"px";
					backupHeight=image.offsetHeight+"px";
					this.info.push({src:backupSrc,width:backupWidth,height:backupHeight});
				}
				else {
					backupSrc=found.src;
					backupWidth=found.width;
					backupHeight=found.height;
				}
				this.siteRoot=image.longDesc?image.longDesc:this.siteRoot;
				image.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+backupSrc+"',sizingMethod='scale')";
				image.src=this.siteRoot+this.transparencyImage;
				image.style.width=backupWidth;
				image.style.height=backupHeight;
				image=null;
			}
		}
	}
}

window.loadBeforePNGAlpha=window.onload;
window.onload=function() {
	if (window.loadBeforePNGAlpha) window.loadBeforePNGAlpha()
	PNGAlpha.all();
}
