<!-- 
        // club method, used to route to a page that they host and 
        // detects whether or not the entered zipcode is theirs. 
        // 
        // this implementation passes the user off to the AES ZipCode Application with 
        // rclub and rurl parameters for this club and page 
        function verifyUserIsInOurTerritory(clubNumber) { 
                // verify client is in our territory via ZCG, must escape the rurl for proper processing by browsers 
                window.location = "http://www.aaa.com/?rclub=" + clubNumber + "&rurl=" + escape(window.location); 
        }      

        // checks to see if the client is a spider, major engines listed 
        function spiderClient() { 
                var spiderFound = false; 
                var useragent = window.navigator.userAgent; 
                useragent = useragent.toUpperCase(); 
                if(useragent.substring(0, 6) == "GOOGLE" || useragent.substring(0, 7) == "BACKRUB") { 
                        // should match all Google Spiders 
                        spiderFound = true; 
                } else if(useragent.substring(0, 5) == "YAHOO") { 
                        // should match all Yahoo spiders 
                        spiderFound = true; 
                } else if(useragent.substring(0, 6) == "MSNBOT") { 
                        // should match all MSN spiders 
                        spiderFound = true; 
                } else if(useragent.substring(0, 5) == "LYCOS") { 
                        // should match Lycos 
                        spiderFound = true; 
                } else if(useragent.substring(0, 8) == "MERCATOR") { 
                        // should match AltaVista 
                        spiderFound = true; 
                } 
                return spiderFound; 
        } 

        // 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); 
                        } 
                } 
        } 

        // This method should be used by clubs hosting pages on aaa.com 
        // that are referenced under the domains ww1.aaa.com, www.aaa.com and www.aaa.com 
        // since these pages will have access to the zipcode cookie written under aaa.com. 
        function validateUserInClub(clubNumber) { 
                var ourUser = false; 
                var foundAssociation = ""; 
                var foundClub = ""; 
                var startIndex = 0; 
                var pipe = ""; 
                var cookieData = getCookie("zipcode"); 
                var foundZipCode = ""; 

                if(cookieData > "") { 
                        // get the zipcode 
                        pipe = cookieData.indexOf("|"); 
                        if(pipe > 4) { 
                                foundZipCode = cookieData.substring(startIndex, pipe); 
                                // find association 
                                startIndex = pipe + 1; 
                                pipe = cookieData.indexOf("|", startIndex); 
                                if(pipe > 8) { 
                                        foundAssociation = cookieData.substring(startIndex, pipe); 
                                        // get the club 
                                        startIndex = pipe + 1; 
                                        if(cookieData.length > startIndex) { 
                                                foundClub = cookieData.substring(startIndex); 
                                        } 

                                } 
                        } 
                } 
                if(foundZipCode > "" && foundAssociation > "" && foundClub > "") { 
                        // we have valid data 
                        if(foundClub == clubNumber) { 
                                // this is our user, keep them here. 
                                ourUser = true; 
                        } else { 
                                // not our user, calling method will get them to the 
                                // ZipCode Gateway and then routed to their club. 
                                ourUser = false; 
                        } 
                } else { 
                        // returning false, in this case meaning we could not validate 
                        // the user, the calling method will call the ZipCode Gateway 
                        // which will take care of validating the user 
                        ourUser = false; 
                } 
                return ourUser; 
        } 

        // going to mark the user via a cookie as 
        // a validated user belonging to our club 
        function tagOurUser() { 
                // write the zipcode cookie since not under aaa.com 
                var today = new Date(); 
                var expirationDate = new Date(); 
                var foundZipcode = window.location.search.substring(startingIndex); 
                if(foundZipcode.length > 5) { 
                        var endingIndex = foundZipcode.indexOf("&"); 
                        if(endingIndex > 0) { 
                                // cut down the zipcode 
                                foundZipcode = foundZipcode.substring(0, endingIndex); 
                        } 
                } 
                // set expiration date to one year. 
                expirationDate.setTime(today.getTime() + 31536000); 
                document.cookie = "zipcode=" + foundZipcode + "|AAA|241; expires=" + expirationDate.toGMTString(); 
        } 

// --> 
