// JavaScript Document
var xmlHttp;
function GetXmlHttpObject()
{
  var xmlHttptemp=null;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttptemp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttptemp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      xmlHttptemp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    }
  return xmlHttptemp;
}	 

function stateChanged() 
{ 
if (xmlHttp.readyState<4){ 
	window.document.body.style.cursor="wait";
		document.getElementById("txtAjaxhome").innerHTML="<br><p align='center'><img src='image/loading.gif' border=0'></p>";

		}
if (xmlHttp.readyState==4)
{ 
document.getElementById("tinh").style.display="block";  
document.getElementById('tinh').innerHTML=xmlHttp.responseText;
window.document.body.style.cursor="default";
}
}

function stateChangedfs() 
{ 
if (xmlHttp.readyState<4){ 
		window.document.body.style.cursor="wait";
			document.getElementById("txtAjaxhome").innerHTML="<br><p align='center'><img src='image/loading.gif' border=0'></p>";
}

if (xmlHttp.readyState==4)
{ 
document.getElementById("tinhfs").style.display="block";  
document.getElementById('tinhfs').innerHTML=xmlHttp.responseText;
window.document.body.style.cursor="default";
}
}

function showtinh(str)
{
if (str==0)
  { 
  document.getElementById("tinh").innerHTML="";
  document.getElementById("tinh").style.display="none";  
  return;
  }
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="tinh.asp";
url=url+"?id_city="+str;
url=url+"&usid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}	 

function showtinhfs(str)
{
if (str==0)
  {   
  document.getElementById("tinhfs").innerHTML="";
  document.getElementById("tinhfs").style.display="none";  
  return;
  }
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="tinhfs.asp";
url=url+"?id_city="+str;
url=url+"&usid="+Math.random();
xmlHttp.onreadystatechange=stateChangedfs;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}	 

/* get result house home for txtAjax*///////////////////////////////////////////////////////////////////////////////

function showResultHome(loai,p)
{ 
var objHole=document.getElementById('txtAjaxhome');
if (objHole==null){
	window.location.href="raovat.asp?";	
}
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="";
if (loai<=4&&loai>0){
	url+="raovat/raovat_home_ajax.asp?loaigd="+loai;	
}else
{
	url+="raovat/raovat_list_duan_ajax.asp?tinh="+loai;	
}
if (p!=null){
url=url+"&whichpage="+p;
}
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=trangthaiHome;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function trangthaiHome(){ 
var objHole;
if(objHole=document.getElementById('tbldetail')){
	objHole.style.display="none";	
	}
if (objHole=document.getElementById('txtAjaxhome')){
	if (xmlHttp.readyState<4){ 
		window.document.body.style.cursor="wait";
	    document.getElementById("txtAjaxhome").innerHTML="<br><p align='center'><img src='image/loading.gif' border=0'></p>";
	}
	if (xmlHttp.readyState==4)
	{	
		objHole.innerHTML = xmlHttp.responseText;
		window.document.body.style.cursor="default";
	}
}
else{
	window.location.href="raovat.asp";	
	}
}

////////////////////////////////

//function show rao vat list from raovat detail, rao vat home.////////////////////////////////////////////////////////
function showRaovatlist(loaigd,loaibds,p)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="raovat/raovat_list_ajax.asp";
url+="?loaigd="+loaigd;
url+="&loaibds="+loaibds;
if (p!=null){
url=url+"&whichpage="+p;
}
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=trangthairaovatlist;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function trangthairaovatlist(){ 
if (xmlHttp.readyState<4){ 
	window.document.body.style.cursor="wait";
	document.getElementById("txtAjaxhome").innerHTML="<br><p align='center'><img src='image/loading.gif' border=0'></p>";

}
if (xmlHttp.readyState==4)
{
	window.document.body.style.cursor="default";
document.getElementById("txtAjaxhome").innerHTML =xmlHttp.responseText;
}
}
/* end get result house home for txtAjax*//////////////////////////////////////////////////////////////

// lay mot ma code moi //////////////////////////////////////////////////////////////////////
function getcodest() 
{ 
if (xmlHttp.readyState<4){ 
	document.getElementById("refesh").innerHTML="<img src='image/loading.gif' width=10 heigh=10>";
}
	if (xmlHttp.readyState==4)
	{ 
	document.frmSubmit.code.value=xmlHttp.responseText;
	document.getElementById("refesh").innerHTML="";

	}
}
function getcodsecurity(){
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="getcodesecurity.asp";
url=url+"?usid="+Math.random();
xmlHttp.onreadystatechange=getcodest;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}	
/////////////////////////////////////////////////////////////
function showRaovatlist_vip_top(p)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="raovat/raovat_vip_top_ajax.asp";
url=url+"?whichpage="+p;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=vip_top;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function vip_top(){ 
if (xmlHttp.readyState<4){ 
	window.document.body.style.cursor="wait";
	document.getElementById("raovatviptopajax").innerHTML="<br><p align='center'><img src='image/loading.gif' border=0'></p>";
}
if (xmlHttp.readyState==4)
{
document.getElementById("raovatviptopajax").innerHTML =xmlHttp.responseText;
window.document.body.style.cursor="default";
}
}
//////////////////////////////////////////////////////////////////////////////

