function getHitTrackingHtmlCode(){
  var ht_params,nhp,ntz,rf,sr,lc,dt,result;
  try{
    rf=document.referrer;
    sr=document.location.search;
    lc=window.changedURL?window.changedURL:document.location;
    if(window.dontTrack || (unescape(lc+"")).indexOf("htrack=off")>=0){
      return "";
    }

    try{
      if(top.document.location==document.referrer || (document.referrer==''&&top.document.location!='')){
         rf=top.document.referrer;
         sr=top.document.location.search;
      }
    } catch(e1){}

    if(rf==""){
      var aCookie = document.cookie.split("; ");
      for (var i=0; i < aCookie.length; i++){
        var aCrumb = aCookie[i].split("=");
        if (aCrumb[0] == "redirectReferrer"){
          rf=typeof(aCrumb[1])!='undefined'?aCrumb[1]:"";
        }
      }
    }
    document.cookie = "redirectReferrer=; ; expires=Fri, 31 Dec 2010 23:59:59 GMT";

    try{
      if ((top.document.location+"").indexOf("hrefer=off")!=-1){
        rf="";
      }
    } catch(e1){}
    if ((document.location+"").indexOf("hrefer=off")!=-1){
      rf="";
    }

    dt=document.title;
    try{
      dt=((document.title==''&&top.document.title!='')?top.document.title:document.title);
    } catch(e1){}
    dt=window.chengedTitle?window.chengedTitle:dt;
    ntz=new Date();
    ht_params=
      'an=' +escape(navigator.appName)+
      '&sl='+escape(navigator.systemLanguage)+
      '&av='+escape(navigator.appVersion)+
      '&l=' +escape(navigator.language)+
      '&pg='+escape(dt)+
      '&pf='+escape(navigator.platform)+
      '&lc='+escape(lc);
    if(navigator.appVersion.substring(0,1)>'3'){
       ht_params=ht_params+
        '&cd='+screen.colorDepth+
        '&rs='+escape(screen.width+
        ' x ' +screen.height)+
        '&tz='+ntz.getTimezoneOffset()+
        '&je='+navigator.javaEnabled();
    }
    if(typeof(__HitRealtorId)!='undefined'){
      ht_params=ht_params+'&rid='+__HitRealtorId;
    }
    if(typeof(__HitAddMB)!='undefined'){
      ht_params=ht_params+'&mb=1';
    }
    if(typeof(__HitNotCountRealtor)!='undefined'){
      ht_params=ht_params+'&ncr=1';
    }
    if(typeof(__HitInListings)!='undefined'){ // for FeaturedListings and OfficeListings at realtor's site
      ht_params=ht_params+'&hil=1';
    }
    ht_params=ht_params+
      '&sr=' +escape(sr)+
      '&rf=' +escape(rf)+
      '&rnd='+Math.random(4)*100000000000000000+
      ""+Math.random(4)*100000000000000000;
  } catch(e){}
  if(window.custom_url){
    result = '<img border=0 hspace=0 vspace=0 width=1 height=1 src="'+window.custom_url+'/HitTracker?'+ht_params+'">';
  } else {
    result = '<img border=0 hspace=0 vspace=0 width=1 height=1 src="/HitTracker?'+ht_params+'">';
  }
  return result;
}
function pasteHitTracking(){
  var hitTrackingCode = getHitTrackingHtmlCode();
  if (hitTrackingCode != "") {
    document.write(hitTrackingCode + "<br>");
  }
}
if(typeof(__HitSkip)!='undefined' && __HitSkip){
  //skip hit
}else{
  pasteHitTracking();
}

