/**
 * @file 					common.js
 */
(function($) {
	$(document).ready(function () {
		
		// hover main logo
		$('#logo a').hover(function () {
			$(this).addClass('hover');
		}, function () {
			$(this).removeClass('hover');
		});
		
		// hover acces direct
		$('.shortcuts').hover(function () {
			$('.link', $(this)).addClass('hover');
			$('.linkList', $(this)).show();
		}, function () {
			$('.link', $(this)).removeClass('hover');
			$('.linkList', $(this)).slideUp('fast');
		});
		
		// manage width of main menu items
		var nbItems = $('#mainNav > div > ul > li:not(.first):not(.last)').length;
		if(nbItems == 6) {
			$('#mainNav > * > ul').addClass('sixitems');
		}
		
		// manage submenu show/hide
		var menuAppearDuration = 250;
		$('#mainNav > * > ul > li').hover(function () {
			var elmt = $(this);
			elmt.addClass('select');
			$('#mainNav .decorationTrigger').parent().addClass('hideArrow');
		}, function() {
			var elmt = $(this);
			elmt.removeClass('select');
			$('#mainNav .decorationTrigger').parent().removeClass('hideArrow');
		});
		
		// manage hover on direct access & footer bubble info
		$('#footerLinks').mouseenter(function () {
			$(this).css({'z-index': '2'});
			$('#footer .shortcuts').css({'z-index': '1'});
		});
		
		$('#footer .shortcuts').mouseenter(function () {
			$(this).css({'z-index': '2'});
			$('#footerLinks').css({'z-index': '1'});
		});
				
		$('a.addFav').jFav();
				
	});
})(jQuery);
