// Next comes the standard javascript detection that uses the 
// navigator.plugins array. We pack the detector into a function so that 
// it preloads before being run.
 alert("Start main-main.js   actualVersion=" + actualVersion ); 
 
function detectFlash() {  
  // If navigator.plugins exists...
   alert("Start main-main.js   navigator.plugins=" + navigator.plugins ); 
  if (navigator.plugins) {
    // ...then check for flash 2 or flash 3+.
    if (navigator.plugins["Shockwave Flash 2.0"]
        || navigator.plugins["Shockwave Flash"]) {

      // Some version of Flash was found. Time to figure out which.
      
      // Set convenient references to flash 2 and the plugin description.
      var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
      var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;

      // DEBUGGING: uncomment next line to see the actual description.
      // alert("Flash plugin description: " + flashDescription);
      
      // A flash plugin-description looks like this: Shockwave Flash 4.0 r5
      // We can get the major version by grabbing the character before the period
      // note that we don't bother with minor version detection. 
      // Do that in your movie with $version or getVersion().
      //var flashVersion = parseInt(flashDescription.substring(16));
        //available_version = description.substr(16, (description.indexOf(".", 16) - 16));
		var flashVersion;
		var myDescParts = flashDescription.split(/ +/);
        if (myDescParts.length == 4){
			if(myDescParts[2] == "Player"){
				flashVersion = myDescParts[3].split(/\./);
			}else {
				flashVersion = myDescParts[2].split(/\./);
			}
		}
		actualVersion = flashVersion[0];
      alert("Start main-main.js navigateor.plugins flashDescription=" + flashDescription + " actualVersion=" + actualVersion ); 
      // We found the version, now set appropriate version flags. Make sure
      // to use >= on the highest version so we don't prevent future version
      // users from entering the site.
	  flash2Installed = actualVersion == 2;    
      flash3Installed = actualVersion == 3;
      flash4Installed = actualVersion == 4;
      flash5Installed = actualVersion == 5;
      flash6Installed = actualVersion == 6;
      flash7Installed = actualVersion == 7;
      flash8Installed = actualVersion == 8;
	  flash9Installed = actualVersion == 9;
	  flash10Installed = actualVersion == 10;
      flash11Installed = actualVersion >= 11;
	  
	 // Loop through all versions we're checking, and
	// set actualVersion to highest detected version.
	/*for (var i = 2; i <= maxVersion; i++) 
	if (eval("flash" + i + "Installed") == true){
		actualVersion = i;
	} 
	*/
    }
  }
  else if(typeof(ActiveXObject) == "function")
  {
        /* durchlaufen der Flash Versionen von 2 bis zur maximal zu prüfenden Version */
        for(var i = 2; i < (max_version + 1); i ++)
        {
            /***
             * wir beugen mittels try und catch (JS 1.5+ / IE5+) einem Fehler vor (welcher einen
             * Abbruch des Scripts zur Folge hätte), so können wir auch auf ein extra VBScript
             * verzichten.
             */
            try
            {
                /***
                 * läßt sich das ActiveX Flash Objekt Version i erstellen, so ist diese Version
                 * auch installiert
                 */
                if(typeof(new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i)) == "object")
                {
                    actualVersion = i;
                }
           }
           catch(error)
           {
           }
        }
		 alert("DEBUG main-main ActiveObject: Flash = " + Flash + "  Actual Version = " + actualVersion);



  }
}

detectFlash();  // call our detector now that it's safely loaded. 

      alert("End main-main.js  actualVersion=" + actualVersion ); 
