(function($){ 
	$(function(){
		// Cufon
		// Cufon.replace('#navigation li a', { hover: true, fontFamily: 'Futura' });
		
		// Dropdown Menu
		$('#navigation ul:first > li').addClass('first-children');
		
		//Cancel if there's only one subnav item
		$length = $('#navigation .current_page_parent ul li, #navigation .current_page_ancestor ul li, #navigation .current_page_item ul li').length;
		if( $length == 1 ) {
			$('#navigation .current_page_parent > ul, #navigation .current_page_ancestor > ul, #navigation .current_page_item > ul').remove();
			$('body').removeClass('page-parent, page-child');
			
			return false;
		}
		
		if ($('#navigation li.current_page_item ul, #navigation li.current_page_ancestor ul, #navigation li.current_page_parent ul').is(':visible')){
			$('body').addClass('hasSubNav');
		}
		
		$('#twitter').hover(
			function(){
				$(this).find('#tweets').stop(true, true).fadeIn(120);
			},
			function(){
				$(this).find('#tweets').stop(true, true).fadeOut(120);
			}
		);
		//modals
        $('#rsvp-click').click(function() { 
            $.blockUI({ message: $('#rsvp'), css: { width: '410px', top: '20%' } }); 
            preventDefault();
        }); 
        $('#subscribe-click').click(function() { 
            $.blockUI({ message: $('#newsletter-subscribe'), css: { width: '410px', top: '20%' } }); 
            preventDefault();
        }); 
 
        $('.cancel').click(function() { 
            $.unblockUI(); 
            return false; 
        }); 
        $('.unblock').click(function() { 
            $.unblockUI(); 
        }); 
        
		//Comments hint box
		$('#commentsform #rules-toggle').show(0);
		$('#commentsform .comment-rules').hide(0);
		$('#commentsform #rules-toggle a').toggle(
			function(){
				$('#commentsform #rules-toggle a').html("hide" );
				$('#commentsform .comment-rules').stop(true,true).slideDown(140);
				return false;
			},
			function(){
				$('#commentsform #rules-toggle a').html("show allowed tags" );
				$('#commentsform .comment-rules').stop(true,true).slideUp(130);
				return false;
			}
		);
	});
})(jQuery);

