$(document).ready(function(){	
	Cufon.replace('.avenir a', { fontFamily: 'Avenir LT Std', hover: {}});
	Cufon.replace('.avenir', { fontFamily: 'Avenir LT Std'});
	Cufon.replace('#navbar > ul > li > a:not(.active, .semiActive)', { fontFamily: 'Avenir LT Std', hover: { textShadow: '0px -1px #00195A' }});
	Cufon.replace('#navbar > ul > li > a.active, #navbar > ul > li > a.semiActive', { fontFamily: 'Avenir LT Std', textShadow: '0px -1px #00195A'});
	Cufon.replace('#navbar > ul > li > ul li a', { fontFamily: 'Avenir LT Std', hover: {}});
	Cufon.now();
	
	$('#navbar > ul > li ul').hide();
	$('#navbar > ul > li').each(function(){
		var posX		= $(this).offset().left - $('#global .center').offset().left;
		var posX_sub	= 0;
			
		if (posX + $(this).children('ul').outerWidth() > $(this).parent().outerWidth())
		{
			posX_sub = $(this).outerWidth() - $(this).children('ul').outerWidth();
		}
			
		$(this).children('ul').css({ left: posX_sub + 'px' });
		
		$(this).hover(function(){
			$(this).addClass('hover');
			$(this).children('ul').show();
		},
		function(){
			$(this).removeClass('hover');
			$(this).children('ul').hide();
		});
	});
});
