if(typeof Base != "function")
	throw("Base.js must be included before Image.js");
	
Img.prototype.Source = "";
Img.prototype.Width = 0;
Img.prototype.Height = 0;
Img.prototype.Alt = 0;
Img.prototype.Type = 0;
Img.prototype.element = null;

function Img(img)
{
	if(Base.Exists(img.href) && img.href != "")
		this.Source = img.href;
	else
		this.Source = img.src;
	this.Width = img.width;
	this.Height = img.height;
	this.Alt = img.alt;
	this.Type = this.Source.slice(this.Source.lastIndexOf('.')+1);
	this.element = img;
	return this;
}

Img.GetImages = function(extension)
{
	var allImages = document.getElementsByTagName("img");
	var retur = new Array();
	for(i = 0; i < allImages.length; i++)
	{
		if(arguments.length == 1)
		{
			var img = new Img(allImages[i]);	
			if(img.Type == extension)
				retur.push(new Img(allImages[i]));
		}
		else
			retur.push(new Img(allImages[i]));
	}
	return retur;
}

Img.PngFix = function(emptyGif)
{    
	if(Base.Browser().Name == "IE" && Base.Browser().VersionNumber == 6)
	{	    
		var inspect = 0;
		var allElements = document.getElementsByTagName("*");
		var strout = "";
		for(i = 0; i < allElements.length; i++)
		{
			if(allElements[i].style != null && allElements[i].style["backgroundImage"].toLowerCase().indexOf("png") >= 0)
			{
				var imgPath = allElements[i].style["backgroundImage"].replace("url(","").replace(")","");					
				allElements[i].style["filter"] = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+imgPath+"', sizingMethod='crop')";
				allElements[i].style["backgroundImage"] = "none";
			}
		}
		
		var allImages = Img.GetImages("png");
		for(i = 0; i < allImages.length; i++)
		{
			var image = allImages[i];
			var replacer = document.createElement('img');
			replacer.src = emptyGif;
			
			replacer.id = i+"_replaced";
			
			Base.TransferStyle(image.element, replacer);
			replacer.width = image.Width.toString();
			replacer.height = image.Height.toString();
			replacer.style["width"] =  image.Width.toString();
			replacer.style["height"] = image.Height.toString();					
			replacer.style["filter"] = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+image.Source+"', sizingMethod='crop')";
			image.element.parentNode.appendChild(replacer);
			image.element.style["display"] = "none";
			
		}		
	}
}
