function TNT_FlashDetect() { }

TNT_FlashDetect.prototype.maxVersionToDetect = 11;
TNT_FlashDetect.prototype.minVersionToDetect = 3;

TNT_FlashDetect.prototype.hasPlugin = ( navigator.mimeTypes &&
                navigator.mimeTypes.length &&
                navigator.mimeTypes["application/x-shockwave-flash"] &&
                navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin );

TNT_FlashDetect.prototype.hasActiveX = window.ActiveXObject;

TNT_FlashDetect.prototype.hasWinIE = ( navigator.userAgent &&
                ( navigator.userAgent.indexOf( "MSIE" ) != -1 ) &&
                navigator.appVersion &&
                ( navigator.appVersion.indexOf( "Win" ) != -1 ) );

TNT_FlashDetect.prototype.getVersion = function () {
        var versionNum = 0;
        var i = 0;

        if ( this.hasActiveX ) {
                var activeXObject = false;
                for ( i = this.maxVersionToDetect; i >= this.minVersionToDetect && !activeXObject; versionNum = ( activeXObject ? i : versionNum ), i-- ) {
                        try {
                                activeXObject = new ActiveXObject( "ShockwaveFlash.ShockwaveFlash." + i );
                        } catch( e ) {
                                // do nothing
                        }
                }
        } else if ( this.hasWinIE ) {
                VBS_Result = false;
                for ( i = this.maxVersionToDetect; i >= this.minVersionToDetect && !VBS_Result; versionNum = ( VBS_Result ? i : versionNum ), i-- ) {
                        execScript( 'on error resume next: VBS_Result = IsObject( CreateObject( "ShockwaveFlash.ShockwaveFlash.' + i + '" ) )', 'VBScript' );
                }
        } else if ( this.hasPlugin ) {
                if ( navigator.plugins && navigator.plugins.length && navigator.plugins["Shockwave Flash"] ) {
                        var words = navigator.plugins["Shockwave Flash"].description.split( " " );
                        for ( i = 0; i < words.length; ++i ) {
                                if ( isNaN( parseInt( words[i] ) ) )
                                        continue;
                                versionNum = words[i];
                        }
                }
        }

        return ( versionNum );
}

TNT_FlashDetect.prototype.detectVersion = function ( num ) {
        var isVersionSupported = false;

        if ( ! isNaN( num ) ) {
                isVersionSupported = ( this.getVersion() >= parseInt( num ) );
        }

        return ( isVersionSupported );
}

