/* -------------------------
Scripts de la page d'accueil
( index.html )
------------------------- */

/* ---------------------------------------------------
vPasNom_Objet    =    Pas de déplacement des objets
vPosNom_Objet    =    Position des objets
vNbPas           =    Nombre de déplacements effectués
--------------------------------------------------- */
var vPasGauche, vPasCercle, vPasDroite, vPasAsmb
var vPosGauche, vPosCercle, vPosDroite, vPosAsmb
var vNbPas = 0

var vLargeurMess = 504
var vLargeurNets = 270
var vDefileTo
var vDefileFrom

/* -------------------------------
Le logo est animé en 45 mouvements
Le losange doit arriver à left = 10
Le cercle doit arriver à top = 26
Le carré doit arriver à left = 138
ASMB doit arrivé à top = 57
------------------------------- */
function poseLogo() {
    // 125 = (3*45) - 10
    // -----------------
    ch = vDeb + "gauche" + vStyl1 + vLeft + "-125" + vFin;
    eval(ch);
    vPosGauche = -125;
    vPasGauche = 3;

    // 100 = (2.8 * 45) - 26
    // ---------------------
    ch = vDeb + "cercle" + vStyl1 + vTop + "-100" + vFin;
    eval(ch);
    vPosCercle = -100;
    vPasCercle = 2.8;

    // On pose le carré contre le bord droit de la fenêtre
    // ---------------------------------------------------
    vPosDroite = vLargeur - 77
    ch = vDeb + "droite" + vStyl1 + vLeft + vPosDroite + vFin;
    eval(ch);
    vPasDroite = (vPosDroite-138) / 45

    // On pose ASMB tout en bas de la fenêtre
    // --------------------------------------
    vPosAsmb = vHauteur - 37
    ch = vDeb + "asmb" + vStyl1 + vTop + vPosAsmb + vFin;
    eval(ch);
    vPasAsmb = (vPosAsmb-57) / 45

    // On rend les objets visibles
    // ---------------------------
    ch = vDeb + "droite" + vStyl1 + vVis + vVisible + vFin;
    eval(ch);
    ch = vDeb + "gauche" + vStyl1 + vVis + vVisible + vFin;
    eval(ch);
    ch = vDeb + "cercle" + vStyl1 + vVis + vVisible + vFin;
    eval(ch);
    ch = vDeb + "asmb" + vStyl1 + vVis + vVisible + vFin;
    eval(ch);

    // On lance l'animation
    // --------------------
    animeLogo()
}

/* ------------------------------------
Cette fonction gère l'animation du logo
en 45 mouvements
------------------------------------ */
function animeLogo() {
    vNbPas += 1

    vPosGauche += vPasGauche
    ch = vDeb +"gauche" + vStyl1 + vLeft + vPosGauche + vFin
    eval(ch)

    vPosCercle += vPasCercle
    ch = vDeb +"cercle" + vStyl1 + vTop + vPosCercle + vFin
    eval(ch)

    vPosDroite -= vPasDroite
    ch = vDeb +"droite" + vStyl1 + vLeft + vPosDroite + vFin
    eval(ch)

    vPosAsmb -= vPasAsmb
    ch = vDeb +"asmb" + vStyl1 + vTop + vPosAsmb + vFin
    eval(ch)

    // Une fois les 45 mouvements effectués, on affiche l'image
    // complète du logo et on efface les 4 morceaux
    if (vNbPas < 45) {
        setTimeout('animeLogo()', 10)
    } else {
        ch = vDeb + "ilogo" + vStyl1 + vVis + vVisible + vFin
        eval(ch)

        ch = vDeb + "gauche" + vStyl1 + vVis + vCache + vFin
        eval(ch)
        ch = vDeb + "droite" + vStyl1 + vVis + vCache + vFin
        eval(ch)
        ch = vDeb + "cercle" + vStyl1 + vVis + vCache + vFin
        eval(ch)
        ch = vDeb + "asmb" + vStyl1 + vVis + vCache + vFin
        eval(ch)

        placeTitre()
    }
}

function placeTitre() {
    vLObj=400; vLargeUtile=vLargeur-215;
    
    if (vLargeur>750 & vLargeur<=1000) { vLObj=480 }
    if (vLargeur>1000) {vLObj=580}
    vGauche=(vLargeUtile-vLObj)/2; vGauche=vGauche+215

    ch = vDeb + "text1a" + vStyl1 + vLeft + vGauche + vFin;
    eval(ch);
    ch = vDeb + "text1b" + vStyl1 + vLeft + (vGauche-2) + vFin;
    eval(ch);

    vLText2=vGauche+150
    vLVirg=vGauche+24

    if ((vLargeur>750) & (vLargeur<1000)) {
        vLText2=vGauche+220
        vLVirg=vGauche+100
    }

    if (vLargeur>1000) {
        vLText2=vGauche+250
        vLVirg=vGauche+150
    }
    ch = vDeb + "text2a" + vStyl1 + vLeft + vLText2 + vFin;
    eval(ch);
    ch = vDeb + "text2b" + vStyl1 + vLeft + (vLText2-2) + vFin;
    eval(ch);
    ch = vDeb + "virgule" + vStyl1 + vLeft + vLVirg + vFin;
    eval(ch);
    ch = vDeb + "text1a" + vStyl1 + vTop + "39" + vFin;
    eval(ch);
    ch = vDeb + "text1b" + vStyl1 + vTop + "37" + vFin;
    eval(ch);
    ch = vDeb + "text2a" + vStyl1 + vTop + "64" + vFin;
    eval(ch);
    ch = vDeb + "text2b" + vStyl1 + vTop + "62" + vFin;
    eval(ch);
    ch = vDeb + "virgule" + vStyl1 + vTop + "35" + vFin;
    eval(ch);
    ch = vDeb + "text1a" + vStyl1 + vVis + vVisible + vFin;
    eval(ch);
    ch = vDeb + "text1b" + vStyl1 + vVis + vVisible + vFin;
    eval(ch);
    ch = vDeb + "text2a" + vStyl1 + vVis + vVisible + vFin;
    eval(ch);
    ch = vDeb + "text2b" + vStyl1 + vVis + vVisible + vFin;
    eval(ch);
    ch = vDeb + "virgule" + vStyl1 + vVis + vVisible + vFin;
    eval(ch);

    ch = vDeb + "menu" + vStyl1 + vVis + vVisible + vFin;
    eval(ch);
    if (vNavi=="ie4") {
        vDefileFrom=vLargeur-50
        vDefileTo = 265 - 504 
        ch = vDeb + "planqueMess2" + vStyl1 + vLeft + vDefileFrom + vFin;
        eval(ch);
        ch = vDeb + "planqueMess2" + vStyl1 + vVis + vVisible + vFin;
        eval(ch);
        ch = vDeb + "planqueMess1" + vStyl1 + vVis + vVisible + vFin;
        eval(ch);
        ch = vDeb + "messDefile" + vStyl1 + vLeft + vDefileFrom + vFin;
        eval(ch);
        ch = vDeb + "messDefile" + vStyl1 + vVis + vVisible + vFin;
        eval(ch);
        defileMess(vDefileFrom, vDefileTo)
    } else {
        vPosNetscape = ((vLargeUtile-vLargeurNets)/2)+215
        ch = vDeb + "messNetscape" + vStyl1 + vLeft + vPosNetscape + vFin;
        eval(ch);
        ch = vDeb + "messNetscape" + vStyl1 + vVis + vVisible + vFin;
        eval(ch);
    }

    affichePub()
}

function defileMess(from, to) {
    from -= 4
    ch = vDeb +"messDefile" + vStyl1 + vLeft + from + vFin
    eval(ch)

    if (from >= to) {
        setTimeout('defileMess(' + from + ',' + to + ')', 10)
    } else {
        ch = vDeb + "messDefile" + vStyl1 + vVis + vCache + vFin
        eval(ch)
        ch = vDeb + "messDefile" + vStyl1 + vLeft + vDefileFrom + vFin
        eval(ch)
        ch = vDeb + "messDefile" + vStyl1 + vVis + vVisible + vFin
        eval(ch)
        defileMess(vDefileFrom, vDefileTo)
    }
}

function affichePub() {
    ch = vDeb + "menu" + vStyl1 + vVis + vVisible + vFin;
    eval(ch);
    vTopP1=(vHauteur-290)/2
    vTopP1=vTopP1+127
    vTopP2=vTopP1+70
    ch = vDeb + "textpub" + vStyl1 + vTop + vTopP1 + vFin;
    eval(ch);
    ch = vDeb + "planquepub" + vStyl1 + vTop + vTopP1 + vFin;
    eval(ch);
    ch = vDeb + "textpub2" + vStyl1 + vTop + vTopP2 + vFin;
    eval(ch);


    vLeftP1=(vLargeur-392)/2
    vLeftP1=vLeftP1+90
    ch = vDeb + "planquepub" + vStyl1 + vLeft + vLeftP1 + vFin;
    eval(ch);
    vLeftP2=(vLargeur-392)/2
    vLeftP2=vLeftP2+90
    ch = vDeb + "textpub" + vStyl1 + vLeft + vLeftP2 + vFin;
    eval(ch);
    vLeftP3=(vLargeur-158)/2
    vLeftP3=vLeftP3+90
    ch = vDeb + "textpub2" + vStyl1 + vLeft + vLeftP3 + vFin;
    eval(ch);

    ch = vDeb + "planquepub" + vStyl1 + vVis + vVisible + vFin;
    eval(ch);

    ch = vDeb + "textpub" + vStyl1 + vVis + vVisible + vFin;
    eval(ch);
    ch = vDeb + "textpub2" + vStyl1 + vVis + vVisible + vFin;
    eval(ch);
    toto=vTopP1+170
    affichePub2(vTopP1,toto)
}
function affichePub2(leTop, to) {
    vLeftDroite = vLargeur - 50
    leTop += 5
    ch = vDeb + "planquepub" + vStyl1 + vTop + leTop + vFin;
    eval(ch);
    if (leTop>=to) {
        ch = vDeb + "planquepub" + vStyl1 + vVis + vCache + vFin;
        eval(ch);
        ch = vDeb + "planquepub" + vStyl1 + vTop + "-500" + vFin;
        eval(ch);
    } else {
        setTimeout('affichePub2(' + leTop + ', ' + to + ')', 50)
    }
}

