/**
* Vinter.expandingList()
* Version 1.0
* Updated 4 nov 2008
*
*	Vinter.expandingList() is (c) 2008 Lars Huring, Olov Nilzén and Vinter (www.vinterwebb.se) and is released under the MIT License:
*	http://www.opensource.org/licenses/mit-license.php
*
* SIMPLE USAGE:
* $(".expanding-list").expandingList();
*/

jQuery.fn.expandingList = function(settings) 
{

	/**
	* Default settings
	*/ 
	settings = jQuery.extend({
		content_class: "expanding-list-content",
		trigger_class: "expanding-list-trigger",
		elements: "input",
		trigger: "dt a",
		content_container: "dd",
		fade_speed: "fast",
		showClick: show,
		hideClick: hide
		
	}, settings);


	// Get the elements
	var trigger = jQuery(settings.trigger, this);
	var content = jQuery(settings.content_container, this);

	// Setup styles
	content.css({
		display: "none"
	});
	
	// Wire up events & add classes
	trigger
		.addClass(settings.trigger_class)
		.toggle(settings.showClick, settings.hideClick)
	
	/**
	* Default event handlers
	* can be overridden in settings
	*/
	function show(e)
	{
		content
			.fadeIn(settings.fade_speed)
			.addClass(settings.content_class);
	}
	
	function hide(e)
	{
		content
			.fadeOut(settings.fade_speed)
			.removeClass(settings.content_class);
	}
	
}
