$(document).ready(function(){
 var body_class = $('body').attr('class');

 /*See if the active page - lies in a subcategory*/
 var location = $('#product_navigation>ul>li').index($('li#' + body_class));
 if(location < 0){
    $('li#' + body_class).parent('ul').addClass('nohide');
 }
 /*Create the array of ul's to be hidden - do not include if the active class is same as body class or if it's in a subcategory*/
 var prod_groups = $('#product_navigation ul ul').not('.' + body_class).not('.nohide');

  $(prod_groups).each(function(){
    $(this).hide();
    $(this).parent('li').hover(function(){
      $(this).addClass('alight');
      $(this).find('ul').stop(true, true).slideDown();
      },function(){
      $(this).removeClass('alight');
      $(this).find('ul').slideUp();
    });
 });

 /*For the mini-image gallery*/
  $('.thumbs li:eq(0)').addClass('active');
        $('.large_prod_img_bdr h3').text($('.thumbs img:eq(0)').attr('alt'));
        $('.thumbs img').click(function(){
          var target = $(this).attr('src');
          var title = $(this).attr('alt');
            $('.large_prod_img_bdr img').attr('src',target.replace('_thumb.jpg','.jpg'));
            $('.large_prod_img_bdr h3').text(title);
            $(this).parent().addClass('active').siblings().removeClass('active');
        });

})
