// JScript File for the cookies function CreateCookie(myName, myValue, numDays) { var myDate = new Date(); // Define expiration as a number of milliseconds; var myTimeToLive = numDays * 24 * 60 * 60 * 1000; // set the time to the expiration time myDate.setTime(myDate.getTime() + myTimeToLive); // Convert to a string var myExpiration = "; expires=" + myDate.toGMTString(); // Write out the cookie document.cookie = myName + "=" + myValue + myExpiration + "; path=/"; } function ReadCookie(myName) { // Obtain an array of cookie name-values var objCookies = document.cookie.split(';'); var myNameTag = myName + "="; // Search the cookie array for the one you're looking for. for(var i=0 ; i < objCookies.length; i++) { var myCookie = objCookies[i]; // Need to trim the cookie of any leading spaces while (myCookie.charAt(0)==' ') myCookie = myCookie.substring(1, myCookie.length); // Does this match? if (myCookie.indexOf(myNameTag) == 0) { return myCookie.substring( myNameTag.length, myCookie.length); } } return null; } function EraseCookie(name) { CreateCookie(name,"",-1); }