
//detect browser's plugins//
var isDetectWithVB = false;
var isPluginFound = false;

var isIE 	= (navigator.userAgent.indexOf('MSIE') != -1)? true : false;
var isWin 	= (navigator.appVersion.toLowerCase().indexOf("win") != -1)? true : false;
var isMac 	= (navigator.appVersion.toLowerCase().indexOf("mac") != -1)? true : false;

// DetectPlugin Class for non-IE 
var DetectPlugin= function() {
    // allow for multiple checks in a single pass
    var dKeywords = DetectPlugin.arguments;
	var isKeywordsFound = false;
	
	var oPlugin;
	
	// to sure navigator.plugins method is available
    if ( navigator.plugins && (navigator.plugins.length>0) )
	{
		var dklen = dKeywords.length;
		var arrlen = navigator.plugins.length;
		var s = "";
		for ( al=0; al<arrlen; al++ ) 
		{
			//alert("dPlugins["+a+"] : " + dPlugins[a]);
			var nFound = 0;
			
			//--s += "n"+al+" : " + navigator.plugins[al].name + "\n";
			//--s += "d"+al+" : " + navigator.plugins[al].name + "\n";

			for( ag=0; ag < dklen; ag++ ) 
			{
				//if desired plugin name is found in either plugin name or description
				if ( (navigator.plugins[al].name.indexOf(dKeywords[ag]) >= 0 ) || 
					(navigator.plugins[al].description.indexOf(dKeywords[ag]) >= 0) ) 
				{
					nFound++;
				}   
			}
			//if only found quantity is equal to arguments passed
			if( nFound == dklen ) 
			{
				isKeywordsFound = true;
				oPlugin = navigator.plugins[al];
				//plugin found and stop the rest of checking
				break;
			}
		}
		
		//--alert (s);
    }
	
	this.isInstalled = isKeywordsFound;
	
    return oPlugin;
	
};

// DetectAXOPlugiun Class for IE 
var DetectAXOPlugin = function()
{
    var dKeywords = DetectAXOPlugin.arguments;
	var isKeywordsFound = false;
	
	var pluginAXO;
	//alert("window : "+window+ "\n "+
	//"dKeywords : "+dKeywords+ "\n "+
	//"typeof(window.ActiveXObject)")
	
	//to sure that AXO is available
	if ( typeof(window.ActiveXObject) == "function" )
	{
		var dklen = dKeywords.length;
		var nFound = 0;
		
		for ( ag=0; ag<dklen; ag++ )
		{
			try {
				pluginAXO = new ActiveXObject(dKeywords[ag]);
				nFound ++;
			} catch (e) {
				alert(e);
			}
		}
		//if matched keywords found is matched to dKeywords.length
		if ( nFound==dklen )
		{
			isKeywordsFound = true;
		}
	}

	this.isInstalled = isKeywordsFound;

	return pluginAXO;
};

// DetectFlash Class
var DetectFlash = function()
{
	var oFlash;
	var sVer_major;
	var sVer_minor;
	var sVer_revision;
	var version;

	//issue : (not IE + navigator.plugins) OR (IE + MAC + navagator.plugins)
	if ( (!isIE && (typeof navigator.plugins == "object")) || (isIE && isMac && (typeof navigator.plugins == "object")) )
	{
		oFlash = new DetectPlugin ("Shockwave", "Flash");
		
		var s = new String(oFlash.description);
		var sVer = new String(s.split('Shockwave Flash ')[1]);
		
		var tmpSplit_1 	= sVer.split('.');
		sVer_major 		= parseInt(tmpSplit_1[0]);
		
		var tmpSplit_2 	= tmpSplit_1[1].split(' r');
		sVer_minor 		= parseInt(tmpSplit_2[0]);
		
		sVer_revision 	= parseInt(tmpSplit_2[1]);
		
		version = sVer_major +'.'+ sVer_minor +'.'+ sVer_revision;
	}
	//issue : IE + WIN + AXO
	else if (  isIE && typeof(window.ActiveXObject) == "function" ) 
	{
		if ( isWin ) {
			
			oFlash = new DetectAXOPlugin("ShockwaveFlash.ShockwaveFlash");
			
			var s = new String(oFlash.getVariable("$version"));
			var sVer = s.split(' ')[1];
		
			var tmpSplit = sVer.split(',');
			sVer_major 		= parseInt(tmpSplit[0]);
			sVer_minor 		= parseInt(tmpSplit[1]);
			sVer_revision 	= parseInt(tmpSplit[2]);
			
			version = sVer_major +'.'+ sVer_minor +'.'+ sVer_revision;
		}
	}
	
	this.versionMajor = sVer_major;
	this.versionMinor = sVer_minor;
	this.versionRevision = sVer_revision;
	this.version = version;
	this.isInstalled = oFlash.isInstalled;
}




