// Custom Javascript Functions Unique to: Biltmore Baptist Church

var subnavTO;

function initSubnav(){
	var staticHeight = $('#am_container').css('paddingTop').replace('px','');
	$('#top').attr('staticHeight', staticHeight);
	$('#top').css('clip', 'rect(0px, 9999px, '+staticHeight+'px, 0px)');
	$('#flash_nav').mouseover(function(){
		clearTimeout(subnavTO);
	});
	$('#flash_nav').mouseout(function(){
		clearTimeout(subnavTO);
		subnavTO = setTimeout("slideUpSubnav()", 1500);
	});
}

function resizeSubnav(flashHeight){
	flashHeight += 30;
	$('#top').attr('flashHeight', flashHeight);
	$('#top').css('height', flashHeight+'px');
	$('#flash_nav').css('height', flashHeight+'px');
}

function slideDownSubnav(){
	var clipHeight = $('#top').attr('flashHeight');
	$('#top').css('clip', 'rect(0px, 9999px, '+clipHeight+'px, 0px)');
}

function slideUpSubnav(){
	var clipHeight = $('#top').attr('staticHeight');
	$('#top').css('clip', 'rect(0px, 9999px, '+clipHeight+'px, 0px)');
}

function initBookList(){
	if($('.book').length > 0){
		$('.book').each(function(i,elem){
			if($(elem).find('.image').html() == null || $(elem).find('.image').html().trim() == ""){
				var slug = $(elem).find('.slug').text().trim();
				$(elem).find('.image').load('/includes/ajax/books.php', {slug:slug});
			}
		});
	}
}