// Standard JavaScript detection (navigator.plugins array)
function detectFlash(){  

	if(navigator.plugins){

	    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: uncomment next line to see the actual description.
			// alert("Flash plugin description: " + flashDescription);
			
			// NOTE: Flash plugin-description looks like this: Shockwave Flash 4.0 r5
			var flashDetect = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
			
			flash2installed = flashDetect == 2;    
			flash3installed = flashDetect == 3;
			flash4installed = flashDetect == 4;
			flash5installed = flashDetect == 5;
			flash6installed = flashDetect >= 6;
		}
	}
  
	for(var i=2; i<=maxFlashVersion; i++){  
		if(eval("flash"+i+"installed")==true) flashVer = i;
  	}
  
	if(navigator.userAgent.indexOf("WebTV")!=-1) actualFlashVersion = 3;  
	
	// DEBUGGING: uncomment the next line to display Flash version
	// alert("Version Detected: " + flashVer);
	
	// Assign Variables
	flash    = (flashVer>0)  ? true:false;
	flash2   = (flashVer==2) ? true:false;
	flash3   = (flashVer==3) ? true:false;
	flash4   = (flashVer==4) ? true:false;
	flash5   = (flashVer==5) ? true:false;
	flash5up = (flashVer>=5) ? true:false;
	flash6   = (flashVer==6) ? true:false;
	flash6up = (flashVer>=6) ? true:false;
	
}

detectFlash(); //Execute the code