(function($){})(window.jQuery);


/* trigger when page is ready */
$(document).ready(function (){
	
	// set clicks
		$("a").not('.pageSelect').click(function() {
			var mref = this.href;
			this.href = mref + "?noNavigation=" + $("body").hasClass("noNavigation").toString() + "&noSubNav=" + $("body").hasClass("noSubNav").toString() + "&bt=true";
		});
	//img  hover to show the text behind it but only on the contentholders/indexes
		if ($("body").hasClass("ImagesHolder") || $("body").hasClass("HomePage")) {
		$("div.indexImage a").hover(
		function () {
			$(this).children("img.hoverHide").fadeOut("slow");
	        },function(){
			$(this).children("img.hoverHide").delay(400).fadeIn("slow");
		});
		}
	
	// set tabs
		if ($("body").hasClass("HomePage")) {
			$("#aboutTab").click(function() {
				$("body").toggleClass("noSubNav");
			});
		}
		else {
			$("#subNavTab").click(function() {
				$("body").toggleClass("noSubNav");
			}); 	
		}
		
		$("#navigationTab").click(function() {
			$("body").toggleClass("noNavigation");
		});
	
	//read urls and variables
		if ($.url.param("noSubNav") == "true") { $("body").addClass("noSubNav"); } // Aboutpages need their index to navigate since there are no arrows
		if ($.url.param("noNavigation") == "true") { $("body").addClass("noNavigation"); }
	
		if (!($.url.param("bt") == "true")) {
			//if you are landing on this from somewhere else, or from the homepage
				if ($("body").hasClass("home")) { if (window.innerWidth<=990) {$("body").addClass("noSubNav");
				}
	
			}
	
		}



});


