var exp = new Date(); exp.setTime(exp.getTime() + (expDays*24*60*60*1000)); theWidth = 720; if (screen.height >= 1024) theHeight = 540; else if (screen.height >= 864) theHeight = 540; else if (screen.height >= 768) theHeight = 540; else if (screen.height >= 600) theHeight = 540; else theHeight = 540; theTop=(screen.availHeight/2)-(theHeight/2) theLeft=(screen.availWidth/2)-(theWidth/2) features='toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,resizable=no,height='+theHeight+',width='+theWidth+',top='+theTop+',left='+theLeft; var hRange = 100; //Change the upper range to modify the probablity of an eCollector call RTPopup(link); initInviteBox(link); function RTPopup(link) //Calling function for the popup window on page load. { var count = GetCookie('Resp'); if (count == null) { count=1; SetCookie('Resp', count, exp, '/', null,false); } else { if (count == pCount) // This is the number of pages hit before the eCollector is popped up. { //Institate code to call AJAX window here. count++; SetCookie('Resp', count, exp, '/', null,false); var rndNum; rndNum = Math.floor(Math.random()*hRange); if ((rndNum <= PercentOpen)) { confirmation(); // var wOpen; // wOpen = window.open(link, 'RTCollector', features); // wOpen.focus(); } else { } } else { count++; SetCookie('Resp', count, exp, '/', null,false); } } } function RTeClick(link) // Activates popup on click and increase count above pCount. { count=pCount + 2; SetCookie('Resp', count, exp, '/', null,false); var wOpen; wOpen = window.open(link, 'RTCollector', features); wOpen.focus(); } function confirmation() { displayInviteBox(); // var answer = confirm("We value customer feedback and invite you to complete a short survey about your customer experience.") // // if (answer){ // } // else{ // } } function initInviteBox(link) { jQuery('#inviteBox').css({ 'width': '320px', 'left': (jQuery(window).width()/2 - 160) }); jQuery('#inviteBox #close_survey').click(function() { jQuery('#inviteBox').fadeOut(); }); jQuery('#inviteBox #do_survey').click(function() { var wOpen; jQuery('#inviteBox').fadeOut(); wOpen = window.open(link, 'RTCollector', features); wOpen.focus(); }); } function displayInviteBox() { jQuery('#inviteBox').fadeIn(); }