

var requiredVersion = 6;			
// system globals
var flash2Installed = flash3Installed = flash4Installed = flash5Installed = flash6Installed = hasRightVersion = false;		
var maxVersion = 6; 
var actualVersion = 0;
var hasFlash = false;				
//vbscript detection for Win IE
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;		
var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false; 
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('</SCR' + 'IPT\> \n'); 
}



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;
			// a flash plugin-description looks like this: Shockwave Flash 4.0 r5
			var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
			flash2Installed = flashVersion == 2;		
			flash3Installed = flashVersion == 3;
			flash4Installed = flashVersion == 4;
			flash5Installed = flashVersion == 5;
			flash6Installed = flashVersion == 6;
		}
	}
	for (var i = 2; i <= maxVersion; i++) {	
		if (eval("flash" + i + "Installed") == true) actualVersion = i;
	}
	// if we're on webtv, the version supported is 3
	if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 3;	
    // aol5/mac fix - AOL5/Mac always comes with Flash
	if ( (navigator.userAgent.indexOf("Mac") != -1) && (navigator.userAgent.indexOf("AOL 5") != -1) )  actualVersion = 6;
	if (actualVersion >= requiredVersion) { 		
		hasFlash = true;						
	} 
	
}
detectFlash();

/*need to add real link to flash file and url path to the fail sniff page*/
function ebook(){
if (hasFlash && actualVersion >= 6 ){
var newWin=window.open('http://www-1test.ibm.com/linux/emag/start.html','linuxPopup','toolbars=no,scrollbars=no,noresize,height=450,width=700');
}
else {
document.location.href = "http://www-1test.ibm.com/linux/emag/ebook_fail_sniff.html"
}
}

