function cmnInformation(){
        var eHTML = document.getElementsByTagName( 'html' )[0];
        this.sUser_agent = navigator.userAgent.toLowerCase();
        if( window.opera ){
                this.bOpera = true;
        }
        if( !this.bOpera && this.sUser_agent.indexOf( 'msie' ) != -1 ){
                this.bIE = true;
        }else if( navigator.product == 'Gecko' ){
                this.bGecko = true;
                this.bMozilla = true;
        }
        this.bMAC = ( this.sUser_agent.indexOf( 'mac' ) != -1 );
        this.sLanguage = null;
        this.bHTTP = null;
        this.bHandheld = false;
        return this;
}

var cmn_oInformation = new cmnInformation();

function cmnFlash(){}

cmnFlash.prototype.build=function( vEnabled, vDisabled, vNone, iVersion  ){
        var vVersion = this.get_version( iVersion );
        if( vVersion ){
                if( vEnabled.nodeType ) vEnabled.style.display = "block";
                else document.write( this.build_object(vEnabled) );
                if( vDisabled.nodeType ) vDisabled.style.display = "none";
                if( vNone.nodeType ) vNone.style.display = "none";
        }else{
                if( vEnabled.nodeType ) vEnabled.style.display = "none";
                if( vDisabled.nodeType ) vDisabled.style.display = "block";
                else if( vDisabled ) document.write( vDisabled );
                if( parseInt(vVersion) == 0 );
                        if( vNone.nodeType ) vNone.style.display = "block";
                        else if( vNone ) document.write( vNone );
        }
}

cmnFlash.prototype.get_version=function(iVersion){
        return this.check_flash_version(iVersion);
}

cmnFlash.prototype.check_flash_version=function(iVersion){
        if( navigator.plugins && navigator.plugins['Shockwave Flash'] ){
                var sVersion = ( !iVersion ) ? "\\d+" : "[" + iVersion + "-9]\\d*";
                sVersion = parseInt( navigator.plugins['Shockwave Flash'].description.replace( new RegExp( "^[^\\d]+(" + sVersion + ").*$"), "$1" ) );
                return ( isNaN( sVersion ) ) ? ( !iVersion ) ? false : 0 : sVersion;
        }else if( cmn_oInformation.bIE && !cmn_oInformation.bMAC ){
                var oTemp, iMax = 20;
                iVersion = ( !iVersion ) ? 3 : iVersion;
                for( var i = iVersion ; i < iMax ; i++ ){
                        try{
                                oTemp = new ActiveXObject( "ShockwaveFlash.ShockwaveFlash." + i );
                                iVersion = i;
                        }catch(e){
                                return ( i > iVersion ) ? iVersion : 0;
                        }
                }
                return iVersion;
        }else{
                return ( !iVersion ) ? false : 0;
        }
}

cmnFlash.prototype.build_object=function( sOptions ){
		var br = ""; // place "\r\n" if need -- breaking line
        var asOptions = sOptions.split( "," );
		var props = Array();
        for( var i = 0 ; i < asOptions.length ; i++){
                asPair = asOptions[i].split( "=" );
                props[asPair[0]] = asOptions[asPair[0]] = unescape( asPair[1] );
        }
        var sHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"';
        sHTML += ' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"';
        if( props.width ){ sHTML += ' width="' + props.width + '"'; }
        if( props.height ){ sHTML += ' height="' + props.height + '"'; }
        if( props.id ){ sHTML += ' id="' + props.id + '"'; }
		sHTML += '>'+br;
		sHTML += '<param name="movie" value="'+props.source+'" />'+br;
		for (var prop in props) {
			if((prop != "width") && (prop != "height") && (prop != "source") && (prop != "id"))
			sHTML += '<param name="'+prop+'" value="'+props[prop]+'" />'+br;
		}
        sHTML += '<embed type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="' + props.source + '" width="' + props.width + '" height="' + props.height + '"';
        if( props.id ){ 
			sHTML += ' name="' + props.id + '"'; 
			sHTML += ' id="' + props.id + '"'; // not required
		}
		for (var prop in props) {
			if((prop != "width") && (prop != "height") && (prop != "source") && (prop != "id"))
			sHTML += ' '+prop+'="'+props[prop]+'"';
		}
        sHTML += '></embed></object>';
        return sHTML;
}
