function validateAlertForm(e) {
		
		function cancel() {
			if(e.preventDefault) e.preventDefault();
			else e.returnValue = false;
			return false;
		}
		
		for(i=0;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();
		}
		
		if(document.theForm.Phone.value.length < 5){
			alert('Please enter a valid phone number.');
			document.theForm.Phone.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("",500);
						document.theForm.max_price.options[0] = new Option("",5000);
						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.min_price.options[2] = new Option("$600",600);
						document.theForm.min_price.options[3] = new Option("$700",700);
						document.theForm.min_price.options[4] = new Option("$800",800);
						document.theForm.min_price.options[5] = new Option("$900",900);
						document.theForm.min_price.options[6] = new Option("$1000",1000);
						document.theForm.min_price.options[7] = new Option("$1200",1200);
						document.theForm.min_price.options[8] = new Option("$1400",1400);
						document.theForm.min_price.options[9] = new Option("$1600",1600);
						document.theForm.min_price.options[10] = new Option("$1800",1800);
						document.theForm.min_price.options[11] = new Option("$2000",2000);
						document.theForm.min_price.options[12] = new Option("$2200",2200);
						document.theForm.min_price.options[13] = new Option("$2400",2400);
						document.theForm.min_price.options[14] = new Option("$2600",2600);
						document.theForm.min_price.options[15] = new Option("$2800",2800);
						document.theForm.min_price.options[16] = new Option("$3000",3000);						
						document.theForm.min_price.options[17] = new Option("$3200",3200);
						document.theForm.min_price.options[18] = new Option("$3400",3400);
						document.theForm.min_price.options[19] = new Option("$3600",3600);	
						document.theForm.min_price.options[20] = new Option("$3800",3800);
						document.theForm.min_price.options[21] = new Option("$4000",4000);	
						document.theForm.min_price.options[22] = new Option("$4500",4500);	
						document.theForm.min_price.options[23] = new Option("$5000",5000);
						
						document.theForm.max_price.options[1] = new Option("$700",700);
						document.theForm.max_price.options[2] = new Option("$800",800);
						document.theForm.max_price.options[3] = new Option("$900",900);
						document.theForm.max_price.options[4] = new Option("$1000",1000);
						document.theForm.max_price.options[5] = new Option("$1200",1200);
						document.theForm.max_price.options[6] = new Option("$1400",1400);
						document.theForm.max_price.options[7] = new Option("$1600",1600);
						document.theForm.max_price.options[8] = new Option("$1800",1800);
						document.theForm.max_price.options[9] = new Option("$2000",2000);
						document.theForm.max_price.options[10] = new Option("$2200",2200);
						document.theForm.max_price.options[11] = new Option("$2400",2400);
						document.theForm.max_price.options[12] = new Option("$2600",2600);
						document.theForm.max_price.options[13] = new Option("$2800",2800);
						document.theForm.max_price.options[14] = new Option("$3000",3000);
						document.theForm.max_price.options[15] = new Option("$3200",3200);						
						document.theForm.max_price.options[16] = new Option("$3400",3400);
						document.theForm.max_price.options[17] = new Option("$3600",3600);						
						document.theForm.max_price.options[18] = new Option("$3800",3800);						
						document.theForm.max_price.options[19] = new Option("$4000",4000);	
						document.theForm.max_price.options[20] = new Option("$4500",4500);	
						document.theForm.max_price.options[20] = new Option("$5000+",99999999);
						
						/*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
