var xmlHttp1;

function check(businessname,bphno,addr1,addr2,country,state,city,zip,firstname,lastname,email,pphno)
{ 

xmlHttp1=GetXmlHttpObject1();
if (xmlHttp1==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 

//alert(businessname);
//alert(bphno);
//alert(addr1);
//alert(addr2);
//alert(country);
//alert(city);
//alert(website);
//alert(zip);


if (businessname!=="" && bphno!=="" && addr1!=="" && country!=="" && city!=="" && zip!=="" && firstname!=="" && lastname!=="" && email!=="" && pphno!=="")

{
//alert("Ok");
document.selectlocation.submit();

}

else
{

var post_file="checkfields.asp";
url = "";
url=url+"businessname="+businessname;
url=url+"&bphno="+bphno;
url=url+"&addr1="+addr1;
url=url+"&addr2="+addr2;
url=url+"&country="+country;
url=url+"&state="+state;
url=url+"&city="+city;
url=url+"&zip="+zip;
url=url+"&firstname="+firstname;
url=url+"&lastname="+lastname;
url=url+"&email="+email;
url=url+"&pphno="+pphno;
url=url+"&sid1="+Math.random();
xmlHttp1.onreadystatechange=alertContents;
xmlHttp1.open("POST",post_file,true);
xmlHttp1.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp1.setRequestHeader("Content-length", url.length);
xmlHttp1.setRequestHeader("Connection", "close");
xmlHttp1.send(url);

}

}




function alertContents() 
{ 
if (xmlHttp1.readyState==4)
{ 

 if (xmlHttp1.status == 200)
 {
		var sContentType = xmlHttp1.getResponseHeader("Content-Type");
                //alert(sContentType);            

//alert(xmlHttp1.responseText);
		document.getElementById("errortext").innerHTML=xmlHttp1.responseText;
 }
else
{
alert("error");
}

}


}







function GetXmlHttpObject1()
{
var xmlHttp1=null;
//xmlHttp1 = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         xmlHttp1 = new XMLHttpRequest();
         if (xmlHttp1.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //xmlHttp1.overrideMimeType('text/xml');
            xmlHttp1.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            xmlHttp1 = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               xmlHttp1 = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!xmlHttp1) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      

return xmlHttp1;
}




var xmlHttp;

function showstate(str)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 

var url = "getcitylist.asp";
url=url+"?state="+str;
url=url+"&sid2="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);


//xmlHttp.setRequestHeader("Connection", "close");
//xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
//xmlHttp.setRequestHeader("Content-length", url.length);
//xmlHttp.setRequestHeader("Connection", "close");


xmlHttp.send(null);



}




function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{
			if (xmlHttp.status == 200)
 			{
                                    	//  document.getElementById("statencity").innerHTML="";
					document.getElementById("statencity").innerHTML=xmlHttp.responseText;
			}
			else	
			{
					alert('There was a problem with the request.');

			}
}

}

function GetXmlHttpObject()
{
var xmlHttp=null;
xmlHttp = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         xmlHttp = new XMLHttpRequest();
         if (xmlHttp.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //xmlHttp.overrideMimeType('text/xml');
            xmlHttp.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!xmlHttp) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      

return xmlHttp;
}






var xmlHttp2;

function showlocality(str,state)
{ 
xmlHttp2=GetXmlHttpObject();
if (xmlHttp2==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 

//alert(state);
var url = "getlocality.asp";
url=url+"?city="+str;
url=url+"&state="+state;
url=url+"&sid3="+Math.random();
xmlHttp2.onreadystatechange=stateChangedvalue;
xmlHttp2.open("GET",url,true);
//xmlHttp.setRequestHeader("Connection", "close");
//xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
//xmlHttp.setRequestHeader("Content-length", url.length);
//xmlHttp.setRequestHeader("Connection", "close");
xmlHttp2.send(null);




}




function stateChangedvalue() 
{ 
if (xmlHttp2.readyState==4)
{
			if (xmlHttp2.status == 200)
 			{
                                       
					document.getElementById("localitydiv").innerHTML=xmlHttp2.responseText;
			}
			else	
			{
					alert('There was a problem with the request.');

			}
}

}

function GetXmlHttpObject()
{
var xmlHttp2=null;
xmlHttp2 = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         xmlHttp2 = new XMLHttpRequest();
         if (xmlHttp2.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //xmlHttp2.overrideMimeType('text/xml');
            xmlHttp2.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            xmlHttp2 = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               xmlHttp2 = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!xmlHttp2) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      

return xmlHttp2;
}


