// JavaScript Document

function initTopNav(){
	var opennav = false;
	var navHeight = $('#glbnav').height();
	$('#glbnav').height(27);
	$('#glbnav_wrapper').css('overflow','visible');
	$('#glbnav_wrapper').css('height','auto');
	$("#site_map").click(function(){
		if(opennav){
			$(this).css({'background-image' : 'url(/images/arrow_down.gif)'});
			$("#glbnav").animate({height:27}, 700);
			opennav = false;
		}else{
			$(this).css({'background-image' : 'url(/images/arrow_up.gif)'});
			$("#glbnav").animate({height:navHeight}, 700);
			opennav = true;
		}
	});
}

function doSearch(e){
	if(isEnterKey(e)) $('#searchForm').submit();
}

function initFindAChurchNav(){
	$('#fnav').children('li').hover(
		function(){
			$(this).attr('class', $(this).attr('class')+' sfhover');
		},
		function(){
			$(this).attr('class', $(this).attr('class').replace(' sfhover',''));
		}
	);
}

function initLightBox(){
	$(function(){
		$("a[rel='lightbox']").lightBox({
			imageLoading: '/images/lightbox-ico-loading.gif',
			imageBtnClose: '/images/lightbox-btn-close.gif',
			imageBtnPrev: '/images/lightbox-btn-prev.gif',
			imageBtnNext: '/images/lightbox-btn-next.gif',
			fixedNavigation: true
		});
	});
}

