// JavaScript functions for content pages using jQuery to animate the main menu
// written 2009.03.16 by Dan Klassen
// Copyright 2009, Church of the Saviour
//
//
// NOTE: The homepage image cycle function, and the jquery lightbox function do not play well together,
// so the homepage and content pages were given separate js files to avoid the conflict.
//
$(document).ready(function() {
					  
// Pre-load Images from CSS (requires preload-images.js plugin)
	$.preloadCssImages({statusTextEl: '#textStatus', statusBarEl: '#status'});
	
// Show or Hide Submenus
	$("#mainmenu > li > ul").hide(); // hide second level main meny links on document ready.
	$("#subnav ul li:has(.current)").addClass("current"); // Show 'active' menu items in subnav
	
// Main Menu slide effects

	$("#mainmenu > li").click(
		function () { 
			$(this).children("ul").show("slow") ; // fade in the submenu
			$(this).parent().children(".clicked").children("ul").hide("slow"); // fade out previously opened submenu
			$(this).parent().children(".clicked").removeClass("clicked"); // removed clicked class from opened menu
			$(this).addClass("clicked"); // change menuitem class to 'clicked' 
		} 
	);
	$("#mainmenu").hover(
		function () { },// on hover in, do nothing
		function () { 
			$("#mainmenu > li > ul").hide("normal"); // fade out all drop-downs
			$("#mainmenu > li").removeClass("clicked"); // clear clicked class from any drop-downs
		} 
	);
	
// Lightbox Initialization for Photo Gallery Pages
		$(".lightbox").lightbox();	
	
});
