window.onload=function(){
	//***************左侧热卖推荐****************
	var shop_prohotbd=document.getElementById("shop_prohotbd");
	var shop_prohotbdLi=[];
	var shop_prohotbdLilen=shop_prohotbd.getElementsByTagName("li").length;
	for(shopI=0;shopI<shop_prohotbdLilen;shopI++){
		shop_prohotbdLi[shopI]=shop_prohotbd.getElementsByTagName("li")[shopI];
		shop_prohotbdLi[shopI].index=shopI;
		shop_prohotbdLi[shopI].onmouseover=function(){
			for(shopI2=0;shopI2<shop_prohotbdLilen;shopI2++){
				shop_prohotbdLi[shopI2].className="";
			}
			shop_prohotbdLi[this.index].className="shop_prohotbdlicurrent";
		}
	}
	
	//产品小图标
	var shop_probuymid=document.getElementById("shop_probuymid");
	var shop_probuymidLi=[];
	var shop_probuymidLilen=shop_probuymid.getElementsByTagName("li").length;
	var shop_showMaximg=document.getElementById("shop_showMaximg");//大图片标记
	var shop_probuylbot=document.getElementById("shop_probuylbot");//左按钮
	var shop_probuyrbot=document.getElementById("shop_probuyrbot");//右按钮
	var shopShowTurnI=shopScrollI=0;
	var Turnlen=Math.floor(shop_probuymidLilen/4);
	var shopPicTimer=null;
	shop_probuymid.style.width=68*shop_probuymidLilen+"px";//小图标宽度设置
	for(shopshowI=0;shopshowI<shop_probuymidLilen;shopshowI++){
		shop_probuymidLi[shopshowI]=shop_probuymid.getElementsByTagName("li")[shopshowI];
		shop_probuymidLi[shopshowI].index=shopshowI;
		shop_probuymidLi[shopshowI].onmouseover=function(){
			for(shopshowI2=0;shopshowI2<shop_probuymidLilen;shopshowI2++){
				shop_probuymidLi[shopshowI2].className="";
			}
			shop_probuymidLi[this.index].className="shop_probuyimgcurrent";
			var StringN=shop_probuymidLi[this.index].getAttribute("name");
			shop_showMaximg.src=shop_showMaximg.jqimg=StringN;
		}
	}
	//计时器函数
	function shopPlayTimer(num){
		if(shopPicTimer){
			clearInterval(shopPicTimer);
			shopPicTimer=null;
		}else{
			if(num==1){
				shopPicTimer=setInterval(LeftscrollImg,10);
			}else if(num==2){
				shopPicTimer=setInterval(RightscrollImg,10);
			}
		}
	}
	//滚动函数
	function RightscrollImg(){
		if(shopScrollI>272*shopShowTurnI-5){
			shopPlayTimer();
		}else{
			shopScrollI+=8;
			shop_probuymid.style.marginLeft="-"+shopScrollI+"px";
		}
	}
	function LeftscrollImg(){
		if(shopScrollI>272*shopShowTurnI+5){
			shopScrollI-=8;
			shop_probuymid.style.marginLeft="-"+shopScrollI+"px";
		}else{
			shopPlayTimer();
		}
	}
	//左按钮点击
	shop_probuylbot.onclick=function(){
		if(shopShowTurnI>0){shopShowTurnI--}else{shopShowTurnI=0};
		shopPlayTimer(1);
	}
	//右按钮点击
	shop_probuyrbot.onclick=function(){
		if(shopShowTurnI<Turnlen){shopShowTurnI++}else{shopShowTurnI=Turnlen};
		shopPlayTimer(2);
	}
}