$(document).ready(function(){

$("#menu0").hoverIntent(function (){$("#menu_a0").addClass("indexhover")},function(){$("#menu_a0").removeClass("indexhover")});
$("#menu1").hoverIntent(function (){$("#menu_a1").addClass("current1");$("#sub_menu1").slideDown(200);},function(){if(!$("#menu_a1").hasClass("current")){$("#menu_a1").removeClass("current1")}$("#sub_menu1").hide(0);});
$("#menu2").hoverIntent(function (){$("#menu_a2").addClass("current1");$("#sub_menu2").slideDown(200);},function(){if(!$("#menu_a2").hasClass("current")){$("#menu_a2").removeClass("current1")}$("#sub_menu2").hide(0);});
$("#menu3").hoverIntent(function (){$("#menu_a3").addClass("current1");$("#sub_menu3").slideDown(200);},function(){if(!$("#menu_a3").hasClass("current")){$("#menu_a3").removeClass("current1")}$("#sub_menu3").hide(0);});
$("#menu4").hoverIntent(function (){$("#menu_a4").addClass("current1");$("#sub_menu4").slideDown(200);},function(){if(!$("#menu_a4").hasClass("current")){$("#menu_a4").removeClass("current1")}$("#sub_menu4").hide(0);});
$("#menu5").hoverIntent(function (){$("#menu_a5").addClass("current1");$("#sub_menu5").slideDown(200);},function(){if(!$("#menu_a5").hasClass("current")){$("#menu_a5").removeClass("current1")}$("#sub_menu5").hide(0);});
$("#menu6").hoverIntent(function (){$("#menu_a6").addClass("current1");$("#sub_menu6").slideDown(200);},function(){if(!$("#menu_a6").hasClass("current")){$("#menu_a6").removeClass("current1")}$("#sub_menu6").hide(0);});
$("#menu7").hoverIntent(function (){$("#menu_a7").addClass("current1");$("#sub_menu7").slideDown(200);},function(){if(!$("#menu_a7").hasClass("current")){$("#menu_a7").removeClass("current1")}$("#sub_menu7").hide(0);});
$("#menu8").hoverIntent(function (){$("#menu_a8").addClass("current1");$("#sub_menu8").slideDown(200);},function(){if(!$("#menu_a8").hasClass("current")){$("#menu_a8").removeClass("current1")}$("#sub_menu8").hide(0);});
	

});

(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);

$(document).ready(function(){				
	$(".nav_a").hover(function(){resetNavbtn("#c1");$(".nav_a").css({"background-position": "0px -120px", "color": "#334562" })});
	$(".nav_b").hover(function(){resetNavbtn("#c2");$(".nav_b").css({"background-position": "162px -120px", "color": "#334562" })});
	$(".nav_c").hover(function(){resetNavbtn("#c3");$(".nav_c").css({"background-position": "162px -120px", "color": "#334562" })});
	$(".pt_a").hover(function(){resetLogin("#w1");$("#w1").css({"visibility": "visible"});$(".pt_a").css({"background-position": "0px 0", "font-weight": "bold" })});
	$(".pt_b").hover(function(){resetLogin("#w2");$("#w1").css({"visibility": "hidden"});;$(".pt_b").css({"background-position": "-125px -31px", "font-weight": "bold" })});
});

function resetNavbtn(str)
{
	$(".nav_a").css({"background-position": "0px -85px", "color": "#5f6e85" });
	$(".nav_b").css({"background-position": "162px -85px", "color": "#5f6e85" });
	$(".nav_c").css({"background-position": "162px -85px", "color": "#5f6e85" });
	$("#c1,#c2,#c3,#c4").hide();
	$(str).show();
}
function resetLogin(str)
{
	$(".pt_a").css({"background-position": "0px -31px","font-weight": "normal"});
	$(".pt_b").css({"background-position": "-125px 0px","font-weight": "normal"});
	$("#w1,#w2").hide();
	$(str).show();
}
