

	//最好的商品的js
	var currentBestGoodsNo = 0;
	var bestGoodsNum = 3;
	var runBestGoodsInterval = 5000;
	var bestGoodsRunFlag = setInterval('autoRunBestGoods()', runBestGoodsInterval);
	function autoRunBestGoods()
	{
		currentBestGoodsNo++;
		if( currentBestGoodsNo == bestGoodsNum ) currentBestGoodsNo = 0;
		$('.hotgoodsul').hide().eq(currentBestGoodsNo).show();
		$('#shuzi_hot>a').removeClass('hover').eq(currentBestGoodsNo).addClass('hover');
	}
	function startAutoRunBestGoods(){
		clearInterval(bestGoodsRunFlag);
		bestGoodsRunFlag = setInterval('autoRunBestGoods()', runBestGoodsInterval);
	}
	function stopAutoRunBestGoods(){
		clearInterval(bestGoodsRunFlag);
	}
	
	//最新的商品的js
	var currentNewGoodsNo = 0;
	var newGoodsNum = 3;
	var runNewGoodsInterval = 5000;
	var newGoodsRunFlag = setInterval('autoRunNewGoods()', runNewGoodsInterval);
	function autoRunNewGoods()
	{
		currentNewGoodsNo++;
		if( currentNewGoodsNo == newGoodsNum ) currentNewGoodsNo = 0;
		$('.newgoodsul').hide().eq(currentNewGoodsNo).show();
		$('#shuzi_new>a').removeClass('hover').eq(currentNewGoodsNo).addClass('hover');
	}
	function startAutoRunNewGoods(){
		clearInterval(newGoodsRunFlag);
		newGoodsRunFlag = setInterval('autoRunNewGoods()', runNewGoodsInterval);
	}
	function stopAutoRunNewGoods(){
		clearInterval(newGoodsRunFlag);
	}
	
	//品牌商品的js
	var currentBrandNo = 0;
	var BrandNum = 6;
	var runBrandInterval = 5000;
	var brandRunFlag = setInterval('autoRunBrand()', runBrandInterval);
	function autoRunBrand()
	{
		currentBrandNo++;
		if( currentBrandNo == BrandNum ) currentBrandNo = 0;
		$('.brandarea-logo>span').removeClass('visited').eq(currentBrandNo).addClass('visited');
		$('.brandarea-more>div').hide().eq(currentBrandNo).show();
		$('.brandarea-pic>a').hide().eq(currentBrandNo).show();
	}
	function startAutoRunBrand(){
		clearInterval(brandRunFlag);
		brandRunFlag = setInterval('autoRunBrand()', runBrandInterval);
	}
	function stopAutoRunBrand(){
		clearInterval(brandRunFlag);
	}
	
$(document).ready(function(){
	setTimeout(function(){
		$("#haMarks").hide("fast");
		$("#haControl>img").attr("src","http://s.happimg.com/images/btn/btn_happimarks1.gif");
		$("#haControl>img").attr("title","展开");
	}, 30000);
		
	var visited_time; //菜单选择的时候使用
	
	//最好的商品右侧的js
	$('.newstp>p').each(function(i){
		$(this).mouseover(function(){
			$('.newstp>p').find('a:even').removeClass("visited");
			$('.newstp>p').find('a:odd').hide();
			$(this).find('a:odd').show();
			$(this).find('a:even').addClass("visited");
		});
	});
	//最好的商品的js
	$('#shuzi_hot>a').each(function(i){
		$(this).mouseover(function(){
			$('#shuzi_hot>a').removeClass('hover').eq(i).addClass('hover');
			$('.hotgoodsul').hide().eq(i).show();
			stopAutoRunBestGoods();
		}).mouseout(startAutoRunBestGoods);
	});
	//最新的商品的js
	$('#shuzi_new>a').each(function(i){
		$(this).mouseover(function(){
			$('#shuzi_new>a').removeClass('hover').eq(i).addClass('hover');
			$('.newgoodsul').hide().eq(i).show();
			stopAutoRunNewGoods();
		}).mouseout(startAutoRunNewGoods);
	});
	

	

	//大眼睛部分代码
	var defaultOpts = { interval: 5000, fadeInTime: 300, fadeOutTime: 200 };
    //Iterate over the current set of matched elements
	var _titles = $("ul.slide-txt li");
	var _titles_bg = $("ul.op li");
	var _bodies = $("ul.slide-pic li");
	var _count = _titles.length;
	var _current = 0;
	var _intervalID = null;
	var stop = function() { window.clearInterval(_intervalID); };
	var slide = function(opts) {
		if (opts) {
			_current = opts.current || 0;
		} else {
			_current = (_current >= (_count - 1)) ? 0 : (++_current);
		};
		_bodies.filter(":visible").fadeOut(defaultOpts.fadeOutTime, function() {
			_bodies.eq(_current).fadeIn(defaultOpts.fadeInTime);
			_bodies.removeClass("cur").eq(_current).addClass("cur");
		});
		_titles.removeClass("cur").eq(_current).addClass("cur");
		_titles_bg.removeClass("cur").eq(_current).addClass("cur");
	}; //endof slide
	var go = function() {
		stop();
		_intervalID = window.setInterval(function() { slide(); }, defaultOpts.interval);
	}; //endof go
	var itemMouseOver = function(target, items) {
		stop();
		var i = $.inArray(target, items);
		slide({ current: i });
	}; //endof itemMouseOver
	_titles.hover(function() { if($(this).attr('class')!='cur'){itemMouseOver(this, _titles); }else{stop();}}, go);
	//_titles_bg.hover(function() { itemMouseOver(this, _titles_bg); }, go);
	_bodies.hover(stop, go);
	//trigger the slidebox
	go();
}); 
