function caricaFoto(cosa, lingua){
	$('foto').set('html', '<div id="ajax-loader"><img src="images/ajax-loader.gif" /></div>"');
	//We can use one Request object many times.
	var req = new Request.HTML({url:'plugins/home/foto.php?id=' + cosa + "&lingua=" + lingua, 
		onSuccess: function(html) {
			//Clear the text currently inside the results div.
			$('foto').set('text', '');
			//Inject the new DOM elements into the results div.
			$('foto').adopt(html);
		},
		//Our request will most likely succeed, but just in case, we'll add an
		//onFailure method which will let the user know what happened.
		onFailure: function() {
			$('foto').set('text', 'The request failed.');
		}
	});
	req.send();
	return false;
}

function caricaMiniature(pag, lingua){
	$('scroll_foto').set('html', '<div id="ajax-loader"><img src="images/ajax-loader.gif" /></div>"');
	//We can use one Request object many times.
	var req = new Request.HTML({url:'plugins/home/scroll.php?pagina=' + pag + '&lingua=' + lingua, 
		onSuccess: function(html) {
			//Clear the text currently inside the results div.
			$('scroll_foto').set('text', '');
			//Inject the new DOM elements into the results div.
			$('scroll_foto').adopt(html);
		},
		//Our request will most likely succeed, but just in case, we'll add an
		//onFailure method which will let the user know what happened.
		onFailure: function() {
			$('scroll_foto').set('text', 'The request failed.');
		}
	});
	req.send();
	return false;	
}

function fotoPrecedenti(pag,lingua){
	if(pag != 1){
		pagina = pag - 1;
		$('fotoPrec').set('onclick',"return fotoPrecedenti("+(pagina)+",'"+lingua+"');");
		$('fotoSucc').set('onclick',"return fotoSuccessive("+(pagina)+",'"+lingua+"');");
		caricaMiniature(pagina,lingua);		
	}
	return false;
}
function fotoSuccessive(pag,lingua){
	pagina = pag+1;
	$('fotoSucc').set('onclick',"return fotoSuccessive("+(pagina)+",'"+lingua+"');");
	$('fotoPrec').set('onclick',"return fotoPrecedenti("+(pagina)+",'"+lingua+"');");
	caricaMiniature(pagina,lingua);
	return false;
}

window.addEvent("domready", function(){
	
});


