// JavaScript Document

function PropertyPriceEstimatorValidation()
{   //alert('dhfjhdshfhf');
	
	
	if(!validateMailId(document.getElementById('email').value))
	{
		error="Sorry! Enter your valid email.";
		document.getElementById('PropertyPriceEstimatorFeedback').innerHTML='';
		document.getElementById('PropertyPriceEstimatorFeedback').innerHTML=error;
		return false;
	}
	else if(!validatePhone(document.getElementById('phone').value))
	{
		error="Sorry! Enter your phone.";
		document.getElementById('PropertyPriceEstimatorFeedback').innerHTML='';
		document.getElementById('PropertyPriceEstimatorFeedback').innerHTML=error;
		return false;
	}
	else if(document.getElementById('np_pro_covered_area').value== '')
	{
		error="Sorry! Enter Area.";
		document.getElementById('PropertyPriceEstimatorFeedback').innerHTML='';
		document.getElementById('PropertyPriceEstimatorFeedback').innerHTML=error;
		return false;
	}
	else
	{
		document.getElementById('PropertyPriceEstimatorFeedback').innerHTML='';
		document.getElementById('propertyValue').innerHTML='';
		document.getElementById('propertyValueIndicator').style.display='block';
		PropertyPriceEstimatorFormSubmitAjax();
	}
	
}


function PropertyPriceEstimatorFormSubmitAjax()
{
	var name=document.getElementById('name').value;
	var email=document.getElementById('email').value;
	var phone=document.getElementById('phone').value;
	var SearchPropertyType=document.getElementById('SearchPropertyType').value;
	
	var PropertySearchCity=document.getElementById('PropertySearchCity').value;
	var PropertySearchLocalitytmp=document.getElementById('PropertySearchLocality').value;
		if(PropertySearchLocalitytmp=='Please Enter Locality')
		{
			var PropertySearchLocality='';
		}
		else
		{
			var PropertySearchLocality=PropertySearchLocalitytmp;
		}
	var PropertySearchAddress=document.getElementById('PropertySearchAddress').value;
	var np_pro_covered_area=document.getElementById('np_pro_covered_area').value;
	
	var np_cov_area_type=document.getElementById('np_cov_area_type').value;
	var np_pro_covered_area_hidden=document.getElementById('np_pro_covered_area_hidden').value;
	//alert(np_pro_covered_area_hidden);
	var np_pro_beds=document.getElementById('np_pro_beds').value;
	var np_pro_baths=document.getElementById('np_pro_baths').value;
	
	var propertyTotalFloor=document.getElementById('propertyTotalFloor').value;
	var propertyFloorNo=document.getElementById('propertyFloorNo').value;
	var propertyBuiltYear=document.getElementById('propertyBuiltYear').value;
	//var loc_id=strloc;
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	
	xmlHttp.onreadystatechange=PropertyPriceEstimatorResponse
	var url="PropertyPriceEstimatorFormsubmit.php"
	url=url+"?name="+name
	url=url+"&email="+email
	url=url+"&phone="+phone
	url=url+"&SearchPropertyType="+SearchPropertyType
	url=url+"&PropertySearchCity="+PropertySearchCity
	url=url+"&PropertySearchLocality="+PropertySearchLocality
	url=url+"&PropertySearchAddress="+PropertySearchAddress
	url=url+"&np_pro_covered_area="+np_pro_covered_area
	url=url+"&np_cov_area_type="+np_cov_area_type
	url=url+"&np_pro_covered_area_hidden="+np_pro_covered_area_hidden
	url=url+"&np_pro_beds="+np_pro_beds
	url=url+"&np_pro_baths="+np_pro_baths
	url=url+"&propertyTotalFloor="+propertyTotalFloor
	url=url+"&propertyFloorNo="+propertyFloorNo
	url=url+"&propertyBuiltYear="+propertyBuiltYear
	//alert(url);
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function PropertyPriceEstimatorResponse() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 	document.getElementById('propertyValueIndicator').style.display='none';
	document.getElementById('propertyValue').innerHTML=xmlHttp.responseText;
	
 } 
}