$(document).ready(function() {
    
  $(".dropdown dt a").click(function() {

    var dropID = $(this).closest("dl").attr("id");

    if ($("#"+dropID+" dd ul.opened").length) {
      $('ul.opened').slideToggle(200).removeClass('opened');
    } else {
      $('ul.opened').slideToggle(200).removeClass('opened');
      $("#"+dropID+" dd ul").slideToggle(200).addClass('opened');
    }
    return false; 
  
  });
  
  $(".dropdown dd ul li a").click(function() {
    var dropID = $(this).closest("dl").attr("id");
    var text = $(this).html();
    var selVal = $(this).find(".dropdown_value").html();
    $("#"+dropID+" dt a").html(text);
    $("#"+dropID+" dd ul").hide().removeClass('opened');

    // get clips here


    var extra = $(this).attr('href');
    var theClips = loadClips(currentSection, currentTag, 0, extra);
    $('#containerCatVids .slider').html(theClips);
    $('#numPages').val($('#newNumPages').val());
    $('.videoPageCount').html('Page '  + currentSet + ' of ' + $('#newNumPages').val());
    $('#containerCatVids .prev').hide();





  
    //Calcutron();
  
    return false; 
  });
  
  $("dl[class!=dropdown]").click(function() {
    $(".dropdown dd ul").hide();
    $('ul.opened').removeClass('opened');
    return false; 
  });
  
  $('body').click(function() {
    $(".dropdown dd ul").hide();
    $('ul.opened').removeClass('opened');
    return true; 
  });

});



function filterResults(filter) { 
  alert('test');
}
 



