// JavaScript Document

$(document).ready(function(){
	
	
	$(".timeline-year-wrapper:first-child").addClass("visible");
	$("#timeline-dates li:first-child").addClass("active");
	$("#timeline-dates li").click(function(){
		$("#timeline-dates li").removeClass("active");
		$(this).addClass("active");
	//	$(".timeline-year-wrapper").removeClass("visible");
		currentYear = $(this).attr("rel");
		currentYearID = "#timeline-" + currentYear 
		$(currentYearID).addClass("visible");
		
		var anchorOffset = $("a#" + currentYear).position();
		
	//	$(".news-item").html("left: " + anchorOffset.left + ", top: " + anchorOffset.top);
		
		$('.scroll-pane')[0].scrollTo(anchorOffset.top);
  //      return false;

		
	});

	$('.scroll-pane').jScrollPane();
	
});
 
var scrollDownID;
function scrollDownHandler() {
	scrollDownID = setInterval ( "scrollDown()", 1 );
}
function scrollDown() {
	$('.visible .scroll-pane')[0].scrollBy(2);
	return false;
}
function scrollDownStop() {
	scrollID = clearInterval (scrollDownID);
}
var scrollUpID;
function scrollUpHandler() {
	scrollUpID = setInterval ( "scrollUp()", 1 );
}
function scrollUp() {
	$('.visible .scroll-pane')[0].scrollBy(-2);
	return false;
}
function scrollUpStop() {
	scrollUpID = clearInterval (scrollUpID);
}
