$(document).ready(function()
{
	// Add the information div into the parent of the Institution select box
	$("#rel_member").parent("p").prepend('<div id="institution_info"><\/div>');
	
	// When an option element is clicked within the Institution select box
	$("#rel_member").change(function()
	{
		// Get the title of this institution
		var details = $("#rel_member option:selected").attr("title");
		
		// If 'None' wasn't selected
		if (details)
		{
			// Get the important information out of the title attribute
			var dateRegistered = details.match(/(Date registered): ([0-9]{2}\/[0-9]{2}\/[0-9]{4})/);
			var editorName = details.match(/(Owner): (.{0,50})/);
	
			// Build a definition list of the info, we always have Date registered
			details = ''+
			'<dl>'+
			'	<dt>'+dateRegistered[1]+'<\/dt>'+
			'		<dd>'+dateRegistered[2]+'<\/dd>';
			
			// Institution may not have been assigned an editor
			if (editorName)
			{
				details += ''+
				'	<dt>'+editorName[1]+'<\/dt>'+
				'		<dd>'+editorName[2]+'<\/dd>';
			}
			
			details += '<\/dl>';
		} else {
			details = "";
		}
		
		// Display the changes
		$("#institution_info").html(details);
	});
});