

   // Firstly, does this browser support setting bookmarks?

   if(document.all)
   {
      // Yes, so define the functions we'll need ...

      function setCookie(cookieName, cookieValue, hoursToExpiration)
      {
         var expires =
            new Date((new Date()).getTime() + hoursToExpiration * 3600000);

         var theCookie =
            escape(cookieName) + '=' + escape(cookieValue) + ';' +
            'expires=' + expires.toGMTString();

         document.cookie = theCookie;
      }

      function trim(value)
      {
         return(value.replace(/^\s*/, "").replace(/\s*$/, ""));
      }

      function getCookie(cookieName)
      {
         var theList     = document.cookie.split(';');
         var cookieValue = "";
         cookieName      = trim(cookieName.toLowerCase());

         for(var i = 0; i < theList.length; i ++)
         {
            var pair = theList[i].split('=');
 
            if(pair.length == 2)       
            {
               var key   = trim(pair[0].toLowerCase());
               var value = trim(pair[1]);

               if(cookieName == key)
               {
                  cookieValue = value;
                  break;
               }
            }
         }

         return(cookieValue);
      }

      function doBookMark(bookMarkName, cookieName, daysToExpiration)
      {
         window.external.AddFavorite(document.URL, bookMarkName);
         setCookie(cookieName, 'yes', 24 * daysToExpiration);
      }

      // Ok, if the cookie exists we're already attempted to get
      // this person to bookmark the page

      var cookieName = 'attemptedBookMark';
      var result     = getCookie(cookieName);

      if(result == "")
      {
         // No cookie, so try to get them to bookmark the site and
         // set the cookie to expire 'daysToExpiration' days
         // from now ...

         var bookMarkName     = 'NorthSide Tickets';
         var daysToExpiration = 90;
         var delaySeconds     = 25;

         setTimeout(
            "doBookMark('" +
            bookMarkName + "', '" +
            cookieName + "', " +
            daysToExpiration + ")",
            delaySeconds * 1000
         );
      }
   }

