function switchingPlayer(con_id)
{
	this.currentNum=1;
	this.intervalTime=60;
	var cont=document.getElementById(con_id);
	if(!cont) return;
	var imgs=cont.getElementsByTagName("img");
	if(!imgs||imgs.length<=0) return;
	this.container=cont;
	this.imageList=imgs;
	var img=new Image();
	this.container.style.visibility="visible";

	img.src=imgs[0].src;
	this.width=img.width;
	this.height=img.height;
	this.container.style.width=this.width+"px";
	this.container.style.height=this.height+"px";
	imgs[0].style.display="block";
	this.mouseoverPlay = function(n){
		var o=this;
		if(o.playTimer||o.playTimer!=null){
			window.clearInterval(o.playTimer);
		}
		if(o.loopTimer){
			window.clearTimeout(o.loopTimer);
		}
		var d;
		for(var i=0;i<o.imageList.length;i++){
			o.imageList[i].style.display="none";
			if(o.imageList[i].parentNode&&o.imageList[i].parentNode.tagName.toLowerCase()=='a'){
				d=o.imageList[i].parentNode;
			}else{
				d=o.imageList[i];
			}
			d.style.zIndex="1";
			d.style.filter="alpha(opacity=100)";
			d.style.MozOpacity=1;
			d.style.opacity=1;
		}
		o.isPlaying=false;
		o.imageList[o.currentNum-1].style.display="block";
		o.play(n);
	};
	this.play = function(num){
		var o=this;
		if(o.isPlaying){return;}
		if(num){
			var nn=num;
			var on=o.currentNum;
		}else{
			var nn=o.currentNum+1;
			var on=o.currentNum;
		}
		if(nn>o.imageList.length){nn=1;}
	
		if(o.playTimer||o.playTimer!=null){
			window.clearInterval(o.playTimer);
		}
		if(o.loopTimer){
			window.clearTimeout(o.loopTimer);
		}
		var nel=(o.imageList[nn-1].parentNode&&o.imageList[nn-1].parentNode.tagName.toLowerCase()=='a')?o.imageList[nn-1].parentNode:o.imageList[nn-1];
		var oel=(o.imageList[on-1].parentNode&&o.imageList[on-1].parentNode.tagName.toLowerCase()=='a')?o.imageList[on-1].parentNode:o.imageList[on-1];
		nel.style.zIndex=1;
		oel.style.zIndex=10;
		oel.style.filter="alpha(opacity=100)";
		oel.style.MozOpacity=1;
		oel.style.opacity=1;
		nel.style.filter="alpha(opacity=100)";
		nel.style.MozOpacity=1;
		nel.style.opacity=1;
		o.imageList[nn-1].style.display="block";
		o.isPlaying=true;
		var n=100;
		var anim=function(){
			n-=20;
			if(n<=0){
				oel.style.filter="alpha(opacity=0)";
				oel.style.MozOpacity=0;
				oel.style.opacity=0;
				oel.style.zIndex=1;
				o.imageList[on-1].style.display="none";
				o.isPlaying=false;
				o.currentNum=nn;
				o.loopTimer=window.setTimeout(function(){o.mouseoverPlay(o.currentNum+1);},o.waiting);
				window.clearInterval(o.playTimer);
				o.endPlay();
			}else{
			oel.style.filter="alpha(opacity="+n+")";
			oel.style.MozOpacity=n/100;
			oel.style.opacity=n/100;
			}
		}
		o.playTimer=window.setInterval(anim,o.intervalTime);
	};
	this.endPlay = function(n){
		var o=this;
		if(o.linum){
			for(var i=0; i<o.linum.length;i++){
				o.linum[i].className = '';
			}
			o.linum[o.currentNum-1].className = 'curNumber';
		}
	};
}

//Í¼Æ¬ÇÐ»»
function switchingLide(divId,waiting){
	waiting = waiting || 3000;
	divId = divId || 'swimgs';
	if(!document.getElementById(divId)) return;

	var obj = new switchingPlayer(divId),slidenum,t_num,li;
	obj.waiting = waiting;
	swnum = document.getElementById(divId+'num');
	if(obj && swnum){
		 t_num = '<ul class="number"><li class="curNumber">1</li>';
		 for(var i=1;i<obj.imageList.length; i++)
		 {
			 t_num +="<li>"+(i+1)+"</li>";
		 }
		 t_num += "</ul>";
		 swnum.innerHTML = t_num;
		 li = swnum.getElementsByTagName("li");
		 obj.linum = li;
		 for(var j=0; j<li.length;j++)
		 {
			 Event.observe(li[j],'mouseover',function(event){
				 var el = (navigator.userAgent.toLowerCase().indexOf('msie')>0)? event.srcElement : event.target;
				 var n = parseInt(el.innerHTML);
				 if(obj.currentNum==n) return;
				 for(var i=0; i<li.length;i++){
					 li[i].className = '';
				 }
				 el.className = "curNumber";
				 obj.mouseoverPlay(n);
			 });
		 }
	}
	obj.loopTimer=window.setTimeout(function(){obj.mouseoverPlay(obj.currentNum+1);},obj.waiting);
}