// JavaScript Document
$(document).ready(function(){	
	$('a.toTop').click(function(){
		$.scrollTo( '#content', 500, { axis:'y'});return false;
		});
	$('a.toReferences').click(function(){
		$.scrollTo( '#references', 500, { axis:'y', offset:-200});return false;
		});
	$('a.toApropos').click(function(){
		$.scrollTo( '#apropos', 500, { axis:'y', offset:-200});return false;
		});
	$('a.toContact').click(function(){
		$.scrollTo( '#contact', 500, { axis:'y', offset:-209});return false;
		});	
	var $references_content = $('#references_content');
	$('#previous a').fadeTo("slow", 0.3);
	$references_content.scroll(function() {
		var position = $(".reference:first-child").position();
		var positionEnd = $(".reference:last-child").position();
		if (position.top == 0) {  
			$('#previous a').addClass('hidden');
			$('#previous a').fadeTo(300, 0.3);
			
		}
		else { 
			$('#previous a').css("opacity", 1);
			$('#previous a').removeClass('hidden')
		};
		if (positionEnd.top == 223) {  
			$('#next a').addClass('hidden');
			$('#next a').fadeTo(300, 0.3);
			
		}
		else { 
			$('#next a').css("opacity", 1);
			$('#next a').removeClass('hidden')
		};

	});
	$('#next a').click(function(){
		$references_content.stop().scrollTo( '+=448', 500);
		return false;
		});	
	$('#previous a').click(function(){
		$references_content.stop().scrollTo( '-=448', 500);
		return false;
		});	
	$('.reference a').lightBox({fixedNavigation:true});
});
