 var _host = document.location.hostname;
 var _path = document.location.pathname;
 var _search = document.location.search; // Get Query-Strings
 var _referrer = document.referrer;
 var tag_image = window.location.protocol + "//img.mag2.com/h/common/1x1.gif";
 var i, rhost, rpath, url;

 rhost = "";
 rpath = "";

if (window.location.protocol != "file:"){

 i = _referrer.indexOf("://");
 if (i > 0) {
  _referrer = _referrer.substring(i + 3, _referrer.length);
  i = _referrer.indexOf("/");
  if (i > 0) {
   rhost = _referrer.substring(0, i);
   rpath = _referrer.substring(i, _referrer.length);
  }
 }
 
 if (rhost==_host){
  rhost = "";
  rpath = "";
 }
 
 url = tag_image + "?host=" + _host + "&path=" + _path + "&rhost=" + rhost + "&rpath=" + escape(rpath) + "&rnd=" + Math.random();
 
 if (_search) url += "&" + _search.substring(1,_search.length) + "&brk&";
 
 document.writeln("<img src=\"" + url + "\" class=\"rt-metrics\" \/>");

}
