// SubNavigation
$(function() {
	$(".navi li").hover(function(){
		$(this).find('ul:first').css({visibility: "visible",display: "block"});
	},function(){
		$(this).find('ul:first').css({visibility: "hidden"});
	});
});
// HomeFeaturedSlider
$(function() {
	$('#featured').jcarousel();
});
// Menu First li nb
$(function() {
	$(".navi li:first").addClass("nl");
	$(".footpage li:first").addClass("nb");
});
//Products Tabs
$(function(){
    var $title = $(".tabs h3 span");
    var $content = $(".tabs .tabcontent");
    $title.mousemove(function(){
        var index = $title.index($(this));
		$(this).addClass("mhover").siblings().removeClass("mhover");
        $content.hide();
        $($content.get(index)).show();
        return false;
    });
});
// SearchForm
$(document).ready(function(){				   
	$('.searchInput').focus(
		function() {
			if($(this).val() == 'Keywords') {
				$(this).val('').css({color:"#333"});
			}
		}
	).blur(
		function(){
			if($(this).val() == '') {
				$(this).val('Keywords').css({color:"#777"});
			}
		}
	);
});
// 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");
}
