<!--	
	function SetRegions2(the_array) {
		// only eval this variable when the user have selected a state.
		if (the_array != "Select State") {
			the_array = eval(the_array);
		}

		for (loop = document.myform.region1.length; loop > 0; loop--) {
			document.myform.region1.options[loop] = null;
			document.myform.region1.options[0] = new Option("All Regions", "any", true, true);
			document.myform.region1.length=1;
		}
		
		// Added a second check to make sure the selected option is not the default.
		if (the_array != "" && the_array != "Select State") {
			for(loop=0; loop<the_array.length; loop++) {
				document.myform.region1.options[loop+1] = new Option(the_array[loop][0],the_array[loop][1],false, false);				
				document.myform.region1.options[loop+1].style.color = "#000000";
			}
			document.myform.region1.length=the_array.length+1;
			document.myform.region1.options[0].style.color = "#000000";
		}
	}

	function showOrHide() {
		var br=document.myform.buyrent.selectedIndex;
		var i=document.myform.propertytype2.selectedIndex;
		
		if( i==1 ) {
			document.myform.bedrooms.disabled=true;
			document.myform.bathrooms.disabled=true;
			document.all.beds.style.visibility='hidden';
			document.all.baths.style.visibility='hidden';
		} else if( i==2 ) {
			if( br==0 ) {
				document.myform.bedrooms.disabled=true;
				document.myform.bathrooms.disabled=true;
				document.all.beds.style.visibility='hidden';
				document.all.baths.style.visibility='hidden';
			} else {
				document.myform.bedrooms.disabled=false;
				document.myform.bathrooms.disabled=false;
				document.all.beds.style.visibility='visible';
				document.all.baths.style.visibility='visible';
			}
		} else if( i==3 ) {
			document.myform.bedrooms.disabled=false;
			document.myform.bathrooms.disabled=false;
			document.all.beds.style.visibility='visible';
			document.all.baths.style.visibility='visible';
		} else {
			document.myform.bedrooms.disabled=false;
			document.myform.bathrooms.disabled=false;
			document.all.beds.style.visibility='visible';
			document.all.baths.style.visibility='visible';
		}
	}
	function SetTypes(the_array) {
		the_array=eval(the_array);
		for(loop=document.myform.propertyID.length; loop>=0; loop--)
			document.myform.propertyID.options[loop] = null;
		if( the_array != "" ) {
			for(loop=0; loop<the_array.length; loop++)
	        	document.myform.propertyID.options[loop] = new Option(the_array[loop][0],the_array[loop][1],false, false);
			document.myform.propertyID.length=the_array.length;
			document.myform.propertyID.selectedIndex=0;
		}
	}
	function buyRent() {
		
		if( document.myform.buyrent.value=="buy" ) {
			the_array=eval(ptypes1);			
			SetTypes("res");
			PopulatePrice(buyprices);			
		} else {
			the_array=eval(ptypes2);			
			SetTypes("resL");
			PopulatePrice(rentprices);			
		}	
	}
	function checkSbrbs() {
		var selected=false;
		for(loop=0; loop<document.myform.sbrb1.length; loop++) {
			if( document.myform.sbrb1.options[loop].selected==true ) {
				selected=true;
				break;
			}
		}
		if( selected ) {
			if( document.myform.surr_sbrb.selectedIndex!=2 )
				document.myform.surr_sbrb.selectedIndex=1;
		}
		else
			document.myform.surr_sbrb.selectedIndex=0;
	}
	function quickCheck() {
		if	(document.quickform.sbrb.value == "Enter Suburb, Postcode or Ref #") {
	        alert("Please enter a Suburb, Postcode or Reference Number");
	        return false;
		}
		if (!isNaN(document.quickform.sbrb.value) && document.quickform.sbrb.value.length!=4) {
			alert("Postcodes must be 4 numbers in length, please enter in a correct Postcode");
			return false;
		}
	}
	
	function validateSuburbField() {
		if	(document.quickform.sbrb.value == "Enter a Suburb or Postcode") {
	        alert("Please enter a valid Suburb or Postcode");
	        return false;
		}
		if (!isNaN(document.quickform.sbrb.value) && document.quickform.sbrb.value.length!=4) {
			alert("Postcodes must be 4 numbers in length, please enter in a correct Postcode");
			return false;
		}
	}	
	
	function formCheck() {
		/*if( document.myform.region1.value == "any" ) {
	        alert("Please select a region");
	        return false;
		}*/
		if( document.myform.propertytype2.value!="rur" ) {
			var selected=false;
			for(loop=0; loop<document.myform.propertyID.length; loop++) {
				if( document.myform.propertyID.options[loop].selected==true ) {
					selected=true;
					break;
				}
			}
			if( !selected ) {
				alert("Please select a property classification");
		        return false;
			}
		}
		document.myform.region.value=document.myform.region1.options[document.myform.region1.selectedIndex].value;
		document.myform.prcefrom.value=document.myform.prcefrom1.options[document.myform.prcefrom1.selectedIndex].value;
		document.myform.prceto.value=document.myform.prceto1.options[document.myform.prceto1.selectedIndex].value;
		pricefromtext=document.myform.prcefrom1.options[document.myform.prcefrom1.selectedIndex].text;
		pricetotext=document.myform.prceto1.options[document.myform.prceto1.selectedIndex].text;
		regiontext=document.myform.region1.options[document.myform.region1.selectedIndex].text;
		//document.myform.action='http://localhost/newC21website/propertySearch/search.cfm';
	}
		
	function clearVals() {
		document.myform.state.selectedIndex = parseInt(document.myform.state_num.value);
		SetRegions2(document.myform.state.options[document.myform.state.selectedIndex].value);
		
		// Check to see if the select box has only one item.
		if (document.myform.region1.length == 1) {
			document.myform.region1.options[0].selected = true;
		} else {
			document.myform.region1.selectedIndex = parseInt(document.myform.region_num.value);
		}
			
		//buyRent();
		//document.myform.action='http://localhost/newC21Website/propertySearch/advanced_search.cfm';
	}
-->
