// counts the height of all .left elements, adding 1 for a bottom "margin"
	var wrapperHeight = 0;
	$("#content-wrapper").children("div .left").each(function() {
		if( $(this).hasClass("body") ) {
			if( $(".body.right").innerHeight() > $(".body.left").innerHeight() ) {
				wrapperHeight += $(".body.right").innerHeight() + 1;
			} else {
				wrapperHeight += $(".body.left").innerHeight() + 1;
			}
		} else {
			wrapperHeight += $(this).innerHeight() + 1;
		}
	});
// then applies the calculated height to the #content-wrapper
	$("#content-wrapper").height( wrapperHeight );
	
// activates the menu based on what page you're currently on
	var thisClass = "."+ $("body").attr("id").replace("-page", "");
	if( thisClass != ".index" ) {
		$("#menu .navigation "+ thisClass).addClass("active");
	}
	
// onload
	$(function() {
	// shows the footer {
		$("#footer").show();
		
	// really basic JS form validation
		var defaultValues = new Array();
		$("form.contact-form .text").each(function(i) {
			$(this).attr("rel", i); // sneaky
			defaultValues[i] = $(this).val();
		});
		$("form.contact-form").submit(function() {
			var result = true;
			$("form.contact-form .text").each(function(i) {
				if( $(this).val() == defaultValues[i] ) {
					$(this).css({
						color: 		"#f00",
						fontWeight:	"bold"
					});
					result = false;
				}
			});
			return result;
		});
		$("form.contact-form .text").focus(function() {
			$(this).val("");
			$(this).removeAttr("style");
		});
		$("form.contact-form .text").blur(function() {
			if( $(this).val() == "" )
				$(this).val(defaultValues[$(this).attr("rel")]);
		});
	});
	
// Google Analytics
	var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-22601210-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

