/*-----------------------------------------------------------------------------
 home-body.js

 JavaScript code used by the body (as opposed to the header and footer, not the
 Body tag) of the Home page of Solid Logic's web site.

 Change history (most recent first):

  <1>  02/11/03  Thomas C. Eaton  Created.

 Copyright © 2003 by Solid Logic Computer Solutions Inc.  All rights reserved.
------------------------------------------------------------------------------*/

// If the browser does not support image objects, document.images evaluates
// to "undefined," which the browser treats as false.
if (document.images) {

  var LOGO_COUNT   = 14       // The number of client logos to be displayed.
  var LOGO_TIMEOUT = 8000     // The duration in milliseconds that a client
                              // logo is displayed.
                          
  var logoIndex = 0           // The index into the logos array of the client
                              // logo currently displayed on the Home page.
  var previousLogoIndex = -1  // The index into the logos array of the client
                              // logo previously displayed on the Home page.

  var logos = new Array()     // An array of client logos.

  for (var i = 0; i < LOGO_COUNT; i++) {
    logos[i] = new Image(190, 65)
  }
  
  logos[0].src  = "images/client-logos/allina-logo.gif"
  logos[1].src  = "images/client-logos/amex-logo.gif"
  logos[2].src  = "images/client-logos/att-logo.gif"
  logos[3].src  = "images/client-logos/bosch-logo.gif"
  logos[4].src  = "images/client-logos/ceridian-logo.gif"

  logos[5].src  = "images/client-logos/faribault-foods-logo.gif"
  logos[6].src  = "images/client-logos/fingerhut-logo.gif"
/*  logos[7].src  = "images/client-logos/gmac-rfc-logo.gif"*/
  logos[7].src  = "images/client-logos/holiday-logo.gif"
  logos[8].src  = "images/client-logos/ing-logo.gif"

  logos[9].src = "images/client-logos/ncs-pearson-logo.gif"
  logos[10].src = "images/client-logos/star-tribune-logo.gif"
  logos[11].src = "images/client-logos/toro-logo.gif"
  logos[12].src = "images/client-logos/trane-logo.gif"
  logos[13].src = "images/client-logos/unisys-logo.gif"
}

/*******************************************************************************
 Changes the logo displayed in the Featured Client section of the page.
*******************************************************************************/

function changeFeaturedClient() {
  if (document.images) {
    do {
      logoIndex = Math.floor(Math.random() * LOGO_COUNT)
    } while (logoIndex == previousLogoIndex)
    document.images['featured-client-logo'].src = logos[logoIndex].src
    setTimeout('changeFeaturedClient()', LOGO_TIMEOUT)
  }
}
