function validateAlertForm(e) {
		
		function cancel() {
			if(e.preventDefault) e.preventDefault();
			else e.returnValue = false;
			return false;
		}
		
		for(i=1;i<document.theForm.cat.length;i=i+1)
		{
			if(document.theForm.cat[i].checked)
			{
				cat_ok = true;
				break;
			}
			else
			{
				cat_ok = false;
			}
		}
		if(!cat_ok)
		{
			alert('Please select an area.');
			return cancel();
		}
		var minp=document.theForm.min_price.options.value;
		var maxp=document.theForm.max_price.options.value;
		if (Number(minp) > Number(maxp)){			
			alert('Please select less min price than max price.');
			document.theForm.min_price.focus();
			return;
		}
		
		if((document.theForm.email.value.search(/@/i) == -1)
			|| (document.theForm.email.value.search(/\./i) == -1)
			|| (document.theForm.email.value.length < 5))
		{
			alert('Please enter a valid E-Mail address.');
			document.theForm.email.focus();
			return cancel();
		}
		document.theForm.submit();
	
	}
	
	function ifAll(){
		if(document.theForm.allareas.checked == true){
		
			for (loop=0; loop < document.theForm.cat.options.length; loop++)
  			{
				document.theForm.cat.options[loop].selected = true;
			}
		}else{
			for (loop=0; loop < document.theForm.cat.options.length; loop++)
  			{
				document.theForm.cat.options[loop].selected = false;
			}
		}
	}
	
	function selectField(value) {
				
					document.theForm.searchType.value = value;
				
					if (value==2) {
						document.theForm.buy.checked=0;
						document.theForm.rent.checked=1;
						document.theForm.min_price.options[0] = new Option("$0","0");
						document.theForm.max_price.options[0] = new Option("No Limit","99999999");
						l = document.theForm.max_price.options.length;
						for (i=1;i<=l;i++) {
							document.theForm.min_price.options[1] = null;
							document.theForm.max_price.options[1] = null;
						}
						document.theForm.min_price.options[1] = new Option("$500",500);
						document.theForm.max_price.options[1] = new Option("$500",500);
						document.theForm.min_price.options[2] = new Option("$1000",1000);
						document.theForm.max_price.options[2] = new Option("$1000",1000);
						document.theForm.min_price.options[3] = new Option("$1500",1500);
						document.theForm.max_price.options[3] = new Option("$1500",1500);
						document.theForm.min_price.options[4] = new Option("$2000",2000);
						document.theForm.max_price.options[4] = new Option("$2000",2000);
						document.theForm.min_price.options[5] = new Option("$3000",3000);
						document.theForm.max_price.options[5] = new Option("$3000",3000);
						document.theForm.min_price.options[6] = new Option("$4000",4000);
						document.theForm.max_price.options[6] = new Option("$4000",4000);
						document.theForm.min_price.options[7] = new Option("$5000",5000);
						document.theForm.max_price.options[7] = new Option("$5000",5000);
						document.theForm.min_price.options[8] = new Option("$6000",6000);
						document.theForm.max_price.options[8] = new Option("$6000",6000);
						document.theForm.min_price.options[9] = new Option("$7000",7000);
						document.theForm.max_price.options[9] = new Option("$7000",7000);
						document.theForm.min_price.options[10] = new Option("$8000",8000);
						document.theForm.max_price.options[10] = new Option("$8000",8000);
						document.theForm.min_price.options[11] = new Option("$10000",10000);
						document.theForm.max_price.options[11] = new Option("$10000",10000);
						/*document.theForm.search_Type.checked = true;*/
					} else {
						document.theForm.rent.checked=0;
						document.theForm.buy.checked=1;
						l = document.theForm.max_price.options.length;
						for (i=1;i<=l;i++) {
							document.theForm.min_price.options[1] = null;
							document.theForm.max_price.options[1] = null;
						}
						document.theForm.min_price.options[0] = new Option("$0","0");
						document.theForm.max_price.options[0] = new Option("No Limit","99999999");
						j=0;
						for (i=100000;i<=350000;i+=25000) {
							j++;
							document.theForm.min_price.options[j] = new Option("$"+i,i);
							document.theForm.max_price.options[j] = new Option("$"+i,i);
						}
						for (i=400000;i<=900000;i+=50000) {
							j++;
							document.theForm.min_price.options[j] = new Option("$"+i,i);
							document.theForm.max_price.options[j] = new Option("$"+i,i);
						}
						for (i=1000000;i<=1600000;i+=100000) {
							j++;
							document.theForm.min_price.options[j] = new Option("$"+i,i);
							document.theForm.max_price.options[j] = new Option("$"+i,i);
						}
						j++;
						document.theForm.min_price.options[j] = new Option("$1750000",1750000);
						document.theForm.max_price.options[j] = new Option("$1750000",1750000);
						for (i=2000000;i<=5000000;i+=500000) {
							j++;
							document.theForm.min_price.options[j] = new Option("$"+i,i);
							document.theForm.max_price.options[j] = new Option("$"+i,i);
						}
						
						j++;
						document.theForm.min_price.options[j] = new Option("$6000000",6000000);
						document.theForm.max_price.options[j] = new Option("$6000000",6000000);
						j++;
						document.theForm.min_price.options[j] = new Option("$8000000",8000000);
						document.theForm.max_price.options[j] = new Option("$8000000",8000000);
					}
				}

	
	// JavaScript Document
