
var xmlHttp_addcity;


function addcitysubmit(addurl,countryaddid)

{

//alert(addurl);
xmlHttp_addcity=GetXmlHttpObject()

if (xmlHttp_addcity==null)

  {

  alert ("Your browser does not support AJAX!");

  return;

  } 


 var addcity=document.addnewcity.addcity.value;
  var addcitystate=document.addnewcity.addstateId.value;
  //alert(addcity+addcitystate);
if(addcitystate=='' || addcity=='')
{
if(addcitystate=='')
{
alert("Please Select State");
//return false;
}
if(addcity.search(/\S/)==-1)
{
alert("Please Write City Name");
//return false;

}
}
else{
var url=addurl+"/server_addnewcity.php";

url=url+"?countryaddid="+countryaddid+"&addcity="+addcity+"&addcitystate="+addcitystate;
//alert(url);
xmlHttp_addcity.onreadystatechange=addcity_test_post_vote_stateChanged;

xmlHttp_addcity.open("GET",url,true);

xmlHttp_addcity.send(null);
if(xmlHttp_addcity.readyState<4)
{
	document.getElementById("requestNewDiv").style.display='';
	document.getElementById("requestNewDiv").innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;<img src='"+addurl+"/images/loading.gif' /> Requesting...";
}

}
}
function addcity_test_post_vote_stateChanged() 

{ 

if (xmlHttp_addcity.readyState==4)

{ 



var text_array=xmlHttp_addcity.responseText;


document.getElementById("addcity").value='';
document.getElementById("addstateId").value='';
document.getElementById('requestNewDiv').innerHTML=text_array;
//alert(text_array);
timedCount_addcity();

}

}
function GetXmlHttpObject()

{

var xmlHttp=null;

try

  {

 

  xmlHttp=new XMLHttpRequest();

  }

catch (e)

  {

 

  try

    {

    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");

    }

  catch (e)

    {

    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");

    }

  }

return xmlHttp;

}