/*sidNavAccordion for Yahoo! Stores by My Store Solutions. Copyright 2008 4D Internet Solutions, Inc. All rights researved.*/
var aTs, aEs, aLs, aLhs;
function sideNavAccordion(displayUl){
   aTs = $$('li.aTrig');
   aEs = $$('li.aTrig ul');
   if(aTs.length < 1)return;
   accordNav = new Accordion(aTs,aEs,{
         alwaysHide: false,
         opacity: false,
         show: 0,
         onActive: function(toggler, element){
            element.addClass('active');
            toggler.addClass('active');
         },
         onBackground: function(toggler, element){
            element.removeClass('active');
            toggler.removeClass('active');
         }
      }
   );
   
   if(displayUl==null){displayUl=0;}
   accordNav.display(displayUl);
   
   /*
   var curUrl=window.location.href.split('?')[0].split('#')[0];
   var pageName=curUrl.substring((curUrl.lastIndexOf("/")) + 1);
   var el = aLs[aLhs.indexOf(pageName)];
   el = $(el);
   
   if (!el) { // This means we are on the product page, so try the previous page as we do in the advanced bookmark.
      var curUrl2=document.referrer.split('?')[0].split('#')[0];
      var pageName2 = curUrl2.substring((curUrl2.lastIndexOf("/")) + 1);
      var el2 = aLs[aLhs.indexOf(pageName2)];
      el2 = $(el2);
      if(!el2){return;}
      var tog2 = el2.parentNode.parentNode.parentNode;
      accordNav.display(aTs.indexOf(tog2));
      el2.addClass('active');
      return;
   }
   var tog = el.parentNode.parentNode.parentNode;
   accordNav.display(aTs.indexOf(tog));
   el.addClass('active');
   */
}


window.addEvent('domready', function(){
   aTs = $$('li.aTrig');
   aEs = $$('li.aTrig ul');
   aLs = $$('.aEl a');
   aLhs = aLs.getProperty('href');
   //if (aTs >0){sideNavAccordion()}else {window.onload=sideNavAccordion;}
});





