$(document).ready(function(){
	$("#menu .li_effect").hover(
	    function(){
		 index=$("#menu .li_effect").index($(this));
		 $("#menu .panel").eq(index).show();
		 $("#menu .li_effect > a").eq(index).addClass("li_hover");
		},
		function(){
	      $("#menu .li_effect > a").eq(index).removeClass("li_hover");
		  $("#menu .panel").eq(index).hide();
			}
		)
		
	
	$("#menu .panel table td").hover(
	    function(){
			index_o=$("#menu .panel table td").index($(this));
			$(this).css("background","#4b5b78");
			$("#menu .panel table td a").eq(index_o).css("background","#4b5b78");
			},
		function(){
			$(this).css("background","#afadae");
			$("#menu .panel table td a").eq(index_o).css("background","#afadae");
			}
	);
	
	

	$("select#changelang").change(function () {
		var currentLang = $("select#changelang option.current").val();
		var toLang = $("select#changelang option:selected").val();
		if(currentLang != toLang){switchLang(currentLang, toLang);}
	});
	 
});

function switchLang(from,to) {
	var currentStr = window.location.href;
	if(currentStr.indexOf("module/warrantyAction.do?method=regWarranty")!=-1){
		currentStr = currentStr.replace("module/warrantyAction.do?method=regWarranty", "support/warrantyregistration.html");
	}
	currentStr = currentStr.replace("/" + from + "/", "/" + to + "/");
	currentStr = currentStr.replace("lang=" + from, "lang=" + to);
	window.location.href = currentStr;
}

