﻿
// S'execute quand le DOM est pret
$(document).ready(function() {

    // hover sur les menus du haut
    $('a.Bouton').mouseenter(function() {
        $(this).addClass('hover');
    }).mouseleave(function() {
        $(this).removeClass('hover');
    }).click(function() {
        //document.location = this.href;
        //alert($(this));
        //$(this).click(); // changemenet d'url au click (bug IE)
        window.location = $(this).attr('href');
        return false;
    });

    // hover sur les menus de gauche
    $('li.MenuItem').not('.selected').mouseenter(function() { $(this).addClass('hover'); }).mouseleave(function() { $(this).removeClass('hover'); });

    //fadeOut();
});

//////////////////////////////////
// Effets visuels

function fadeIn() {
    $('.blink').each(function() {
        $(this).fadeTo(600, 1);
        setTimeout('fadeOut();', 625);
    });
}

function fadeOut() {
    $('.blink').each(function() {
        $(this).fadeTo(600, 0);
        setTimeout('fadeIn();', 625);
    });
}

//////////////////////////////////
// Gestion des popup

function Apercu(url, dimx, dimy) {
    var nom = "Zoom";
    if (dimx == undefined) { dimx = 800; }
    if (dimy == undefined) { dimy = 557; }
    var xEcran = 1024;
    var yEcran = 768;
    if (top.screen) {
        if (screen.width && screen.height) {
            xEcran = screen.width;
            yEcran = screen.height;
        };
    }
    if (dimx > xEcran) { dimx = xEcran; }
    if (dimy > yEcran) { dimy = yEcran; }
    xPos =  Math.floor((xEcran - dimx - 10) / 2);
    yPos = Math.floor((yEcran - dimy) / 2);
    featur = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,screenX=" + xPos + ",left=" + xPos + ",screenY=" + yPos + ",top=" + yPos + ",width=" + dimx + ",height=" + dimy + "";
    window.open(url, nom, featur);
}

function PopupCentree(cPage, nLargeur, nHauteur, cOptions) {
    var nTop = (screen.height - nHauteur) / 2;
    var nLeft = (screen.width - nLargeur) / 2;
    window.open(cPage, "", "top=" + nTop + ",left=" + nLeft + ",width=" + nLargeur + ",height=" + nHauteur + "," + cOptions);
    return false;
}

function PopupCentree_Simple(cPage, nLargeur, nHauteur) {
    return PopupCentree(cPage, nLargeur, nHauteur, 'menubar=no,scrollbars=yes,statusbar=no');
}

function Popup(cPage, cPageName) {
    window.open(cPage, cPageName);
    return false;
}
