


$(document).ready(function() {
	var href = document.location.pathname;
	if (href === '/' || href == '/en/')
	{
		href = 'index.php';
	}
	if (href.indexOf('message') !== -1)
	{
		return;
	}
	var ismenu = false,
		nav = $("#nav-menu a"),
		$this;
	nav.each(function(v, o) {
		$this = $(this);
		if (href.indexOf($this.attr("href")) !== -1)
		{
			$this.addClass("hover");
			ismenu = true;
			return false;
		}
	});

	if (!ismenu)
	{
		nav.eq(0).addClass("hover");
	}
	
	var $li = $("#category_menu ul li");
	var index = 0;

	if (window.location.search.length < 3)
	{
		
		$li.eq(index).addClass("current");
	}
	
	$li.each(function() {
		if ($("a", this).attr("href").indexOf(window.location.search) != -1)
		{
			$(this).addClass("current");
			index = ($(this).parent("ul").find("li").index($(this)));
			return false;
		}
	});

	$("#category_menu ul li").hover(function(){
		$(this).addClass("current");
	}, function(){
		if (($(this).parent("ul").find("li").index($(this))) === index)
		{
			return;
		}
		$(this).removeClass("current");
	});

	function pro_show() {
		
		var index = 0,
			$li = $("#product_show li")
		;

		$li
			.mouseover(function(){
				$li.removeClass("current");
				$(this).addClass("current");
			});
		
		function d() {

			if(index == 2) {
				index = -1;
			}

			$li
				.removeClass("current")
				.eq(++index)
				.addClass("current");
		}

		setInterval(d, 3000);
	}
	
	if ($("#product_show").length > 0)
	{
		pro_show();
	}
	
});




