


function restore_right_content()
{
	if(document.getElementById("content_right").style.visibility=="hidden")
	{
		document.getElementById("content_left").style.width = "660px"; 	
//		document.getElementById("content").style.height = "800px"; 	
		document.getElementById("content_right").style.visibility=""; 
		document.getElementById("content_right").style.height="100%"; 	
//		alert('1');	
					
	}	

}					
function get_home_content(url,id)
{
		
	compatible();
	
	if(document.getElementById("loadimg")!=null)
	{
		document.getElementById("loadimg").innerHTML="<img src='img/loading7.gif' width=16px height=16px >";
	}
	
	xmlhttp.onreadystatechange=function()
  	{
  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
    	{	
		
				document.getElementById(id).innerHTML=xmlhttp.responseText; 
				document.getElementById("1").className="menuSelect";	
				document.getElementById("2").className="";						
				document.getElementById("3").className="";		
				document.getElementById("4").className="";		
				document.getElementById("5").className="";	
													
			
				restore_right_content();
					
				try{
	
					//init slide
					$("div#controller").CTDB({ slides: "#slides",  width: "100%",       height: "140px"     });
					$("div#controllerTMDS").TMDS({ slides: "#slidesTMDS",  width: "100%",       height: "140px"     });
					$("div#controllerTT").TT({     slides: "#slidesTT",        width: "100%",    height: "400px"     });
					//$("div#controllerDPT").DPT({     slides: "#slidesDPT",        width: "100%",    height: "200px"     });
					
					
				}catch(e){
				
				}
				//update the news session because of crazything from PHP;
				xem_tt(0);

		}
 	}
	


	xmlhttp.open("GET",url,true);
	xmlhttp.send();

}
function get_lastest_news(){
	compatible();
	xmlhttp.onreadystatechange=function()
  	{
  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
    	{
			
			var a = xmlhttp.responseText;
			if(a>=1){
				xem_tt('0');
			}
			document.getElementById("img_tt").innerHTML="<a href='javascript:void(0)' onclick='xem_tt(0)' class='tt_type'>Tin tức</a>";	

		}
	}
	xmlhttp.open("GET","?act=getRSS",true);
	//document.getElementById("img_tt").innerHTML="Tin tức &nbsp;&nbsp;&nbsp;<img src='img/loading7.gif' width=16px height=16px >";	
	xmlhttp.send();
	
} 
function radio_plan_week_time(time_url)
{
	compatible();
	document.getElementById("loadimg").innerHTML="<img src='img/loading7.gif' width=16px height=16px >"	
	xmlhttp.onreadystatechange=function()
  	{
  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
    	{		
			document.getElementById("local").innerHTML=xmlhttp.responseText; 
			document.getElementById("tab1").className="NTabSelect";
			document.getElementById("tab").className="";			
			document.getElementById("loadimg").innerHTML="";
			document.getElementById(time_url).selected="selected";
		}
 	}
	xmlhttp.open("GET","?act=radio_plan&code=4&time_url="+time_url,true);
	xmlhttp.send();

}
function radio_plan_date_current(time_url)
{
	compatible();
	document.getElementById("loadimg").innerHTML="<img src='img/loading7.gif' width=16px height=16px >"	
	xmlhttp.onreadystatechange=function()
  	{
  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
    	{		
			document.getElementById("content_left").innerHTML=xmlhttp.responseText; 
			document.getElementById("tab").className="NTabSelect";
			document.getElementById("tab1").className="";			
			document.getElementById("loadimg").innerHTML="";
			document.getElementById(time_url).selected="selected";
		}
 	}

	xmlhttp.open("GET","?act=radio_plan&code=1&time_url="+time_url,true);
	xmlhttp.send();

}
function get_home_content_time(time_url)
{
	compatible();
	
	if(document.getElementById("loadimg")!=null)
	{
		document.getElementById("loadimg").innerHTML="<img src='img/loading7.gif' width=16px height=16px >"
	}
	
	xmlhttp.onreadystatechange=function()
  	{
  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
    	{	
		
				document.getElementById("content_left").innerHTML=xmlhttp.responseText; 
			
				//restore_right_content();
					
				try{
	
					//init slide
					$("div#controller").CTDB({ slides: "#slides",  width: "100%",       height: "140px"     });
					$("div#controllerTMDS").TMDS({ slides: "#slidesTMDS",  width: "100%",       height: "140px"     });
					$("div#controllerTT").TT({     slides: "#slidesTT",        width: "100%",    height: "400px"     });
					//$("div#controllerDPT").DPT({     slides: "#slidesDPT",        width: "100%",    height: "200px"     });
					
					
				}catch(e){
				
				}
				
				document.getElementById("loadimg").innerHTML="";
				document.getElementById(time_url).selected="selected";
				xem_tt('0');
		}
 	}
	xmlhttp.open("GET","?act=home&code=4&time_url="+time_url,true);
	xmlhttp.send();
}

//start to get home content
get_home_content("?act=home&code=4","content_left");

/*--------------------------------chuong trinh phat thanh ----------------------*/
function get_radio_plan(url,id)
{
	compatible();
	if(document.getElementById("loadimg")!=null)
	{
		document.getElementById("loadimg").innerHTML="<img src='img/loading7.gif' width=16px height=16px >"
	}else{
		document.getElementById(id).innerHTML="<img src='img/loading7.gif' width=16px height=16px >"
	}
	
	xmlhttp.onreadystatechange=function()
  	{
  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
    	{	
			document.getElementById(id).innerHTML=xmlhttp.responseText; 	
			document.getElementById("1").className="";	
			document.getElementById("2").className="";						
			document.getElementById("3").className="menuSelect";		
			document.getElementById("4").className="";		
			document.getElementById("5").className="";
			//$(".datepicker").datepicker({	changeMonth: true,	changeYear: true,	dateFormat: "dd-mm-yy"	});
			document.getElementById("loadimg").innerHTML="<img src='img/loading7.gif' width=16px height=16px >";						
			//new JsDatePick({			useMode:2,			target:"inputField",			dateFormat:"%d-%M-%Y"		});
			restore_right_content();
			document.getElementById("content_right").style.height="100%";
			document.getElementById("content_right").style.visibility=""; 
			document.getElementById("loadimg").innerHTML="";			
		}
 	}
 
	xmlhttp.open("GET",url,true);
	xmlhttp.send();
}
/*--------------------------------update lastest news ----------------------*/

