<!--
// Extera Flash player inspector
// version: 1.2
// #############################################
// Variabili per la detect
// Versione richiesta di Flash
var requiredVersion = 4;
// Indirizzo della pagina NO FLASH
var noFlashPage = "default2.asp?flash_enabled=false";
// Indirizzo della pagina UPGRADE FLASH
var upgradePage = "default2.asp?flash_enabled=false";
var useRedirect = true; 
var flashPage = "default2.asp?flash_enabled=true"				// indirizzo della pagina con Flash
// #############################################
var flash2Installed = false;    // Flash 2 non  installato
var flash3Installed = false;    // Flash 3 non  installato
var flash4Installed = false;    // Flash 4 non  installato
var flash5Installed = false;    // Flash 5 non  installato
var flash6Installed = false;    // Flash 6 non  installato
var flash7Installed = false;    // Flash 7 non  installato
var flash8Installed = false;    // Flash 8 non  installato
var maxVersion = 8;             // Massima versione del plugin che  possibile cercare
var actualVersion = 0;          // Versione attualmente installata
var hasRightVersion = false;    // True se si vuole caricare il Flash nella pagina corrente
var jsVersion = 1.0;            // La versione Javascriptsupportata



// Check del Browser
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;    // True se hai Explorer
var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false; // True se hai Windows

// Versione del codice Javascript seguente
jsVersion = 1.1;

// Scrivo una detection in VBscript. In Explorer su Windows non  supportata la detection del plugin in Javasvript

if(isIE && isWin){
  document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
  document.write('on error resume next \n');
  document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
  document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
  document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
  document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');  
  document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');  
  document.write('flash7Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');  
  document.write('flash8Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))) \n');  	
  document.write('</SCR' + 'IPT\> \n'); 
}


// Detection in Javascript

function detectFlash() {  
  // Se il plugin esiste...
  if (navigator.plugins) {
    // ... ne cerco la versione 2 o 3+
    if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {

      var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";

      var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;

      // DEBUGGING: Decommentare la riga seguente per ottenere la descrizione del Plugin
      //alert("Flash plugin description: " + flashDescription);
      //alert("Flash plugin Version: " + isVersion2);      

      var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
     
      // Trovo la versione del plugin

      flash2Installed = flashVersion == 2;    
      flash3Installed = flashVersion == 3;
      flash4Installed = flashVersion == 4;
      flash5Installed = flashVersion == 5;
      flash6Installed = flashVersion == 6;
      flash7Installed = flashVersion == 7;			
      flash8Installed = flashVersion >= 8;
    }
  }
  
  // Loop attraverso le versioni trovate per determinare l'ultima versione come versione installata

  for (var i = 2; i <= maxVersion; i++) {  
    if (eval("flash" + i + "Installed") == true) actualVersion = i;
  }
  
  // Se siamo sun una webtv, la versione supportata  la 2 (pre-Estate 2000, 
  // o 3, post-Estate 2000).

  if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 3;  
  
  // DEBUGGING: Decommentare la riga seguente per sapere la versione attuale del plugin
  //alert("version detected: " + actualVersion);


  // Abbiamo finito con la detection
  // Ora eseguiamo le azioni appropriate

  // Se l'utente possiede una versione uguale o superiore del plugin...
//  if (actualVersion < requiredVersion) {
//		if(jsVersion > 1.0) {
//			window.location.replace((actualVersion >= 2) ? upgradePage : noFlashPage);
//		} else {
//			window.location = (actualVersion >= 2) ? upgradePage : noFlashPage;
//		}
//  }

	if (actualVersion >= requiredVersion) { 		// user has a new enough version
		hasRightVersion = true;						// flag: it's okay to write out the object/embed tags later

		if (useRedirect) {							// if the redirection option is on, load the flash page
			if(jsVersion > 1.0) {					// need javascript1.1 to do location.replace
				window.location.replace(flashPage);	// use replace() so we don't break the back button
			} else {
				window.location = flashPage;		// otherwise, use .location
			}
		}
	} else {	// user doesn't have a new enough version.
	
		if (useRedirect) {		// if the redirection option is on, load the appropriate alternate page
			if(jsVersion > 1.0) {	// need javascript1.1 to do location.replace
				window.location.replace((actualVersion >= 2) ? upgradePage : noFlashPage);
			} else {
				window.location = (actualVersion >= 2) ? upgradePage : noFlashPage;
			}
		}
	}


}

detectFlash();
// -->

