var RootPath = "/"   // Must be changed to final path !!!


// Retrieve the value of the cookie with the specified name.
function GetCookie(sName)
{
  // cookies are separated by semicolons
  var aCookie = document.cookie.split("; ");
  for (var i=0; i < aCookie.length; i++)
  {
    // a name/value pair (a crumb) is separated by an equal sign
    var aCrumb = aCookie[i].split("=");
    if (sName == aCrumb[0])
    {
      var s = unescape(aCrumb[1]);
      if (s == "undefined" || s == "") s = ""
      return s
    }  
  }
  // a cookie with the requested name does not exist
  return "";
}


// Create a cookie with the specified name and value.
function SetCookie(sName, sValue)
{
var s
var d = new Date()
  d = d.getFullYear() + 1
  s = sName + "=" + escape(sValue) + ";" +
                   "expires=Mon, 31 Dec " + d + " 23:59:59 UTC;";                  
  s += "path=" + RootPath + ";"
  document.cookie = s
}


// Delete a cookie with the specified name
function DeleteCookie(sName)
{
var s
var d = new Date()
  d = d.getFullYear() - 10
  s = sName + "=;expires=Mon, 31 Dec " + d + " 23:59:59 UTC;";                   
  s += "path=" + RootPath + ";"
  document.cookie = s
}

