$(document).ready(function(){
  $(".sermon:last").addClass('last');
  $('select#select-series, select#select-category, select#select-month, select#select-preacher, select#select-groupby').change(function() {
    var series = $('#select-series option:selected').val();
 		var category = $('#select-category option:selected').val();
 		var month = $('#select-month option:selected').val();
  	var preacher = $('#select-preacher option:selected').val();  
    var group = $('#select-groupby option:selected').val(); 
				
    $('#items').fadeOut("fast").load('/_inc/ajax-sermonsort.php',{
      'series': series,
      'category': category,
      'month': month,
      'preacher': preacher,
      'groupby': group},
      function(){
        $(this).fadeIn("fast");
        doMediaEvents();
      });
    }); 

			 /*  $('select#select-category').change(function() {
	                var val = $('#select-category option:selected').val();
	                var group = "category";
	                    $('#sermons').fadeOut("fast").load('/_inc/ajax-sermonsort.php',{'category':val, 'groupby':group},
	                    function(){
	                        $(this).fadeIn("fast");
	                    });
	               });
               
               $('select#select-month').change(function() {
                var val = $('#select-month option:selected').val();
                var group = "month";
                    $('#sermons').fadeOut("fast").load('/_inc/ajax-sermonsort.php',{'month':val, 'groupby':group},
                    function(){
                        $(this).fadeIn("fast");
                    });
               });

		 

               
               $('select#select-preacher').change(function() {
                var val = $('#select-preacher option:selected').val();
                var group = "preacher";
                    $('#sermons').fadeOut("fast").load('/_inc/ajax-sermonsort.php',{'preacher':val, 'groupby':group},
                    function(){
                        $(this).fadeIn("fast");
                    });
               }); */
});
