/**
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne <brian@cherne.net>
*/
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:3,interval:200,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);

$(document).ready(function(){
	//$("#trailmapplaceholder").load('includes/trailmap.html');
	
	$(".trailmaplink").click(function(){
		$("#blank2").show();
		$("#blank3").show();
		$("#SignLinks").css("marginTop","-5000px"); 
		$("#trailmap").fadeIn("300", function() {
			$("#step1").fadeIn("600", function() {
				$("#step2").fadeIn("600", function() {
					$("#step3").fadeIn("600", function() {
						$("#step4").fadeIn("600", function() {
							$("#step5").fadeIn("600", function() {
								$("#step6").fadeIn("600", function() {
									$("#step7").fadeIn("600", function() {
										$("#step8").fadeIn("600", function() {
											$("#step9").fadeIn("600", function() {
												$("#step10").fadeIn("600", function () {
													  $(".paths").fadeIn("600");
												  });
											});	
										});	
									});	   
								});			   
							});			   
						});			   
					});						   
				});						   
			});
	    });	
	});
	
	function doNothing(){
		
	}
	
	function step1() {
		$("#blank1").show();
		$("#blank4").fadeIn("50");
		$(".steps").fadeIn("50");
		$(".paths").fadeIn("50");
		$("#Zoom1").fadeIn("100");	
		$("#Zoom1").children().fadeIn("100");
	}
	
	function step2() {
		$("#blank1").show();
		$("#blank4").fadeIn("50");
		$(".steps").fadeIn("50");
		$(".paths").fadeIn("50");
		$("#Zoom2").fadeIn("100");	
		$("#Zoom2").children().fadeIn("100");
	}
	
	function step3() {
		$("#blank1").show();
		$("#blank4").fadeIn("50");
		$(".steps").fadeIn("50");
		$(".paths").fadeIn("50");
		$("#Zoom3").fadeIn("100");	
		$("#Zoom3").children().fadeIn("100");
	}
	
	function step4() {
		$("#blank1").show();
		$("#blank4").fadeIn("50");
		$(".steps").fadeIn("50");
		$(".paths").fadeIn("50");
		$("#Zoom4").fadeIn("100");	
		$("#Zoom4").children().fadeIn("100");
	}
	
	function step5() {
		$("#blank1").show();
		$("#blank4").fadeIn("50");
		$(".steps").fadeIn("50");
		$(".paths").fadeIn("50");
		$("#Zoom5").fadeIn("100");	
		$("#Zoom5").children().fadeIn("100");
	}
	
	function step6() {
		$("#blank1").show();
		$("#blank4").fadeIn("50");
		$(".steps").fadeIn("50");
		$(".paths").fadeIn("50");
		$("#Zoom6").fadeIn("100");	
		$("#Zoom6").children().fadeIn("100");
	}
	
	function step7() {
		$("#blank1").show();
		$("#blank4").fadeIn("50");
		$(".steps").fadeIn("50");
		$(".paths").fadeIn("50");
		$("#Zoom7").fadeIn("100");	
		$("#Zoom7").children().fadeIn("100");
	}
	
	function step8() {
		$("#blank1").show();
		$("#blank4").fadeIn("50");
		$(".steps").fadeIn("50");
		$(".paths").fadeIn("50");
		$("#Zoom8").fadeIn("100");	
		$("#Zoom8").children().fadeIn("100");
	}
	
	function step9() {
		$("#blank1").show();
		$("#blank4").fadeIn("50");
		$(".steps").fadeIn("50");
		$(".paths").fadeIn("50");
		$("#Zoom9").fadeIn("100");	
		$("#Zoom9").children().fadeIn("100");
	}
	
	function step10() {
		$("#blank1").show();
		$("#blank4").fadeIn("50");
		$(".steps").fadeIn("50");
		$(".paths").fadeIn("50");
		$("#Zoom10").fadeIn("100");	
		$("#Zoom10").children().fadeIn("100");
	}
	
	
	$("#blank2").click(step1);
	$("#step1").hoverIntent( step1, doNothing );
	$("#step2").hoverIntent( step2, doNothing );
	$("#step3").hoverIntent( step3, doNothing );
	$("#step4").hoverIntent( step4, doNothing );
	$("#step5").hoverIntent( step5, doNothing );
	$("#step6").hoverIntent( step6, doNothing );
	$("#step7").hoverIntent( step7, doNothing );
	$("#step8").hoverIntent( step8, doNothing );
	$("#step9").hoverIntent( step9, doNothing );
	$("#step10").hoverIntent( step10, doNothing );


	$(".zoomclose").click(function () {
		$("#blank1").hide();
		$("#blank4").fadeOut("100");
		$(".zoom").fadeOut("100");
		$(".zoom").children().fadeOut("100");
	}); 
	
	$(".zoom_close").click(function () {
		$("#blank1").hide();
		$("#blank4").fadeOut("100");
		$(".zoom").fadeOut("100");
		$(".zoom").children().fadeOut("100");
	}); 
	
	$(".trailmapclose").click(function(){
		$("#trailmap").fadeOut("100");
		$("#ourapproach").show("0"); 
		$("#SignLinks").css("marginTop","0px"); 
	});
			
			
	$(".zoom_next").click(function() {
		$(this).parent().parent().next().show();
		$(this).parent().parent().next().children().show("0", function () {	
			$(this).parent().prev().hide("0");	
		});
    });
	
	$(".zoom_back").click(function() {
		$(this).parent().parent().prev().show();
		$(this).parent().parent().prev().children().show("0", function () {
			$(this).parent().next().hide();
		});
    });
	
	$('.obfuscate').nospam({ filterLevel: 'low' });
});