function send_mail()
{
	
	if(document.frmemailenquiry.txtname.value.length < 1)
	{
		alert('Please Enter Your Name');
		document.frmemailenquiry.txtname.focus();
		return false;
	}
	
	if(document.frmemailenquiry.txtemail.value==0)
	{
		alert('Please Enter Your Email');
		document.frmemailenquiry.txtemail.focus();
		return false;
	}
	if(echeck(document.frmemailenquiry.txtemail.value)==false)
	{
         document.frmemailenquiry.txtemail.value="";
         document.frmemailenquiry.txtemail.focus();
        
         return false;
    }
	
	if(document.frmemailenquiry.txtphone.value.length < 1 )
	{
		alert('Please Enter Phone Number');
		document.frmemailenquiry.txtphone.focus();
		return false;
	}
	
		if(!IsNumeric(document.frmemailenquiry.txtphone.value))
		{
			alert('Please Enter phone Number as Number');
			document.frmemailenquiry.txtphone.value="";
			document.frmemailenquiry.txtphone.focus();
			return false;
		}


	if(document.frmemailenquiry.txtmsg.value.length < 1 )
	{
		alert('Please Enter Message');
		document.frmemailenquiry.txtmsg.focus();
		return false;
	}
}
function winClose(id)
{
	document.getElementById(id).style.display='none';
}
function show_send_enquiry(id,prop_id,user_id)
{
	
	document.getElementById(id).style.display='block';
	document.addproperty.property_id.value=prop_id;
	document.addproperty.user_id.value=user_id;
	document.getElementById('prop_div').innerHTML=prop_id;
	document.getElementById("msg").innerHTML="";
	document.addproperty.txtname.value="";
	document.addproperty.txtemail.value="";
	document.addproperty.txtphone.value="";
	document.addproperty.txtmsg.value="";
}
function send_mail_js()
{
	
	if(document.addproperty.txtname.value.length < 1)
	{
		alert('Please Enter Your Name');
		document.addproperty.txtname.focus();
		return false;
	}
	
	if(document.addproperty.txtemail.value==0)
	{
		alert('Please Enter Your Email');
		document.addproperty.txtemail.focus();
		return false;
	}
	if(echeck(document.addproperty.txtemail.value)==false)
	{
         document.addproperty.txtemail.value="";
         document.addproperty.txtemail.focus();
        
         return false;
    }
	

	if(!IsNumeric(document.addproperty.txtphone.value))
		{
			alert('Please Enter phone Number as Number');
			document.addproperty.txtphone.value="";
			document.addproperty.txtphone.focus();
			return false;
		}
	
	
	if(document.addproperty.txtphone.value.length < 1 )
	{
		alert('Please Enter Phone Number');
		document.addproperty.txtphone.focus();
		return false;
	}
	if(document.addproperty.txtmsg.value.length < 1 )
	{
		alert('Please Enter Message');
		document.addproperty.txtmsg.focus();
		return false;
	}
	send_mail_ajax();
}
function send_mail_ajax()
{	
	//var prop_id=102;
	var name=document.addproperty.txtname.value;
	var email=document.addproperty.txtemail.value;
	var phone=document.addproperty.txtphone.value;
	var msg=document.addproperty.txtmsg.value;
	var prop_id=document.addproperty.property_id.value;
	var user_id=document.addproperty.user_id.value;
	var sell_rent_buy=document.addproperty.sell_rent_buy.value;
	
	var params="name="+escape(name)+"&email="+escape(email)+"&phone="+escape(phone)+"&msg="+escape(msg)+"&prop_id="+escape(prop_id)+"&sell_rent_buy="+escape(sell_rent_buy)+"&user_id="+escape(user_id);
	
	var url="send_enquiry_ajax.php";
	//	alert(url);
	 http.open("POST", url, true);
	 http.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
	 http.onreadystatechange = handleHttpResponse_send_mail_ajax;
	 http.send(params);
}
function handleHttpResponse_send_mail_ajax()
{
	if (http.readyState == 4)
	{
		 results = http.responseText;
		
		 document.getElementById("msg").innerHTML ='<font color="#FF0000">Mail Sent Successfully</font>';
		// Split the comma delimited response into an array
		//results = http.responseText.split("|||");
		//document.getElementById("div12").style.display="block";
		//document.getElementById("div12").innerHTML =results[0];
	}
}
function getHTTPObject() 
{
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}
var http = getHTTPObject(); // We create the HTTP Object

