// Create the application
$.application = {
	// Initialize the main object
	init: function() {
		// Enable rounded corners for MSIE
		$('#main-navigation ul.level1 li a').corner('6px tl tr');
		
		// Enable main menu dropdowns for all browsers
		$('#main-navigation .container > ul > li:not(.active)').hover(
			function() {
				$(this).addClass('show-sub-navigation');
				$(this).children('a').css('color', '#333');
				
				// Refresh Cufon when leaving the dropdown
				$(this).bind('mouseleave', function() {
					$(this).parent().children('a').css('color', '#fff');
					Cufon.refresh('#main-navigation>ul>li>a');
				});
			},
			function() {
				$(this).removeClass('show-sub-navigation');
				$(this).children('a').css('color', '#fff');
			}
		);		
	}
};

// Replace text with Cufon
Cufon.replace('h1')('h2')('#main-navigation .container > ul > li:not > a', { textShadow: '0 1px 0 #000' })('#main-navigation .container > ul > li.active > a', { textShadow: 'none' })('#sub-navigation > ul > li > a', { hover: true});

// Initialize the application
$(window).ready(function() {
	// Initialize the main object
	$.application.init();
});
