window.onload = function() { Header.init(); };  
var $ = function (item) { return(document.getElementById(item)); };
Header = {
  AjaxScriptLocation : "/surf/includes/general/_CFAjax/AjaxCalls.cfc",
  init : function() {
    try { this.getShoppingCartHeaderDisplay(); }   catch(e) {}
    try { this.getNavigationLinks(); }         catch(e) {}
    try { this.getFooterVersion(); }         catch(e) {}
    try { this.getLeftNavigation(); }         catch(e) {}
    try { this.getSalesAndPromotions(); }       catch(e) {}
    try { this.insertFooterLinkDirectly([true, 'To link directly to this page: '+ window.location.href.toString() ]); } catch(e) {}
  },
  getShoppingCartHeaderDisplay : function () {
    DWREngine._execute(Header.AjaxScriptLocation, null, 'getClientCart', this.insertCartDisplayContent); 
  },
  getNavigationLinks : function() {
    DWREngine._execute(Header.AjaxScriptLocation, null, 'getNavigation', this.insertNavigation);   
  },
  getFooterVersion : function () {
    DWREngine._execute(Header.AjaxScriptLocation, null, 'getFooterVersion', this.insertFooterVersion); 
  },
  getLeftNavigation : function () {
    DWREngine._execute(Header.AjaxScriptLocation, null, 'getLeftNavigation', this.insertLeftNavigation); 
  },
  getSalesAndPromotions : function () {
    DWREngine._execute(Header.AjaxScriptLocation, null, 'getSalesAndPromotions', this.insertSalesAndPromotions); 
  },
  insertCartDisplayContent : function(result) {
    if ((Boolean(result[0])) && (result[1].length)) {
      var CartDSP_DIV = ($('cartdspCount'));  
      if (Boolean(CartDSP_DIV)) CartDSP_DIV.innerHTML = (result[1]);
      return;
    }
  },
  insertNavigation : function (result) {
    if ((Boolean(result[0])) && (result[1].length)) {
      var NavigationDSP_DIV = ($('navigation_links'));  
      if (Boolean(NavigationDSP_DIV)) NavigationDSP_DIV.innerHTML = (result[1]);
      return;
    }
  },
  insertFooterVersion : function (result) {
    if ((Boolean(result[0])) && (result[1].length)) {
      var FooterVersionDSP_DIV = ($('footer_version'));  
      if (Boolean(FooterVersionDSP_DIV)) FooterVersionDSP_DIV.innerHTML = (result[1]);
      return;
    }
  },
  insertLeftNavigation : function (result) {
    if ((Boolean(result[0])) && (result[1].length)) {
      var LeftNavigationDSP_DIV = ($('left_column_navigation_boutique_menu'));  //left_column_menu
      if (Boolean(LeftNavigationDSP_DIV)) LeftNavigationDSP_DIV.innerHTML = (result[1]);
      return;
    }
  },
  insertSalesAndPromotions : function (result) {
    if ((Boolean(result[0])) && (result[1].length)) {
      var SpecialFeaturesDSP_DIV = ($('special_features'));  
      if (Boolean(SpecialFeaturesDSP_DIV)) SpecialFeaturesDSP_DIV.innerHTML = (result[1]);
      return;
    }
  },
  insertFooterLinkDirectly : function (result) {
    if ((Boolean(result[0])) && (result[1].length)) {
      var FooterLinkDirectlyDSP_DIV = ($('footer_link_directly'));  
      if (Boolean(FooterLinkDirectlyDSP_DIV)) FooterLinkDirectlyDSP_DIV.innerHTML = (result[1]);
      return;
    }
  }
};
