$(document).ready(function(){

	//default settings
	$("#mainContent span.sideBar").hide();

	$("#mainContent a.readSidebar").click(function() {
		$(this).parent().next(".sideBar").fadeIn();
		return false;
	});
	$("#mainContent .sideBar a.closeSideBar").click(function() {
		$(this).parent(".sideBar").fadeOut();
		return false;
	});

	setPullQuote(0);

	$('.shortTopSection').hide();
});



function paginate(i, pageCount){
	
	$('.page').hide();
	$('.page:eq(' + i +')').show();
	$('.current').removeClass('current');
	$('#page' + i).addClass('current'); 
	$('#page' + (i + pageCount)).addClass('current'); 
	
	if(i == 0){
		$('.fullTopSection').show();
		$('.shortTopSection').hide();
	}
	else{
		$('.fullTopSection').hide();
		$('.shortTopSection').show();
	}
	
	setPullQuote(i);
}

function setPullQuote(pageIndex){
	var quoteText = $('.pullQuotePlacement').eq(pageIndex).html();
	if(quoteText != '' && quoteText != null){
		$('blockquote').show();	
		$('#quoteText').text(quoteText);
		$('#lineBreak').hide();
	}
	else{
		$('blockquote').hide();	
		$('#lineBreak').show();
	}
}