  // SELF CONTAINED FLASH CODE (for ANY browser or device)

  // Some USER DEFINED VARIABLES that must be assigned depending on the circumstances.
  //
  // *** THESE HAVE BEEN REMARKED OUT AS THEY ARE DECLARED IN ADVANCE OF THIS CODE ON THE CALLING PAGE ***
  //
  // UseXHTMLforClosingTags = true; // I.E.  true or false.  Set to true for XHTML version.
  // LowestVersionFlashPlayerRequired = 4; // Must be a number (Flash version 7 is Flash MX).
  //
  // The following lines are required on the calling page ONLY if required to pass variables to a Flash file.
  // The code on this page WILL ALSO handle it properly if the variable is NOT defined on the calling page
  // at all. Variables can only be passed to a Flash file that is Flash version 6 or higher.
  // FlashVarsStringForFlash6Plus = "var1=Hello%20World&var2=first+line%0Dsecond+line";

  ErrorTrappingOn = true; // Set to true or false. If false then error reporting is turned on.

  function errorHandler(errorMessage, url, lineNumber) {

    // All JavaScript errors are trapped. If ErrorTrappingOn is false then an alert box with the error
    // details is also displayed. This code is supported under Netscape 3+ and IE4+ and later.
    if (ErrorTrappingOn == false)
      {
       errormsg  = "This page contains a scripting error.\r\n\r\n";
       errormsg += "Line: "  + lineNumber   + "\r\n";
       errormsg += "Error: " + errorMessage + "\r\n";
       errormsg += "URL: "   + url;
       alert(errormsg);
      };
    event.returnValue = true;
    return true;
  };
  window.onerror = errorHandler;

  // Set some variable default values (before being tested and assigned in the code).
  FlashExistsAndMinFlashVersionIsSupported = false;
  IsIEBrowserOnWindows = false;
  TheFlashString = '';
  TheNonFlashString = '';
  // If the FlashVarsStringForFlash6Plus has not been defined, create it here as a blank string.
  if (!window.FlashVarsStringForFlash6Plus)
    {
      FlashVarsStringForFlash6Plus = "";
    };
  AddedCharsBeforeClosingTagForXHTMLVersion = "";
  if (UseXHTMLforClosingTags)
    {
      AddedCharsBeforeClosingTagForXHTMLVersion = " \/";
    };
  // The Flash code base version for the plug-in download changes depending on the value of the 
  // LowestVersionFlashPlayerRequired variable.
  FlashCodeBaseVersionString = "version=4,0,2,0";  // Default value (Flash MX is version 7) before being assigned below.
  if ((LowestVersionFlashPlayerRequired) && (LowestVersionFlashPlayerRequired == 4))
    {
      FlashCodeBaseVersionString = "version=4,0,2,0";
    };
  if ((LowestVersionFlashPlayerRequired) && (LowestVersionFlashPlayerRequired == 5))
    {
      FlashCodeBaseVersionString = "version=5,0,42,0";
    };
  if ((LowestVersionFlashPlayerRequired) && (LowestVersionFlashPlayerRequired == 6))
    {
      FlashCodeBaseVersionString = "version=6,0,79,0";
    };
  if ((LowestVersionFlashPlayerRequired) && (LowestVersionFlashPlayerRequired == 7))
    {
      FlashCodeBaseVersionString = "version=7,0,19,0";
    };
  if ((LowestVersionFlashPlayerRequired) && (LowestVersionFlashPlayerRequired == 8))
    {
      FlashCodeBaseVersionString = "version=8,0,22,0";
    };
  if ((LowestVersionFlashPlayerRequired) && (LowestVersionFlashPlayerRequired == 9))
    {
      FlashCodeBaseVersionString = "version=9,0,124,0";
    };
     
  // START CODE THAT DETECTS IF FLASH EXISTS AND IF THE MINIMUM REQUIRED FLASH VERSION IS SUPPORTED .
  //
  // This code will set the FlashExistsAndMinFlashVersionIsSupported variable to true if Flash exists and the minimum required version is supported.
  //
  // It tests for any Flash version between the value assigned to the LowestVersionFlashPlayerRequired variable and 20.
  //
  // *** Tested on iPhone, PSP, and on Windows IE, FireFox, Netscape and Opera. ***
  // *** However, the code has been designed to work on ANY type of browser. And if the type ***
  // *** of browser does not support the mimeTypes, plug-in or ActiveX control detection, then ***
  // *** it will set the FlashExistsAndMinFlashVersionIsSupported variable to false so that a non Flash equivalent may be shown. ***
  //
  IsIEBrowserOnWindows = ((navigator.appName) && (navigator.appName == 'Microsoft Internet Explorer') && (navigator.userAgent) && (navigator.userAgent.indexOf("Win") != -1));
  //
  // VBScript check for Flash ActiveX control in IE browsers running on Windows.
  // VBScript is the ONLY method of detecting Flash support on IE browsers that are running on Windows.
  if (IsIEBrowserOnWindows)
    {
      document.write(
      '<sc' + 'rip' + 't lan' + 'gua' + 'ge=VB' + 'Sc' + 'rip' + 't>' + '\n' + 
      'Function Flash_CheckForActiveXonIEBrowserOnWindows()' + '\n' + 
      'Dim hasPlayer, playerversion' + '\n' + 
      'hasPlayer = false' + '\n' + 
      'playerversion = 50' + '\n' + 
      'Do While playerversion >= LowestVersionFlashPlayerRequired' + '\n' +
      'On Er' + 'ror Res' + 'ume Next' + '\n' +
      'hasPlayer = (IsObject(CreateObject(\"ShockwaveFlash.ShockwaveFlash.\" & playerversion & \"\")))' + '\n' + 
      'If hasPlayer = true Then Exit Do' + '\n' +
      'playerversion = playerversion - 1' + '\n' + 
      'Loop' + '\n' +
      'Flash_CheckForActiveXonIEBrowserOnWindows = hasPlayer' + '\n' + 
      'End Function' + '\n' + 
      '<\/s' + 'cri' + 'pt>');
    };
  //
  function CheckForAnyFlashSupport() {
    //
    // Check for Flash mimeType support on all browsers.
    if ((navigator.mimeTypes) && (navigator.mimeTypes["application/x-shockwave-flash"]) && (navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin))
      {
        if ((navigator.plugins) && (navigator.plugins["Shockwave Flash"]))
          {
            pluginversion = parseInt(navigator.plugins["Shockwave Flash"].description.substring(navigator.plugins["Shockwave Flash"].description.indexOf(".") - 2));
            if (pluginversion >= LowestVersionFlashPlayerRequired)
              { 
                FlashExistsAndMinFlashVersionIsSupported = true;
              };
          };
      };
    // Check for Flash ActiveX controls using VBScript for IE browser running on Windows.
    if ((!FlashExistsAndMinFlashVersionIsSupported) && (IsIEBrowserOnWindows))
      {
        FlashExistsAndMinFlashVersionIsSupported = (Flash_CheckForActiveXonIEBrowserOnWindows());
      };
    return FlashExistsAndMinFlashVersionIsSupported;
  };
  //
  FlashExistsAndMinFlashVersionIsSupported = CheckForAnyFlashSupport();
  // The FlashExistsAndMinFlashVersionIsSupported variable will be true if Flash is currently supported in some form.
  //
  // END CODE THAT DETECTS IF FLASH EXISTS AND IF THE MINIMUM REQUIRED FLASH VERSION IS SUPPORTED .

  if (FlashExistsAndMinFlashVersionIsSupported)
    {

      TheFlashString = '<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"';
      TheFlashString = TheFlashString + ' codebase=\"http:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#' + FlashCodeBaseVersionString + '\"';
      TheFlashString = TheFlashString + ' id=\"ccc_homepageflash\" width=\"750\" height=\"405\">';
      TheFlashString = TheFlashString + '<param name=\"movie\" value=\"ccc_homepageflash.swf\"' + AddedCharsBeforeClosingTagForXHTMLVersion + '>';
      if ((FlashVarsStringForFlash6Plus) && (FlashVarsStringForFlash6Plus > "") && (LowestVersionFlashPlayerRequired) && (LowestVersionFlashPlayerRequired >= 6))
        {
          TheFlashString = TheFlashString + '<param name=\"flashvars\" value=\"' + FlashVarsStringForFlash6Plus + '\"' + AddedCharsBeforeClosingTagForXHTMLVersion + '>';
        };
      TheFlashString = TheFlashString + '<param name=\"quality\" value=\"best\"' + AddedCharsBeforeClosingTagForXHTMLVersion + '>';
      TheFlashString = TheFlashString + '<param name=\"scale\" value=\"showall\"' + AddedCharsBeforeClosingTagForXHTMLVersion + '>';

      // IMPORTANT: The key to not having any popup warning bar alerts is to have the page within a frame
      // AND to set the wmode parameter to transparent (BOTH steps are CRITICAL!):
      TheFlashString = TheFlashString + '<param name=\"wmode\" value=\"transparent\"' + AddedCharsBeforeClosingTagForXHTMLVersion + '>';

      TheFlashString = TheFlashString + '<embed name=\"ccc_homepageflash\" src=\"ccc_homepageflash.swf\"';
      if ((FlashVarsStringForFlash6Plus) && (FlashVarsStringForFlash6Plus > "") && (LowestVersionFlashPlayerRequired) && (LowestVersionFlashPlayerRequired >= 6))
        {
          TheFlashString = TheFlashString + ' flashvars=\"' + FlashVarsStringForFlash6Plus + '\"';
        };
      TheFlashString = TheFlashString + ' quality=\"best\" wmode=\"transparent\"';
      TheFlashString = TheFlashString + ' width=\"750\" height=\"405\" type=\"application\/x-shockwave-flash\"';
      TheFlashString = TheFlashString + ' pluginspage=\"http:\/\/www.macromedia.com\/shockwave\/download\/index.cgi?P1_Prod_Version=ShockwaveFlash\">';
      TheFlashString = TheFlashString + '<\/embed><\/object>';


      // *** THIS HAS BEEN DISABLED HERE SO THAT IT MAY BE WRITTEN BY THE CALLING CODE PAGE ***
      // document.write(TheFlashString);


    };

  // *** THIS SECTION IS OPTIONAL AS IT MAY BE ENTIRELY HANDLED BY THE CALLING PAGE CODE ***
  //
  if (!FlashExistsAndMinFlashVersionIsSupported)
    {

      // TheNonFlashString = '<a href=\"http:\/\/www.iamdebtfree.com\/index.html\/\" target=\"_new\">';

      TheNonFlashString = TheNonFlashString + '<img src=\"ccc_photowithoverlays750x405.jpg\" width=\"750\" height=\"405\" border=\"0\" alt=\"CCC Consumer Credit Counselling. Be Debt Free Again.\"' + AddedCharsBeforeClosingTagForXHTMLVersion + '>';

      // TheNonFlashString = TheNonFlashString + '<\/a>';


      // *** NOTE: THE NONFLASH STRING STUFF HAS BEEN DISABLED HERE SO THAT IT CAN BE WRITTEN ON THE CALLING PAGE ***
      // document.write(TheNonFlashString);


    };
