;((function(){
  if (window._ts) return;
  window._ts = function(){
    var x = {
      // Get incoming referrer
      r: escape(document.referrer||""),
      // Get current URL
      u: escape(window.location.href),
      // Get all of the tracking codes available on the page
      c: ((function(){
        var a = document.getElementsByTagName("script"),
        b=[], c, d, e, f;
        for (c=0; c<a.length; c++) {
          // Get codes from each 
          if (a[c].src && a[c].src.indexOf("targetspot")>-1) {
            d = a[c].src.split("?");
            if (d.length && d[1]) {
              d = d[1].split("&");
              if (d.length) {
                for(e=0;e<d.length;e++) {
                  f = d[e].split("=");
                  if (f.length && f[0] == "tracking_code") {
                    b.push(f[1]);
                  }
                }
              }
            }
          }
        }
        return b;
      })())
    };
    var iframe = document.createElement("iframe");
    iframe.src = "//player.cdn.targetspot.com/track/iframe.php?referrer="+x.r+"&u1="+x.u+"&code="+escape(x.c.join('|'));
    iframe.height = 0;
    iframe.width = 0;
    iframe.style.position = "absolute";
    iframe.style.top = "-1000px";
    iframe.style.left = "-1000px";
    document.body.appendChild(iframe);
  };
  window.setTimeout(function(){
    window._ts();
    window._ts = null;
  }, 4000);
})());