/*
 * Fonction permettant de changer les images du menu
 */
    ( function($) {
        $(document).ready(function(){
            $(function() {
				var current_index = 0;
				$("#menu1 a").each(function(index){ 
					if($("#menu1 a#menu_item_"+index).hasClass('current')){
						current_index = index;
					}
					set_menu(current_index);
					$(this).mouseover(function(){  
						set_menu(index);	
					})
					$(this).mouseout(function(){
						//alert('out_'+current_index);	
						set_menu(current_index);
					})
				});

            });
        });
    } ) ( jQuery )

 
function set_menu(index){
    ( function($) {
		var height = -2;
		if(index == 0 )
			height = -2;
		else if(index == "1")
			height = -49;
		else if(index == "2")
			height = -95;
		else if(index == "3")
			height = -143;
		else if(index == "4")
			height = -193;
		else if(index == "5")
			height = -193;
		else if(index == "6")
			height = -193;
		else if(index == "7")
			height = -193;
		else if(index == "8")
			height = -193;
		else if(index == "9")
			height = -193;
		else if(index == "10")
			height = -193;
		else if(index == "11")
			height = -193;
		else if(index == "12")
			height = -240;
		else height = -2;
		$(".main_menu_wide").css({backgroundPosition: "left "+height+"px"});
    } ) ( jQuery )
}

function updateTextField(element, text, type) {
	var nothing = '';
	var elt = jQuery("#"+element);
	if(elt.val() == text)
		elt.val(nothing);
	else if(elt.val() == nothing && type == 'blur')
		elt.val(text);
	return false;
}
