
var hasFlash;

function checkFlash( argVersion ) {

  if( argVersion == 4 ) argVersion = [4,0,2,0];
  if( !argVersion || argVersion == 5 ) argVersion = [5,0,0,0];
  
  hasFlash = ( navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] ) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
  if( hasFlash ) {
    hasFlash = parseInt( hasFlash.description.substring( hasFlash.description.indexOf( "." ) -1 ) ) >= argVersion[0];
  }
  else if( navigator.userAgent && navigator.userAgent.indexOf( "MSIE" ) >= 0
   && ( navigator.userAgent.indexOf( "Windows 95" ) >= 0
   || navigator.userAgent.indexOf( "Windows 98" ) >= 0
   || navigator.userAgent.indexOf( "Windows NT" ) >= 0 ) ) {
    document.write( '<script language="VBScript"> \n' );
    document.write( 'on error resume next \n' );
    document.write( 'hasFlash = ( IsObject( CreateObject( "ShockwaveFlash.ShockwaveFlash.' + argVersion[0] + '" ) ) ) \n' );
    document.write( '</script>' );
  }
  if( hasFlash == null || hasFlash == 0 ) hasFlash = false;
}

function insertAsset( pathAndStaticFilename, assetWidth, assetHeight ) {
  var assetTag = "";
  var extDot = pathAndStaticFilename.indexOf( "." );
  var pathAndFlashFilename = pathAndStaticFilename.substring( 0, extDot );
  if( hasFlash ) {
    assetTag += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" \n';
    assetTag += ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + argVersion + '" \n';
    assetTag += ' id="' + pathAndFlashFilename + '" width="' + assetWidth + '" height="' + assetHeight + '"> \n';
    assetTag += '<param name="movie" value="' + pathAndFlashFilename + '.swf" /> \n';
    assetTag += '<param name="quality" value="high" /> \n';
    assetTag += '<embed src="' + pathAndFlashFilename + '.swf" quality="high" \n';
    assetTag += ' swLiveConnect="false" width="' + assetWidth + '" height="' + assetHeight + '" \n';
    assetTag += ' type="application/x-shockwave-flash" \n';
    assetTag += ' pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed></object>';
  } else if(! ( navigator.appName && navigator.appName.indexOf( "Netscape" ) >= 0 && navigator.appVersion.indexOf( "2." ) >= 0 ) ) {
    assetTag = '<img src="' + pathAndStaticFilename + '" width="' + assetWidth + '" height="' + assetHeight + '" />';
  }
  return document.write( assetTag );
}