if(typeof sina!="object"){
	sina={};
 }
 sina.$=function(objId){
	if(!objId){
		return null;
	}
	if(document.getElementById){
		return eval('document.getElementById("'+objId+'")');
	}
	else if(document.layers){
		return eval("document.layers['"+objId+"']");
	}
	else{
		return eval('document.all.'+objId);
	}
}
ImgFocus=function(i){
	var I=this;
	if(!i){
		throw new Error("must set param({String}instance) for class ImgFocus()");
		return null;
	}
	I.instance=i;
	I.data=null;
	I.imgDivId="";
	I.imgDivObj=null;
	I.listNumDivId="";
	I.listNumDivNode=null;
	I.wmplayer=null;
	I.listNumClass1="";
	I.listNumClass2="";
	I.defaultListIndex=0;
	I.filterDuration=0.5;
	I.switchInterval=2;
	I.currentListIndex=I.defaultListIndex;
	I.imgAObj=document.createElement("a");
	I.imgObj=new Image;
	I.setIntervalId=null;
}
ImgFocus.prototype={
	Init:function(){
		var i=this;
		i.InitVar();
		i.WriteImg();
		i.WriteListNum();
		i.IntervalSwitchImg();
	},InitVar:function(){
		var i=this;
		i.imgDivObj=sina.$(i.imgDivId);
		i.listNumDivNode=sina.$(i.listNumDivId);
		i.switchInterval=i.switchInterval*1000;
		if(i.defaultListIndex>=i.data.length||i.defaultListIndex<0){
			throw new Error("您指定的默认焦点图序号不存在,请检查object.defaultListIndex的值");
			return;
		}
		if(i.switchInterval<0){
			throw new Error("自动切换间隔时间不能小于0,请检查object.switchInterval的值");
			return;
		}
		for(var I=0;I<i.data.length;I++){
			new Image().src=i.data[I][0];
		}
	},WriteImg:function(){
		var i=this;
		i.imgAObj.href=i.data[i.defaultListIndex][1];
		i.imgAObj.setAttribute("href",i.data[i.defaultListIndex][1]);
		i.imgAObj.target="_blank";i.imgAObj.setAttribute("target","_blank");
		i.imgObj.src=i.data[i.defaultListIndex][0];
		i.imgObj.setAttribute("src",i.data[i.defaultListIndex][0]);
		i.imgAObj.appendChild(i.imgObj);
		i.imgDivObj.appendChild(i.imgAObj);
		if(typeof(i.wmplayer)=='object'&&i.data[i.defaultListIndex][2]!=""){
			i.wmplayer.SetCurFile(i.data[i.defaultListIndex][2],i.data[i.defaultListIndex][2]);
			i.wmplayer.Stop();
		}
		curImgDataIndexForPlayer=i.defaultListIndex;
	},WriteListNum:function(){
		var I=this,i="";
		for(var l=0;l<I.data.length;l++){
			if(l==I.defaultListIndex){
				i+='<span style="cursor:pointer;" class="'+I.listNumClass2+'" onmouseover="'+I.instance+'.SwitchImg('+l+')"><a onfocus="this.blur()" href="javascript:void(0)">'+(l+1)+'</a></span>';
			}
			else{
				i+='<span style="cursor:pointer;" class="'+I.listNumClass1+'" onmouseover="'+I.instance+'.SwitchImg('+l+')"><a onfocus="this.blur()" href="javascript:void(0)">'+(l+1)+'</a></span>';
			}
		}
		I.listNumDivNode.innerHTML=i;
	},SwitchImg:function(i){
		var c=this,o=navigator.appName=='Microsoft Internet Explorer';
		if(o){
			c.imgObj.style.filter='blendTrans(duration='+c.filterDuration+')';
			c.imgObj.filters.blendTrans.Apply();
		}
		var I=c.data[i];
		c.imgAObj.href=I[1];
		c.imgAObj.setAttribute("href",I[1]);
		c.imgObj.src=I[0];
		c.imgObj.setAttribute("src",I[0]);
		if(o){
			c.imgObj.filters.blendTrans.Play();
		}
		var l=c.listNumDivNode.getElementsByTagName("span");
		for(var O=0;O<l.length;O++){
			l[O].className=c.listNumClass1;
		}
		l[i].className=c.listNumClass2;
		c.currentListIndex=i;
		if(c.setIntervalId){
			clearInterval(c.setIntervalId);c.IntervalSwitchImg();
		}
		curImgDataIndexForPlayer=i;
	},IntervalSwitchImg:function(){
		if(this.switchInterval==0){
			return;
		}
		this.currentListIndex++;
		if(this.currentListIndex>=this.data.length){
			this.currentListIndex=0;
		}
		this.setIntervalId=setInterval(this.instance+'.SwitchImg('+this.instance+'.currentListIndex)',this.switchInterval);
	}
}