// JavaScript Document

function IE_CorrectAlpha_PNG(){ 
for(i=0; i<document.images.length; i++){ 
img    = document.images[i]; 
imgExt  = img.src.substring(img.src.length-3, img.src.length); 
imgExt  = imgExt.toUpperCase(); 
if (imgExt == "PNG"){ 
imgID    = (img.id) ? "id='" + img.id + "' " : ""; 
imgClass= (img.className) ? "class='" + img.className + "' " : ""; 
imgTitle= (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "; 
imgStyle= "display:inline-block;" + img.style.cssText; 
if (img.align == "left") { imgStyle = "float:left;"  + imgStyle; } else if (img.align == "right"){ imgStyle = "float:right;" + imgStyle; } 
if (img.parentElement.href)   { imgStyle = "cursor:hand;" + imgStyle; }        
strNewHTML    = '<span '+imgID+imgClass+imgTitle+' style="width:'+img.width+'px; height:'+img.height+'px;'+imgStyle+';'+'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+img.src+'\', sizingMethod=\'noscale\');"></span>'; 
img.outerHTML = strNewHTML; 
i = i-1; 
}}} 


function alphaBackgrounds(){
	// Désactivé car empèche le click sur les liens
	
	/*var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
	var itsAllGood = (rslt != null && Number(rslt[1]) >= 5.5);
	for (i=0; i<document.all.length; i++){
		var bg = document.all[i].currentStyle.backgroundImage;
		if (itsAllGood && bg){
			if (bg.match(/\.png/i) != null){
				var mypng = bg.substring(5,bg.length-2);
				document.all[i].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+mypng+"', sizingMethod='scale')";
				document.all[i].style.backgroundImage = "url('/assets/images/x.gif')";
			}
		}
	}*/
}

if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent) {
	window.attachEvent("onload", alphaBackgrounds);
	window.attachEvent("onload", IE_CorrectAlpha_PNG);
}
