function fetchIt() 
{           
    //var fetchType = document.search_form.search_type.value
var fetchType = document.getElementById("search_type").value
var fetchZip = document.getElementById("zip").value                              

if (fetchType == "1" || fetchType == "2" || fetchType == "3")
{
    if (fetchZip.length > 0 && fetchZip != "Enter Your Zip") {
    
        if (isValidZipcode(fetchZip) == false)
	    {
	        alert("Please specify a valid zip code.");
		    return false;
	    }
	}
} 

if (fetchZip == "Enter Your Zip") {	            
	fetchZip = '' 
}
    
//Determine if we need to process boarders or sitters folder
switch (fetchType) {

            case "1":                                                                          
            document.search_form.action = "listview_members.asp?gcf=1&address=" + fetchZip;                     
            document.search_form.submit();                                            
            break;

            case "2":                                                                          
            document.search_form.action = "listview_BS.asp?SearchTypes=2&HRT=1&gcf=1&page=1&address=" + fetchZip;                           
            document.search_form.submit();                                            
            break;
            
            case "3":
            document.search_form.action = "listview_BS.asp?SearchTypes=9&HRT=1&page=1&gcf=1&address=" + fetchZip
            document.search_form.submit();
            break;  
                                
            default:
            //alert("fetchType - " + fetchType);
            break;
        }                     
    //search_type
}  

// Check that a US zip code is valid
function isValidZipcode(zipcode) {
	zipcode = removeSpaces(zipcode);
	if (!(zipcode.length == 5 || zipcode.length == 9 || zipcode.length == 10)) return false;
    if ((zipcode.length == 5 || zipcode.length == 9) && !isNumeric(zipcode)) return false;
    if (zipcode.length == 10 && zipcode.search && zipcode.search(/^\d{5}-\d{4}$/) == -1) return false;
    return true;
}

// Remove all spaces from a string
function removeSpaces(string) {
	var newString = '';
	for (var i = 0; i < string.length; i++) {
		if (string.charAt(i) != ' ') newString += string.charAt(i);
	}
	return newString;
} 

// Check that a string contains only numbers
function isNumeric(string, ignoreWhiteSpace) {
	if (string.search) {
		if ((ignoreWhiteSpace && string.search(/[^\d\s]/) != -1) || (!ignoreWhiteSpace && string.search(/\D/) != -1)) return false;
	}
	return true;
}
    
