// JavaScript to get state list
function ajaxSearch()
  { 
  //alert(document.form1.stateId.value);
  alert(document.form1.district.value);
  /*alert(document.form1.hotelType.value);
  alert(document.form1.location.value);
  alert(document.form1.hotelName.value);*/
   
  var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject(" Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function ()
     {
      if(xmlHttp.readyState==4)
        {
       // document.getElementById("ajxfac2").innerHTML=xmlHttp.responseText;
		 }
      }
	  
   /* var url="getstateList.php";
    url=url+"?countryId="+str;
	//alert(url);
    xmlHttp.open("GET",url,true);        
   xmlHttp.send(null);*/
  }
// JavaScript to get state list
function ajaxFunction2(str)
  { 
  var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject(" Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function ()
     {
      if(xmlHttp.readyState==4)
        {
        document.getElementById("ajxfac2").innerHTML=xmlHttp.responseText;
		 }
      }
	  
    var url="getstateList.php";
    url=url+"?countryId="+str;
	//alert(url);
    xmlHttp.open("GET",url,true);        
   xmlHttp.send(null);
  }
// JavaScript to get district list
function ajaxFunction(str)
  {
  //alert(str);
  var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject(" Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function ()
     {
      if(xmlHttp.readyState==4)
        {
        document.getElementById("ajxfac").innerHTML=xmlHttp.responseText;
		 }
      }
	  
    var url="getDistrictList.php"
    url=url+"?stateId="+str;
    xmlHttp.open("GET",url,true);
        
    xmlHttp.send(null);
  }
  
function ajaxFunctionAdmin(str)
  {
  //alert(str);
  var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject(" Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function ()
     {
      if(xmlHttp.readyState==4)
        {
        document.getElementById("ajxfac").innerHTML=xmlHttp.responseText;
		 }
      }
	  
    var url="../getDistrictList.php"
    url=url+"?stateId="+str;
    xmlHttp.open("GET",url,true);
        
    xmlHttp.send(null);
  }  
  function checkContactForm(form) {	
	var why = "";	
	 why += checkUsernamee(document.form1.name.value);
	 why +=	checkAddresse(document.form1.address.value);
	 why +=	checkmessage(document.form1.message.value);
	 why +=	checkcountryId(document.form1.countryId.value);
	 why +=	checkEmaile(document.form1.email.value);
	 why +=	checkPhonee(document.form1.telephone.value);
  if (why != "") {
       alert("Please enter the following fields.\n" + why);
       return false;
    }
document.form1.submit();
return true;
}
function checkUsernamee (strng) {

var error = "";
if (strng == "") {
   error = "Name.\n";
}
   /* var illegalChars = /\W/; // allow letters, numbers, and underscores
    if (illegalChars.test(strng)) {
    error = "The username contains illegal characters.\n";
    } */
return error;

 }
function checkAddresse(strng) {

	var error = "";
	if (strng == "") {
	   error = "Address.\n";
	 }
	 if (strng.length >250) {
	   error = "Address character should be less than 150.\n";
	 }
	 
	 return error;
}
function checkmessage(strng) {

	var error = "";
	if (strng == "") {
	   error = "message.\n";
	 }
	 return error;
}
 function checkcountryId(strng) {

	var error = "";
	if (strng == "") {
	   error = "Country.\n";
	 }
	 return error;
}
function checkEmaile (strng) {
var error="";
if (strng == "") {
   error = "Email address.\n";
}


 var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(strng))) { 
       error = "Please enter a valid email address.\n";
    }
    else {
//test email for illegal characters
       var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
         if (strng.match(illegalChars)) {
          error = "The email address contains illegal characters.\n";
       }
    }
return error;    
}

function checkPhonee (strng) {
var error = "";
if (strng == "") {
   error = "Phone number.\n";
}

return error;
}
/*function validTelephone(key){
	if(key==9 || key==8 || key==96 || key==97 || key==98 || key==99 || key==100 || key==101 || key==102 || key==103 || key==104 || key==105 || key==189 ) 
		return true; 
	else if(key < 46 || key > 57) 
		return false;
}
function validZip(key){
	if(key==9 || key==8 || key==96 || key==97 || key==98 || key==99 || key==100 || key==101 || key==102 || key==103 || key==104 || key==105 || key==189 || key==109 ) 
		return true; 
	else if(key < 46 || key > 57) 
		return false;
}*/
function validspace(key){
 //alert(key);
	 if(key==32) 
		return false;
}
