google.load("jquery", "1.2");
google.setOnLoadCallback(initialize);
	
function sdColumns() {
	var dimensions = { width: 0, height: 0 };
	if (document.documentElement) {
		dimensions.width = document.documentElement.offsetWidth;
		dimensions.height = document.documentElement.offsetHeight;
	} else if (window.innerWidth && window.innerHeight) {
		dimensions.width = window.innerWidth;
		dimensions.height = window.innerHeight;
	}
	var colWidth;
	if (dimensions.width < 1024) {
		colWidth = (dimensions.width/4);
		$('.columns .post').css('width', colWidth);
		$('.columns .post img').css('width', colWidth-10);
		$('.columns .post object').css('width', colWidth-10);
		$('.columns .post object').css('height', (350 * ((colWidth-10)/425))  );
	} else if (dimensions.width > 1600) {
		colWidth = (dimensions.width/9);
		$('.columns .post').css('width', colWidth);
		$('.columns .post img').css('width', colWidth-10);
		$('.columns .post object').css('width', colWidth-10);
		$('.columns .post object').css('height', (350 * ((colWidth-10)/425))  );

	} else {
		colWidth = (dimensions.width/6);
		
		$('.columns .post').each(function(){
			$(this).css('width', colWidth);
			$('img', this).css('width', colWidth-10);
			$('object', this).attr('width', colWidth-10);
			$('object', this).attr('height', (350 * ((colWidth-10)/425))  );
			$('embed', this).attr('width', colWidth-10);
			$('embed', this).attr('height', (350 * ((colWidth-10)/425))  );
		
		});
	}
	
	return dimensions;
}
function initialize() {
	
	$('a#minimize').click( function () {
		// $('#branding').slideToggle('slow');
		if ( $('a#minimize').text() == 'minimize') {
			$('a#minimize').text('expand');
			$('#branding').animate({"top" : "-141px"}, "slow");  // move the branding up
			$('a#minimize').animate({"top": "34px"}, "slow"); // move the minimize up
			$('#content').animate({"top": "34px"}, "slow"); // move the content up.  
			$('#sidebar').animate({"top": "34px"}, "slow"); // move the sidebar up.
			$('#nav ul li:last').after("<li id=\"navlogo\">Simian Design</li>"); // inserting SD
		} else {
			$('a#minimize').text('minimize');
			$('#branding').animate({"top" : "0"}, "slow");
			$('a#minimize').animate({"top": "175px"}, "slow");
			$('#content').animate({"top": "175px"}, "slow");   
			$('#sidebar').animate({"top": "160px"}, "slow"); // move the sidebar up.
			$('#nav ul li#navlogo').remove(); // inserting SD
		}
		return false;
	});

	sdColumns();
	
	var maxdateHeight = 0;
	var maxTitleHeight = 0;
	var maxSmallHeight = 0;
	
	$('.columns #content .post').each(function() {
		if ($('.date', this).height() > maxdateHeight) { maxdateHeight = $('.date', this).height(); }
		if ($('h2', this).height() > maxTitleHeight) { maxTitleHeight = $('h2', this).height(); }
		if ($('small', this).height() > maxSmallHeight) { maxSmallHeight = $('small', this).height(); }
	});
	$('.columns #content .post').each(function() {
		$('small', this).css('top', maxdateHeight + maxTitleHeight + 'px');
		$('.entry', this).css('padding-top', (maxdateHeight + maxTitleHeight + maxSmallHeight + 'px'));
	});
}