function validate_form()							//index page search form
{
	area_from=document.getElementById('area_from').value		//form values
	area_to=document.getElementById('area_to').value
	price_from=document.getElementById('price_from').value
	price_to=document.getElementById('price_to').value
	trees1=document.getElementById("cashew").value;
	trees2=document.getElementById("mango").value;
	trees3=document.getElementById("coconut").value;
	trees4=document.getElementById("jackfruits").value;
	trees5=document.getElementById("teakwood").value;
	trees6=document.getElementById("othertrees").value;

	areafrom_len=area_from.length;
	areato_len=area_to.length;
	pricefrm_len=price_from.length;
	priceto_len=price_to.length;
	
	document.getElementById('img_area_from').style.visibility='hidden';
	document.getElementById('img_areaf_arrow').style.visibility='hidden';
	document.getElementById('img_area_to').style.visibility='hidden';
	document.getElementById('img_areat_arrow').style.visibility='hidden';	
	document.getElementById('img_price_from').style.visibility='hidden';
	document.getElementById('img_pricef_arrow').style.visibility='hidden'
	document.getElementById('img_price_to').style.visibility='hidden';
	document.getElementById('img_pricet_arrow').style.visibility='hidden';
	document.getElementById('trees_num').style.visibility='hidden';
	document.getElementById('trees_arrow').style.visibility='hidden';
	
	var no_error=0;
	var error_lines=0;
	var error_count=0;
	var error_messages=new Array();					//array to store error messages
	var digitCheck = /^[0-9]+$/;
	var image_set=0;

	if((area_from !="")||(area_to !="")||(price_from !="")||(price_to !=""))
	{
		if(area_from !="")							//area from field
		{
			if((!digitCheck.test(area_from))||(area_from==0))
			{
				if(error_lines<error_limit)
				{
					++error_count;
					error_img = 'number_'+error_count;
					document.getElementById('img_area_from').src='images/'+error_img+'.gif';
					document.getElementById('img_area_from').style.visibility='visible';
					document.getElementById('img_areaf_arrow').style.visibility='visible';
				
					error_messages[no_error]=error_count+". "+area_frm;
					++no_error;
					++error_lines;
				}
			}
			if((area_to=="")&&(digitCheck.test(area_from))&&(area_from!=0))
			{
				if(error_lines<error_limit)
				{
					++error_count;
					error_img = 'number_'+error_count;
					document.getElementById('img_area_to').src='images/'+error_img+'.gif';
					document.getElementById('img_area_to').style.visibility='visible';
					document.getElementById('img_areat_arrow').style.visibility='visible';

					error_messages[no_error]=error_count+". "+areato_empty;
					++no_error;
					++error_lines;
				}
			}
		}
			
		if(area_to !="")						//area to field
		{
			if((!digitCheck.test(area_to))||(area_to==0))
			{
				if(error_lines<error_limit)
				{
					++error_count;
					error_img = 'number_'+error_count;
					document.getElementById('img_area_to').src='images/'+error_img+'.gif';
					document.getElementById('img_area_to').style.visibility='visible';
					document.getElementById('img_areat_arrow').style.visibility='visible';
			
					error_messages[no_error]=error_count+". "+areato_err;
					++no_error;
					++error_lines;
				}
			}
			
			if((area_from !="")&&(digitCheck.test(area_from)))
			{
				val=(parseInt(area_to) < parseInt(area_from))
				if(digitCheck.test(area_from&&area_to)&&(area_from!=0)&&(area_to!=0))
				{	
					if(((areafrom_len)>(areato_len))|| val)
					{
						if(error_lines<error_limit)
						{
							++error_count;
							error_img = 'number_'+error_count;
							document.getElementById('img_area_to').src='images/'+error_img+'.gif';
							document.getElementById('img_area_to').style.visibility='visible';
							document.getElementById('img_areat_arrow').style.visibility='visible';
					
							error_messages[no_error]=error_count+". "+areato_frm;
							++no_error;
							++error_lines;
						}
					}
				}
			}
			if((area_from=="")&&(digitCheck.test(area_to))&&(area_to!=0))
			{
				if(error_lines<error_limit)
				{
					++error_count;
					error_img = 'number_'+error_count;
					document.getElementById('img_area_from').src='images/'+error_img+'.gif';
					document.getElementById('img_area_from').style.visibility='visible';
					document.getElementById('img_areaf_arrow').style.visibility='visible';
				
					error_messages[no_error]=error_count+".  "+areafrm_empty;
					++no_error;
					++error_lines;
				}
			}
		}
			
		if(price_from !="")											//price  from field
		{
			if((!digitCheck.test(price_from))||(price_from==0))
			{
				if(error_lines<error_limit)
				{
					++error_count;
					error_img = 'number_'+error_count;
					document.getElementById('img_price_from').src='images/'+error_img+'.gif';
					document.getElementById('img_price_from').style.visibility='visible';
					document.getElementById('img_pricef_arrow').style.visibility='visible';
				
					error_messages[no_error]=error_count+". "+price_frm;
					++no_error;
					++error_lines;
				}
			}
			if((price_to=="")&&(digitCheck.test(price_from))&&(price_from!=0))
			{
				if(error_lines<error_limit)
				{
					++error_count;
					error_img = 'number_'+error_count;
					document.getElementById('img_price_to').src='images/'+error_img+'.gif';
					document.getElementById('img_price_to').style.visibility='visible';
					document.getElementById('img_pricet_arrow').style.visibility='visible';
				
					error_messages[no_error]=error_count+". "+priceto_empty;
					++no_error;
					++error_lines;
				}
			}
		}

		if(price_to !="")										//price to field
		{
			if((!digitCheck.test(price_to))||(price_to==0))
			{
				if(error_lines<error_limit)
				{
					++error_count;
					error_img = 'number_'+error_count;
					document.getElementById('img_price_to').src='images/'+error_img+'.gif';
					document.getElementById('img_price_to').style.visibility='visible';
					document.getElementById('img_pricet_arrow').style.visibility='visible';
			
					error_messages[no_error]=error_count+". "+priceto_err;
					++no_error;
					++error_lines;
				}
			}
			
			if((price_from !="")&&(digitCheck.test(price_from)))
			{
				priceval=(parseInt(price_to) < parseInt(price_from))
				if(digitCheck.test(price_from&&price_to)&&(price_from!=0)&&(price_to!=0))
				{
					if(((pricefrm_len)>(priceto_len))||priceval)
					{
						if(error_lines<error_limit)
						{
							++error_count;
							error_img = 'number_'+error_count;
							document.getElementById('img_price_to').src='images/'+error_img+'.gif';
							document.getElementById('img_price_to').style.visibility='visible';
							document.getElementById('img_pricet_arrow').style.visibility='visible';
						
							error_messages[no_error]=error_count+". "+priceto_frm;
							++no_error;
							++error_lines;
						}
					}
				}
			}
	
			if((price_from=="")&&(digitCheck.test(price_to))&&(price_to!=0))
			{
				  if(error_lines<error_limit)
				  {
					  ++error_count;
					  error_img = 'number_'+error_count;
					  document.getElementById('img_price_from').src='images/'+error_img+'.gif';
					  document.getElementById('img_price_from').style.visibility='visible';
					  document.getElementById('img_pricef_arrow').style.visibility='visible';
				  
					  error_messages[no_error]=error_count+". "+pricefrm_empty;
					  ++no_error;
					  ++error_lines;
				  }
			}
		}
	}
	if(trees1!="") 
	{
		if((!digitCheck.test(trees1)) || (trees1==0))
		{
			if(error_lines<error_limit)
			{
				image_set=1;
			}
		}
	}
	if(trees2!="") 
	{
		if((!digitCheck.test(trees2)) || (trees2==0))
		{
			if(error_lines<error_limit)
			{
				image_set=1;
			}
		}
	}
	if(trees3!="") 
	{
		if((!digitCheck.test(trees3)) || (trees3==0))
		{
			if(error_lines<error_limit)
			{
				image_set=1;
			}
		}
	}
	if(trees4!="") 
	{
		if((!digitCheck.test(trees4)) || (trees4==0))
		{
			if(error_lines<error_limit)
			{
				image_set=1;
			}
		}
	}
	if(trees5!="") 
	{
		if((!digitCheck.test(trees5)) || (trees5==0))
		{
			if(error_lines<error_limit)
			{
				image_set=1;
			}
		}
	}
	if(trees6!="") 
	{
		if((!digitCheck.test(trees6)) || (trees6==0))
		{
			if(error_lines<error_limit)
			{
				image_set=1;
			}
		}
	}
	if (image_set==1)
	{
		error_count=error_count+1;
		error_messages[no_error]=error_count+". "+tree_error;
		++no_error;
		error_lines=error_lines+1;
		error_img = 'number_'+error_count;
		document.getElementById('trees_num').src='images/'+error_img+'.gif';
		document.getElementById('trees_num').style.visibility='visible';
		document.getElementById('trees_arrow').style.visibility='visible';
	}
	
	if(no_error>0)
	{
		var tempvar="";
		var divTag=document.getElementById('div_error_msg')
		divTag.setAttribute("align","left");
		divTag.style.margin = "10px";
		divTag.className ="dynamicDiv";
	
		if(error_lines<=error_limit)
		{
			for(j=0; j < no_error;j++)
			{
				tempvar += error_messages[j]+'<br/>';
			}

			divTag.innerHTML=tempvar;
			document.getElementById('div_error_msg').style.display='';
		}
	}
	if(no_error)
	{
		return false;
	}
}

function propertycode()								//index page search property id.
{
	  propid=document.getElementById('prop_id').value
	  charcheck= /^[A-Z]+$/
	  digitcheck=/^[0-9]+$/
	  document.getElementById('img_propty_id').style.visibility='hidden';
	  document.getElementById('img_propty_arrow').style.visibility='hidden';
	  
	  var no_error=0;
	  var error_count=0;
	  var error_lines=0;
	  error_msg=new Array();
	  strlen =propid.length
	  var image_set=0;
	  var chk="";
	  var result="";
  
	  if(propid=="")
	  {
		  if(error_lines<error_limit)
		  {
			  ++error_count;
			  error_msg[no_error]=error_count+". "+prop_id;
			  ++no_error;
			  ++error_lines;
			  image_set=1;
			  chk=1;
		  }
	  }
	  if(propid!="")
	  {
		  first_char = propid.charAt(0);
		  subchar = propid.substring(1,6);
	  
		  if((strlen!=7)||(!charcheck.test(first_char))||(!digitcheck.test(subchar)))
		  {
			  if(error_lines<error_limit)
			  {
				  ++error_count;
				  error_msg[no_error]=error_count+". "+prop_err;
				  ++no_error;
				  ++error_lines;
				  image_set=1;
				  chk=1;
			  }
		  }
	  }
	  if(chk!=1)
	  {
		  result=chkprop();
		  if(result != 0)
		  {
			  window.location.href =result;
		  }
		  else 
		  {
			  if(error_lines<error_limit)
			  {
					  ++error_count;
					  error_msg[no_error]=error_count+". "+prop_ajxerr;
					  ++no_error;
					  ++error_lines;
					  image_set=1;
			  }
		  }
	  }
	  if(image_set=1)
	  {
		  error_img = 'number_'+error_count;
		  document.getElementById('img_propty_id').src='images/'+error_img+'.gif';
		  document.getElementById('img_propty_id').style.visibility='visible';
		  document.getElementById('img_propty_arrow').style.visibility='visible';
	  }
			  
	  var divTag=document.getElementById('div_prop_error')
	  divTag.setAttribute("align","left");
	  divTag.style.margin = "10px";
	  divTag.className ="propDiv";

	  if(no_error)
	  {
		  var tempvar="";
		  if(error_lines<=error_limit)
		  {
			  for(j=0; j < no_error;j++)
			  {
				  tempvar += error_msg[j]+'<br/>';
			  }
			 
			  divTag.innerHTML=tempvar;
			  
			  document.getElementById('div_prop_error').style.display='';
			  document.getElementById('property_code').style.height=(66+(no_error*pixel_per_line)) + 'px';
		  }
		  return false;
	  }
}
