$(function() {

	
	

	$('a#nextBtn').live("click", function() {
		loadCurriculumBody($nextState, changeNext() );
		
		
	});
	
	$('a#prevBtn').live("click", function() {
		loadCurriculumBody($prevState, changePrev() );
		
	});
	
	function loadCurriculumBody(nextState) {
		
		
		$("#rightcolumn #curriculumBody").fadeOut('slow', function(){$(this).empty()})
						.fadeOut('slow', function() { 
							if ($.browser.msie)
								this.style.removeAttribute('filter');
						
						 })
						.animate({opacity: 1.0}, 0, function()		 
						 {
						 
							 $.ajax({
								url: "includes/inc_curriculumPage" + nextState + ".html",
								cache: false,
								success: function(html){
									$("#curriculumBody").append(html);
								}
							});
						
						 })
						.fadeIn('slow', function() { 
							if ($.browser.msie)
								this.style.removeAttribute('filter');
						
						 });
		
		
	}
		
	function changeNext() {
		
		$state = $nextState;
		$nextState = $state + 1;
		$prevState = $state - 1;
		
		$('a#prevBtn img').attr("src","images/prev.jpg");
		
		if ($nextState == 9) { 
			
			$nextState = 8;
			$('a#nextBtn img').attr("src","images/next_nomore.jpg");
		
		}
	}
	
	function changePrev() {
		$state = $prevState;
		$nextState = $state + 1;
		$prevState = $state - 1;
		
		$('a#nextBtn img').attr("src","images/next.jpg");
		
		if ($prevState == 0) { 
			
			$prevState = 1; 
			$('a#prevBtn img').attr("src","images/prev_nomore.jpg"); 
		
		}
		
	}

});
