/*
 Hotel Link Bar interaction setup
 */
SHIRE.HotelLinkBar = (function($)
{

	function hidePanel(element)
	{
		// requires an <a> element from the link bar
		$(element).removeClass('active').next('.content').hide();
	}
	
	function showPanel(element)
	{
		// requires an <a> element from the link bar
		$(element).addClass('active').next('.content').show();
	}
	function setup()
	{
		// setup the link actions for the bar
		$('#hotellinkbar li > a').click(function(event)
		{
			if ($(this).hasClass('active')) 
			{
				// turn off
				hidePanel(this);
				
				// hide the freeze panel as we have no active hotel panel
				$('#freezepanel').hide();
			}
			else 
			{
				// turn off all other panels and make links inactive
				hidePanel($('#hotellinkbar li > a'));
				
				// turn on this panel and make link active
				showPanel(this);
				
				// show the freeze panel as we have an active hotel panel
				$('#freezepanel').show();
			}
			
			// prevent the link being followed
			event.preventDefault();
		});
		
		// setup the close button actions in the content
		$('#hotellinkbar .close').click(function(event)
		{
			// turn off the panel which this close button is for
			hidePanel($(this).parent('div').prev('a')[0]);
			
			// hide the freeze panel as we have no active hotel panel
			$('#freezepanel').hide();
			
			// prevent the link being followed
			event.preventDefault();
		});
	}

	return {
		setup: setup
	};
	
}(jQuery));


// initialise click events
//jQuery(document).ready(SHIRE.HotelLinkBar.setup);
