	
	
		function SaveMe()
		{
		   		
			if (document.frmcontactus.ownername.value =="")
			{
				alert ("Please Enter Name");
				document.frmcontactus.ownername.focus();
				return(false);
			}
			else if (document.frmcontactus.email.value =="")
			{
				alert ("Please enter your Email Address");
				document.frmcontactus.email.focus();
				return(false);
			}
			else if (document.frmcontactus.telenum.value =="")		
			{
				alert ("Please Enter Contact number");
				document.frmcontactus.telenum.focus();
				return(false);
			}
			else if (document.frmcontactus.inquiringabout.value =="")
			{
				alert ("Please enter your inquiry details");
				document.frmcontactus.inquiringabout.focus();
				return(false);
			}
			else if (document.frmcontactus.txtmessage.value =="")
			{
				alert ("Please enter your message to us");
				document.frmcontactus.txtmessage.focus();
				return(false);
			}
			else
			{
				location="contactus.php?ownername="+ document.frmcontactus.ownername.value +"&cmpname="+ document.frmcontactus.cmpname.value +"&addr="+ document.frmcontactus.addr.value +"&email="+ document.frmcontactus.email.value +"&city="+ document.frmcontactus.city.value +"&telenum="+ document.frmcontactus.telenum.value +"&txtmessage="+ document.frmcontactus.txtmessage.value +"";	
			}
		}
	function check(k)
		{
					for(i=k;i<2;i++)
						{
						  	if (document.frmcontactus.elements[i].value =="")
								{
									alert ("Please fill in the " + document.frmcontactus.elements[i].name +"field");
									document.frmcontactus.elements[i].focus();
									return(false);
								}
						}
				//validation for email
				k=k+1;
				var val=parseInt(document.frmcontactus.elements[k].value.indexOf('@',0));
				var val1=parseInt(document.frmcontactus.elements[k].value.indexOf('.',0));
  
				if ((val==-1) || (val1==-1))
					{
						alert("Invalid email") ;
						document.frmcontactus.elements[k].focus();
						document.frmcontactus.elements[k].value="";
						return(false);
        			}
        
				var e_length =parseInt(document.frmcontactus.elements[k].value.length);     
			
				if (e_length < 8) 
					{  
						alert("Email length is too short");
						document.frmcontactus.elements[k].focus();
						document.frmcontactus.elements[k].value="";
						return(false)
					}

				var pos=0;
        
				for (i=0;i<e_length;i++)    
					{
						var email=(document.frmcontactus.elements[k].value.charAt(i));
			
						if (email=="@")
							{ 
								pos=pos+1;
							}
       
					}
      
				if (pos >1 )
					{
						alert("Too many @");
						document.frmcontactus.elements[k].focus();
						document.frmcontactus.elements[k].value="";
						return(false);
					}  
         
				var aa="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
         
				for (i=0;i<e_length;i++)   
					{
						var charval=document.frmcontactus.elements[k].value.charAt(i);
					
						if ((charval == "@")|| (charval == "."))
							{
								continue;
							} 
						else
							{
								if (aa.indexOf(charval)==-1)
									{
										alert("No special character");
										document.frmcontactus.elements[k].focus();
										document.frmcontactus.elements[k].value="";
										return false;
									}
							}
					}
}


function SearchMe()
{
	if (document.frmsearch.city1.value =="")
	{
		alert ("All fields are mandatory in order for us to show you the property you are looking for. Please enter city name.");
		document.frmsearch.city1.focus();
		return(false);
	}
	else if (document.frmsearch.state.value == "0")
	{
		alert ("All fields are mandatory in order for us to show you the property you are looking for. Please select State Code from the drop down box.");
		document.frmsearch.state.focus();
		return(false);
	}
	else 
	{
		location="search.php?callfrom=DispFile&county=&type="+ document.frmsearch.type.value +"&state="+ document.frmsearch.state.value +"&projname="+ document.frmsearch.projname.value +"&message=&city1="+ document.frmsearch.city1.value ;			
	}
}

function SearchMePrj()
{
	if (document.frmsearch.projname.value == "")
	{
		alert ("Project name is mandatory in order for us to search the property you are looking for. Please Enter Project Name");
		document.frmsearch.projname.focus();
		return(false);
	}
	else 
	{
		location="search.php?callfrom=DispFilePrj&country=&type=&state=&projname="+ document.frmsearch.projname.value +"&message=";			
	}
}



function openWindow(internalURL,internalName,internalArgs)
{
	if (internalArgs == null || internalArgs == '')
	{	
		internalArgs = 'scrollbars,resizable,toolbar,status,width=640,height=480,left=50,top=50';
	}
	popupWin = window.open(internalURL,internalName,internalArgs);
	popupWin.focus();
}

function OpWind(p_strUrl)
{
	DispWin = window.open('p_strUrl', 'NewWin', 'toolbar=no,status=no,width=300,height=300')
	message = "U got this Page ";
	DispWin.document.write(message);
}

function OpNewWind()
{
	DispWin = window.open('l', 'NewWin', 'toolbar=no,status=no,width=300,height=300')
	message = "U got this Page ";
	DispWin.document.write(message);
}

function messageme()
{
	alert ("this is href clicked");

}
