// ----------------------------
// IMAGE TRANSPARENCY FUNCTIONS
// ----------------------------
// Copyright (c) 2006-2007 The Salamander Organization Ltd.  All Rights Reserved.
//
// THIS WORK IS SUBJECT TO U.K. AND INTERNATIONAL COPYRIGHT LAWS AND TREATIES.
//
// DISCLAIMER:
//
// The Salamander Organization Ltd. (hereto referred as "Salamander") makes no representations or warranties
// with respect to the contents or use of this code, and specifically disclaims any express or implied
// warranties of merchantability or fitness for any particular purpose.  Further, Salamander reserves the right
// to revise this publication and to make changes to its content, at any time, without obligation to notify any
// person or entity of such revisions or changes.
//
// Further, Salamander makes no representations or warranties with respect to any software, and specifically
// disclaims any express or implied warranties of merchantability or fitness for any particular purpose.  Salamander
// reserves the right to make changes to any and all parts of the software, at any time, without obligation to notify
// any person or entity of such changes.
//
// Inclusion of the above notice does not necessarily imply publication.

function ProcessImages() 
{ 
	var ieVersion = navigator.appVersion.match(/MSIE (\d+\.\d+)/, ''); 
	var isNewBrowser = (ieVersion != null && Number(ieVersion[1]) >= 5.5 && Number(ieVersion[1]) < 7.0); 

	if(isNewBrowser)
	{		
		// store all png images in a separate array so we can forward iterate the list
		var imageArray = new Array();
		for (var j = 0; imageArray.length < maxImagesToProcess && j < document.images.length; j++)
		{
			var img = document.images[j];
			
			if (img != null)
			{
				if (img.src.match(/\.(png)/i) != null && !img.isMap)
				{
					// got a png image, store it for processing
					var pngCount = imageArray.length;
					imageArray[pngCount] = img;
				}
			}
		}
		
		// fix the collected png images
		for (var i = 0; i < imageArray.length; i++) 
		{
			var pngImg = imageArray[i];
			
			if (pngImg != null)
			{
				var src = pngImg.src;
				var span = document.createElement("span");
				span.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizing='scale')";
				span.style.display = "inline-block";
				span.style.width = pngImg.width + "px";
				span.style.height = pngImg.height + "px";  
				span.title = pngImg.alt;
				span.innerHTML = "&nbsp;";
				pngImg.replaceNode(span);
			}
		}
	}
}