// JavaScript Document

$(function() {
	if($('#showUs').length) {
		$('#showUs').cycle({
		fx:    'scrollDown', 
		easing: 'easeInOutBack',
		pause: 1
		});
	}
	
	$(".aclink > li").hover(
		function() {
			$(this).css('height','36px');
		},
		function() {
			$(this).css('height','32px');	
		}
	)
	if($("#arrowss").length) {
		$("#slideBox").cycle({'timeout': 5000});	
	}
	if($(".sectionLinks").length) {
		$(".sectionLinks").click(function() {
			$(".catbox").hide();
			labl = $(this).text().replace(/\/[\w\s]*$/g,'');
			
			$('#'+labl).show();
		});
	}
	if($(".tourslides").length) {
		$(".tourslides").cycle({
			cleartype:  true,
			cleartypeNoBg:  true,
			timeout : 5000
		});	
	}
	if($(".farm_food").length) {
		$(".farm_food").mouseover(function() {
			$(".showMore").toggle();
		});	
		$(".farm_food").mouseout(function() {
			$(".showMore").toggle();
		});	
	}
});
		 
(function($) {
	
	$("#showUs > img").live("click",function() {
		if($(this).attr("title").length) {		
			window.location = $(this).attr("title");
		}
	});
		  
	// this is a function that deplays an effect
	$.fn.delay = function(time, callback){
		// Empty function:
		jQuery.fx.step.delay = function(){};
		// Return meaningless animation, (will be added to queue)
		return this.animate({delay:1}, time, callback);
	}
	$.fn.menu = function(menu) {
		var menu = menu
		$("#"+$(this).attr('id') + " > li").each(function(i) {
			$(this).mouseover(function(e) {
				var submenu = e.target.title+"-Menu";
				$("#"+menu+" > p").hide();
				$("p[title='"+submenu+"']").toggle();
			});
		})
	}	  
	$(document).ready(function() {
		// checking to see if opacity is properly supported
		// if true it it will animate the logo
		if(jQuery.support.opacity) {
		// on load hide the logo
		$("#mfulogo").hide();
		// after delay show logo
		$("#mfulogo").delay(2000, function() {
			$(this).show(1000);
		});
		}
		
		$("#navlist").menu("submenu");
		
		if($("#mfuConact").length) {
			$("#mfuConact").submit(function() {
				try {
					$("#mfuConact").checkForm('cgi-bin/_cont_mail.php');
					return false;
				}
				catch(e) {
					alert("Your Email Failed To Send!");
					return false;
				}
			});
		};
		
	});
	$("#arrowpeak").ready(function() {
		$('#arrow-price').click(function() {
			$("#pricingDIV").toggle();
		});
		$('#arrow-rule').click(function() {
			$("#rulesDIV").toggle();
		});
	});
	
})(jQuery);
