$(document).ready(function() {
	//make sure that the language dropdown is selected correctly
	//var ContentLanguageID = $("#ContentLanguageID").val();
	
	var ContentLanguageID = 1033;
	//quick fix to get the current language type
	if($("#global ul li").length == 3){
		ContentLanguageID = 3084;
	}
	
	$("#ctl00_ddlistLanguage option").each(function(){
	
		if($(this).val() != ContentLanguageID){
			$(this).attr("selected", "");
		}
		else{
			$(this).attr("selected", "selected");
		}
	});

    //fix pngs for ie6
    $("#footershadow").supersleight();
    
    
    //position GrayOnState
    var Menulnk = $(".bottomnav ul li.on");
    
    var SearchUrl = "/Search/";
    
    if(ContentLanguageID != 1033){
     SearchUrl = "/Resultats-de-la-recherche/";
    }
    
    if(Menulnk.length > 0){
   
       var tempwidth = Menulnk.width();
    	Menulnk.append("<div id='GrayOnState'></div>");
    	$("#GrayOnState").width(tempwidth);
    	//$("#mainnav").css("padding-bottom", "0");
    	$("#innerContent").css("padding-bottom", "0");
    }
    
    $("#Product_txtbox").keyup(function(e){
    	if(e.keyCode == 13){
    		window.location.href = SearchUrl + "?q=" + $("#Product_txtbox").val();
    	}
    });
    
    $("#GoBtn, #GoBtn_fr").click(function(){
    	if($("#Product_txtbox").val() != "Search" && $("#Product_txtbox").val() != "Recherche"){
	    	window.location.href = SearchUrl + "?q=" + $("#Product_txtbox").val();
    	}
    });
    
    
    //IE6 hover stats
    if(navigator.appVersion.indexOf("MSIE 6") > 0){
    	$(".bottomnav ul li, #secondaryNavContainer ul li").hover(
    		function(){
    			
    			$(this).addClass("hover");
    		},
    		function(){
			$(this).removeClass("hover");
    		}
    	);
    	
    	
    }
    
    //hide / show french or english content, used for images
    
    if(ContentLanguageID == 1033){
    	$("#GoBtn").show();
    	$(".en").removeClass("en");
    }
    else{  //french
    	$("#GoBtn_fr").show();
    	$(".fr").removeClass("fr");
    }
});