//This script checks to see if visitor is using Netscape or MSIE browser. 
//If Netscape or MSIE, make sure it is version 4.x or higher
//If not 4.x or above, send to error page.

var browserVer=parseInt(navigator.appVersion); 
 
if(navigator.appName == "Netscape")
	{
	if (browserVer < 4)
	 	{
			document.location="erreur.php"
		}
	}

if(navigator.appName == "Microsoft Internet Explorer")
	{
	if (browserVer < 4)
	 	{
			document.location="erreur.php"
		}
	}

	/*/
//// DETECT FLASH \\\\\
//alert( flashVersion);
var myPlugin = navigator.plugins["Flash"]; 
var myPlugin = navigator.plugins.name; 
if (myPlugin){ 
	//Action si le visiteur n'a pas le plugin. (Ici redirection) 
	window.location = "error-flash.html";
} 
*/

	agt = navigator.userAgent.toLowerCase();
	app = navigator.appName.toLowerCase();
	
	///// OS \\\\\
	osCode = "";
	osVersion = "";
	osName = "";
	
  if ( agt.indexOf( "win") != -1) {
	  osCode = "win";
		osName = "Windows";
  	if ( agt.indexOf( "nt 5.1") != -1) {
  	  osVersion = "XP";
  	} else if ( agt.indexOf( "nt 5.0") != -1) {
  	  osVersion = "2000";
  	} else if ( ( agt.indexOf( "nt 4.0") != -1)
						 || ( agt.indexOf( "nt;") != -1)
						 || ( agt.indexOf( "winnt4") != -1)
						 || ( agt.indexOf( "windows nt") != -1)) {
  	  osVersion = "NT";
  	} else if ( agt.indexOf( "98") != -1) {
  	  osVersion = "98";
  	} else if ( agt.indexOf( "windows 95") != -1) {
  	  osVersion = "95";
  	}
	} else if ( agt.indexOf( "mac") != -1) {
	  osCode = "mac";
		osName = "MacOS";
		if ( agt.indexOf( "mac os x") != -1) {
		  osVersion = "X";
		}
	} else if ( agt.indexOf( "linux") != -1) {
	  osCode = "linux";
		osName = "Linux";
	} else {
	  osCode = "win";
		osName = "Windows";
	}

	///// NAV \\\\\
	navCode = "";
	navVersion = "";
	navName = "";
	
	if ( agt.indexOf( "msie") != -1) {
		navCode = "ie";
		navName = "Internet Explorer";
		navVersion = agt.substr( agt.indexOf( "msie") + 5, 1);
	} else if ( agt.indexOf( "safari") != -1) {
		navCode = "safari";
		navName = "Safari";
 	  navVersion = "1";
	} else if ( agt.indexOf( "netscape") != -1
				 || ( app.indexOf( "netscape") != -1 && app.indexOf( "safari") == -1)) {
		navCode = "ns";
		navName = "Netscape";
  	if ( agt.indexOf( "netscape/7") != -1) {
  	  navVersion = "7";
  	} else if ( agt.indexOf( "netscape6/6") != -1) {
  	  navVersion = "6";
  	} else if ( agt.indexOf( "mozilla/4") != -1) {
  	  navVersion = "4";
  	} else {
  		navCode = "mozilla";
  		navName = "Mozilla";
   	  navVersion = agt.substr( agt.indexOf( "rv:") + 3, 3);
		}
	} else if ( agt.indexOf( "firebird") != -1) {
		navCode = "firebird";
		navName = "Mozilla Firebird";
 	  navVersion = agt.substr( agt.indexOf( "firebird/") + 9, 3);
	} else if ( agt.indexOf( "firefox") != -1) {
		navCode = "firefox";
		navName = "Mozilla Firefox";
 	  navVersion = agt.substr( agt.indexOf( "firefox/") + 8, 3);
	} else if ( agt.indexOf( "konqueror") != -1) {
		navCode = "konqueror";
		navName = "Konqueror";
	}
	///// FLASH \\\\\
	var flashVersionMin = 4;
	var flashVersionMax = 20;
	var flashVersion = -1;

	for ( var iFlashVersion = flashVersionMin; iFlashVersion <= flashVersionMax; iFlashVersion ++) {
	  eval( "aFlash" + iFlashVersion + " = false");
	}

	if( navCode == "ie" && osCode != "mac") {
  	document.write('<scr' + 'ipt language=VBScript\> \n');
  	document.write('on error resume next \n');
		for ( var iFlashVersion = flashVersionMin; iFlashVersion <= flashVersionMax; iFlashVersion ++) {
   	  document.write('aFlash' + iFlashVersion + ' = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.' + iFlashVersion + '"))) \n');
		}	
   	document.write('</scr' + 'ipt\> \n');
  }

  var aFlash = null;
  for ( var iFlashVersion = flashVersionMin; iFlashVersion <= flashVersionMax; iFlashVersion ++) {
  	if ( navCode == "ie" && osCode != "mac") {
      if ( eval( 'aFlash' + iFlashVersion) == true) {
				flashVersion = iFlashVersion;
			}
    } else {
			if ( aFlash == null) {
			  aFlash = false;
  			for ( var iPlugin = 0; iPlugin < navigator.plugins.length; iPlugin ++) {
  			  var p = navigator.plugins[ iPlugin];
  			  if ( p.name == "Shockwave Flash") {
  				  aFlash = true;
  					break;
  				}
  			}
			}
			if ( aFlash == false) {
				break;
			}
			if( navigator.plugins["Shockwave Flash"].description.indexOf( "Flash " + iFlashVersion) != -1) {
				flashVersion = iFlashVersion;
		  }
    }
  }
if ( flashVersion < 6) {
		window.location.href = 'erreur-flash.php';
}


