home *** CD-ROM | disk | FTP | other *** search
- // COOKIE FUNCTIONS
-
- // setCookie (name, value) - sets a name value pair in the cookie
- // getCookie (name) - returns the value associated with the name
- // deleteCookie (name) - destroys the name value pair in the cookie
-
- function setPermanentCookie (name, value)
- { // creates temporary cookies, if you make a permanent cookie choose date way in future
- document.cookie = escape(name) + "=" + escape(value) + ";path=/;expires=Fri, 2-Jan-2025 00:00:00 GMT;";
- } // End Function
-
-
- function getCookie (name) {
- if (document.cookie == '') {
- return false;
- }
- else {
- var firstChar, lastChar;
- var allCookies = document.cookie;
- firstChar = allCookies.indexOf(name);
- var theSpecifiedCookie = firstChar + name.length;
- if ((firstChar != -1) && (allCookies.charAt(theSpecifiedCookie) == '=')) {
- firstChar += name.length + 1;
- lastChar = allCookies.indexOf(';' , firstChar);
- if (lastChar == -1) lastChar = allCookies.length; {
- return unescape(allCookies.substring(firstChar, lastChar));
- }
- }
- else {
- return false;
- }
- }
- } // End Function
-
-
- function deleteCookie(name)
- {
- var theValue = getCookie(name);
- if(theValue)
- {
- //alert("deleting " + name)
- document.cookie = name + '="";path=/;expires=Fri, 13-Apr-1970 00:00:00 GMT;';
- }
- } // End Function