$(document).ready(function() {

	$("#ministriesHeader a").toggle(
		function() {
			$("#ministries").slideDown(500);
			$(this).addClass("active");
		},function() {
			$("#ministries").slideUp(300);
			$(this).removeClass("active");
		}
	);

	// Notice the use of the each() method to acquire access to each elements attributes
	$('.sermonLinks a[title]').each(function()
		{
			$(this).qtip({
			show: { delay: 0 },
			style: {
				tip: { corner: 'topLeft' },
				name: 'light'
			},
			position: {
				adjust: { x: 0, y: 0 },
				corner: {
					target: 'bottomMiddle',
					tooltip: 'topLeft'
				}
			}
		});
	});

	$("#searchBtn").hover(
		function() {
			$(this).addClass("btnSearchHover");
		},
		function() {
			$(this).removeClass("btnSearchHover");
		}
	);
	
	$("#searchBtn").click(
		function() { $(this).addClass("btnSearchActive"); }			  
	);
	
	$("#navigation li").hover(
		function() {
			$(this).children("ul").show();
			$(this).children("ul").attr({
					style: "z-index:1000; display:block;",
				});
			$(this).addClass("in-progress");
		},
		function() {
			$(this).children("ul").attr({
					style: "z-index:1; display:none;",
				});
			$(this).removeClass("in-progress");
			$("li.activeNav").children("ul").show();
		});
});