﻿function ShowDeroulante(visible, gauche, element) {
    try {
        der = element.children[0];
    }
    catch (e) {
        der = element.childNodes[1];
    }

    if (visible == true) {
        der.style.display = "block";
        der.style.left = element.offsetParent.offsetParent.offsetParent.offsetLeft + gauche + 1 + "px";
        der.style.top = "116px";
        //$("#" + der.id).fadeIn("slow");
    }
    else {
        der.style.display = "none";
        //$("#" + der.id).fadeOut("slow");
    }
}

function PushBouton(hover, element, combien) {
    
    if (hover == true) {
        element.width = element.width - combien;
    }
    else {
        element.width = element.width + combien;
    }
}

//------------------------------
// repositionnement du scroll
//------------------------------

function InitScrollPosition() {
    document.cookie = "yPos=!~0~!";
}

function SetScrollPosition() {
    var strCook = document.cookie;
    if (strCook.indexOf("!~") != 0) {
        var intS = strCook.indexOf("!~");
        var intE = strCook.indexOf("~!");
        var strPos = strCook.substring(intS + 2, intE);
        document.documentElement.scrollTop = strPos;
    }
}

function GetScrollPosition() {
    var intY = document.documentElement.scrollTop;
    document.cookie = "yPos=!~" + intY + "~!";
}

function SetLoading() {
    try {
        document.getElementById('Chargement').style.height = (document.getElementById('options').offsetHeight - 15) + "px";
    }
    catch (e) {
    }
}

function ouvre(fichier, width, height) {
    window.open(fichier, "popup", "directories=0,location=0,addressbar=0,toolbar=0,copyhistory=0,status=0,scrollbars=1,modal=0,menu=0,dialog=0,menubar=0,resizable=0,titlebar=0,personalbar=0,width=" + width + ",height=" + height);
}

function RetourCatalogue() {
    //    if (parent.location.pathname != '/catalogue.aspx')
    //        history.go(-3);
    //    else
    //        history.go(-1);
    //

    history.go(history.previous);
}



function EffaceChamp(valeur, champ) {
    txt = document.getElementById(champ);
    if (txt == null)
        txt = document.getElementById("ctl00_" + champ);
    if (txt == null)
        txt = document.getElementById("ctl00_ctl00_" + champ);
    if (txt != null) {
        if (txt.value == valeur)
            txt.value = '';
    }
}

function ShowHide(s) {
    if (document.getElementById(s).style.display != 'none')
        document.getElementById(s).style.display = 'none';
    else document.getElementById(s).style.display = 'inline';
}


$(document).ready(function() {

    $("img.Suivant, input.Suivant, a.Suivant img").hover(
    function() {
        if (this.src.search("_hover") == -1)
            this.src = this.src.substring(0, this.src.length - 4) + "_hover.png";
    },

    function() {
        this.src = this.src.replace("_hover", "");
    }
    );

    $("img,[class]").each(function() {
        if ($(this).css("background-image") != null) {
            //$(this).css("behavior", "url(/js/iefix/iepngfix.htc)");
        }
    });

});