$(document).ready(function(){
	var $article = $('article');
	
	$article.waypoint({ offset: '50%' });
	
	// The same for all waypoints
	$('body').delegate('article', 'waypoint.reached', function(event, direction) {
		var $active = $(this);

		if (direction === "up") {
			$active = $active.prev();
		}
		if (!$active.length) $active.end();

		$('.active').removeClass('active');
		$active.addClass('active');				
	});
});
