var running=0;
onload=function(){
	new roll('Switch','one',3000);
	}
function roll(){
	this.idName = arguments[0];
	if(!this.idName) {
		alert("您要设置的\"" + arguments[0] + "\"初始化错误\r\n请检查标签ID设置是否正确!");
		this.idName = -1;
		return;
	}
	this.ID=document.getElementById(this.idName);
	this.liNum = this.ID.getElementsByTagName('li').length;
	this.ID2=arguments[1];
	this.scrollTime=arguments[2];
	this.cursor=1;
	this.start();
}
roll.prototype.start= function(){
	var msobj = this;
	var timer = msobj.scrollTime;
	msobj.startId=function (){msobj.scroll()};
	msobj.begin = function(){
		msobj.intervalId = setInterval(msobj.startId,timer);
		msobj.ID.onmouseover = function(){
			clearInterval(msobj.intervalId);
		}
		msobj.ID.onmouseout = function(){
			msobj.intervalId = setInterval(msobj.startId,timer);
		}
	}
	var myrandom=Math.round(Math.random()*1000);
	setTimeout(msobj.begin,myrandom);
}
roll.prototype.scroll = function(){
	var msobj=this;
	msobj.setTab=function (){
		for(i=1;i<=msobj.liNum;i++){
			var menu=document.getElementById(msobj.ID2+i);
			var con=document.getElementById("con_"+msobj.ID2+"_"+i);
			if(i==msobj.cursor){
				menu.className="Select";
				con.style.display="block";
			}else{
				menu.className="";
				con.style.display="none";
			}
		}
	}
	msobj.setTab();
	if(msobj.cursor==msobj.liNum){
		msobj.cursor=1;
	}
	else{
		msobj.cursor++;
	}
}
function setTab(id,id2,id3){
	var liNum=document.getElementById(id).getElementsByTagName('li').length;
	for(i=1;i<=liNum;i++){
		var menu=document.getElementById(id2+i);
		var con=document.getElementById("con_"+id2+"_"+i);
		if(i==id3){
			menu.className="Select";
			con.style.display="block";
		}else{
			menu.className="";
			con.style.display="none";
		}
	}
}