//  Cookie Functions -- "Night of the Living Cookie" Version (25-Jul-96)
//  Written by:  Bill Dortch, hIdaho Design <bdortch@hidaho.com>
//  The following functions are released to the public domain.
// "Internal" function to return the decoded value of a cookie
//
 
function getCookieVal(offset){var endstr=document.cookie.indexOf (";",offset);if(endstr== -1)endstr=document.cookie.length;return unescape(document.cookie.substring(offset, endstr));}

function GetCookie(name) 
{
var arg=name+"=";
var alen=arg.length;
var clen=document.cookie.length;
var i=0;
var j=0;
while(i<clen) 
{
j=i+alen;
if(document.cookie.substring(i,j)==arg)
return getCookieVal(j);
i=document.cookie.indexOf(" ",i)+1;
if(i == 0)break; 
}
return null;
}

function SetCookie(name,value,expires,path,domain,secure) 
{
document.cookie = name + "=" + escape (value) +
((expires) ? "; expires="    + expires.toGMTString() : "") +
((path)    ? "; path="       + path : "") +
((domain)  ? "; domain="     + domain : "") +
((secure)  ? "; secure" : "");
}

function DeleteCookie(name,path,domain){if(GetCookie(name)){document.cookie=name+"="+((path)?"; path="+path:"")+((domain)?"; domain="+domain:"")+";expires=Tue, 01-Jan-2030 00:00:01 GMT";}}

/*
var expdate = new Date ();
expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 1000)); // 24 hrs from now 

SetCookie ("ccpath",     "http://www.hidaho.com/colorcenter/",            expdate              );
SetCookie ("ccname",     "hIdaho Design ColorCenter",                     expdate              );
SetCookie ("tempvar",    "This is a temporary cookie."                                         );
SetCookie ("ubiquitous", "This cookie will work anywhere in this domain", null,   "/"          );
SetCookie ("paranoid",   "This cookie requires secure communications",    expdate,"/",null,true);

SetCookie ("goner",      "This cookie must die!");

document.write (document.cookie + "<br>");

DeleteCookie ("goner");

document.write (document.cookie + "<br>");
document.write ("ccpath = " + GetCookie("ccpath") + "<br>");
document.write ("ccname = " + GetCookie("ccname") + "<br>");
document.write ("tempvar = " + GetCookie("tempvar") + "<br>");
*/