// JavaScript Document //calling the getCookie () function //define variable checkCookie and set to "" var checkCookie = ""; //Assign checkCookie to result of getCookie("SeenGenEvntNotc") checkCookie = getCookie("SeenGenEvntNotc"); alert("The value of checkCookie is: " + checkCookie); //debug only //Function to add a cookie to the users computer //Uses 2 parameters: //Tag: Name of the variable to save in the cookie //Value: value to store in that variable function addCookie(tag,value) { //Initialize variables var expireDate = new Date(); var expireString = ""; //set the expiry date 3 hours from now, in milliseconds expireDate.setTime(expireDate.getTime() + (1000*60*60*3)); //build string containing expiry date in browser comaptiable format //(toGMTString()) expireString = "expires=" + expireDate.toGMTString(); //Create the Cookie document.cookie= tag + "=" + escape(value) + ";" + expireString + ";"; } //end of function addCookie(tag,value) //function to get cookie information function getCookie(tag) { //set value variable to null var value = null; //get the cookies name value pairs; add a ';' to the end var myCookie = document.cookie + ";"; //concatenate the value being looked for with an equal sign var findTag = tag + "="; //define endPos variable var endPos; //Check to see if cookie has data in it if (myCookie.length > 0) { //Since the cookie contains data, find the variable the //calling function requested var beginPos = myCookie.indexOf(findTag); // if (beginPos != -1) { // beginPos = beginPos + findTag.length; //search for the next ';' endPos = myCookie.indexOf(";",beginPos); //Check to see if this is the ending position if (endPos ==-1) { //set endPos to the length of myCookie - the last position endPos = myCookie.length; } //end of if (endPos==-1) //Extract the value from the cookie value = unescape(myCookie.substring(beginPos,endPos)); } //end of if (beginPos != -1) } //end of if (myCookie.length > 0) //Return the value return value; } //end of getCookie(tag) function msgGenEvent(checkCookie) { alert("Inside msgGenEvent()"); //debug only alert("The value of checkCookie is: " + checkCookie); //debug only //does the cookie exist? if it does, then display a frame if (checkCookie == null) { //display the message alert("The London & Middlesex County Branch OGS library will be CLOSED as of Thursday September 28th, 2006 for restoration work being done to the interior. The restoration work necessitates the removal of the books and equipment from the library. We hope that we will be back in the library and operational by October 23rd, 2006 but it may be October 31st, 2006 before we are operational again. Information and updates will be posted on our website regularly. We are very sorry for the inconvenience. Carolyn Croke, Chair London & Middlesex County Branch OGS"); addCookie("SeenGenEvntNotc","TRUE"); } //end of if (checkCookie = null) }