$(document).ready(function(){ 
	
	var width = $('#tree-wrapper').outerWidth() -20;
	var width = 240*3;
	var currentPage = 0;
	var pages = Math.ceil($('#tree-wrapper div').children().length / 3);
	$('#prev-big').css({ 'opacity': 0, 'cursor': 'default' });
	
	if(pages == 1)
		$('#next-big').css({ 'opacity': 0, 'cursor': 'default' });
	//console.log(pages);
	
	$('#next-big').click(function () {
		currentPage++;    
		$('#prev-big').css({ 'opacity': 1, 'cursor': 'pointer', 'marginLeft': 20 });
		$('#tree-wrapper div').animate({ 'marginLeft': -(currentPage * width) }, 500);
		
		if(currentPage == (pages-1))
			$(this).css({ 'opacity': 0, 'cursor': 'default', 'marginLeft': -1000 }); 

	});
	
	$('#prev-big').click(function () {
		currentPage--; 
		$('#next-big').css({ 'opacity': 1, 'cursor': 'pointer', 'marginLeft': 830 });
		$('#tree-wrapper div').animate({ 'marginLeft': -(currentPage * width) }, 500);
		if(currentPage == 0)
			$(this).css({ 'opacity': 0, 'cursor': 'default', 'marginLeft': -1000 });

	});
         
});

