wsSupersleight = function() {
	this.root = false;
	this.applyPositioning = false;
	// Path to a transparent GIF image
	this.shim			= 'javascript/x.gif';
	this.shim_pattern	= /javascript\/x\.gif$/i;
}

wsSupersleight.prototype.fnLoadPngs = function() { 
	var root = document;
	var obj = null;
	
	for (var i = root.all.length - 1, obj = null; (obj = root.all[i]); i--) {
		//if(obj.currentStyle.backgroundImage != 'none')
			//alert(obj.currentStyle.backgroundImage);
		// background pngs
		if (obj.currentStyle.backgroundImage.match(/\.png/i) !== null) {
			//alert('hey');
			this.bg_fnFixPng(obj);
		}
/*		// image elements
		if (obj.tagName=='IMG' && obj.src.match(/\.png$/i) !== null){
			this.el_fnFixPng(obj);
		}
		// input image elements
		if (obj.tagName=='INPUT' && obj.type == "image" && obj.src.match(/\.png$/i) !== null){
			this.el_fnFixPng(obj);
		}*/
	}
};

wsSupersleight.prototype.fnCleanX = function() { 
	var root = document;
	var obj = null;
	
	for (var i = root.all.length - 1, obj = null; (obj = root.all[i]); i--) {
/*		if(obj.style.backgroundImage != '')
			alert(obj.style.backgroundImage);*/
		// background pngs
		if (obj.currentStyle.backgroundImage.match(/x\.gif/i) !== null) {
			obj.style.backgroundImage = '';
		}
	}
};

wsSupersleight.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 + "')";
	//alert(obj.style.filter);
	obj.style.backgroundImage = 'url('+this.shim+')';
};

wsSupersleight.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;
};

var WS_SUPERSLEIGHT = new wsSupersleight();
