/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


var obj = null;

function checkHover() {
	if (obj) {
		//obj.find('ul').fadeOut('fast');
	} //if
} //checkHover

$(document).ready(function() {

/**
 * Positionnement et largeur des menus déroulants
 * A T T E N T I O N   La longueur des menus dans la barre
 * dépend des intitulés des rubriques, il faut changer les leftOffset
 * à chaque modification des intitulés dans la base
 *
 */
if(navigator.userAgent.indexOf("MSIE 6") != -1){
	if($("#menu1"))$('a#menu1').cluetip({local:true, cursor: 'pointer', mouseOutClose: true, positionBy:'fixed', width:"auto" , leftOffset:"-90px", stiky:true, topOffset:"32px"});
	if($("#menu2"))$('a#menu2').cluetip({local:true, cursor: 'pointer', mouseOutClose: true, positionBy:'fixed', width:"auto" , leftOffset:"-92px", stiky:true, topOffset:"32px"});
	if($("#menu3"))$('a#menu3').cluetip({local:true, cursor: 'pointer', mouseOutClose: true, positionBy:'fixed', width:"500" , leftOffset:"-91px", stiky:true, topOffset:"32px"});
	if($("#menu4"))$('a#menu4').cluetip({local:true, cursor: 'pointer', mouseOutClose: true, positionBy:'fixed', width:"500" , leftOffset:"-91px", stiky:true, topOffset:"32px"});
	if($("#menu5"))$('a#menu5').cluetip({local:true, cursor: 'pointer', mouseOutClose: true, positionBy:'fixed', width:"120" , leftOffset:"-90px", stiky:true, topOffset:"32px"});
	if($("#menu6"))$('a#menu6').cluetip({local:true, cursor: 'pointer', mouseOutClose: true, positionBy:'fixed', width:"120" , leftOffset:"-81px", stiky:true, topOffset:"29px"});
	if($("#menu7"))$('a#menu7').cluetip({local:true, cursor: 'pointer', mouseOutClose: true, positionBy:'fixed', width:"120" , leftOffset:"-66px", stiky:true, topOffset:"29px"});
	if($("#menu8"))$('a#menu8').cluetip({local:true, cursor: 'pointer', mouseOutClose: true, positionBy:'fixed', width:"120" , leftOffset:"-74px", stiky:true, topOffset:"29px"});
	}else {
	if($("#menu1"))$('a#menu1').cluetip({local:true, cursor: 'pointer', mouseOutClose: true, positionBy:'fixed', width:"auto" , leftOffset:"-58px", stiky:true, topOffset:"29px"});
	if($("#menu2"))$('a#menu2').cluetip({local:true, cursor: 'pointer', mouseOutClose: true, positionBy:'fixed', width:"auto" , leftOffset:"-74px", stiky:true, topOffset:"29px"});
	if($("#menu3"))$('a#menu3').cluetip({local:true, cursor: 'pointer', mouseOutClose: true, positionBy:'fixed', width:"500" , leftOffset:"-76px", stiky:true, topOffset:"29px"});
	if($("#menu4"))$('a#menu4').cluetip({local:true, cursor: 'pointer', mouseOutClose: true, positionBy:'fixed', width:"500" , leftOffset:"-88px", stiky:true, topOffset:"29px"});
	if($("#menu5"))$('a#menu5').cluetip({local:true, cursor: 'pointer', mouseOutClose: true, positionBy:'fixed', width:"120" , leftOffset:"-50px", stiky:true, topOffset:"29px"});
	if($("#menu6"))$('a#menu6').cluetip({local:true, cursor: 'pointer', mouseOutClose: true, positionBy:'fixed', width:"120" , leftOffset:"-82px", stiky:true, topOffset:"29px"});
	if($("#menu7"))$('a#menu7').cluetip({local:true, cursor: 'pointer', mouseOutClose: true, positionBy:'fixed', width:"120" , leftOffset:"-66px", stiky:true, topOffset:"29px"});
        if($("#menu8"))$('a#menu8').cluetip({local:true, cursor: 'pointer', mouseOutClose: true, positionBy:'fixed', width:"120" , leftOffset:"-74px", stiky:true, topOffset:"29px"});}

/**
 *======================
 * MENU GAUCHE
 * =====================
 */
/**
 * Tous les menus sont désélectionnés par défaut
 * Le menu de la page, sera initialisé dans menuInit()
 * voir header_file.tpl et menu.tpl
 */
$('#Nav > li').data("menu_selected","off");

/**
 * Modification du dernier menu
 */
if ($("#Nav > li:last-child"))
    $("#Nav > li:last-child").css({border:"0"});


/**
 * Fonctions pour les menus déroulants
 */
if ($('#Nav > li'))
{
	$('#Nav > li').hover(function() {
		if (obj)
        {
            $(this).addClass("menu_on");
    		obj = null;
		}
        }, function() {
		obj = $(this);
		setTimeout(
			"checkHover()",
			0); // si vous souhaitez retarder la disparition, c'est ici
            menu_encours = ($(this).data("menu_selected")=="on");
            if (!menu_encours)
                $(this).removeClass("menu_on");

     });
}

/**
 *======================
 * MENU DROITE
 * =====================
 */

/**
 * Tous les menus sont désélectionnés par défaut
 * Le menu de la page, sera initialisé dans menuInit()
 * voir header_file.tpl et menu.tpl
 */

$('#Nav2 > li').data("menu_selected","off");

/**
 * Modification du dernier menu
 */
if ($("#Nav2 > li:last-child"))
	$("#Nav2 > li:last-child").css({border:"0"});

/**
 * Fonctions pour les menus déroulants
 */
if ($('#Nav2 > li'))
{
    $('#Nav2 > li').hover(function() {
        if (obj) {
            $(this).addClass("menu_on");
			obj = null;
		}
        }, function() {
		obj = $(this);
		setTimeout(
			"checkHover()",
			0); // si vous souhaitez retarder la disparition, c'est ici
        menu_encours = ($(this).data("menu_selected")=="on");
        if (!menu_encours)
            $(this).removeClass("menu_on");
	});
}

});

