// SubNavigation
$(function() {
	$(".navi li").hover(function(){
		$(this).find('ul:first').css({visibility: "visible",display: "block"});
	},function(){
		$(this).find('ul:first').css({visibility: "hidden"});
	});
	if($(".navi li ul li:has(ul)").length > 0)         
	{   
		$(".navi li ul li ul").parent().addClass("arrow");
	}   
});
//Homepage Tabs
$(function(){
    var $title = $(".slt h2 span");
    var $content = $(".slt ul");
    $title.mousemove(function(){
        var index = $title.index($(this));
		$(this).addClass("mov").siblings().removeClass("mov");
        $content.hide();
        $($content.get(index)).show();
        return false;
    });
});
$(function(){
    var $title = $(".smid h2 span");
    var $content = $(".smid ul");
    $title.mousemove(function(){
        var index = $title.index($(this));
		$(this).addClass("mov").siblings().removeClass("mov");
        $content.hide();
        $($content.get(index)).show();
        return false;
    });
});
// Menu First li nb
$(function() {
	$(".navi li:first").addClass("nl");
	$(".footpage li a:first").addClass("nb");
});
// Slideshow
$(function(){
	var index = 0;
	$("#operate span:first").addClass("hov");
	$("#operate span").mouseover(function(){
	  index  =  $("#operate span").index(this);
	  showImg(index);
	});	
	
	$('#slideshow').hover(function(){
			if(MyTime){
			   clearInterval(MyTime);
			}
	},function(){
			MyTime = setInterval(function(){
			  showImg(index)
			  index++;
			  if(index==5){index=0;}
			} , 6000);
	});
	
	var MyTime = setInterval(function(){
	  showImg(index)
	  index++;
	  if(index==5){index=0;}
	} , 6000);
})
function showImg(i){
	$("#showimg img")
	  .eq(i).stop(true,true).fadeIn(1000)
	  .parent().siblings().find("img").hide();
	$("#msg li")
	  .eq(i).stop(true,true).fadeIn(1000)
	  .siblings().hide();
	$("#operate span")
	  .eq(i).addClass("hov")
	  .siblings().removeClass("hov");
}
