﻿var menuheightmax = 603;
function iiCalCb_Pos(iiCalCb_) {
    var iiCalCb_ObjLeft = iiCalCb_.offsetLeft;
    var iiCalCb_ObjTop = iiCalCb_.offsetTop;
    while (iiCalCb_.offsetParent != null && iiCalCb_.style.position != 'absolute') {
        iiCalCb_ObjParent = iiCalCb_.offsetParent;

        iiCalCb_ObjLeft += iiCalCb_ObjParent.offsetLeft;
        iiCalCb_ObjTop += iiCalCb_ObjParent.offsetTop;
        iiCalCb_ = iiCalCb_ObjParent;
    }
    return [iiCalCb_ObjLeft, iiCalCb_ObjTop];
}

// Gestion de la hauteur du menu flash
// paramétrage de la masterPage :
var flashMarginBottom = 0; // gestion des écarts hauteur flash et bas écran (ex: pied de page)
var flashPaddingBottom = 30; // marge intérieur entre le bas du texte flash et le bas du menu flash (ex: bloc interne en bas ds le flash)
var flashCentreDeltaHeight = 0; // permet de gérer les cas ou la hauteur du menu flash doit etre différente du centre (bloc hml au dessous par ex)
var flashWindowDependency = true; // si false: le dimensionnement se fait seulement sur la taille intrinsèque au flash
var menuheightmin = 0;
// AN 30/03/2009 flash et iframes
var useFrame = false;// si true --> alors le param flashheightauto est désactivé car le flash ne doit pas modifier la hauteur du menu !
function FlashHeight(flashheight_auto) {
    if (useFrame) flashheight_auto = null;
    var menu = document.getElementById("menu");
    if (!menu) return;
    var result = 0;

    //    var windowheight = (document.all ? document.body.clientHeight-0 : window.innerHeight-0);
    II_calculScroll();
    var menuheight = 0;
    if (!flashWindowDependency)
        menuheight = menu.offsetHeight
    else
        menuheight = II_windowHeight - iiCalCb_Pos(menu)[1] - flashMarginBottom;
    if (flashheight_auto) {
        if (flashheight_auto + flashPaddingBottom > menuheight) { menuheight = flashheight_auto + flashPaddingBottom }
    }
    var centre = document.getElementById("centre");
    if (centre && flashWindowDependency) {
        if (centre.offsetHeight > menuheight) menuheight = centre.offsetHeight - flashCentreDeltaHeight;
    }
    //if (flashheight_auto) alert('l39-fa='+flashheight_auto)
    //alert('l40:'+menuheight)
    if (flashheight_auto && !flashWindowDependency) {
        menuheight = flashheight_auto + flashPaddingBottom;
    }

    menuheightinit = menuheight;
    if (menuheight > menuheightmax) menuheight = menuheightmax;
    if (menuheight <= menuheightmin) menuheight = menuheightmin;
    menu.style.height = menuheight + "px";
    menu.style.visibility = 'visible';

    if (centre && flashWindowDependency) {
        centre.style.height = menuheightinit + 'px';
        // AN 02042008 : gérer les padding top/bottom sur style du centre.
        var centreOH1 = centre.offsetHeight;
        if (centreOH1 != menuheightinit)
            centre.style.height = (menuheightinit - (centreOH1 - menuheightinit)) + 'px';
        centre.style.width = "100%";
    }
}

function PageWidth() {
    pagewidth = document.getElementById("centre").offsetWidth + document.getElementById("menu").offsetWidth;
    if (pagewidth < 1000) pagewidth = 1000;
    document.getElementById("page").style.width = pagewidth + "px";
}


function MM_swapImgRestore() { //v3.0
    var i, x, a = document.MM_sr; for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;
}

function MM_preloadImages() { //v3.0
    var d = document; if (d.images) {
        if (!d.MM_p) d.MM_p = new Array();
        var i, j = d.MM_p.length, a = MM_preloadImages.arguments; for (i = 0; i < a.length; i++)
            if (a[i].indexOf("#") != 0) { d.MM_p[j] = new Image; d.MM_p[j++].src = a[i]; } 
    }
}

function MM_findObj1(n, d) { //v4.01
    var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
        d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
    }
    if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
    for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj1(n, d.layers[i].document);
    if (!x && d.getElementById) x = d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
    var i, j = 0, x, a = MM_swapImage.arguments; document.MM_sr = new Array; for (i = 0; i < (a.length - 2); i += 3)
        if ((x = MM_findObj1(a[i])) != null) { document.MM_sr[j++] = x; if (!x.oSrc) x.oSrc = x.src; x.src = a[i + 2]; }
}
var strcmd_nav_DoFSCommand = ''
function nav_DoFSCommand(command, args) {
    var strcmd = command + '(' + args + ')';
    if (strcmd_nav_DoFSCommand != strcmd) {
        //alert ('juste....'+strcmd);
        strcmd_nav_DoFSCommand = strcmd
        eval(strcmd)
    }
} 
