//
//   setEECookie(name,value,expire)
//
//   Sets cookie value for the cookie named "name". The expiration date is optional; 
//   if not given, the cookie will only exist for the current session
//
function setEECookie(name, value, expire) {
   var cookie_string = name + "=" + escape(value);
   if (expire) { cookie_string += "; expires=" + expire.toGMTString() + ";"; }   
   document.cookie = cookie_string;
}

//
//   getEECookie(name)
//
//   Returns the value of the existing cookie named "name".
//
function getEECookie(name) {
   var search = name + "="
   if (document.cookie.length > 0) { // if there are any cookies
      offset = document.cookie.indexOf(search) 
      if (offset != -1) { // if cookie exists 
         offset += search.length 
         // set index of beginning of value
         end = document.cookie.indexOf(";", offset) 
         // set index of end of cookie value
         if (end == -1) 
            end = document.cookie.length
         return unescape(document.cookie.substring(offset, end))
         }
      else {
        return ""
        } 
   }
}

