var setcookie = "N"; var doreplace = "N"; var ruleset = "None"; var continueeval = "Y"; var referrer = "Nothing"; var overridevariablevalue = "Nothing"; // Examine cookie var curCookie = document.cookie.split("; "); for (var i=0; i < curCookie.length; i++) { var crumb = curCookie[i].split("="); var name = crumb[0]; var value = crumb[1]; // Found a Cookie if (name == "HubCookie") { // Pull values from the HubCookie var cookvalue = value.split("|"); overridevariablevalue = cookvalue[0]; if (overridevariablevalue != "Nothing") { value = overridevariablevalue; // We found our variable name.. Now look at values. if (name = "PhoneScript") { // We found a value match. Set doreplace to Y... if (value == "cpc") { overridevariablevalue = value; doreplace = "Y"; ruleset = "V"; setcookie = "Y"; continueeval = "N"; } // We found a value match. Set doreplace to Y... if (value == "cpc") { overridevariablevalue = value; doreplace = "Y"; ruleset = "V"; setcookie = "Y"; continueeval = "N"; } // We found a value match. Set doreplace to Y... if (value == "cpc") { overridevariablevalue = value; doreplace = "Y"; ruleset = "V"; setcookie = "Y"; continueeval = "N"; } // We found a value match. Set doreplace to Y... if (value == "cpc") { overridevariablevalue = value; doreplace = "Y"; ruleset = "V"; setcookie = "Y"; continueeval = "N"; } // We found a value match. Set doreplace to Y... if (value == "cpc") { overridevariablevalue = value; doreplace = "Y"; ruleset = "V"; setcookie = "Y"; continueeval = "N"; } } } referrer = cookvalue[1]; if (referrer != "Nothing") { var str = referrer; } // This was set to Y in the template because that is used later, but we DONT want to rewrite the cookie here. setcookie = "N"; } } // Only do this if HubCookie was NOT found... if (continueeval == "Y") { //Examine URL string var searchString = document.location.search; searchString = searchString.substring(1); var nvPairs = searchString.split("&"); for (i = 0; i < nvPairs.length; i++) { var nvPair = nvPairs[i].split("="); var name = nvPair[0]; var value = nvPair[1]; // We found our variable name.. Now look at values. if (name = "PhoneScript") { // We found a value match. Set doreplace to Y... if (value == "cpc") { overridevariablevalue = value; doreplace = "Y"; ruleset = "V"; setcookie = "Y"; continueeval = "N"; } // We found a value match. Set doreplace to Y... if (value == "cpc") { overridevariablevalue = value; doreplace = "Y"; ruleset = "V"; setcookie = "Y"; continueeval = "N"; } // We found a value match. Set doreplace to Y... if (value == "cpc") { overridevariablevalue = value; doreplace = "Y"; ruleset = "V"; setcookie = "Y"; continueeval = "N"; } // We found a value match. Set doreplace to Y... if (value == "cpc") { overridevariablevalue = value; doreplace = "Y"; ruleset = "V"; setcookie = "Y"; continueeval = "N"; } // We found a value match. Set doreplace to Y... if (value == "cpc") { overridevariablevalue = value; doreplace = "Y"; ruleset = "V"; setcookie = "Y"; continueeval = "N"; } } } } // Only do this if HubCookie was NOT found AND URL string evaluation failed to find anything... if (continueeval == "Y") { //Examine referrer var str = document.referrer; } // START myscript FUNCTION function myscript() { //Start Rewrite var newtext = document.body.innerHTML; if (ruleset == "V") { if (overridevariablevalue == "cpc") { newtext = newtext.replace("662-842-8274","662-845-4039"); newtext = newtext.replace("662-842-8274","662-845-4039"); newtext = newtext.replace("662-842-8274","662-845-4039"); newtext = newtext.replace("662-842-8274","662-845-4039"); } if (overridevariablevalue == "cpc") { newtext = newtext.replace("800-429-4357","866-680-5220"); newtext = newtext.replace("800-429-4357","866-680-5220"); newtext = newtext.replace("800-429-4357","866-680-5220"); newtext = newtext.replace("800-429-4357","866-680-5220"); } if (overridevariablevalue == "cpc") { newtext = newtext.replace("800-429-HELP(4357)","866-680-HELP(5220)"); newtext = newtext.replace("800-429-HELP(4357)","866-680-HELP(5220)"); newtext = newtext.replace("800-429-HELP(4357)","866-680-HELP(5220)"); newtext = newtext.replace("800-429-HELP(4357)","866-680-HELP(5220)"); } if (overridevariablevalue == "cpc") { newtext = newtext.replace("(662) 844-7949","(662) 626-6770"); newtext = newtext.replace("(662) 844-7949","(662) 626-6770"); newtext = newtext.replace("(662) 844-7949","(662) 626-6770"); newtext = newtext.replace("(662) 844-7949","(662) 626-6770"); } if (overridevariablevalue == "cpc") { newtext = newtext.replace("622-844-7949","662-626-6770"); newtext = newtext.replace("622-844-7949","662-626-6770"); newtext = newtext.replace("622-844-7949","662-626-6770"); newtext = newtext.replace("622-844-7949","662-626-6770"); } } if (ruleset == "R") { } document.body.innerHTML = newtext; // alert('5'); //End Rewrite if (setcookie == "Y") { // Set cookie // We need to add a PATH substatement here to specify the ROOT directory for landing pages in directories... days=30; // number of days to keep the cookie myDate = new Date(); myDate.setTime(myDate.getTime()+(days*24*60*60*1000)); // Build a HubCookie value that includes the overridevariablevalue | referrer for later processing if they come back. document.cookie = 'HubCookie=' + overridevariablevalue + '|' + referrer + '; path=/; expires=' + myDate.toGMTString(); } } // END myscript function /* function onloadhandler() { window.onLoad = myscript(); } */ if (doreplace == "Y") { //Get browser and Page - Delay if IE and FindaLocation due to Google map conflict var browser=navigator.appName; var sPath = window.location.pathname; var sPage = sPath.substring(sPath.lastIndexOf('/') + 1); if (browser=="Microsoft Internet Explorer" && sPage == "FindaLocation.aspx") { setTimeout('myscript();', 5); } else { setTimeout('myscript();', 5); } } // End If DoReplace is Y