function trim(str)
{
   return str.replace(/^\s+|\s+$/g,'');
}
function contactvalid()
	{
		
		if(EmailValidateCheck(document.contact.email,"your email address") == false){ return false; }
		if(EmailValidateCheck(document.contact.confirm_email,"your confirm email address") == false){ return false; }
		
		if (document.contact.email.value != document.contact.confirm_email.value) 
		{
			alert("The email and confirm email do not match !");
			document.contact.confirm_email.focus();
			document.contact.confirm_email.select();   	
			return false;
		}
		if(TextValidate(document.contact.names,"your name") == false){ return false; }
		if(TextValidate(document.contact.phone,"your phone number") == false){ return false; }
		if(TextValidate(document.contact.country,"your country") == false){ return false; }
		if(TextValidate(document.contact.budget,"your budget") == false){ return false; }
		if(NumberValidate(document.contact.bedroom,"minimum number of bedrooms") == false){ return false; }
		if(SelectValidate(document.contact.region,"your location") == false){ return false; }
		if(TextValidate(document.contact.requirement,"your other requirements") == false){ return false; }
		if(TextValidate(document.contact.code,"your security code") == false){ return false; }
		
		document.contact.action = 'contactus.php';
		document.contact.submit();		
		/*RegExp=/\w+(@{1})+[0-9a-zA-Z]+[.-]+[^+*=$@%][a-zA-Z.]/g;
		ntest=RegExp.test(document.contact.email.value);
		if (!ntest)
		{ 
			alert("You have typed in wrong email address!")
			document.contact.email.focus(); 
			return false; 
		}*/
		

	}
	function Search(){

	var frmObject=document.formsearch;
	var country = frmObject.country.value;	
	
	if(OptValidateSingle(frmObject.radio,"Rent or For Sale")==false) return false;
	

	document.formsearch.action="simple_results.php";
	document.formsearch.submit();		

}
function OptValidateSingle(optCtrl,msg) 
{
	var itemchecked = false;
	for(var i = 0 ; i < optCtrl.length; i++) 
	{
		if(optCtrl[i].checked)
		{
		  itemchecked = true;
		  return(optCtrl[i].value);
		}
	}
	if(!itemchecked) 
	{
		alert("Please choose an option for "+msg);
		if(optCtrl[0].focus)
			optCtrl[0].focus();
		return false;
	}
} // Function End
function get_type()

{

	for (i = 0; i < document.formsearch.radio.length; i++) 
	
	{
	
		if (document.formsearch.radio[i].checked){
	
			var val=document.formsearch.radio[i].value;
	
		}
	
	}
	
		if(val=='Rent'){
	
		var objselect=document.getElementById("pricefm");
		objselect.style.visibility="hidden";	
		var objselect=document.getElementById("priceto");
		objselect.style.visibility="hidden";
		var objselect=document.getElementById("currency");
		objselect.style.visibility="hidden";			
	
		}
	
		else{
	
			
	
			var objselect=document.getElementById("pricefm");
	
		objselect.style.visibility="visible";	
	
		var objselect=document.getElementById("priceto");
	
		objselect.style.visibility="visible";	
		var objselect=document.getElementById("currency");
		objselect.style.visibility="visible";			
	
		}	
}
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
