$('.heading').each(function(){
	var tmp = $(this).html();
	$(this).html("<span>" + tmp + "</span");
});
$('.content_summary').wrap('<div class="content_shell" />').wrap('<div class="content_container" />');

$('.maximize').unbind('click').click(function(){
	$(this).parents('.content_block').children('.article_content').show();
	return false;
});
$('.minimize').unbind('click').click(function(){
	$(this).parents('.content_block').children('.article_content').hide();
	return false;
});

recent_hash = '';

$('#menu_block a').click(function(){
	$.history.add($(this).attr('href').replace('#',""));
});

function auto_open(){
	if($.history.getCurrent()){
		if($.history.getCurrent().length>0){ //check if the current history item has anything in it
			if($.history.getCurrent() != recent_hash){
				recent_hash = $.history.getCurrent(); //get the new hash
				$("#" + recent_hash + "_block").children('.article_content').show();
				$.scrollTo({top:$("#" + recent_hash + "_block").offset().top,left:0},250);
			}
		}
	}
	link_timer = self.setTimeout("auto_open()", 100);
}
link_timer = null;
$(document).ready(function(){
	link_timer = self.setTimeout("auto_open()", 250);
});
