// Nav menu effect
$(document).ready(function(){  
    $("#menu li.topnav").hover(function() {  

        //Following events are applied to the subnav itself (moving subnav up and down)  
        $(this).find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click  

        $(this).hover(function() {  
        }, function(){  
            $(this).find("ul").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up  
        });  

        //Following events are applied to the trigger (Hover events for the trigger)  
        }).hover(function() {  
            $(this).find("a.level1").addClass("hover"); //On hover over, add class "subhover"  
        }, function(){  //On Hover Out  
            $(this).find("a.level1").removeClass("hover"); //On hover out, remove class "subhover"  
    });  

	// champs avec texte qui disparait onclick
	$("input.blur").focus(function(){
		if ($(this).hasClass('blur')) {$(this).val('');}
		$(this).removeClass('blur');
	});
	
	// preload css images
	//$.preloadCssImages();
});

// Helpers
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}
 
function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}
 
var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		menu_club_fr_over = newImage("images/menu_club_fr-over.gif");
		menu_histoire_fr_over = newImage("images/menu_histoire_fr-over.gif");
		menu_lien_fr_over = newImage("images/menu_lien_fr-over.gif");
		menu_contact_fr_over = newImage("images/menu_contact_fr-over.gif");
		menu_inscrire_fr_over = newImage("images/menu_inscrire_fr-over.gif");
		menu_emplois_fr_over = newImage("images/menu_emplois_fr-over.gif");
		preloadFlag = true;
	}
}
