/***** ad *****/
$(function(){
	 var len  = $(".ad .num li").length;
	 var index = 0;
	 var adTimer;
	 $(".ad .num li").mouseover(function(){
		index  =   $(".ad .num li").index(this);
		showImg(index);
	 }).eq(0).mouseover();	
	
	 $('.ad').hover(function(){
			 clearInterval(adTimer);
		 },function(){
			 adTimer = setInterval(function(){
				showImg(index)
				index++;
				if(index==len){index=0;}
			  } , 3000);
	 }).trigger("mouseleave");
})

function showImg(index){
		var adHeight = $(".ad").height();
		$(".ad .slider").stop(true,false).animate({top : -adHeight*index},800);
		$(".ad .num li").removeClass("on").eq(index).addClass("on");
}

/***** nav *****/
$(function(){
	$(".nav ul li:has(ul)").hover(function(){
		$(this).children("ul").stop(true,true).slideDown(400);
		$(this).children("a").addClass("on");
	},function(){
		$(this).children("ul").stop(true,true).slideUp("fast");
		$(".nav ul li").children("a").removeClass("on");
	});
})

//*******Nav url setting*******//
var ruyou =  location.href.substr(0, location.href.lastIndexOf('/')) ;
$(function(){
	if(ruyou){
		ruyou = ruyou.substr(ruyou.lastIndexOf('/')+1);
		$(".nav ul ul li a").each(function(){
			var csname = $(this).attr("title");
			if(ruyou=='10.2.43.174:8951'){
				$(".nav ul li:first a.nav_1st_level").addClass('active');
			}else if(csname == ruyou){
				$(".nav ul li:first a.nav_1st_level").removeClass('active');
				$(this).parent().parent().parent().children("a.nav_1st_level").addClass('active');
			}
		});
	}
});



