
	// Detect Client Browser type
	var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
	var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
	var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
	
	jsVersion = 1.1;
	
	// JavaScript helper required to detect Flash Player PlugIn version information
	function JSGetSwfVer(i) {
		
		// NS/Opera version >= 3 check for Flash plugin in plugin array
		if (navigator.plugins != null && navigator.plugins.length > 0) {
			
			if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
				
				var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
				var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
				
				descArray = flashDescription.split(" ");
				tempArrayMajor = descArray[2].split(".");
				versionMajor = tempArrayMajor[0];
				versionMinor = tempArrayMajor[1];
				
				if ( descArray[3] != "" ) {
					
					tempArrayMinor = descArray[3].split("r");
					
				} else {
					
					tempArrayMinor = descArray[4].split("r");
					
				}
				
				versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
				flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
				
			} else {
				
				flashVer = -1;
				
			}
			
		} else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) {
			
			// MSN/WebTV 2.6 supports Flash 4
			flashVer = 4;
			
		} else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) { 
		
			// WebTV 2.5 supports Flash 3
			flashVer = 3;
			
		} else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) {
			
			// older WebTV supports Flash 2
			flashVer = 2;
			
		} else {
			
			// Can't detect in all other cases			
			flashVer = -1;
			
		}
		
		return flashVer;
		
	} 
	
	function WriteFlashSystemVer( versionStr ) {
		
		if ( acd_detect ) {
		
			var appCodeName, appName, appMinorVersion, cpuClass, platform, plugins, opsProfile, userProfile;
			var systemLanguage, userLanguage, appVersion, userAgent, onLine, cookieEnabled, mimeTypes;
			
			var OS = false;
			var Version = false;
			var Browser, place, thestring;
			
			var detect = navigator.userAgent.toLowerCase();
	
			function checkIt( string ) {
				
				place = detect.indexOf( string ) + 1;
				thestring = string;
				
				return place;
				
			}
			
			if ( checkIt("konqueror") ) {
				
				Browser = "Konqueror";
				OS = "Linux";
				
			} else if ( checkIt("safari") ) {
				
				Browser = "Safari";
				
			} else if ( checkIt("omniweb") ) {
				
				Browser = "OmniWeb";
				
			} else if ( checkIt("opera") ) {
				
				Browser = "Opera";
				
			} else if ( checkIt("webtv") ) {
				
				Browser = "WebTV";
				
			} else if ( checkIt("icab") ) {
				
				Browser = "iCab";
				
			} else if ( checkIt("msie") ) {
				
				Browser = "Internet Explorer";				
				
			} else if ( checkIt("firefox") ) {
				
				Browser = "Mozilla FireFox";
				Version = detect.charAt(8);
				
			} else if ( !checkIt("compatible") ) {
				
				Browser = "Netscape Navigator";
				Version = detect.charAt(8);
				
			} else {
				
				Browser = "Browser sconosciuto";
				
			}
			
			if ( Version == false ) {
				
				Version = detect.charAt(place + thestring.length);
				
			}
			
			if ( OS == false ) {
				
				if ( checkIt("linux") ) {
					
					OS = "Linux";
					
				} else if ( checkIt("x11") ) {
					
					OS = "Unix";
					
				} else if ( checkIt("mac") ) {
					
					OS = "Mac";
					
				} else if ( checkIt("win") ) {
					
					OS = "Windows";
					
				} else {
					
					OS = "OS sconosciuto";
					
				}
				
			}
	
			var res = OS + ", " +  Browser + ", " + Version + ", " + thestring;
			
			if ( res != undefined ) {
				// alert( res );
			}
				  
			appCodeName		= ( navigator.appCodeName != undefined ) ?		navigator.appCodeName : "-"; // = Mozilla;
			appName			= ( navigator.appName != undefined ) ?			navigator.appName : "-"; // = Microsoft Internet Explorer;
			appMinorVersion	= ( navigator.appMinorVersion != undefined ) ?	navigator.appMinorVersion : "-"; // = SP2;
			cpuClass		= ( navigator.cpuClass != undefined ) ?			navigator.cpuClass : "-"; // = x86;
			platform		= ( navigator.platform != undefined ) ?			navigator.platform : "-"; // = Win32;
			plugins			= ( navigator.plugins != undefined ) ?			navigator.plugins : "-"; // =;
			opsProfile		= ( navigator.opsProfile != undefined ) ?		navigator.opsProfile : "-"; // =;
			userProfile		= ( navigator.userProfile != undefined ) ?		navigator.userProfile : "-"; // =;
			systemLanguage	= ( navigator.systemLanguage != undefined ) ?	navigator.systemLanguage : "-"; // = it;
			userLanguage	= ( navigator.userLanguage != undefined ) ?		navigator.userLanguage : "-"; // = it;
			appVersion		= ( navigator.appVersion != undefined ) ?		navigator.appVersion : "-"; // = 4.0 (compatible; MSIE 6.0; Windows NT 5.1; dial; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322);
			userAgent		= ( navigator.userAgent != undefined ) ?		navigator.userAgent : "-"; // = Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; dial; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322);
			onLine			= ( navigator.onLine != undefined ) ?			navigator.onLine : "-"; // = true;
			cookieEnabled	= ( navigator.cookieEnabled ) ?	"on" : "off"; // = true;
			mimeTypes		= ( navigator.mimeTypes != undefined ) ?		navigator.mimeTypes : "-"; // = 
			
			if ( versionStr == -1 ) { 
				
				acd_versionStr = "non installato";
				
				acd_detect = false;
				
			} else if ( versionStr != 0 ) {
				
				if( isIE && isWin && !isOpera ) {
					
					tempArray         = versionStr.split(" ");
					tempString        = tempArray[1];
					versionArray      = tempString .split(",");		
					
				} else {
					
					versionArray      = versionStr.split(".");
					
				}
				
				versionMajor	= versionArray[0];
				versionMinor	= versionArray[1];
				versionRevision	= versionArray[2];
				versionString	= versionMajor + "." + versionRevision; // 7.0r24 == 7.24
				
				acd_versionStr 	= versionString;
				
				acd_detect = false;
				
			}
			
			if ( !acd_detect ) {
				
				// alert( "Flash ... " + acd_versionStr + "\n\nSystem Version ... " + platform + " " + appMinorVersion + " " + systemLanguage + ", " + cpuClass + "\n" + appCodeName + " " + appVersion + " " + userLanguage + "\nCookie = " + cookieEnabled );
				alert( "ACD_Flash v" + acd_version + "\n\nShockwave Flash " + acd_versionStr + "\n\n" + OS + " " + appMinorVersion + " (" + systemLanguage + "), " + cpuClass + "\n" + Browser + " " + Version + " (" + userLanguage + ")\nCookie " + cookieEnabled );
				
			}
			
		}
		
	}
	
	// If called with no parameters this function returns a floating point value 
	// which should be the version of the Flash Player or 0.0 
	// ex: Flash Player 7r14 returns 7.14
	// If called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
	function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) {
		
		reqVer = parseFloat( reqMajorVer + "." + reqRevision );
		
		// loop backwards through the versions until we find the newest version	
		for ( i = 25; i > 0; i-- ) {
			
			if ( isIE && isWin && !isOpera ) {
				
				versionStr = VBGetSwfVer( i );
				
			} else {
				
				versionStr = JSGetSwfVer( i );
				
			}
			
			WriteFlashSystemVer( versionStr )
			
			if (versionStr == -1 ) { 
			
				return false;
				
			} else if (versionStr != 0) {
				
				if(isIE && isWin && !isOpera) {
					
					tempArray         = versionStr.split(" ");
					tempString        = tempArray[1];
					versionArray      = tempString .split(",");		
					
				} else {
					
					versionArray      = versionStr.split(".");
					
				}
				
				versionMajor      = versionArray[0];
				versionMinor      = versionArray[1];
				versionRevision   = versionArray[2];
				versionString     = versionMajor + "." + versionRevision;   // 7.0r24 == 7.24
				versionNum        = parseFloat(versionString);
				
				// is the major.revision >= requested major.revision AND the minor version >= requested minor
				if ( (versionMajor > reqMajorVer) && (versionNum >= reqVer) ) {
					
					return true;
					
				} else {
					
					return ((versionNum >= reqVer && versionMinor >= reqMinorVer) ? true : false );	
					
				}
				
			}
			
		}	
		
		return ( reqVer ? false : 0.0 );
		
	}
	
	var acd_hasflash = false;
	acd_hasflash = DetectFlashVer( acd_majorversion, acd_minorversion, acd_revision );	
		
	var acd_flashwrites = new Array();
	
	function FlashWrite( acd_textonly, acd_noflash, acd_flashobj, acd_secondary, par_majorversion, par_minorversion, par_revision, acd_div, acd_test ) {
		
		var myobj = new Object();
		myobj.acd_textonly = acd_textonly;
		myobj.acd_noflash = acd_noflash;
		myobj.acd_flashobj = acd_flashobj;
		myobj.acd_secondary = acd_secondary;
		myobj.par_majorversion = par_majorversion;
		myobj.par_minorversion = par_minorversion;
		myobj.par_revision = par_revision;
		myobj.acd_div = acd_div;
		myobj.acd_test = acd_test;
		
		acd_flashwrites.push( myobj );
		
	}
	
	function FlashRun() {
		
		for ( var s=0; s < acd_flashwrites.length; s++ ) {
		
			var myobj = acd_flashwrites[s];
			FlashWriteSub( myobj.acd_textonly, myobj.acd_noflash, myobj.acd_flashobj, myobj.acd_secondary, myobj.par_majorversion, myobj.par_minorversion, myobj.par_revision, myobj.acd_div, myobj.acd_test );
		
		}
		
	}
						
	function FlashWriteSub( acd_textonly, acd_noflash, acd_flashobj, acd_secondary, par_majorversion, par_minorversion, par_revision, acd_div, acd_test ) {
		
		var myFlash, myElement, myFlag, mySecondary
		
		myElement = document.getElementById("acd_"+acd_div);
		// alert( myElement );
		
		myFlash = "<!--" + acd_textonly + "-->";
		
		mySecondary = false;
		
		if ( acd_secondary != "" ) {
			
			mySecondary = DetectFlashVer( par_majorversion, par_minorversion, par_revision );
			
		}
		
		if ( acd_hasflash && acd_test == 0 ) {
			
			// alert( "PRIMARY > " + acd_flashobj );
			AC_FL_RunContent( acd_flashobj, myElement );		
			// AC_AX_RunContent( new Array("width","1","height","1"), myElement );
			
		} else if ( ( mySecondary && acd_test != 1 ) || acd_test == 2 ) {
				
			// alert( "SECONDARY > " + acd_secondary );
			AC_FL_RunContent( acd_secondary, myElement );		
			// AC_AX_RunContent( new Array("width","1","height","1"), myElement );
					
		} else {
				
			// alert( acd_noflash );				
			myFlash += acd_noflash;	
			
			// alert( myFlash );
			myElement.innerHTML = myFlash;
			
		}

	}
	
	$(document).ready(function(){

		FlashRun();

	});
	