function GetCookie(CookieName) { // Returns the data stored in the client cookie CookieName var tmpVal=""; // Get name/value part of cookie - all characters before first ";" character in cookie var aCookie = document.cookie.split(";"); // Iterate thru all name/value pairs within cookie until one matching the specified name is found for (var i=0; i < aCookie.length; i++) { // a name/value pair (a crumb) is separated by an equals sign var aCrumb = aCookie[i].split("="); if (EquivalentStrings(CookieName, aCrumb[0])) { tmpVal=unescape(aCrumb[1]); // return the cookie value } } // Return null if no match found return tmpVal; // return unescape(document.cookie); } function SetCookie(CookieName, CookieValue) { // Saves the value CookieValue in the client cookie CookieName var arryWeekDays = new Array("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"); var arryMonths = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"); // Set default cookie properties var dteExpires = new Date(); var intDay = dteExpires.getDate(); dteExpires.setDate(intDay + 200); var strExpires = arryWeekDays[dteExpires.getDay()] + ", " + dteExpires.getDate() + " " + arryMonths[dteExpires.getMonth()] + " " + dteExpires.getFullYear() + " " + dteExpires.getHours() + ":" + dteExpires.getMinutes() + ":00 UTC"; // Create the cookie string var tmpCookie = CookieName + "=" + escape(CookieValue) + ";"; // "escape" function ensures only valid characters are stored if (CookieValue == 0) tmpCookie = CookieName + "=;" else tmpCookie=tmpCookie + "expires=" + strExpires + ";"; // Save the cookie document.cookie=tmpCookie; } // INTERNAL FUNCTIONS: function EquivalentStrings(String1, String2) { // Compare String1 to String2 to see if they are equivalent (ie equal strings ignoring case and leading/trailing spaces) // Dependancy of: GetCookie() // Removes any leading/trailing spaces from String1 // Remove any leading spaces while (String1.charAt(0)==" ") { String1=String1.substr(1); } // Remove any trailing spaces while(String1.charAt(String1.length-1)==" ") { String1=String1.substr(0, (String1.length-1)); } // Removes any leading/trailing spaces from String2 // Remove any leading spaces while (String2.charAt(0)==" ") { String2=String2.substr(1); } // Remove any trailing spaces while(String2.charAt(String2.length-1)==" ") { String2=String2.substr(0, (String2.length-1)); } // Compare String1 to String2 (case insensitive comparison) var retval=false; if (String1.toUpperCase()==String2.toUpperCase()) { retval=true; } return retval; } function AllowSessionCookie() { document.cookie="GCtest=Yes;"; if (GetCookie("GCtest") != "") { return true; } else { return false; } }