var uid;
var euid = checkCookie(cPrefix+"UID", 5);
var fuid = checkCookie(cPrefix+"FUID", 6);
var lmd = checkCookie(cPrefix+"LMD", 5);
var flmd = checkCookie(cPrefix+"FLMD", 6);
var curDate = new Date();

function checkCookie(cookieName, length) {
  var allcookies = document.cookie;
  var cookiePos = allcookies.indexOf(cookieName + "=");
  if(cookiePos != -1) {
    var start = cookiePos + length;
    var end = allcookies.indexOf(";", start);
    if(end == -1)
      end = allcookies.length;
    var value = allcookies.substring(start, end);
    value = unescape(value);
    return value;
  }
  return "";
}

function writeUserJs(){  
if (flmd == null || flmd == "") {
   flmd = curDate.getMilliseconds();
   //document.cookie = "qFLMD=" + curDate + "; path=/; domain=.foxsports.com;";
   document.cookie = cPrefix+"FLMD=" + curDate + "; path=/; domain=.foxsports.com;";
}

if (lmd != null && lmd != "") {
    uid = euid;
  } else{
    uid = checkCookie(cPrefix+"RME", 5);
    if (uid != null && uid != "") {
      euid = uid;
      curDate = curDate.getMilliseconds();
      document.cookie = cPrefix+"LMD=" + curDate + "; path=/; domain=.foxsports.com";
      document.cookie =  cPrefix+"UID=" + uid + "; path=/";
    }
  }
  //alert(euid + "\n\n" + lmd + "\n\n" + uid);
  if (fuid.length > 0) {
    var fantasyUserJsPath = '/fantasy/football/commissioner/fantasyUser.js?efuid=' + encodeURIComponent(fuid) + '&flmd=' + encodeURIComponent(flmd); // javascript:document.write(fantasyUserJsPath)
    document.write('<scr' + 'ipt language="JavaScript1.2" src="' + fantasyUserJsPath + '" type="text/javascript"></scr' + 'ipt>');
  } 
  else if (euid.length > 0) {
    var fantasyUserJsPath = '/fantasy/football/commissioner/fantasyUser.js?epuid=' + encodeURIComponent(euid) + '&flmd=' + encodeURIComponent(flmd); // javascript:document.write(fantasyUserJsPath)
    document.write('<scr' + 'ipt language="JavaScript1.2" src="' + fantasyUserJsPath + '" type="text/javascript"></scr' + 'ipt>');
  }
  else {
    //var fu = new Object();  
  }
}
writeUserJs();

function generateLoginUrl(path) {
  if (arguments.length == 0) {
    var path = location.pathname;
    var query = location.search;
    if (query == '') {
      query = "?";
    } else {
      query += "&";
    }
    var path = path + query;
  }
  //var siteId = "60665";
  var cfu = escape(secureDomain+"/pp/response?fan=true&cfu=" + path);
  var queryParams = "&seclog=10&wa=wsignin1.0&wreply=" + cfu + "&cb=" + escape("cbid=" + siteId + "&wa=wsignin1.0&wreply=") + cfu;
  //var loginUrl = "https://login.live-int.com/ppsecure/secure.srf?wp=MBI_SSL_SAML" + queryParams + "&cbid=" + siteId;
  var loginUrl = passportURL + queryParams + "&cbid=" + siteId;
  //alert(loginUrl);
  return loginUrl;
}

var hbxOutput = window.location.pathname;
//hbxOutput = hbxOutput.replace(/football/i, "nfl");
<!--WEBSIDESTORY CODE HBX1.0 (Universal)-->
<!--COPYRIGHT 1997-2004 WEBSIDESTORY,INC. ALL RIGHTS RESERVED. U.S.PATENT No. 6,393,479B1. MORE INFO:http://websidestory.com/privacy-->
  function _hbxStrip(a){
    a = a.replace(/\s+$/, '');
    a = a.split(",").join("");
    a = a.split("&").join("");
    a = a.split("'").join("");
    a = a.split("#").join("");
    a = a.split("$").join("");
    a = a.split("%").join("");
    a = a.split("^").join("");
    a = a.split("*").join("");
    a = a.split(":").join("");
    a = a.split("!").join("");
    a = a.split("<").join("");
    a = a.split(">").join("");
    a = a.split("~").join("");
    a = a.split(";").join("");
    a = a.split("\\").join("");
    a = a.split(" ").join("+");
    return a;
  }
  
  
function _hbxContentSessionRemove(a) {
    var start = a.indexOf('jsessionid=');
    if (start != -1) {
      var newStr = a.substring(0,start-1);
      //alert(a + "\n\n" + start + "\n\n" + newStr);
      return newStr;
    }
    return a;
}

  var _hbEC=0,_hbE=new Array;function _hbEvent(a,b){b=_hbE[_hbEC++]=new Object();b._N=a;b._C=0;return b;}
  var hbx=_hbEvent("pv");hbx.vpc="HBX0100u";hbx.gn="ehg-foxsports.hitbox.com";
  hbx.pndef="title";
  hbx.ctdef="full";
  hbx.fv="";
  hbx.lt="auto"; //
  hbx.dlf="n";
  hbx.dft="n";
  hbx.elf="n";
  hbx.seg="";
  hbx.fnl="";
  hbx.cmp="";
  hbx.cmpn="CMP"; //
  hbx.dcmp="";
  hbx.dcmpn="DCMP"; //
  hbx.dcmpe="";
  hbx.dcmpre="";
  hbx.hra="";
  hbx.hqsr="";
  hbx.hqsp="ATT"; //
  hbx.hlt="";
  hbx.hla="";
  hbx.gp="";
  hbx.gpn="GP"; //
  hbx.hcn="";
  hbx.hcv="";
  hbx.cp="null";
  hbx.cpd="";

  if (typeof(user) == 'undefined') {
    var user = new Object();
    user.USER_ID = '';
  }
  hbx.ci=user.USER_ID; //

  hbx.hc1="";
  hbx.hc2="";
  hbx.hc3="";
  hbx.hc4="";
  hbx.hrf="";
  hbx.pec="";

  hbx.acct= hitboxAccount;
  var _acct= hitboxAccount; //legacy for back compat
  var _acctMedia= hitboxAccount;  // legacy for back compat

  hbx.pn=_hbxStrip(pnString);
  hbx.mlc=_hbxStrip(_hbxContentSessionRemove(hbxOutput));
  var _pn=_hbxStrip(pnString);
  var _mlc=_hbxStrip(_hbxContentSessionRemove(hbxOutput));
  //alert(hbx.pn + "\n\n" + hbx.mlc