var quale ="";
var quanto = "";

function movsx(cosa,tot) {
	var num = cosa+'-num';
	var i = document.getElementById(num).firstChild.nodeValue;
	quale = '#'+cosa;
	if (i == 1) { quanto = "-="+(tot-1)*600+"px"; i = tot+1; } else {  quanto = "+=600px"; }
	i--;
	document.getElementById(num).innerHTML = i;
}
function movdx(cosa,tot) {
	var num = cosa+'-num';
	var i = document.getElementById(num).firstChild.nodeValue;
	quale = '#'+cosa;
	if (i == tot) { quanto = "+="+(tot-1)*600+"px"; i = 0; } else { quanto = "-=600px"; }
	i++;
	document.getElementById(num).innerHTML = i;
}

$(".sx").click(function() {
	$(quale).animate({"left": quanto}, 300);
});

$(".dx").click(function(){
	$(quale).animate({"left": quanto}, 300);
});

$(".fotodx").click(function(){
	$(quale).animate({"left": quanto}, 300);
});