$(document).ready(function(){
  $('input.productToggleSprite').click(function(){
    // Parse out the number from the second class
    var num = $(this).attr('class').split(' ')[1].split('-').pop();

    // Toggle the class on the input
    $(this).toggleClass('product-active');

    // Slide toggle the div matching the class (plus the number parsed from the input class)
    $('.product-details-extended-' + num).slideToggle('slow');
    
    // Wouldn't need to jump through the above hoops if the content had either a
    // clean ID or the dom was in a clear heirachry
  });

  $('input.relatedToggleSprite').click(function(){
    var num = $(this).attr('class').split(' ')[1].split('-').pop();
    $(this).toggleClass('related-active');
    $('.related-products-extended-' + num).slideToggle('slow');
  });
});
