// This file is (C) Copyright 2004 by ASI Image Studios Inc.
// All rights reserved.
function deleteCookie(key)
{
  var prevYear = new Date();
  
  prevYear.setFullYear(prevYear.getFullYear() - 1);
  document.cookie = key + "=x; expires=" + prevYear.toGMTString();
}

function setCookie(key, value, expiry, path, domain, secure)
{
  var cookieString = "";

  cookieString = key + "=" + escape(value);
  if(expiry)
    cookieString += "; expires=" + expiry.toGMTString();
  if(path && path != "")
    cookieString += "; path=" + path;
  if(domain && domain != "")
    cookieString += "; domain=" + domain;
  if(secure)
    cookieString += "; secure";

  document.cookie = cookieString;
}

function getCookie(key)
{
  var startKey, startIndex, endIndex, keyString;
  
  startKey = document.cookie.indexOf(key + "=");
  if(startKey == -1)
    return(false);

  keyString = document.cookie.substring(startKey);
  startIndex = keyString.indexOf("=") + 1;
  endIndex = keyString.indexOf(";", startIndex);

  if(endIndex == -1)
    return(unescape(keyString.substring(startIndex)));

  return(unescape(keyString.substring(startIndex, endIndex)));
}
