var cOpen = 'none';

$(document).ready(function(){
	$('.nav').click(function(){
		var id = $(this).attr('id');
		$('#content-wrapper').slideDown('slow');
		$('#htitle').fadeOut('fast');
		setTimeout(function(){showContent(id);},250);
	})
	$('#close').click(function(){
		$('#c' + cOpen).fadeOut('fast');
		$('#content-wrapper').slideUp('slow');
		$('#close').fadeOut('fast');
		$('#htitle').fadeOut('fast');
	})

})

function showContent(id){
	document.getElementById('htitle').innerHTML=id;
	$('#htitle').fadeIn('fast');
	$('#close').fadeIn('slow');
	$('#ichael').animate({width: 'toggle'});
	if(cOpen=='none'){
		$('#c' + id).fadeIn('slow');
		cOpen=id;
	} else if(cOpen==id){
		$('#c' + id).fadeIn('slow');
	} else {
		$('#c' + cOpen).fadeOut('fast');
		$('#c' + id).fadeIn('slow');
		cOpen=id;
	}
}