//Detect ActiveX Architecture on Both IE and on Gecko
//Defer to plugin architecture for other browsers

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;
}
	

function printResults()
{
	var detectionResults = detectWMP();
        document.write("<html><head><body bgcolor=#CCCCCC>");
	document.write("<blockquote><font face=Verdana size=1>");
        if(detectionResults.type=="ActiveX"){
	document.write("<b>Browser architecture supports: </b><font color=#00FF00>" + detectionResults.type + "</font><br>");
	}
        else {
	document.write("<b>Browser architecture supports:</b><font color=#FF0000>" + detectionResults.type + "</font><br>");
	}
	if(detectionResults.installed){
		document.write("<b>Windows Media Player Installed: </b><font color=#00FF00>" + detectionResults.installed + "</font><br>");
		if(detectionResults.scriptable){
		document.write("<b>Windows Media Scriptable:  </b><font color=#00FF00>" + detectionResults.scriptable + "</font><br>");
		document.write("<b>Windows Media Version: </b>" + detectionResults.versionInfo + "<br>");
		document.write("Version MUST BE higher of 4.~ for heard the music<br> and higher of 9.~ to heard lives and audiolyrics <br>");
		}
		else{
		document.write("<b>Windows Media Scriptable:  </b><font color=#FF0000>" + detectionResults.scriptable + "</font><br>");		
		}
	}
        else { 
		document.write("<b>Windows Media Player Installed: </b><font color=#FF0000>" + detectionResults.installed + "</font><br><a target=_blank href=http://windowsmedia.com/download/download.asp>Install the latest windows media Player</a><br>");
		}
	if (navigator.javaEnabled()){ 
		document.write("<b>Java: </b> <font color=#00FF00>On</font> ");
                }
		else 
		document.write("<b>Java-Off </b>");
       
        if (document.getElementById || document.all || document.layers){
	        document.write("<br><b>DHTML:</b> <font color=#00FF00>On</font>");// browser can do DHTML
        }
        else {
		document.write("<br><b><b>DHTML:</b> <font color=#FF0000>Off</font> </b><br> You have some problem in your browser try to update it"); }
        //if (document.getElementById && document.createElement) {
	//	document.write("<br><b>DHTML-On2 </b>");
	//}
        //else {
	//document.write("<br><b><b>DHTML:</b> <font color=#FF0000>Off2</font> </b><br><font color=#FF0000> You have some problem in your browser try to update it");
	//}
	document.write("<br>DHTML results don't secure well function on NETSCAPE");
        


	
}




