jQuery(document).ready(function(){
	var which = '';

	// Iterate through each table row:
	jQuery('table.classes tr').each(function(){
		// For those with their first cell containing greater than a 2-digit number, hide the row:
		jQuery(this).children('td:first').filter(function(){
			// Check if this is a parent or child:
			if( jQuery(this).html().length > 2 ){
				// Set our 'which' variable so we know what class to add to the children:
				which = jQuery(this).html().substr(0, 2);

				// Find and designate the parent:
				if( jQuery(this).parent().prev().children('td:first').text() == which ){
					//jQuery(this).parent().prev().addClass('class_parent').children('td:first').prepend('<img src="/images/open.png" height="12px" width="12px" />');
					jQuery(this).parent().prev().addClass('class_parent').css('font-weight', 'bold');
				}
				return true;
			} else{
				return false;
			}
		}).parent().hide().addClass('class_child').addClass(which);
	});

	// Bind parent clicks to show children:
	jQuery('table.classes tr.class_parent').click(function(){
		jQuery('.class_child.' + jQuery(this).children('td:first').text() ).toggle();
	});

	jQuery('table.classes tr:visible:odd').addClass('odd');
});
