$().ready(function(){

	/*
	 *		Scroller using jQueries .animate to slide a <div>, allowing different elements along its width to be viewed.
	 *		
	 *		by Ricky Stevens - 14/06/2009
	*/
	
	$('.photo').click(function(){

		// pre-set vars
		var viewPortWidth = 800;		// current width of #viewport
		var custDuration = 400;			// default duration of animation


		// get element id, and create the destination to animate to
		var currentClass = $(this).attr('id').split('pos');
		var gotoPos = (0 - ((currentClass[1] - 1) * viewPortWidth));

		// check the distance to travel, and adjust the duration
		var currentPos = $('#viewport').position().left;
		var distance = Math.abs(currentPos - gotoPos);
		if((distance / viewPortWidth) > 4) custDuration = (distance / 8);

		// run animation
		$('#viewport').animate({left: gotoPos+'px'}, {queue:false, duration: custDuration});

		return false;
		

	});

	$('.twit').click(function(){

		var link = $(this).parent().attr("href");

		window.open(link,'blank','width=900,height=800,toolbar=yes, location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes, resizable=yes');

	});
   
});
