function ShowPopup(event)

{

   mnu = document.getElementById('JSPopup');

   mnu.style.left = event.clientX+document.body.scrollLeft+'px';

   mnu.style.top = event.clientY+document.body.scrollTop+'px';

   mnu.className = 'visiblePopup';

}

function ClosePopup()

{

    document.getElementById('JSPopup').className='hiddenState';

}

/************************************************************************************************************
Ajax chained select
************************************************************************************************************/	
var ajax = new Array();
function getMenu1(sel)
{
	var countryCode = sel.options[sel.selectedIndex].value;
	document.getElementById('cat_2').options.length = 0;	// Empty city select box
	if(countryCode.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		
		ajax[index].requestFile = 'include/menu_2.php?cat='+countryCode;	// Specifying which file to get
		ajax[index].onCompletion = function(){ createMenu1(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}
function getMenu1_en(sel)
{
	var countryCode = sel.options[sel.selectedIndex].value;
	document.getElementById('cat_2').options.length = 0;	// Empty city select box
	if(countryCode.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		
		ajax[index].requestFile = 'include/menu_2_en.php?cat='+countryCode;	// Specifying which file to get
		ajax[index].onCompletion = function(){ createMenu1(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}

function createMenu1(index)
{
	var obj = document.getElementById('cat_2');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}



function getMenu2(sel)
{
	var countryCode = sel.options[sel.selectedIndex].value;
	document.getElementById('cat_3').options.length = 0;	// Empty city select box
	if(countryCode.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		
		ajax[index].requestFile = 'include/menu_3.php?cat_2='+countryCode;	// Specifying which file to get
		ajax[index].onCompletion = function(){ createMenu2(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}
function getMenu2_en(sel)
{
	var countryCode = sel.options[sel.selectedIndex].value;
	document.getElementById('cat_3').options.length = 0;	// Empty city select box
	if(countryCode.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		
		ajax[index].requestFile = 'include/menu_3_en.php?cat_2='+countryCode;	// Specifying which file to get
		ajax[index].onCompletion = function(){ createMenu2(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}

function createMenu2(index)
{
	var obj = document.getElementById('cat_3');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}



/***********************************************************************************************************/

function getCityList_r(sel)
{
	var countryCode = sel.options[sel.selectedIndex].value;
	document.getElementById('district_r').options.length = 0;	// Empty city select box
	if(countryCode.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		
		ajax[index].requestFile = 'include/inc_district.php?id='+countryCode;	// Specifying which file to get
		ajax[index].onCompletion = function(){ createCities_r(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}
function getCityList_r_en(sel)
{
	var countryCode = sel.options[sel.selectedIndex].value;
	document.getElementById('district_r').options.length = 0;	// Empty city select box
	if(countryCode.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		
		ajax[index].requestFile = 'include/inc_district_en.php?id='+countryCode;	// Specifying which file to get
		ajax[index].onCompletion = function(){ createCities_r(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}

function createCities_r(index)
{
	var obj = document.getElementById('district_r');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}


function getStreets_r(sel)
{
	var category = sel.options[sel.selectedIndex].value;
	document.getElementById('street_r').options.length = 0;	// Empty city select box
	if(category.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		
		ajax[index].requestFile = 'include/inc_street.php?id='+category;	// Specifying which file to get
		ajax[index].onCompletion = function(){ createStreets_r(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}
function getStreets_r_en(sel)
{
	var category = sel.options[sel.selectedIndex].value;
	document.getElementById('street_r').options.length = 0;	// Empty city select box
	if(category.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		
		ajax[index].requestFile = 'include/inc_street_en.php?id='+category;	// Specifying which file to get
		ajax[index].onCompletion = function(){ createStreets_r(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}

function createStreets_r(index)
{
	var obj = document.getElementById('street_r');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}		


////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
function getCityList(sel)
{
	var countryCode = sel.options[sel.selectedIndex].value;
	document.getElementById('district_').options.length = 0;	// Empty city select box
	if(countryCode.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		
		ajax[index].requestFile = 'include/inc_district_s.php?id='+countryCode;	// Specifying which file to get
		ajax[index].onCompletion = function(){ createCities(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}
function getCityList_en(sel)
{
	var countryCode = sel.options[sel.selectedIndex].value;
	document.getElementById('district_').options.length = 0;	// Empty city select box
	if(countryCode.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		
		ajax[index].requestFile = 'include/inc_district_s_en.php?id='+countryCode;	// Specifying which file to get
		ajax[index].onCompletion = function(){ createCities(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}

function createCities(index)
{
	var obj = document.getElementById('district_');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}


function getStreets(sel)
{
	var category = sel.options[sel.selectedIndex].value;
	document.getElementById('street_').options.length = 0;	// Empty city select box
	if(category.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		
		ajax[index].requestFile = 'include/inc_street_s.php?id='+category;	// Specifying which file to get
		ajax[index].onCompletion = function(){ createStreets(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}

function getStreets_en(sel)
{
	var category = sel.options[sel.selectedIndex].value;
	document.getElementById('street_').options.length = 0;	// Empty city select box
	if(category.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		
		ajax[index].requestFile = 'include/inc_street_s_en.php?id='+category;	// Specifying which file to get
		ajax[index].onCompletion = function(){ createStreets(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}

function createStreets(index)
{
	var obj = document.getElementById('street_');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}		

////////////////////END AJAX SHOW SELECT/////////////////////////



function open_sendmail(url) {
	popupWin = window.open(url,'new_page','width=350,height=280,menubar=no')
}
function open_searchnganh(url) {
	popupWin = window.open(url,'new_page','width=500,height=320,menubar=no,scrollbars=1')
}

function tellerror(){
	window.status = 'Doanhba.com';
}
window.onerror=tellerror

var a = ""
	function hide_submenu(b)
	{	
		if(a != b){
			eval('document.all.'+b).style.display = 'none'
			eval('document.all.'+a).style.display = 'none'
			a = ""
		}else{
			if(a == b){
				if(a != "")
				eval('document.all.'+a).style.display = 'none'
				eval('document.all.'+b).style.display = ''
				a = b
			}
		}
	}

//Thong ke

//SHOW SUBPRODUCT
	var theoldcell = ""
	function showhide(thecell)
	{	
		if(theoldcell == thecell){
			eval('document.all.'+thecell).style.display = 'none'
			eval('document.all.'+theoldcell).style.display = 'none'
			theoldcell = ""
		}else{
			if(theoldcell != thecell){
				if(theoldcell != "")
				eval('document.all.'+theoldcell).style.display = 'none'
				eval('document.all.'+thecell).style.display = ''
				theoldcell = thecell
			}
		}
	}
	function openReview(id) {
		document.getElementById('rev' + id + '_overview').style.display = 'none';
		document.getElementById('rev' + id).style.display = '';
	}
	function closeReview(id) {
		document.getElementById('rev' + id + '_overview').style.display = '';
		document.getElementById('rev' + id).style.display = 'none';
	}
//SHOW SUBPRODUCT
	var theoldcell = ""
	function showhide(thecell)
	{	
		if(theoldcell == thecell){
			eval('document.all.'+thecell).style.display = 'none'
			eval('document.all.'+theoldcell).style.display = 'none'
			theoldcell = ""
		}else{
			if(theoldcell != thecell){
				if(theoldcell != "")
				eval('document.all.'+theoldcell).style.display = 'none'
				eval('document.all.'+thecell).style.display = ''
				theoldcell = thecell
			}
		}
	}

function submit_srv()
{

	/*keywords = document.getElementById('keywords');
	if(keywords.value.length == ""){
		alert('Qui khách vui lòng đánh từ khóa');
		keywords.focus();
	}	
	
	chuyenmuc = document.getElementById('chuyenmuc');
	if(chuyenmuc.value.length == ""){
		alert('Quí khách vui lòng chọn chuyên mục');
		chuyenmuc.focus();
	}

	noidang = document.getElementById('noidang');
	if(noidang.value.length == ""){
		alert('Quí khách vui lòng chọn nơi đăng');
		noidang.focus();	
	}
	else
	{*/
  		document.search_rv.submit();
//	}
}

function submit_qsearch()
{
	searchname = document.getElementById('searchname');
	if(searchname.value.length == ""){
		alert('Please Enter a Value');
		searchname.focus();
	}
	else
	{
	  document.qsearch.submit();
	}
}

function submit_gopy()
{
	  document.f_gopy.submit();
}

function submit_search()
{
	country = document.getElementById('country');
	if(country.value.length == ""){
		alert('Please Select Country');
		country.focus();
	}	
	else
	{
	  document.search_.submit();
	}
}

function submit_login()
{
	user = document.getElementById('user');
	if(user.value.length == ""){
		alert('Please Enter Email');
		user.focus();
	}
	pass = document.getElementById('pass');
	if(pass.value.length == ""){
		alert('Please Enter Pasword');
		pass.focus();
	}
	else
	{
	  document.login.submit();
	}
}

function submitform()
{
	po = document.getElementById('point');
	if(po.value.length == ""){
		alert('Vui lòng chọn điểm');
		po.focus();
	}
	name_rate = document.getElementById('name_rate');
	if(name_rate.value.length == ""){
		alert('Vui lòng đánh tên của bạn');
		name_rate.focus();
	}else
	{
		con = document.getElementById('content');
		if(con.value == ""){
			alert('Vui lòng đánh nội dung');
			con.focus();
		}
		else
		{
			val = document.getElementById('val');
			if(val.value.length == ""){
				alert('Vui lòng đánh mã đánh giá');
				val.focus();
			}
			else
			{
			  document.rate.submit();
			}
		}
	}
}

<!-- TEXTAREA LIMIT CHARACTER
function getObject(obj) {
  var theObj;
  if(document.all) {
    if(typeof obj=="string") {
      return document.all(obj);
    } else {
      return obj.style;
    }
  }
  if(document.getElementById) {
    if(typeof obj=="string") {
      return document.getElementById(obj);
    } else {
      return obj.style;
    }
  }
  return null;
}

//Contador de caracteres.
function Contar(entrada,salida,texto,caracteres) {
  var entradaObj=getObject(entrada);
  var salidaObj=getObject(salida);
  var longitud=caracteres - entradaObj.value.length;
  if(longitud <= 0) {
    longitud=0;
    texto='<span class="disable"> '+texto+' </span>';
    entradaObj.value=entradaObj.value.substr(0,caracteres);
  }
  salidaObj.innerHTML = texto.replace("{CHAR}",longitud);
}

//-->


<!--///Ajax
loadstatustext = '<center>Loading...</center>';
function ajaxLoad(url,id)
   {
       if (document.getElementById) {
           var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
           }
           if (x)
               {
           x.onreadystatechange = function()
                   {
                       el = document.getElementById(id);
                       el.innerHTML = loadstatustext;
               if (x.readyState == 4 && x.status == 200)
                       {
                       el.innerHTML = x.responseText;
                   }
                   }
               x.open("GET", url, true);
               x.send(null);
               }
       }


//function street_other(x)       
//   {
//   ajaxLoad('include/street_other.php?sid='+x,'show_streetother');
//   }

function db_display(x)       
   {
   ajaxLoad('include/menu_2.php?cat='+x,'showmenu_r');
   }
function db_display_en(x)       
   {
   ajaxLoad('include/menu_2_en.php?cat='+x,'showmenu_r');
   }

function db_display2(x)       
   {
   ajaxLoad('include/menu_3.php?cat_2='+x,'showmenu_r2');
   }
function db_display2_en(x)       
   {
   ajaxLoad('include/menu_3_en.php?cat_2='+x,'showmenu_r2');
   }
   
////////////////////////////////////////////
function db_country(x)       
   {
   ajaxLoad('include/inc_city.php?id='+x,'city');
   }
function db_city(x)       
   {
   ajaxLoad('include/inc_district.php?id='+x,'district');
   }
function db_district(x)       
   {
   ajaxLoad('include/inc_street.php?id='+x,'street');
   }

function db_country_en(x)       
   {
   ajaxLoad('include/inc_city_en.php?id='+x,'city');
   }
function db_city_en(x)       
   {
   ajaxLoad('include/inc_district_en.php?id='+x,'district');
   }
function db_district_en(x)       
   {
   ajaxLoad('include/inc_street_en.php?id='+x,'street');
   }

////////////////
function db_country_s(x)       
   {
   ajaxLoad('include/inc_city_s.php?id='+x,'city_s');
   }
function db_city_s(x)       
   {
   ajaxLoad('include/inc_district_s.php?id='+x,'district_s');
   }
function db_district_s(x)       
   {
   ajaxLoad('include/inc_street_s.php?id='+x,'street_s');
   }

function db_country_s_en(x)       
   {
   ajaxLoad('include/inc_city_s_en.php?id='+x,'city_s');
   }
function db_city_s_en(x)       
   {
   ajaxLoad('include/inc_district_s_en.php?id='+x,'district_s');
   }
function db_district_s_en(x)       
   {
   ajaxLoad('include/inc_street_s_en.php?id='+x,'street_s');
   }

////////////////////////////////////////////////
<!--///Rate
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->


// Show ToolTip
<!--
wmtt = null;

document.onmousemove = updateWMTT;

function updateWMTT(e) {
	x = (document.all) ? window.event.x + document.body.scrollLeft : e.pageX;
	y = (document.all) ? window.event.y + document.body.scrollTop  : e.pageY;
	if (wmtt != null) {
		wmtt.style.left = (x + 20) + "px";
		wmtt.style.top 	= (y + 20) + "px";
	}
}

function showWMTT(id) {
	wmtt = document.getElementById(id);
	wmtt.style.display = "block"
}

function hideWMTT() {
	wmtt.style.display = "none";
}
//-->
function window_phanhoi(url) {
	popupWin = window.open(url,'new_page','width=350,height=200,menubar=no')
}