//
// detect macromedia flash player
//

// get general browser version and oparating system version.

agent = navigator.userAgent.toLowerCase();

// inquire internet explorer versions.

var ie = ( document.all ) ? true:false
if ( ie ) {
  ie4 = ( agent.indexOf( 'msie 4.' ) != -1 ) ? true:false
  ie5 = ( agent.indexOf( 'msie 5.' ) != -1 ) ? true:false
} else {
  ie4 = 0;
  ie5 = 0;
}

// inquire netscape versions.

var ns = ( document.layers ) ? true:false
var ns6 = ( document.getElementById && !document.all ) ? true:false

// inquire operatig system versions.

var win = ( ( agent.indexOf( "win" ) != -1 ) || ( agent.indexOf( "16bit" ) != -1 ) ) ? true:false
var mac = ( agent.indexOf( "mac" ) != -1 ) ? true:false

var plugin_version = 0;

var pluginspages = new Object();

pluginspages.japanese = "http://www.macromedia.com/jp/shockwave/download/?P1_Prod_Version=ShockwaveFlash&Lang=Japanese";

// inquire flash plugin

var plugin = ( ( navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0 );
if ( plugin ) {
  plugin_version = parseInt( plugin.description.substring( plugin.description.indexOf( "." ) -1 ) );
}

// write source codes

function detectFlashPlayer( objs ) {

  document.open();
  
  if ( objs.file != "" ) {
    
    document.write( '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" id=' + objs.name + ' width=' + objs.width + ' height=' + objs.height + ' name="' + objs.name + '">' + '\n' );
    document.write( '<param name="movie" value="' + objs.swf + '">' + '\n');
    document.write( '<param name="loop" value="'+ objs.loop+'">'+'\n');
    document.write( '<param name="menu" value="'+ objs.menu+'">'+'\n');
    document.write( '<param name="quality" value="' + objs.quality + '">' + '\n');
    document.write( '<param name="bgcolor" value="' + objs.bgcolor + '">' + '\n');
    document.write( '<param name="menu" value="false"' + '>' + '\n');
    
    if ( ( win && ie ) && !( navigator.userAgent.indexOf( "Opera" ,0 ) != -1 ) ) {
      document.write( objs.nonflashsrc ) + '\n';
    }
    
    if ( plugin && plugin_version >= objs.requiredVer ) {
      document.write( '<embed src="' + objs.swf + '" menu="false" quality="' + objs.quality + '" swLiveConnect="' + objs.liveconnect + '" bgcolor=' + objs.bgcolor + ' width=' + objs.width + ' height=' + objs.height + ' type="application/x-shockwave-flash" pluginspage="' + pluginspages[objs.language] + '" name="' + objs.name + '"><\/embed><br>' + '\n' );
    } else {
      if ( !( win && ie ) ) {
        document.write( objs.lowflashsrc ) + '\n';
      }
    }
    
    document.write( '<\/object>' + '\n' );
  }
  
  document.close();

}

