/******** START detectWMP to open embedded WM player (openViewer) FUNCTIONS *************************
DESCRIPTION: Pops up DHTML window after browseer and ActiveX WM detection:
				Detect ActiveX Architecture on Both IE and on Gecko
                Defer to plugin architecture for other browsers

TECH NOTES:
-----------------------------------------------------------------------------
-uses code from DHTMLWindowLib.js
-uses code from DHTML Window above
-creates a DHTML Window
-----------------------------------------------------------------------------
PARAMETERS:

RETURNS:
   
*************************************************/
//global variables
function detectWMP()
{
var wmpInfo = {
		installed: false,
		scriptable: false,
		type: null,
		versionInfo: null
	};
	var wmp64 = "MediaPlayer.MediaPlayer.1";
	var wmp7 = "WMPlayer.OCX.7";
	
	if((window.ActiveXObject && navigator.userAgent.indexOf('Windows') != -1) || window.GeckoActiveXObject)
	{
		wmpInfo.type = "ActiveX";
		var player = createActiveXObject(wmp7);
		if(player)
		{
			wmpInfo.installed = true;
			wmpInfo.scriptable = true;
			wmpInfo.versionInfo = player.versionInfo;
			return wmpInfo;
		}
		else
		{
			player = createActiveXObject(wmp64);
			if(player)
			{
				wmpInfo.installed = true;
				wmpInfo.scriptable = true;
				wmpInfo.versionInfo = "6.4";
				return wmpInfo;
			}
			else
			{
				wmpInfo.versionInfo = "none";
				return wmpInfo;
			}
		}
	}
	else if(navigator.mimeTypes)
	{
		wmpInfo.type = "NetscapePlugin";
		var player = navigator.mimeTypes['application/x-mplayer2'].enabledPlugin;
		if(player)
		{	
			
			wmpInfo.installed = true;
			wmpInfo.scriptable = false;
			wmpInfo.versionInfo = "PluginVersion";
			return wmpInfo;
		}
		return wmpInfo;
	}
	
	
}

function createActiveXObject(id)
{
  var error;
  var control = null;

  try
  {
    if (window.ActiveXObject)
    {
      control = new ActiveXObject(id);
    }
    else if (window.GeckoActiveXObject)
    {
      control = new GeckoActiveXObject(id);
    }
  }
  catch (error)
  {
    ;
  }
  return control;
}
	

var detectionResults = detectWMP();

 // Windows Media Player 7 Code
 if ( detectionResults.type == "ActiveX" && detectionResults.installed==true )
 {

	var paramsHPWelcomeMessage =  	
	{	
	   BorderColor : '#824E40', 
	   BorderWidth : 0, 
	   CloseBoxHeight : 0, 
	   CloseBoxSrc : '/gfx/closebox_small.gif', 
	   CloseBoxWidth : 11, 
	   ContentFontSize : 11, 
	   ContentFontFamily : '\"Trebuchet MS\", Arial, Helvetica, sans-serif', 
	   ContentFontColor : '#824E40', 
	   ContentColor : '#F9EC99', 
	   ContentBottomBorderColor : '#824E40', 
	   ContentHTML : '<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"><html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"><title>Welcome</title></head><body><table><tr><td><OBJECT ID=MediaPlayer CLASSID=CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6 standby=\"Loading Microsoft Windows Media Player components...\" TYPE=\"application/x-oleobject\" width=\"200\" height=\"180\"><PARAM NAME=\"url\" VALUE=\"http://www.franciscan.org/ASXFiles/HPWelcomeMessage.asx\"><PARAM NAME=\"AutoStart\" VALUE=\"false\"><PARAM NAME=\"ShowControls\" VALUE=\"1\"><PARAM NAME=\"ShowStatusBar\" VALUE=\"0\"><PARAM NAME=\"uiMode\" VALUE=\"mini\"></OBJECT></td></tr></table></body></html>', 
	   ContentLeftBorderColor : '#824E40', 
	   ContentPadding : 0, 
	   ContentRightBorderColor : '#824E40', 
	   ContentTopBorderColor : '#824E40', 
	   InnerBorderColor : '#824E40', 
	   OuterBorderWidth : 0, 
	   Resizable : 'None', 
	   ResizeBoxHeight : 0, 
	   Shadow : true, 
       StatusBarHeight : 0, 
	   StatusBarAlign : 'left', 
	   StatusColor : '#ACA633', 
	   StatusFontSize : 5, 
	   StatusFontFamily : '\"Trebuchet MS\", Arial, Helvetica, sans-serif', 
       Height : 205, 
	   Width : 208, 
       Top : 220, 
       Left : 100, 
	   TitleLeftMargin : 7, 
	   TitleBarHeight : 16, 
       TitleBarHTML : '<table height=17 width=202 border=0 cellpadding=0 cellspacing=0><tr><td valign=middle align=right><a href=\"JavaScript:closeViewer()\"><img src=\"/gfx/closebox_small.gif\" width=\"11\" height=\"11\" border=\"0\"></a></td></tr></table>',	  
	   TitleBarText : 'Welcome', 
	   TitleBarAlign : 'left', 
	   TitleColor : '#A87933', 
	   TitleFontSize : 12, 
	   TitleFontFamily : '\"Trebuchet MS\", Arial, Helvetica, sans-serif', 
	   Id  : 'HPWelcomeMessage'
	}; 
	var HPWelcomeMessage = new FerantDHTMLWindow(paramsHPWelcomeMessage);

        //HPWelcomeMessage.OpenWindow();
}

  //Most Web movies have 4:3 proportions, meaning 4 units of width to every 3 units of height. 
  //Common width x height values are 160 x 120, 176 x 132, 240 x 180, 320 x 240, and 640 x 480. 

 // Windows Media Player 6.4 Code
 else
 {
	var paramsHPWelcomeMessage =  	
	{	
	   BorderColor : '#824E40', 
	   BorderWidth : 0, 
	   CloseBoxHeight : 11, 
	   CloseBoxSrc : '/gfx/closebox_small.gif', 
	   CloseBoxWidth : 11, 
	   ContentFontSize : 11, 
	   ContentFontFamily : '\"Trebuchet MS\", Arial, Helvetica, sans-serif', 
	   ContentFontColor : '#824E40', 
       ContentColor : '#000000', 
	   ContentBottomBorderColor : '#824E40', 
	   ContentHTML : '<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"><html><head><meta http-equiv=\"Content-Type\" content=\"text/html\; charset=iso-8859-1\"><title>Welcome</title></head><body><table align=\"center\"><tr><td><OBJECT ID=MediaPlayer CLASSID=CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95 CODEBASE=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715 standby=\"Loading Microsoft Windows Media Player components...\" TYPE=\"application/x-oleobject\" width=\"200\" height=\"180\"><PARAM NAME=\"FileName\" VALUE=\"/ASXFiles/HPWelcomeMessage.asx\"><PARAM NAME=\"AutoStart\" VALUE=\"true\"><PARAM NAME=\"ShowControls\" VALUE=\"1\"><embed type=\"application/x-mplayer2\" pluginspage=\"http://www.microsoft.com/windows/windowsmedia/download/\" filename=\"http://www.franciscan.org/ASXFiles/HPWelcomeMessage.asx\" src=\"http://www.franciscan.org/ASXFiles/HPWelcomeMessage.asx\" Name=MediaPlayer ShowControls=1 ShowDisplay=0 ShowStatusBar=1 width=200 height=180></embed></OBJECT></td></tr></table></body></html>', 
	   ContentLeftBorderColor : '#824E40', 
	   ContentPadding : 0, 
	   ContentRightBorderColor : '#824E40', 
	   ContentTopBorderColor : '#824E40', 
	   InnerBorderColor : '#824E40', 
	   OuterBorderWidth : 0, 
       Shadow : false,
	   Resizable : 'None', 
	   ResizeBoxHeight : 0, 
       StatusBarHeight : 0, 
       StatusBarAlign : 'left', 
	   StatusColor : '#ACA633', 
	   StatusFontSize : 5, 
	   StatusFontFamily : '\"Trebuchet MS\", Arial, Helvetica, sans-serif', 
	   Height : 218, 
	   Width : 226, 
       Top : 220, 
       Left : 100, 
	   TitleLeftMargin : 7, 
	   TitleBarHeight : 16, 
	   TitleBarText : '', 
	   TitleBarAlign : 'left', 
	   TitleColor : '#A87933', 
	   TitleFontSize : 12, 
	   TitleFontFamily : '\"Trebuchet MS\", Arial, Helvetica, sans-serif', 
	   Id  : 'HPWelcomeMessage'
	}; 
	var HPWelcomeMessage = new FerantDHTMLWindow(paramsHPWelcomeMessage); 
   
    //HPWelcomeMessage.OpenWindow();

  }


function openViewer()
{  
 //if ( typeof document.MediaPlayer.controls == 'object' || detectionResults.installed==true )
// {
  HPWelcomeMessage.OpenWindow();
  document.MediaPlayer.controls.play();
// }
// else
// {
 // HPWelcomeMessage.OpenWindow();
 //}
}

function closeViewer()
{
// if ( typeof document.MediaPlayer.controls == 'object' || detectionResults.installed==true )
 //{
  document.MediaPlayer.controls.stop();
  HPWelcomeMessage.CloseWindow();
 //}
// else
 //{
 // HPWelcomeMessage.CloseWindow();
// }
}



/******** END openViewer FUNCTION *************************/
