jQuery.ajaxSetup({async:false});
jQuery.getScript('/wp-content/themes/bethania/scripts/jquery-plugins/tipsy/javascripts/jquery.tipsy.js');
jQuery.ajaxSetup({async:true});

jQuery(function( $ ) {
	$('.nyroModal').nyroModal();
	if( $('#sidebar').height() < $('#content').height() ) {
		$('#sidebar').height( $('#content').height() + 'px' );
	}
	else if( $('#content').height() < $('#sidebar').height() ) {
		$('#content').height( $('#sidebar').height() + 'px' );
	}
	
	$('.bod-bio div').each(
		function() {
			if(window.location.hash === 'undefined' || window.location.hash.slice(1).length <= 0 || $(this).parent().attr('id') != window.location.hash.slice(1)) {
				$(this).hide();
			}
		}
	);
	
	$('.bod-bio h2').live('click',
		function(event) {
			$(this).parent().siblings().children('.bod-bio div').hide();
			/*$(this).next('div').toggle();*/
			$(this).parent().find('div').toggle();
			/*event.preventDefault();
			var parentID = $(this).parents('div.bod-bio');
			window.location.hash = $(parentID).attr('id');*/
		}
	)
	.each(
		  function() {
			  $(this).html('<a>' + $(this).html() + '</a>');
		  }
	);
	
	$('.bod-bio h2 a')
	.css('cursor','pointer')
	.attr('title','Click to hide or expand')
	.tipsy({gravity: 'w'});
	
	$('.accordion').accordion();
});

