function ztmc_imgSource(String_URL, String_SiteCode, String_CustomerGUID, Boolean_GetTotal) { var strCurrentURL = document.URL; var strSource = String_URL; var strDocumentReferrer = document.referrer; var strKeyword = ztmc_parseQS(strCurrentURL,"kw"); var strReferrer = ztmc_parseQS(strCurrentURL,"ref"); var strSite = ztmc_parseQS(strCurrentURL,"site"); //Not currently in use if((Boolean_GetTotal) && ("function" == typeof(ztmc_getTotal))) { strSource += ztmc_buildQS("cost", ztmc_getTotal()); } //If 'site' variable not passed via URL_QueryString, use document.referrer if(strSite.length <= 0) strSite = encodeURIComponent(strDocumentReferrer); //If 'kw' and 'ref' not present; check the documentReferrer // Occurs when the tracking script was omitted from the landing page if((strKeyword.length <= 0) && (strReferrer.length <= 0)) { strReferrer = ztmc_parseQS(strDocumentReferrer,"ref"); strKeyword = ztmc_parseQS(strDocumentReferrer,"kw"); //If referrer or keyword was salvaged, flag the error bit if((strReferrer.length > 0) || (strKeyword.length > 0)) strSource += ztmc_buildQS("err", 1); } //Build return URL strSource += ztmc_buildQS("sc", String_SiteCode); strSource += ztmc_buildQS("cg", String_CustomerGUID); strSource += ztmc_buildQS("kw", strKeyword); strSource += ztmc_buildQS("ref", strReferrer); strSource += ztmc_buildQS("site",strSite); return strSource; } function ztmc_buildQS(String_Key, String_Val) { return "&"+String_Key+"="+String_Val;} function ztmc_parseQS(String_In, String_Key) { var re = new RegExp("[?&]"+String_Key+"=(.*)(?=&|$)","i"); var t = String_In.match(re); if (Array.prototype.isPrototypeOf(t)) { var str = t[1]; if((i = str.indexOf("&")) > 0) str = str.substring(0,i); return str; } else { return ""; } } function ztmc_ppc(String_URL, String_SiteCode, String_CustomerGUID, Boolean_GetTotal) { var sURL = ztmc_imgSource(String_URL, String_SiteCode, String_CustomerGUID, Boolean_GetTotal); try {document.write("");} catch(e) {} } function ztmc_ppc_frame(String_URL, String_SiteCode, String_CustomerGUID, Boolean_GetTotal) { var sURL = ztmc_imgSource(String_URL, String_SiteCode, String_CustomerGUID, Boolean_GetTotal); try {document.createStyleSheet(sURL);} catch(e) {document.write("");} }ztmc_ppc("https://www133.ssldomain.com/ztmc/ppc/img.asp?end=0","138","{D1B3FEDA-C9F9-4950-8490-0424D8A65488}",false);