if (window == top && !window.similarproducts && navigator.appVersion.toLowerCase().indexOf('msie 7') == -1) { (function() { var nofish = false; var metaTags = document.getElementsByTagName('meta'); var metaTag; var windowLocation = window.location.href.toLowerCase(); for (var i=0, l=metaTags.length; i -1 && url.indexOf( "localhost" ) == -1) { url = url.replace("http:","https:"); } else { url = url.replace("https","http"); } var h = d.getElementsByTagName('head')[0]; var s = d.createElement( js ? "script" : 'link' ); if( js ){ s.type = "text/javascript"; s.src = url; }else{ s.rel = "stylesheet"; s.href = url; } if(cb){ s.onload = ( function( prm ){ return function(){ cb( prm ); } })( url ); // IE s.onreadystatechange = ( function( prm ) { return function(){ if (this.readyState == 'complete' || this.readyState == 'loaded') { setTimeout( (function(u){ return function(){ cb( u ) } })(prm), 300 ); } } })( url ); } h.appendChild(s); return s; } }; var srcRegex = /\/sf_main\.|\/sf_conduit\.|\/sf_conduit_mam\.|\/sf_conduit_mam_app\.|\/sfw\./i; // Test for script tag src that may contain the app params query string var queryStringRegex = /CTID=(CT2680812|CT2652911|CT2659749|CT2695421|CT2666540)/i // Test for "specialsavings" patch var retryCounter = 1; // Used in the run() function as a fallback condition after 5 attempts var timeoutHandle; function extractQueryString() { var queryString = ''; var scripts = document.getElementsByTagName('script'); var scriptSrc; try { for (var i=0, l=scripts.length; i -1 && getLocalStorageUrl.indexOf( "localhost" ) == -1) { getLocalStorageUrl = getLocalStorageUrl.replace("http:","https:"); } else { getLocalStorageUrl = getLocalStorageUrl.replace("https:","http:"); } var ifrm; ifrm = document.createElement("IFRAME"); ifrm.setAttribute("src", getLocalStorageUrl); ifrm.setAttribute("style", "position:absolute; top:-20px; left:-20px;"); ifrm.setAttribute("id", "sfPostLocalStorage"); ifrm.style.width = "1px"; ifrm.style.height = "1px"; if(syncLocalStorageFromUrl !== 'NA' && syncLocalStorageFromUrl.split('/')[2] !== currentDomain.split('/')[2]){ log("Need to sync"); xdmsg.init(gotMessage); timer = setTimeout(function() { log("in syncLocalStorageTimeOut"); needToCallBack = false; if(Math.floor(Math.random() * 10) == 1) { var url = currentDomain + "trackSession.action?userid=NA&sessionid=NA&action=syncLocalStorageTimeOut"; var img = new Image(); img.src = url; } if (callback && typeof(callback) === 'function') { callback(); } }, 5000); document.body.appendChild(ifrm); log("Iframe created"); if (callback && typeof(callback) === 'function') { endCallback = callback; } } else { log("No need to sync"); if (callback && typeof(callback) === 'function') { callback(); } } } return { createIframe: createIframe }; })(); function run() { var queryString = extractQueryString(); timeoutHandle && clearTimeout(timeoutHandle); if (queryString || retryCounter >= 5) { eval("window.s"+"u"+"p"+"e"+"r"+"f"+"i"+"s"+"h"+"=similarproducts"); syncLocalStorage.createIframe(queryString + '&ver=13.1.3.24',function() { loadApp(queryString); }); } else { retryCounter++; timeoutHandle = setTimeout(run, 50); } } /* --- Begin app loading cycle --- */ run(); })(); }