//图片滚动列表 mengjia 070816
function Cont(){}
Cont.prototype.id="ISL_Cont";
Cont.prototype.List1="List1";
Cont.prototype.List2="List2";
Cont.prototype.auto=false;
Cont.prototype.Speed = 10; //速度(毫秒)
Cont.prototype.Space = 5; //每次移动(px)
Cont.prototype.PageWidth=200; //翻页宽度
Cont.prototype.fill = 0; //整体移位
Cont.prototype.MoveLock = false;
Cont.prototype.MoveTimeObj;
Cont.prototype.Comp = 0;
Cont.prototype.AutoPlayObj = null;
Cont.prototype.init= function(id,List1,List2,Speed,Space,PageWidth,auto){
	this.id=id;
	this.List1=List1;
	this.List2=List2;
	this.Speed=Speed;
	this.Space=Space;
	this.PageWidth=PageWidth;
	this.auto=auto;
	if(this.auto){
		AutoPlay(this);
	}
}


function GetObj(objName){if(document.getElementById){return eval('document.getElementById("'+objName+'")')}else{return eval('document.all.'+objName)}}
function AutoPlay(Cont){ //自动滚动
 clearInterval(Cont.AutoPlayObj); 
 if(Cont.auto){
 	Cont.AutoPlayObj = setInterval(function(){ISL_GoDown(Cont);ISL_StopDown(Cont);},5000); //间隔时间
 }
}
function ISL_GoUp(Cont){ //上翻开始
 if(Cont.MoveLock) return;
 clearInterval(Cont.AutoPlayObj);
 Cont.MoveLock = true;
 Cont.MoveTimeObj = setInterval(function(){ISL_ScrUp(Cont);},Cont.Speed);
}
function ISL_StopUp(Cont){ //上翻停止
 clearInterval(Cont.MoveTimeObj);
 if(GetObj(Cont.id).scrollLeft % Cont.PageWidth - Cont.fill != 0){
  Cont.Comp = Cont.fill - (GetObj(Cont.id).scrollLeft % Cont.PageWidth);
  CompScr(Cont);
 }else{
  Cont.MoveLock = false;
 }
 AutoPlay(Cont);
}
function ISL_ScrUp(Cont){ //上翻动作
 if(GetObj(Cont.id).scrollLeft <= 0){GetObj(Cont.id).scrollLeft = GetObj(Cont.id).scrollLeft + GetObj(Cont.List1).offsetWidth}
 GetObj(Cont.id).scrollLeft -= Cont.Space ;
}
function ISL_GoDown(Cont){ //下翻
 clearInterval(Cont.MoveTimeObj);
 if(Cont.MoveLock) return;
 clearInterval(Cont.AutoPlayObj);
 Cont.MoveLock = true;
 ISL_ScrDown(Cont);
 Cont.MoveTimeObj = setInterval(function(){ISL_ScrDown(Cont);},Cont.Speed);
}
function ISL_StopDown(Cont){ //下翻停止
 clearInterval(Cont.MoveTimeObj);
 if(GetObj(Cont.id).scrollLeft % Cont.PageWidth - Cont.fill != 0 ){
  Cont.Comp = Cont.PageWidth - GetObj(Cont.id).scrollLeft % Cont.PageWidth + Cont.fill;
  CompScr(Cont);
 }else{
  Cont.MoveLock = false;
 }
 AutoPlay(Cont);
}
function ISL_ScrDown(Cont){ //下翻动作
 if(GetObj(Cont.id).scrollLeft >= GetObj(Cont.List1).scrollWidth){GetObj(Cont.id).scrollLeft = GetObj(Cont.id).scrollLeft - GetObj(Cont.List1).scrollWidth;}
 GetObj(Cont.id).scrollLeft += Cont.Space ;
}
function CompScr(Cont){
 var num;
 if(Cont.Comp == 0){Cont.MoveLock = false;return;}
 if(Cont.Comp < 0){ //上翻
  if(Cont.Comp < -Cont.Space){
   Cont.Comp += Cont.Space;
   num = Cont.Space;
  }else{
   num = -Cont.Comp;
   Cont.Comp = 0;
  }
  GetObj(Cont.id).scrollLeft -= num;
  setTimeout(function(){CompScr(Cont);},Cont.Speed);
 }else{ //下翻
  if(Cont.Comp > Cont.Space){
   Cont.Comp -= Cont.Space;
   num = Cont.Space;
  }else{
   num = Cont.Comp;
   Cont.Comp = 0;
  }
  GetObj(Cont.id).scrollLeft += num;
  setTimeout(function(){CompScr(Cont);},Cont.Speed);
 }
}
