<!-- TMLINKS start -->
function replace(str, from, to) {
 var i = str.indexOf(from);
 if (!from || !str || i == -1) return str;
 var newstr = str.substring(0, i) + to;
 if (i+from.length < str.length)
   newstr += replace(str.substring(i+from.length,str.length),from,to);
 return newstr;

}
function getQry(nm)
{
 if (!location.search) return '';
 var i, j, qry;
 qry = location.search.substring(1);
 i = qry.indexOf(nm)+nm.length+1;
 if (i == nm.length) return '';
 j = qry.indexOf('&',i);
 if (j+1) qry = qry.substring(i,j);
 else qry = qry.substring(i);
 return unescape(replace(qry, '+', ' '));
}


//==============================================================
//This section creates a new meta tag to store the uri and tm_link
var myDocumentHead;
if (document.all){
 myDocumentHead=document.all.tags("head")[0];
}
else if (document.documentElement){
 myDocumentHead=document.getElementsByTagName("head")[0];
}
var CAMEFROM_value = getQry("CAMEFROM") ? getQry("CAMEFROM") : "";
if(CAMEFROM_value){
  newMetaTag = document.createElement("meta");
  newMetaTag.setAttribute('name', 'DCSext.CFC');
      if(CAMEFROM_value.match("rnd=")){
        newMetaTag.setAttribute('content', "NULL");
    }else{
        newMetaTag.setAttribute('content', CAMEFROM_value ? CAMEFROM_value : "NULL");
    }
  myDocumentHead.appendChild(newMetaTag);
}

var tm_link_value = getQry("tm_link");
if(tm_link_value){
    newMetaTag = document.createElement("meta");
    newMetaTag.setAttribute('name', 'DCSext.tm_link');
    // As a result ofpeople monkeying around with our URLs tm_links are coming back as unique and are overloading our reports
    // If the tm_link value contains bogus entries such as "rnd=" reset it to "NULL"
    if(tm_link_value.match("rnd=")){
        newMetaTag.setAttribute('content', "NULL");
    }else{
        newMetaTag.setAttribute('content', tm_link_value ? tm_link_value : "NULL");
    }
    myDocumentHead.appendChild(newMetaTag);
}
           

<!-- TMLINKS end -->
