/**
* Microsoft Internet Explorer semi-transparency patch
*/
function pngPatch()
{
	// save image objects, because they will be replaced in next loop
	var imageList = new Array();
	for (var i = 0; i < document.images.length; i++) {
		imageList[i] = document.images[i];
	}
	
	// loop all images
	for (var k = 0; k < imageList.length; k++) {
	   var img = imageList[k];
	   var src = img.src;
	   var ext = src.substr(src.length - 3, 3);
	   // image extension png?
	   if (ext.toLowerCase() == "png") {
	      // yes png!
		  
		  // create new container element
		  var container = document.createElement("span");
		  
		  // transparency patch
		  container.style.cssText = "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"
			 + (img.src)
			 + "')";
		  
		  // set container properties
		  container.style.display = "inline-block";
		  container.style.width   = img.width  + "px";
		  container.style.height  = img.height + "px";
		  
		  // adopt link behaviour
		  var par = img.parentNode;
		  if (par.tagName.toLowerCase() == "a")
			 container.style.cursor = "hand";
		  
		  // adopt title
		  if (img.alt.length > 0)
			 container.title = img.alt
		  else if (img.title.length > 0)
			 container.title = img.title;
		  
		  // adopt alignment
		  if (img.align == "left")
			 container.style.float = "left";
		  else if (img.align == "right")
			 container.style.float = "right";
		  
		  // adopt class name
		  if (img.className.length > 0)
			 container.className = img.className;
		  
		  // replace <img> with patched container
		  par.replaceChild(container, img);
	   }
	}
}
	 
if (document.all && !window.opera)
	window.onload = pngPatch;
