////////////////////////////// // VARIABLES ////////////////////////////// var survWindow; var requestAgain = false; var survWidth = 725; var survHeight = 725; var survURL = 'http://www.surveymonkey.com/s/tbwebsitesurvey'; var survWinProps = 'status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=0,scrollbars=1'; var survWinName = 'surveyWindow'; var survFreq = 10; var survDay='30'; var today = new Date(); var setDay = new Date(); setDay.setDate(today.getDate() + Number(survDay)); ////////////////////////////// // MAIN ////////////////////////////// function decline() { document.cookie = 'survey=declined; expires=' + setDay + '; path=/business'; document.cookie = 'expiryday=' + setDay + '; expires=Mon, 31-Dec-2029 23:59:59 GMT; path=/business'; } function later() { requestAgain = true; document.cookie = 'survey=later; expires=' + setDay + '; path=/business'; document.cookie = 'expiryday=' + setDay + '; expires=Mon, 31-Dec-2029 23:59:59 GMT; path=/business'; } function unloadRequest() { if (requestAgain) { requestAgain = false; } else { //decline(); } } function accept() { if (!survWindow) { survWindow = window.open(survURL, survWinName, survWinProps + ',height=' + survHeight + ',width=' + survWidth + ',top=' + (screen.height-survHeight)/2 + ',left=' + (screen.width-survWidth)/2); } else { survWindow.focus(); } if (survWindow) { // We only set the accepted cookie after the window has successfully opened. So if a popup blocker blocks the survey document.cookie = 'survey=accepted; expires=' + setDay + '; path=/business'; document.cookie = 'expiryday=' + setDay + '; expires=Mon, 31-Dec-2029 23:59:59 GMT; path=/business'; } else { // warn about popup blockers? } }