function show(id)
{
 document.getElementById(id).className='visibleobject';
}
function hide(id)
{
 document.getElementById(id).className='invisibleobject';
}
function toggle_display(id)
{
 if (document.getElementById(id).className=='visibleobject')  
  { hide(id); }
 else
 { show(id); }
}
// JavaScript Document
	var whitespace = " \t\n\r";
// Function to check whether the value in a Text Field is Null
	function isEmpty(s)
	{  return ((s == null) || (s.length == 0))
	}
// Function to check whether the value in a Text Field is a WhiteSpace
	function isWhitespace (s)
	{  var i;
 	  // Is s empty?
 	  if (isEmpty(s)) return true;
 	   // Search through string's characters one by one
 	   // until we find a non-whitespace character.
 	   // When we do, return false; if we don't, return true.
 	   for (i = 0; i < s.length; i++)
 	   {   
 	  // Check that current character isn't whitespace.
 	  var c = s.charAt(i);
 	  if (whitespace.indexOf(c) == -1) return false;
 	   }
 	   // All characters are whitespace.
	  return true;
	}
// Function to ensure that the email address is in proper format
	function isEmail (s)
  	{
    var i = 1;
    var sLength = s.length;
    // look for @
    while ((i < sLength) && (s.charAt(i) != "@"))
    { i++
    }
    if ((i >= sLength) || (s.charAt(i) != "@")) return false;
    else i += 2;
    // look for .
    while ((i < sLength) && (s.charAt(i) != "."))
    { i++
    }
	  // there must be at least one character after the .
    if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
    else return true;
    }
 function isWebsite (s)
  	{
    var i = 1;
    var sLength = s.length;
    while ((i < sLength) && (s.charAt(i) != "."))
    { i++
    }
    if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
    else return true;
    }
  function isCharsInBag (s, bag)
  {  
  var i;
  for (i = 0; i < s.length; i++)
  {   
    var c = s.charAt(i);
    if (bag.indexOf(c) == -1)
	 return false;
  }
  return true;
  }
function validate()
{
var name= document.send_form.name.value;
 if(name=="")
 {
		alert( "Please Enter  Name");
		document.send_form.name.focus( );
		return false;
 }

  var email = document.send_form.email.value;
	if(email=="")
	{
		alert("Please enter the Email");
		document.send_form.email.focus( );
		return false;
	}
	else{
	if (!isEmail(email))
		{
			alert("Please enter the Email address in the proper Format");
			document.send_form.email.focus( );	
			return false;
		}
	}

var requirements= document.send_form.requirements.value;
 if(requirements=="")
 {
		alert( "Please Enter Requirements");
		document.send_form.requirements.focus( );
		return false;
 }
	len=document.send_form.prefer_contact.length;
				if(!len)
				chosen = document.send_form.prefer_contact.value;	
				else
				{	
				for (i = 0; i <len; i++) {
				if (document.send_form.prefer_contact[i].checked) {
				chosen = document.send_form.prefer_contact[i].value				}
				}	
				}
	len1=document.send_form.property_type.length;
				if(!len1)
				chosen1 = document.send_form.property_type.value;	
				else
				{	
				for (i = 0; i <len1; i++) {
				if (document.send_form.property_type[i].checked) {
				chosen1 = document.send_form.property_type[i].value				}
				}	
				}
	len2=document.send_form.renting_options.length;
				if(!len2)
				chosen2 = document.send_form.renting_options.value;	
				else
				{	
				for (i = 0; i <len2; i++) {
				if (document.send_form.renting_options[i].checked) {
				chosen2 = document.send_form.renting_options[i].value				}
				}	
				}
	getRequest('FormSubmissionAjax.php?action=query1&id=queryBox&name='+document.send_form.name.value+'&email='+document.send_form.email.value+'&phone='+document.send_form.phone.value+'&best_time='+document.send_form.best_time.value+'&prefer_contact='+chosen+'&currency='+document.send_form.currency.value+'&budget='+document.send_form.budget.value+'&amount='+document.send_form.amount1.value +'&property_type='+document.send_form.property_type.value+'&renting_options='+chosen2+'&requirements='+document.send_form.requirements.value+'&location='+document.send_form.location.value,'queryBox','');
}
function validatelistform()
{
var short_heading= document.list_property_form.short_heading.value;
 if(short_heading=="")
 {
		alert( "Please Enter  Short Heading");
		document.list_property_form.short_heading.focus( );
		return false;
 }

var name= document.list_property_form.name.value;
 if(name=="")
 {
		alert( "Please Enter  Name");
		document.list_property_form.name.focus( );
		return false;
 }

  var email = document.list_property_form.email.value;
	if(email=="")
	{
		alert("Please enter the Email");
		document.list_property_form.email.focus( );
		return false;
	}
	else{
	if (!isEmail(email))
		{
			alert("Please enter the Email address in the proper Format");
			document.list_property_form.email.focus( );	
			return false;
		}
	}
 var area= document.list_property_form.area.value;
 if(area=="")
 {
		alert( "Please Enter  Area");
		document.list_property_form.area.focus( );
		return false;
 }
len=document.list_property_form.list_for.length;
if(!len)
chosen = document.list_property_form.list_for.value;	
else
{	
for (i = 0; i <len; i++) {
if (document.list_property_form.list_for[i].checked) {
chosen = document.list_property_form.list_for[i].value				}
}	
}
len1=document.list_property_form.visible_phone.length;
if(!len1)
chosen1 = document.list_property_form.visible_phone.value;	
else
{	
for (i = 0; i <len1; i++) {
if (document.list_property_form.visible_phone[i].checked) {
chosen1= document.list_property_form.visible_phone[i].value				}
}	
}
	getRequest('FormSubmissionAjax.php?action=query2&id=rentBox&short_heading='+document.list_property_form.short_heading.value+'&name='+document.list_property_form.name.value+'&rvalue='+document.list_property_form.rvalue.value+'&pvalue='+document.list_property_form.pvalue.value+'&area='+document.list_property_form.area.value+'&email='+document.list_property_form.email.value +'&phone='+document.list_property_form.phone.value+'&property_type='+document.list_property_form.property_type.value+'&location='+document.list_property_form.location.value+'&list_for='+chosen+'&visible_phone='+chosen1+'&comments='+document.list_property_form.details.value+'&image='+document.list_property_form.image.value,'rentBox','');
}