// $Id: faqs.js 563 2009-09-15 13:31:49Z pglh $
// A blind-up, blind-down JS lib for FAQ sections organised into <dl>s
// Requires: jquery core and jquery-ui + blind effect

// Version 2 - the "better" version

// Hide the <dt> in each faq
$('html').addClass('js-enabled');

$(document).ready( function()
{
	// Add arrow image
	$('.faq dt').prepend('<img alt="" src="/images/arrow_blue.gif"/>');

	// Add onclick event
	$('.faq dt').click( function()
	{
		// If we aren't already showing this element
		if( $(this).next().css('display') == 'none' )
		{
			// Hide any showing
			$("dt", this.parentNode).each( function()
			{
				if( $(this).next("dd").css('display') != 'none' )
				{
					$(this).next("dd").stop(true, true).hide("blind",{},500);
					this.firstChild.src = '/images/arrow_blue.gif';
				}
			});
			this.firstChild.src = '/images/arrow_blue_down.gif';
			$(this).next("dd").stop(true, true).show("blind",{},500);
		}
	});
});
