//  CODES FOR AFFILATES W/O HTTP_REFERER    EBR 2/1/06
var bbAffiliates = new Array(25);

bbAffiliates[ '4bf1001a' ] = 'EdsNewSystem-eteamz/epointz/basketball';
bbAffiliates[ '4bf1001b' ] = 'EdsNewSystem-eteamz/newsletter-in-email';
bbAffiliates[ '4bf1002j' ] = 'EdsNewSystem-kanoodle-All';
bbAffiliates[ '4bf1002x1' ] = 'EdsNewSystem-kanoodle-BasketballTopics';
bbAffiliates[ '4bf1002x2' ] = 'EdsNewSystem-kanoodle-NotBasketballTopics';
bbAffiliates[ '4bf1002x3' ] = 'EdsNewSystem-kanoodle-Sports';
bbAffiliates[ '4bf1003a' ] = 'EdsNewSystem-GoogleAdwords-Content';
bbAffiliates[ '4bf1004a' ] = 'EdsNewSystem-Sites-BasketballDrillsandPlays-Email';
bbAffiliates[ '4bf1005a' ] = 'EdsNewSystem-Sites-BBallin';
bbAffiliates[ '4bf1006' ] = 'EdsNewSystem-Sites-NBA-Com';
bbAffiliates[ '4bf1010' ] = 'EdsNewSystem-Sites-HoopsVibe';
bbAffiliates[ '4bf1012' ] = 'EdsNewSystem-Sites-SlamOnline';
bbAffiliates[ '4bf1013' ] = 'EdsNewSystem-Sites-JesSoftNetwork';
bbAffiliates[ '4bf1014' ] = 'EdsNewSystem-Sites-PowerBasketball';
bbAffiliates[ '4bf1015' ] = 'EdsNewSystem-Sites-HoopsDojo';
bbAffiliates[ '4bf1016' ] = 'EdsNewSystem-Sites-KnowledgeHound';
bbAffiliates[ '4bf1016b' ] = 'EdsNewSystem-Sites-KnowledgeHound-TextBanners';
bbAffiliates[ '4bf1017' ] = 'EdsNewSystem-Sites-HoopsHypeCom';
bbAffiliates[ '4bf1018' ] = 'EdsNewSystem-Sites-NBADraft-Dot-Net';
bbAffiliates[ '4bf1019' ] = 'EdsNewSystem-Sites-NYLiberty';
bbAffiliates[ '4bf1020' ] = 'EdsNewSystem-Sites-IndianaFever';
bbAffiliates[ '4bf1021' ] = 'EdsNewSystem-Sites-Canada-Basketball';
bbAffiliates[ '4bf1022' ] = 'EdsNewSystem-Sites-StackDotCom';
bbAffiliates[ '4bf1023' ] = 'EdsNewSystem-Sites-DCMetroSports';
bbAffiliates[ '4bf1024' ] = 'EdsNewSystem-Sites-CoachesClipboardNet';
bbAffiliates[ '4bf1025' ] = 'EdsNewSystem-Sites-BrunoChusTwoSites';

// DO NOT CHANGE ANYTHING BELOW THIS LINE   EBR  2/1/06

function SetCookieEZ2(name, value) {
  document.cookie = name + "=" + escape(value)+"; path=/"; 
} 

function setExpirationDate(month){
  var oTimeNow = new Date();
  oTimeNow.setMonth(oTimeNow.getMonth() + month);
  return sExpirationDate = oTimeNow.toUTCString();
}

function setCookie(name, value, months_to_expire, path, domain, secure) {
  var expires = setExpirationDate(months_to_expire);
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

// alert("->"+document.referrer+"<-");
var tester = getCookie('http_referer');
var srch = location.search.toString();
if(  (tester == null || tester == undefined) && (document.referrer.length != 0) ){ 
  setCookie('http_referer', document.referrer, 12, '/'); 
} else if(srch != undefined && srch != null && srch.length != 0){
  var myCode = srch.substring(1, srch.length);
  var myHost = location.host;
  var myPathname = location.pathname;
  setCookie('http_referer', bbAffiliates[myCode], 12, '/');
  window.location.href = 'http://'+myHost+myPathname;
}

var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") ||
pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=yes,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}

// CODE ADDED BY SEAN TO TRACK USING TRACKPOINT

var ref   = escape(document.referrer);
var land  = escape( location.href );

document.write( '<' + 'script language="javascript" src="https://www.betterbasketball.com/trackpoint/t.php?u=3&r=' + ref + '&l=' + land + '"><' + '/script>' );