var acceptsCookies = false; if(document.cookie == '') { document.cookie = 'acceptsCookies=yes'; if(document.cookie.indexOf('acceptsCookies=yes') != -1) { acceptsCookies=true; } } else { acceptsCookies=true; } function readCookie (cookieName) { if(document.cookie== '') { return false; } else { var firstChar, lastChar; var theBigCookie = document.cookie; firstChar = theBigCookie.indexOf(cookieName); var NN2Hack = firstChar + cookieName.length; if((firstChar != -1) && (theBigCookie.charAt(NN2Hack) == '=')) { firstChar += cookieName.length + 1; lastChar = theBigCookie.indexOf(';', firstChar); if(lastChar == -1) { lastChar = theBigCookie.length; } //decode any spaces (created as + symbols on server side) var cookieString = theBigCookie.substring(firstChar, lastChar); cookieString = cookieString.replace(/\+/g, '%20'); cookieString = unescape(cookieString); //?? for some reason, the first try at unescaping doesn't always work cookieString = unescape(cookieString); return cookieString; } else { return false; } } }