// DEPRECATED CODE SECTION FOLLOWS
//
//
// The following code performs various browser and plugin tests based on the old detection
// model.  As time allows, pages referencing these utility functions should
// be updated to use the new detection features in webcastglobal.js
//
// pluginTest and p_pluginTest are holdovers from the old (shared versus sharedv2) 
// test files (test_mp and test_real) and are also called from the main event index.phtml (landing page)
//
// 



// Real Player detect
function WM_netscapeCssFix() { 
  if (document.WM.WM_netscapeCssFix.initWindowWidth != window.innerWidth  
      || document.WM.WM_netscapeCssFix.initWindowHeight != window.innerHeight)
  { 
    document.location = document.location;
  }
 }

function WM_netscapeCssFixCheckIn() { 
  if ((navigator.appName == 'Netscape') && (parseInt(navigator.appVersion) == 4)) {
    if (typeof document.WM == 'undefined'){
       document.WM = new Object;
    }
    if (typeof document.WM.WM_scaleFont == 'undefined') 
    {
       document.WM.WM_netscapeCssFix = new Object;
       document.WM.WM_netscapeCssFix.initWindowWidth = window.innerWidth; 
       document.WM.WM_netscapeCssFix.initWindowHeight = window.innerHeight;
    }
    window.onresize = WM_netscapeCssFix;
  }
}

function whichBrowser() 
{ 
  var br="BR";
  if (ua.indexOf("MSIE") != -1) 
  {
    br="IE";
  } 
  if ( (ua.indexOf('Mozilla') != -1) && (ua.indexOf('Spoofer') == -1) && (ua.indexOf('compatible') == -1) )
  {
    br="NS";
  } 
  return br;
}

function findPlugin(plugin, ext)
{
  if (navigator.plugins)
  { 
    pluginName = plugin; 
    if (navigator.plugins.length > 0)
    { 
      for (i=0; i<navigator.plugins.length; i++)
      { 
	if (navigator.plugins[i].name.indexOf(plugin) != -1)
	{ 
	  pluginName = navigator.plugins[i].name; 
	  return 1; 
	} 
      } 
    }
  }
  if (navigator.mimeTypes)
  { 
    if (navigator.mimeTypes.length > 0)
    { 
      for (i=0; i<navigator.mimeTypes.length; i++)
      { 
	if (navigator.mimeTypes[i].suffixes.indexOf(ext) != -1)
	{ 
	  return 1; 
	} 
      } 
    } 
  } 
  return 0; 
}

function pluginTest (x)
{
// pluginTest will open the test_[player] code within the same browser
// window that called this function.  Do not use this code with popups
// or similarly "minimized" windows: see p_pluginTest below

  if (x == 'mp') 
  { 
    if ( mpDetected )
    { 

	window.location.href = '/investor/sharedv2/deprecate/test_mp.phtml?' + parent.eventDir;

    } 
    else { 
      openPopup('/investor/sharedv2/deprecate/p_nodetect_mp.html', 'TESTWIN', 'width=300, height=370')
    } 
  }
  else if (x == 'real') 
  { 
    if ( realDetected )
    {

	window.location.href = '/investor/sharedv2/deprecate/test_real.phtml?' + parent.eventDir;

    } 
    else { 
      openPopup('/investor/sharedv2/deprecate/p_nodetect_real.html', 'TESTWIN', 'width=300, height=370'); 
    } 
  }
}       

function p_pluginTest (x)
{
// p_pluginTest is a kludgy way of dealing with a popup-only condition:
// plugins should call this code so that the test_[player] page opens in the
// window that spawned the popup as opposed to within the popup itself
// Obviously, a better approach would be to add conditions to pluginTest to
// identify this condition
  if (x == 'mp') 
  { 
    if ( mpDetected )
    { 
      if (window.opener)
      {
	window.opener.location.href = '/investor/sharedv2/deprecate/test_mp.phtml?' + window.opener.parent.eventDir;
      } 
      else { 
	window.location.href = '/investor/sharedv2/deprecate/test_mp.phtml?' + parent.eventDir;
      }
    } 
    else {      
	  if (window.opener)	
	  {
		  window.location.href = '/investor/sharedv2/deprecate/p_nodetect_mp.html'
		  }
		else {
			openPopup('/investor/sharedv2/deprecate/p_nodetect_mp.html', 'TESTWIN', 'width=300, height=370')
		}
    } 
  }
  else if (x == 'real') 
  { 
    if ( realDetected )
    {
      if (window.opener)
      { 
	window.opener.location.href = '/investor/sharedv2/deprecate/test_real.phtml?' + window.opener.parent.eventDir;
      } 
      else { 
	window.location.href = '/investor/sharedv2/deprecate/test_real.phtml?' + parent.eventDir;
      }
    } 
    else { 
	  if (window.opener) {
	  	window.location.href = '/investor/sharedv2/deprecate/p_nodetect_real.html'
		}
	  else {
	  	openPopup('/investor/sharedv2/deprecate/p_nodetect_real.html', 'TESTWIN', 'width=300, height=370');
	  }		
    } 
  }
}       

WM_netscapeCssFixCheckIn()

var ua="UA";
ua=navigator.userAgent;
var b=whichBrowser(); 

// ** plugin and mimeType detects **

var pluginName;
var realDetected  = false;
var mpDetected    = 0;

//((navigator.userAgent.indexOf("Windows") > 0) || (navigator.userAgent.indexOf("Win95") > 0) || (navigator.userAgent.indexOf("Win98") > 0) || (navigator.userAgent.indexOf("WinNT") > 0));

var RealMode      = 0;
var RealPlayer5   = 0;
var RealPlayer4   = 0;
var RealPlayerG2  = 0;
var RAReady     = 0; 
var MediaPlayer   = 0;
var mp_object     = 0;
var mp_play       = 0;


if (navigator.mimeTypes) 
{ 
  RAReady = (navigator.mimeTypes["audio/x-pn-realaudio"] !=null); 
}


if (navigator.userAgent.indexOf("MSIE")<0 ) 
{ 
  if (findPlugin('RealPlayer','ram') || findPlugin('REALPLAY','RAM') )
  { 
    RealMode=1; 
    realDetected = true;
  }
}
if (navigator.userAgent.indexOf("MSIE")<0 ) 
{ 
  if (findPlugin('Windows Media Player')) 
  {
    MediaPlayer=1; 
    mpDetected = true;
  }
}

document.writeln('<OBJECT ID="NSPlay" WIDTH=1 HEIGHT=1 classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" CODEBASE="#Version=6,4,5,809">');
document.writeln('</object>');

document.writeln('<SCRIPT LANGUAGE=VBScript>');
document.writeln('on error resume next ');
document.writeln('RealPlayerG2 = (NOT IsNull(CreateObject("rmocx.RealPlayer G2 Control")))');

//document.write('RealPlayer5 = (NOT IsNull(CreateObject("RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)")))\n');
//document.write('RealPlayer4 = (NOT IsNull(CreateObject("RealVideo.RealVideo(tm) ActiveX Control (32-bit)")))\n');

document.writeln('On error resume next ');
document.writeln('mp_object = (IsObject(CreateObject("MediaPlayer.MediaPlayer.1") ) ) ');
document.writeln('mp_play = (NSPlay.FileName="") ');
document.writeln('</SCRIPT' + '> \n');

if ( RealPlayerG2 || RealMode || RAReady ) 
{ 
  realDetected = true; 
} 
if ( mp_play ) 
{ 
  mpDetected = true; 
}
// =================================================================================

