﻿
var appVideo=new Object();
appVideo._data=new Array();
appVideo._player=new Array();

appVideo.getData=function(strKey) { return this._data[strKey]; }
appVideo.setData=function(strKey,strValue) { this._data[strKey]=strValue; }

appVideo.setScreen=function()
{
	if (this._data['type']=='wmp')
	{
		var g_Browser = navigator.appName;
		var wmp_state="1";
		//alert(g_Browser);
		if (g_Browser == "Netscape")
		{ wmp_state = document.video_play_fix.GetPlayState(); }
		else
		{ wmp_state = document.video_play_fix.PlayState;}
		if(wmp_state!="3")
		{ alert("音像还未开始播放或已结束，无法切换为全屏模式！\n\n请在音像播放时使用 “全屏播放” 功能。"); }
		else
		{ 
			document.video_play_fix.fullScreen=true;
		}
	}else{
		document.video_play_fix.SetFullScreen();
	}
}

appVideo.doFixPlay=function(strID,strFixID)
{
	var tmpDIV=$("div-view-player");
	if (isObject(tmpDIV))
	{
		var tmpDisplay=tmpDIV.style.display;
		if (tmpDisplay=="none") tmpDIV.style.display=(tmpDisplay=="") ? "none" : "";
		var tmpType=this._data['type'];
		if (isEmpty(tmpType)) tmpType='wmp';
		this._player=new libVDCSPlayer();
		this._player.setID("video_play_fix");
		this._player.setType(tmpType);
		this._player.setName($("name-"+strFixID).innerHTML);
		this._player.setURL("url.asp?action=play&id="+strID+"&fixid="+strFixID);
		this._player.setSize(546,340);
		this._player.doParse();
		try
		{
			tmpDIV.style.display="";
			tmpDIV.innerHTML=this._player.getHTML();
			window.setTimeout("appVideo.doFixPlayInfo()",1000);
		}
		catch(e) { dbg.e(e); }
	}
	return false;
}



appVideo.doFixPlayInfo=function()
{
	var tmpTimes=this._player.getTimes();
	var tmpObject=$("div-view-play-times");
	if (tmpTimes>0 && tmpObject)
	{
		tmpObject.style.display="";
		var tmpAry=this._player.getTimeAry();
		if ($("fix-play-hour")) $("fix-play-hour").innerHTML=tmpAry[1];
		if ($("fix-play-minute")) $("fix-play-minute").innerHTML=tmpAry[2];
		if ($("fix-play-second")) $("fix-play-second").innerHTML=tmpAry[3];
		//alert(tmpAry[1]+":"+tmpAry[2]+":"+tmpAry[3]+"."+tmpAry[4]);
	}
}

appVideo.doFixDownload=function(strID,strFixID)
{
	var tmpURL="url.asp?action=download&id="+strID+"&fixid="+strFixID;
	var tmpDIV=$("div-view-downloader");
	if (isObject(tmpDIV))
	{
		var tmpValue="<a href=\""+tmpURL+"\">点击下载此音像资料</a>";
		try
		{
			tmpDIV.style.display="";
			tmpDIV.innerHTML=tmpValue;
		}
		catch(e) { dbg.e(e); }
	}
	var tmpObjectURL=$("fix-download-url");
	if (isObject(tmpObjectURL))
	{
		try
		{
			tmpObjectURL.innerHTML=tmpURL;
		}
		catch(e) { dbg.e(e); }
	}
	return false;
}
