var oPropType = document.getElementById("propertyType");
var oRngFrom = document.getElementById("rangeFrom");
var oRngTo = document.getElementById("rangeTo");
var oLimit = document.getElementById("limit");

function validate() {
	var errors = false;
	var errorMessage = "Please correct the following: \n\n";
	
	// Check to see if a Property Type is selected.
	if (oPropType.selectedIndex == 0) {
		errors = true;
		errorMessage = errorMessage + "  - Please select a Property Type.\n";
	}
	
	// Check to see if a Range From is selected.
	if (oRngFrom.selectedIndex == 0) {
		errors = true;
		errorMessage = errorMessage + "  - Please select a Range From for Price.\n";
	}
	
	// Check to see if a Range To is selected.
	if (oRngTo.selectedIndex == 0) {
		errors = true;
		errorMessage = errorMessage + "  - Please select a Range To for Price.\n";
	}
	
	if (!errors) {
		var iRngFrom = parseInt(oRngFrom.options[oRngFrom.selectedIndex].value);
		var iRngTo = parseInt(oRngTo.options[oRngTo.selectedIndex].value);

		
		if (iRngFrom >= iRngTo) {
			errors = true;
			errorMessage = errorMessage + "  - Invalid Price Range selection.\n";
		}
	}
	
	if (errors) {
		alert(errorMessage);
		return false;
	}
	else {
		return true;
	}
}