
var hasFlash;

function checkFlash() {
  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 ) ) >= 5;
  }
  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.5" ) ) ) \n' );
    document.write( '</script>' );
  }
  if( hasFlash == null || hasFlash == 0 ) hasFlash = false;
}

function insertAsset( pathAndFlashFilename, pathAndStaticFilename, assetWidth, assetHeight ) {
  var assetTag = "";
  var extDot = pathAndFlashFilename.indexOf( "." );
  var idName = pathAndFlashFilename.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=9,0,0,0" \n';
    assetTag += ' id="' + idName + '" width="' + assetWidth + '" height="' + assetHeight + '"> \n';
    assetTag += '<param name="allowScriptAccess" value="sameDomain" /> \n';
	assetTag += '<param name="movie" value="' + pathAndFlashFilename + '" /> \n';
    assetTag += '<param name="quality" value="high" /> \n';
    assetTag += '<embed src="' + pathAndFlashFilename + '" quality="high" allowScriptAccess="sameDomain" \n';
    assetTag += ' swLiveConnect="false" width="' + assetWidth + '" height="' + assetHeight + '" \n';
    assetTag += ' type="application/x-shockwave-flash" \n';
    assetTag += ' pluginspage="http://www.macromedia.com/go/getflashplayer"></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 );


}
