	// gets the zipcode cookie data from the club's cookie
	function getCookie(CookieName) {
		var search = CookieName + "=";
		if(document.cookie.length > 0) {
			offset = document.cookie.indexOf(search);
			if(offset != -1) {
				offset += search.length;
				end = document.cookie.indexOf(";", offset);
				
				if(end == -1) {
					end = document.cookie.length;
				}
				return document.cookie.substring(offset, end);
			}
		}
	}
	
	function checkForZipCodeCookie(areaTag) {
		var sendTo = "/?zip=";
		var pipe = "";
		var cookieData = getCookie("zipcode");
		var startIndex = 0;
		// found a ZipCode cookie
		// for it to be valid it must be zipcode(>4 digits)|Association(3 char)|Club(>0 digits)
		if(cookieData > "") {
			// get the first marker		
			pipe = cookieData.indexOf("|");
			// get the zipcode, which is a minimum of 5 digits
			if(pipe > 4) {
				foundZipCode = cookieData.substring(startIndex, pipe);
				// build the send to URL
				sendTo += foundZipCode;
				if(areaTag != null && areaTag.length > 0) {
					sendTo += "&area=";
					sendTo += areaTag;
				}
				// we have a zipcode, forward the user to the zipcode gateway
				window.location = sendTo;
			}
		} 
	}
    
    function GoToTop()
    {
        document.zip.ZipCodeEntry.focus();
    }

