
function libVDCSPlay()
{
	this._param=new Array();
	this._id="";
	this._url="";
	this._name="";
	this._type=""; 
	this._width=-1; 
	this._height=-1;
	this._html="";
	
	this.setParam=function(strKey,strValue) { this._param[strKey]=strValue; }
	this.getParam=function(strKey) { return this._param[strKey]; }
	//uimode	= full,window,control,none
	
	this.setID=function(strer) { this._id=strer; }  
	this.setURL=function(strer) { this._url=strer; } 
	this.setName=function(strer) { this._name=strer; }
	this.setType=function(strer) { if (strer=='real') strer='rm'; this._type=strer; } 
	this.setSize=function(strWidth,strHeight) { this._width=strWidth; this._height=strHeight; } 
	
	this.getHTML=function() { return this._html; }
	
	this.doParse=function()
	{
		switch (this._type)
		{
			case "wmp":
				this._html=this.toWMP();
				//alert(this._html)
				break; 
			case "rm":
				this._html=this.toRM();
				break;
			case "flv":
				this._html=this.toFLV();
				//alert(this._html)
				break; 
		}
	}
	
	this.toWMP=function()
	{
		var re="";
		var tmpMode=this.getParam("uimode");
		if (tmpMode=="control")
		{
			
			re+="<object id=\""+this._id+"\" name=\""+this._id+"\" style=\"filter:Xray();\" border=\"0\" width=\""+this._width+"\" height=\""+this._height+"\" classid=\"CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6\" type=\"application/x-oleobject\" standby=\"loading...\">";
			re+="<param name=\"url\" value=\""+this._url+"\">";
			re+="<param name=\"AutoStart\" value=\"1\">";
			re+="<param name=\"Balance\" value=\"0\">";
			re+="<param name=\"enabled\" value=\"1\">";
			re+="<param name=\"EnableContextMenu\" value=\"1\">";
			re+="<param name=\"ShowDisplay\" value=\"0\">";
			re+="<param name=\"AutoReplay\" value=\"1\">";
			re+="<param name=\"PlayCount\" value=\"100\">";
			re+="<param name=\"rate\" value=\"1\">";
			re+="<param name=\"currentPosition\" value=\"0\">";
			re+="<param name=\"currentMarker\" value=\"0\">";
			re+="<param name=\"defaultFrame\" value=\"\">";
			re+="<param name=\"invokeURLs\" value=\"0\">";
			re+="<param name=\"baseURL\" value=\"\">";
			re+="<param name=\"stretchToFit\" value=\"0\">";
			re+="<param name=\"volume\" value=\"50\">";
			re+="<param name=\"mute\" value=\"0\">";
			re+="<param name=\"uiMode\" value=\"full\">";
			re+="<param name=\"windowlessVideo\" value=\"0\">";
			re+="<param name=\"fullScreen\" value=\"0\">";
			re+="<param name=\"enableErrorDialogs\" value=\"-1\">";
			

			
			/*
			re+="<object id=\""+this._id+"\" name=\""+this._id+"\" border=\"0\" width=\""+this._width+"\" height=\""+this._height+"\" classid=\"CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6\" type=\"application/x-oleobject\" standby=\"loading...\">";
			re+="<param name=\"invokeURLs\" value=\"0\">";
			re+="<param name=\"url\" value=\""+this._url+"\">";
			re+="<param name=\"ShowPositionControls\" value=\"1\">";
			re+="<param name=\"ShowTracker\" value=\"1\">";
			re+="<param name=\"ShowDisplay\" value=\"0\">";
			re+="<param name=\"ShowControls\" value=\"1\">";
			re+="<param name=\"ShowAudioControls\" value=\"1\">";
			re+="<param name=\"ShowStatusBar\" value=\"1\">";
			re+="<param name=\"ShowGotoBar\" value=\"0\">";
			re+="<param name=\"ShowCaptioning\" value=\"0\">";
			re+="<param name=\"AutoSize\" value=\"0\">";
			re+="<param name=\"AutoStart\" value=\"1\">";
			re+="<param name=\"PlayCount\" value=\"10\">";
			re+="<param name=\"AnimationAtStart\" value=\"0\">";
			re+="<param name=\"TransparentAtStart\" value=\"0\">";
			re+="<param name=\"AllowScan\" value=\"0\">";
			re+="<param name=\"EnableContextMenu\" value=\"0\">";
			re+="<param name=\"ClickToPlay\" value=\"0\">";
			re+="<param name=\"DefaultFrame\" value=\""+this._id+"\">";
			*/
			
			
			re+="<embed id=\""+this._id+"\" border=\"0\" width=\""+this._width+"\" height=\""+this._height+"\" type=\"application/x-mplayer2\" ";
			re+="pluginspage=\"http://www.microsoft.com/isapi/redir.dll?prd=windows&amp;sbp=mediaplayer&amp;ar=media&amp;sba=plugin&amp;\" ";
			re+="src=\""+this._url+"\" ";
			re+="showcontrols=\"1\" showpositioncontrols=\"0\" ";
			re+="showaudiocontrols=\"1\" showtracker=\"1\" showdisplay=\"0\" ";
			re+="showstatusbar=\"1\" ";
			re+="autosize=\"0\" ";
			re+="showgotobar=\"0\" showcaptioning=\"0\" autostart=\"1\" autorewind=\"0\" ";
			re+="animationatstart=\"0\" transparentatstart=\"0\" allowscan=\"1\" playcount=\"0\" ";
			re+="enablecontextmenu=\"1\" clicktoplay=\"0\"  ";
			re+="defaultframe=\""+this._id+"\" invokeurls=\"0\"> ";
			re+="</embed>";
			re+="</object>";
		}
		else
		{
			
			
			re+="<object id=\""+this._id+"\" name=\""+this._id+"\" style=\"filter:Xray();\" border=\"0\" width=\""+this._width+"\" height=\""+this._height+"\" classid=\"CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6\" type=\"application/x-oleobject\" standby=\"loading...\">";
			re+="<param name=\"url\" value=\""+this._url+"\">";
			re+="<param name=\"AutoStart\" value=\"1\">";
			re+="<param name=\"Balance\" value=\"0\">";
			re+="<param name=\"enabled\" value=\"1\">";
			re+="<param name=\"EnableContextMenu\" value=\"1\">";
			re+="<param name=\"ShowDisplay\" value=\"0\">";
			re+="<param name=\"AutoReplay\" value=\"1\">";
			re+="<param name=\"PlayCount\" value=\"100\">";
			re+="<param name=\"rate\" value=\"1\">";
			re+="<param name=\"currentPosition\" value=\"0\">";
			re+="<param name=\"currentMarker\" value=\"0\">";
			re+="<param name=\"defaultFrame\" value=\"\">";
			re+="<param name=\"invokeURLs\" value=\"0\">";
			re+="<param name=\"baseURL\" value=\"\">";
			re+="<param name=\"stretchToFit\" value=\"0\">";
			re+="<param name=\"volume\" value=\"50\">";
			re+="<param name=\"mute\" value=\"0\">";
			re+="<param name=\"uiMode\" value=\"full\">";
			re+="<param name=\"windowlessVideo\" value=\"0\">";
			re+="<param name=\"fullScreen\" value=\"0\">";
			re+="<param name=\"enableErrorDialogs\" value=\"-1\">";
			
			/*
			re+="<object id=\""+this._id+"\" name=\""+this._id+"\" border=\"0\" width=\""+this._width+"\" height=\""+this._height+"\" classid=\"CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6\" type=\"application/x-oleobject\" standby=\"loading...\">";
			re+="<param name=\"invokeURLs\" value=\"0\">";
			re+="<param name=\"baseURL\" value=\"\">";
			re+="<param name=\"URL\" value=\""+this._url+"\">";
			//re+="<param name=\"Album\" value=\""+this._name+"\"/>";
			re+="<param name=\"Rate\" value=\"1\">";	//1.0-2.0
			re+="<param name=\"AutoStart\" value=\"1\">";
			re+="<param name=\"Balance\" value=\"0\">";
			re+="<param name=\"enabled\" value=\"-1\">";
			re+="<param name=\"EnableContextMenu\" value=\"-1\">";
			re+="<param name=\"PlayCount\" value=\"0\">";
			re+="<param name=\"currentPosition\" value=\"0\">";
			re+="<param name=\"currentMarker\" value=\"0\">";
			re+="<param name=\"stretchToFit\" value=\"0\">";
			re+="<param name=\"volume\" value=\"80\">";
			re+="<param name=\"mute\" value=\"0\">";
			switch(tmpMode)
			{
				case "none":
					tmpMode="invisible";
					break;
				case "window":
					tmpMode="None";
					break;
				case "control":
					tmpMode="mini";
					break;
				default :
					tmpMode="Full";
					break;
			}
			re+="<param name=\"uiMode\" value=\""+tmpMode+"\">";
			re+="<param name=\"windowlessVideo\" value=\"0\">";	//isfull
			re+="<param name=\"fullScreen\" value=\"0\">";
			re+="<param name=\"enableErrorDialogs\" value=\"-1\">";
			re+="<param name=\"SAMIStyle\" value=\"\">";
			re+="<param name=\"SAMILang\" value=\"\">";
			re+="<param name=\"SAMIFilename\" value=\"\">";
			re+="<param name=\"DefaultFrame\" value=\""+this._id+"\">";
			*/
			re+="</object>";
		}

		return re;
	}
	
	this.toRM=function()
	{
		var _control_height=60;
		var re="";
		var tmpMode=this.getParam("uimode");
		if (isEmpty(tmpMode)) tmpMode="full";
		if (tmpMode=="full" || tmpMode=="window")
		{
			re+="<object id=\""+this._id+"\" name=\""+this._id+"\" width=\""+this._width+"\" height=\""+this._height+"\" classid=\"clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa\">";
			re+="<param name=\"src\" value=\""+this._url+"\">";
			re+="<param name=\"console\" value=\"Joekoe_CMS_3_real_clip1\">";
			re+="<param name=\"controls\" value=\"imagewindow\">";
			re+="<param name=\"autostart\" value=\"true\">";
			re+="<embed type=\"audio/x-pn-realaudio-plugin\" console=\""+this._id+"_clip\" controls=\"ImageWindow\" width=470 height=350></embed>";
			re+="</object>";
		}
		if (tmpMode=="full" || tmpMode=="control")
		{
			re+="<object id=\""+this._id+"_control\" name=\""+this._id+"_control\" width=\""+this._width+"\" height=\""+_control_height+"\" classid=\"clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa\">";
			re+="<param name=\"src\" value=\""+this._url+"\">";
			re+="<param name=\"console\" value=\"Joekoe_CMS_3_real_clip1\">";
			re+="<param name=\"controls\" value=\"ControlPanel,StatusBar\">";
			re+="<param name=\"autostart\" value=\"-1\">";
			re+="<param name=\"shuffle\" value=\"0\">";
			re+="<param name=\"prefetch\" value=\"0\">";
			re+="<param name=\"nolabels\" value=\"0\">";
			re+="<param name=\"loop\" value=\"0\">";
			re+="<param name=\"numloop\" value=\"0\">";
			re+="<param name=\"center\" value=\"0\">";
			re+="<param name=\"maintainaspect\" value=\"0\"> ";
			re+="<embed type=\"audio/x-pn-realaudio-plugin\" console=\""+this._id+"_clip\" controls=\"ControlPanel,StatusBar\" width=470 height=60></embed>";
			re+="</object>";
		}
		return re;
	}

	
	this.toFLV=function()
	{
		var re="";
		var tmpMode=this.getParam("uimode");
		this._url = this.toRealAddress(this._url);
		if (tmpMode=="control")
		{
			
			re+="<object id=\""+this._id+"\" name=\""+this._id+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\""+this._width+"\" height=\""+this._height+"\">";
			re+="<param name=\"movie\" value=\"http://www.djpx.net/images/Flvplayer.swf\" />";
			re+="<param name=\"quality\" value=\"high\" />";
			re+="<param name=\"allowFullScreen\" value=\"true\" />";
			re+="<param name=\"FlashVars\" value=\"vcastr_file="+this._url+"&LogoText=www.djpx.net&BufferTime=3\" />";
			re+="</object>";

		}
		else
		{
			re+="<object id=\""+this._id+"\" name=\""+this._id+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\""+this._width+"\" height=\""+this._height+"\">";
			re+="<param name=\"movie\" value=\"http://www.djpx.net/images/Flvplayer.swf\" />";
			re+="<param name=\"quality\" value=\"high\" />";
			re+="<param name=\"allowFullScreen\" value=\"true\" />";
			re+="<param name=\"FlashVars\" value=\"vcastr_file="+this._url+"&LogoText=www.djpx.net&BufferTime=3\" />";
			re+="</object>";
		}

		return re;
	}
	
	this.toRealAddress=function(strer)
	{
		var re = '';
		re = this.getFileContent(strer)
	
		return re;
	}
	
	
		
	this.getFileContent=function(strURL){
		var tmpDate = new Date()
		
		if (strURL.substring(0,7)=='http://'){
			tmpURL = strURL
		}else{
			var tmpTempURL = location.pathname;
			var tmpNowURL=document.URL;
				tmpNowURL=tmpNowURL.slice(tmpNowURL.lastIndexOf("/")+1,tmpNowURL.length);
				if(tmpNowURL.indexOf("?")!=-1) tmpNowURL=tmpNowURL.slice(0,tmpNowURL.indexOf("?"));
			var tmpTempURL = tmpTempURL.replace(tmpNowURL,'');
			var tmpURL=location.protocol+"//"+location.hostname+tmpTempURL+strURL+'&v='+(tmpDate.getHours()+''+tmpDate.getMinutes()+''+tmpDate.getSeconds()); 
		}
		var objxml=  document.all?new ActiveXObject("Microsoft.XMLHttp"):new XMLHttpRequest() ;
		//alert(tmpURL)
		objxml.open("GET",tmpURL,false);
		objxml.send(null);
		var reData=objxml.responseText;
		//alert(reData)
		if (objxml.status=="200"){
			if (reData.length < 1) reData = "";
			return reData;
		}else{
			return "";
		}
	}

	this.getTimes=function(strer)
	{
		var tmpObject=$((isEmpty(strer) ? this._id : strer));
		var re=-1;
		switch (this._type)
		{
			case "wmp":
				re=tmpObject.GetLength();
				break; 
			case "rm":
				re=tmpObject.GetLength();
				break;
		}
		return re;
	}
	
	this.getTimeAry=function(strer)
	{
		var re=new Array();
		re[1]=0; re[2]=0; re[3]=0; re[4]=0;
		var tmpTimes=this.getTimes(strer);
		var tmpSeconds=parseInt(tmpTimes/1000);
		re[4]=tmpTimes-tmpSeconds*1000;
		var tmpNum=tmpSeconds;
		re[3]=tmpNum;
		if (tmpNum>60)
		{
			tmpNum=parseInt(tmpNum/60);
			re[2]=tmpNum;
			re[3]=tmpSeconds-tmpNum*60;
		}
		if (tmpNum>60)
		{
			tmpNum=parseInt(tmpNum/60);
			re[1]=tmpNum;
			re[2]=re[2]-tmpNum*60;
		}
		return re;
	}
}

dcs.play=new Object();

dcs.play.doFullScreen=function()
{
	var g_Browser = navigator.appName;
	var wmp_state="1";
	if (g_Browser == "Netscape")
		{ wmp_state = document.Joekoe_CMS_3_wmp.GetPlayState(); }
	else
		{ wmp_state = document.Joekoe_CMS_3_wmp.PlayState; }
	if(wmp_state!="3")
		{ alert("影片还未开始播放或已结束，无法切换为全屏模式！\n\n请在影片播放时使用 “全屏播放” 功能。") }
	else
		{ document.Joekoe_CMS_3_wmp.fullScreen=1; }
}
