1/* Define Global State Variables */ 2 3var _eGovSessionID = ''; 4var _eGovStateNavigation = ''; 5var _eGovStateSubNavigation = ''; 6var _eGovStateToolbar = ''; 7var _eGovStateLeftNav = ''; 8 9/* Get All Cookies Pertaining to This Webpage */ 10 11var allCookies = document.cookie; 12 13/* Parse Session Cookie */ 14 15var posSession = allCookies.indexOf("egov="); 16 17if (posSession != -1) 18{ 19 var start = posSession + 5; 20 var end = allCookies.indexOf(";", start); 21 22 if (end == -1) 23 { 24 end = allCookies.length; 25 } 26 var value = allCookies.substring(start, end); 27 28 _eGovSessionID = unescape(value); 29} 30 31/* Parse Navigation State Cookie */ 32 33var posNavigation = allCookies.indexOf("egn="); 34 35if (posNavigation != -1) 36{ 37 var start = posNavigation + 4; 38 var end = allCookies.indexOf(";", start); 39 40 if (end == -1) 41 { 42 end = allCookies.length; 43 } 44 var strValue = allCookies.substring(start, end); 45 46 var arrValue = strValue.split('&'); 47 48 for (var i = 0; i < arrValue.length; i++) 49 { 50 if (i == 0) 51 { 52 _eGovStateNavigation = unescape(arrValue[i]); 53 } 54 else if (i == 1) 55 { 56 _eGovStateSubNavigation = unescape(arrValue[i]); 57 } 58 else if (i == 2) 59 { 60 _eGovStateToolbar = unescape(arrValue[i]); 61 } 62 else if (i == 3) 63 { 64 _eGovStateLeftNav = unescape(arrValue[i]); 65 } 66 } 67} 68 69function eGovStoreCookie(strCookieName, arrValue) 70{ 71 /* Declare Some Variables */ 72 73 var strCookieValue; 74 var expiration; 75 var navExpireLife = 30 * 24 * 60 * 60 * 1000; /* days * hr/day * min/hr * sec/min * ms/sec */ 76 var navExpiration = new Date((new Date()).getTime() + navExpireLife); 77 var sessionExpiration; /* TO DO: get this from the manager */ 78 79 /* Create Cookie String Based on cookie name and passed values */ 80 if (strCookieName == 'egn') 81 { 82 arrValue[0] = arrValue[0] ? escape(arrValue[0]) : ''; 83 arrValue[1] = arrValue[1] ? escape(arrValue[1]) : ''; 84 arrValue[2] = arrValue[2] ? escape(arrValue[2]) : _eGovStateToolbar ? escape(_eGovStateToolbar) : ''; 85 arrValue[3] = arrValue[3] ? escape(arrValue[3]) : _eGovStateLeftNav ? escape(_eGovStateLeftNav) : ''; 86 87 _eGovStateNavigation = unescape(arrValue[0]); 88 _eGovStateSubNavigation = unescape(arrValue[1]); 89 _eGovStateToolbar = unescape(arrValue[2]); 90 _eGovStateLeftNav = unescape(arrValue[3]); 91 92 strCookieValue = arrValue.join('&'); 93 expiration = navExpiration; 94 } 95 else if (strCookieName == 'egov') 96 { 97 strCookieValue = arrValue[0] ? escape(arrValue[0]) : _eGovSessionID ? escape(_eGovSessionID) : ''; 98 _eGovSessionID = unescape(strCookieValue); 99 expiration = arrValue[1]; 100 } 101 else 102 { 103 alert('Invalid Cookie Name: \'' + strCookieName + '\''); 104 return; 105 } 106 107 /* Construct the Cookie */ 108 109 var strCookie = strCookieName + '=' + strCookieValue + '; ' 110 + 'expires=' + expiration + '; ' 111 + 'path=/;'; 112 strCookie += window.location.protocol == 'https:' ? 'secure;' : ''; 113 114 /* Write the Cookie */ 115 116 document.cookie = strCookie; 117}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.