	$(document).ready(function(){

		// nav startup
		// remove link background images since we're re-doing the hover interaction below 
		// (doing it this way retains the CSS default hover states for non-javascript-enabled browsers)
		// we also want to only remove the image on non-selected nav items, so this is a bit more complicated
		$(".nav").children("li").each(function() {
			var current = "nav current-" + ($(this).attr("class"));
			var parentClass = $(".nav").attr("class");
			if (parentClass != current) {
				$(this).children("a").css({backgroundImage:"none"});
			}
		});	


		// create events for each nav item
		attachNavEvents(".nav", "navLawn");
		attachNavEvents(".nav", "navTree");
		attachNavEvents(".nav", "navAera");
		attachNavEvents(".nav", "navOther");
		attachNavEvents(".nav", "navFaqs");
		attachNavEvents(".nav", "navContact");

		function attachNavEvents(parent, myClass) {
			$(parent + " ." + myClass).mouseover(function() {
				$(this).append('<div class="nav-' + myClass + '"></div>');
				$("div.nav-" + myClass).css({display:"none"}).fadeIn(200);
			}).mouseout(function() {
				$("div.nav-" + myClass).fadeOut(200, function() {
					$(this).remove();
				});
			}).mousedown(function() {
				$("div.nav-" + myClass).attr("class", "nav-" + myClass + "-click");
			}).mouseup(function() {
				$("div.nav-" + myClass + "-click").attr("class", "nav-" + myClass);
			});
		}


		$("#signClick").click(function () {
		  $("#signDiv").slideToggle("slow");
		});


		$("a.rollover img").hover(
		 function() {
			this.src = this.src.replace("-off","-on");
		 },
		 function(){
			this.src = this.src.replace("-on","-off");
		 }
		);



	// PageLoad function
	// This function is called when:
	// 1. after calling $.historyInit();
	// 2. after calling $.historyLoad();
	// 3. after pushing "Go Back" button of a browser
	function pageload(hash) {
		//alert("pageload: " + hash);
		// hash doesn't contain the first # character.
		if(hash) {
			// restore ajax loaded state
			if($.browser.msie) {
				// jquery's $.load() function does't work when hash include special characters like åäö.
				hash = encodeURIComponent(hash);
				//alert(hash);
			}
			$("#load").load("/pages/" + hash + ".php" + "?random=" + Math.random()*99999);
		} else {
			// start page
			$("#load").empty();
		}
	}
		
		//apply rounded corners
		$('.rounded').corners();
	
		// Initialize history plugin.
		// The callback is called at once by present location.hash. 
		$.historyInit(pageload, "");
		
		// set onlick event for buttons
		//$("a[rel='history']").click(function(){
		$(".loadClick").click(function(){
			// 
			var hash = this.href;
			hash = hash.replace(/^.*#/, '');
			// moves to a new page. 
			// pageload is called at once. 
			// hash don't contain "#", "?"
			$.historyLoad(hash);
			return false;
		});
		
	$("#splashSet a").hover(function(){
		$(this).children("span").fadeOut();
	}, function(){
		//$(this).children("span").fadeIn();
	})	
	
	if(page==""){
		var t=$("#mainSplashImg");
		var l=$("#mainSplash");
	    var src1= t.attr('src'); // initial src
		var src2 = "/img/splash"+src1.substring(src1.lastIndexOf('/'), src1.lastIndexOf('.'));
	}
	
	$("#tabSet a").hover(function(){
		currentId = $(this).attr('id');
		$(this).children("span").fadeOut();
		var newSrc = src2 + '-' + currentId + '.' + /[^.]+$/.exec(src1);
    	t.attr('src', newSrc);
    	l.children("span").fadeOut();
	}, function(){
		$(this).children("span").fadeIn();
		t.attr('src', src1);
		//l.children("span").fadeIn();
	})	
	
	
		
	$("#printButton").click(function () { 
		$('#interior').jqprint();  
    });

	$(".pseudoClick").hover(function () {
		$(this).addClass("hover");
    }, function () {
		$(this).removeClass("hover");
    });

	var originalFontSize = $('html').css('font-size');
	$(".resetFont").click(function(){
		$('html').css('font-size', originalFontSize);
	});
	  
	// Increase Font Size
	$(".increaseFont").click(function(){
		var currentFontSize = $('html').css('font-size');
		var currentFontSizeNum = parseFloat(currentFontSize, 10);
		var newFontSize = currentFontSizeNum*1.2;
		$('html').css('font-size', newFontSize);
			return false;
	});
	  
	// Decrease Font Size
	$(".decreaseFont").click(function(){
		var currentFontSize = $('html').css('font-size');
		var currentFontSizeNum = parseFloat(currentFontSize, 10);
		var newFontSize = currentFontSizeNum*0.8;
		$('html').css('font-size', newFontSize);
	    	return false;
	});
	
	var click = false;
	
	$("#toggleFont").click(function(){
		var currentFontSize = $('html').css('font-size');
		var currentFontSizeNum = parseFloat(currentFontSize, 10);
		//alert(currentFontSizeNum);
		if(click==true) {
			var newFontSize = currentFontSizeNum-2;
			click=false;
		} else {
			var newFontSize = currentFontSizeNum+2;
			click=true;
		}
		$('html').css('font-size', newFontSize);
	    	return false;
	});

	});