function clearText(thefield){
	if(thefield.defaultValue==thefield.value) {
		thefield.value = "";
	}
} 
function addText(thefield){
	if(thefield.value == '') {
		thefield.value = "Zip Code or City, State";
	}
}
function checkCounty(thefield) {
	if(thefield.selectedIndex > 0) {
		var locationField = document.forms[0].location;
		var milesSelect = document.forms[0].miles;
		locationField.value = "Zip Code or City, State";
		milesSelect.selectedIndex = 0;
	}
}
function validate(theform) {
	var locationField = theform.location;
	if(locationField.defaultValue==locationField.value) {
		theform.location.value = "";	
	}
	
	return true;
}
function search() {
	if(validate(document.forms[0])) {
		document.forms[0].submit();
	}
}
function validate_subscribe(theform) {
	var required = ['mb-ntdlh-ntdlh','mb.f-tuudh','mb.f-tuudk'];
	for(i=0; i<document.forms[0].elements.length; i++) {
		if(in_array(document.forms[0].elements[i].name,required,true) && document.forms[0].elements[i].value=='') {
				alert('Email, First Name, and Last Name are required.');
				return false;
		}
	}
	return false;
}
function in_array(needle, haystack, strict) {
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // *     example 1: in_array('van', ['Kevin', 'van', 'Zonneveld']);
    // *     returns 1: true
    var found = false, key, strict = !!strict;
    for (key in haystack) {
        if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) {
            found = true;
            break;
        }
    }
    return found;
}