// jQuery script to facilitate showing/hiding of answer
// in the various FAQ pages in the MET website

$().ready(function() {
		//hide all of the answers
		//answers are in div containers with a class of 'answer'
		$('div.answer').hide();	
		
		//toggle display of answer when link is clicked
		$('a.question').toggle(function() {
			$(this).next().show();				   
		}, function() {
			$(this).next().hide();						   
		});
		
		//Text link to expand or hide all answers
		$('a.expand-all').toggle(function(e) {
			$('div.answer').each(function() {
				if ($(this).css('display') == 'none') {
					$(this).prev().click();
				}
			});
			$(this).text('Hide all answers');
			e.preventDefault();
		}, function(e) {
			$('div.answer').each(function() {
				if ($(this).css('display') != 'none') {
					$(this).prev().click();
				}
			});
			$(this).text('Show all answers');
			e.preventDefault();							  
		});
		
		var loc = this.location.href;
   		var anc = loc.split('#');
		$('#' + anc[1]).click(); 
});