$(document).ready( function(){
	$(".biog").show();

	$("#nopref").click( function(){
		$(".biog").show();
		update_hrefs($(this).attr('id'));
		return false;	
		});

	$("#agriculture").click( function(){
		$(".biog").hide();
		$(".agriculture").show();
		update_hrefs( $(this).attr('id'));
		return false;	
		});

	$("#artscrafts").click( function(){
		$(".biog").hide();
		$(".artscrafts").show();
		update_hrefs( $(this).attr('id'));
		return false;	
		});

	$("#birdwatching").click( function(){
		$(".biog").hide();
		$(".birdwatching").show();
		update_hrefs( $(this).attr('id'));
		return false;	
		});

	$("#churches").click( function(){
		$(".biog").hide();
		$(".churches").show();
		update_hrefs( $(this).attr('id'));
		return false;	
		});

	$("#castles").click( function(){
		$(".biog").hide();
		$(".castles").show();
		update_hrefs( $(this).attr('id'));
		return false;	
		});

	$("#countrywalks").click( function(){
		$(".biog").hide();
		$(".countrywalks").show();
		update_hrefs( $(this).attr('id'));
		return false;	
		});

	$("#filmlocs").click( function(){
		$(".biog").hide();
		$(".filmlocs").show();
		update_hrefs( $(this).attr('id'));
		return false;	
		});

	$("#folklore").click( function(){
		$(".biog").hide();
		$(".folklore").show();
		update_hrefs( $(this).attr('id'));
		return false;	
		});

	$("#gardens").click( function(){
		$(".biog").hide();
		$(".gardens").show();
		update_hrefs( $(this).attr('id'));
		return false;	
		});

	$("#ghosts").click( function(){
		$(".biog").hide();
		$(".ghosts").show();
		update_hrefs( $(this).attr('id'));
		return false;	
		});

	$("#glosaviation").click( function(){
		$(".biog").hide();
		$(".glosaviation").show();
		update_hrefs( $(this).attr('id'));
		return false;	
		});

	$("#glosrealale").click( function(){
		$(".biog").hide();
		$(".glosrealale").show();
		update_hrefs( $(this).attr('id'));
		return false;	
		});

	$("#industrialarch").click( function(){
		$(".biog").hide();
		$(".industrialarch").show();
		update_hrefs( $(this).attr('id'));
		return false;	
		});

	$("#literaryglos").click( function(){
		$(".biog").hide();
		$(".literaryglos").show();
		update_hrefs( $(this).attr('id'));
		return false;	
		});

	$("#foodwine").click( function(){
		$(".biog").hide();
		$(".foodwine").show();
		update_hrefs( $(this).attr('id'));
		return false;	
		});

	$("#manorhouses").click( function(){
		$(".biog").hide();
		$(".manorhouses").show();
		update_hrefs( $(this).attr('id'));
		return false;	
		});

	$("#romancotswolds").click( function(){
		$(".biog").hide();
		$(".romancotswolds").show();
		update_hrefs( $(this).attr('id'));
		return false;	
		});

	$("#sports").click( function(){
		$(".biog").hide();
		$(".sports").show();
		update_hrefs( $(this).attr('id'));
		return false;	
		});

	$("#vernaculararch").click( function(){
		$(".biog").hide();
		$(".vernaculararch").show();
		update_hrefs( $(this).attr('id'));
		return false;	
		});
	
	function update_hrefs(subject){
		$('.contact-member-button').each( function(){
		var href = $(this).attr('href');
		var href_parts = href.split('&');
		var first_half = href_parts[0];
		href = first_half + '&subject=' + subject;
		$(this).attr('href', href);
		});
	} 
}); 