// JavaScript Document


   function popup(sPicPath) {   
     window.open('url.html?'+sPicPath,'Picture','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizeable=0,left=50,top=50')
   } 


function validate(frm){			
		
		
		var contact_frm = document.getElementById('contact_us');

		if(trim(contact_frm.nameid.value) == "")
		{
			alert("Please enter your Name");
			return false;
		}
				
		if(trim(contact_frm.emailid.value) == "" )
		{
			alert("Please enter your Email Id");
			return false;
		}
		if(!ValidEmail(trim(contact_frm.emailid.value)))
		{
			alert("Please enter valid email address");
			return false;
		}
		

		if(trim(contact_frm.telid.value) == "" )
		{
			alert("Please enter your Telephone Number");
			return false;
		}
		
		if(trim(contact_frm.typeid.value) == "")
		{
			alert("Please enter your Property Required");
			return false;
		}
		
		if(trim(contact_frm.locationid.value) == "")
		{
			alert("Please enter your Locations");
			return false;
		}
		
		if(trim(contact_frm.priceid.value) == "")
		{
			alert("Please enter your starting Price Range");
			return false;
		}
		
		
		if(trim(contact_frm.pricetoid.value) == "")
		{
			alert("Please enter your ending Price Range");
			return false;
		}
		
		return true;
		
		}


function trim(inputString) {
		var returnString = inputString;
		var removeChar =' ';
		if (removeChar.length){
		  while(''+returnString.charAt(0)==' ')	{
			  returnString=returnString.substring(1,returnString.length);
			}
			while(''+returnString.charAt(returnString.length-1)==' '){
			returnString=returnString.substring(0,returnString.length-1);
		  }
		  
		}
		return returnString;
	}
		
			function ValidEmail(objFieldValue){		
		
			var validFormatRegExp=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
			
			var isValid=validFormatRegExp.test(objFieldValue);
			
			return isValid;		
				
		}
