
var WMPVer;

function testWMP(){
	var fHasWMP = navigator.mimeTypes && navigator.mimeTypes["video/x-ms-wm"] && navigator.mimeTypes["video/x-ms-wm"].enabledPlugin && navigator.mimeTypes["video/x-ms-wmv"] && navigator.mimeTypes["video/x-ms-wmv"].enabledPlugin;
	
	if( fHasWMP ) {
		return true;
	} else {
		return false;
	}
}

function getWindowsVersion()
{
	var v_win = -1;
	var agt = navigator.userAgent.toLowerCase();
	if (agt.indexOf("win")!=-1 || agt.indexOf("16bit")!=-1) {
		if (agt.indexOf("win95")!=-1 || agt.indexOf("windows 95")!=-1)
			v_win = 1;
		if (agt.indexOf("win98")!=-1 || agt.indexOf("windows 98")!=-1)
			v_win = 2;
		if (agt.indexOf("win 9x 4.90")!=-1)
			v_win = 3;
		if (agt.indexOf("winnt")!=-1 || agt.indexOf("windows nt")!=-1)
			v_win = 4;
		if (agt.indexOf("windows nt 5.0")!=-1)
			v_win = 5;
		if (agt.indexOf("windows nt 5.1")!=-1 || agt.indexOf("windows nt 5.2")!=-1) {
			// XP
			v_win = 6;
		}
		if (agt.indexOf("windows nt 6.0")!=-1 || agt.indexOf("windows nt 6.1")!=-1) {
			// Vista
			v_win = 7;
		}
	}

	return v_win;
}

// Fonction pour verifier le systeme d'exploitation
function CheckOS()
{
	if (getWindowsVersion()>5)  {
		return true;
	} else {
		return false;
	}
}

// Fonction pour verifier le media player
function CheckMediaPlayer()
{
	// Tests MediaPlayer
	var is_WMP = testWMP();
	var is_WMP64 = false;
	var is_WMP7up = false;
	var agt = navigator.userAgent.toLowerCase();
	var is_ie = (agt.indexOf("msie") != -1);
	var is_firefox_mozilla = (agt.indexOf("msie") == -1);
	
	if (getWindowsVersion()>6) {
		// Vista = wmp11
		return true;
	}

	var objMediaPlayer = null;
	
	// if windows
	if (getWindowsVersion()>0) {

		if (is_WMP)
		{
			try
			{
				if(is_ie){
					objMediaPlayer = new ActiveXObject("WMPlayer.OCX");
				}
				is_WMP7up = true;
			}
			catch(objError)
			{
				// cannot determine
				objMediaPlayer = null;
			}
		}
	}
	else
	{
		// not windows
		return false;
	}

	if (objMediaPlayer != null)
	{
		WMPVer = objMediaPlayer.versionInfo;
		objMediaPlayer = null;
		if (parseFloat(WMPVer) >= 10)
		{
			// MP >= 10.0 : OK
			return true;
		}
		else
		{
			// MP < 10.0 : echec
			return false;
		}
	}
	else
	{
		return true;
	}
}


function CheckIEversion()
{
	var name = navigator.appName;
	if (name == "Microsoft Internet Explorer")
	{
		var msIndex = navigator.appVersion.indexOf("MSIE");
		msie  = navigator.appVersion.slice(msIndex,msIndex+8);
		version = parseFloat(msie.slice(5,6));
		if(version>5) return(true);
		else return(false);
	}
}

function CheckIE7version()
{
	var name = navigator.appName;
	if (name == "Microsoft Internet Explorer")
	{
		var msIndex = navigator.appVersion.indexOf("MSIE");
		msie  = navigator.appVersion.slice(msIndex,msIndex+8);
		version = parseFloat(msie.slice(5,6));
		if(version>6) return(true);
		else return(false);
	}
}

OS_ok = CheckOS();
WMP_ok = CheckMediaPlayer();
IE_ok = CheckIEversion();
IE7_ok = CheckIE7version();
