// HBC College Ministry Javascript Document
$ = jQuery.noConflict();
$ = jQuery;

$ = jQuery.noConflict();
$ = jQuery;

$(document).ready(function(){
	$("#nav > li").hover(
		function(){ $("ul:first", this).css({display: 'block'}); }, 
		function(){ $("ul:first", this).css({display: 'none'}); } 
	);
	$("#nav > li ul li").hover(
		function(){ $("ul:first", this).css({display: 'block'}); }, 
		function(){ $("ul:first", this).css({display: 'none'}); } 
	);
	$("#nav li ul").css({display: 'none'});
	
	if($('#banner').length > 0){ //If element exists
		$('#banner').cycle({
			fx : 'fade',
			speed :  1500,
			pause : 0,
			timeout : 5000,
			random : 0,
			cleartype :  1, // enable cleartype corrections 
			next : '#banner_next',
			prev : '#banner_previous',
			pager : '#banner_pager',
			pagerAnchorBuilder: function(idx, slide) {
				if (idx == 0) {
						return '<li class="one"><a id="one" href="#"></a></li>';
				}
				if (idx == 1) {
						return '<li class="two"><a id="two" href="#"></a></li>';
				}
				if (idx == 2) {
						return '<li class="three"><a id="three" href="#"></a></li>';
				}
				if (idx == 3) {
						return '<li class="four"><a id="four" href="#"></a></li>';
				}
				if (idx == 4) {
						return '<li class="five"><a id="five" href="#"></a></li>';
				}
				if (idx == 5) {
						return '<li class="six"><a id="six" href="#"></a></li>';
				}
				if (idx == 6) {
						return '<li class="seven"><a id="seven" href="#"></a></li>';
				}
				else {
                        return '' + (idx + 1) + '';
                }

			}

		});
	}

});

$(document).ready(function() {
	
	$("a[rel=meridian_group_1]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'centerOnScroll'	: 'true',
		'overlayOpacity'	: '0.5'
	});
	
	$("#google_map").fancybox({
		'scrolling'			: 'no',
		'titlePosition'		: 'inside',
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'centerOnScroll'	: 'true',
		'overlayOpacity'	: '0.5'
	});
	
	$("#google_map_sidebar").fancybox({
		'scrolling'			: 'no',
		'titlePosition'		: 'inside',
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'centerOnScroll'	: 'true',
		'overlayOpacity'	: '0.5'
	});
	
});
	
$(function(){$.fn.scrollToTop=function(){$(this).hide().removeAttr("href");if($(window).scrollTop()!="0"){$(this).fadeIn("fast")}var scrollDiv=$(this);$(window).scroll(function(){if($(window).scrollTop()=="0"){$(scrollDiv).fadeOut("fast")}else{$(scrollDiv).fadeIn("fast")}});$(this).click(function(){$("html, body").animate({scrollTop:0},"slow")})}});
$(function() {
	$("#toTop").scrollToTop();
});
