/**
 * @projectname     Demo Shop Project 
 * @version         1.0 2010.09.23
 * @copyright       Copyright (C) 2008 - 2010 All rights reserved.
 * @license         Commercial
 * @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('+');                          
        jQuery('.accordion_expand_btn').css("background-image", "url(templates/standard/img/arrow_categorii_up.jpg)"); 
        
		//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('-');
            jQuery('.accordion_expand_btn', this).css("background-image", "url(templates/standard/img/arrow_categorii_down.jpg)"); 
		 } 
	 });
     
     // 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('+');
    jQuery('.accordion_expand_btn').css("background-image", "url(templates/standard/img/arrow_categorii_up.jpg)"); 

    // OPENS THE DIV THAT IS ASSIGNED WITH THE ID open
    jQuery("#open").trigger('click');
//    jQuery("#open").find('.accordion_expand_btn').html('-');
    jQuery("#open").find('.accordion_expand_btn').css("background-image", "url(templates/standard/img/arrow_categorii_down.jpg)"); 

});

