jQuery(document).ready( function() {
	
	jQuery('.stl-slider').stlSlider({
		easing: "easeInOutExpo",        	// Anything other than "linear" or "swing" requires the easing plugin
		autoPlay: false,                 	// This turns off the entire FUNCTIONALY, not just if it starts running or not.
		delay: 5000,                    	// How long between slide transitions in AutoPlay mode
		startStopped: false,            	// If autoPlay is on, this can force it to start stopped
		animationTime: 600,             	// How long the slide transition takes
		hashTags: true,                 	// Should links change the hashtag in the URL?
		pauseOnHover: true,           		// If true, and autoPlay is enabled, the show will pause on hover
		leftOffset: 148 					// optional value to push the content away from the left margin
	});

	jQuery("#nav > li").hover(
		function () {
			jQuery(this).find('> a').addClass('nav-highlight');
			jQuery(this).find('ul:first').css({visibility: "visible",display: "none"}).show();
		}, 
		function () {
			jQuery(this).find('> a').removeClass('nav-highlight');
			jQuery(this).find('ul:first').css({visibility: "hidden"});
		}
	);
	
	// begin code to prevent navigating to landing pages
	jQuery('.page-item-5 > a').click( function() {
		return false;
	});
	
	jQuery('.page-item-18 > a').click( function() {
		return false;
	});
	
	jQuery('.page-item-119 > a').click( function() {
		return false;
	});
	
	jQuery('.page-item-26 > a').click( function() {
		return false;
	});
	
	jQuery('.page-item-327 > a').click( function() {
		return false;										 
	});
	// end nav landing page prevention
	
	
	jQuery.mask.masks = jQuery.extend(jQuery.mask.masks,{
		'exp-date':{ mask: '1939' },
		'numeric':{ mask: '9', type: 'repeat' },
		'alpha':{ mask: 'a', type: 'repeat' }
	});
	
	jQuery('.mask-input').setMask( {autoTab: false});
	
	jQuery('#daily-submit-link').click( function(){
		if( jQuery('#daily-prayer-form #GRCategory2').val() == '' || jQuery('#daily-prayer-form #GRCategory3').val() == '' ){
			jQuery('#daily-confirmation').hide();
			jQuery('#daily-error').fadeIn("slow");
		} else {
			jQuery('#daily-error').hide();
			jQuery.post(jQuery('#daily-prayer-form').attr("action"), jQuery('#daily-prayer-form').serialize(), function(data) {
				jQuery('#daily-confirmation').fadeIn("slow");
			});
		}
		return false;
	});
	
	jQuery('#weekly-submit-link').click( function(){
		if( jQuery('#weekly-prayer-form #GRCategory2').val() == '' || jQuery('#weekly-prayer-form #GRCategory3').val() == '' ){
			jQuery('#weekly-confirmation').hide();
			jQuery('#weekly-error').fadeIn("slow");
		} else {
			jQuery('#weekly-error').hide();
			jQuery.post(jQuery('#weekly-prayer-form').attr("action"), jQuery('#weekly-prayer-form').serialize(), function(data) {
				jQuery('#weekly-confirmation').fadeIn("slow");
			});
		}
	});
	
	jQuery('#newsletter-submit-link').click( function(){
		if( jQuery('#newsletter-form #GRCategory2').val() == '' || jQuery('#newsletter-form #GRCategory3').val() == '' ){
			jQuery('#newsletter-confirmation').hide();
			jQuery('#newsletter-error').fadeIn("slow");
		} else {
			jQuery('#newsletter-error').hide();
			jQuery.post(jQuery('#newsletter-form').attr("action"), jQuery('#newsletter-form').serialize(), function(data) {
				jQuery('#newsletter-confirmation').fadeIn("slow");
			});
		}
	});
});

