// cookie.js // Generic reusable cookie-handling code for JavaScript. // (c)2000 by Lightfall Interactive. May be re-used with // inclusion of this copyright text. // n = name, v = value, x = expire (optional), p = path (optional) function seck(n, v, x, p) { document.cookie = n + "=" + escape(v) + "; domain=.abanet.org" + ((x == null) ? "" : ("; expires=" + x.toGMTString())) + ((p == null) ? "" : ("; path=" + p)); } function geck(n) { var sn = n + "="; var dc = document.cookie; if (dc.length > 0) { // any cookies home? offset = dc.indexOf(sn); if (offset != -1) { // does the sought cookie exist? offset += sn.length; end = dc.indexOf(";", offset); if (end == -1) end = dc.length; return unescape(dc.substring(offset, end)); } } } function makeComplexCookie(indicia,vals) { var cxCookie = ""; for (i = 0; i < indicia.length; i++) { cxCookie += indicia[i] + ":" + vals[i]; if (i != indicia.length - 1) cxCookie += "+"; } return cxCookie; } function getComplexCookie(cStr) { // should already have been unescaped by geck() var cPairs = cStr.split("+"); var cPair = ""; var cxCookie = new Array(); for (i = 0; i < cPairs.length; i++) { cPair = cPairs[i]; var cPairSplit = cPair.split(":"); var cProp = cPairSplit[0]; var cValue = cPairSplit[1]; cxCookie[cProp] = cValue; } return cxCookie; } function userAccessible() { var auth = geck("ABAIAuth"); if (auth != "true") { alert("Please sign in before browsing this section."); window.location = "http://www.abanet.org/publiced/insights/gateway.html"; } }