// CONSTANTS // cookie names being set var SELECTED_TAB = "SelectedTab"; var SELECTED_MENU = "SelectedMenu"; var SELECTED_SUBMENU = "SelectedSubMenu"; // DeleteCookie() will remove the named cookie from the cookie file. function DeleteCookie ( inCookieName ) { // set the value of the name to nothing, this should wipe out the cookie document.cookie = inCookieName + "=" + "; path=/"; } // GetCookie() will retrieve the value associated with the cookie name passed in. function GetCookie ( inCookieName ) { var dcookie = document.cookie; var cname = inCookieName + "="; var clen = dcookie.length; var cbegin = 0; while ( cbegin < clen ) { var vbegin = cbegin + cname.length; if ( dcookie.substring( cbegin, vbegin ) == cname ) { var vend = dcookie.indexOf ( ";", vbegin ); if ( -1 == vend ) { vend = clen; } return unescape( dcookie.substring( vbegin, vend )); } cbegin = dcookie.indexOf( " ", cbegin ) + 1; if ( 0 == cbegin ) { break; } } return null; } // SetCookie() will add the cookie name, value and expiration date and time // (if specified) to the cookie file. function SetCookie ( inCookieName, inCookieValue, inCookieExpiration) { document.cookie = inCookieName + "=" + escape( inCookieValue ) + ( inCookieExpiration ? "; expires=" + getExpiryDate(inCookieExpiration) : "" ) + "; path=/"; } function getExpiryDate(nodays) { var UTCstring; Today = new Date(); nomilli=Date.parse(Today); Today.setTime(nomilli+nodays*24*60*60*1000); UTCstring = Today.toUTCString(); return UTCstring; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////// //newly added // the start of Cookie related function function getFontCookieVal (offset) { var endstr = document.cookie.indexOf (";", offset); if (endstr == -1) endstr = document.cookie.length; return unescape(document.cookie.substring(offset, endstr)); } function GetFontCookie (name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + alen; if (document.cookie.substring(i, j) == arg) { return getFontCookieVal (j); } i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return null; } function SetFontCookie (name, value) { var argv = SetFontCookie.arguments; var argc = SetFontCookie.arguments.length; var expires = (argc > 2) ? argv[2] : null; var path = (argc > 3) ? argv[3] : null; var domain = (argc > 4) ? argv[4] : null; var secure = (argc > 5) ? argv[5] : false; document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toUTCString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : ""); } function DeleteFontCookie (name) { var exp = new Date(); exp.setTime (exp.getTime() - 1); var cval = GetFontCookie (name); document.cookie = name + "=" + cval + "; expires=" + exp.toUTCString(); }