﻿var isc = 0,curid = 1,curo = 0,inr;
var sml = [['49','41','4','24'],['49','41','4','24'],['49','41','4','24'],['49','41','4','24'],['49','41','4','24']];
function co(o){ $('lod').style.filter = 'Alpha(opacity='+o+'0)'; $('lod').style.opacity = '0.'+o;}
function clv(){
	if(curo>0){
		curo--; co(curo);
	}else{
		$('sm1').href = 'Detail.aspx?ProductId='+sml[curid-1][0];
		$('sm2').href = 'Detail.aspx?ProductId='+sml[curid-1][1];
		$('sm3').href = 'Detail.aspx?ProductId='+sml[curid-1][2];
		$('sm4').href = 'Detail.aspx?ProductId='+sml[curid-1][3];
		$('lod').style.display = 'none';
		clearInterval(inr);
		isc = 0;
	}
}
function opv(){
	if(curo<9){
		curo++; co(curo);
	}else{
		$('iml').src = 'images/index/m'+curid+'.jpg';
		clearInterval(inr);
	}
}
function cl(){ inr = setInterval(clv,10) }
for(var i=1; i<6; i++){
	$("im"+i).onclick = function(){
		if(isc == 0){
			if(curid > 0)
				$("im"+curid).style.background = '';
			curid = this.id.substr(2,1);
			this.style.background = "url(/images/index/imbg.gif) -"+((curid-1)*196)+"px -30px";
			$('lod').style.display = 'block';
			inr = setInterval(opv,10);
			isc = 1;
		}
	}
}
function Marquee(){
  this.ID=document.getElementById(arguments[0]);
  this.Direction=arguments[1];
  this.Step=arguments[2];
  this.Width=arguments[3];
  this.Height=arguments[4];
  this.Timer=arguments[5];
  this.WaitTime=arguments[6];
  this.StopTime=arguments[7];
  if(arguments[8]){this.ScrollStep=arguments[8];}else{this.ScrollStep=this.Direction>1?this.Width:this.Height;}
  this.CTL=this.StartID=this.Stop=this.MouseOver=0;
  this.ID.style.overflowX=this.ID.style.overflowY="hidden";
  this.ID.noWrap=true;
  this.ID.style.width=this.Width;
  this.ID.style.height=this.Height;
  this.ClientScroll=this.Direction>1?this.ID.scrollWidth:this.ID.scrollHeight;
  this.ID.innerHTML+=this.ID.innerHTML;
  this.Start(this,this.Timer,this.WaitTime,this.StopTime);
  }
Marquee.prototype.Start=function(msobj,timer,waittime,stoptime){
  msobj.StartID=function(){msobj.Scroll();}
  msobj.Continue=function(){
    if(msobj.MouseOver==1){setTimeout(msobj.Continue,waittime);}
    else{clearInterval(msobj.TimerID); msobj.CTL=msobj.Stop=0; msobj.TimerID=setInterval(msobj.StartID,timer);}
    }
  msobj.Pause=function(){msobj.Stop=1; clearInterval(msobj.TimerID); setTimeout(msobj.Continue,waittime);}
  msobj.Begin=function(){
    msobj.TimerID=setInterval(msobj.StartID,timer);
    msobj.ID.onmouseover=function(){msobj.MouseOver=1; clearInterval(msobj.TimerID);}
    msobj.ID.onmouseout=function(){msobj.MouseOver=0; if(msobj.Stop==0){clearInterval(msobj.TimerID); msobj.TimerID=setInterval(msobj.StartID,timer);}}
    }
  setTimeout(msobj.Begin,stoptime);
  }
Marquee.prototype.Scroll=function(){
  switch(this.Direction){
    case 0:
      this.CTL+=this.Step;
      if(this.CTL>=this.ScrollStep&&this.WaitTime>0){this.ID.scrollTop+=this.ScrollStep+this.Step-this.CTL; this.Pause(); return;}
      else{if(this.ID.scrollTop>=this.ClientScroll) this.ID.scrollTop-=this.ClientScroll; this.ID.scrollTop+=this.Step;}
      break;
    case 1:
      this.CTL+=this.Step;
      if(this.CTL>=this.ScrollStep&&this.WaitTime>0){this.ID.scrollTop-=this.ScrollStep+this.Step-this.CTL; this.Pause(); return;}
      else{if(this.ID.scrollTop<=0) this.ID.scrollTop+=this.ClientScroll; this.ID.scrollTop-=this.Step;}
      break;
    case 2:
      this.CTL+=this.Step;
      if(this.CTL>=this.ScrollStep&&this.WaitTime>0){this.ID.scrollLeft+=this.ScrollStep+this.Step-this.CTL; this.Pause(); return;}
      else{if(this.ID.scrollLeft>=this.ClientScroll) this.ID.scrollLeft-=this.ClientScroll; this.ID.scrollLeft+=this.Step;}
      break;
    case 3:
      this.CTL+=this.Step;
      if(this.CTL>=this.ScrollStep&&this.WaitTime>0){this.ID.scrollLeft-=this.ScrollStep+this.Step-this.CTL; this.Pause(); return;}
      else{if(this.ID.scrollLeft<=0) this.ID.scrollLeft+=this.ClientScroll; this.ID.scrollLeft-=this.Step;}
      break;
    }
  }
function mq(){ new Marquee("wenda",0,1,980,32,30,2000,1000,32); };
if (document.all) {
window.attachEvent('onload', mq);
}else{
window.addEventListener('load',mq,false);
}
