function Cookie(document, name, hours, path, domain, secure) { this.$document = document; this.$name = name; if ((hours) && (hours != 0)) { this.$expiration = new Date((new Date()).getTime() + hours*3600000); } else { this.$expiration = null; } if (path) this.$path = path; else this.$path = null; if (domain) { if (domain == "_DOMAIN_") this.$domain = getDomain(); else if (domain == "_HOST_") this.$domain = document.location.host; else this.$domain = domain; } else { this.$domain = null; } if (secure) this.$secure = true; else this.$secure = false; } function getDomain() { var server = document.location.host.split("."); if (server.length > 1) { return server.slice(1).join("."); } else return null; } function _Cookie_store() { var cookieval = ""; for(var prop in this) { // Ignore properties with names that begin with '$' and also methods. if ((prop.charAt(0) == '$') || ((typeof this[prop]) == 'function')) { continue; } if (cookieval != "") cookieval += '&'; cookieval += prop + ':' + escape(this[prop]); } var cookie = this.$name + '=' + cookieval; if (this.$expiration) { cookie += '; expires=' + this.$expiration.toGMTString(); } if (this.$path) cookie += '; path=' + this.$path; if (this.$domain) cookie += '; domain=' + this.$domain; if (this.$secure) cookie += '; secure'; this.$document.cookie = cookie; } function _Cookie_load() { var allcookies = this.$document.cookie; if (allcookies == "") return false; var start = allcookies.indexOf(this.$name + '='); if (start == -1) return false; // Cookie not defined for this page. start += this.$name.length + 1; // Skip name and equals sign. var end = allcookies.indexOf(';', start); if (end == -1) end = allcookies.length; var cookieval = allcookies.substring(start, end); var a = cookieval.split('&'); // Break it into array of name/value pairs. for(var i=0; i < a.length; i++) { // Break each pair into an array. a[i] = a[i].split(':'); } for(var i = 0; i < a.length; i++) { this[a[i][0]] = unescape(a[i][1]); } return true; } function _Cookie_remove() { var cookie; cookie = this.$name + '='; if (this.$path) cookie += '; path=' + this.$path; if (this.$domain) cookie += '; domain=' + this.$domain; cookie += '; expires=Fri, 02-Jan-1970 00:00:00 GMT'; this.$document.cookie = cookie; } // Create a dummy Cookie object, so we can use the prototype object to make the functions above into methods. new Cookie(); Cookie.prototype.store = _Cookie_store; Cookie.prototype.load = _Cookie_load; Cookie.prototype.remove = _Cookie_remove; // CUSTOMIZATIONS TO THE SCRIPT START HERE ***************** function createSurveyCookie() { var ck = new Cookie(document,"8weekstogo cookies", 2147483647); ck.timevalue = (new Date()).getTime(); ck.store(); } function clearSurveyCookie() { var ck = new Cookie(document,"8weekstogo cookies"); ck.remove(); } function readSurveyCookie() { var ck = new Cookie(document,"8weekstogo cookies"); if (ck.load()) { return ck.timevalue; } else { return null; } return null; } function checkSurveyCookie() { var ck = readSurveyCookie("8weekstogo cookies"); if (ck == null || ck == undefined || ck == "") { // Only displays the popup if cookie is not already set var newdiv = document.createElement('div'); newdiv.setAttribute("id", "popup_window"); newdiv.innerHTML = "
1234

Please take our survey

Thanks for visiting our website today. We would appreciate your feedback on it. Completing the survey takes just over 1 minute. Would you like to help us by answering some questions?

Yes
No
I am happy to answer some questionsI would prefer not to answer any questions
"; document.body.appendChild(newdiv); newdiv.style.cssText = "display:none;position:absolute;visibility:hidden;z-index:1000;"; showSurveyPopup(); } } function showSurveyPopup() { var lay = document.getElementById("popup_window"); var content = document.getElementById("popup_window").innerHTML; var myWin = window.open('','myWin','width=640,height=370'); myWin.document.write(''); lay.style.display = "none"; lay.style.visibility = "hidden"; } function closeSurveyPopup() { var lay = document.getElementById("popup_window"); lay.style.display = "none"; lay.style.visibility = "hidden"; createSurveyCookie(); window.close(); } function activateSurvey() { createSurveyCookie(); window.open("http://gskvoiceofcustomer.com/uc/gsk_admin/04dc/ ","_blank","width=900,height=600,location=no,resizable=yes,menubar=no,toolbar=no,scrollbars=yes"); window.close(); } var Page_Enter; var TimeLimit=20; var Page_ShowPopOnExit=false; var MySiteDomain=''; function XBrowserAddHandlerPops(target,eventName,handlerName) { if (target.addEventListener) { target.addEventListener(eventName, function(e){target[handlerName](e);}, false); } else if (target.attachEvent) { target.attachEvent("on" + eventName, function(e){target[handlerName](e);}); } else { var originalHandler = target["on" + eventName]; if (originalHandler) { target["on" + eventName] = function(e){originalHandler(e);target[handlerName](e);}; } else { target["on" + eventName] = target[handlerName]; } } } function InternalLink() { Page_ShowPopOnExit = false; } function PageEnter() { Page_Enter=new Date(); } function SiteExit() { var time_dif; var Page_Exit=new Date(); time_dif=(Page_Exit.getTime()-Page_Enter.getTime())/1000; time_dif=Math.round(time_dif); if (time_dif<=TimeLimit && Page_ShowPopOnExit==true) { checkSurveyCookie(); } } function LinkConvert() { var href; var anchors = document.getElementsByTagName('a'); for (var y=0; y < anchors.length; y++) { href = anchors[y].href.toLowerCase(); if (href.indexOf(MySiteDomain)!=-1) { anchors[y].clickhandler=InternalLink; XBrowserAddHandlerPops(anchors[y],"click","clickhandler"); } } } XBrowserAddHandlerPops(window,"load","PageEnter"); XBrowserAddHandlerPops(window,"load","LinkConvert"); XBrowserAddHandlerPops(window,"unload","SiteExit"); Page_ShowPopOnExit=true;