var citynameObj;
function createRequestObject()
{
	  var obj;
	  var browser = navigator.appName;
	  if(browser == "Microsoft Internet Explorer")
	  	obj = new ActiveXObject("Microsoft.XMLHTTP");
	  else 
	  	obj = new XMLHttpRequest();
	   return obj;
}
function changecity(obj)
{
	citynameObj=createRequestObject();
		
	document.getElementById("modbusy").innerHTML="<img src='"+web_lite+"/images/busy.gif' />";	
	stateval=obj.value;		
	url="ajxfiles/checkCityName.php?statevalue="+escape(stateval);
	citynameObj.open('get', url+"&sid="+Math.random());
	citynameObj.onreadystatechange =displayavail;
	citynameObj.send(null);
}
function displayavail()
{
   try
   { 
   	if(citynameObj.readyState == 4)
	{
	    	try{
		  	if(citynameObj.status == 200)
		 	{
		   		document.getElementById("cityoption").innerHTML="<select class='smallinput' name='city'>"+citynameObj.responseText+"</select>";
				document.getElementById("modbusy").innerHTML="";
		   	}
		   	else{}
		}catch(e){}
	 }}
	catch(e){}
}
function changecity2(obj)
{
	citynameObj=createRequestObject();
		
	document.getElementById("modbusy2").innerHTML="<img src='"+web_lite+"/images/busy.gif' />";	
	stateval=obj.value;		
	url="ajxfiles/checkCityName.php?statevalue="+escape(stateval);
	citynameObj.open('get', url+"&sid="+Math.random());
	citynameObj.onreadystatechange =displayavail2;
	citynameObj.send(null);
}
function displayavail2()
{
   try
   { 
   	if(citynameObj.readyState == 4)
	{
	    	try{
		  	if(citynameObj.status == 200)
		 	{
		   		document.getElementById("cityoption2").innerHTML="<select class='smallinput' name='city'>"+citynameObj.responseText+"</select>";
				document.getElementById("modbusy2").innerHTML="";
		   	}
		   	else{}
		}catch(e){}
	 }}
	catch(e){}
}
function validatesearchprofile()
{
	document.searchprofilefrm.submit();
}
function validatesearchname()
{
	var error=0;
	
	if(document.nameform.findusername.value=="")
	{
		document.getElementById("errornamemessages").innerHTML = "* User Name is required.";
		document.nameform.findusername.focus()
		error =1;
		return false;
	}
	if(error==0)
	{
		document.nameform.submit();
	}
}
function validatesearchcommunity()
{
	var error=0;
	
	if(document.communityform.findcommunity.value=="")
	{
		document.getElementById("errorcommunitymessages").innerHTML = "* Community Name is required.";
		document.communityform.findcommunity.focus()
		error =1;
		return false;
	}
	if(error==0)
	{
		document.communityform.submit();
	}
}
function validateuserincommunity()
{
	var error=0;
	
	if(document.userincommunityform.communitylist.value=="Choose")
	{
		document.getElementById("errorcommunitymsg").innerHTML = "* Select a Community.";
		document.userincommunityform.communitylist.focus()
		error =1;
		return false;
	}
	if(document.userincommunityform.communityusername.value=="")
	{
		document.getElementById("errorcommunitymsg").innerHTML = "* User is required.";
		document.userincommunityform.communityusername.focus()
		error =1;
		return false;
	}
	if(error==0)
	{
		document.userincommunityform.submit();
	}
}
function callquicksearch(obj)
{
	obj.className="current";
	document.getElementById("searchname").className="";
	document.getElementById("searchcommunity").className="";
	document.getElementById("quicksearchcontent").style.display='block';
	document.getElementById("searchnamecontent").style.display='none';
	document.getElementById("searchcommunitycontent").style.display='none';
}
function callsearchname(obj)
{
	obj.className="current";
	document.getElementById("quicksearch").className="";
	document.getElementById("searchcommunity").className="";
	document.getElementById("searchnamecontent").style.display='block';
	document.getElementById("quicksearchcontent").style.display='none';
	document.getElementById("searchcommunitycontent").style.display='none';
}
function callsearchcommunity(obj)
{
	obj.className="current";
	document.getElementById("quicksearch").className="";
	document.getElementById("searchname").className="";
	document.getElementById("searchcommunitycontent").style.display='block';
	document.getElementById("searchnamecontent").style.display='none';
	document.getElementById("quicksearchcontent").style.display='none';
}
