<!--
function LoadMovie(){
	MediaPlayer.url='http://www.crossmission.org/wmv/loading.wmv';
	MediaPlayer.controls.play();
}
function PlayMovie(myID){
	if (myID==''){
		alert('This Channel is under construction!');
	}else{
		//LoadMovie();
		switch(myID){
		case "1":
		  ProgramForm.ProgramUUID.value='5dd2be7a-f15f-4bb0-b3eb-fada577a70e9';//ching
		  break;
		case "2":
		  ProgramForm.ProgramUUID.value='ed293294-d89a-4001-a76a-501dedd4de74';//goodtv
		  break;
		case "3":
		  ProgramForm.ProgramUUID.value='a491058d-0d94-4f68-836a-d244007a92d0';//GNCI
		  break;
		case "4":
		  ProgramForm.ProgramUUID.value='9fc68ee2-319d-456a-a286-de8062e913ad';//SOBEM
		  break;
		}
		document.getElementById("PlayMovie").click();
	}
}
function StartChannel(myCH){
	if (BrowserDetect.browser=='Explorer'){
		OrbitLive_Close()
		PlayMovie(myCH);
	} else {
		alert('請使用IE7或以上瀏覽!');
	}
}


OrbitDownloader.Update('OrbitLive');

try{
  ShowRecentlyOpened();
}
catch(e){
}

function ShowDebugInfo(btn){
	DebugInfoTable.style.display=DebugInfoTable.style.display=="none"?"block":"none";
}
function OrbitDownloaderEventHandler(eventCode){
	AddMonitor("OrbitDownloader "+eventCode+" "+OrbitDownloader.Progress);
	if(typeof(OrbitDownloaderProgressInterval)!="undefined") clearInterval(OrbitDownloaderProgressInterval);
	if(eventCode==0) {//DownloadStart
		OrbitDownloaderProgressDone.style.width=0;
		OrbitDownloaderProgressInterval=setInterval("AddMonitor('OrbitDownloader ' + OrbitDownloader.Progress + '%');OrbitDownloaderProgressPercent.innerHTML=OrbitDownloader.Progress;OrbitDownloaderProgressDone.style.width=OrbitDownloader.Progress*3;", 500);
	}else if(eventCode==1){//DownloadOK
	}else if(eventCode==2){//InstallOK
		CreateOrbitLive();
	}else if(eventCode==-1 || eventCode==-2) {//DownloadError	InstallError
	}else{
	}
	OrbitDownloaderProgress.style.display=eventCode==2?"none":"block";
	OrbitDownloaderProgressDownloading.style.display=eventCode==0?"block":"none";
	OrbitDownloaderProgressInstalling.style.display=eventCode==1?"block":"none";
	OrbitDownloaderProgressError.style.display=eventCode<0?"block":"none";
}
function PopupWindow(programUUID){
	window.open("OrbitLivePopup.html?ProgramUUID="+programUUID,"OrbitLive","status=no,toolbar=no,menubar=no,location=no,scrollbars=no,titlebar=no,resizable=yes");
}
function OrbitLive_Open(programUUID){
	AddMonitor("OrbitLive_Open(\""+programUUID+"\")");
	MediaPlayer.controls.stop();
	if(typeof(OrbitLive)=="object"&&typeof(OrbitLive.OrbitLive_Open)!="undefined"){
		OrbitLive.OrbitLive_Open("Orbit",2008122511,programUUID);
	}
	MediaPlayerURL="";
	try{
		SetRecentlyOpened(programUUID)
		ShowRecentlyOpened();
	}
	catch(e){
	}
}
function OrbitLive_Close(){
	AddMonitor("OrbitLive_Close()");
	MediaPlayer.controls.stop();
	if(typeof(OrbitLive)=="object"&&typeof(OrbitLive.OrbitLive_Close)!="undefined"){
		OrbitLive.OrbitLive_Close();
	}
}
function CreateOrbitLive(){
	AddMonitor("CreateOrbitLive()");
	if(typeof(OrbitLiveInterval)!="undefined") clearInterval(OrbitLiveInterval);
	OrbitLiveDiv.innerHTML='<object id="OrbitLive" classid="clsid:06FFD772-4C82-4CCA-BDE8-977C9431162F" width="0" height="0" style="background-color:Olive;">';
	OrbitLiveInterval=setInterval("IntervalFunction()",1000);
}
function DestroyOrbitLive(){
	AddMonitor("DestroyOrbitLive()");
	if(typeof(OrbitLiveInterval)!="undefined") clearInterval(OrbitLiveInterval);
	MediaPlayer.controls.stop();
	if(typeof(OrbitLive)=="object"&&typeof(OrbitLive.OrbitLive_Term)!="undefined"){
		OrbitLive.OrbitLive_Term();
	}
	OrbitLiveDiv.innerHTML="";
	OrbitLiveInterval=setInterval("IntervalFunction()",1000);
}
function RunScript(script){
	RunScriptTextArea.value=script;
	AddMonitor("Run "+RunScriptTextArea.value);
	var ret="";
	try{
		ret=eval(RunScriptTextArea.value);
	}
	catch(e){
		ret=e;
	}
	AddMonitor("Result "+ret);
}
function IntervalFunction(){
	if(typeof(OrbitLive)!="object"){
		AddMonitor(".");
	} else if(typeof(OrbitLive.OrbitLive_Status)=="undefined") {
		DestroyOrbitLive();
	} else {
		OrbitLive_Status=OrbitLive.OrbitLive_Status;
		OrbitLive_StreamUrl=OrbitLive.OrbitLive_StreamUrl;
		AddMonitor(OrbitLive_Status+" "+OrbitLive_StreamUrl);
		if(OrbitLive_Status==4){
			if(MediaPlayerURL!=OrbitLive_StreamUrl){
				MediaPlayerURL=OrbitLive_StreamUrl;
				MediaPlayer.URL=OrbitLive_StreamUrl;
				MediaPlayer.controls.play();
			}
		} else if(OrbitLive_Status<1){
			if(typeof(OrbitLiveInterval)!="undefined") clearInterval(OrbitLiveInterval);
		} else if(OrbitLive_Status!=3){
			//MediaPlayer.controls.stop();
		}
	}
}
function AddMonitor(content){
	MonitorTextAreaValue=MonitorTextArea.value;
	if(content=="."){
		if(MonitorTextAreaValue.length>0&&MonitorTextAreaValue.charAt(0)!='.'){
			MonitorTextAreaValue=content+"\r\n"+MonitorTextAreaValue;
		}
		MonitorTextAreaValue=content+" "+MonitorTextAreaValue;
	}else{
		MonitorTextAreaValue=new Date().toLocaleTimeString()+" "+content+"\r\n"+MonitorTextAreaValue;
	}
	MonitorTextArea.value=MonitorTextAreaValue.length>100000?MonitorTextAreaValue.substr(0,90000):MonitorTextAreaValue;
}
function GetCookie(sName){
	var aCookie=document.cookie.split("; ");
	for (var i=0; i<aCookie.length; i++){
		var aCrumb=aCookie[i].split("=");
		if (sName==aCrumb[0])
			return unescape(aCrumb[1]);
	}
	return "";
}
function SetCookie(sName, sValue){
	if(sValue==""){
		date="; expires=Fri, 21 Dec 1976 04:31:24 GMT;";
	}else{
		date="; expires=Fri, 31 Dec 2099 23:59:59 GMT;";
	}
	document.cookie=sName+"="+escape(sValue)+date;
}
function SetRecentlyOpened(programUUID){
	var programUUIDs=GetCookie("ProgramUUIDs");
	if(programUUID.length==36){
		programUUIDs=programUUIDs.replace(" " + programUUID, "")+" "+programUUID;
		SetCookie("ProgramUUIDs", programUUIDs);
	}
}
function ShowRecentlyOpened(){
	var programUUIDs=GetCookie("ProgramUUIDs");
	var mIds=programUUIDs.split(" ");
	RecentlyOpened_innerHTML="";
	for(var i=0; i<mIds.length; i++){
		if(mIds[i].length==36){
			RecentlyOpened_innerHTML='<button onclick="RunScript(innerText)" style="width:95%;">OrbitLive_Open("<span style="font-family: DFKai-SB">'+mIds[i]+'</span>")</button><br />'+RecentlyOpened_innerHTML;
		}
	}
	if(RecentlyOpened_innerHTML.length>0){
		RecentlyOpened.innerHTML=RecentlyOpened_innerHTML;
	}
}
//-->
