function GetCookie(Name) {
   if(document.cookie.length > 0) {
      Begin = document.cookie.indexOf(Name + "=");

      if(Begin != -1) {
         Begin += CookieName.length + 1;
         End = document.cookie.indexOf(";", Begin);

         if(End == -1) {
            End = document.cookie.length;
         }

         return unescape(document.cookie.substring(Begin, End));
      }
   }

   return null;
}

function SetCookie(Name, Value, ExpireDays) {
   var ExpireDate = new Date();

   ExpireDate.setTime(ExpireDate.getTime() + (ExpireDays * 24 * 3600 * 1000));
   document.cookie = Name + "=" + escape(Value) + ((ExpireDays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}
