// BEHAVIOUR: SITES PAGE (SLIDESHOW, etc)

// (c) 2006 Toowoomba Motor Village - all rights reserved



// 'MAIN' - called when complete page loaded with images, etc
// Initially, only start slideshow projector if broadband (to ensure responsiveness on low-bandwidth); however,
// when page fully downloaded (hence cached), & then re-entered , slideshow will download even if low-bandwidth.

function hostLoaded ()
{
  try
  {
      var PAGELOAD_SLOW_SECS = 8.0;
      var pageLoad_secs = ((new Date()).getTime() - hostLoaded.pageLoadStartTime) / 1000;
      if ( pageLoad_secs >= PAGELOAD_SLOW_SECS )  { return; }

      new Projector (
                       'consult2',            // target elementID for slideshow
                       4,                   // slide-duration in secs - for 'normal' play
                       true,                // on-pause: true == RETAIN current-slide, false == REWIND to start  
                       true,                // playmode: true == AUTO-PLAY of slides,  false == DEMAND-PLAY (hover)
                       10,                  // auto-play: pause-duration (use zero if on-demand-play)
                       0.1,                 // start delay, in secs (browser breathing-space)
                       'Images',            // slides-folder - relative to page [otherwise use '']
                       'Slide1.jpg',        // mandatory (usually same as src image of image-element)
                       'Slide2.jpg',     // mandatory - at least 2 image URLs are mandatory, more are allowed    
                       'Slide3.jpg',    
                       'Slide4.jpg',    
                       'Slide5.jpg'    
                    );

  }
  catch(e) { }
}




// SCRIPT INITIALISATION
// When page fully loaded, initiate processing, but only if a modern-browser;
// obsolete browsers are not countenanced (as script merely enhances an already competent page).
// This script-page formally binds the page-load event, hence does not use deprecated 'window.onload' event.
// The following is a statement which defines & executes a literal anonymous function
// whose only post-execution effect is normally the event-handler vector
// (in this script, the start-time of page-load is stored as well).
// [review-crossbrowser: consider alternatives to use of 'window-load' event: eg 'window.document.load', etc.]

(
        function (evtHandler)
        {
            try
            {
                evtHandler.pageLoadStartTime = (new Date()).getTime();
                
                var CAPTURE    = false;
                var W3C        = !!(window.addEventListener);
                var MSIE       = !!(window.attachEvent);
                
                if (W3C)  { window.addEventListener('load', evtHandler, CAPTURE); }
                else 
                if (MSIE) { window.attachEvent('onload', evtHandler); }
            }
            catch(e) { }
        }
 )(hostLoaded);                                           // change function-name if name-space clash



// (c) 2006 Ian Brown

// end script
