/**
 * @projectname     Zuza Hand Made
 * @version         0.0.2 2010.07.14
 * @copyright       Copyright (C) 2008 - 2010 All rights reserved.
 * @license         Comertial
 * @author          Székely Csaba / csaba@szekely.ro / http://www.csaba.szekely.ro
 * 
 * @desc            Product accordion menu script / inspired by : Ryan Stemkoski's accordion_menu
 */

jQuery(document).ready(function() {
      
    //ACCORDION BUTTON ACTION (ON CLICK DO THE FOLLOWING)
    jQuery('.accordionButton').click(function() {

        //REMOVE THE ON CLASS FROM ALL BUTTONS
        jQuery('.accordionButton').removeClass('on');
          
        //NO MATTER WHAT WE CLOSE ALL OPEN SLIDES
         jQuery('.accordionContent').slideUp('normal');
        // closing slide button
        jQuery('.accordion_expand_btn').html('+');                          
        
        //IF THE NEXT SLIDE WASN'T OPEN THEN OPEN IT
        if(jQuery(this).next().is(':hidden') == true) {
            
            //ADD THE ON CLASS TO THE BUTTON
            jQuery(this).addClass('on');
              
            //OPEN THE SLIDE
            jQuery(this).next().slideDown('normal');
            // changes open button
            jQuery('.accordion_expand_btn', this).html('-');
         } 
     });
     
     // general expand button action
     jQuery('.accordion_expand_all_btn').click(function() {
        // showing all content
        jQuery('.accordionContent').show();
     });
     
      
    //ADDS THE .OVER CLASS FROM THE STYLESHEET ON MOUSEOVER 
    jQuery('.accordionButton').mouseover(function() {
        jQuery(this).addClass('over');
        
    //ON MOUSEOUT REMOVE THE OVER CLASS
    }).mouseout(function() {
        jQuery(this).removeClass('over');                                        
    });
    
    // CLOSES ALL S ON PAGE LOAD
    jQuery('.accordionContent').hide();
    // the menu expand button 
    jQuery('.accordion_expand_btn').html('+');

    // OPENS THE DIV THAT IS ASSIGNED WITH THE ID open
    jQuery("#open").trigger('click');
    jQuery("#open").find('.accordion_expand_btn').html('-');
}); // end ready func.


