﻿///////////////////////////////////////////////////////////////////////////////
//
//  wcoPageManager.js
//
// © 2007-2010 Wco iEnterprise Solutions Pty Ltd. ALL RIGHTS RESERVED.
// This file is licensed as part of the DataPortal 3.0 Managed Web Presence Solution, for details look here: http://www.wco.com.au
//
///////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////
/*<remarks>
Method:      constructor
Description: Instantiates a new instance of the pageManager object, making it ready to receive and process calls to the DataPortal Web service.
Parameters:  [none]
</remarks>*/
HtmlPageManagerObject = function() {
  
  this.bodyElement = positioning.getObject('bodyElement');
  this.titlebarElement = positioning.getObject('titlebarElement');
  this.locationListElement = positioning.getObject('locationListElement');
  this.mainElement = positioning.getObject('mainElement');
  this.footerElement = positioning.getObject('footerElement');
  
}

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/*<remarks>
  Description: Defines the Class methods.
</remarks>*/
HtmlPageManagerObject.prototype = {
  /*<remarks>
  Method:      init
  Description: Initialises the object's members and runs through any required startup procedures.
  Parameters:  [none]
  </remarks>*/
  init: function() {
    this.mainElement.innerHTML = '';

    // now all the elements have completed loading and are correctly positioned,
    // display the ui
    this.titlebarElement.style.display = 'block';
    this.mainElement.style.display = 'block';
    this.footerElement.style.display = 'block';
    
    // load the store locations
    this.storeLocator = new HtmlStoreLocatorObject(this);
    
    // load the slides
    this.slideshow = new HtmlSlideshowObject(this);
    //this.slideshow.start();
  },

  splash: function() {
    this.titlebarElement.style.display = 'block';
    this.mainElement.style.display = 'block';
    this.storeLocator = new HtmlStoreLocatorObject(this);
    
    //var html = '<div id="splashElement" style="width:966px; height:397px; margin:60px 0 0 0; background-image:url(\'ssl/images/VT-Warehouse-Ad-2.jpg\'); background-repeat:no-repeat;">';
    //html += '</div>';
    var html = '<div id="splashElement" style="padding:30px 0 0 0; cursor:pointer;">';
    html += '<p style="color:#FFFFFF; font-family:\'Verdana\', \'Arial\'; font-size:12pt;">[CLOSE and continue to Winter 2010 Collection]</p>';
    html += '<p><img src="ssl/images/VT-Warehouse-Ad-2.jpg" style="width:966px; height:337px; border:0px none" /></p>';
    html += '<p style="color:#FFFFFF; font-family:\'Verdana\', \'Arial\'; font-size:12pt;">[CLOSE and continue to Winter 2010 Collection]</p>';
    html += '</div>';
    var newContent = document.createElement('DIV');
    newContent.id = 'newContent';
    newContent.innerHTML = html;
    newContent.style.display = 'none';
    var splash = newContent.childNodes[0];
    
    this.mainElement.appendChild(splash);
  
    splash.onmouseup = function () {
      positioning.delayStop();
      pageManager.init();
    };

    positioning.delayAction(60000, positioning.createDelegate(this, this.init));
  }

}
