/*copied from homepage_1001.js with unneeded functions removed*/

jQuery(function(){
	
	//audiences accordion
	jQuery('ul.accordion').accordion({
		autoHeight: true,
		header: 'h2',
		event: 'mouseover'
	});
	
	jQuery('ul.accordion').show();
	jQuery('ul.accordion').accordion("activate", Math.floor(Math.random()*jQuery('ul.accordion > li').length));
	
	//publications and image slider
	var maxWidth = 0;
	jQuery('.slides-wrapper li').each(function () {
		var thiswidth = jQuery(this).width();
		maxWidth += thiswidth + 2;
	});

	jQuery('.slides-wrapper .slides').css({"width": maxWidth+"px"});

	jQuery('.featured_publications .slides-wrapper').serialScroll({
		items: 'li',
		prev: '.featured_publications .slide_previous',
		next:'.featured_publications .slide_next'
	});

		
	//jump select boxes
	jQuery('.jumpform .submit').hide();
	jQuery('.jumpform select').change(function(){
		jQuery(this).parents('form').submit();
	});
	
	jQuery('.howcanwehelp .jumpform').show(); //hidden by default as it is js-only
	jQuery('.howcanwehelp h3,.howcanwehelp .links > li').hide();
	jQuery('.howcanwehelp .jumpform select').unbind().change(function(){
		jQuery('.howcanwehelp .links > li').hide();
		jQuery('#'+jQuery(this).val()).show();
		return false;
	});
	
});

