function verifylogin()
{
   if (document.frmlogin.elements[0].value == "")
   {	
	  alert("Please fill the User ID");
	  document.frmlogin.elements[0].focus();
	  return (false);
   }
 else if (document.frmlogin.elements[1].value == "")
   {	
		alert("Please fill the Password");
		document.frmlogin.elements[1].focus();
		return (false);
   }		
}

function verifypropertyid()
{
   if (document.frmsearchid.elements[0].value == "")
   {	
	  alert("Please fill the Property ID");
	  document.frmsearchid.elements[0].focus();
	  return (false);
   }		
}

function usertype2(pos)
{
	if(pos==1)
	{
		change_dropdown2('user_type1')			
	}
	else
	{
		change_dropdown2('user_type2')
	}				
}

function change_dropdown2(opt)
{
	if (opt=='user_type1')
	{
		var myid = '1';
		var myindex = 5;
	}
	else if (opt=='user_type2')
	{
		var myid = '2';
		var myindex = 5;
	}
	else
	{
		return false;
	}
	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}
	
	xmlHttp.onreadystatechange = DisplayResult1;
	
    xmlHttp.open("POST","change_dropdown.php?myid=" + myid + "&myindex=" +  myindex + "&opt=" +  opt,true);
    xmlHttp.send(null); 
}

function DisplayResult1()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		var xmlResponse = xmlHttp.responseXML;
		
		opt = xmlResponse.getElementsByTagName("opt1")[0].childNodes[0].nodeValue;
		
		var IDArray = xmlResponse.getElementsByTagName("id");
		
		document.findproperty.budget_from.length = 0;
		document.findproperty.budget_from.length = IDArray.length;
		
		document.findproperty.budget_to.length = 0;
		document.findproperty.budget_to.length = IDArray.length;
		
		for (var i=0; i < IDArray.length; i++) 
		{
			document.findproperty.budget_from.options[i].text  = xmlResponse.getElementsByTagName("name")[i].childNodes[0].nodeValue;
			document.findproperty.budget_from.options[i].value = xmlResponse.getElementsByTagName("id")[i].childNodes[0].nodeValue;
			
			document.findproperty.budget_to.options[i].text  = xmlResponse.getElementsByTagName("name")[i].childNodes[0].nodeValue;
			document.findproperty.budget_to.options[i].value = xmlResponse.getElementsByTagName("id")[i].childNodes[0].nodeValue;
		}
	}	
}

function usertype3(pos)
{	
	if(pos==1)
	{
		change_dropdown3('user_type1')			
	}
	else
	{
		change_dropdown3('user_type2')
	}						
}

function change_dropdown3(opt)
{
	if (opt=='user_type1')
	{
		var myid = '1';
		var myindex = 5;
	}
	else if (opt=='user_type2')
	{
		var myid = '2';
		var myindex = 5;
	}
	else
	{
		return false;
	}
	

	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}
	
	xmlHttp.onreadystatechange = DisplayResult2;
	
    xmlHttp.open("POST","change_dropdown.php?myid=" + myid + "&myindex=" +  myindex + "&opt=" +  opt,true);
    xmlHttp.send(null); 
}

function DisplayResult2()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		var xmlResponse = xmlHttp.responseXML;
		
		opt = xmlResponse.getElementsByTagName("opt1")[0].childNodes[0].nodeValue;
		
		var IDArray = xmlResponse.getElementsByTagName("id");
		
		document.postproperty.budget_from_r.length = 0;
		document.postproperty.budget_from_r.length = IDArray.length;
		
		document.postproperty.budget_to_r.length = 0;
		document.postproperty.budget_to_r.length = IDArray.length;
		
		for (var i=0; i < IDArray.length; i++) 
		{
			document.postproperty.budget_from_r.options[i].text  = xmlResponse.getElementsByTagName("name")[i].childNodes[0].nodeValue;
			document.postproperty.budget_from_r.options[i].value = xmlResponse.getElementsByTagName("id")[i].childNodes[0].nodeValue;
			
			document.postproperty.budget_to_r.options[i].text  = xmlResponse.getElementsByTagName("name")[i].childNodes[0].nodeValue;
			document.postproperty.budget_to_r.options[i].value = xmlResponse.getElementsByTagName("id")[i].childNodes[0].nodeValue;
		}
	}	
}

function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}

function verify()
   {
	if (document.forms[0].elements[0].value == "")
	   {	
	  alert("Please fill the User ID");
	  document.forms[0].elements[0].focus();
	  return (false);
	   }
	else if (document.forms[0].elements[1].value == "")
	   {	
	  
		  alert("Please fill the Password");
		  document.forms[0].elements[1].focus();
	  return (false);
	   }
   }
function set(form)
{
  document.forms[0].elements[0].focus();
}

function verifyfindproperty()
   {
   		   if (document.findproperty.property_id_find.value == 0)
		   {	
			  alert("Please Select Property Type.");
			  document.findproperty.property_id_find.focus();
			  return (false);
		   }
		 else if (document.findproperty.city_id_find.value == "none")
		   {	
			  	alert("Please Select City.");
			  	document.findproperty.city_id_find.focus();
		  		return (false);
		   }
		   else if (document.findproperty.budget_from.value != 0 && document.findproperty.budget_to.value == 0)
		   {	
			  	alert("Please Select Budget Max.");
			  	document.findproperty.budget_to.focus();
		  		return (false);
		   }
		   else if (document.findproperty.budget_from.value == 0 && document.findproperty.budget_to.value != 0)
		   {	
			  	alert("Please Select Budget Min.");
			  	document.findproperty.budget_to.focus();
		  		return (false);
		   }
		    else if (document.findproperty.budget_from.value>document.findproperty.budget_to.value )
		   {	
			  	alert("Maximum Budget Should Be Greater Than Minimum Budget.");
			  	document.findproperty.budget_to.focus();
		  		return (false);
		   }		
   }
   
   function verifypostproperty()
   {
		   if (document.postproperty.property_id_find.value == 0)
		   {	
			  alert("Please Select Property Type.");
			  document.postproperty.property_id_find.focus();
			  return (false);
		   }
		   
		 else if (document.postproperty.city_id_find.value == "none")
		   {	
			  	alert("Please Select City.");
			  	document.postproperty.city_id_find.focus();
		  		return (false);
		   }
		   else if (document.postproperty.budget_from.value != 0 && document.postproperty.budget_to.value == 0)
		   {	
			  	alert("Please Select Budget Max.");
			  	document.postproperty.budget_to.focus();
		  		return (false);
		   }
		   else if (document.postproperty.budget_from.value == 0 && document.postproperty.budget_to.value != 0)
		   {	
			  	alert("Please Select Budget Min.");
			  	document.postproperty.budget_to.focus();
		  		return (false);
		   }
		   
		    else if (document.postproperty.budget_from.value>document.postproperty.budget_to.value )
		   {	
			  	alert("Maximum Budget Should Be Greater Than Minimum Budget.");
			  	document.postproperty.budget_to.focus();
		  		return (false);
		   }
   }
	 
	function verifylogin()
   {
		   if (document.frmlogin.elements[0].value == "")
		   {	
			  alert("Please fill the User ID");
			  document.frmlogin.elements[0].focus();
			  return (false);
		   }
		 else if (document.frmlogin.elements[1].value == "")
		   {	
			  	alert("Please fill the Password");
			  	document.frmlogin.elements[1].focus();
		  		return (false);
		   }		
   }
	 
	 	function showpage(k)
	{
		
		//obj1 = document.getElementById("city_option1");
		obj2 = document.getElementById("city_option2");
		obj3 = document.getElementById("city_option3");
		obj4 = document.getElementById("city_option4");
		obj5 = document.getElementById("city_option5");
		
		//if (obj1.checked==true)
		//{
		//	cbotype=1;
		//}
		if (obj2.checked==true)
		{
			cbotype=2;
		}
		else if (obj3.checked==true)
		{
			cbotype=3;
		}
		else if (obj4.checked==true)
		{
			cbotype=4;
		}
		else if (obj5.checked==true)
		{
			cbotype=5;
		}
		
		if (cbotype==1)
		{
			var id=document.getElementById("my_city").value;
			
			var query="id="+id;
			var linkpage="city_special.php";
			
			if (id=="more")
			{
				document.frmsearchid.action= "more_cities_special.php";
				document.frmsearchid.method="post";
				document.frmsearchid.submit();
				return false
			}
			else
			{
				document.frmsearchid.action= linkpage + "?"+query;
				document.frmsearchid.method="post";
				document.frmsearchid.submit();
			}
		}
		else if (cbotype==2)
		{
			var id=document.getElementById("my_city").value;
			
			var query="id="+id;
			var linkpage="list_rates.php";
			
			if (id=="more")
			{
				document.frmsearchid.action= "more_cities_rates.php";
				document.frmsearchid.method="post";
				document.frmsearchid.submit();
				return false
			}
			else
			{
				document.frmsearchid.action= linkpage + "?"+query;
				document.frmsearchid.method="post";
				document.frmsearchid.submit();
				return false

			}
		}
		else if (cbotype==3)
		{
			var id=document.getElementById("my_city").value;
			
			var query="id="+id;
			var linkpage="agent_list.php";
			
			if (id=="more")
			{
				document.frmsearchid.action= "more_cities_agents.php";
				document.frmsearchid.method="post";
				document.frmsearchid.submit();
				return false
			}
			else
			{
				document.frmsearchid.action= linkpage + "?"+query;
				document.frmsearchid.method="post";
				document.frmsearchid.submit();
				return false

			}
		}
		else if (cbotype==4)
		{
			var id=document.getElementById("my_city").value;
			
			var query="city_id="+id;
			var linkpage="builder_search_list.php";
			
			if (id=="more")
			{
				document.frmsearchid.action= "more_cities_builders.php";
				document.frmsearchid.method="post";
				document.frmsearchid.submit();
				return false
			}
			else
			{
				document.frmsearchid.action= linkpage + "?"+query;
				document.frmsearchid.method="post";
				document.frmsearchid.submit();
				return false
			}
		}
		else if (cbotype==5)
		{
			var id=document.getElementById("my_city").value;
			
			var query="id="+id;
			var linkpage="search_requirement.php";
			
			if (id=="more")
			{
				document.frmsearchid.action= "more_cities_requirement.php";
				document.frmsearchid.method="post";
				document.frmsearchid.submit();
			}
			else
			{
				document.frmsearchid.action= linkpage + "?"+query;
				document.frmsearchid.method="post";
				document.frmsearchid.submit();
			}
			return false
		}
	}
	
function openchild(thisurl)
{
    msgWindow=window.open( '' ,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=570,height=420');
		msgWindow.focus();
		msgWindow.location.href = thisurl;
}
	