﻿// JScript File
function ChangeBtn(id) {
    Objet = document.getElementById(id);
    Objet.src = UrlApplication + 'App_Themes/Default/images/boutonsbleus_05.jpg';
}

function ReloadBtn(id) {
    Objet = document.getElementById(id);
    Objet.src = UrlApplication + 'App_Themes/Default/images/boutonsrouges_05.jpg';
}

/* Fonction popup (non bloquée) pour affichage de la facture */
function twAller(_url,_cadre,_target) {
    if (_cadre)
    {
        parent._cadre.location.href = _url;
    }
    else if (_target)
    {
        _target = window.open(_url,_target);
    }
    else
    {
        window.location.href = _url;
    }
}

/* Fonction mettant la culture dans un champ caché de la MaterPage */
function ChangeCulture(LangueSelec) {
    document.getElementById('ctl00_H_MEM_LANGUE').value = LangueSelec;
}

/* Fonctions d'affichage d'un message clignotant */
function clign() {
    document.getElementById('ctl00_footerliens').style.left = '120px';
    if(document.getElementById('ctl00_LBLWarning').style.visibility = 'hidden')
        setTimeout("document.getElementById('ctl00_LBLWarning').style.visibility = 'visible';",500);
    else
        setTimeout("document.getElementById('ctl00_LBLWarning').style.visibility = 'hidden';",500);
}

function AppelClign(){
    setInterval("clign();",1000);
}

/* Fonction déclencheuse du click pour ouverture modale */
function _FireEventModal(P, isCaddy){
    var appVer = navigator.appVersion.toLowerCase();
    var agt=navigator.userAgent.toLowerCase();
    var LINKMod = document.getElementById('ctl00_LINKMod');
    var is_ie = appVer.indexOf('msie');
    var is_fx = ((agt.indexOf('mozilla/5')!=-1) && (agt.indexOf('spoofer')==-1) &&
                 (agt.indexOf('compatible')==-1) && (agt.indexOf('opera')==-1)  &&
                 (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)     &&
                 ((navigator.vendor=="Firefox")||(agt.indexOf('firefox')!=-1)));
    
    if (is_ie != -1){
        LINKMod.fireEvent('onclick');
    }
    if (is_fx !=-1 && is_ie == -1){
        LINKMod.click();
    }
    
    if(isCaddy)
        AddiModalCaddy(P);
    else
        AddiModal(P);
}

/* Fonction de renseignement du src de l'iframe */
function AddiModal(P){
    var iFrame;
    iFrame = document.getElementById('iPopUp');
    iFrame.src = UrlApplication + "PopUp/PopupContent.aspx?P=" + P;
}

function AddiModalCaddy(P){
    var iFrame;
    iFrame = document.getElementById('iPopUp');
    iFrame.src = UrlApplication + "PopUp/PopupContentCaddy.aspx?P=" + P;
}

/* Fonction de fermeture de la modale */
function HideModal(){
    var appVer = navigator.appVersion.toLowerCase();
    var agt = navigator.userAgent.toLowerCase();
    var LINKMod = document.getElementById('ctl00_LINKMod');
    var is_ie = appVer.indexOf('msie');
    var is_fx = ((agt.indexOf('mozilla/5')!=-1) && (agt.indexOf('spoofer')==-1) &&
                 (agt.indexOf('compatible')==-1) && (agt.indexOf('opera')==-1)  &&
                 (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)     &&
                 ((navigator.vendor=="Firefox")||(agt.indexOf('firefox')!=-1)));
    
    if (is_ie != -1){
        document.forms['aspnetForm'].submit();
    }
    if (is_fx !=-1 && is_ie == -1){
        document.aspnetForm.submit();
    }
}

/* Fonction déclencheuse du click pour ouverture modale */
function _FireEventPoidsModal(){
    var appVer = navigator.appVersion.toLowerCase();
    var agt=navigator.userAgent.toLowerCase();
    var LINKMod = document.getElementById('ctl00_LINKMod');
    var is_ie = appVer.indexOf('msie');
    var is_fx = ((agt.indexOf('mozilla/5')!=-1) && (agt.indexOf('spoofer')==-1) &&
                 (agt.indexOf('compatible')==-1) && (agt.indexOf('opera')==-1)  &&
                 (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)     &&
                 ((navigator.vendor=="Firefox")||(agt.indexOf('firefox')!=-1)));
    
    if (is_ie != -1){
        LINKMod.fireEvent('onclick');
    }
    if (is_fx !=-1 && is_ie == -1){
        LINKMod.click();
    }
    
    AddiPoidsModal();
}

/* Fonction de renseignement du src de l'iframe */
function AddiPoidsModal(){
    var iFrame;
    iFrame = document.getElementById('iPopUp');
    iFrame.src = UrlApplication + "PopUp/PopupPoidsDepasse.aspx";
}


/* Fonction de renseignement du src de l'iframe */
function AddiCodePromoModal(){
    var iFrame;
    iFrame = document.getElementById('iPopUp');
    iFrame.src = UrlApplication + "PopUp/PopupCodePromoErreur.aspx";
}