// Javascript

// function is started when page is loaded.
$(function() {
	//loads the bible
	if($("#bible").length) { $("#bible").delay(8000).fadeIn(2000); }
	
	//this changes the background color during the day.
	var d = new Date();
	var thour = d.getHours();
	if(thour >= 18 || thour < 6) {
		$("body").css({'background-color' : '#34607F'});
	}
	//this controls the slide show on the home page
	$('.slideshow').cycle({
		fx:    'scrollDown', 
		easing: 'easeInOutBack',
		pause: 1
	});
	
	// this is the dropdowm meun
	$('li.headlinks').hover(
		function() { $('ul', this).show(); },
		function() { $('ul', this).hide(); }
	);
	// to send the contact page
	if($("#contact").length) {
		$("#contact").submit(function() {
			$("#contact").checkForm('cgi-bin/_cont_mail.php');
			return false;
		});
	}
	//to send the visitor card
	if($("#visitor").length) {
		$("#visitor").submit(function() {
			$("#visitor").checkForm('cgi-bin/_visitor.php');
			return false;
		});
	}
	// if the hall of fame page is there
	if($('#famer').length) {
		// make the links to the famers live by there class
		$(".eachFamer").live("click", function() {
			var str = $(this).find("a").attr('href');
			// load via ajax the famer
			$.get('_fameFinder.php',str,function(data) {
				$('#fame_info').html(data);
			});
			window.scrollTo(0,400);
			return false;
		});
		// find all the famers dynaically
		$('#famer').keyup(function() {
			var str = $('#fameSearch').serialize();
			$.get('_fameFinder.php',str,function(data) {
				$('#famerList').html(data);
			});
		});
	}
});