// JavaScript Document

$(function()	{
	/*TES newspaper*/
	$('#publications #extras div.browse_section>div.facet_set>ul').each(function(){$(this).children('li:gt(3)').css('display','none')});
	$('#publications #extras div.browse_section>div.facet_set>a.viewmore').bind('click',{initialNumber:'4'},facetViewMore);
	$('#publications #extras div.browse_section>div.facet_set>a.viewfewer').bind('click',{initialNumber:'4'},facetViewLess);

	$(".browse_section.yaa .heading h3 span").bind("mouseenter mouseleave", function() {
		$(this).toggleClass("hover");
	}).parents(".browse_section").yaa({
		headClass:	"heading",
		contentClass: "facet_set",
		slideActionUsed: true,
		initiallyHidden: true,
		onSlideCallback: function () {
		$(this).children("h3").toggleClass("expanded");
		}
	});
});
//Accordion used on the 'Archive' box
/**
 * yaa (yet another accordion)
 *
 * http://www.604media.com/jquery
 *
 * Copyright (c) 2008 Tim Kraumanis
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 * MODIFIED BY J. FINN 6-Sep-2011
 * Changes the smooth and gradual slide up down action can be replaced with a simple switch for display on & off
 * Also now provides capability for a callback function to be called when the expand-reveal / contract-hide action is complete
 * Version: 2.0a
 */

(function($) {


$.fn.yaa = function(settings) {
		// settings
		settings = $.extend({
		activeClass: "header_highlight",
				headClass: "accordion_heading",
				contentClass: "accordion_content",
				anchor: "",
				initiallyHidden: true,
				slideActionUsed: false,
		slideTime: 300,
		onSlideCallback: function() { }
		}, settings || {});

		return this.each(function() {
		if (settings.initiallyHidden) {
		  $(this).children('.' + settings.contentClass).hide(); 
		}
		$(this).children('.' + settings.activeClass).next('.' + settings.contentClass).slideDown(settings.slideTime);
		$(this).find('.' + settings.headClass).click(
		   function() {
			  ($(this).next('.' + settings.contentClass)[settings.slideActionUsed ? "slideToggle" : "toggle"])()
			  .siblings('.' + settings.contentClass + ':visible').slideUp(settings.slideTime);
			  settings.onSlideCallback.call(this)
				if (settings.anchor) {
				  setTimeout(function()
					  {
						  window.location = settings.anchor.charAt(0) === "#" ? settings.anchor : "#" + settings.anchor;
						}, settings.slideTime * settings.slideActionUsed * 1.125);
					
				}
		});
		
	});

};


})(jQuery);



