var CT_I_Datasets = ['Pzi4MEC3NW3VOkeY']; var CT_I_Path = '//rogue.seoinc.com/cgi-bin/ctasp-server.cgi?'; // CT_I_... is an internally defined variable // window.CT_C_... is an internally named variable that the customer sets // window.CT_X_... is a customer defined variable to be written as a biscuit if (typeof(window.CT_C_Debug) == 'undefined') { window.CT_C_Debug = 0; } var CT_I_Busy = 0; var CT_I_Requests = new Array(); var CT_I_FirstPartyJDC = 0; var CT_I_FirstPartyCookies = 0; var CT_I_EnableExitTracking = 0; var CT_I_LocalLinks = ['www.sb.continentalwarranty.com', 'continentalwarranty.com', 'sb.continentalwarranty.com', 'www.continentalwarranty.com']; function CT_GetCookies() { var all = document.cookie; var cs = all.split(/; /); var output = new Object(); for (var i in cs) { var cookie = cs[i]; var fields = cookie.split(/=/, 2); output[fields[0]] = fields[1]; } return output; } function CT_RecordView(request, method) { // set defaults var basicCall = 1; if (request == null) { request = document.location; } else { basicCall = 0; } if (typeof(window.CT_R_PID) != 'undefined') { request += (/\?/.test(request) ? '&' : '?') + 'CT_R_PID=' + escape(window.CT_R_PID); } var orderTotal = 0; if (typeof(window.CT_C_OrderTotal) != 'undefined') { orderTotal = window.CT_C_OrderTotal; } // handle biscuits first var biscuits = new Array(); for (var i in window) { // if variable name starts with CT_X_ followed by something else if (i.substring(0, 5) == 'CT_X_' && i.length > 5) { var s = escape(window[i] + '').replace(/%26/g, '%2526'); biscuits.push(i + '=' + s); } } var ctxValue = biscuits.join('%26'); // setup request fields var vals = new Array(); vals.push('i=' + CT_I_Datasets.join('&i=')); vals.push('r=' + escape(request)); if (CT_I_FirstPartyJDC) { vals.push('fp=1'); } if (CT_I_FirstPartyCookies || CT_I_FirstPartyJDC) { vals.push('c=' + escape(document.cookie)); } if (method != null) { vals.push('s=' + method); // method vals.push('f=' + escape(document.location)); // referrer } else { vals.push('f=' + escape(document.referrer)); // referrer if (orderTotal > 0) { // due to Safari, can't use Math.toFixed calls or String.slice - I guess they forgot it var orderTotalSign = ''; if (orderTotal < 0) { orderTotalSign = '-'; orderTotal = 0 - orderTotal; } var orderTotalInt = Math.floor(orderTotal); var orderTotalPennies = '' + (100 + (100 * (orderTotal - Math.floor(orderTotal)))); var oLen = orderTotalPennies.length; orderTotalPennies = orderTotalPennies.substring(oLen - 2, oLen); orderTotal = orderTotalSign + orderTotalInt + '.' + orderTotalPennies; vals.push('e=' + orderTotal); } } if (typeof(CT_I_Subdomain) != 'undefined') { vals.push('d=' + escape(CT_I_Subdomain)); } if (ctxValue != '') vals.push('U=' + ctxValue); // biscuits if (basicCall == 0) vals.push('g=1'); // use graphic as response if (typeof(CT_I_Protocol) == 'undefined') { CT_I_Protocol = window.location.protocol; } var path = CT_I_Protocol + CT_I_Path + vals.join('&'); var debug = window.CT_C_Debug; if (debug) { debugMsg = 'ClickTracks JavaScript Data\n'; if (orderTotal != 0) { debugMsg += 'OrderTotal = ' + orderTotal.toFixed(2) + '\n'; } if (biscuits.length > 0) { debugMsg += 'Biscuits:\n ' + biscuits.join('\n ') + '\n'; } if (debug > 1) { debugMsg += 'Request:\n ' + path + '\n'; } if (basicCall) { debugMsg += '(Basic call)\n'; } else { debugMsg += '(Advanced call)\n'; } debugMsg += '\n\nIf you set any other data, it was not set correctly.\n'; alert(debugMsg); } if (basicCall) { // called to log the page being loaded, JavaScript can still be added to and executed document.write('<'+'script language="javascript" type="text/javascript" src="' + path + '">'); } else { // called by exit tracking or customer activity var a = new Image(); a.src = path; CT_I_Requests.push(a); CT_I_Busy = 1; var now = new Date(); now = now.getTime() + 1000; var then; do { then = new Date(); } while (then.getTime() < now); } } // CT_RecordView() function CT_ProcClick(evt) { evt = (evt) ? evt : ((window.event) ? event : null); if (evt) { var e = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null); if (e) { while (e) { var link = ''; switch(e.tagName) { case 'A': case 'AREA': link = e.href; break; case 'INPUT': if (e.form) { e = e.form; link = e.action; if (link == '') link = document.location.href; } else { link = ''; } break; } switch(e.tagName) { case 'A': case 'AREA': if (link != '' && !CT_LocalLink(link)) CT_RecordView(link, 'EXIT'); e = 0; break; default: e = (e.parentElement) ? e.parentElement : e.parentNode; break; } } } } } // CT_ProcClick function CT_LocalLink(link) { var pieces = link.match(/^https?:\/\/([^\/]+)\//); if (pieces) { var l = pieces[1].length; for (var i in CT_I_LocalLinks){ if (pieces[1] == CT_I_LocalLinks[i] || pieces[1].substring(l - 1 - CT_I_LocalLinks[i].length) == '.' + CT_I_LocalLinks[i]) return true; } return false; } return true; } // CT_LocalLink if (CT_I_EnableExitTracking) { if (document.addEventListener) { // handle DOM 2 (Mozilla 6) document.addEventListener('click', CT_ProcClick, false); } else { document.attachEvent('onclick', CT_ProcClick); } } CT_RecordView();