﻿var _emr_ver = "1.0";
var _emr_uid = "";
var _emr_zipcode = "";
var _emr_amount = "";

function emrct() {
  try {
    //[bug:3285 hard-coded here, doh]
    var _root = "www.enterprisemailer.net";
    var _pre = (location.protocol == "https:" ? location.protocol : "http:") + "//";
    var _ur = _root+"/tracking/conversion.aspx";
    var _qs = "";
    if(_emr_uid) { qsIt("uid", _emr_uid); }
    if(_emr_ver) { qsIt("ver", _emr_ver); }
    if(_emr_zipcode) { qsIt("zc", _emr_zipcode); }
    if(_emr_amount) { qsIt("am", _emr_amount); }
    try { qsIt("loc", parent.location.href); } catch(e) {}
    var _emrif = document.createElement("ifr" + "ame");
    _emrif.style.height = 1;
    _emrif.style.width = 1;
    _emrif.style.visibility = "hidden";
    _emrif.src = _pre + _ur + _qs;
    document.body.appendChild(_emrif);
  }
  catch(e) {
    try { 
      //[bug:3200 hard-coded, doh]
      new Image().src = _pre + _root+"/tracking/conversionerror.aspx" + "?em=" + eu(e.message) + "&qs=" + eu(_qs); 
    } 
    catch(e){
    }
  }

  function qsIt(ky, vl) {
    _qs += (_qs == "" ? "?" : "&") + ky + "=" + eu(vl);
  }

  function eu(vl) {
    return encodeURIComponent(vl);
  }
}

