var photoIndex = 0;$.scrollTo.defaults.axis = 'x';function loadImage(index) {	element = $("#photo-galeria .inner ul li").eq(index);		$("#photo-galeria .loader").hide();		/*alert('obecna: ' +photoIndex +', ' +'docelowa:' +index);*/	if (element.children('img').length==0) {			$("#photo-galeria .loader").show();				element.css("width","831px");		element.css("height","380px");				if (index < photoIndex) {			$("#photo-galeria .inner").stop().scrollTo('+=831px', 0);		}						$('<img class="photo" />').attr('src',photoUrl[index]).attr('id','photo-'+index).prependTo(element).load(function() {				$("#photo-galeria .loader").hide();			$("#photo-galeria .inner").stop().scrollTo($('#photo-galeria .inner li:eq('+index+')'), 800 );		});	} else {		$("#photo-galeria .inner").scrollTo($('#photo-galeria .inner li:eq('+index+')'), 800 );	}		photoIndex = index;		if (photoIndex == 0) $('#photo-galeria .prev').hide();	if (photoIndex > 0) $('#photo-galeria .prev').not(':visible').show();	if (photoIndex == photoUrl.length - 1) $('#photo-galeria .next').hide();	if (photoIndex < photoUrl.length - 1) $('#photo-galeria .next').not(':visible').show();}$(document).ready(function(){		$('#photo-galeria .prev').hide();	$("#photo-galeria .inner ul").css('width',photoUrl.length*831 +'px');		for (var i=0;i<photoUrl.length - 1;i++) {		$('#photo-galeria .inner ul').append('<li></li>');	}	$('#photo-galeria .next').click(function()	{		if (photoIndex < photoUrl.length -1) {			loadImage(photoIndex + 1);		}				return false;	});		$('#photo-galeria .prev').click(function()	{		if (photoIndex > 0) {			loadImage(photoIndex - 1);		}				return false;	});		$("#galeria a").click(function() {		loadImage($("#galeria a").index(this));//		return false;	});});