/*
 * Function to hide all of the tables and headings
 */
function hideCultureCollectionContent() {
	
	$('#culture-collection-cultures-list table, #culture-collection-cultures-list h2').hide();	
	
}

$(document).ready(function(){
	
	// Hide all of the content
	hideCultureCollectionContent();
	
	// Variable to hold the options for the division select
	var divisionOptions = '';
	
	// Get all of the h2 tags in the culture list div
	$('#culture-collection-cultures-list h2').each(function(){
		
		divisionOptions += '<option value="' + $(this).attr('id') + '">' + $(this).html() + '</option>';
		
	});
	
	// Prepend the divisions select
	$('#culture-collection-cultures-list').prepend('<p>Show me cultures from the division <select id="chooseDivision">' + divisionOptions + '</select></p>');
	
	// Display a division when the select changes
	$('#chooseDivision').change(function(){
		
		// Hide all of the content
		hideCultureCollectionContent();
		
		// Get the chosen value
		var chosenDivision = $('#chooseDivision').val();
		
		// Show the heading and table
		$('#' + chosenDivision + ', #' + chosenDivision + ' + table').show();
		
	});
	
	// Set up the autocomplete for the strain number
	//$('#culture-strain-number').
	
});
