// JavaScript Document
// 商品分类代码
$(document).ready(function(){
//商品分类，品牌分类文字切换
$("ul.siderNavTop li").click(function(){
	  var tli = $("ul.siderNavTop li").index(this);
	  $(this).addClass("siderNavTopCurrent").siblings().removeClass("siderNavTopCurrent");
	  $("#category_"+tli).show().siblings().hide();
	}); 
//内容切换
$("div.gdsCategory").find(".siderNavLi").hover(
		   function(){$(this).attr("class","siderNavHover")},
		   function(){$(this).attr("class","siderNavLi")}
		   );
});
//全部商品
$(document).ready(function(){

	$("ul.indexSubNav").find(".allCategory").hover(
		   function(){$(this).attr("class","allCategory block")},
		   function(){$(this).attr("class","allCategory")}
		   );
});
//快速通道
$(document).ready(function(){

	$("div.fastTrack").find(".fastList").hover(
		   function(){$(this).attr("class","fastList fastListHover")},
		   function(){$(this).attr("class","fastList")}
		   );
});
//惊爆价遮罩
$(document).ready(function(){

	$("ul.specialsBox").find("li").hover(
		   function(){$(this).attr("class","redBorder")},
		   function(){$(this).attr("class","")}
		   );
	$("ul.indexContentMid").find("li").hover(
		   function(){$(this).attr("class","redBorder")},
		   function(){$(this).attr("class","")}
		   );
	$("ul.columnList").find("li").hover(
		   function(){$(this).attr("class","redBorder")},
		   function(){$(this).attr("class","")}
		   );
});
// 首页焦点轮播区域代码
$(document).ready(function() {				   
	$(".wheelButton").show();
	$(".wheelButton a:first").addClass("active");
	var imageWidth = $(".carouselChangePic").width();
	var imageSum = $(".wheelPicBox img").size();
	var imageReelWidth = imageWidth * imageSum;
	

	$(".wheelPicBox").css({'width' :imageReelWidth});
	rotate = function(){	
		var triggerID = $active.attr("rel") - 1;
		var wheelPicBoxPosition = triggerID * imageWidth; 

		$(".wheelButton a").removeClass('active');
		$active.addClass('active');

		$(".wheelPicBox").stop().animate({ 
			left: -wheelPicBoxPosition
		},{queue:true, duration:700} );
		
	}; 

	rotateSwitch = function(){		
		play = setInterval(function(){ 
			$active = $('.wheelButton a.active').next();
			if ( $active.length === 0) { 
				$active = $('.wheelButton a:first'); 
			}
			rotate();
		}, 7000); 
	};
	
	rotateSwitch();
	

	$(".wheelPicBox a").hover(function() {
		clearInterval(play); 
	}, function() {
		rotateSwitch(); 
	});	
	

	$(".wheelButton a").mouseover(function() {	
		$active = $(this);
		clearInterval(play);
		rotate();
		return false; 
	});	
	
	$(".wheelButton a").mouseout(function() {	
		rotateSwitch(); 
		rotate();
		return false; 
	});	
	
});
//滑动门
function setTab(name,cursel,n){
for(i=1;i<=n;i++){
var menu=document.getElementById(name+i);
var con=document.getElementById("con_"+name+"_"+i);
menu.className=i==cursel?"hover":"";
con.style.display=i==cursel?"block":"none";
}
}
//所有分类
$(document).ready(function(){

	$("div.category").find(".categoryList").hover(
		   function(){$(this).attr("class","categoryList categoryListHover")},
		   function(){$(this).attr("class","categoryList")}
		   );
});
/*总销量排行榜*/
function showAll(m,n,count,num){
	for(var i=1;i<=count;i++){
		if (i==n){
			$get(num+"_"+m+"_"+i).className="topShow topShowHover";
			}
		else {
			$get(num+"_"+m+"_"+i).className="topShow";
			}
	}
}
var $get = function(){
	var elements = new Array();
	var ii = arguments.length;
	for (var i = 0; i < arguments.length; i++) {
		var element = arguments[i];
		if (typeof element == 'string')
			element = document.getElementById(element);
		if (arguments.length == 1) {
			return element;
		}
		elements.push(element);
	}
	return elements;
}
/*医疗器械TOP榜*/
function showtabyl(m,n,count){
	for(var i=1;i<=count;i++){
		if (i==n){
			$get("yl_"+m+"_"+i).className="topShow topShowHover";
			}
		else {
			$get("yl_"+m+"_"+i).className="topShow";
			}
	}
}
var $get = function(){
	var elements = new Array();
	var ii = arguments.length;
	for (var i = 0; i < arguments.length; i++) {
		var element = arguments[i];
		if (typeof element == 'string')
			element = document.getElementById(element);
		if (arguments.length == 1) {
			return element;
		}
		elements.push(element);
	}
	return elements;
}
/*两性生活TOP榜*/
function showtablx(m,n,count){
	for(var i=1;i<=count;i++){
		if (i==n){
			$get("lx_"+m+"_"+i).className="topShow topShowHover";
			}
		else {
			$get("lx_"+m+"_"+i).className="topShow";
			}
	}
}
var $get = function(){
	var elements = new Array();
	var ii = arguments.length;
	for (var i = 0; i < arguments.length; i++) {
		var element = arguments[i];
		if (typeof element == 'string')
			element = document.getElementById(element);
		if (arguments.length == 1) {
			return element;
		}
		elements.push(element);
	}
	return elements;
}
/*其他类别TOP榜*/
function showtabother(m,n,count){
	for(var i=1;i<=count;i++){
		if (i==n){
			$get("other_"+m+"_"+i).className="topShow topShowHover";
			}
		else {
			$get("other_"+m+"_"+i).className="topShow";
			}
	}
}
var $get = function(){
	var elements = new Array();
	var ii = arguments.length;
	for (var i = 0; i < arguments.length; i++) {
		var element = arguments[i];
		if (typeof element == 'string')
			element = document.getElementById(element);
		if (arguments.length == 1) {
			return element;
		}
		elements.push(element);
	}
	return elements;
}
/*TOP榜*/
function showtab(m,n,count){
	for(var i=1;i<=count;i++){
		if (i==n){
			$get("td_"+m+"_"+i).className="topShow topShowHover";
			}
		else {
			$get("td_"+m+"_"+i).className="topShow";
			}
	}
}
var $get = function(){
	var elements = new Array();
	var ii = arguments.length;
	for (var i = 0; i < arguments.length; i++) {
		var element = arguments[i];
		if (typeof element == 'string')
			element = document.getElementById(element);
		if (arguments.length == 1) {
			return element;
		}
		elements.push(element);
	}
	return elements;
}
/*TOP榜*/
function showtabB(m,n,count){
	for(var i=1;i<=count;i++){
		if (i==n){
			$get("tb_"+m+"_"+i).className="topShow topShowHover";
			}
		else {
			$get("tb_"+m+"_"+i).className="topShow";
			}
	}
}
var $get = function(){
	var elements = new Array();
	var ii = arguments.length;
	for (var i = 0; i < arguments.length; i++) {
		var element = arguments[i];
		if (typeof element == 'string')
			element = document.getElementById(element);
		if (arguments.length == 1) {
			return element;
		}
		elements.push(element);
	}
	return elements;
}
//隐私保护ICO图标
$(document).ready(function(){

	$("ul.sListMode1").find("li").hover(
		   function(){$(this).attr("class","yinsiB")},
		   function(){$(this).attr("class","")}
		   );
	$("ul.sListMode2").find("li").hover(
		   function(){$(this).attr("class","yinsiB")},
		   function(){$(this).attr("class","")}
		   );
});

