// FLASHCODE.JS

  var 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;

  var Version4Plus = 
    (((navigator.appName == "Netscape") &&
    (parseInt(navigator.appVersion) >= 4)) || 
    ((navigator.appName == "Microsoft Internet Explorer") && 
    (parseInt(navigator.appVersion) >= 4)));

  var Version5Plus = false; // default value before being tested.

  NavUserAgent = navigator.userAgent;
  NavUserAgent = NavUserAgent.toLowerCase();
  NavAppName = navigator.appName;
  NavAppName = NavAppName.toLowerCase();

  var IsWindows = (NavUserAgent.indexOf("win") != -1);

  var IsMac = (NavUserAgent.indexOf("mac") != -1);

  var IsOpera = false; // Default value before testing below.
  if (NavUserAgent.indexOf("opera") != -1)
    {
     IsOpera = true;
    };

  var IsWebTV = false; // Default value before testing below.
  // WebTV is also known as MSNTV and is also offered by Sony.
  // They are all the same.
  if (NavAppName.indexOf("webtv") != -1)
    {
     IsWebTV = true;
    };

  // Detect IE browser and versions. This code also requires the IsOpera code and
  // the IsWebTV above.
  var IsIE = false; // Default value before testing below.
  var IEVersion = 0; // Default value before testing below.
  // Note that IEVersion must end up being a number and not a string.
  if (navigator.appVersion.indexOf("MSIE") != -1)
    {
     IsIE = true;
     if ((!IsOpera) && (!IsWebTV))
       {
        TheSplitString = navigator.appVersion.split("MSIE");
        // TheSplitString[0] is now the portion of the string before "MSIE".
        // TheSplitString[1] is now the portion of the string after "MSIE".
        IEVersion = parseFloat(TheSplitString[1]);
        // IEVersion is now the first number sequence encountered in the string
        // that follows "MSIE".
        if (isNaN(IEVersion))
          {
           IEVersion = 0;
          };
       };
     if ((IsOpera) || (IsWebTV))
       {
        IsIE = false;
        IEVersion = 0;
       };
     if (IsMac)
       {
        if ((IEVersion >= 4) && (IEVersion < 5.2))
          {
           // IE versions less than 5.2 on the Mac are flakey so change the version number to 3.9.
           // The number must be exactly 3.9 due to the FlakeyBrowser testing further down.
           IEVersion = 3.9;
          };
       };
    };

  // Detect Netscape browser and versions. Mozilla 1.0 and higher shows up as
  // Netscape 6 and behaves the same.
  var IsNetscape = (NavAppName.indexOf("netscape") != -1);
  var NetscapeVersion = 0; // Default value before testing below.
  // Note that NetscapeVersion must end up being a number and not a string.
  if (IsNetscape)
    {
     NetscapeVersion = parseFloat(navigator.appVersion);
     if (isNaN(NetscapeVersion))
       {
        NetscapeVersion = 0;
       };
     if (NetscapeVersion == 5)
       {
        NetscapeVersion = 6;
        NetSplitStringArray = NavUserAgent.split("/");
        // This now creates an array of each portion of the string before or
        // after each "/" found in the string. NetSplitStringArray[0] is the
        // portion before the first "/", etc.
        // There should be 3 "/"'s which means that the detailed version info
        // (just for Netcape 6+) will follow the last "/".
        if (NetSplitStringArray)
          {
           if (NetSplitStringArray.length == 4)
             {
              NetscapeVersionNmbr = parseFloat(NetSplitStringArray[3]);
              if (isNaN(NetscapeVersionNmbr))
                {
                 // If a valid version number was not returned then reset the
                 // default to 6.
                 NetscapeVersionNmbr = 6;
                } else {
                        if (NetscapeVersionNmbr > 6)
                          {
                           NetscapeVersion = NetscapeVersionNmbr;
                          };
                       };
             };
          };
       };

     if ((NetscapeVersion > 3.99) && (NetscapeVersion < 4.4))
       {
        // Early versions of Netscape 4 are too flakey. As a result those versions
        // are treated as if they are not Netscape 4+ browsers. Version4Plus and
        // isNetscape both stay as true.
        // The number must be exactly 3.9 due to the FlakeyBrowser testing further down.
        NetscapeVersion = 3.9;
       };
     if (IsMac)
       {
        if ((NetscapeVersion >= 4) && (NetscapeVersion < 5))
          {
           // Netscape 4 on the Mac is flakey so change the version number to 3.9.
           // The number must be exactly 3.9 due to the FlakeyBrowser testing further down.
           NetscapeVersion = 3.9;
          };
       };
    };

  var FlakeyBrowser = false;// Default value before testing below.

  if ((NetscapeVersion == 3.9) || (IEVersion == 3.9) || (IsWebTV))
    {
     // There are some functions where Version4Plus is true, but where the function is
     // not appropriate for some borderline browsers. So all version 4 browsers running
     // on a Mac (5 plus are OK), all Netscape 4.0x browsers, and all WebTV/MSN TV browsers
     // are all identified with FlakeyBrowser set to true. This allows for easy testing
     // elsewhere in the code for the major exeptions.  The NetscapeVersion code and the
     // IEVersion code all have previously set these browser versions to exactly 3.9.
     FlakeyBrowser = true;
    };

  Version5Plus = false; // Default value before testing below.
  if (Version4Plus)
    {
     if (!FlakeyBrowser)
       {
        if ((IEVersion >= 5) || (NetscapeVersion >= 5))
          {
           Version5Plus = true;
          };
       };
    };

  // The GetThisWindowsInnerSizes() function returns the variables:
  // WindowsInnerWidth and the WindowsInnerHeight.
  //
  var ThisPageIsAParentFrameset = false;  // This MUST be manually specified and do NOT delete it.
  //
  // Manually enter true or false depending on the circumstances in which this SELF CONTAINED
  // UNIVERSAL CODE function is being used.
  //
  // This variable is necessary to toggle a change in how IE 5.5 browsers are handled depending
  // on whether this universal code is used on a typical page, or whether it has been placed in a
  // parent entry page frameset where the child frame sizes are written based on the values of the
  // WindowsInnerWidth and WindowsInnerHeight variables, BEFORE a body tag is encountered
  // (if one even exists).
  //
  // This code works under all of the browsers tested (Netscape 4+, IE 4+, IE 5, IE 5.5, IE 6,
  // FireFox, Web TV / MSN TV and the Sony PSP), regardless of the DTD header used, and
  // whether or not the page is the parent of a frameset, is in the frameset, or is
  // contained within an IFrame.  With two exceptions, this function can be successfully
  // called from within the head section of the code.  This first exception is IE 4, which will
  // return zero values unless the function is called again after the body tag has been written.
  // The second exception is IE 5.5 ONLY if ThisPageIsAParentFrameset has been set to false.
  // Then it too will return zero values unless the function is called again after the body tag has
  // been written.  This is necessary as IE 5.5 content pages that are within frames will otherwise
  // ignore the frameset that they are in and falsely return the width of the entire browser viewport.
  // This results in a value that appears to be valid but is actually way too large.  This does NOT
  // occur in IE 5.0 or IE 6+ browsers.  This problem is also not an issue where an IE 5.5 browser
  // is writing an entry page parent frameset based on sizes that must be detected before the body
  // tag is written.  That is why the ThisPageIsAParentFrameset variable is required to be manually
  // entered, so that it can toggle how the code handles IE 5.5 browsers depending on these various
  // circumstances.  Of the IE 5+ and 6+ browsers, the various exceptions that are in place strictly
  // for IE 5.5 have been exhaustively tested and while they seem strange, they are definitely true.
  //
  // The WindowsInnerWidth and WindowsInnerHeight variables do NOT include the
  // area containing the vertical scrollbar and border, but DO include the page margins.
  // The height of the area containing the horizontal scrollbars (if present) is IGNORED.
  // It is ASSUMED that it is NOT PRESENT as it cannot be dynamically and reliably detected.
  //
  // These variables must be globally declared outside of the function.
  var WindowsInnerWidth = 0;  // Default value before being tested.
  var WindowsInnerHeight = 0;  // Default value before being tested.
  //
  function GetThisWindowsInnerSizes() {

    // This function returns the full inner width and height of the browser window.
    // See the detailed notes above for more information on exactly what is measured
    // and for exceptions, etc.
  
    WindowsInnerWidth = 0;  // Default value is reset before being tested.
    WindowsInnerHeight = 0;  // Default value is reset before being tested.

    // To avoid problems, this is set to correct for a little larger than the
    // the largest common scrollbar and border width correction found as
    // a result of my extensive testing.
    MaxScrollBarAndBorderWidthCorrection = 24;

    // To avoid problems, this is set to correct for a little larger than the
    // the largest common border height correction found as a result of
    // my extensive testing.
    MaxBorderHeightCorrection = 6;

    // NOTE: It is important that you DO NOT CHANGE THE ORDER OF THESE TESTS.
    // This testing approach is supported under JS 1.1. (everything from Netscape 3+, IE4+, etc)

    if ((typeof self.innerWidth != "undefined") && (self.innerWidth != 0))
      {
        // For almost all non IE browsers including FireFox, MSN TV, Opera, the PSP & Netscape 4 to 7.
        // Note that in my tests this was the most reliable method for non IE browsers.
        WindowsInnerWidth = self.innerWidth;
        WindowsInnerHeight = self.innerHeight;

        // Correct for the width of the vertical scrollbar and border area as THIS CANNOT BE DETECTED.
        // This is NOT done on smaller handheld devices and MSN TV/Web TV where no
        // scrollbars are used.  The assumption is that if it has a screen width (not browser width)
        // that is larger than 550 pixels wide, then a scrollbar is likely used and is present. We 
        // also assume that there is no horizontal scrollbar currently in use.
        if ((window.screen) && (window.screen.width) && (screen.width > 550))
          {
            // Now do the scrollbar and border width correction
            WindowsInnerWidth = WindowsInnerWidth - MaxScrollBarAndBorderWidthCorrection;
          };
        // Now do the border height correction.
        if ((window.screen) && (window.screen.width) && (screen.width > 550) && (WindowsInnerHeight > MaxBorderHeightCorrection))
          {
            WindowsInnerHeight = WindowsInnerHeight - MaxBorderHeightCorrection;
          };

      } else {
                 // Now test for IE 5.5 and based on the value of the previously defined and manually
                 // assigned ThisPageIsAParentFrameset variable, assign the correct value to the
                 // SkipDocumentElementTest variable, so that the code will branch accordingly.

                 var ThisBrowserIsIE55 = (window.navigator.appVersion.indexOf("IE 5.5") > 0);

                 var SkipDocumentElementTest = false;  // Default value before being tested below.

                 if ((ThisBrowserIsIE55) && (ThisPageIsAParentFrameset == false))
                   {
                    SkipDocumentElementTest = true;  // Skip the DocumentElement section as it
                    // is a content page running under IE 5.5 which would otherwise return results that
                    // appear to be valid but are false (too large) if this page is within a frameset.
                   };

                 if ((typeof document.documentElement != "undefined") && (typeof document.documentElement.offsetWidth != "undefined") && (document.documentElement.offsetWidth != 0) && (SkipDocumentElementTest == false))
                   {
                     // This method will slowly replace the other methods over time.  It is currently
                     // mainly used for IE 5+ browsers EXCEPT IE 5.5 where the ThisPageIsAParentFrameset
                     // variable is false.  See the notes at the top of this function for the complete details.
                     // This method is also flakey for non IE browsers, so it should only be used for those
                     // browsers when self.innerWidth is not available.  Doing things this way will also
                     // avoid problems with older browsers.

                     // Note that offsetWidth must be used instead of clientWidth as clientWidth changes
                     // whenever the vertical scrollbar becomes active. That causes a problem as the 
                     // WindowsInnerWidth starts as one value right after the body tag is written and then
                     // changes whenever the page content becomes long enough to activate the vertical
                     // scrollbar.  So instead the width is taken without regard to the vertical scrollbar and
                     // then is manually corrected to adjust for the width of the scrollbar.  Note that
                     // Mozilla/FireFox varies as to whether or not clientWidth accepts or ignores the
                     // scrollbar in its calculations, which is another reason why self.innerWidth (where
                     // available) was used in the previous code section.

                     WindowsInnerWidth = document.documentElement.offsetWidth;
  	       WindowsInnerHeight = document.documentElement.offsetHeight;

                     // Now do the scrollbar and border width correction
                     if (WindowsInnerWidth > MaxScrollBarAndBorderWidthCorrection)
                       {
                         WindowsInnerWidth = WindowsInnerWidth - MaxScrollBarAndBorderWidthCorrection;
                       };
                      
                     // Now do the border height correction.
                     if (WindowsInnerHeight > MaxBorderHeightCorrection)
                       {
                         WindowsInnerHeight = WindowsInnerHeight - MaxBorderHeightCorrection;
                       };

                    } else {
                               if ((document.all) && (document.body) && (typeof document.body.offsetWidth != "undefined") && (document.body.offsetWidth != 0))
                                 {
                                  // For IE 4.x and IE 5.5 browsers (where ThisPageIsAParentFrameset is false).
                                  // IE 5.0 and IE 6+ browers (plus IE 5.5 browsers where the 
                                  // ThisPageIsAParentFrameset variable is true), use the previous method.
                                  // Of the IE 5+ browsers, only IE 5.5 is buggy with that method so is 
                                  // (depending on the circumstances) filtered out and passed on to this 
                                  // method. When this method is used, the values can only be read if this
                                  // function is called AFTER the body tag has been written.  Otherwise the
                                  // WindowsInnerWidth and WindowsInnerHeight variables will be returned
                                  // with zero values.

                                  // Note that offsetWidth must be used instead of clientWidth as clientWidth
                                  // changes whenever the vertical scrollbar becomes active. That causes a
                                  // problem as the WindowsInnerWidth starts as one value right after the
                                  // body tag is written and then changes whenever the page content becomes
                                  // long enough to activate the vertical scrollbar.  So instead the width is
                                  // taken without regard to the vertical scrollbar and then is manually
                                  // corrected to adjust for the width of the scrollbar.

   	                    WindowsInnerWidth = document.body.offsetWidth;
	                    WindowsInnerHeight = document.body.offsetHeight;

                                  // Now do the scrollbar and border width correction
                                  if (WindowsInnerWidth > MaxScrollBarAndBorderWidthCorrection)
                                    {
                                      WindowsInnerWidth = WindowsInnerWidth - MaxScrollBarAndBorderWidthCorrection;
                                    };
                                  
                                  // Now do the border height correction.
                                  if (WindowsInnerHeight > MaxBorderHeightCorrection)
                                    {
                                      WindowsInnerHeight = WindowsInnerHeight - MaxBorderHeightCorrection;
                                    };

                                 };
                             };
                };
  };

  // Code for function that is the JavaScript equivalent of the VBScript "Replace" command.
  // A typical call would be:
  // TheNewString = ReplaceInString(TheStringBeingModified,"/","\/");
  //
  function ReplaceInString(originalString,searchText,replacementText) {

    originalString = originalString + ""; // convert to string
    var strLength = originalString.length;
    var txtLength = searchText.length;
    if ((strLength == 0) || (txtLength == 0))
      {
       return originalString;
      };
    var LocInString = originalString.indexOf(searchText);
    if ((!LocInString) && (searchText != originalString.substring(0,txtLength)))
      {
       return originalString;
      };
    if (LocInString == -1)
      {
       return originalString;
      };
    var newstr = originalString.substring(0,LocInString) + replacementText;
    if (LocInString + txtLength < strLength)
      {
       newstr += ReplaceInString(originalString.substring(LocInString + txtLength,strLength),searchText,replacementText);
      };
    return newstr;
  };

  // Detect whether Flash is supported or not.
  //
  // This detection code is deliberately placed near the top of the page before any calls
  // are made to the parent or top frame that could cause any security errors when the site
  // is within a different web site such as VancouverCar.Net. Such an error can abort the
  // execution of the rest of this code file, which is why this code is called here first
  // before any potential problem calls.
  //
  // A number of required variables are declared first and then the following call is made:
  // IsFlashSupported = CheckForFlashSupport();
  // IsFlashSupported will be true or false depending on the results.
  //
  LowestVersionFlashPlayerRequired = 4; // Must be a number.
  winIEpass = false; // Default value before testing below.
  if ((IEVersion >= 4) && (IsWindows))
    {
     winIEpass = true;
    };
  NNpass = false; // Default value before testing below.
  if (NetscapeVersion >= 4)
    {
     NNpass = true;
    };
  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(".") - 2));
       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 = 50' + '\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();
  //
  // Note: Mac cannot detect Flash via code, so automatically set all Mac Netscape 6.2+ browsers to 
  // indicate that Flash is supported.  IE5 on Mac does not support it properly.
  if (IsMac)
    {
     if ((NetscapeVersion >= 6.2) || (IEVersion >= 5.2))
       {
        IsFlashSupported=true;
       };
    };

  // CODE TO DYNAMICALLY WRITE THE FLASH DISPLAY CODE.
  // 
  // A typical call would be:
  //
  // if (Version5Plus) 
  //   {
  //    // Parameters for the function below are: 
  //    // WriteFlashOrDefaultImageCode(FlashFileNameWithNoExtOrDir, FlashFileNameWithExtAndDir, FlashFileWidth, FlashFileHeight, FlashBGColorAsHexString, CenterFlashDisplay, FlashTransparency, StretchFlashDisplay, StretchFlashMultiplierForAvailContentWidth, StretchFlashIgnoreResizingWithinPixelWidthRange, StretchFlashMinimumPixelWidth, StretchFlashMaximumPixelWidth, AltImageFullFileName, AltImageFileWidth, AltImageFileHeight, AltImageFileAltTag) {
  //
  //    WriteFlashOrDefaultImageCode("s80vrwelc","vrflash/s80vrwelc.swf","480","345", "#FFFFFF","CenterFlashOn","TransparentFlashBackgroundOn","StretchFlashOn",".88","15","480","950","vrflash/s80vrwelc.jpg","480","345","Welcome to Volvo of Richmond in Vancouver BC!");
  //    // NOTE: For home page Flash effects that have a TRANSPARENT Flash promo over top of it, it
  //    // is VERY IMPORTANT that BOTH the home page Flash file and the promo have FlashTransparency
  //    // set to "TransparentFlashBackgroundOn".
  //   };
  // 
  // When you need to write an alternate image for browsers that DO NOT SUPPORT FLASH
  // but NEED AN ANCHOR TAG LINK, simply leave the last 4 paramaters as empty strings.
  // This way no alternate image info will be dynamically written to the page. Then follow this
  // function call with an "if (!IsFlashSupported)" routine that dynamically writes the
  // alternate image with anchor tag link code, as required.
  //
  // There would also be a ClrFlashAltTagImg.gif displayed before the flash code with a height of 10 and 
  // the alt text would be added that would match the desired alt text for the flash sequence.
  //
  // Something like the following would follow the flash sequence for non script, older browsers and the print mode: 
  // <div class="BasicDisplayMode"><center><div class="Centered"><img src="vrflash/s80vrwelc.jpg" width="480" height="345" border="0" alt="Your Vancouver Volvo dealer in the Richmond Auto Mall, Volvo of Richmond." /></div></center></div>
  // 
  //
  // Set the global variable that will indicate whether the page contains a Flash sequence.
  var DynamicPromoLayerCallingPageIsAFlashPage = false;
  // This global variable is changed to true only if the function to display a Flash routine
  // is successfully called. This variable may be used by other functions (such as the code
  // to display a floating promo ad layer), which may need to alter it's behavious if it is
  // being displayed over an existing Flash animation. An example of that is when a transparent
  // Flash promo ad layer is being displayed over a Flash sequence on the calling page and the
  // browser is Netscape version 4, 6 or 7, which can't handle this properly.
  //
  function WriteFlashOrDefaultImageCode(FlashFileNameWithNoExtOrDir, FlashFileNameWithExtAndDir, FlashFileWidth, FlashFileHeight, FlashBGColorAsHexString, CenterFlashDisplay, FlashTransparency, StretchFlashDisplay, StretchFlashMultiplierForAvailContentWidth, StretchFlashIgnoreResizingWithinPixelWidthRange, StretchFlashMinimumPixelWidth, StretchFlashMaximumPixelWidth, AltImageFullFileName, AltImageFileWidth, AltImageFileHeight, AltImageFileAltTag) {

    if (Version5Plus)
      {
       // First set some default variables in case they haven't been defined.

       // If CenterFlashDisplay is not set to CenterFlashOff then the default is on.
       if (CenterFlashDisplay != "CenterFlashOff")
         {
          CenterFlashDisplay = "CenterFlashOn";
         };      

       // Make sure that a value for ThisPageIsCurrentlyBeingPrinted has been defined. If not
       // set it to false.
       if (!window.ThisPageIsCurrentlyBeingPrinted)
         {
          ThisPageIsCurrentlyBeingPrinted = false;
         };
       // If this page is being printed display the static image file instead of the Flash file.
       if (ThisPageIsCurrentlyBeingPrinted)
         {
          IsFlashSupported = false;
         };

       // Check to make sure that all of the parameters are present to for stretching or
       // shrinking the Flash animation depending on the available width for content on the page.
       if ((StretchFlashDisplay == "StretchFlashOn") && (IsFlashSupported))
         {
          if ((parseFloat(StretchFlashMultiplierForAvailContentWidth) < 0) || (parseFloat(StretchFlashMultiplierForAvailContentWidth) > 1))
            {
             StretchFlashDisplay = "StretchFlashOff";
            };
          if (parseInt(StretchFlashIgnoreResizingWithinPixelWidthRange) < 0)
            {
             StretchFlashDisplay = "StretchFlashOff";
            };
          if (parseInt(StretchFlashMinimumPixelWidth) < 2)
            {
             StretchFlashDisplay = "StretchFlashOff";
            };
          if (parseInt(StretchFlashMaximumPixelWidth) < 2)
            {
             StretchFlashDisplay = "StretchFlashOff";
            };
          if (WindowsInnerWidth < 50)
            {
             StretchFlashDisplay = "StretchFlashOff";
            };
          if (MarginSize < 1)
            {
             StretchFlashDisplay = "StretchFlashOff";
            };
          if (WindowsInnerWidth - (2 * MarginSize) < 10)
            {
             StretchFlashDisplay = "StretchFlashOff";
            };
         };
       // Now recalculate the Flash animation size if specified and supported.
       if ((StretchFlashDisplay  == "StretchFlashOn") && (IsFlashSupported))
         {
          // Testing shows that many flash animations that are stretched to larger 
          // percentage ratios of the available screen width (such as 88%) work better
          // as a smaller percentage (such as 77%), if the site does not use side by
          // side frames (such as on interim noframe versions of the site). If that is
          // the case then the StretchFlashMultiplierForAvailContentWidth is modified here
          // using StretchFlashMultiplierCorrection values assigned in the sitewide.js code.
          if ((StretchFlashMultiplierForAvailContentWidth > .7) && (StretchFlashMultiplierForAvailContentWidth < 1) && (ThisSiteUsesSideBySideFrames != true))
            {
             StretchFlashMultiplierCorrectionToSubtractForNoFrameMode = 0; // Default value.
             // Start with the default value for the smaller resolutions.
             StretchFlashMultiplierCorrectionToSubtractForNoFrameMode = StretchFlashMultiplierCorrectionToSubtractForNoFrameModeIfInnerWidthLessThan950;
             if (WindowsInnerWidth > 949)
               {
                StretchFlashMultiplierCorrectionToSubtractForNoFrameMode = StretchFlashMultiplierCorrectionToSubtractForNoFrameModeIfInnerWidthBetween950And1200;
                if (WindowsInnerWidth > 1199)
                  {
                   StretchFlashMultiplierCorrectionToSubtractForNoFrameMode = StretchFlashMultiplierCorrectionToSubtractForNoFrameModeIfInnerWidthGreaterThan1200;
                  };
               };
             if (DisableSiteWide_StretchFlashMultiplierCorrectionToSubtractForNoFrameMode)
               {
                StretchFlashMultiplierCorrectionToSubtractForNoFrameMode = 0;
               };
             if ((StretchFlashMultiplierCorrectionToSubtractForNoFrameMode > 0) && ((StretchFlashMultiplierForAvailContentWidth - StretchFlashMultiplierCorrectionToSubtractForNoFrameMode) > .5))
               {
                StretchFlashMultiplierForAvailContentWidth = StretchFlashMultiplierForAvailContentWidth - StretchFlashMultiplierCorrectionToSubtractForNoFrameMode;
               };
            };
          OriginalFlashFileWidth = parseInt(FlashFileWidth);
          OriginalFlashFileHeight = parseInt(FlashFileHeight);
          CurrentAvailContentWidth = parseInt(WindowsInnerWidth) - (2 * parseInt(MarginSize));
          NewFlashFileWidth = CurrentAvailContentWidth * parseFloat(StretchFlashMultiplierForAvailContentWidth);
          NewFlashFileWidth = parseInt(NewFlashFileWidth);

          // Now correct the new value if it is smaller than the minimum width or wider than
          // the maximum width.
          if (NewFlashFileWidth <= parseInt(StretchFlashMinimumPixelWidth))
            {
             NewFlashFileWidth = parseInt(StretchFlashMinimumPixelWidth);
            };

          if (NewFlashFileWidth >= parseInt(StretchFlashMaximumPixelWidth))
            {
             NewFlashFileWidth = parseInt(StretchFlashMaximumPixelWidth);
            };

          // Now test that the new width is an even number and correct it if necessary.
          if (2 * (parseInt(NewFlashFileWidth / 2)) != NewFlashFileWidth) 
            {
             // It is not an even number so correct it.
             NewFlashFileWidth = NewFlashFileWidth - 1;
            };
          // Now check if the new value is more than the range that the resizing is to be 
          // ignored in and if so, whether the image should be enlarged or shrunk.
          FlashShouldBeEnlarged = false; // default value before the testing below.
          FlashShouldBeShrunk = false; // default value before the testing below.
          if (NewFlashFileWidth > (parseInt(OriginalFlashFileWidth) + parseInt(StretchFlashIgnoreResizingWithinPixelWidthRange)))
            {
             FlashShouldBeEnlarged = true;
            };
          if (NewFlashFileWidth < (parseInt(OriginalFlashFileWidth) - parseInt(StretchFlashIgnoreResizingWithinPixelWidthRange)))
            {
             FlashShouldBeShrunk = true;
            };

          // Now calculate and assign the new Flash sizes if they need to be enlarged.
          if (FlashShouldBeEnlarged)
            {
             FlashEnlargeMultiplier = parseInt(NewFlashFileWidth) / parseInt(OriginalFlashFileWidth);
             NewFlashFileHeight = parseInt(parseInt(OriginalFlashFileHeight) * parseFloat(FlashEnlargeMultiplier));

             // Now test that the new height is an even number and correct it if necessary.
             if (2 * (parseInt(NewFlashFileHeight / 2)) != NewFlashFileHeight) 
               {
                // It is not an even number so correct it.
                NewFlashFileHeight = NewFlashFileHeight - 1;
               };
             
             // Assign the new Flash file sizes.
             FlashFileWidth = NewFlashFileWidth;
             FlashFileHeight = NewFlashFileHeight;
            };

          // Now calculate and assign the new Flash sizes if they need to be shrunk.
          if (FlashShouldBeShrunk)
            {
             FlashShrinkMultiplier = parseFloat(parseInt(NewFlashFileWidth) / parseInt(OriginalFlashFileWidth));
             NewFlashFileHeight = parseInt(parseInt(OriginalFlashFileHeight) * parseFloat(FlashShrinkMultiplier));

             // Now test that the new height is an even number and correct it if necessary.
             if (2 * (parseInt(NewFlashFileHeight / 2)) != NewFlashFileHeight) 
               {
                // It is not an even number so correct it.
                NewFlashFileHeight = NewFlashFileHeight - 1;
               };
             
             // Assign the new Flash file sizes.
             FlashFileWidth = NewFlashFileWidth;
             FlashFileHeight = NewFlashFileHeight;
            };
         };

       var FlashString = '';

       if (IsFlashSupported) 
         {
          // Flash (and the version) is supported here so write the Flash file information

          // It is very important NOT to include any string replace functions for the backslash (with the escape backslash combination)
          // as that code causes ALL SORTS of unexpected problems with Firefox when the Flash file is not in the same directory as the
          // calling code.

          // Assign some default values if they haven't been assigned.
          if (FlashBGColorAsHexString == "")
            {
             FlashBGColorAsHexString = "#FFFFFF";
            };

          if (FlashTransparency != "TransparentFlashBackgroundOff")
            {
             FlashTransparency = "TransparentFlashBackgroundOn";
            };
          if (CenterFlashDisplay != "CenterFlashOff")
            {
             FlashString = FlashString + '<center><div class=\"Centered\">';
            };
          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 + '<param name=\"movie\" value=\"';
          FlashString = FlashString + FlashFileNameWithExtAndDir + '\" \/>';
          FlashString = FlashString + '<param name=\"quality\" value=\"best\" \/>';
          FlashString = FlashString + '<param name=\"scale\" value=\"showall\" \/>';
          FlashString = FlashString + '<param name=\"bgcolor\" value=\"';
          FlashString = FlashString + FlashBGColorAsHexString + '\" \/>';
          // Now write the transparent background mode if requested and if not in print mode.
          if (!ThisPageIsCurrentlyBeingPrinted)
            {
             // The transparent mode causes a variety of problems in print mode including a known
             // bug which can turn the flash movie upside down after printing or print preview
             // when the transparent mode is enabled.
             if (FlashTransparency == "TransparentFlashBackgroundOn")
               {
                FlashString = FlashString + '<param name=\"wmode\" value=\"transparent\" \/>';
               };
            };
          FlashString = FlashString + '<embed name=\"' + FlashFileNameWithNoExtOrDir;
          FlashString = FlashString + '\" src=\"' + FlashFileNameWithExtAndDir + '\"';
          // Now write the transparent background mode if requested and if not in print mode.
          if (!ThisPageIsCurrentlyBeingPrinted)
            {
             // The transparent mode causes a variety of problems in print mode including a known
             // bug which can turn the flash movie upside down after printing or print preview
             // when the transparent mode is enabled.
             if (FlashTransparency == "TransparentFlashBackgroundOn")
               {
                FlashString = FlashString + ' wmode=\"transparent\"';
               };
            };
          FlashString = FlashString + ' quality=\"best\" scale=\"showall\"';
          FlashString = FlashString + ' bgcolor=\"' + FlashBGColorAsHexString + '\"';
          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>';
          if (CenterFlashDisplay != "CenterFlashOff")
            {
             FlashString = FlashString + '<br \/><\/div><\/center>';
            };
          document.write('<div class=\"DynamicDisplayMode\">' + FlashString + '<\/div>');
          // Indicate that this page is a page that contains a Flash sequence. 
          DynamicPromoLayerCallingPageIsAFlashPage = true;
         };

       var AltImageString = '';

       if (!IsFlashSupported) 
         {
          if (AltImageFullFileName > "")
            {
             // Flash (or the version) is not supported here so write the alternate image
             // information.

             // It is very important NOT to include any string replace functions for the backslash (with the escape backslash combination)
             // as that code causes ALL SORTS of unexpected problems with Firefox when the Flash file is not in the same directory as the
             // calling code.

             if (CenterFlashDisplay != "CenterFlashOff")
               {
                AltImageString = '<center><div class=\"Centered\">';
               };
             AltImageString = AltImageString + '<img src=\"';
             AltImageString = AltImageString + AltImageFullFileName + '\"';
             if (parseInt(AltImageFileWidth) > 0)
               {
                AltImageString = AltImageString + ' width=\"' + AltImageFileWidth + '\"';
               };
             if (parseInt(AltImageFileHeight) > 0)
               {
                AltImageString = AltImageString + ' height=\"' + AltImageFileHeight + '\"';
               };
             AltImageString = AltImageString + ' border=\"0\" alt=\"';
             AltImageString = AltImageString + AltImageFileAltTag + '\" \/>';
             if (CenterFlashDisplay != "CenterFlashOff")
               {
                AltImageString = AltImageString + '<br \/><\/div><\/center>';
               };

             document.write('<div class=\"DynamicDisplayMode\">' + AltImageString + '<\/div>');
            };
         };
      };
  };
  // END CODE TO DYNAMICALLY WRITE THE FLASH DISPLAY CODE.

