	// configurable vars
	// -- these are arranged so that the customizeable parts are nearest the top
	// -- any line labaled "do not change" should not be changed, because they are 
	//    cascaded from other variables above that particular line
	// -- anything labeled "do not change?" with a question mark *probably* shouldn't be changed
	// -- everything else should be customized
	
	// IE <object> tag attributes
	var 
	      // IE WMP v7+
		  IEWMPObjId		= "MediaPlayer" // id name
		, IEWMPObjWidth		= 320
		, IEWMPObjHeight	= 240
		, IEWMPObjClID		= "6BF52A52-394A-11D3-B153-00C04F79FAA6" // do not change?

		  // IE WMP v6.4
		, IEWMP64Id			= IEWMPObjId // do not change
		, IEWMP64Width		= IEWMPObjWidth // do not change
		, IEWMP64Height		= IEWMPObjHeight // do not change
		, IEWMP64ClID		= "22D6f312-B0F6-11D0-94AB-0080C74C7E95" // do not change?
		;

	// IE <object> params
	var
		  // IE WMP v7+

		  IEWMPObjURL		= "video/" + tmpVideoName

		, IEWMPObjUiMode	= "full" // see TO DO below
		, IEWMPObjAutoStart	= "False"

		  // IE WMP v6.4 - TO DO: look up the v9+ uimode equivalents for the params below		
		, IEWMP64FileName				= IEWMPObjURL // do not change
		, IEWMP64ShowStatusBar			= "False"
		, IEWMP64AutoStart				= IEWMPObjAutoStart // do not change
		, IEWMP64ShowControls			= "True"
		, IEWMP64ShowTracker			= "False"
		, IEWMP64EnableTracker			= "True"
		, IEWMP64ShowPositionControls	= "True"
		, IEWMP64EnablePositionControls	= "True"
		;

	// NS applet -- <applet> params
	var
		  NSAppletName		= IEWMPObjId // do not change
		, NSAppletWidth		= IEWMPObjWidth // do not change
		, NSAppletHeight	= IEWMPObjHeight // do not change
		, NSAppletAutoStart	= IEWMPObjAutoStart // do not change
		, NSAppletEnabled	= "true" // do not change
		, NSAppletBalance	= "50" // do not change?
		, NSAppletVolume	= "50" // do not change?
		, NSAppletUiMode	= IEWMPObjUiMode // do not change
		, NSAppletURL		= IEWMPObjURL // do not change
		;
	
	// NS plugin -- <embed>
	var
		  NSPluginSrc						= IEWMPObjURL // do not change
		, NSPluginName						= IEWMPObjId // do not change
		, NSPluginAutoStart					= IEWMPObjAutoStart.toLowerCase()=="true" ? 1 : 0 // do not change
		, NSPluginShowStatusBar				= IEWMP64ShowStatusBar.toLowerCase()=="true" ? 1 : 0 // do not change
		, NSPluginShowControls				= IEWMP64ShowControls.toLowerCase()=="true" ? 1 : 0 // do not change
		, NSPluginShowTracker				= IEWMP64ShowTracker.toLowerCase()=="true" ? 1 : 0 // do not change
		, NSPluginEnableTracker				= IEWMP64EnableTracker.toLowerCase()=="true" ? 1 : 0 // do not change
		, NSPluginShowPositionControls		= IEWMP64ShowPositionControls.toLowerCase()=="true" ? 1 : 0 // do not change
		, NSPluginEnablePositionControls	= IEWMP64EnablePositionControls.toLowerCase()=="true" ? 1 : 0 // do not change
		, NSPluginWidth						= IEWMPObjWidth // do not change
		, NSPluginHeight					= IEWMPObjHeight + 50 // do not change
		;



//------------------------
//-- Global Vars 
//------------------------
var WMPVer = "unknown";       // Set to WMP version string detected
var fHasWMP = false;          // True if either WMP v6.4 or v7+ found
var fHasWMP64 = false;        // True if WMP v6.4 found
var fHasWMP7 = false;         // True if WMP v7+ (8, 9) found
var fAppletRunning = false;   // True if v9 Applet is in use
var fPluginRunning = false;   // True if v6.4 Netscape plugin is in use


//-----------------------------------------------
// v7+ onPlayStateChange state options array
//-----------------------------------------------
var psArray = new Array(12);
psArray[0] = "Undefined - Windows Media Player is in an undefined state.";
psArray[1] = "Stopped - Playback of the current media clip is stopped."; 
psArray[2] = "Paused - Playback of the current media clip is paused. When media is paused, resuming playback begins from the same location.";
psArray[3] = "Playing - The current media clip is playing."; 
psArray[4] = "ScanForward - The current media clip is fast forwarding.";
psArray[5] = "ScanReverse - The current media clip is fast rewinding."; 
psArray[6] = "Buffering - The current media clip is getting additional data from the server.";
psArray[7] = "Waiting - Connection is established, however the server is not sending bits. Waiting for session to begin.";
psArray[8] = "MediaEnded - Media has completed playback and is at its end.";  
psArray[9] = "Transitioning - Preparing new media."; 
psArray[10] = "Ready - Ready to begin playing."; 
psArray[11] = "Reconnecting - Reconnecting to stream.";


//-----------------------------------------------
// v6.4 onPlayStateChange state options array
//-----------------------------------------------
var ps64Array = new Array(9);
ps64Array[0] = "mpStopped - Playback is stopped.";
ps64Array[1] = "mpPaused - Playback is paused."; 
ps64Array[2] = "mpPlaying - Stream is playing."; 
ps64Array[3] = "mpWaiting - Waiting for stream to begin."; 
ps64Array[4] = "mpScanForward - Stream is scanning forward."; 
ps64Array[5] = "mpScanReverse - Stream is scanning in reverse."; 
ps64Array[6] = "mpSkipForward - Skipping to next."; 
ps64Array[7] = "mpSkipReverse - Skipping to previous."; 
ps64Array[8] = "mpClosed - Stream is not open."; 


//-----------------------------------------------
// Name:  GetBrowser
// Purpose: Get Browser Information
//-----------------------------------------------
function GetBrowser()
{
   var agt=navigator.userAgent.toLowerCase();
   if( ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1)) )
       return "IE";
   else if( ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
         && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
         && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)) )
       return "Netscape";
   else
       return "unknown";
}


//------------------------------------------------
// Name:  GetPlayerMajorVer
// Purpose: Get Media Player Major Version Number
//------------------------------------------------
function GetPlayerMajorVer()
{
	var strVer = new String(WMPVer);
	s = strVer.split(".");
    return s[0];
}


//-------------------------------------------------
// Name:  GetPlayerMinorVer
// Purpose: Get Media Player Major Version Number.
//-------------------------------------------------
function GetPlayerMinorVer()
{
	var strVer = new String(WMPVer);
	s = strVer.split(".");
	if (s[1])
		return s[1];
	else
		return("unknown");
}


//-----------------------------------------------------------------
// Name: IsNSPluginInstalled
// Purpose: Checks mime types to determine if the WMP 6.4 Netscape 
//          Plugin is installed.
//-----------------------------------------------------------------
function IsNSPluginInstalled()
{
    // See if 6.4 pluggin installed
    if (navigator.mimeTypes && navigator.mimeTypes["application/x-mplayer2"] && navigator.mimeTypes["application/x-mplayer2"].enabledPlugin)
		return(true);
	else
		return(false);
}


//----------------------------------------------------------------------
// Name:  set_uiMode
// Purpose:  Wrapper function for setting the uiMode of the Media Player 
//  control.  Supports uiMode of "none", "mini" and "full".
//-----------------------------------------------------------------------
function set_uiMode(uiMode)
{
 // Note: Per WMP SDK, uiMode is a string:  "none", "mini", "full"
 // If Netscape pluggin is running set properties via SetXXX routines.
 if (fPluginRunning)
 {
 	if (uiMode=="none") {
	   document.MediaPlayer.SetShowControls(false);
	   document.MediaPlayer.SetShowTracker(false);
	   document.MediaPlayer.SetEnableTracker(false);
	   document.MediaPlayer.SetShowPositionControls(false);
	   document.MediaPlayer.SetEnablePositionControls(false);
	   document.MediaPlayer.SetShowStatusBar(false);
	} 
    if (uiMode=="mini") {
	   document.MediaPlayer.SetShowControls(true);
	   document.MediaPlayer.SetShowTracker(false);
	   document.MediaPlayer.SetEnableTracker(false);
	   document.MediaPlayer.SetShowPositionControls(false);
	   document.MediaPlayer.SetEnablePositionControls(false);
	   document.MediaPlayer.SetShowStatusBar(true);
	}  
	if (uiMode=="full") {
	   document.MediaPlayer.SetShowControls(true);
	   document.MediaPlayer.SetShowTracker(true);
	   document.MediaPlayer.SetEnableTracker(true);
	   document.MediaPlayer.SetShowPositionControls(true);
	   document.MediaPlayer.SetEnablePositionControls(true);
	   document.MediaPlayer.SetShowStatusBar(true);
	}
 }
 else
 // If WMP 6.4 then set ui mode related properties
 if (fHasWMP64) { 
	if (uiMode=="none") {
	   MediaPlayer.ShowControls=false;
	   MediaPlayer.ShowTracker=false;
	   MediaPlayer.EnableTracker=false;
	   MediaPlayer.ShowPositionControls=false;
	   MediaPlayer.EnablePositionControls=false;
	   MediaPlayer.ShowStatusBar=false;
	} 
    if (uiMode=="mini") {
	   MediaPlayer.ShowControls=true;
	   MediaPlayer.ShowTracker=false;
	   MediaPlayer.EnableTracker=false;
	   MediaPlayer.ShowPositionControls=false;
	   MediaPlayer.EnablePositionControls=false;
	   MediaPlayer.ShowStatusBar=true;
	}  
	if (uiMode=="full") {
	   MediaPlayer.ShowControls=true;
	   MediaPlayer.ShowTracker=true;
	   MediaPlayer.EnableTracker=true;
	   MediaPlayer.ShowPositionControls=true;
	   MediaPlayer.EnablePositionControls=true;
	   MediaPlayer.ShowStatusBar=true;
	}
 }
 else
 {
	// If using v7+ interface set through applet's setXXX routine or
	// by setting property directly
	if (fAppletRunning)
		document.MediaPlayer.setUiMode(uiMode);
	else
		MediaPlayer.uiMode=uiMode;
 }
}


//---------------------------------------------------------------------------
// Name: get_uiMode
// Purpose: Wrapper function for getting current uiMode of the Media Player.

//---------------------------------------------------------------------------
function get_uiMode()
{
 // Note: Per WMP SDK, uiMode is a string:  "none", "mini", "full"
 // If using the Netscape plugin access properties through GetXXX routines.
 if (fPluginRunning) { 
	if (document.MediaPlayer.GetShowControls()==false &&
	    document.MediaPlayer.GetShowTracker()==false &&
	    document.MediaPlayer.GetEnableTracker()==false && 
	    document.MediaPlayer.GetShowPositionControls()==false && 
	    document.MediaPlayer.GetEnablePositionControls()==false )
    return("none");

    if (document.MediaPlayer.GetShowControls()==true &&
	    document.MediaPlayer.GetShowTracker()==false && 
	    document.MediaPlayer.GetEnableTracker()==false &&
	    document.MediaPlayer.GetShowPositionControls()==false &&
	    document.MediaPlayer.GetEnablePositionControls()==false)
	return("mini");   

	if (document.MediaPlayer.GetShowControls()==true &&
	    document.MediaPlayer.GetShowTracker()==true &&
	    document.MediaPlayer.GetEnableTracker()==true &&
	    document.MediaPlayer.GetShowPositionControls()==true &&
	    document.MediaPlayer.GetEnablePositionControls()==true)
	return("full");   

    return("unknown");
 }
 else
 // If accessing the old 6.4 properties
 if (fHasWMP64) {
 	   	    
	if (MediaPlayer.ShowControls==false &&
	    MediaPlayer.ShowTracker==false &&
	    MediaPlayer.EnableTracker==false && 
	    MediaPlayer.ShowPositionControls==false && 
	    MediaPlayer.EnablePositionControls==false )
    return("none");

    if (MediaPlayer.ShowControls==true &&
	    MediaPlayer.ShowTracker==false && 
	    MediaPlayer.EnableTracker==false &&
	    MediaPlayer.ShowPositionControls==false &&
	    MediaPlayer.EnablePositionControls==false)
	return("mini");   

	if (MediaPlayer.ShowControls==true &&
	    MediaPlayer.ShowTracker==true &&
	    MediaPlayer.EnableTracker==true &&
	    MediaPlayer.ShowPositionControls==true &&
	    MediaPlayer.EnablePositionControls==true)
	return("full");   

    return("unknown");
 }
 else
 { 
    // Accessing later v7+ interface either through applet's getXXX 
    // routines or directly
    if (fAppletRunning)
		return(document.MediaPlayer.getUiMode()); 
	else	
		return(MediaPlayer.uiMode);
 }
}


//------------------------------------------------------------------
// Name: ToggleMode
// Purpose:  Using get_uiMode and set_uiMode this  function cycles 
//           through the UI modes of the player control when called.
//-------------------------------------------------------------------
function ToggleMode()
{
   var Mode = get_uiMode();
   if (Mode=="none") set_uiMode("mini");
   if (Mode=="mini") set_uiMode("full");
   if (Mode=="full") set_uiMode("none");   
}


//----------------------------------------------------------------------
// Name: GetPlayerState
// Purpose:  Returns a string describing the NewState number specified.
//----------------------------------------------------------------------
function GetPlayerState(NewState)
{
 if (fPluginRunning || fHasWMP64)
 {
	if (NewState>=0 && NewState<=8)
	  return ps64Array[NewState];
	else
	  return "mpUndefined - Windows Media Player is in an undefined state.";
 }	  
 else
  {
	if (NewState>=0 && NewState<=11)
	  return psArray[NewState];
	else
	  return "Undefined - Windows Media Player is in an undefined state.";
  }	  
}

//---------------------------------------------------------------------
// Name:  AddDownloadLink
// Purpose:  Add WMP v9 download link if an older version of WMP 
//           detected.
//---------------------------------------------------------------------
function AddDownloadLink(MajorVer)
{
 if (!(MajorVer) || MajorVer=="unknown" || MajorVer<9)
  { 
   document.write('<center>(You do not have the latest Windows Media Player version.)<BR><A HREF="http://windowsmedia.com/download"><IMG SRC="http://www.microsoft.com/windows/windowsmedia/images/Download_88x31_static.gif" WIDTH="88" HEIGHT="31" BORDER="0" ALT="Get Windows Media Player" VSPACE="7"></A></center>');
  } 
}

//---------------------------------------------------------------------
// Name:  CheckForApplet
// Purpose:  If the broswer is identified as Netscape requiring an applet,
//           check if we can play (true)
//           or if we need to send to download page (false)
//---------------------------------------------------------------------
function CheckForApplet()
{
    navigator.plugins.refresh();  // Refresh pluggins/applets
    
	// If java runtime not enabled, give error message box
    if (!navigator.javaEnabled()) {
        return false;
	}

    // If applet not loaded redirect to download page
	if ( !( document // document available
	        && document['MediaPlayer'] // applet available in js
	        && document['MediaPlayer'].isActive  // applet active
	       )
	   ) {
	    return false;
	}
	return true;
}


