/**********************************************************************
* cheslers.category.js - Category and Brand page utilities
*
* Copyright (c) 2009, White Horse Technology Consulting Inc.
* Copyright (c) 2009, Cheslers Shoes Inc.
***********************************************************************/ 

/**********************************************************************
 initCategoryPage - Initiailise our category and brand pages (lists 
 of products)

 Arguments:
   pageType - Will let us differentiate geeneral category and brand pages
              if we need to in the future.
**********************************************************************/
function initCategoryPage(pageType) {
  try {
    if ((pageType == "category") ||
        (pageType == "brand")) {
      // Hide our extended description - we do this in script so that it 
      // is displayed by default for search engines (which don't interpret 
      // script)
      descriptionBlock = document.getElementById("categoryFooter");
      if (descriptionBlock != null) {
        descriptionBlock.style.display="none";
        document.getElementById("categoryExtendedDescriptionLinkMore").style.display="inline";
        }
      else {
        // If there is no header and no footer, hide the dividing line 
        if (!document.getElementById("categoryHeader")) {
          // Doesn't exist on search results page, so catch this
          if (divider = document.getElementById("categoryDescriptionDivider")) {
            divider.style.display="none";
            }
          }
        }
      }
    }
  catch (err) {
    if (debugMessages == true) {
      alert("initCategoryPage: " + err.message);
      }
    }
  } //END: initStorePage


/**********************************************************************
 showCategoryExtendedDescription - Toggle display of extended description

 Arguments:
   show - true to expand extended description, false to collapse it
**********************************************************************/
function showCategoryExtendedDescription(show) {
  try {
    if (show == true) {
      document.getElementById("categoryFooter").style.display="block";
      document.getElementById("categoryExtendedDescriptionLinkMore").style.display="none";
      document.getElementById("categoryExtendedDescriptionLinkLess").style.display="inline";
      }
    else {
      document.getElementById("categoryFooter").style.display="none";
      document.getElementById("categoryExtendedDescriptionLinkLess").style.display="none";
      document.getElementById("categoryExtendedDescriptionLinkMore").style.display="inline";
      }
    }
  catch (err) {
    if (debugMessages == true) {
      alert("showCategoryExtendedDescription: " + err.message);
      }
    }
  } //END: showCategoryExtendedDescription
