



// Code to check for Flash support (top portion)

// Code to dynamically write Flash code or default image (second portion)

 

// Typical JavaScript code call (made AFTER the code below):

// if (IsFlashSupported == true) { .. code goes here .. };

// or:

// if (IsFlashSupported == false) { ..alternate code goes here .. };

// 





LowestVersionFlashPlayerRequired = 4; // Must be a number

winIEpass = ((navigator.appName.indexOf("Microsoft") != -1) && 

  (navigator.appVersion.indexOf("Windows") != -1)) && 

  (parseFloat(navigator.appVersion) >= 4) ? true : false;

// Opera pretends to be Internet Explorer but doesn't support noscript and other functions

if (navigator.userAgent.toLowerCase().indexOf("opera") != -1) {winIEpass = false;};

NNpass = ((navigator.appName == "Netscape") && 

  (navigator.userAgent.indexOf("Mozilla") != -1) && 

  (parseFloat(navigator.appVersion) >= 4) && 

  (navigator.javaEnabled())) ? true : false;

supportedBrowser = (winIEpass || NNpass) ? true : false;

function Flash_checkForPlugIn() {

  var plugin = (navigator.mimeTypes &&

  navigator.mimeTypes["application/x-shockwave-flash"]) ?

  navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;

  if (plugin) {

    var pluginversion = parseInt(plugin.description.substring(plugin.description.indexOf(".")-1)) 

    if(pluginversion >= LowestVersionFlashPlayerRequired) {return true;}

  }

  return false;

};

// vbscript check for Flash ActiveX control in windows IE

if(supportedBrowser && winIEpass) {

  document.write(

	'<script language=VBScript>' + '\n' +

	'Function Flash_checkForActiveX()' + '\n' +

	'Dim hasPlayer, playerversion' + '\n' +

	'hasPlayer = false' + '\n' +

	'playerversion = 10' + '\n' +

	'Do While playerversion >= LowestVersionFlashPlayerRequired' + '\n' +

	'On Error Resume Next' + '\n' +

	'hasPlayer = (IsObject(CreateObject(\"ShockwaveFlash.ShockwaveFlash.\" & playerversion & \"\")))' + '\n' +

	'If hasPlayer = true Then Exit Do' + '\n' +

	'playerversion = playerversion - 1' + '\n' +

	'Loop' + '\n' +

	'Flash_checkForActiveX = hasPlayer' + '\n' +

	'End Function' + '\n' +

	'<\/script>'

  );

};

function CheckForFlashSupport() {

  if(!supportedBrowser) return false;

  if(NNpass) return (Flash_checkForPlugIn());

  if(winIEpass) return (Flash_checkForActiveX());

};



IsFlashSupported = CheckForFlashSupport();



// End of code checking for Flash support







function WriteFlashOrDefaultImageCode(FlashFileNameWithNoExtOrDir, FlashFileNameWithExtAndDir, FlashFileWidth, FlashFileHeight, FlashBGColorAsHexString, FlashTransparency, AltImageFullFileName, AltImageFileWidth, AltImageFileHeight, AltImageFileAltTag) {

  if (IsFlashSupported == true) 

    {

     // Flash (and the version) is supported here so write the Flash file information

     // Make sure that the directory and file name is properly separated with the "\/" characters

     TheStr = String.fromCharCode(92) + "/";

     if ((FlashFileNameWithExtAndDir.indexOf("http") == -1)           && (FlashFileNameWithExtAndDir.indexOf(TheStr) == -1)) 

       {

        FlashFileNameWithExtAndDir = FlashFileNameWithExtAndDir.replace("/",TheStr);

       };

     // Make sure that the file heights and widths are strings and not numbers:

     FlashFileWidth = FlashFileWidth.toString();

     FlashFileHeight = FlashFileHeight.toString();

     // Assign some default values if they haven't been assigned.

     if (FlashBGColorAsHexString == "")

       {

        FlashBGColorAsHexString = "#FFFFFF";

       };

     if (FlashTransparency == "")

       {

        FlashTransparency = "TransparentFlashBackgroundOff";

       };

     FlashString = '<center>';

     FlashString = FlashString + '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';

     FlashString = FlashString + 'codebase="http://active.macromedia.com/flash4/cabs/swflash.cab#version=4,0,0,0"';

     FlashString = FlashString + ' id="' + FlashFileNameWithNoExtOrDir + '"';

     FlashString = FlashString + ' width="' + FlashFileWidth + '"';

     FlashString = FlashString + ' height="' + FlashFileHeight + '"';

     FlashString = FlashString + '>';

     FlashString = FlashString + '<param name="movie"';

     FlashString = FlashString + ' value="' + FlashFileNameWithExtAndDir + '">';

     FlashString = FlashString + '<param name="quality" value="high">';

     FlashString = FlashString + '<param name="bgcolor" value="' + FlashBGColorAsHexString + '">';

     if (FlashTransparency == "TransparentFlashBackgroundOn")

       {

        FlashString = FlashString + '<param name="wmode" value="transparent">';

       };

     FlashString = FlashString + '<embed name="' + FlashFileNameWithNoExtOrDir + '" src="' + FlashFileNameWithExtAndDir + '"';

     FlashString = FlashString + ' quality="high" bgcolor="#FFFFFF"';

     FlashString = FlashString + ' width="' + FlashFileWidth + '"';

     FlashString = FlashString + ' height="' + FlashFileHeight + '"';

     FlashString = FlashString + ' type="application/x-shockwave-flash"';

     FlashString = FlashString + ' pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">';

     FlashString = FlashString + '</embed>';

     FlashString = FlashString + '</object>';

     FlashString = FlashString + '</center>';



     document.write (FlashString);

    };



  if (IsFlashSupported != true) 

    {

     // Flash (or the version) is not supported here so write the alternate image information

     // Make sure that the directory and file name is properly separated with the "\/" characters

     TheStr = String.fromCharCode(92) + "/";

     if ((AltImageFullFileName.indexOf("http") == -1) && (AltImageFullFileName.indexOf(TheStr) == -1)) 

       {

        AltImageFullFileName = AltImageFullFileName.replace("/",TheStr);

       };

     // Make sure that the file heights and widths are strings and not numbers:

     AltImageFileWidth = AltImageFileWidth.toString();   

     AltImageFileHeight = AltImageFileHeight.toString();

     AltImageString = '<center><img src="';

     AltImageString = AltImageString + AltImageFullFileName + '"';

     AltImageString = AltImageString + ' width="' + AltImageFileWidth + '"';

     AltImageString = AltImageString + ' height="' + AltImageFileHeight + '"';

     AltImageString = AltImageString + ' border="0" alt="';

     AltImageString = AltImageString + AltImageFileAltTag + '"></center><br>';

     document.write (AltImageString);

    };

};







