function hideHiddenFacets() {
  $('.hiddenfacet').hide();
  
  $('div.facet').each(function() {
    $('.hiddenfacet:last', this).after('<li><a class="facetshow" href="#" title="More">More&hellip;</a></li>');
    $('.facetshow', this).toggle(function() {
      $('.hiddenfacet', $(this).parent().parent()).slideDown("fast");
      $(this).attr('title', 'Less');
      $(this).html('Less&hellip;');
    }, function() {
      $('.hiddenfacet', $(this).parent().parent()).slideUp("fast");
      $(this).attr('title', 'More');
      $(this).html('More&hellip;');
    });
  });
}

$(document).ready(function() {
	  // Add font controls
      $('#header').prepend('<p id="pagecontrols"><a href="#" class="fontdec" title="Decrease font size" accesskey="r">Decrease font size</a><a href="#" class="fontinc" title="Increase font size" accesskey="t">Increase font size</a><a href="#" class="contrast contrast-dark" title="Switch to light on dark reading mode" accesskey="l">Switch to light on dark reading mode</a><a href="#" class="contrast contrast-light" title="Switch to dark on light reading mode" accesskey="d">Switch to dark on light reading more</a></p>');
      var cookieSize = $.cookie("oofontsize");
      if (cookieSize) {
        $('body').css('fontSize', cookieSize +'px');
      }

      $('p#pagecontrols a.fontdec').click(function() {
          var newSize = parseFloat($('body').css('fontSize'), 10) * 0.8;
          if (newSize < 10) { newSize = 10; }
          $('body').css('fontSize', newSize +'px');
          $.cookie("oofontsize", newSize, { expires: 7 });
      });
      $('p#pagecontrols a.fontinc').click(function() {
          var newSize = parseFloat($('body').css('fontSize'), 10) * 1.2;
          if (newSize > 24) { newSize = 24; }
          $('body').css('fontSize', newSize +'px');
          $.cookie("oofontsize", newSize, { expires: 7 });
      });

      // Contrast controls
      var contrastMode = $.cookie("oomode");
      if (contrastMode == 'lightondark') {
          $('link#lightondark').removeAttr('disabled');
          $('link#darkonlight').attr('disabled', 'disabled');
      }
      $('p#pagecontrols a.contrast-dark').click(function() {
          // Change mode to dark on light
          $('link#darkonlight').attr('disabled', 'disabled');
          $('link#lightondark').removeAttr('disabled');
          $.cookie("oomode", "lightondark", { expires: 7 });
	  });
	  $('p#pagecontrols a.contrast-light').click(function() {
          $('link#darkonlight').removeAttr('disabled');
          $('link#lightondark').attr('disabled', 'disabled');
          $.cookie("oomode", "darkonlight", { expires: 7 });
      });
});