Contrast Rebellion

//  Copyright (c) 2011 Richard Gazdik. All rights reserved.
//  http://richard.gazdik.name
 
 
trace = function(s) { try { console.log(s) } catch (e) { alert(s) }};
 
function pageTurn(direction) {
	var newPage;
	if (direction == 'next' && $('.page.selected').index() < $('.page').length-1)  newPage = $('.page.selected').next();
	else if (direction == 'prev' && $('.page.selected').index() > 0) newPage = $('.page.selected').prev();
	if (newPage) {
		$('.page').removeClass('selected');
		newPage.addClass('selected');
		jQuery.scrollTo.window().queue([]).stop();
		$(window).scrollTo(newPage,1200,{easing:'easeOutQuint'});
		_gaq.push(['_trackEvent', 'Paging', 'Turn to page '+(newPage.index()+1)]); //stat
	}
}
 
function imageChange(direction) {
	var next;
	var selectedIndex = $('.page.selected .selector.selected').index();
	if (direction == 'next') next = selectedIndex+1 < $