function extractImgURL(i) {
	var o = i;
	var cando = ((i.indexOf("(") != -1) && (i.indexOf(")") != -1));
	var firstIndex = i.indexOf("(");
	var secondIndex = i.indexOf(")");        
	if (cando) {
		o = i.substring((firstIndex + 1), secondIndex);
	}
	return o;
}

function initPNGs() {
	var isOldIE = ((navigator.userAgent.toLowerCase().indexOf("msie") != -1) && (navigator.userAgent.toLowerCase().indexOf("msie 7") == -1));

	if (isOldIE) { // detect for IE 6.0 and older
			// Replace all <img> sources with DirectX hack
			is = document.getElementsByTagName("img"); // get all images
			for(x = 0; x < is.length; x++){ // cycle through those images
					if(is[x].src.indexOf(".png") != -1){ // only do this to png files
							is[x].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+is[x].src+"', sizingMethod='crop')"; // apply the filter stuff that makes IE do it's magic
							is[x].src = "transparent.gif"; // replace the image with a clear gif so that the filter can show through
							is[x].style.zIndex = -100;
					}
			}

			// Replace all <td background> sources with DirectX hack
			is = document.getElementsByTagName("td"); // get all images
			for(x = 0; x < is.length; x++){ // cycle through those images
					if(is[x].background.indexOf(".png") != -1){ // only do this to png files
							is[x].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+is[x].background+"', sizingMethod='crop')"; // apply the filter stuff that makes IE do it's magic
							is[x].background = "transparent.gif"; // replace the image with a clear gif so that the filter can show through
							is[x].style.zIndex = -100;

					}
			}

			for(x = 0; x < is.length; x++){ // cycle through those images
					var initPNGs_imgurl = extractImgURL(is[x].style.background);
					if(initPNGs_imgurl.indexOf(".png") != -1){ // only do this to png files                                
							is[x].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + initPNGs_imgurl + "', sizingMethod='crop')"; // apply the filter stuff that makes IE do it's magic
							is[x].style.background = "url(transparent.gif)"; // replace the image with a clear gif so that the filter can show through
							is[x].style.zIndex = -100;
					}
			}

			// Replace all <input> sources with DirectX hack
			is = document.getElementsByTagName("input"); // get all images
			for(x = 0; x < is.length; x++){ // cycle through those images
					var initPNGs_imgurl = extractImgURL(is[x].style.background);
					if(initPNGs_imgurl.indexOf(".png") != -1){ // only do this to png files                                
							is[x].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + initPNGs_imgurl + "', sizingMethod='crop')"; // apply the filter stuff that makes IE do it's magic
							is[x].style.background = "url(transparent.gif)"; // replace the image with a clear gif so that the filter can show through
							is[x].style.zIndex = -100;
					}
			}
		   
			// Replace all <input> sources with DirectX hack
			is = document.getElementsByTagName("div"); // get all images
			for(x = 0; x < is.length; x++){ // cycle through those images
					var initPNGs_imgurl = extractImgURL(is[x].style.background);
					if(initPNGs_imgurl.indexOf(".png") != -1){ // only do this to png files                                
							is[x].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + initPNGs_imgurl + "', sizingMethod='crop')"; // apply the filter stuff that makes IE do it's magic
							is[x].style.background = "url(transparent.gif)"; // replace the image with a clear gif so that the filter can show through
							is[x].style.zIndex = -100;
					}
			}

	}
}


