function ValidateFreePropertyListingFrm()
{
	pName=document.FreePropertyListingFrm.pName.value;
	pEmail=document.FreePropertyListingFrm.pEmail.value;
	pContactNo=document.FreePropertyListingFrm.pContactNo.value;
	pProjectName=document.FreePropertyListingFrm.pProjectName.value;
	pPropertyType=document.FreePropertyListingFrm.pPropertyType.value;
	pBedrooms=document.FreePropertyListingFrm.pBedrooms.value;
	pFloor=document.FreePropertyListingFrm.pFloor.value;
	pArea=document.FreePropertyListingFrm.pArea.value;
	pPrice=document.FreePropertyListingFrm.pPrice.value;
	
		if (pName==0)
		{
			alert("Please specify your name");
			return false;
		}

		if (ValidateEmail(pEmail)==false)
			return false;

		if (pContactNo==0)
		{
			alert("Please specify your contact no.");
			return false;
		}

		if (pProjectName==0)
		{
			alert("Please specify your project name");
			return false;
		}

		if (pPropertyType=='N/A')
		{
			alert("Please specify your property type");
			return false;
		}

		if (pBedrooms=='N/A')
		{
			alert("Please specify no of bedrooms");
			return false;
		}

		if (pFloor=='N/A')
		{
			alert("Please specify floor no.");
			return false;
		}

		if (pArea==0)
		{
			alert("Please specify area in sqft.");
			return false;
		}

		if (pPrice==0)
		{
			alert("Please specify price in AED");
			return false;
		}


return true;
}



function ValidateSubscriptionFrm()
{
	MemberName=document.SubscriptionFrm.MemberName.value;
	MemberEmail=document.SubscriptionFrm.MemberEmail.value;

		if (MemberName==0)
		{
			alert("Please specify your name");
			return false;
		}

		if (ValidateEmail(MemberEmail)==false)
			return false;


return true;
}



function ValidateReferFrm()
{
	YourName=document.ReferFrm.YourName.value;
	YourEmail=document.ReferFrm.YourEmail.value;
	FriendName=document.ReferFrm.FriendName.value;
	FriendEmail=document.ReferFrm.FriendEmail.value;

		if (YourName==0)
		{
			alert("Please specify your name");
			return false;
		}

		if (ValidateEmail(YourEmail)==false)
			return false;

		if (FriendName==0)
		{
			alert("Please specify your friend name");
			return false;
		}

		if (ValidateEmail(FriendEmail)==false)
			return false;

return true;
}


function ValidateEnquiryFrm()
{
	EName=document.EnquiryFrm.EName.value;
	EEmail=document.EnquiryFrm.EEmail.value;
	EContactNo=document.EnquiryFrm.EContactNo.value;
	ECountry=document.EnquiryFrm.ECountry.value;
	ECity=document.EnquiryFrm.ECity.value;
	EMsg=document.EnquiryFrm.EMsg.value;


		if (EName==0)
		{
			alert("Please specify your name");
			return false;
		}

		if (ValidateEmail(EEmail)==false)
			return false;

		if (EContactNo==0)
		{
			alert("Please specify your contact no");
			return false;
		}

		if (ECountry==0)
		{
			alert("Please specify your country of residence");
			return false;
		}

		if (ECity==0)
		{
			alert("Please specify your city of residence");
			return false;
		}

		if (EMsg==0)
		{
			alert("Please specify your message");
			return false;
		}

return true;
}


function ValidateEmail(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					
}