/**
*	This JS file creates the toggle function on a table
*	with the class "toggle-table" and uses jQuery.
*/

// Add the functions onLoad
jQuery(document).ready(function() {

	// Add the mouse-over style
	$(".toggle-table .summary").hover(
		function () {
			$(this).addClass("summary-hover");
		},
		function () {
			$(this).removeClass("summary-hover");
		}
	);

	// Hide the extended element
	$(".toggle-table .extended").addClass("extended-closed");

	// Add the toggle function
	$(".toggle-table .summary").toggle(
		function () {
			var tmpId = $(this).attr("id");
			tmpId = tmpId.replace("summary", "extended");
			$('#'+tmpId).addClass("extended-open");
			$('#'+tmpId).removeClass("extended-closed");
			$(this).addClass("summary-open");
			$(this).removeClass("summary-closed");
		},
		function () {
			var tmpId = $(this).attr("id");
			tmpId = tmpId.replace("summary", "extended");
			$('#'+tmpId).addClass("extended-closed");
			$('#'+tmpId).removeClass("extended-open");
			$(this).addClass("summary-closed");
			$(this).removeClass("summary-open");
		}
	);

});
