// JavaScript Document
var xmlHttp;

function show_province(id)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  } 
  
  
  if(document.getElementById("country").value=='1' || document.getElementById("country").value=='2' || document.getElementById("country").value=='0')
  {
  document.getElementById("state_display").style.display='';
  document.getElementById("city_display").style.display='';
  }
  
  else
  {
	 document.getElementById("state_display").style.display='none';
     document.getElementById("city_display").style.display='none'; 
  }


var url="ajax_province.php";
url=url+"?country_id="+id;
url=url+"&sid="+Math.random();

xmlHttp.onreadystatechange=stateChanged_province;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 

function stateChanged_province() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("province").innerHTML=xmlHttp.responseText; 
 document.getElementById("city").innerHTML='<select name="city"  class="dropdown" tabindex="16"><option value="0">Select City</option></select>'; 
 } 
}
function show_city(id)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  } 
var url="ajax_province.php";
url=url+"?province_id="+id;
url=url+"&sid="+Math.random();

xmlHttp.onreadystatechange=stateChanged_city;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function stateChanged_city() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 {  
 document.getElementById("city").innerHTML=xmlHttp.responseText; 
 } 
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 // Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}
