// top menu
function state_ch(obj){
	if (navigator.userAgent.toLowerCase().indexOf("msie")!=-1)
		obj.filters[0].Apply();
	
	obj.style.backgroundColor="#ADB8C6";
	obj.style.color="white";
	obj.onmouseout=function(){
		obj.style.backgroundColor="transparent";
		obj.style.color="#29658A";
		}

	if (navigator.userAgent.toLowerCase().indexOf("msie")!=-1)
		obj.filters[0].Play(duration=0.5);	
}

// left menu
function color_ch(obj){
	if (navigator.userAgent.toLowerCase().indexOf("msie")!=-1)
		obj.filters[0].Apply();
	
	obj.style.backgroundColor="#999999";
	obj.onmouseout=function(){
		obj.style.backgroundColor="#E6EAEC";
		}

	if (navigator.userAgent.toLowerCase().indexOf("msie")!=-1)
		obj.filters[0].Play();	
}

function play_radio(){
	var frame=document.getElementById('player_frame');
	if (navigator.userAgent.toLowerCase().indexOf("msie")!=-1)
		frame.filters[0].Apply();
	frame.style.display="inline";
	if (navigator.userAgent.toLowerCase().indexOf("msie")!=-1)
		frame.filters[0].Play(duration=4);	
	document.radio_form.submit();
}

// ********** SERVER INTERACTION *****************************************
var http_request=false;
function load_data(url,page,index) {
	if (window.XMLHttpRequest) { 
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/html');
			}
	} else if (window.ActiveXObject) { 
		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	if (!http_request) {
		alert('Fail to load data');
		return false;
	}
	
	if (index==1){
		if (cat=window.location.hash)
			url=cat.substring(1);
		}
	else
		window.location.hash=url;

	if (page=="news")
		page="news_bridge.php?cat="+url;
	if (page=="flight")
		page="flight_bridge.php?cat="+url;
	if (page=="weather"){
		page="weather_bridge.php?loc="+url;
		}
		
	document.getElementById('content_r').innerHTML="<p class='loading'><object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='64' height='41' id='loading_swf' align='middle'><param name='allowScriptAccess' value='sameDomain' /><param name='movie' value='loading.swf' /><param name='wmode' value='transparent' /><param name='quality' value='high' /><param name='bgcolor' value='#ffffff' /><embed src='loading.swf' quality='high' bgcolor='#ffffff' width='64' height='41' name='loading' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object></p>";
	
	page+="&"+new Date().getTime(); // stop IE caching
	http_request.onreadystatechange = getContents;
	http_request.open('GET',page, true);
	http_request.setRequestHeader("Cache-Control","no-cache")  /////// cache bug!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
	http_request.send(null);
}

function getContents() {
	obj=document.getElementById('content_r');
	if (http_request.readyState == 4) {
		if (http_request.status == 200) {
			obj.innerHTML="";
			if (navigator.userAgent.toLowerCase().indexOf("msie")!=-1)
				obj.filters[0].Apply();
			
			obj.innerHTML=http_request.responseText;
	
			if (navigator.userAgent.toLowerCase().indexOf("msie")!=-1)
				obj.filters[0].Play(duration=1);
		} else {
			obj.innerHTML="Fail to load data, Please refresh this page and try again.";
		}
	}
}

function play_radio(obj){
	code=obj.value!="stop"?"<OBJECT height='0' width='0' CLASSID='CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6'><PARAM name='uiMode' value='mini'><PARAM name='URL' value='"+obj.value+"'><PARAM NAME='AutoStart' VALUE='1'><embed height='0' width='0' type='application/x-mplayer2' pluginspage='http://www.microsoft.com/windows/windowsmedia/download/AllDownloads.aspx/' src='"+obj.value+"' ShowStatusBar='1' autostart='1' ></embed></OBJECT>":"";
	document.getElementById('obj').innerHTML=code;
}
// ********** SERVER INTERACTION *****************************************
