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 (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 (!/^\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 checkcontactForm()
{	

	if (!document.contactForm.YourFirstName.value)
		{
			alert('Error! Please Input your First Name.');
			document.contactForm.YourFirstName.focus();
			return false; }
	
	if (!document.contactForm.YourEmailAddress.value)
		{
			alert('Error! Please Input your Email Address.');
			document.contactForm.YourEmailAddress.focus();
			return false; }
		

	if (!document.contactForm.Detail.value)
	{
		alert('Error! Please input your Comments.');
		document.contactForm.Detail.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;		
	}
	
	if (document.orderform.scode.value!=document.orderform.securityCode.value)
		{
			alert('Error! Input Correct security code.');
			document.orderform.securityCode.focus();
			return false; }
			
	return true;
}

function checkorderform()
{
		if (!document.orderform.website_url.value)
		{
			alert('Error! Please Input your Website URL.');
			document.orderform.website_url.focus();
			return false; }

		if (!document.orderform.website_title.value)
		{
			alert('Error! Please Input your website Title.');
			document.orderform.website_title.focus();
			return false; }

		if (!document.orderform.website_desc.value)
		{
			alert('Error! Please input your website Description.');
			document.orderform.website_desc.focus();
			return false; }

		if (!document.orderform.website_tag.value)
		{
			alert('Error! Please input your website Tag separated by Comma.');
			document.orderform.website_tag.focus();
			return false; }

		
		if (!document.orderform.full_name.value)
		{
			alert('Error! Please Input your Full Name.');
			document.orderform.full_name.focus();
			return false; }
			
		if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(orderform.email.value))
		{
				alert("Invalid E-mail Address! Please re-enter.")
				document.orderform.email.focus();
				return false;		
		}
		
		if (!document.orderform.paypal_trans_id.value)
		{
			alert('Error! Please input Paypal Transaction ID.');
			document.orderform.paypal_trans_id.focus();
			return false; }
		
		if (document.orderform.scode.value!=document.orderform.securityCode.value)
		{
			alert('Error! Input Correct security code.');
			document.orderform.securityCode.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.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+'');");
} 

