/**
 *
 * CONSTRUCTEUR
 *
 */

var FlashUtil = function(){
		
	this.isIE  = ( navigator.appVersion.indexOf( "MSIE" ) != -1 ) ? true : false;
	
	this.isOpera = ( navigator.userAgent.indexOf( "Opera" ) != -1 ) ? true : false;
	
	this.isWin = ( navigator.appVersion.toLowerCase().indexOf( "win" ) != -1 ) ? true : false;
	
	return;
	
}

/**
 *
 * BROWSER DETECTION
 *
 */
FlashUtil.prototype.getBrowserInfos = function(){
	
	this.RETURN = new Object();
		this.RETURN._browser = navigator.appName;
		this.RETURN._version = parseFloat( navigator.appVersion );
	
	return this.RETURN;
	
}

FlashUtil.prototype.IEVersion = function(){
	
	var e;
	var axo;
	var version;
		
	axo = new ActiveXObject( "ShockwaveFlash.ShockwaveFlash.7" );
		version = axo.GetVariable( "$version" );
	
	return version;
	
}

FlashUtil.prototype.getPlayerVersion = function(){
	
	this.flashVer = -1;
	
	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;
			
			var descArray = flashDescription.split( " " );
			
			var tempArrayMajor = descArray[ 2 ].split( "." );
			
			var versionMajor = tempArrayMajor[ 0 ];
			
			var versionMinor = tempArrayMajor[ 1 ];
			
			var versionRevision = descArray[ 3 ];
			
			if( versionRevision == "" )
				versionRevision = descArray[ 4 ];
			
			if( versionRevision[ 0 ] == "d" )
				versionRevision = versionRevision.substring( 1 );
				
			else if( versionRevision[ 0 ] == "r" ){
				
				versionRevision = versionRevision.substring( 1 );
				
				if( versionRevision.indexOf( "d" ) > 0 )
					versionRevision = versionRevision.substring( 0, versionRevision.indexOf( "d" ) );
					
			}
			
			this.flashVer = versionMajor + "." + versionMinor + "." + versionRevision;				
		} else {
			this.flashVer = "";	
		}		
	}
	
	// MSN/WebTV 2.6 supports Flash 4
	else if ( navigator.userAgent.toLowerCase().indexOf( "webtv/2.6" ) != -1 )
		this.flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if( navigator.userAgent.toLowerCase().indexOf( "webtv/2.5" ) != -1 )
		this.flashVer = 3;
	// older WebTV supports Flash 2
	else if( navigator.userAgent.toLowerCase().indexOf( "webtv" ) != -1 )
		this.flashVer = 2;
	
	else if( this.isIE && this.isWin && !this.isOpera )
		this.flashVer = this.IEVersion();
		
	if( this.isIE && this.isWin )
		this.flashVer = this.flashVer.split( "," )[ 0 ].split( " " )[ 1 ];
	else
		this.flashVer = this.flashVer.split( "." )[ 0 ];
	
	return this.flashVer;
}
