// JavaScript Document

jQuery(document).ready(function() {
	
	jQuery('.charterLink').click(function(event) {
		
		// Close any boxes that are currently open
		jQuery('.charterLinkAction').html('click to open');
		jQuery('.charterText').hide('slow');
		
		// Get the ID of the link.  We'll use this to do fancy stuff
		var currentId = jQuery(this).attr('id');
		
		if (jQuery('#charter'+currentId+'Text').is(':visible'))
		{
			jQuery('#charter'+currentId+'Text').hide('slow');
			jQuery('#charter'+currentId+'LinkAction').html('click to open');
		}
		else
		{
			jQuery('#charter'+currentId+'Text').show('slow');
			jQuery('#charter'+currentId+'LinkAction').html('click to close');
		}
		
		event.preventDefault();
	});
	
	jQuery(".locationPin").hover(
		function() 
		{
			// Get the ID of the link.  We'll use this to do fancy stuff
			var countryName = jQuery(this).attr('id').replace('mapPin-', '');
			
			jQuery('#locationPopup-'+countryName).show();
		},
		function() 
		{
			// Get the ID of the link.  We'll use this to do fancy stuff
			var countryName = jQuery(this).attr('id').replace('mapPin-', '');
			
			jQuery('#locationPopup-'+countryName).hide();
		}
	);
});