
function getCookie(cookName, thisDoc) { 
 if (! thisDoc) thisDoc = document;
 if (typeof(isServerSide) == "function" && isServerSide())
  return ""+ Request.Cookies(cookName);
 else
  var aCookie = thisDoc.cookie.split("; ");
 for (var i=0; i < aCookie.length; i++) { 
	 var aCrumb = aCookie[i].split("=");
	 if (cookName == aCrumb[0]) 
	  return (aCrumb[1] ? unescape(aCrumb[1]) : null);
  }
 return "";
 }

function deleteCookies(cookName, thisDoc) { 
 if (! thisDoc) thisDoc = document;
 var cookDate =";expires=Sat, 31 Dec 2000 23:59:59 UTC;";
 if (getCookie(cookName))
  if (isServerSide())
  Request.cookie(cookName) = escape("on") + cookDate;
 else
  thisDoc.cookie = cookName + "="+ escape("on") + cookDate;
 }

function saveCookies(cookName, thisVal, thisDoc)  { 
 if (! thisDoc) thisDoc = document;
 var cookDate = ";expires=Sat, 31 Dec 2050 23:59:59 UTC;";
 if (typeof(isServerSide) == "function" && isServerSide())
  Request.cookie(cookName) = escape(thisVal) + cookDate;
 else
  thisDoc.cookie = cookName + "="+ escape(thisVal) + cookDate;
 }

