$(document).ready(function() {
    $(".category-list li a.parent").click(function(e) {
        // prevent the click href action
        e.preventDefault(); 

        // next child menu
        var child_menu = $(this).next('ul');
        
        // if child menu is hidden
        if (child_menu.hasClass('hide')) {
          // show the child menu
          child_menu.removeClass('hide');

          // swap background image to collapse
          $(this).css('background-image', 'url(http://static.opalauctions.com/resources/images/but-parent-bg-collapse.jpg)');

        } else {
          // hide the child menu
          child_menu.addClass('hide');

          // swap background image to expand
          $(this).css('background-image', 'url(http://static.opalauctions.com/resources/images/but-parent-bg-expand.jpg)');
        }
    });
});
