function checkenquiryForm()
{
	if (!document.enquiryForm.YourFirstName.value)
		{
			alert('Error! Please Input your First Name.');
			document.enquiryForm.YourFirstName.focus();
			return false; }
		
	if (!document.enquiryForm.YourLastName.value)
		{
			alert('Error! Please Input your Last Name.');
			document.enquiryForm.YourLastName.focus();
			return false; }

	if (!document.enquiryForm.YourEmailAddress.value)
		{
			alert('Error! Please Input your Email Address.');
			document.enquiryForm.YourEmailAddress.focus();
			return false; }
	
	if (!document.enquiryForm.YourPhoneNo.value)
	{
		alert('Error! Your Phone # is missing.');
		document.enquiryForm.YourPhoneNo.focus();
		return false; }
	
	if (!document.enquiryForm.bedroom.value)
	{
		alert('Error! How many bedroom you required?.');
		document.enquiryForm.bedroom.focus();
		return false; }
		
		
	if (!document.enquiryForm.YourBudget.value)
	{
		alert('Error! Please input your Budget.');
		document.enquiryForm.YourBudget.focus();
		return false; }
	
	if (!document.enquiryForm.YourLocation.value)
	{
		alert('Error! Location is missing.');
		document.enquiryForm.YourLocation.focus();
		return false; }

	if (!document.enquiryForm.YourDate.value)
	{
		alert('Error! Please input Date Required.');
		document.enquiryForm.YourDate.focus();
		return false; }
		
	if (!document.enquiryForm.Detail.value)
	{
		alert('Error! Please input your Comments.');
		document.enquiryForm.Detail.focus();
		return false; }
	
	if (document.enquiryForm.scode.value!=document.enquiryForm.securityCode.value)
	{	alert('Error! Input Correct security code.');
		document.enquiryForm.securityCode.focus();
		return false; }
		
	if (echeck(enquiryForm.YourEmailAddress.value)==false){
		document.enquiryForm.YourEmailAddress.value="";
		document.enquiryForm.YourEmailAddress.focus();
		return false
	}

	return true;
}

function checkListProperty()
{
	if (!document.listPropertyForm.YourFirstName.value)
		{
			alert('Error! Please Input your First Name.');
			document.listPropertyForm.YourFirstName.focus();
			return false; }
	
	if (!document.listPropertyForm.YourLastName.value)
		{
			alert('Error! Please Input your Last Name.');
			document.listPropertyForm.YourLastName.focus();
			return false; }

	if (!document.listPropertyForm.YourEmailAddress.value)
		{
			alert('Error! Please Input your Email Address.');
			document.listPropertyForm.YourEmailAddress.focus();
			return false; }
	
	if (!document.listPropertyForm.YourPhoneNo.value)
	{
		alert('Error! Your Phone # is missing.');
		document.listPropertyForm.YourPhoneNo.focus();
		return false; }
	
	if (!document.listPropertyForm.bedroom.value)
	{
		alert('Error! How many bedroom you required?.');
		document.listPropertyForm.bedroom.focus();
		return false; }
	
	if (!document.listPropertyForm.YourLocation.value)
	{
		alert('Error! Location is missing.');
		document.listPropertyForm.YourLocation.focus();
		return false; }

	if (!document.listPropertyForm.Detail.value)
	{
		alert('Error! Please input your Comments.');
		document.listPropertyForm.Detail.focus();
		return false; }
	
	if (document.listPropertyForm.scode.value!=document.listPropertyForm.securityCode.value)
	{	alert('Error! Input Correct security code.');
		document.listPropertyForm.securityCode.focus();
		return false; }
		
	if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(listPropertyForm.YourEmailAddress.value))
	{
			alert("Invalid E-mail Address! Please re-enter.")
			document.listPropertyForm.YourEmailAddress.focus();
			return false;		
	}
	return true;
	}

function checkmakeOfferForm()
{
	if (!document.makeOfferForm.YourFirstName.value)
		{
			alert('Error! Please Input your Full Name.');
			document.makeOfferForm.YourFirstName.focus();
			return false; }

	if (!document.makeOfferForm.YourEmailAddress.value)
		{
			alert('Error! Please Input your Email Address.');
			document.makeOfferForm.YourEmailAddress.focus();
			return false; }

	if (!document.makeOfferForm.YourPhoneNo.value)
	{
		alert('Error! Your Phone # is missing.');
		document.makeOfferForm.YourPhoneNo.focus();
		return false; }
	
	if (document.makeOfferForm.payment_plan.selectedIndex == 0)
	{   alert('Error! Please select Payment Plan.');
		document.makeOfferForm.payment_plan.focus();
		return false; 
		}
	
	if (document.makeOfferForm.amount_type.selectedIndex == 0)
	{   alert('Error! Please select Currency type.');
		document.makeOfferForm.amount_type.focus();
		return false; 
		}
		
	if (!document.makeOfferForm.offer_amount.value)
	{
		alert('Error! Your Offer Amount is missing.');
		document.makeOfferForm.offer_amount.focus();
		return false; }

	if (!document.makeOfferForm.Detail.value)
	{
		alert('Error! Please input your Comments.');
		document.makeOfferForm.Detail.focus();
		return false; }
	
	if (document.makeOfferForm.scode.value!=document.makeOfferForm.securityCode.value)
	{	alert('Error! Input Correct security code.');
		document.makeOfferForm.securityCode.focus();
		return false; }
		
	if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(makeOfferForm.YourEmailAddress.value))
	{
			alert("Invalid E-mail Address! Please re-enter.")
			document.makeOfferForm.YourEmailAddress.focus();
			return false;		
	}
		
	return true;
}

function checkcontactForm()
{
	if (!document.contactForm.YourFirstName.value)
		{
			alert('Error! Please Input your First Name.');
			document.contactForm.YourFirstName.focus();
			return false; }

	/*if (!document.contactForm.YourLastName.value)
		{
			alert('Error! Please Input your Last Name.');
			document.contactForm.YourLastName.focus();
			return false; }*/

	if (!document.contactForm.YourEmailAddress.value)
		{
			alert('Error! Please Input your Email Address.');
			document.contactForm.YourEmailAddress.focus();
			return false; }
		
	if (!document.contactForm.YourPhoneNo.value)
	{
		alert('Error! Your Phone # is missing.');
		document.contactForm.YourPhoneNo.focus();
		return false; }

	/*if (!document.contactForm.YourBudget.value)
	{
		alert('Error! Please input your Budget.');
		document.contactForm.YourBudget.focus();
		return false; }
		
	if (!document.contactForm.bedroom.value)
	{
		alert('Error! How many bedroom you required?.');
		document.contactForm.bedroom.focus();
		return false; }
			*/
	if (!document.contactForm.YourLocation.value)
	{
		alert('Error! Location is missing.');
		document.contactForm.YourLocation.focus();
		return false; }
		
	/*if (!document.contactForm.YourDate.value)
	{
		alert('Error! Please input Date Required.');
		document.contactForm.YourDate.focus();
		return false; }*/
		

	if (!document.contactForm.Detail.value)
	{
		alert('Error! Please input your Comments.');
		document.contactForm.Detail.focus();
		return false; }
	
	if (document.contactForm.scode.value!=document.contactForm.securityCode.value)
	{	alert('Error! Input Correct security code.');
		document.contactForm.securityCode.focus();
		return false; }
		
	if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(contactForm.YourEmailAddress.value))
	{
			alert("Invalid E-mail Address! Please re-enter.")
			document.contactForm.YourEmailAddress.focus();
			return false;		
	}
		
	return true;
}


function checkemailToFriend()
{	
	if (!document.emailToFriend.senderName.value)
	{
			alert('Error! Please Input Sender Name.');
			document.emailToFriend.senderName.focus();
			return false; }

/*	if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(emailToFriend.senderEmail.value))
	{
			alert("Invalid E-mail Address! Please re-enter.")
			document.emailToFriend.senderEmail.focus();
			return false;		
	}*/
	
	if (!document.emailToFriend.senderEmail.value)
	{
			alert("Invalid sender E-mail Address! Please re-enter.")
			document.emailToFriend.senderEmail.focus();
			return false; }

	if (!document.emailToFriend.receiverName.value)
	{
		alert('Error! Please Input Receiver Name.');
		document.emailToFriend.receiverName.focus();
		return false; }

	if (!document.emailToFriend.receiverEmail.value)
	{
		alert("Invalid receiver E-mail Address! Please re-enter.")
		document.emailToFriend.receiverEmail.focus();
		return false; }

	if (document.emailToFriend.scode.value!=document.emailToFriend.securityCode.value)
	{	alert('Error! Input Correct security code.');
		document.emailToFriend.securityCode.focus();
		return false; }
	
	return true;
}


function checksendEnquiry()
{	
	if (!document.sendEnquiry.senderName.value)
	{
		alert('Error! Please Input Sender Name.');
		document.sendEnquiry.senderName.focus();
		return false; }
	
	if (!document.sendEnquiry.senderEmail.value)
	{
		alert('Error! Please Input Sender Email Address.');
		document.sendEnquiry.senderEmail.focus();
		return false; }
	
	if (!document.sendEnquiry.senderPhone.value)
	{
		alert('Error! Please Input Phone #.');
		document.sendEnquiry.senderPhone.focus();
		return false; }
			
	if (document.sendEnquiry.scode.value!=document.sendEnquiry.securityCode.value)
	{	alert('Error! Input Correct security code.');
		document.sendEnquiry.securityCode.focus();
		return false; }

		
	return true;
}

function checkConfirmation()
{
	var answer = confirm("Are you sure you want to complete this process?")
	if (answer)
	{
		return true;
	}//end of IF Answer	
	else return false
}

function checkSearchForm()
{
	if (document.searchForm.unit_type_id.selectedIndex == 0 && document.searchForm.property_bedrooms.selectedIndex == 0 && document.searchForm.community.selectedIndex == 0)
	{   alert('Error! Please select at least any one option to process Searching.');
		document.searchForm.unit_type_id.focus();
		return false; }

	return true;
	}

function echeck(str)
{
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1)
		{
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}

function popUp(URL, popupwidth, popupheight) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width='+ popupwidth +',height='+popupheight+'');");
} 
