var pd_me;
var siteDomainList = {"MSNBC":"www.msnbc.msn.com", 
 "NBCSPORTS":"nbcsports.msnbc.com",
 "Today":"today.msnbc.msn.com",
 "CNBC":"www.cnbc.com"};
if(pd_me==null){pd_me=new Object();pd_me.site="NBCSPORTS";}

function tryCatch(sTry, sCatch)
{
this.trycatch =
  new Function("try{" + sTry + "}catch(e){" + sCatch + "}");
 this.trycatchV =
  new Function("s1", "try{" + sTry + "}catch(e){" + sCatch + "}");
}

function UberSniff(sUndefined)
{
 var ua = navigator.userAgent.toLowerCase();

 // Identify specific browser versions
 this.webtv = (ua.indexOf("webtv") > -1);
 this.ie = (parseFloat(ua.slice(ua.indexOf("msie") + 5)));
 this.nn = (this.ie) ? (-1) :
  (parseFloat(ua.slice(ua.indexOf("mozilla/") + 8)));
 this.mac = (ua.indexOf("mac") > -1);
 this.firefox = (ua.indexOf("firefox") > -1);
 this.safari = (ua.indexOf("safari") > -1);

 // Flash version
 // TODO: Why use navigator.MSNBCFlashVer?
 if (navigator.MSNBCFlashVer == sUndefined)
 {
  if (this.nn <= 0 && this.ie < 5)
  {
   // TODO: Why do we say 6 here?
   navigator.MSNBCFlashVer = 6;
  }
  else
  {
   if (!this.mac && this.ie > 4)
   {
    var oTestVersion = new tryCatch(
     "oWMPlayer=new  ActiveXObject('ShockwaveFlash.ShockwaveFlash.'+s1);return s1;",
     "return 0;");
    navigator.MSNBCFlashVer = -1;
    for (var nCheckVersion = 9; nCheckVersion > 2; --nCheckVersion)
    {
     if (oTestVersion.trycatchV(nCheckVersion))
     {
      navigator.MSNBCFlashVer = nCheckVersion;
      break;
     }
    }
   }
   else
   {
    if (navigator.plugins['Shockwave Flash'])
    {
     navigator.MSNBCFlashVer = (parseInt(navigator.plugins['Shockwave Flash'].description.substr(16)));
    }
    else
    {
     navigator.MSNBCFlashVer =- 1;
    }
   }
  }
 }
 this.flash=navigator.MSNBCFlashVer;

 // Media Player version
 // TODO: Is the MSNBCMPlayer boolean or a number?
 if (navigator.MSNBCMPlayer == sUndefined)
 {
  if ((this.nn <= 0 && this.ie < 5) || this.mac)
  {
   navigator.MSNBCMPlayer = true;
  }
  else
  {
   if (!this.mac && this.ie > 4)
   {
    var oTestVersion = new tryCatch(
     "oWMPlayer=new ActiveXObject('WMPlayer.OCX');return oWMPlayer.versionInfo;","return 0;");
    if (oTestVersion.trycatch())
    {
     // TODO: Remove duplicate call to trycatch?
     navigator.MSNBCMPlayer = oTestVersion.trycatch();
    }
    else
    {
     for (itest = 0; itest < 9; ++itest)
     {
      oTestVersion = new tryCatch(
       "oWMPlayer=new  ActiveXObject('MediaPlayer.MediaPlayer.'+itest);return 1;",
       "return 0;");
      navigator.MSNBCMPlayer =  (oTestVersion.trycatch());
      if (navigator.MSNBCMPlayer)
      {
       // TODO: Break rather than bump  iterator?
       itest=100;
      }
     }
    }
   }
   else
   {
    // TODO: Do we need !! below?
    navigator.MSNBCMPlayer = !!(navigator.mimeTypes &&
     navigator.mimeTypes["video/x-ms-wm"] &&
     navigator.mimeTypes["video/x-ms-wm"].enabledPlugin);
   }
  }
 }
 this.mplayer=navigator.MSNBCMPlayer;

 // Screen resolution
 this.screenHeight = screen.height;
 this.screenWidth = screen.width;
 this.colorDepth = (this.nn >= 4) ? screen.pixelDepth : screen.colorDepth;
}

function vPlayer(vDocId,sGuid,sFlavor){
 var bEmergency=false;
 var sHost="http://" + siteDomainList[pd_me.site];

 if (!siteDomainList[pd_me.site]){
  sHost="http://www.msnbc.msn.com"; 
  }
 var sDefaultFlavor="21134540";
 if  (sHost.toLowerCase().indexOf("nbcsports.msnbc.com")>-1||(location.host.toLowerCase().indexOf("nbcsports.msnbc.com")>-1)){
  sDefaultFlavor="22825103";
  sHost="http://nbcsports.msnbc.com";
 }
 if (!sFlavor){   
  sFlavor=sDefaultFlavor;
 }
 var vUrl=sHost+"/id/"+sFlavor+"/vp/"+vDocId+"#"+vDocId;
 if (!bEmergency){
  var oUser=new UberSniff();
  var sLoc=",location=1";
  if (oUser.ie>6){
   sLoc=",location=0";
  }
  var w =  window.open(vUrl,"MSNBCvplayer","width=1000,height=600,status=1,scrollbars=0,resizable=0,toolbar=0,menubar=0,titlebar=0,directories=0"+sLoc);
  if (w.focus){
   w.focus();
  }
 }
 else{
  msnvDwd('00',sGuid, 'us','', 'm5', 'msnbc', '', '', ''); 
 }
}