var contentLinks = '';
var contentBlocks = ''; 
var currentContentName = '';

//do these things on page load
google.setOnLoadCallback(function() {
	if ($('.contentLink').length) {
		contentBlocks = $('.contentBlock');
		contentLinks = $('.contentLink');
		contentLinks.each(function(){
			if ($(this).hasClass('current')) {
				currentContentName = this.id.split('_')[0];
			}			
			$(this).bind('click', function(){
				switchContent(this.id.split('_')[0]);
			});
		});
		
		maxItemHeight = 0;
		
		contentBlocks.each(function(){
			height = $(this).height( ) ;
			if (maxItemHeight < height) {
				maxItemHeight = height;
			}
			$(this).hide();
		});
		
		contentBlocks.each(function(){		 
			$(this).height(maxItemHeight);
		});
		 
		switchContent(currentContentName);
	}
	
});


function switchContent(contentName){ 
	contentLinks.each(function(){
		$(this).removeClass('current');
	});
	
	contentBlocks.each(function(){
		$(this).fadeOut();
	});
	
	$("#" + contentName + "_link").addClass('current');
	$("#" + contentName + "_content").fadeIn();
	
	$("#" + contentName + "_content").css("position", "relative");
}
