/*
 * sina
 * author:zhangping
 * date:2006-8-31
 */
 
 /*
  * 检测sina是否为已建对象
  */
 if(typeof(sina) != "object"){
	var sina = new Object();
 }
 /*
  * 判断浏览器
  */
 sina.isIE = navigator.appName == "Microsoft Internet Explorer";
 sina.isNS = navigator.appName == "Netscape";
 sina.isOP = navigator.appName == "Opera";
/*
 * Object sina.$(String objId)
 * 参数：必须
 */
 sina.$ = function(objId){
 	if(!objId){
 		//throw new Error("sina.$(String objId)参数必须");//throw new Error("sina.$(String objId)参数必须")
		return;
 	}
	if(document.getElementById){
		return eval('document.getElementById("' + objId + '")');
	}else if(document.layers){
		return eval("document.layers['" + objId +"']");
	}else{
		return eval('document.all.' + objId);
	}
 }
 /*
  * 
  */
 sina.GetOLeft = function(myObj){
	curObj = myObj;
	var objLT = curObj.offsetLeft;
	while(curObj!=curObj.offsetParent && curObj.offsetParent){
		curObj=curObj.offsetParent;
		if(curObj.tagName=="DIV" || curObj.tagName=="TABLE" || curObj.tagName=="TR" || curObj.tagName=="TD"){
			objLT += curObj.offsetLeft;
		}
	}
	return objLT;
 }
 /*
  * String sina.GetClassName(Object obj)
  * 获得对象的class属性
  * 参数: 必须
  */
 sina.GetClassName = function(obj){
	if(!obj){
		throw new Error("GetClassName(obj)参数:必须");
	}
	//if(obj.className)
	return obj.className;
	//if(obj.getAttribute) return obj.getAttribute("class");
 }

/*
 * void sina.SetClassName(Object obj,String classNameTmp)
 * 设置对象的class属性
 * 参数: 必须
 */
 sina.SetClassName = function(obj,classNameTmp){
 	if(!obj || classNameTmp == undefined){
 		throw new Error("SetClassName(obj,classNameTmp)参数:必须");
 	}
 	//if(obj.className) 
 	obj.className = classNameTmp; //return;
	//if(obj.setAttribute) obj.setAttribute("class",classNameTmp);
 }
 sina.SetCookie = function(name,value){
	//检测参数
 	if(!name || !value){
 		throw new Error("sina.SetCookie(name,value) 参数必须")
 	}
	var argv = arguments;
	var argc = arguments.length;

	var nextyear = new Date();
	nextyear.setFullYear(nextyear.getFullYear() + 1);
	var c = name + "=" + value +";" +"expires=" + nextyear.toGMTString();
		
	document.cookie = c;
 }
 sina.GetCookie = function(name){
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg){
			return getCookieVal (j);
		}
		i = document.cookie.indexOf("", i) + 1;
		if (i == 0){
			break; 
		}
	}
	return null;
}
function getCookieVal (offset){
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1){
		endstr = document.cookie.length;
	}		
	return unescape(document.cookie.substring(offset, endstr));
}
 /* 
  * Array GetOffsetPos(Object element)
  * return a array obj [left,top]
  */
 sina.GetOffsetPos = function(element) {
	var posTop = 0, posLeft = 0;
	do {
		posTop += element.offsetTop || 0;
		posLeft += element.offsetLeft || 0;
		element = element.offsetParent;
		} while (element);
	return [posLeft, posTop];
}

/*
 * 播放器构造函数
 */
sina.Player = function(){
	/* 播放器属性 */
	this.wWidth 			= 320;	//视频宽度
	this.wHeight 			= 350;	//视频高度
	this.wSize				= new Array();//其他视频尺寸
	this.wmZoneId			= "";	//播放器容器
	this.wZoneId 			= "";	//放置视频的容器的ID
	this.pZoneId			= "";	//进度区域的ID
	this.pBoxId				= "";	//进度控制钮的ID
	this.vZoneId 			= "";	//声音区域的ID
	this.vBoxId 			= "";	//声音滑块的ID
	this.playBtnId 			= "";	//播放按钮的ID
	this.stopBtnId 			= "";	//停止按钮的ID
	this.muteBtnId 			= "";	//静音按钮的ID
	this.fullScreenBtnId	= "";	//全屏按钮的ID	
	this.bOrNBtnId 			= "";	//宽窄频单一button
	this.ctrZoneId 			= "";	//控制区域 获得此对象目的在NS下隐藏它
	this.mplayerAdId		= "";	//播放前广告iframe的ID
	this.defaultAdurl		= "";	//默认的缓冲url	
	
	this.autoStart			= true;	//是否自动播放			VARIANT_BOOL
	this.stateShow			= true;	//是否允许显示状态信息	VARIANT_BOOL
	
	this.netModel		= 1;		//当前网络连接模式 Number 0:窄频 1:宽频
	this.curNarrowFile	= "";		//当前播放的视频的窄频url
	this.curBroadFile	= "";		//当前播放的视频的宽频url	
	
	this.pFlag = false;
	this.vFlag = false;	
	this.isPorV = 0;//判断是否对进度条还是音量操作
	
	/* 创建<object>对象 */
	this.wObject = document.createElement("object");
	this.wEmbed = document.createElement("embed");
}
/*
 * 附加方法到原型对象
 */
	sina.Player.prototype = {
		/* 初始化 播放器 */
		Init:function(){
			var objTmp = this;
			this.InitVar();		//初始化 变量
			this.InitBtn();		//初始化 按钮状态
			if(sina.isIE){		//写<object>到文档
				this.Draw();
			}else{
				this.DrawToNS();
			}			
			this.SetVolume(5);	//初始化 音量
			//setInterval.call(objTmp,"this.FixPos()",1000);//初始化播放进度条
			
		},
		/* 初始化变量 */
		InitVar:function(){
			/* 默认视频宽高 */
			this.wWidth 	= parseInt(this.wSize[0].split("|")[0]);
			this.wHeight 	= parseInt(this.wSize[0].split("|")[1]);
			/* 获得按钮对象 */
			this.wZone		= sina.$(this.wZoneId);
			this.wmZone		= sina.$(this.wmZoneId);		
			this.ctrZone	= sina.$(this.ctrZoneId);
			this.vZone		= sina.$(this.vZoneId);
			this.vBox 		= sina.$(this.vBoxId);
			this.vBoxWidth	= this.vBox.clientWidth;			
			this.playBtn 	= sina.$(this.playBtnId);
			this.stopBtn 	= sina.$(this.stopBtnId);
			this.muteBtn 	= sina.$(this.muteBtnId);
			this.fullScreenBtn = sina.$(this.fullScreenBtnId);
			/* 放大按钮 可能有多个 
			for(var i = 1; i < this.wSize.length; i++){
				eval('this.zoomBtn'+i+' = sina.$(this.wSize['+i+'].split("|")[2])');
				//eval('alert(this.zoomBtn'+i+')');
			}*/
			this.zoomBtn1	= sina.$(this.wSize[1].split("|")[2]);
			this.zoomBtn2	= sina.$(this.wSize[2].split("|")[2]);
			if(this.zoomBtn1){
				this.w1Width	= parseInt(this.wSize[1].split("|")[0])
				this.w1Height	= parseInt(this.wSize[1].split("|")[1])
			}
			if(this.zoomBtn2){
				this.w2Width	= parseInt(this.wSize[2].split("|")[0])
				this.w2Height	= parseInt(this.wSize[2].split("|")[1])
			}
				
			this.bOrNBtn	= sina.$(this.bOrNBtnId);
			/* iframe 提示区域 */
			this.mplayerAd	= sina.$(this.mplayerAdId);
			//初始化this.netModel cookie中的值优先权最高
			var netModelCookie = parseInt(sina.GetCookie("bnTxtNetModel"));
			if(netModelCookie == 0 || netModelCookie == 1){
				this.netModel = netModelCookie;
			}			
			/* 播放按钮 */
			this.playBtnNoneUrl		= this.skinPath + "play_disable.gif";						//不可操作状态图片的url
			this.playBtnUrl		= this.skinPath + "play.gif";				//可操作状态图片的url
			this.playBtnOverUrl	= this.skinPath + "play_over.gif";					//鼠标放上状态图片的url
			this.playBtnAlt			= "播放";										//可操作状态的Alt属性值
			/* 暂停按钮 */
			this.pauseBtnNoneUrl	= this.skinPath + "pause_disable.gif";	//不可操作状态图片的url
			this.pauseBtnUrl		= this.skinPath + "pause.gif";			//可操作状态图片的url
			this.pauseBtnOverUrl	= this.skinPath + "pause.gif";	//鼠标放上状态图片的url
			this.pauseBtnAlt		= "暂停";											//可操作状态的Alt属性值
			/* 停止按钮 */
			this.stopBtnNoneUrl		= this.skinPath + "stop_disable.gif";					//不可操作状态图片的url
			this.stopBtnUrl			= this.skinPath + "stop.gif";			//可操作状态图片的url
			this.stopBtnOverUrl		= this.skinPath + "stop_over.gif";
			this.stopBtnAlt			= "停止";											//可操作状态的Alt属性值
			/* 静音按钮 */
			this.muteBtnNoneUrl		= this.skinPath + "mute_disable.gif";					//不可操作状态图片的url
			this.muteBtnUrl			= this.skinPath + "mute.gif";			//静音状态图片的url
			this.muteBtnOverUrl		= this.skinPath + "mute_over.gif";	//鼠标放上状态图片的url
			this.muteBtnAlt			= "打开声音";											//静音状态的Alt属性值
			this.muteBtnNoUrl		= this.skinPath + "muteoff.gif";			//非静音状态图片的url
			this.muteBtnNoOverUrl	= this.skinPath + "muteoff_over.gif";		//鼠标放上状态图片的url
			this.muteBtnNoAlt		= "关闭声音";											//非静音状态的Alt属性值
			/* 全屏按钮 */
			this.fullScreenBtnNoneUrl	= this.fullScreenBtn.getAttribute("src");				//不可操作状态图片的url
			this.fullScreenBtnUrl		= this.fullScreenBtnNoneUrl.replace("_none","");		//可操作状态图片的url
			this.fullScreenBtnOverUrl	= this.fullScreenBtnNoneUrl.replace("_none","_over");	//鼠标放上状态图片的url
			this.fullScreenBtnAlt		= "全屏模式\nEsc键退出全屏";								//可操作状态的Alt属性值
			/* 放大1按钮 */
			if(this.zoomBtn1){
				this.zoomBtn1NoneUrl	= this.zoomBtn1.getAttribute("src");
				this.zoomBtn1Url		= this.zoomBtn1NoneUrl.replace("_none","");
				this.zoomBtn1OverUrl	= this.zoomBtn1NoneUrl.replace("_none","_over");
				this.zoomBtn1Alt 		= "放大";
				this.reZoomBtn1Url		= this.zoomBtn1NoneUrl.replace("_none","re");
				this.reZoomBtn1NoneUrl	= this.zoomBtn1NoneUrl.replace("_none","re_none");
				this.reZoomBtn1OverUrl	= this.zoomBtn1NoneUrl.replace("_none","re_over");
				this.reZoomBtn1Alt 	= "还原";
			}
			/* 放大2按钮 */
			if(this.zoomBtn2){
				this.zoomBtn2NoneUrl	= this.zoomBtn2.getAttribute("src");
				this.zoomBtn2Url		= this.zoomBtn2NoneUrl.replace("_none","");
				this.zoomBtn2OverUrl	= this.zoomBtn2NoneUrl.replace("_none","_over");
				this.zoomBtn2Alt 		= "更大";
				this.reZoomBtn2Url		= this.zoomBtn2NoneUrl.replace("_none","re");
				this.reZoomBtn2OverUrl	= this.zoomBtn2NoneUrl.replace("_none","re_over");
				this.reZoomBtn2Alt 	= "还原";
			}
			
			/* 播放进度条 */
			this.pBox 			= sina.$(this.pBoxId);								//进度条控制钮
			this.pBoxWidth 		= parseInt(this.pBox.style.width.replace("px","")); //进度条控制钮宽度
			this.pZone 			= sina.$(this.pZoneId);								//进度条区域
			this.pZoneWidth 	= parseInt(this.pZone.style.width.replace("px",""));	//进度条区域的宽度 不包括margin, border, or scroll bar
			
			/* 播放进度控制钮 */
			this.pBoxUrl			= this.skinPath + "pbox.gif";
			this.pBoxOverUrl		= this.skinPath + "pbox_over.gif";
			/* 音量控制条 */
			this.vBox 			= sina.$(this.vBoxId);								//音量控制钮
			this.vBoxWidth 		= parseInt(this.vBox.style.width.replace("px",""));					//音量控制钮宽度
			this.vZone 			= sina.$(this.vZoneId);								//音量条区域
			this.vZoneWidth 	= parseInt(this.vZone.style.width.replace("px",""));							//音量条区域的宽度
			/* 音量控制钮 */
			this.vBoxUrl			= this.skinPath + "vbox.gif";
			this.vBoxOverUrl		= this.skinPath + "vbox_over.gif";
			/* 播放模式 */
			this.bOrNBtnNoneUrl		= this.bOrNBtn.getAttribute("src");
			this.broadBtnUrl		= this.bOrNBtnNoneUrl.replace("_none","_broad");
			this.broadBtnOverUrl	= this.bOrNBtnNoneUrl.replace("_none","_broad_over");
			this.broadBtnAlt		= "选择清晰模式";
			this.narrowBtnUrl		= this.bOrNBtnNoneUrl.replace("_none","_narrow");
			this.narrowBtnOverUrl	= this.bOrNBtnNoneUrl.replace("_none","_narrow_over");
			this.narrowBtnAlt		= "选择流畅模式";
			
			/* 间隔设置音量函数ID */
			//this.setIntervalVolumeId = new Number();
			/* 间隔设置播放进度函数ID */
			//this.setIntervalPlayId = new Number();
		},
		/*
	 	 * 初始化 播放 停止 静音 音量控制钮 按钮状态
	 	 * 绑定事件处理程序 ...Handler()
	 	 */
	 	InitBtn:function(){
	 		this.autoStart?this.SetBtnState("play"):this.SetBtnState("stop");
			this.playBtn.style.cursor	= "hand";
			this.SetBtnState("muteNo");
			this.muteBtn.style.cursor	= "hand";
			this.vBox.style.cursor		= "hand";
			this.vBox.setAttribute("title","移动滑块控制音量");
			this.pBox.style.cursor		= "hand";
			this.pBox.setAttribute("title","移动滑块控制播放进度");
	 		//初始化 播放模式按钮
	 		if(this.netModel == 0){
	 			this.SetBtnState("narrow");
	 		}else if(this.netModel == 1){
	 			this.SetBtnState("broad");
	 		}else{
	 			throw new Error("网络模式：this.netModel 的值应为0或1");
	 		}
	 		this.SetBtnState("zoom1");
	 		this.SetBtnState("zoom2");
			//初始化按钮绑定事件
			var objTmp = this;
				//播放按钮事件
			this.playBtn.onclick = function(){//播放按钮在初始化时即可绑定事件 停止不同	
				objTmp.PlayOrPauseHandler.call(objTmp);
			}
			this.playBtn.onmouseover = function(){
				if(this.src == objTmp.playBtnUrl){
					this.src = objTmp.playBtnOverUrl;
				}else if(this.src == objTmp.pauseBtnUrl){
					this.src = objTmp.pauseBtnOverUrl;
				}
			}
			this.playBtn.onmouseout = function(){
				if(this.src == objTmp.playBtnOverUrl){
					this.src = objTmp.playBtnUrl;
				}else if(this.src == objTmp.pauseBtnOverUrl){
					this.src = objTmp.pauseBtnUrl;
				}
			}
				//音量控制钮event
			this.pBox.onmouseover = function(){
				this.style.backgroundImage = "url(" + objTmp.pBoxOverUrl + ")";
			}
			this.pBox.onmouseout = function(){
				this.style.backgroundImage = "url(" + objTmp.pBoxUrl + ")";
			}
				//静音按钮事件
			this.muteBtn.onclick = function(){
				objTmp.Mute.call(objTmp);
			}
			this.muteBtn.onmouseover = function(){
				if(this.src == objTmp.muteBtnUrl){
					this.src = objTmp.muteBtnOverUrl;
				}else if(this.src == objTmp.muteBtnNoUrl){
					this.src = objTmp.muteBtnNoOverUrl;
				}
			}
			this.muteBtn.onmouseout = function(){
				if(this.src == objTmp.muteBtnOverUrl){
					this.src = objTmp.muteBtnUrl;
				}else if(this.src == objTmp.muteBtnNoOverUrl){
					this.src = objTmp.muteBtnNoUrl;
				}
			}
				//音量控制钮event
			this.vBox.onmouseover = function(){
				this.style.backgroundImage = "url(" + objTmp.vBoxOverUrl + ")";
			}
			this.vBox.onmouseout = function(){
				this.style.backgroundImage = "url(" + objTmp.vBoxUrl + ")";
			}
				//停止按钮事件
			this.stopBtn.onclick = function(){
				objTmp.Stop.call(objTmp);
			}
			this.stopBtn.onmouseover = function(){
				if(this.src == objTmp.stopBtnUrl){
					this.src = objTmp.stopBtnOverUrl;
				}
			}
			this.stopBtn.onmouseout = function(){
				if(this.src == objTmp.stopBtnOverUrl){
					this.src = objTmp.stopBtnUrl;
				}
			}
				//播放模式按钮事件
			this.bOrNBtn.onclick = function(){
				objTmp.SelectNetModel.call(objTmp);
			}
				//全屏按钮事件
			this.fullScreenBtn.onclick = function(){
				objTmp.FullScreen.call(objTmp);
			}
				// 放大1按钮事件
			if(this.zoomBtn1){
				this.zoomBtn1.onclick = function(){
					objTmp.Zoom.call(objTmp,objTmp.w1Width,objTmp.w1Height,1);
				}
				/*this.zoomBtn1.onmouseover = function(){
					if(this.src == objTmp.zoomBtn1Url){
						this.src = objTmp.zoomBtn1OverUrl;
					}else if(this.src == objTmp.reZoomBtn1Url){
						this.src = objTmp.reZoomBtn1OverUrl;
					}
				}
				this.zoomBtn1.onmouseout = function(){
					if(this.src == objTmp.reScreenBtnOverUrl){
						this.src = objTmp.reScreenBtnUrl;
					}else if(this.src == objTmp.zoomBtn1OverUrl){
						this.src = objTmp.zoomBtn1Url;
					}
				}*/
			}
				// 放大2按钮事件
			if(this.zoomBtn2){
				this.zoomBtn2.onclick = function(){
					objTmp.Zoom.call(objTmp,objTmp.w2Width,objTmp.w2Height,2);
				}
			}		
				//播放进度条事件
			this.pZone.onmousedown = function(){
				objTmp.MouseDown.call(objTmp,0);				
			}
			this.vZone.onmousedown = function(){
				objTmp.MouseDown.call(objTmp,1);
			}
				//绑定document事件
			document.onmousemove = function(){ objTmp.MouseMove.call(objTmp); }
			document.ondragstart = function(){ objTmp.MouseEnd.call(objTmp); }
			document.onmouseup = function(){ objTmp.MouseUp.call(objTmp); }
			document.onstop = function(){ objTmp.Stop.call(objTmp);}
			window.onunload = function(){
				objTmp.Clear.call(objTmp);
			}
	 	},
		/* 写<object>到页面 IE下 */
		Draw:function(){
			this.wObject.classid = "CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95";
			this.wObject.width				= this.wWidth;			//视频宽度
			this.wObject.height 			= this.wHeight;			//视频高度
			this.wObject.FileName			= "";					//视频文件
			this.wObject.AutoStart 			= this.autoStart;		//是否自动播放
			this.wObject.ShowStatusBar 		= true;					//状态条是否可见
			this.wObject.EnableContextMenu 	= false;				//是否显示右键菜单
			this.wObject.ShowControls 		= false;				//控制区域是否可见
			this.wObject.Volume 			= -600;					//音量
						
			this.wZone.appendChild(this.wObject);				//写入页面
		},
		Clear:function(){
			this.wObject = null;
			this.wEmbed = null;
		},
		/* 写<object>到页面 非IE下 */
		DrawToNS:function(){
			this.ctrZone.style.display = "none";
			this.wEmbed.type = "application/x-mplayer2";
			this.wEmbed.src = "";
			this.wEmbed.width = this.wWidth;
			this.wEmbed.height = this.wHeight;
			this.wEmbed.autostart = this.autoStart;
			this.wEmbed.showstatusbar = true;
			this.wEmbed.statusbar = true;
			this.wZone.appendChild(this.wEmbed);
		},		
		/*
		 * 静音 事件处理程序
		 * void Mute(bool)
		 * bool:可选
		 * 无参 静音与非静音交替
		 */
		Mute:function(bool){	
			if(bool == true){
				this.SetBtnState("mute");
				this.wObject.Mute = true;			
			}else if(bool == false){
				this.SetBtnState("muteNo");
				this.wObject.Mute = false;			
			}else if(this.wObject.Mute == false){
				this.SetBtnState("mute");
				this.wObject.Mute = true;			
			}else if(this.wObject.Mute == true){
				this.SetBtnState("muteNo");
				this.wObject.Mute = false;	
			}
		},
		/*
		 * 设置音量
		 * void setVolume:function(Number volNum)
		 * volNum:0-9
		 */
		SetVolume:function(volNum){
			if(typeof(volNum) != "number"){
				throw new Error("SetVolume(volNum)参数为number类型")			
			}
			if(volNum > 9){
				this.SetVolume(9);
			}else if(volNum < 0){
				this.SetVolume(0);
			}else{
				var tmpVol = (10 - volNum) * (-100);
				this.wObject.Volume = tmpVol;
				this.vBox.style.left = Math.round(this.vZoneWidth / 10 * volNum) + "px";
			}
		},
		/*
		 * 播放或暂停 事件处理程序
		 */
		PlayOrPauseHandler:function(){
			if(this.wObject.PlayState == 2){
				this.SetBtnState("pause");
				this.wObject.pause();
			}else {
				this.SetBtnState("play");
				this.wObject.play();	
			}
		},
		/*
		 * 播放
		 */
		Play:function(){
			if(this.wObject.PlayState != 1){//播放前 非暂停状态下 先停止
				this.wObject.stop();
			}
			//this.mplayerAd.style.display = "none";//this.SetTipDisplay();		//设置播放状态 提示iframe
			if(this.netModel == 0){
				this.wObject.FileName = this.curNarrowFile;
			}
			if(this.netModel == 1){
				this.wObject.FileName = this.curBroadFile;
			}
			if(this.autoStart == false){
				this.wObject.play();		//播放
			}
			this.SetBtnState("play");	//设置播放状态按钮			
		},
		/*
		 * 暂停
		 */
		Pause:function(){
			this.SetBtnState("pause");	//设置暂停状态按钮
			this.wObject.pause();		//暂停
		},
		/* 停止 */
		Stop:function(){
			this.SetBtnState("stop");	//设置停止状态按钮
			//this.mplayerAd.style.display = "block";//this.SetTipDisplay(this.tipExtendObj);	//设置停止状态 iframe
			this.wObject.stop();		//停止			
		},
		/* 全屏 */
		FullScreen:function(){
			//全屏条件：播放 或暂停
			if(this.wObject.PlayState == 1 || this.wObject.PlayState == 2){
				this.wObject.DisplaySize = 3;
			}
		},
		/*
		 * 选者网络模式
		 * void SelectNetModel()
		 */
		SelectNetModel:function(){
			this.wObject.stop();
			if(this.netModel == 0){
				this.SetBtnState("broad");
				//记录当前网络模式状态 并写入cookie
				this.netModel = 1;
				this.wObject.FileName = this.curBroadFile;				
				sina.SetCookie("bnTxtNetModel","1");			
			}else if(this.netModel == 1){
				this.SetBtnState("narrow");
				this.netModel = 0;
				this.wObject.FileName = this.curNarrowFile;
				sina.SetCookie("bnTxtNetModel","0");
			}else {
				throw new Error("当前this.netModel状态不正确");
			}			
			this.SetBtnState("play");		
			this.wObject.play();
		},
		/*
		 * 给进度条按钮定位 for setInterval("",1000) 
		 */ 
		FixPos:function(){
			if(this.wObject.Duration > 0){	
				 this.pBox.style.left = Math.round((this.pZoneWidth - this.pBoxWidth)/this.wObject.Duration*this.wObject.CurrentPosition);
				 if((this.wObject.Duration - this.wObject.CurrentPosition) < 1){
				 	this.Stop();
				 }
			}
			if(this.wObject.PlayState == 8){ //如果 Stream is not open 进度条滑块左归零
				this.pBox.style.left = "0px";	
			}
		},
		/* 鼠标按下播放进度区 事件处理程序 */
		MouseDown:function (objSign){
			this.isPorV = objSign;
			if(this.isPorV == 0){
				if(this.wObject.Duration > 0){
					this.pFlag = true;
					if(window.event.srcElement.id != this.pZone.id) this.pBox.style.left = this.pBox.offsetLeft+this.pBoxWidth;
					else this.pBox.style.left = window.event.x - this.pBoxWidth/2;
				}
			}else if(this.isPorV == 1){
				this.vFlag = true;
				if(window.event.srcElement.id != this.vZone.id){
					this.vBox.style.left = this.vBox.offsetLeft;
				}else{
					this.vBox.style.left = window.event.x - this.vBoxWidth/2;
				}
			}
		},
		MouseMove:function(){
			if(this.isPorV == 0){
				if(this.wObject.Duration > 0){
					if(this.pFlag){
						
						this.pBox.style.left = window.event.clientX - sina.GetOLeft(this.pZone) - this.pBoxWidth/2 + "px";
						
					}
					
					if (parseInt(this.pBox.style.left.replace("px","")) > (this.pZoneWidth - this.pBoxWidth)){
						this.pBox.style.left = this.pZoneWidth - this.pBoxWidth +"px";
					}
					if (parseInt(this.pBox.style.left.replace("px","")) < 0){
						//this.pBox.style.left= 0 + "px";
					}
				}
			}else if(this.isPorV == 1){
				if(this.vFlag){
					this.vBox.style.left = window.event.clientX - sina.GetOLeft(this.vZone) - 4 + "px";
				}
					if (parseInt(this.vBox.style.left.replace("px","")) > (this.vZoneWidth - this.vBoxWidth)){
						this.vBox.style.left = (this.vZoneWidth - this.vBoxWidth) + "px";
					}
					if (parseInt(this.vBox.style.left.replace("px","")) < 0){
						this.vBox.style.left = 0 + "px";
					}
			}
		},		
		MouseUp:function(){
			if(this.isPorV == 0){			
				if(this.wObject.Duration>0){
					if (this.pFlag){
						this.wObject.CurrentPosition = this.wObject.Duration * (parseInt(this.pBox.style.left.replace("px",""))/(this.pZoneWidth - this.pBoxWidth));
					}
					this.pFlag = false;
				}
			}else if(this.isPorV == 1){
				if (this.vFlag){
					var tmpVol = (1 - parseInt(this.vBox.style.left)/(this.vZoneWidth - this.vBoxWidth))*(-1000);
					if(tmpVol <= -1000){
						if(this.wObject.Mute.toString().toLowerCase() == 'false'){
							this.wObject.Mute = true;
							this.SetBtnState("mute"); 
						}
					}else{
						if(this.wObject.Mute.toString().toLowerCase()== 'true'){
							this.wObject.Mute = false;
							this.SetBtnState("muteNo");
						}
					}
					this.wObject.Volume = Math.round(tmpVol);
				}
				this.vFlag = false;
			}
		},
		MouseEnd:function(){
			if(this.wObject.Duration > 0){
				window.event.returnValue = false;
			}
		},
		/*
		 * 设置当前要播放的视频url
		 * void SetCurFile(String curTelecomFile,String curNetcomFile,curAdurl)
		 * curBroadFiled	:当前宽频的url
		 * curNarrowFile	:当前窄频的url
		 * curAdurl			: 可选 当前视频的缓冲广告url
		 */
		SetCurFile:function(curBroadFile,curNarrowFile,curAdurl){
			this.curBroadFile = curBroadFile;
			this.curNarrowFile	= curNarrowFile;
			if(curAdurl){
				this.defaultAdurl = curAdurl;
			}
			if(!sina.isIE){
				alert("提示: \n请使用 Microsoft Internet Explorer 浏览器观看")
				if(this.netModel == 0) this.wEmbed.src = this.curNarrowFile;
				if(this.netModel == 1) this.wEmbed.src = this.curBroadFile;
				//this.wEmbed.play();
				return;
			}
			//如果播放器的url不为空 则在更改url前 先stop一次 
			if(this.wObject.PlayState != 0 || this.wObject.FileName != ""){
				this.wObject.stop();
			}
			//if(!this.autoStart){
				//this.Play();
			//}
			if(this.netModel == 0){
				this.wObject.FileName = this.curNarrowFile;
			}
			if(this.netModel == 1){
				this.wObject.FileName = this.curBroadFile;
			}
			this.SetBtnState("play");
		},
		/*
		 * 调整视频尺寸 void Zoom(width,height);
		 * width,height :number
		 */
		Zoom:function(width,height,zoomFlag){
			/* 还原视频大小 */
			if(arguments.length == 1 && arguments[0] == 0){
				if(this.wObject.width != this.wWidth){
					/* 设置视频 */
					this.wObject.width = this.wWidth;
					this.wObject.height = this.wHeight;			
					/* 设置播放器容器 */
					this.wmZone.style.width = this.wWidth + "px";
					this.wmZone.style.height = this.wHeight + 60 + "px";
					/* 设置视频容器 */
					this.wZone.style.width = this.wWidth + "px";
					this.wZone.style.height = this.wHeight + "px";
					/* 设置iframe部分 
					this.tipExtendObj.style.width = width + "px";
					this.tipExtendObj.style.height = height + "px";
					this.tipDloadObj.style.width = width + "px";
					this.tipDloadObj.style.height = height + "px";*/
					/* 设置放大按钮状态 */
					this.SetBtnState("zoom2");
					this.SetBtnState("zoom1");
				}
				return;
			}
			/* 滚动到视频区域 */
			var wObjectPosTop = sina.GetOffsetPos(this.wObject)[1] - 10;
			window.scrollTo(0,wObjectPosTop);
			//var curWidth
			if(this.wObject.width != width){				
				/* 设置视频 */
				this.wObject.width = width;
				this.wObject.height = height;			
				/* 设置播放器容器 */
				this.wmZone.style.width = width + "px";
				this.wmZone.style.height = height + 60 + "px";
				/* 设置视频容器 */
				this.wZone.style.width = width + "px";
				this.wZone.style.height = height + "px";
				/* 设置iframe部分 
				this.tipExtendObj.style.width = width + "px";
				this.tipExtendObj.style.height = height + "px";
				this.tipDloadObj.style.width = width + "px";
				this.tipDloadObj.style.height = height + "px";*/
				/* 设置放大按钮状态 */
				if(zoomFlag == 1){
					this.SetBtnState("reZoom1");
					this.SetBtnState("zoom2");
				}else if(zoomFlag == 2){
					this.SetBtnState("reZoom2");
					this.SetBtnState("zoom1");
				}				
			}else{
				/* 设置视频 */
				this.wObject.width = this.wWidth;
				this.wObject.height = this.wHeight;			
				/* 设置播放器容器 */
				this.wmZone.style.width = this.wWidth + "px";
				this.wmZone.style.height = this.wHeight + 60 + "px";
				/* 设置视频容器 */
				this.wZone.style.width = this.wWidth + "px";
				this.wZone.style.height = this.wHeight + "px";
				/* 设置iframe部分 
				this.tipExtendObj.style.width = this.wWidth + "px";
				this.tipExtendObj.style.height = this.wHeight + "px";
				this.tipDloadObj.style.width = this.wWidth + "px";
				this.tipDloadObj.style.height = this.wHeight + "px";*/
				/* 设置放大按钮状态 */
				this.SetBtnState("zoom1");
				this.SetBtnState("zoom2");				
			}
		},
		/*
		 * 设置播放器按钮的状态
		 * void SetBtnState(String state)
		 * state:
		 * play:	将按钮置于 播放状态
		 * pause:	将按钮置于 暂停状态
		 * stop:	将按钮置于 暂停状态
		 * mute:	将静音按钮置于 静音状态
		 * muteNo:	将静音按钮置于 非静音状态
		 * narrow:	将播放模式置于 流畅模式
		 * broad:	将播放模式置于 清晰模式
		 */
		SetBtnState:function(state){
			switch(state){
				case "play":
					this.playBtn.setAttribute("src",this.pauseBtnUrl);
					this.playBtn.setAttribute("alt",this.pauseBtnAlt);
					this.stopBtn.setAttribute("src",this.stopBtnUrl);
					this.stopBtn.setAttribute("alt",this.stopBtnAlt);
					this.stopBtn.style.cursor = "hand";
					this.fullScreenBtn.setAttribute("src",this.fullScreenBtnUrl);
					this.fullScreenBtn.style.cursor = "hand";
					this.fullScreenBtn.setAttribute("alt",this.fullScreenBtnAlt);	
					break;
				case "pause":
					this.playBtn.setAttribute("src",this.playBtnUrl);
					this.playBtn.setAttribute("alt",this.playBtnAlt);
					this.stopBtn.setAttribute("src",this.stopBtnUrl);
					this.stopBtn.setAttribute("alt",this.stopBtnAlt);
					this.stopBtn.style.cursor = "hand";
					break;
				case "stop":
					this.stopBtn.setAttribute("src",this.stopBtnNoneUrl);
					this.stopBtn.setAttribute("alt","");
					this.stopBtn.style.cursor = "default";				
					this.playBtn.setAttribute("src",this.playBtnUrl);
					this.playBtn.setAttribute("alt",this.playBtnAlt);
					this.fullScreenBtn.setAttribute("src",this.fullScreenBtnNoneUrl);
					this.fullScreenBtn.style.cursor = "default";
					this.fullScreenBtn.setAttribute("alt","");				
					break;
				case "muteNo":
					this.muteBtn.setAttribute("src",this.muteBtnNoUrl);
					this.muteBtn.setAttribute("alt",this.muteBtnNoAlt);
					break;
				case "mute":
					this.muteBtn.setAttribute("src",this.muteBtnUrl);
					this.muteBtn.setAttribute("alt",this.muteBtnAlt);
					break;
				case "narrow":
					this.bOrNBtn.setAttribute("src",this.broadBtnUrl);
					this.bOrNBtn.style.cursor = "hand";
					this.bOrNBtn.setAttribute("alt",this.broadBtnAlt);
					break;
				case "broad":
					this.bOrNBtn.setAttribute("src",this.narrowBtnUrl);
					this.bOrNBtn.style.cursor = "hand";
					this.bOrNBtn.setAttribute("alt",this.narrowBtnAlt);
					break;
				case "zoom1":
					if(this.zoomBtn1){
						this.zoomBtn1.setAttribute("src",this.zoomBtn1Url);
						this.zoomBtn1.setAttribute("alt",this.zoomBtn1Alt);
						this.zoomBtn1.style.cursor = "hand";
					}
					break;
				case "reZoom1":
					if(this.zoomBtn1){
						this.zoomBtn1.setAttribute("src",this.reZoomBtn1Url);
						this.zoomBtn1.setAttribute("alt",this.reZoomBtn1Alt);
						this.zoomBtn1.style.cursor = "hand";
					}
					break;
				case "zoom2":
					if(this.zoomBtn2){
						this.zoomBtn2.setAttribute("src",this.zoomBtn2Url);
						this.zoomBtn2.setAttribute("alt",this.zoomBtn2Alt);
						this.zoomBtn2.style.cursor = "hand";
					}
					break;
				case "reZoom2":
					if(this.zoomBtn2){
						this.zoomBtn2.setAttribute("src",this.reZoomBtn2Url);
						this.zoomBtn2.setAttribute("alt",this.reZoomBtn2Alt);
						this.zoomBtn2.style.cursor = "hand";
					}
					break;				
				default :
					throw new Error("SetBtnState(String state) 参数不正确");
			}
		}
	}
/*
 * 
MediaPlayer.PlayState
Possible Values
This property is a read-only Long containing one of the following values.
Value Visual Basic constant Description 
0 mpStopped		Playback is stopped. 
1 mpPaused		Playback is paused. 
2 mpPlaying 	Stream is playing. 
3 mpWaiting		Waiting for stream to begin. 
4 mpScanForward	Stream is scanning forward. 
5 mpScanReverse	Stream is scanning in reverse. 
6 mpSkipForward	Skipping to next. 
7 mpSkipReverse	Skipping to previous. 
8 mpClosed		Stream is not open. 
 */