// JavaScript Document
var $sel;
function switchPart(to)
{
	$block = $("#neb .neb-block").eq(to);
	if($sel == $block)
	{
		return false;	
	}
	$("#neb .selected").removeClass("selected");
	$block.addClass("selected");
	$("#neb-nav .pressed").removeClass("pressed");
	$("#neb-nav a").eq(to).addClass("pressed");
	$sel = $block;
}

function scrollBlock(block)
{
	$(block).serialScroll({
		target:'div.articles',
		items:'div.article', // Selector to the items ( relative to the matched elements, '#sections' in this case )
		prev:('.up-arrow'),// Selector to the 'prev' button (absolute!, meaning it's relative to the document)
		next:('.down-arrow'),// Selector to the 'next' button (absolute too)
		axis:'y',// The default is 'y' scroll on both ways
		duration:700,// Length of the animation (if you scroll 2 axes and use queue, then each axis take half this time)
		force:true, // Force a scroll to the element specified by 'start' (some browsers don't reset on refreshes)
		cycle:false,
		lock:true,
		step:1
	})
}

$(document).ready(function(){
	if($("#neb").length > 0)
	{	
		if(!$sel)
		{
			$("#neb .neb-block:first").addClass("selected");
			$("#neb-nav a:first").addClass("pressed");
		}
		$("#neb-nav a").click(function() {
			switchPart($(this).index());
			return false;
		});
		$("#neb .neb-block").each(function(){			
			scrollBlock(this);					   
		});
		
	}
});
