
$(function() {

	$('#nonprofit-container').tabs({
		load: function (e, ui) {
			
			$(ui.panel).find(".tab-loading").remove();
			
			Cufon.refresh();
			
			var parent = $('#non-profit-menu div.active').attr('parent');
		/*
			$('#nonprofit-wrapper:not(.fcomp)').height($('#'+parent).height());
			
			baseHeight = $('#nonprofit-wrapper').height() - $('#'+parent).height();
						
			$('#nonprofit-wrapper:not(.fcomp)').animate({
				height: baseHeight + $('#'+parent).height() + "px"
			});
*/
				
			activateSlideshow();
	
			$('.ui-tabs-panel').addClass('nonprofit-content');
			
			if(typeof loadNP == 'function')
				loadNP();
			
		},
		select: function (e, ui) {
			
			var $panel = $(ui.panel);
		
			if ($panel.is(":empty"))
				$panel.append('<div class="tab-loading"><img src="/images/loading.gif" /></div>');
				
		},
		ajaxOptions: {
			error: function( xhr, status, index, anchor ) {
				$( anchor.hash ).html("Couldn't load this tab. We'll try to fix this as soon as possible.");
			}
		}
		
	});

	$('#social-media-container').tabs({
		load: function (e, ui) {
			
			$(ui.panel).find(".tab-loading").remove();
			
			Cufon.refresh();
		
		},
		select: function (e, ui) {
			
			var $panel = $(ui.panel);
		
			if ($panel.is(":empty"))
				$panel.append('<div class="tab-loading"><img src="/images/loading.gif" /></div>');
				
		}
		
	});
	
});
