function valuecheck()
{
if(document.property.name.value=='')
{
	alert('Please enter your name');
	document.property.name.focus();
	return false;
}
if(document.property.address.value=='')
{
	alert('Please enter your addtess');
	document.property.address.focus();
	return false;
}
if(document.property.city.value=='')
{
	alert('Please enter your city');
	document.property.city.focus();
	return false;
}
if(document.property.email.value=='')
{
	alert('Please enter your email address');
	document.property.email.focus();
	return false;
}
if(document.property.email.value!='')
		{
			evalue=document.property.email.value;
	if(evalue.length &&(evalue.indexOf("@")==0||evalue.indexOf("@")==-1||evalue.indexOf(".")==-1||evalue.indexOf(".")==0))
	{
	alert("Invalid E-Mail address.\n"+"Format is: abc@domainname.com");
    //document.FormName.email.value="";
	 document.property.email.focus();
	 return false;
	    }
	 	
	}
if(document.property.phone.value=='')
{
	alert('Please mention your phone number');
	document.property.phone.focus();
	return false;
}
//if(document.property.phone.value!='')
//{
//	If(isNaN(document.property.phone.value))
//	{
//	alert('Please enter the Numeric Digits in phone number');
//	document.property.phone.focus();
//	return false;
//	}
//}
 if(document.property.phone.value!=''){
			if(isNaN(document.property.phone.value)){
				document.property.phone.focus();
				alert("Please enter the Numerical Value in Phone.");
				return false;
			}
	    }
if(document.property.propvalloc.value=='')
{
	alert('Please mention Location of Property');
	document.property.propvalloc.focus();
	return false;
}
if((document.property.closecity.value=='') && (document.property.cname.value==''))
{
	alert('Please mention the city closest to the property');
	document.property.cname.focus();
	return false;
}
if(!(document.property.closecity.value=='') && !(document.property.cname.value==''))
{
	document.property.cname.value='';
	document.property.cname.focus();
	return false;
}

if(document.property.comments.value=='')
{
	alert('Please comments on the nature of the work including description of property');
	document.property.comments.focus();
	return false;
}

xmlhttpPost();
	return true;
}
	function xmlhttpPost() 
{		
var name=document.getElementById('name').value;
var address=document.getElementById('address').value;
var city=document.getElementById('city').value;
var email=document.getElementById('email').value;
var phone=document.getElementById('phone').value;
var propvalloc=document.getElementById('propvalloc').value;
var closecity=document.getElementById('closecity').value;
var cname=document.getElementById('cname').value;
var comments=document.getElementById('comments').value;
	document.getElementById("main").innerHTML = "<FONT SIZE='4' COLOR='red'>Sending Request...<img src='manage/images/ajax-loader.gif' border='0'></font>";

	var url ="query.php";
	var posData = "?name=" + name + "&address=" + address + "&city=" + city  + "&email=" + email + "&phone=" + phone + "&propvalloc=" + propvalloc + "&closecity=" + closecity + "&cname=" + cname + "&comments=" + comments;

	if (window.XMLHttpRequest) 
	{ 
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) 
		{
			http_request.overrideMimeType('text/xml');
		}
	} 
	else if (window.ActiveXObject) 
	{ // IE
		try 
		{
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
			try 
			{
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}

	http_request.onreadystatechange = function() { sendMailPHP(http_request); };
	http_request.open('GET', url + posData, true);
	http_request.send(null);
}
function sendMailPHP(http_request){
	
	if (http_request.readyState == 4) {
            if (http_request.status == 200) 
			{
				resText = http_request.responseText;
				if(resText == 1)
				{
					document.getElementById("main").innerHTML = "<FONT SIZE='3' COLOR='red'>Query successfully submitted. We will contact you soon!</FONT>";
				}else{
					document.getElementById("main").innerHTML = "<FONT SIZE='3' COLOR='red'>Query not submitted!</FONT>";
				}
				
            } else {
                document.getElementById("main").innerHTML = "<FONT SIZE='3' COLOR='red'>Query not submitted!</FONT>";
            }
        }
}




