function ChallsSwitch(){
	this.Time = arguments[0];
	this.ID = document.getElementById(arguments[1]);
	
	if(!this.ID)
	{
		alert("您要设置的\"" + arguments[1] + "\"初始化错误\r\n请检查标签ID设置是否正确!");
		this.ID = -1;
		return;
	}
	if(arguments.length>5){
		this.TxtID = document.getElementById(arguments[4]);
		if(!this.TxtID){
			alert("您要设置的\"" + arguments[4] + "\"初始化错误\r\n请检查标签ID设置是否正确!");
			this.TxtID = -1;
			return;
		}
	}else{
		this.TxtID = -1;	
	}
	this.Photo = arguments[2];
	this.Txt = arguments[5];
	this.URL = []
	if(arguments.length>3){this.URL = arguments[3]};
	this.preLoad = Array();
	for (var i = 0; i < this.Photo.length; i++) { 
		this.preLoad[i] = new Image();
		this.preLoad[i].src = this.Photo[i];
	}
	this.U = 1;
	this.J = 0;
	this.ID.style.filter="revealTrans(duration=2,transition=20)";
	if(arguments.length>2){
		this.Start();
	}
}
ChallsSwitch.prototype.Start = function(){
	var cObj = this;
	var ID = this.ID;
	var TxtID = this.TxtID;
	var Txt = this.Txt;
	var photo = this.Photo;
	var preLoad = this.preLoad;
	var URL = this.URL;
	var U = this.U;
	var J = this.J;
	var j = -1;
	var time = this.Time;
	var t;
	if(document.all){
		ID.style.behavior='url(#default)';
	}
	if(URL.length>0){
	  ID.style.cursor='pointer';
	  ID.onclick = function(){
		  var c = j
		  if(c<0) c=0;
		  location.href = URL[c];
	  }
	}
	if (photo.length>0){
		ID.src = preLoad[0].src;
	}
	cObj.roll = function(){
		if (photo.length>0){
			if(U==1){
				j++;
				if (j >= photo.length ){
					j = 0;
				}
			}else if(U==2){
				j--;
				if (j < 0 ){this.j = photo.length-1;}
			}else if(U==3){
				j=this.J;
				if(j>=photo.length){
					j=photo.length-1;
				}
			}
			if(!isNaN(t)){
				clearTimeout(t);
			}
			if (document.all) {
				try{
				ID.filters.revealTrans.Transition=Math.floor(Math.random()*23); 
				ID.filters.revealTrans.Apply();
				}catch(e){}
			}
			if(TxtID != -1){
				TxtID.innerHTML = Txt[j];	
			}
			ID.src = preLoad[j].src;
			if (document.all) {
				try{
				ID.filters.revealtrans.play();
				}catch(e){}
			}
			t = setTimeout(cObj.roll,time);
		}else{
			ID.src = preLoad[0].src;
		}
	}
	setTimeout(cObj.roll,time);
}

