;TT.HOME = 
{
    init: function()
    {
		this.setActiveTab();
		this.checkEzrezError();
    },
	
	/**
	 * Set active and inactive states for tabs (i.e flights, hotels, car hire and insurance)
	 */
	setActiveTab: function()
	{
		$('.tabNav li a').bind('click', function(e)
        { 
			var imgSrc = '';
			
			//Set all tabs to inactive if they are currently active
			imgSrc = $('.active').children().attr('src').slice(0, -11) + '.png';
			$('.active').children().attr('src', imgSrc);
			$('.active').removeClass('active');
			
			//Set this tab to active
			imgSrc = $(this).children().attr('src').slice(0, -4) + '-active.png';
			$(this).children().attr('src', imgSrc);
			$(this).addClass('active');
        });
	},
	
	checkEzrezError: function()
	{
		var currentUrl = window.location.href,
			ezrezErrorMsg = '';
			
		if(currentUrl.indexOf('ERROR_CODE') > -1)
		{
			ezrezErrorMsg = FCL.UTIL.getUrlVar('ERROR_MESSAGE');
			ezrezErrorMsg = ezrezErrorMsg.replace(/\+/g,' ');
			
			$('<div><p>'+ezrezErrorMsg+'</p></div>').dialog(
				{	buttons: 
					{ "Ok": function() 
						{
							$(this).dialog("close"); 
						}
					},
					title: 'Oops'
				});
		};
	}
};
