function checkBrowser(formObj) {
		//alert(navigator.appVersion);
		//alert(formObj.p_area.value);
        //alert(navigator.appName + " ---- " + navigator.appVersion);
        if (navigator.appName.indexOf("Netscape") !== -1) {
            if (parseFloat(navigator.appVersion) < 4.5) {
                  alert("Please upgrade your browser to Netscape 4.5 or later!");
                  return false;
            } else {
 				return runVerifyForm(formObj);
			}
        } else if (navigator.appName.indexOf("Microsoft") !== -1) {
            if ((parseFloat(navigator.appVersion.substring((navigator.appVersion.indexOf("MSIE")+4)))) < 4.5) {
                  alert("Please upgrade your browser to IE 4.5 or later!");
                  return false;
            } else {
 				return runVerifyForm(formObj);
			} 
        } else {
 			return runVerifyForm(formObj);
        }
}

function runVerifyForm(formObj) {
     return validateZipCityCnty(formObj);
}

function validateZipCityCnty(form) {
    myZipCode = escape(form.zipcode.value);
	myCity = escape(form.city.value);
	myCounty = escape(form.county.value);
	myState = escape(form.state.options[form.state.selectedIndex].value);
//	myCd = escape(form.cd.value);
//	myState4cd = escape(form.state4cd.options[form.state4cd.selectedIndex].value);
	//myGrant = escape(form.grant.value);
	
    if (myZipCode.length == 0 && myCity.length == 0 && myCounty.length == 0 && myState.length == 0 && myCd.length == 0 && myState4cd.length == 0 && form.grantType.selectedIndex == 0) {
        alert("Select Grant Type and enter or select a geography!");
        return false;
    }
	if (myZipCode.length == 0 && myCity.length == 0 && myCounty.length == 0 && myState.length == 0 && myState4cd.length == 0 && myCd == 0 && form.grantType.selectedIndex !== 0) {
        alert("Please enter or select a geography for selected grant type(s)!");
        return false;
    }
	if (myZipCode.length > 0) {
        if (validateUSZip(myZipCode) == false) {
            alert("ZIP code: numeric characters only and 5 digits!");
			form.zipcode.value = "";
            return false;
        } 
		else {
	    	if (form.grantType.selectedIndex == 0) {
				alert("Select one or more Grant Types.");
				return false;
			}
			else	
        		return true;
		} 
    }
    else if (myCity.length !== 0 && myState.length == 0) {
      	alert("Enter both City and State.");
        return false;
    }
	else if (myCounty.length !== 0 && myState.length == 0) {
      	alert("Enter both County and State.");
        return false;
	}
	else if (myState.length !== 0 && form.grantType.selectedIndex !== 0) {
		//alert(form.p_area.value);
		return true;
	//else if ((myCounty.length == 0 && myCity.length == 0) && myState.length !== 0) {
    //  	alert("Enter City or County for selected State.");
    //    return false;
	}
//	else if (myCd.length !== 0 && isNaN(myCd)) {
//		alert("Numeric characters only for Congressional District.");
//		form.cd.value = "";
//		return false;
//	}
//	else if ((myCd.length !== 0 && myState4cd.length == 0) || (myCd.length == 0 && myState4cd.length !== 0)) {
//		alert("Enter both Congressional District Number and State.");
//		return false;
//	}
	else {
	    if (form.grantType.selectedIndex == 0) {
			alert("Select one or more Grant Types.");
			return false;
		}
		else {	
        	return true;
		} 
	} 
	
	function validateUSZip(strValue) {
   	/************************************************
         DESCRIPTION: Validates that a string a United
           States zip code in 5 digit format or zip+4
           format. 99999 or 99999-9999
         PARAMETERS:
           strValue - String to be tested for validity
         RETURNS:
            True if valid, otherwise false.
    *************************************************/
    	var objRegExp  = /(^\d{5}$)|(^\d{5}-\d{4}$)/;
   		//check for valid US Zipcode
   		return objRegExp.test(strValue);
	}
}
