

/*------------faqs.js----------*/

// On DOM load
$(function() {
	// Setup faq links and close buttons
	$('.faqs-list dt a[rel]').click(function() {
		var id = $(this).attr('rel');
		var obj = $('.faqs-list dd#a'+id);
		
		$(this).toggleClass('expanded', !obj.is(':visible'));
		obj.slideToggle();
		return false;
	});
	
	// Setup open all link
	$('h2.category a[rel]').click(function() {
		var id = $(this).attr('rel');
		var expand = ($(this).text() == 'open all') ? true : false;
		
		$('dl#c'+id+' dd').toggle(expand);
		$('dl#c'+id+' dt a[rel]').toggleClass('expanded', expand);
		$(this).text((expand) ? 'close all' : 'open all');
		return false;
	});
	
	// setup close links
	$('p.close a[rel]').click(function() {
			$('.faqs-list dt a[rel="'+$(this).attr('rel')+'"]').click();
			return false;
	});
});
