﻿function compatible()// ham voi tac dung tuong thich moi trinh duyet
{
	if (window.XMLHttpRequest)
  	{// code for IE7+, Firefox, Chrome, Opera, Safari
  		xmlhttp=new XMLHttpRequest();
 	 }
	else
  	{// code for IE6, IE5
 		 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  	}
}// end ham compatible
/* ----------------------------------HIEN THI TAB LUU TRU TRANG HOME ------------------------------*/
function tab_luutru(p)
{
	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("tab").className="";	
			document.getElementById("tab2").className="";						
			document.getElementById("tab1").className="NTabSelect";		
			document.getElementById("tab3").className="";		
			document.getElementById("tab_chuongtrinhdatbiet").innerHTML="";	
			document.getElementById("tab_chuongtrinhdatbiet").className="";		
			document.getElementById("tab_tietmucdacsac").innerHTML="";
			document.getElementById("tab_tietmucdacsac").className="";		
			document.getElementById("tab_tintuc").innerHTML="";
			document.getElementById("tab_tintuc").className="";					
			document.getElementById("loadimg").innerHTML="";
			document.getElementById("thanhtruotDPT").innerHTML="";
			document.getElementById("tim_kiem_archives").innerHTML="";			
			$(".datepicker").datepicker({	changeMonth: true,	changeYear: true,	dateFormat: "dd-mm-yy"	});
		}
 	}

	xmlhttp.open("GET","?act=archives&page="+p,true);
	xmlhttp.send();
}
function tab_luutru_timkiem(p)
{
	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("local").innerHTML=xmlhttp.responseText; 
			document.getElementById("tab").className="";	
			document.getElementById("tab2").className="";						
			document.getElementById("tab1").className="NTabSelect";		
			document.getElementById("tab3").className="";		
			document.getElementById("loadimg").innerHTML="";
			document.getElementById("tim_kiem_archives").innerHTML="";	
			$(".datepicker").datepicker({	changeMonth: true,	changeYear: true,	dateFormat: "dd-mm-yy"	});		
		}
 	}
 
	xmlhttp.open("GET","?act=archives&page="+p,true);
	xmlhttp.send();
}

function tab_luutru_sitemap(p)
{
	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("tab").className="";	
			document.getElementById("tab2").className="";						
			document.getElementById("tab1").className="NTabSelect";		
			document.getElementById("tab3").className="";		
			document.getElementById("loadimg").innerHTML="";						
		}
 	}
 
	xmlhttp.open("GET","?act=archives&page="+p,true);
	xmlhttp.send();
}
function get_archives(url,id)
{
	var html;
	compatible();
	html = "<div class=\"contHNews HNewsT\" ><div class=\"contHNewsC\"><div class=\"contHNewsT\"><div class=\"HNewsTTab\"><ul><li class=\"\" id=\"tab\"><a href=\"javascript:void(0)\" onclick=\"get_home_content('index.php?act=home&code=4','content_left')\">Chương trình hôm nay</a></li><li class=\"\" id=\"tab1\"><a href=\"javascript:void(0)\" onclick=\"tab_luutru_sitemap(1)\" >Lưu trữ</a></li><li class=\"\" id=\"tab2\"><a href=\"javascript:void(0)\" onclick=\"local_sitemap()\">đài phát thanh tnt địa phương</a></li><li class=\"\" id=\"tab3\"><a href=\"javascript:void(0)\" onclick=\"note_sitemap()\">Thông báo</a></li><div style=\"padding-right:10px;text-align:right;\" id=\"loadimg\"></div></ul></div></div><div class=\"contHNewsM\" id=\"local\"></div><a href=\"#\" name=\"ctdb\"></a></div></div>";	
	xmlhttp.onreadystatechange=function()
  	{
  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
    	{	
			//document.getElementById(id).innerHTML="";
			document.getElementById(id).innerHTML=html;
			document.getElementById("local").innerHTML=xmlhttp.responseText; 	
			document.getElementById("tab1").className="NTabSelect"; 			
			document.getElementById("tim_kiem_archives").innerHTML=""; 	
			document.getElementById("content_right").style.height="100%";
			document.getElementById("content_right").style.visibility=""; 

			//alert(xmlhttp.responseText);

		}
 	}
 
	xmlhttp.open("GET",url,true);
	xmlhttp.send();
}
function get_branch(url,id)
{
	var html;
	compatible();
	html = "<div class=\"contHNews HNewsT\" ><div class=\"contHNewsC\"><div class=\"contHNewsT\"><div class=\"HNewsTTab\"><ul><li class=\"\" id=\"tab\"><a href=\"javascript:void(0)\" onclick=\"get_home_content('index.php?act=home&code=4','content_left')\">Chương trình hôm nay</a></li><li class=\"\" id=\"tab1\"><a href=\"javascript:void(0)\" onclick=\"tab_luutru_sitemap(1)\" >Lưu trữ</a></li><li class=\"\" id=\"tab2\"><a href=\"javascript:void(0)\" onclick=\"local_sitemap()\">đài phát thanh tnt địa phương</a></li><li class=\"\" id=\"tab3\"><a href=\"javascript:void(0)\" onclick=\"note_sitemap()\">Thông báo</a></li><div style=\"padding-right:10px;text-align:right;\" id=\"loadimg\"></div></ul></div></div><div class=\"contHNewsM\" id=\"local\"></div><a href=\"#\" name=\"ctdb\"></a></div></div>";	
	xmlhttp.onreadystatechange=function()
  	{
  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
    	{	
			//document.getElementById(id).innerHTML="";
			document.getElementById(id).innerHTML=html;
			document.getElementById("local").innerHTML=xmlhttp.responseText; 	
			document.getElementById("tab2").className="NTabSelect"; 				
			//alert(xmlhttp.responseText);

		}
 	}
 
	xmlhttp.open("GET",url,true);
	xmlhttp.send();
}
function get_note(url,id)
{
	var html;
	compatible();
	html = "<div class=\"contHNews HNewsT\" ><div class=\"contHNewsC\"><div class=\"contHNewsT\"><div class=\"HNewsTTab\"><ul><li class=\"\" id=\"tab\"><a href=\"javascript:void(0)\" onclick=\"get_home_content('index.php?act=home&code=4','content_left')\">Chương trình hôm nay</a></li><li class=\"\" id=\"tab1\"><a href=\"javascript:void(0)\" onclick=\"tab_luutru_sitemap(1)\" >Lưu trữ</a></li><li class=\"\" id=\"tab2\"><a href=\"javascript:void(0)\" onclick=\"local_sitemap()\">đài phát thanh tnt địa phương</a></li><li class=\"\" id=\"tab3\"><a href=\"javascript:void(0)\" onclick=\"note_sitemap()\">Thông báo</a></li><div style=\"padding-right:10px;text-align:right;\" id=\"loadimg\"></div></ul></div></div><div class=\"contHNewsM\" id=\"local\"></div><a href=\"#\" name=\"ctdb\"></a></div></div>";	
	xmlhttp.onreadystatechange=function()
  	{
  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
    	{	
			//document.getElementById(id).innerHTML="";
			document.getElementById(id).innerHTML=html;
			document.getElementById("local").innerHTML=xmlhttp.responseText; 	
			document.getElementById("tab3").className="NTabSelect"; 				
			//alert(xmlhttp.responseText);

		}
 	}
 
	xmlhttp.open("GET",url,true);
	xmlhttp.send();
}
/*--------------------------------------- :::::::::::::::END::::::::: TAB LUU TRU--------------------------------*/

/*------------------------------------------goi ve trang chu ------------------------------------------------*/
function goi_ve_home(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="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"     });
					
					xem_tt(0);

				}catch(e){
				
				}
				

			


		}
 	}
	xmlhttp.open("GET",url,true);
	xmlhttp.send();
}

/*------------------------------------------end ham goi ve trang chu --------------------------------------------*/
/*--------------------------------------- HAM HIEN THI CUA TAB DAI PHAT THANH DIA PHUONG--------------------------------------*/
function local_sitemap()
{					
	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("tab").className="";	
			document.getElementById("tab1").className="";						
			document.getElementById("tab2").className="NTabSelect";		
			document.getElementById("tab3").className="";	
			document.getElementById("loadimg").innerHTML="";		

		}
 	}
	xmlhttp.open("GET","?act=branch",true);	
	xmlhttp.send();

}
function local()
{					
	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("tab").className="";	
			document.getElementById("tab1").className="";						
			document.getElementById("tab2").className="NTabSelect";		
			document.getElementById("tab3").className="";	
			document.getElementById("tab_chuongtrinhdatbiet").innerHTML="";	
			document.getElementById("tab_chuongtrinhdatbiet").className="";		
			document.getElementById("tab_tietmucdacsac").innerHTML="";
			document.getElementById("tab_tietmucdacsac").className="";		
			document.getElementById("tab_tintuc").innerHTML="";
			document.getElementById("tab_tintuc").className="";	
			document.getElementById("thanhtruotDPT").innerHTML="";	
			document.getElementById("loadimg").innerHTML="";	
	///		hide_show();

		}
 	}
	xmlhttp.open("GET","?act=branch",true);	
	xmlhttp.send();

}
/*---------------------------------------:::::::: END ::::: HAM HIEN THI CUA TAB DAI PHAT THANH DIA PHUONG--------------------------------------*/
function note_sitemap()
{
	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("thanhtruotDPT").innerHTML="";
			document.getElementById("local").innerHTML=xmlhttp.responseText; 
			document.getElementById("tab").className="";	
			document.getElementById("tab2").className="";						
			document.getElementById("tab1").className="";		
			document.getElementById("tab3").className="NTabSelect";	
			document.getElementById("loadimg").innerHTML="";		
		}
 	}
 	
	xmlhttp.open("GET","?act=note",true);
	xmlhttp.send();
}

function note()
{
	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("thanhtruotDPT").innerHTML="";
			document.getElementById("local").innerHTML=xmlhttp.responseText; 
			document.getElementById("tab").className="";	
			document.getElementById("tab2").className="";						
			document.getElementById("tab1").className="";		
			document.getElementById("tab3").className="NTabSelect";	
			document.getElementById("tab_chuongtrinhdatbiet").innerHTML="";	
			document.getElementById("tab_chuongtrinhdatbiet").className="";		
			document.getElementById("tab_tietmucdacsac").innerHTML="";
			document.getElementById("tab_tietmucdacsac").className="";		
			document.getElementById("tab_tintuc").innerHTML="";
			document.getElementById("tab_tintuc").className="";
			//document.getElementById("xoa").innerHTML="";	
			document.getElementById("thanhtruotDPT").innerHTML="";	
			document.getElementById("loadimg").innerHTML="";
		
		}
 	}
 	
	xmlhttp.open("GET","?act=note",true);
	xmlhttp.send();
}
function xem_tb(note_cat,tab)
{
	compatible();
	document.getElementById("img_tb").innerHTML="<img src='img/loading7.gif' width=16px height=16px >";						
	xmlhttp.onreadystatechange=function()
  	{
  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
    	{		
			//document.getElementById("thanhtruotDPT").innerHTML="";
			document.getElementById("local").innerHTML=xmlhttp.responseText; 
			document.getElementById("tab").className="";	
			document.getElementById("tab2").className="";						
			document.getElementById("tab1").className="";		
			document.getElementById("tab3").className="NTabSelect";	
			document.getElementById("note1").className="";	
			document.getElementById("note2").className="NTabSelect";							
			document.getElementById("img_tb").innerHTML="";		
		}
 	}
 	
	xmlhttp.open("GET","?act=note&code=1&note_cat="+note_cat,true);
	xmlhttp.send();
}



function homei()
{
	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("thanhtruotDPT").innerHTML="";
			document.getElementById("local").innerHTML=xmlhttp.responseText; 
			document.getElementById("tab").className="NTabSelect";	
			document.getElementById("tab2").className="";						
			document.getElementById("tab1").className="";		
			document.getElementById("tab3").className="";		
			document.getElementById("loadimg").innerHTML="";						
		}
 	}
 
	xmlhttp.open("GET","?act=home",true);
	xmlhttp.send();
}
/*-------------------------------------an hien noi dung phan dai phat thanh ----------------------------------*/
/*
function hide_show()
{
// text hien thi SHOW _ HIDE
var showText="<img src=\"img/arrow_menu.gif\">";
var hideText="<img src=\"img/arrow_menu.gif\">";

// kiem tra trang thai hien tai
var is_visible = false;

// thay doi text 
$('.cnCont').prev().append(' <a href="javascript:void(0)" class="archives_type">'+showText+'</a>');

// an tat cac noi dung doi voi class=cnCont
$('.cnCont').hide();

// su kien click vao text
$('a.archives_type').click(function() {

// hien noi dung
is_visible = !is_visible;

// thay doi text sau khi da in noi dung
$(this).html( (!is_visible) ? showText : hideText);

// slow: hieu ung 
//$('.toggle').hide();$('a.toggleLink').html(showText);
$(this).parent().next('.cnCont').toggle('slow');

// return false so any link destination is not followed
//return false;

});

}*/
/*------------------------------------end ------------------------------------------------------------------------*/
/*----------------------SEARCH------------------------------------------------------------*/
function archives_search(s)
{
	 var html;
	 compatible();
	 
	 html = "<div class=\"contHNews HNewsT\" ><div class=\"contHNewsC\"><div class=\"contHNewsT\"><div class=\"HNewsTTab\"><ul><li class=\"\" id=\"tab\"><a href=\"javascript:void(0)\" onclick=\"get_home_content('index.php?act=home&code=4','content_left')\">Chương trình hôm nay</a></li><li class=\"\" id=\"tab1\"><a href=\"javascript:void(0)\" onclick=\"tab_luutru_sitemap(1)\" >Lưu trữ</a></li><li class=\"\" id=\"tab2\"><a href=\"javascript:void(0)\" onclick=\"local_sitemap()\">đài phát thanh tnt địa phương</a></li><li class=\"\" id=\"tab3\"><a href=\"javascript:void(0)\" onclick=\"note_sitemap()\">Thông báo</a></li><div style=\"padding-right:10px;text-align:right;\" id=\"loadimg\"></div></ul></div></div><div class=\"contHNewsM\" id=\"local\"></div><a href=\"#\" name=\"ctdb\"></a></div></div>"; 
	 
	if(document.getElementById("loadimg")!=null)
	{
		document.getElementById("loadimg").innerHTML="<img src='img/loading7.gif' width=16px height=16px >"
	}else{
		document.getElementById("local").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=html;
		   document.getElementById("local").innerHTML=xmlhttp.responseText; 
		   document.getElementById("tab1").className="NTabSelect"; 
		   document.getElementById("loadimg").innerHTML="";
		   restore_right_content();
		   document.getElementById("content_right").style.height="100%";
		   document.getElementById("content_right").style.visibility=""; 		   
		   $(".datepicker").datepicker({	changeMonth: true,	changeYear: true,	dateFormat: "dd-mm-yy"	});   
		 }
	 }
	 xmlhttp.open("GET","?act=archives&search="+s,true);
	 xmlhttp.send();
}

function archives_search_date(s)
{
	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("loadimg").innerHTML="";
			$(".datepicker").datepicker({	changeMonth: true,	changeYear: true,	dateFormat: "dd-mm-yy"	});
		}
 	}
	xmlhttp.open("GET","?act=archives&date_archives="+s,true);
	xmlhttp.send();
}
function archives(p)
{
	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("loadimg").innerHTML="";						
			document.getElementById("tim_kiem_archives").innerHTML="";						
		}
 	}
 
	xmlhttp.open("GET","?act=archives&page="+p,true);
	xmlhttp.send();
}

function timkiem_luutru()
{
	var	s	=	document.frmtimkiem.dateSelect.value;
	archives_search_date(s);

}

function search_news()
{
	var	s	=	document.frmSearch.search.value;
	archives_search(s);
}
function reset_text()
{
	document.frmSearch.search.value="";
}
/*-----------------------------------------------END :::::: SEARCH -------------------------------*/
/* ----------------------------------loc theo tuan  radio_plan -------------------------------------*/

function radio_plan_week()
{
	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="";
			

			
		}
 	}
	xmlhttp.open("GET","?act=radio_plan&code=4&time_url=vn",true);
	xmlhttp.send();
}

/* ----------------------------------next pre radio_plan -------------------------------------*/
function next_pre_find_radio_plan(url)
{
	compatible();
	xmlhttp.onreadystatechange=function()
  	{
  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
    	{		
			document.getElementById("content_left").innerHTML=xmlhttp.responseText; 
			//reload_datepicter();
		}
 	}
	xmlhttp.open("GET",url,true);
	xmlhttp.send();
}
function reload_datepicter()
{
//new JsDatePick({			useMode:2,			target:"inputField",			dateFormat:"%d-%M-%Y"		});	
//	$(".datepicker").datepicker({	changeMonth: true,	changeYear: true,	dateFormat: "dd-mm-yy"	});
}
function Find()
{
		var dateOther		=	document.find.dateSelect.value;

		next_pre_find_radio_plan("?act=radio_plan&code=1&date_plan="+dateOther);

}
function Next()
{
		var dateOther		=	document.find.dateSelect.value;

		next_pre_find_radio_plan("?act=radio_plan&code=2&date_plan="+dateOther);

}
function Pre()
{
		var dateOther		=	document.find.dateSelect.value;
		next_pre_find_radio_plan("?act=radio_plan&code=3&date_plan="+dateOther);
}
/* ----------------------------------END :::::::::::next pre radio_plan -------------------------------------*/
/*-------------------------------- NEWS -----------------------------------------------------*/
function news(url,id)
{
	compatible();
	xmlhttp.onreadystatechange=function()
  	{
  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
    	{	

				document.getElementById(id).innerHTML=xmlhttp.responseText; 
				document.getElementById("content_left").style.width="100%"; 		
				document.getElementById("content_right").style.height="0px";
				document.getElementById("content_right").style.visibility="hidden"; 
								
		}
 	}
	xmlhttp.open("GET",url,true);
	xmlhttp.send();
}
function news_send(url)
{
	window.open(url);
}
/*-------------------------------- END NEWS -----------------------------------------------------*/
/*-------------------------------- LOC TIN LUU TRU ------------------------------------------------*/
function loc_tin_tmds(radio_cat,p)
{
	compatible();
	document.getElementById("loadimg_lt_tmds").innerHTML="<img src='img/loading7.gif' width=14px height=14px >";
	xmlhttp.onreadystatechange=function()
  	{
  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
    	{				
			document.getElementById("local").innerHTML=xmlhttp.responseText;			
			document.getElementById("tim_kiem_archives").innerHTML="";	
			$(".datepicker").datepicker({	changeMonth: true,	changeYear: true,	dateFormat: "dd-mm-yy"	});
			for(id=2;id<=7;id++){
				document.getElementById("lt_tmds_menu"+id).style.color = "";
			}
			document.getElementById("lt_tmds_menu"+radio_cat).style.color = "#D00";					
		}
		
 	}
	
	xmlhttp.open("GET","?act=archives&theloai="+radio_cat+"&page="+p,true);
	xmlhttp.send();
	
}

/*----------------------------------- END LOC TIN LUU TRU --------------------------------------------*/
// ham hien thi tat cac cac loai trong tiet muc dac sac
function xem_all_tmds(loai)
{
	compatible();
	document.getElementById("img_tmds").innerHTML="<a href=\"javascript:void(0)\" onclick=\"xem_all_tmds('TMDS')\" class=\"archives_type\">TIẾT MỤC ĐẶC SẮC</a><img src='img/loading7.gif' width=16px height=16px >";		

	xmlhttp.onreadystatechange=function()
  	{

  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
    	{		
			document.getElementById("content_tmds_home").innerHTML=xmlhttp.responseText;			

			document.getElementById("slides_tmds_home").innerHTML="<div id=controller"+loai+" class=\"hidden\"><span class="+loai+"Control></span><span class="+loai+"Control></span><span class="+loai+"Control></span></div><div id=\"prevNext\"><div id=\"newsPre\" class="+loai+"Prev><a href=\"javascript: void(0)\" >&nbsp;</a></div><div id=\"newsNext\" class="+loai+"Next><a href=\"javascript: void(0)\">&nbsp;</a></div></div>";
			
			
			document.getElementById("img_tmds").innerHTML="<a href=\"javascript:void(0)\" onclick=\"xem_all_tmds('TMDS')\" class=\"archives_type\">TIẾT MỤC ĐẶC SẮC</a>";		
			$("div#controller"+loai).TMDS({ slides: "#slides"+loai,  width: "100%",       height: "140px"     });

			for(id=2;id<=7;id++)
			{
				document.getElementById("tmds_menu"+id).style.color = "";
			}

		}
 	}

	xmlhttp.open("GET","?act=home&code=8",true);
	xmlhttp.send();
}

// ham hien thi cac muc chon TIET MUC DAC SAC
function xem_tmds(radio_cat,loai)
{
	compatible();
	document.getElementById("img_tmds").innerHTML="<a href=\"javascript:void(0)\" onclick=\"xem_all_tmds('TMDS')\" class=\"archives_type\">TIẾT MỤC ĐẶC SẮC</a><img src='img/loading7.gif' width=16px height=16px >";		

	var tmds="";
	var num=0;
	var html="";
	xmlhttp.onreadystatechange=function()
  	{

  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
    	{		
			num	  	  = xmlhttp.responseText.substring(0,1);
			tmds	  = xmlhttp.responseText.substring(1);
			document.getElementById("content_tmds_home").innerHTML=tmds;			

			if(num==1)
			{
				document.getElementById("slides_tmds_home").innerHTML="<div id=controller"+loai+" class=\"hidden\"><span class="+loai+"Control></span></div><div id=\"prevNext\"><div id=\"newsPre\" class="+loai+"Prev><a href=\"javascript: void(0)\" >&nbsp;</a></div><div id=\"newsNext\" class="+loai+"Next><a href=\"javascript: void(0)\">&nbsp;</a></div></div>";
			}
			if(num==2)
			{
				document.getElementById("slides_tmds_home").innerHTML="<div id=controller"+loai+" class=\"hidden\"><span class="+loai+"Control></span><span class="+loai+"Control></span></div><div id=\"prevNext\"><div id=\"newsPre\" class="+loai+"Prev><a href=\"javascript: void(0)\" >&nbsp;</a></div><div id=\"newsNext\" class="+loai+"Next><a href=\"javascript: void(0)\">&nbsp;</a></div></div>";

			}
			if(num==3)
			{
				document.getElementById("slides_tmds_home").innerHTML="<div id=controller"+loai+" class=\"hidden\"><span class="+loai+"Control></span><span class="+loai+"Control></span><span class="+loai+"Control></span></div><div id=\"prevNext\"><div id=\"newsPre\" class="+loai+"Prev><a href=\"javascript: void(0)\" >&nbsp;</a></div><div id=\"newsNext\" class="+loai+"Next><a href=\"javascript: void(0)\">&nbsp;</a></div></div>";

			}
			if(num==4)
			{
				document.getElementById("slides_tmds_home").innerHTML="<div id=controller"+loai+" class=\"hidden\"><span class="+loai+"Control></span><span class="+loai+"Control></span><span class="+loai+"Control></span><span class="+loai+"Control></span></div><div id=\"prevNext\"><div id=\"newsPre\" class="+loai+"Prev><a href=\"javascript: void(0)\" >&nbsp;</a></div><div id=\"newsNext\" class="+loai+"Next><a href=\"javascript: void(0)\">&nbsp;</a></div></div>";
				//alert(document.getElementById("slides_tmds_home").innerHTML);
			}
			if(num==5)
			{
				document.getElementById("slides_tmds_home").innerHTML="<div id=controller"+loai+" class=\"hidden\"><span class="+loai+"Control></span><span class="+loai+"Control></span><span class="+loai+"Control></span><span class="+loai+"Control></span><span class="+loai+"Control></span></div><div id=\"prevNext\"><div id=\"newsPre\" class="+loai+"Prev><a href=\"javascript: void(0)\" >&nbsp;</a></div><div id=\"newsNext\" class="+loai+"Next><a href=\"javascript: void(0)\">&nbsp;</a></div></div>";
			}
			if(num==6)
			{
				document.getElementById("slides_tmds_home").innerHTML="<div id=controller"+loai+" class=\"hidden\"><span class="+loai+"Control></span><span class="+loai+"Control></span><span class="+loai+"Control></span><span class="+loai+"Control></span><span class="+loai+"Control></span><span class="+loai+"Control></span></div><div id=\"prevNext\"><div id=\"newsPre\" class="+loai+"Prev><a href=\"javascript: void(0)\" >&nbsp;</a></div><div id=\"newsNext\" class="+loai+"Next><a href=\"javascript: void(0)\">&nbsp;</a></div></div>";
			}
			if(num==7)
			{
				document.getElementById("slides_tmds_home").innerHTML="<div id=controller"+loai+" class=\"hidden\"><span class="+loai+"Control></span><span class="+loai+"Control></span><span class="+loai+"Control></span><span class="+loai+"Control></span><span class="+loai+"Control></span><span class="+loai+"Control></span><span class="+loai+"Control></span></div><div id=\"prevNext\"><div id=\"newsPre\" class="+loai+"Prev><a href=\"javascript: void(0)\" >&nbsp;</a></div><div id=\"newsNext\" class="+loai+"Next><a href=\"javascript: void(0)\">&nbsp;</a></div></div>";
			}
			if(num==8)
			{
				document.getElementById("slides_tmds_home").innerHTML="<div id=controller"+loai+" class=\"hidden\"><span class="+loai+"Control></span><span class="+loai+"Control></span><span class="+loai+"Control></span><span class="+loai+"Control></span><span class="+loai+"Control></span><span class="+loai+"Control></span><span class="+loai+"Control></span><span class="+loai+"Control></span></div><div id=\"prevNext\"><div id=\"newsPre\" class="+loai+"Prev><a href=\"javascript: void(0)\" >&nbsp;</a></div><div id=\"newsNext\" class="+loai+"Next><a href=\"javascript: void(0)\">&nbsp;</a></div></div>";
			}
			if(num==9)
			{
				document.getElementById("slides_tmds_home").innerHTML="<div id=controller"+loai+" class=\"hidden\"><span class="+loai+"Control></span><span class="+loai+"Control></span><span class="+loai+"Control></span><span class="+loai+"Control></span><span class="+loai+"Control></span><span class="+loai+"Control></span><span class="+loai+"Control></span><span class="+loai+"Control></span><span class="+loai+"Control></span></div><div id=\"prevNext\"><div id=\"newsPre\" class="+loai+"Prev><a href=\"javascript: void(0)\" >&nbsp;</a></div><div id=\"newsNext\" class="+loai+"Next><a href=\"javascript: void(0)\">&nbsp;</a></div></div>";
			}			
			
			
			document.getElementById("img_tmds").innerHTML="<a href=\"javascript:void(0)\" onclick=\"xem_all_tmds('TMDS')\" class=\"archives_type\">TIẾT MỤC ĐẶC SẮC</a>";		
			if(loai=="TTNS")
			{
				$("div#controller"+loai).TTNS({ slides: "#slides"+loai,  width: "100%",       height: "140px"     });
			}
			if(loai=="DT")
			{
				$("div#controller"+loai).DT({ slides: "#slides"+loai,  width: "100%",       height: "140px"     });
			}
			if(loai=="SK")
			{
				$("div#controller"+loai).SK({ slides: "#slides"+loai,  width: "100%",       height: "140px"     });
			}
			
			if(loai=="VNDA")
			{
				$("div#controller"+loai).VNDA({ slides: "#slides"+loai,  width: "100%",       height: "140px"     });
			}
			if(loai=="DSQT")
			{
				$("div#controller"+loai).DSQT({ slides: "#slides"+loai,  width: "100%",       height: "140px"     });
			}	

			if(loai=="LSPTVN")
			{
				
				$("div#controller"+loai).LSPTVN({ slides: "#slides"+loai,  width: "100%",       height: "140px"     });
			}

		


			//reloadTMDS();// goi ham load lai slide TIET MUC DAC SAC
		}
 	}
	for(id=2;id<=7;id++){
		document.getElementById("tmds_menu"+id).style.color = "";
	}
	document.getElementById("tmds_menu"+radio_cat).style.color = "#d00";
	xmlhttp.open("GET","?act=home&code=2&radio_cat="+radio_cat,true);
	xmlhttp.send();
}
// ham hien thi cac muc chon TIN TUC
var tmp_news_cat  = "";
function xem_tt(news_cat,loai)
{
	compatible();
	
	document.getElementById("img_tt").innerHTML="Tin tức &nbsp;&nbsp;&nbsp;<img src='img/loading7.gif' width=16px height=16px >";	
	tmp_news_cat	=	news_cat;

	xmlhttp.onreadystatechange=function()
  	{
		var num 	= "";
		
		var tt 			= "";
		
		var html		= "";	
		
  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
    	{		
		
			document.getElementById("tab_tintuc").innerHTML	=	"";
			document.getElementById("tab_tintuc").innerHTML = xmlhttp.responseText;
			
				try{
						$("div#controllerTT").TT({     slides: "#slidesTT",        width: "100%",    height: "400px"     });
						for(id=1;id<=4;id++)
						{
							document.getElementById("news_menu"+id).style.color = "";
						}
						
					document.getElementById("news_menu"+news_cat).style.color = "#D00";
				}catch(e){
				
				}
			
			
				//set default color tho the tabs
				//document.getElementById("news_menu"+tmp_news_cat).style.color = "#D00";
		}
 	}
 	
	
	//tmp_news_menu = news_cat;
	/*if(news_cat==0){
		
		for(id=1;id<=4;id++){
			document.getElementById("news_menu"+id).style.color = "";
		}
	}
	else{
		for(id=1;id<=4;id++){
			document.getElementById("news_menu"+id).style.color = "";
		}
		document.getElementById("news_menu"+news_cat).style.color = "#D00";
	}*/
	
	xmlhttp.open("GET","?act=home&code=3&news_cat="+news_cat,true);
	xmlhttp.send();
}
function display_home_luutru(url,id)
{
	compatible();
	document.getElementById(id).innerHTML="<table width='100%' valign='middle' height='500px' ><tr><td align=center><img src='img/loading44.gif'></td></tr></table>"; 	
	xmlhttp.onreadystatechange=function()
  	{
  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
    	{	
			document.getElementById(id).innerHTML=xmlhttp.responseText; 
			archives(1);
	        reloadTT();
			reloadTMDS();
			reloadCTDB();
		}
 	}

	xmlhttp.open("GET",url,true);
	xmlhttp.send();
}
function display_home_dpt(url,id)
{
	compatible();
	document.getElementById(id).innerHTML="<table width='100%' valign='middle' height='500px' ><tr><td align=center><img src='img/loading44.gif'></td></tr></table>"; 	
	xmlhttp.onreadystatechange=function()
  	{
  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
    	{	
			document.getElementById(id).innerHTML=xmlhttp.responseText; 
			local();
	        reloadTT();
			reloadTMDS();
			reloadCTDB();
		}
 	}

	xmlhttp.open("GET",url,true);
	xmlhttp.send();
}
function display_home(url,id)
{
	compatible();
	document.getElementById(id).innerHTML="<table width='100%' valign='middle' height='500px' ><tr><td align=center><img src='img/loading44.gif'></td></tr></table>"; 	
	xmlhttp.onreadystatechange=function()
  	{
  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
    	{	
			document.getElementById(id).innerHTML=xmlhttp.responseText; 
	        reloadTT();
			reloadTMDS();
			reloadCTDB();
		}
 	}

	xmlhttp.open("GET",url,true);
	xmlhttp.send();
}

function display_form(url,id,tab)
{
	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; 
			restore_right_content();		
			if(tab==2)
			{
				document.getElementById("1").className="";	
				document.getElementById("2").className="menuSelect";						
				document.getElementById("3").className="";		
				document.getElementById("4").className="";		
				document.getElementById("5").className="";
			}		
			if(tab==4)
			{
				document.getElementById("1").className="";	
				document.getElementById("2").className="";						
				document.getElementById("3").className="";		
				document.getElementById("4").className="menuSelect";		
				document.getElementById("5").className="";
			}		
			if(tab==5)
			{
				document.getElementById("1").className="";	
				document.getElementById("2").className="";						
				document.getElementById("3").className="";		
				document.getElementById("4").className="";		
				document.getElementById("5").className="menuSelect";
			}
		}
 	}
 
	xmlhttp.open("GET",url,true);
	xmlhttp.send();
}
/*--------------------------------------MENU ----------------------------------*/
function display_form_menu(url,id,tab)
{
	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; 
			restore_right_content();		
			if(tab==2)
			{
				document.getElementById("1").className="";	
				document.getElementById("2").className="menuSelect";						
				document.getElementById("3").className="";		
				document.getElementById("4").className="";		
				document.getElementById("5").className="";
			}		
			if(tab==4)
			{
				document.getElementById("1").className="";	
				document.getElementById("2").className="";						
				document.getElementById("3").className="";		
				document.getElementById("4").className="menuSelect";		
				document.getElementById("5").className="";
			}		
			if(tab==5)
			{
				document.getElementById("1").className="";	
				document.getElementById("2").className="";						
				document.getElementById("3").className="";		
				document.getElementById("4").className="";		
				document.getElementById("5").className="menuSelect";
			}
				document.getElementById("content_right").style.height="100%";
				document.getElementById("content_right").style.visibility=""; 
			
		}
 	}
 
	xmlhttp.open("GET",url,true);
	xmlhttp.send();
}

/*-----------------------------------HIEN THI TRANG TIENG ANH - TIENG VIET------------------------*/
function display_en(url,id,tab)
{
	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; 
			restore_right_content();					
			document.getElementById(tab).innerHTML="<ul><li class=\"\" id=\"1\"><a href='javascript:void(0)'  class=\"\" id=\"1\">HOME</a></li><li class=\"\" id=\"2\"><a href='javascript:void(0)'  >ABOUT TNT RADIO NETWORK</a></li><li class=\"\" id=\"3\"><a href='javascript:void(0)' >RADIO PROGRAMS</a></li><li class=\"\" id=\"4\"><a href='javascript:void(0)'  >CONTACT US</a></li><li class=\"\" id=\"5\"><a href='javascript:void(0)'  >TALK SHOW HOSTS/DJS</a></li><li class='english'><a href='javascript:void(0)' onclick=\"display_vn('?act=home&code=4','content_left','menu_tren')\" class=\"\" id=\"6\">Tiếng Việt</a></li></ul>";	
/*
			document.getElementById(tab).innerHTML="<ul><li class=\"\" id=\"1\"><a href='javascript:void(0)' onclick=\"get_home_content('?act=home&code=4','content_left')\" class=\"\" id=\"1\">HOME</a></li><li class=\"\" id=\"2\"><a href='javascript:void(0)' onclick=\"display_form('?act=about&code=2','content_left',2)\" >ABOUT TNT RADIO NETWORK</a></li><li class=\"\" id=\"3\"><a href='javascript:void(0)'onclick=\"get_radio_plan('?act=radio_plan&code=1','content_left')\" >RADIO PROGRAMS</a></li><li class=\"\" id=\"4\"><a href='javascript:void(0)' onclick=\"display_form('?act=contact&code=3','content_left',4)\" >CONTACT US</a></li><li class='english'><a href='javascript:void(0)' onclick=\"display_vn('?act=home&code=4','content_left','menu_tren')\" class=\"\" id=\"5\">Tiếng Việt</a></li></ul>";	
*/
						
						document.getElementById(id).style.width="100%"; 		
						document.getElementById("content_right").style.visibility="hidden"; 
						document.getElementById("content_right").style.height="0px"; 

			document.getElementById("1").className="";						
			document.getElementById("2").className="menuSelect";									

		}
 	}
 
	xmlhttp.open("GET",url,true);
	xmlhttp.send();
}
function display_vn(url,id,tab)
{
	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; 
			restore_right_content();	
			// goi lai ham de chay slide 
				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"     });
					
					xem_tt(0);
					
				}catch(e){
				
				}
			
			document.getElementById(tab).innerHTML="<ul><li class=\"\" id=\"1\"><a href='javascript:void(0)' onclick=\"get_home_content('?act=home&code=4','content_left')\" class=\"\" id=\"1\">Trang chính</a></li><li class=\"\" id=\"2\"><a href='javascript:void(0)' onclick=\"display_form('?act=about','content_left',2)\" >Giới thiệu</a></li><li class=\"\" id=\"3\"><a href='javascript:void(0)'onclick=\"get_radio_plan('?act=radio_plan&code=1','content_left')\" >Chương trình phát thanh</a></li><li class=\"\" id=\"4\"><a href='javascript:void(0)' onclick=\"display_form('?act=contact','content_left',4)\" >Liên hệ</a></li><li class=\"\" id=\"5\"><a href='javascript:void(0)' onclick=\"display_form('?act=speaker','content_left',5)\" >Xướng ngôn viên</a></li><li class='english'><a href='javascript:void(0)' onclick=\"display_en('?act=home&code=6','content_left','menu_tren')\" class=\"\" id=\"6\">English</a></li></ul>";	
			document.getElementById("1").className="menuSelect";						
			//document.getElementById("2").className="menuSelect";									

		}
 	}
 
	xmlhttp.open("GET",url,true);
	xmlhttp.send();
}

/*---------------------------------END HIEN THI TRANG TIENG ANH------------------------*/
function close_form(url,id)
{
	compatible();
	xmlhttp.onreadystatechange=function()
  	{
  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
    	{	
			document.getElementById(id).innerHTML=""; 			
		}
 	}
 
	xmlhttp.open("GET",url,true);
	xmlhttp.send();
}
/*---------------------------------- XOA KHUNG : TRANG TIN TUC ----------------------------------*/
function delete_frame()
{
	compatible();
	xmlhttp.onreadystatechange=function()
  	{
  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
    	{	
			document.getElementById("myDiv1").innerHTML=""; 					
			document.getElementById("myDiv2").innerHTML=""; 			
		}
 	}
 
	xmlhttp.open("GET","",true);
	xmlhttp.send();
}

/*--------------------------------------END ::::::: XOA KHUNG -------------------------------------------*/
// HAM DELETE DATABASE
function delete_frm(url,layer,id,msg) 
{	
	compatible();
	var strmsg=confirm(msg);
	if(strmsg==true)
	{
		xmlhttp.onreadystatechange=function()
		{
			if (xmlhttp.readyState==4 && xmlhttp.status==200)
			{	
				document.getElementById(layer).innerHTML=xmlhttp.responseText;		
			}
		}
	 
		xmlhttp.open("GET",url+"&branch_id="+id,true);
		xmlhttp.send();
	}else
	{
		return;	
	}
}
// HAM INSERT DATABASE
function insert_frm(layer,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(layer).innerHTML=xmlhttp.responseText;
			}
		}
		xmlhttp.open("GET",url,true);
		xmlhttp.send();
}
// CAC HAM XU LY UPDATE
function display_form_update(url,id,userid)
{
	compatible();
	xmlhttp.onreadystatechange=function()
  	{
  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
    	{	
			document.getElementById(id).innerHTML=xmlhttp.responseText; 			
		}
 	}
 
	xmlhttp.open("GET",url+"&userID="+userid,true);
	xmlhttp.send();
}
function update_frm(layer,url) 
{	
		compatible();
		xmlhttp.onreadystatechange=function()
		{
			if (xmlhttp.readyState==4 && xmlhttp.status==200)
			{	
				document.getElementById(layer).innerHTML=xmlhttp.responseText;
			}
		}
		xmlhttp.open("GET",url,true);
		xmlhttp.send();
}

// JAVA SCRIPT xu ly cac form tren website
function send_form_register(layer)
{
	var registerName		=	document.frmRes.registerName.value;
	var registerEmail		=	document.frmRes.registerEmail.value;
	var registerFone		=	document.frmRes.registerFone.value;
	var registerCompany		=	document.frmRes.registerCompany.value;
	var registerRequest		=	document.frmRes.registerRequest.value;
	var registerCat			=	document.frmRes.registerCat.value;
	var registerMoney		=	document.frmRes.registerMoney.value;
	var registerPayBank		=	document.frmRes.registerPayBank.value;
	var registerPay			=	document.frmRes.registerPay.value;
	var captcha				=	document.frmRes.captcha.value;	
	insert_frm(layer,"?act=register&code=2&registerName="+registerName+"&registerEmail="+registerEmail+"&registerFone="+registerFone+"&registerCompany="+registerCompany+"&registerRequest="+registerRequest+"&registerCat="+registerCat+"&registerMoney="+registerMoney+"&registerPayBank"+registerPayBank+"&registerPay="+registerPay+"&captcha="+captcha);
}
function check_form_speaker(layer)
{
		var speaker_id		=	document.speaker.speaker_id.value;
		var speaker_name	=	document.speaker.speaker_name.value;
		var speaker_des		=	document.speaker.speaker_des.value;
		var speaker_images	=	document.speaker.speaker_images.value;
		if (speaker_name=="")
		{
			alert("Điền thông tin vào ô tên người xướng ");	
			document.speaker.speaker_name.focus();
			return;
		}
		if (speaker_images=="")
		{
			alert("Hãy cập nhập ảnh  ");	
			document.speaker.speaker_images.focus();
			return;
		}
		
		if (speaker_des=="")
		{
			alert("Điền thông tin vào ô mô tả công việc");	
			document.speaker.speaker_des.focus();
			return;
		}
		var ans = confirm("Bạn có cần xem lại thông tin không");
		if (ans==true)
		{
			insert_frm(layer,"?act=speaker&code=2&speaker_name="+speaker_name+"&speaker_images="+speaker_images+"&speaker_des="+speaker_des+"&speaker_id="+speaker_id);
		}else
		{
			return;
		}
		
}
function check_form_note(layer)
{
		var note_id		=	document.note.note_id.value;
		var note_title	=	document.note.note_title.value;
		var note_content		=	document.note.note_content.value;
		if (note_title=="")
		{
			alert("Điền thông tin vào ô tiêu đề ");	
			document.title.note_title.focus();
			return;
		}
		
		if (note_content=="")
		{
			alert("Điền thông tin vào ô nội dung");	
			document.note.note_content.focus();
			return;
		}
		var ans = confirm("Bạn có cần xem lại thông tin không");
		if (ans==true)
		{
			insert_frm(layer,"?act=note&code=2&note_title="+note_title+"&note_content="+note_content+"&note_id="+note_id);
		}else
		{
			return;
		}
		
}
function send_form(layer)
{
	if (checkNull()==false) return false;
		var a	=	document.frmbranch.branch_title.value;
		var b	=	document.frmbranch.img_logo.value;
		
		alert(a);
		alert(b);
		
		insert_frm(layer,"?act=branch&code=3&branch_title="+a+"&img_logo="+b);
}
function checkNull()
{
	if(document.frmbranch.branch_title.value=="")
	{
		alert("Hãy điền tên đài vào");
		document.frmbranch.branch_title.focus();
		return false;
	}
	if(document.frmbranch.img_logo.value=="")
	{
		alert("Chưa có ảnh của đài");
		document.frmbranch.img_logo.focus();
		return false;
	}		
	document.frmbranch.submit();
	return true;
}
function check_del(speaker_id)
{
	var ans=confirm("Bạn có chắc chắn muốn xóa bảng ghi này");	
	if (ans==true)
	{
		window.location.href=("?act=speaker&code=4&speaker_id="+speaker_id);	
	}
}
function check_del_note(note_id)
{
	var ans=confirm("Bạn có chắc chắn muốn xóa bảng ghi này");	
	if (ans==true)
	{
		window.location.href=("?act=note&code=4&note_id="+note_id);	
	}
}
/* ------------------------ doan xu ly goi thong tin cua trang lien he - home -------------*/
function resetForm()
{
	document.frmContact.reset();
	document.frmContact.contact_lname.focus();
}
function insert_frm_contact(layer,url) 
{	
		check_button_form_contact();
		compatible();
		document.getElementById("msg_contact").innerHTML="<img src='img/loading7.gif' width=16px height=16px > Đang gởi yêu cầu ...";
		xmlhttp.onreadystatechange=function()
		{
			if (xmlhttp.readyState==4 && xmlhttp.status==200)
			{	
				document.getElementById(layer).innerHTML=xmlhttp.responseText;
				document.getElementById("img_captcha").src="captcha.php?captcha2.gif";
			}
		}
		xmlhttp.open("GET",url,true);
		xmlhttp.send();
}
function check_button_form_contact()
{
	if(document.getElementById("contact_send")!=null)
	{
		document.getElementById("contact_send").innerHTML="";
	}else{
		document.getElementById("contact_send").innerHTML="<a href=\"javascript:void(0)\" onclick=\"check_form()\">Gửi</a>";
	}	
	
	//------------------------------------------
	
	if(document.getElementById("contact_delete")!=null)
	{
		document.getElementById("contact_delete").innerHTML="";
	}else{
		document.getElementById("contact_delete").innerHTML="<a href=\"javascript:void(0)\" onclick=\"resetForm()\">Xóa</a>";
	}		

}
function check_form()
{
	var contact_lname=document.frmContact.contact_lname.value;
	var contact_fname=document.frmContact.contact_fname.value;
	var contact_email=document.frmContact.contact_email.value;
	var contact_com=document.frmContact.contact_com.value;	
	if (document.frmContact.contact_lname.value=="")
		{
//			alert("Hãy điền vào ô Họ");
			document.getElementById("msg_contact").innerHTML= "Xin vui lòng nhập Họ";
			document.frmContact.contact_lname.focus();
			return false;
		}
	if (document.frmContact.contact_fname.value=="")
		{
//			alert("");
			document.getElementById("msg_contact").innerHTML= "Xin vui lòng nhập Tên ";
			document.frmContact.contact_fname.focus();
			return false;
		}
	// check email abc@abc.com
	var email = document.getElementById("contact_email");
	
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (email.value=="")
	{
//		alert("Hãy điền vào ô Email ");	
		document.getElementById("msg_contact").innerHTML= "Xin vui lòng nhập Email";	
		email.focus();		
		return false;
	}
	if (!filter.test(email.value)) 
	{
	//	alert("Email sai định dạng");
		document.getElementById("msg_contact").innerHTML= "Email sai định dạng";	
		email.focus();
		return false;
	}// end check email
	
	if (document.frmContact.contact_com.value=="")
	{
//		alert("Hãy điền vào ô Ý Kiến");		
		document.getElementById("msg_contact").innerHTML= "Xin vui lòng nhập ý kiến của bạn";			
		document.frmContact.contact_com.focus();
		return false;
	}
		
	//kiem tra captcha
	contact_verification_code =  document.getElementById("contact_verification_code").value;
	$.ajax({  type: "POST", url: "check_captcha.php",     data: {contact_verification_code :contact_verification_code}, 
		   success: function(msg){  
  

				if(msg=="true")
				{
					document.getElementById("msg_contact").innerHTML= "";			
					insert_frm_contact("content_left","?act=contact&code=2&contact_com="+contact_com+"&contact_fname="+contact_fname+"&contact_lname="+contact_lname+"&contact_email="+contact_email+"&contact_verification_code="+contact_verification_code);
					
				}
				else
				{
					alert("Mã Kiểm Tra Không Hợp Lệ");
					document.getElementById("msg_contact").innerHTML= "Mã Kiểm Tra Không Hợp Lệ";			
					document.frmContact.contact_verification_code.focus();
					return false;																															
				}
			
		}
    });


	
}
/*-------------------------------END LIEN HE-----------------------------------*?
/* hieu dung den cua jquery*/
/*	        $(document).ready(function(){
            $("#page").ready(function(){
                $("#dim").fadeIn("slow");
                $("#modal").fadeIn("slow");
                
            });
            $("#dim").ready(function(){
                $("#modal").delay(1500).fadeOut("slow");
                $("#dim").delay(1500).fadeOut("slow");
                return false;				
            });
			
        });
<div id="page_jquery">
	<div id="dim" />
		<div id="modal">
			<div style="padding-top:220px;text-align:center;">
				<img src="images/loading6.gif"><br />
				<a href="javascript:void(0)" class="link_page">Bấm vào đây nếu cảm thấy lâu.</a>
			</div>
		</div>
	</div>
</div>
*/
function goiham_upload()
{
		var buttonMsg = $('#button_msg');
		
		var buttonUpload = $('#buttonUpload');
		
		
		new AjaxUpload(buttonUpload, {
			action: 'upload-file.php', 
			name: 'myfile',
			onSubmit : function(file, ext){
			
				if (! (ext && /^(jpg|gif|png|jpeg|rar|zip|JPG|GIF|PNG)$/.test(ext))){
						// extension is not allowed
						alert('Xin vui lòng chọn file ảnh: jpg|gif|png|jpeg|rar|zip');
					// cancel upload
						return false;
					}	
				// change button text, when user selects file			
				buttonMsg.html('Uploading' + "<img src='img/uploading.gif'>");
								
				// If you want to allow uploading only 1 file at time,
				// you can disable upload button
				this.disable();
				
				// Uploding -> Uploading. -> Uploading...
			},
			onComplete: function(file, response){
			
			
				buttonMsg.html("<img src='uploads/" + file + "' width='120px' width='120px'>");
							
		
				// enable upload button
				this.enable();
				
				// add file to the list
				
				document.speaker.speaker_images.value	=	"uploads/"+file;					
			}
		});
	
}
// url , name, mo ta, anh , ten layer , ma id
function display_form_speaker_edit(url,speaker_name,speaker_des,speaker_images,id,speaker_id)
{
	compatible();
	xmlhttp.onreadystatechange=function()
  	{
  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
    	{	
			document.getElementById(id).innerHTML=xmlhttp.responseText;
			goiham_upload();
			document.speaker.speaker_name.value=speaker_name;
			document.speaker.speaker_images.value=speaker_images;
			document.speaker.speaker_des.value=speaker_des;
			document.speaker.speaker_id.value=speaker_id;	
			
		}
 	}
 
	xmlhttp.open("GET",url,true);
	xmlhttp.send();
}

function display_jquery_edit(id0,id1,id2,speaker_name,speaker_des,speaker_images,speaker_id)
{
	           $("#"+id0).ready(function(){
               $("#"+id1).fadeIn("slow");
			   $("#"+id2).fadeIn("slow");});
				display_form_speaker_edit("?act=speaker&code=3",speaker_name,speaker_des,speaker_images,"speaker_form",speaker_id);

}
function display_form_note_edit(url,note_title,note_content,id,note_id)
{
	compatible();
	xmlhttp.onreadystatechange=function()
  	{
  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
    	{	
			document.getElementById(id).innerHTML=xmlhttp.responseText;
			document.note.note_title.value=note_title;
			document.note.note_content.value=note_content;
			document.note.note_id.value=note_id;	
			
		}
 	}
 
	xmlhttp.open("GET",url,true);
	xmlhttp.send();
}

function display_jquery_edit_note(id0,id1,id2,note_title,note_content,note_id)
{
	           $("#"+id0).ready(function(){
               $("#"+id1).fadeIn("slow");
			   $("#"+id2).fadeIn("slow");});
				display_form_note_edit("?act=note&code=3",note_title,note_content,"note_form",note_id);

}
/* ------------------------ CAM XOA ---------------------------------*/
function fade_in(id0,id1,id2)
{
	           $("#"+id0).ready(function(){
                $("#"+id1).fadeIn("slow");
                $("#"+id2).fadeIn("slow");});
			   //sau thoi gian tu tat
	           $("#"+id1).ready(function(){
                $("#"+id2).fadeOut("slow");
                $("#"+id1).fadeOut("slow");});
}
/*--------------------------END CAM XOA ------------------------------*/
function display_jquery_share(id0,id1,id2)
{
	           $("#"+id0).ready(function(){
               $("#"+id1).fadeIn("slow");
			   $("#"+id2).fadeIn("slow");});
}

function display_jquery(id0,id1,id2)
{
	           $("#"+id0).ready(function(){
               $("#"+id1).fadeIn("slow");
			   $("#"+id2).fadeIn("slow");});
			   document.speaker.speaker_name.value="";
			   document.speaker.speaker_images.value="";
			   document.speaker.speaker_des.value="";
			   document.speaker.speaker_id.value="";
			   goiham_upload();
			   
}
function display_jquery_n(id0,id1,id2)
{
	           $("#"+id0).ready(function(){
               $("#"+id1).fadeIn("slow");
			   $("#"+id2).fadeIn("slow");});
			   document.note.note_title.value="";
			   document.note.note_content.value="";
			   document.note.note_id.value="";

}
function hidden_jquery(id1,id2)
{
	           $("#"+id1).ready(function(){
                $("#"+id2).fadeOut("slow");
                $("#"+id1).fadeOut("slow");});
		   
}
     /* ---------------------------------- ------------------------------*/
        


