// initialise jQuery menus
jQuery(function(){
	jQuery('ul.sf-menu').superfish({
	animation:   {height:'show'},
	speed:       'fast',
	delay:     1200,
	autoArrows:  true
	});
});

// accordian jQuery panels
$(document).ready(function(){
	
	// Hides all panels by default
	$(".accordion .accordionpanel").hide();
	
	// Any clicks on h3's will trigger panel to open, toggles header
    $(".accordion h3").click(function(){
		$(this).next(".accordionpanel").slideToggle("fast")
		$(this).toggleClass("active");
	});
	
	// Toggle for panels that were opened via URL
	$(".accordion a").click(function(){
		$(this).next(".accordionpanel").slideToggle("fast")
	});

// Get's ID from URL anchor and triggers panel.
var elem = location.href.split('#');
	if (elem.length > 1) {
		$('#'+elem[1]).next(".accordionpanel").show();
		$('#'+elem[1]).children().toggleClass("active");
	}
});
