function loadcities(obj)
{
	
var browser=navigator.appName;
	var cityid=obj.value;
if(document.getElementById('tcontent1').style.display!='none' && document.getElementById('tcontent1')!=null)
{
var ctrlcity="rcity";
}
if(document.getElementById('tcontent3')!=null && document.getElementById('tcontent3').style.display!='none')
{
var ctrlcity="ccity";
}
if(document.getElementById('tcontent4')!=null && document.getElementById('tcontent4').style.display!='none')
{
var ctrlcity="lcity";
}
if(browser!='Microsoft Internet Explorer')
				  {
				 	document.getElementById(ctrlcity).innerHTML="<option value=''>Loading..Please wait</option>";
				  }
				  else
				  {
					    newcities="<option>Loading..Please wait</option>";
					
					  select_innerHTML(document.getElementById(ctrlcity),newcities);
				  }
				   document.getElementById(ctrlcity).disabled=true;
					var pars="city_id=" + cityid +"&f12id="+Math.random() ;
					var url="codefiles/city.php"
					var myAjax = new Ajax.Request(
					url,
					{
						method: 'get',
						parameters: pars,
						onComplete:sessionOut
					});
}
function sessionOut(originalRequest)
{
	var sPath = window.location.pathname;
		 var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	 	 var browser=navigator.appName;
		 var newcities='';
	 newcities=originalRequest.responseText;

	if(document.getElementById("rstate").value!="" && document.getElementById('tcontent1').style.display!='none'  )
	{     			if(browser!='Microsoft Internet Explorer')
				  {
				 	document.getElementById("rcity").innerHTML="<option value=''>Select City</option>"+newcities;
					document.getElementById("rcity").disabled=false;
				  }
				  else
				  {
					  newcities="<option value=''>Select City</option>"+newcities;
					
					 select_innerHTML(document.getElementById("rcity"),newcities);
				  }
	}
	else
	{
			 document.getElementById('rcity').options.length=1;
	}
	if(sPage=='index.php' || sPage=='index.html' || sPage=='')
	{	
		 if(document.getElementById("cstate").value!="" && document.getElementById('tcontent3').style.display!='none')
		{
				if(browser!='Microsoft Internet Explorer')
				  {
				 document.getElementById("ccity").innerHTML="<option value=''>Select City</option>"+newcities;
				  }
				  else
				  {
					 newcities="<option value=''>Select City</option>"+newcities;
					  select_innerHTML(document.getElementById("ccity"),newcities);
				  } 
				   document.getElementById("ccity").disabled=false;
		}	
		else
		{
				 document.getElementById('ccity').options.length=1;
		}
		 if(document.getElementById("lstate").value!="" && document.getElementById('tcontent4').style.display!='none')
		{
				  if(browser!='Microsoft Internet Explorer')
				  {
				 document.getElementById("lcity").innerHTML="<option value=''>Select City</option>"+newcities;
				 document.getElementById("lcity").disabled=false;
				  }
				  else
				  { document.getElementById('lcity').options.length=0;
						   newcities="<option value=''>Select City</option>"+newcities;
					  select_innerHTML(document.getElementById("lcity"),newcities);
				  }  
		}
		else
		{
				document.getElementById("lcity").options.length=1;
		}
	}
}

function loadcities1(obj)
{
var browser=navigator.appName;
if(browser!='Microsoft Internet Explorer')
				  {
				 	document.forms.requirementform.city.innerHTML="<option value=''>Loading.. please wait</option>";
				//	document.forms.requirementform.city.disabled=true;
				  }
				  else
				  {
					  
					    newcities="<option value=''>Loading.. please wait</option>";
			
					  select_innerHTML(document.forms.requirementform.city,newcities);
					   
				  }
				  		document.forms.requirementform.city.disabled=true;
	var cityid=obj.value;

			var pars="city_id=" + cityid +"&f12id="+Math.random() ;
	var url="codefiles/city.php"
	var myAjax = new Ajax.Request(
	url,
	{
		method: 'get',
		parameters: pars,
		onComplete:sessionOut7
	});
}

function loadcities2(obj)
{
	var browser=navigator.appName;
if(browser!='Microsoft Internet Explorer')
				  {
				 		document.forms.agentform.city.innerHTML="<option value=''>Loading.. please wait</option>";
				  }
				  else
				  {
					    newcities="<option value=''>Loading.. please wait</option>";
					  select_innerHTML(	document.forms.agentform.city,newcities);
				  }
				  document.forms.agentform.city.disabled=true;
	var cityid=obj.value;
	var pars="city_id=" + cityid +"&f12id="+Math.random() ;
	var url="codefiles/city.php"
	var myAjax = new Ajax.Request(
	url,
	{
		method: 'get',
		parameters: pars,
		onComplete:sessionOut8
	});
	
}
function loadcities4(obj)
{
var browser=navigator.appName;
if(browser!='Microsoft Internet Explorer')
				  {
				 		document.forms.agentsearch.city.innerHTML="<option value=''>Loading.. please wait</option>";
				  }
				  else
				  {
					    newcities="<option value=''>Loading.. please wait</option>";
					  select_innerHTML(	document.forms.agentsearch.city,newcities);
				  }
				  document.forms.agentsearch.city.disabled=true;
	var cityid=obj.value;

			var pars="city_id=" + cityid +"&f12id="+Math.random() ;
	var url="codefiles/city.php"
	var myAjax = new Ajax.Request(
	url,
	{
		method: 'get',
		parameters: pars,
		onComplete:sessionOut9
	});
}

function sessionOut8(originalRequest)
{
	var newcities=originalRequest.responseText;
	var sPath = window.location.pathname;
		 var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	 	 var browser=navigator.appName;
	if(browser!='Microsoft Internet Explorer')
				  {
				document.forms.agentform.city.innerHTML="<option value=''>Select City</option>"+newcities;
					document.forms.agentform.city.disabled=false;
				  }
				  else
				  {  	
					  newcities="<option value=''>Select City</option>"+newcities;
					  select_innerHTML( document.forms.agentform.city,newcities);
				  } 
}
function sessionOut7(originalRequest)
{ var newcities=originalRequest.responseText;
var sPath = window.location.pathname;
		 var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	 	 var browser=navigator.appName;
	 if(browser!='Microsoft Internet Explorer')
				  {
				 document.forms.requirementform.city.innerHTML="<option value=''>Select City</option>"+newcities;
				 document.forms.requirementform.city.disabled=false;
				  }
				  else
				  {  	
					  newcities="<option value=''>Select City</option>"+newcities;
					  select_innerHTML(document.forms.requirementform.city,newcities);
				  } 
}
function sessionOut9(originalRequest)
{
	var newcities=originalRequest.responseText;
	var sPath = window.location.pathname;
		 var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	 	 var browser=navigator.appName;
	if(browser!='Microsoft Internet Explorer')
				  {
				document.forms.agentsearch.city.innerHTML="<option value=''>Select City</option>"+newcities;
				document.forms.agentsearch.city.disabled=false;
				  }
				  else
				  {  	
					  newcities="<option value=''>Select City</option>"+newcities;
					  select_innerHTML( document.forms.agentsearch.city,newcities);
				  } 
}
  
  