function displayCity()
{
	var stateid =document.getElementById('VisitorStateId').value;
 	new Ajax.Updater('citydiv','../visitors/fillcity/?stateid='+stateid+'&flag=0',{asynchronous:true, evalScripts:true});
}
function displayCity1()
{
	var stateid =document.getElementById('VisitorStateId2').value;
 	new Ajax.Updater('citydiv2','../visitors/fillcity/?stateid='+stateid+'&flag=1',{asynchronous:true, evalScripts:true});
}
function displayCity2()
{
	var stateid =document.getElementById('EmailStateId').value;
 	new Ajax.Updater('citydiv','../admins/fillcity/?stateid='+stateid+"&flag=noall",{asynchronous:true, evalScripts:true});
}
function changeStateaddcity(){
	var countryid =document.getElementById('CityCountryId').value;
 	new Ajax.Updater('statediv','../admins/fillstate/?countryid='+countryid,{asynchronous:true, evalScripts:true});
}
 function deletePhoto(phid){
 	//alert(phid);
 	new Effect.Fade('delphotodiv'+phid);
 	new Ajax.Updater('photolistingdiv','/index.php/customers/photolisting/?phid='+phid,{asynchronous:true, evalScripts:true});
 	new Ajax.Updater('imagepositindiv','/index.php/customers/movetopositonRender/',{asynchronous:true, evalScripts:true});
 }

 //Function for photo move to position
  function photoMoveToPosition(phid){
   var moveto ="PhotodetailPosition"+phid;
   var mark ="PhotodetailMarkas"+phid;
   var position =document.getElementById(moveto).value;
	if(document.getElementById(mark))
	{
		var markas =document.getElementById(mark).value;
	}
	else
	{
		var markas ='0';
	}

	 new Ajax.Updater('imagepositindiv','/index.php/customers/movetopositon/?phid='+phid+'&position='+position+'&markas='+markas,{asynchronous:true, evalScripts:true});
//   setTimeout(new Ajax.Updater('imagepositindiv','/index.php/customers/movetopositon/?phid='+phid+'&position='+position+'&markas='+markas,{asynchronous:false, evalScripts:true}),2000);
   new Ajax.Updater('photolistingdiv','/index.php/customers/photoListingRender/',{asynchronous:true, evalScripts:true});
  }
function emailclk(id)
{

	new Ajax.Updater('','../citysites/emailclk/?id='+id+'&flag=0',{asynchronous:true, evalScripts:true});
}
function webclk(id)
{
	new Ajax.Updater('','../citysites/emailclk/?id='+id+'&flag=1',{asynchronous:true, evalScripts:true});
}
function audioclk(id)
{
	new Ajax.Updater('','../citysites/audioclk/?id='+id,{asynchronous:true, evalScripts:true});
}

function adminDisplayCity()
{
	var stateid =document.getElementById('InterestrateStateId').value;
	if(document.getElementById('InterestrateHidcity'))
	{
		var cityid =document.getElementById('InterestrateHidcity').value;
	}
	else
	{
		var cityid='';
	}
 	new Ajax.Updater('citydiv','../admins/fillcity2/?stateid='+stateid+'&city='+cityid,{asynchronous:true, evalScripts:true});
}
function adminDisplayCity2()
{
	var stateid =document.getElementById('CustomerStateId').value;
 	new Ajax.Updater('citydiv','../admins/fillcity2/?stateid='+stateid,{asynchronous:true, evalScripts:true});
}
function adminDisplayCity3()
{
	var stateid =document.getElementById('CustomerStateId').value;
 	new Ajax.Updater('citydiv','../admins/fillcity2/?stateid='+stateid+'&flag=1',{asynchronous:true, evalScripts:true});
}
function adminDisplayCity4(id,cityid)
{
	var stateid =document.getElementById(id).value;
 	new Ajax.Updater('citydiv','../admins/fillcity2/?stateid='+stateid+'&flag=1&city='+cityid,{asynchronous:true, evalScripts:true});
}
function displayCity4()
{
	var stateid =document.getElementById('EmailStateId').value;
 	new Ajax.Updater('citydiv','../admins/fillcity/?stateid='+stateid,{asynchronous:true, evalScripts:true});
}

// Function to change city of a customer dynamically

function transfercity()
{
	var subsid = document.getElementById('SubscriptionId').value;
	if(document.getElementById('InterestrateCityId'))
	{
		var city = document.getElementById('InterestrateCityId').value;
		new Ajax.Updater('resultdiv','../checkAvailableSlot/?cityid='+city+'&subsid='+subsid,{asynchronous:true, evalScripts:true});
	}
	else
	{
		alert("Please select a valid state first.");
	}

}
function GetAdminCityList(id, flag)
{

	var stateid =document.getElementById(id).value;
 	new Ajax.Updater('citydiv','../admins/fillcity2/?stateid='+stateid,{asynchronous:true, evalScripts:true});
}