//window.onload = mon_navigateur(navigator.appVersion);
//window.onload = correctPNG;
window.addEvent('load', correctPNG); 

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 or higher.
{
    if (isNecessaryToCorrectPNG())
    {       
        for(var i=0; i<document.images.length; i++)
        {   
            var img = document.images[i];
            var correctPNG = true;
        
            var parentImg = img;
            
            while (parentImg.parentNode != null && parentImg.parentNode.id != "MutContent" && correctPNG)
            {                    
                if (parentImg.className.search("NoCorrectPNG") != -1)
                {
                    correctPNG = false;
                }
                
                parentImg = parentImg.parentNode;
            }
            
            if (correctPNG)
            {
                var imgName = img.src.toUpperCase();
               
                if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
                {                
                    var imgID = (img.id) ? "id='" + img.id + "' " : ""
                    var imgClass = (img.className) ? "class='" + img.className + "' " : ""
                    var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
                    var imgStyle = "display:inline-block;" + img.style.cssText 
                    if (img.align == "left") imgStyle = "float:left;" + imgStyle
                    if (img.align == "right") imgStyle = "float:right;" + imgStyle
                    if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
                    var strNewHTML = "<span " + imgID + imgClass + imgTitle
                        + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
                        + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                        + "(src=\'" + img.src + "\', sizingMethod='image');\"></span>" 
                    img.outerHTML = strNewHTML
                    
                    i = i-1
                }
            }
       }            
    }
}

function getStyle(oElm, strCssRule)
{
    var strValue = "";
    if(document.defaultView && document.defaultView.getComputedStyle)
    {
        strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
    }
    else if(oElm.currentStyle)
    {
        strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){
            return p1.toUpperCase();
        });
        strValue = oElm.currentStyle[strCssRule];
    }
    return strValue;
}


function Correct_Unique_Png(img)
{
    if (isNecessaryToCorrectPNG())
    {
        var imgID = (img.id) ? "id='" + img.id + "' " : ""
        var imgClass = (img.className) ? "class='" + img.className + "' " : ""
        var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
        var imgStyle = "display:inline-block;" + img.style.cssText 
        if (img.align == "left") imgStyle = "float:left;" + imgStyle
        if (img.align == "right") imgStyle = "float:right;" + imgStyle
        if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
        var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='image');\"></span>" 
        img.outerHTML = strNewHTML
    }
}

function isNecessaryToCorrectPNG()
{
    var X_nameNavigateur = 'FF'; // Par default Firefox
    var X_versionNavigateur = 0; // Par default pas de version
	
	var X_tabNav = navigator.appVersion.split(';');
	
	for(var i = 0; i < X_tabNav.length; i++)
	{
		// Si IE
		if (X_tabNav[i])
		{
		    if(X_tabNav[i].indexOf('MSIE') != -1)
		    {   
    			X_nameNavigateur = 'IE';
    			
    			var X_version = X_tabNav[i].replace('MSIE','');
    			X_versionNavigateur = X_version.replace(' ','');
		    }
		}
	}
	
	if (X_nameNavigateur == 'IE' && parseInt(X_versionNavigateur) < 7) 
	{
	    return true;
	}
	else
	{
	    return false;
	}
}