window.addEvent('domready', function(){

    /*
    *  create left nav Accordion instance
    */
   
    var show = 1;
    
    
    if($('accordionDetails') != null){
        var myAccordion = new Accordion($('accordionDetails'), 'a.toggler', 'ul.slider', {
            opacity: false,
            show: show,
            onActive: function(toggler, slide){
                $(toggler.id).getParent().addClass('active');
            },
            onBackground: function(toggler, slide){
                $(toggler.id).getParent().removeClass('active');
            }
        });
    }   

        var productTypeAccordion = new Accordion($('productTypeAccordion'), 'a.productTypetoggler', 'ul.productTypeslider', {
            opacity: false,
            alwaysHide: true,
            display: -1,
            onActive: function(toggler, slide){
                $('productTypesList').setStyle('margin-top','10px')
            },
            onBackground: function(toggler, slide){
                 $('productTypesList').setStyle('margin-top','0px')
            }
        });

});

/*
*  function used to swap out Body tag classes
*  that will change out background image
*
*  param: collectionNameState
*/
function changeCollection(collectionName){
    //alert('changeCollection');
    if(collectionName=='stateFreshSelected'){
        $$('body').addClass('products-fc');
        $$('body').removeClass('products-je');
        $$('body').removeClass('products-ss');
    }else if(collectionName=='stateJoyfulSelected'){
        $$('body').addClass('products-je');
        $$('body').removeClass('products-fc');
        $$('body').removeClass('products-ss');
    }else if(collectionName=='stateSoothingSelected'){
        $$('body').addClass('products-ss');
        $$('body').removeClass('products-fc');
        $$('body').removeClass('products-je');
    }
}

function determine(collectionName){
    if(collectionName=='stateFreshSelected'){
        return 0;
    }else if(collectionName=='stateJoyfulSelected'){
        return 1;
    }else if(collectionName=='stateSoothingSelected'){
        return 2;
    }
}

