﻿var mbcURL="http://www.mbc.org.mo/";
getNode=function(nodeId) {
 var node=document.getElementById(nodeId);
 return node;
}

setNode=function(nodeId,value) {
  var node=document.getElementById(nodeId);
  node.value=value;
}

function GetXmlHttpObject() {
  var XMLHttp=null;
  if (window.XMLHttpRequest) {
	XMLHttp=new XMLHttpRequest()
  } else if (window.ActiveXObject) {
  try {
	XMLHttp=new ActiveXObject("Msxml2.XMLHTTP");
     }catch(e) {
	XMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
     }
  }
 return XMLHttp;
}

function LayerNews_stateChanged() 
{ 
   if (LayerNews_xmlHttp.readyState==4 || LayerNews_xmlHttp.readyState=="complete") { 
     document.getElementById("LayerNews").innerHTML=LayerNews_xmlHttp.responseText; 
   } 
} 

function LayerNews_load(url) {
 LayerNews_xmlHttp=GetXmlHttpObject();
 url=mbcURL+"/"+url;
 LayerNews_xmlHttp.onreadystatechange=LayerNews_stateChanged; LayerNews_xmlHttp.open("GET",url,true);
 LayerNews_xmlHttp.setRequestHeader("If-Modified-Since","0");
 LayerNews_xmlHttp.send(null);
}

function ContentBody_stateChanged() { 
 if (ContentBody_xmlHttp.readyState==4 || ContentBody_xmlHttp.readyState=="complete") { 
     document.getElementById("ContentBody").innerHTML=ContentBody_xmlHttp.responseText; 
 } 
} 


function ContentBody_load(url) {
 ContentBody_xmlHttp=GetXmlHttpObject();
 url=mbcURL+"/"+url;
 ContentBody_xmlHttp.onreadystatechange=ContentBody_stateChanged; 
 ContentBody_xmlHttp.open("GET",url,true);
 ContentBody_xmlHttp.timeout=10000;
 ContentBody_xmlHttp.setRequestHeader("If-Modified-Since","0");
 ContentBody_xmlHttp.send(null);
 document.getElementById("ContentBody").innerHTML="<P style='color:yellow;font-size:40px;text-decoration:blink;'>"
 					+"資料載入中......<br>Data loading.......</P>" ;
} 

function mp3_play(mp3) { 
 var so = new SWFObject(mbcURL+'/mediaplayer.swf','jstest','400','20','8');
 so.addParam('allowscriptaccess','always');
 so.addVariable('autostart','true');
 so.addVariable('width','400');
 so.addVariable('height','20');
 so.addVariable('file',mbcURL+mp3);
 so.addVariable('javascriptid','jstest');
 so.addVariable('enablejs','true');
 so.write('container');
}

 function CreateBookmarkLink(url,title) {

	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title); }
	else if(window.opera && window.print) { // Opera Hotlist
		return true; }
 }
