// --------------------------------------------------------------------------------------
function go(strUrl, strTarget) {
    if (strTarget != '') {
        var target = eval(strTarget);
        if (document.images)
            target.location.replace(strUrl);
        else
            target.location.href = strUrl;
    }
    else {
        if (document.images)
            window.location.replace(strUrl);
        else
            window.location.href = strUrl;
    }
}

function goWithoutLoading(strUrl, strTarget) {
    // --- Gestion du déplacement ---
    if (strTarget != '') {
        var target = eval(strTarget);

        if (document.images)
            target.location.replace(strUrl);
        else
            target.location.href = strUrl;
    }
    else {
        if (document.images)
            window.location.replace(strUrl);
        else
            window.location.href = strUrl;
    }
}

function ShowHideBloc(idBloc, nbBloc) {
    var obj
    var i

    //On stocke le dernier menu sur lequel on a fait un clic
    if (idBloc != window.top.LogoAppiFrame.hidCurrentMenuBloc.value) {
        window.top.LogoAppiFrame.hidCurrentMenuBloc = idBloc;
        window.top.LogoAppiFrame.hidMaxMenuBloc = nbBloc;

        if (document.getElementById("Bloc" + idBloc.toString()).style.display == "") {
            document.getElementById("Bloc" + idBloc.toString()).style.display = "none";
            document.getElementById("Picto" + idBloc.toString()).src = "../images/fleche_menu_bas.gif";
        }
        else {
            document.getElementById("Bloc" + idBloc.toString()).style.display = "";
            document.getElementById("Picto" + idBloc.toString()).src = "../images/fleche_menu_haut.gif";
        }

        //On ferme le menu ouvert 
        for (i = 0; i <= nbBloc; i++) {
            obj = document.getElementById("Bloc" + i.toString());

            //Si le bloc existe et si le bloc n'est pas celui sur lequel on a fait un clic
            if ((obj != null) && (i != idBloc)) {
                if (document.getElementById("Bloc" + i.toString()).style.display == "") {
                    document.getElementById("Bloc" + i.toString()).style.display = "none";
                    document.getElementById("Picto" + i.toString()).src = "../images/fleche_menu_bas.gif";
                }
            }
        }
    }
}

var monTab = new Array
function TestTab(idBloc) {
    monTab.push(idBloc)
}

function ShowBloc(idBloc) {
    if (document.getElementById("Bloc" + idBloc.toString()).style.display == "none") {
        document.getElementById("Bloc" + idBloc.toString()).style.display = "";
        document.getElementById("Picto" + idBloc.toString()).src = "../images/Menu_ArrowUp.gif";
    }
}

function HideBloc(idBloc) {
    if (document.getElementById("Bloc" + idBloc.toString()).style.display == "") {
        document.getElementById("Bloc" + idBloc.toString()).style.display = "none";
        document.getElementById("Picto" + idBloc.toString()).src = "../images/Menu_ArrowDown.gif";
    }
}

// --------------------------------------------------------------------------------------
function popup(strHTMLfile, lngWidth, lngHeight, lngTop, lngLeft, blnScroll, blnResize, strPopName) {
    //	var truc;
    //	strParam = 'width='+lngWidth+',height='+lngHeight+',top='+lngTop+',left='+lngLeft+',scrollbars='+blnScroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable='+blnResize;
    //	truc=window.open(strHTMLfile, strPopName, strParam);
    popupCenter(strHTMLfile, lngWidth, lngHeight, blnScroll, blnResize, strPopName);
}

// --------------------------------------------------------------------------------------
function popupCenter(strHTMLfile, lngWidth, lngHeight, blnScroll, blnResize, strPopName) {
    var truc;
    strParam = 'width=' + lngWidth + ',height=' + lngHeight + ',top=' + ((screen.availHeight - lngHeight) / 2) + ',left=' + ((screen.availWidth - lngWidth) / 2) + ',scrollbars=' + blnScroll + ',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=' + blnResize;
    truc = window.open(strHTMLfile, strPopName, strParam);
    truc.focus();
}

// --------------------------------------------------------------------------------------
function popupWithToolBar(strHTMLfile, lngWidth, lngHeight, lngTop, lngLeft, blnScroll, blnResize, strPopName) {
    var truc;
    strParam = 'width=' + lngWidth + ',height=' + lngHeight + ',top=' + lngTop + ',left=' + lngLeft + ',scrollbars=' + blnScroll + ',location=no,directories=no,status=no,menubar=no,toolbar=yes,resizable=' + blnResize;
    truc = window.open(strHTMLfile, strPopName, strParam);
}

// --------------------------------------------------------------------------------------
function popupWithMenu(strHTMLfile, lngWidth, lngHeight, lngTop, lngLeft, blnScroll, blnResize, strPopName) {
    var truc;
    strParam = 'width=' + lngWidth + ',height=' + lngHeight + ',top=' + lngTop + ',left=' + lngLeft + ',scrollbars=' + blnScroll + ',location=no,directories=no,status=no,menubar=yes,toolbar=no,resizable=' + blnResize;
    truc = window.open(strHTMLfile, strPopName, strParam);
}

// --------------------------------------------------------------------------------------
function popupTopModal(strHTMLfile, lngWidth, lngHeight, lngTop, lngLeft, blnScroll, blnResize, strPopName) {
    var truc;
    strParam = 'dialogWidth:' + lngWidth + 'px;dialogHeight:' + lngHeight + 'px;dialogTop:' + lngTop + 'px;dialogLeft:' + lngLeft + 'px;dialogHide:no;edge:sunken;help:no;scroll:' + blnScroll + ';status:no;unadorned:no;resizable:' + blnResize;
    truc = window.showModelessDialog(strHTMLfile, "", strParam);
}

// --------------------------------------------------------------------------------------
function popupFullScreen(strHTMLfile, blnScroll, strPopName) {
    var truc;
    strParam = 'scrollbars=' + blnScroll + ',fullscreen=yes';
    truc = window.open(strHTMLfile, strPopName, strParam);
}

// --------------------------------------------------------------------------------------

function setWaitMouseCursor() {
    if (document.all)
        for (var i = 0; i < document.all.length; i++) document.all(i).style.cursor = 'wait';
}

function setNormalMouseCursor() {
    if (document.all)
        for (var i = 0; i < document.all.length; i++) document.all(i).style.cursor = 'default';
}

function ModifyPhoto(strLetter) {
    document.getElementById('trModify' + strLetter).style.display = 'none';
    document.getElementById('Browse' + strLetter).style.display = '';
}

function ShowLoading() {
    var iLeft;
    var iTop;

    var objDiv;
    objDiv = document.getElementById('IdivChargement');

    if (objDiv != null) {
        iLeft = ((document.body.clientWidth / 2) - (IdivChargement.style.width));
        iTop = ((document.body.clientHeight / 2) - (IdivChargement.style.height));

        IdivChargement.style.position = "absolute";
        IdivChargement.style.left = iLeft - 100;
        IdivChargement.style.top = iTop - 100;
        IdivChargement.style.border = 0;

        IdivChargement.style.display = '';
    }
}

function focusOut() {
    var objDiv;
    objDiv = document.getElementById('IdivChargement');

    if (objDiv != null) {
        objDiv.style.visibility = 'hidden';
    }
}

function CreatDiv() {
    document.write("<div SCROLLING='no' width='250' height='100' id='IdivChargement' style='display: none;'><iframe FRAMEBORDER=0 SCROLLING='no' width='250' height='100' src='LoadingLittle.aspx'></iframe></div>");
}

/* Fonction qui active/desactive une liste d'elements donnée d'une CheckBoxList*/
function EnableCheckBoxesByList(CheckBoxListName, CheckBoxesList, EnableValue, UnCheckIfDisabled) {
    if (UnCheckIfDisabled == null) UnCheckIfDisabled = false;
    if (CheckBoxesList != '') {
        var tabId = CheckBoxesList.split(',');
        var i;
        for (i in tabId) {
            var objItem;
            objItem = document.getElementById(CheckBoxListName + '_' + tabId[i]);
            if (objItem != null) {
                objItem.disabled = !EnableValue;
                if (EnableValue == false && UnCheckIfDisabled) {
                    objItem.checked = false;
                }
            }
        }
    }
}

/* Fonction qui active/desactive tous les elements d'une CheckBoxList */
function EnableCheckBoxes(CheckBoxListName, EnableValue, UnCheckIfDisabled) {
    if (UnCheckIfDisabled == null) UnCheckIfDisabled = false;
    var i = 0;
    var objItem;
    objItem = document.getElementById(CheckBoxListName + '_' + i);
    while (objItem != null) {
        objItem.disabled = !EnableValue;
        if (EnableValue == false && UnCheckIfDisabled) {
            objItem.checked = false;
        }
        objItem = document.getElementById(CheckBoxListName + '_' + ++i);
    }
}
/* Fonction d'affichage d'un reportCougar*/
function ShowCougarReport(SiteActuel, ReportType, ExportType, lngWidth, lngHeight, lngTop, lngLeft, blnScroll, blnResize, strPopName) {
    //Nom du cookie
    var dataName = 'ReportUrl';
    if (SiteActuel == false)
        dataName = 'ReportUrlEur';
    var cookies = document.cookie;
    var start = cookies.indexOf(dataName + '=');
    if (start > -1) {
        var len = start + dataName.length + 1;
        var end = cookies.indexOf(';', len);
        if (end == -1) end = cookies.length;
        var ReportUrl = unescape(cookies.substring(len, end));
        while (ReportUrl.indexOf("{0}") > 0) ReportUrl = ReportUrl.replace("{0}", ReportType);
        while (ReportUrl.indexOf("{1}") > 0) ReportUrl = ReportUrl.replace("{1}", ExportType);
    }
}





