/**
 * @package tpl_sidebar.js
 * @usage	to be included in files where tpl_sidebar.php is included
 */
$(document).ready(function() {
	$("#aircraft_type").change(function(){
		$("#assoc_name").attr("value",$("#aircraft_type option:selected").text());
	});
	$("a.list_subtypes").click(function(){
		var list_id  = $(this).attr("id");
		var list_id_shown;
		$("ul.subtypes_list").hide("medium");
		if (!list_id_shown)
		{
			$("ul#subtypes_list_"+list_id).show("medium");
			list_id_shown = true;
		}
		else
		{list_id_shown = false;}
		return false;
	});

	$("ul.list_subtypes").css("display", "none");
	$("p.subtypes a").click(function(){
		var toggleId = $(this).attr("class");
		if ($(this).html() == 'Show list of subtypes')
		{
			$(this).html('Hide list of subtypes');
			$("#"+toggleId).slideDown('medium');
		}
		else
		{
			$(this).html('Show list of subtypes');
			$("#"+toggleId).slideUp('medium');
		}
		return false;
	});
});