
$(document).ready( function($) {
	$('#access ul > li:first-child').addClass('first-item');
	$('#access ul > li:last-child').addClass('last-item');
	
	var right = $('#right-sidebar').outerHeight();	
	
	var hash = window.location.hash;
	if (hash != '') {
		hash = hash.replace('#','');
		$('#contact-person').val(hash);
	}
	$("#container").resize(function(e){
		runScript($('#container').outerHeight());
	});	
	
	$('#jMonthCalendar').css('width','100%');
});
	
function biggestNumber(){
	return Math.max.apply(this,arguments);
}	
	
function runScript(container) {
	/* adjust height of columns */
	var left = $('#primary').outerHeight();
	var center = $('#container').outerHeight();
	var right = $('#right-sidebar').outerHeight();
	
	var highest = biggestNumber(left,center,right);
	
	if ((container != null) && (container < left))  {
		if (container < 1035) {
			highest = 1035;
		}
		else {
			highest = container;
		}
	}
	if (highest > 0) {
		$('#primary').height(highest);
		//$('#container').height(highest);
		$('#right-sidebar').height(highest);
	}
}

