Salve il problema che non so come affrontare è quello di memorizzare un valore ottenuto tramite richiesta ajax in una variabile fruibile all'esterno della di tale richiesta, di seguito il codice:

codice:
window.addEvent("domready", function(){

function show(num, imgpath){	
	new Request({
		url:"js/imgs.xml",
		update:$("ajax"),
		onRequest:function(){ $("ajax").set("html","WAITING FOR ANSWER..."); },//onRequest
		onProress:function(event, xhr){ $("ajax").set("html", event.total); },
		onSuccess:function(txt, xml){
			
			var root = xml.documentElement;
			imgs = root.getElementsByTagName("img");
			img = (Browser.Engine.trident)? imgs[num].text : imgs[num].textContent;
			$("ajax").set("html", "OK - "+root.getElementsByTagName("img").length+" - "+img);
			imgpath = img;
		},
		onFailure:function(){ $("ajax").set("html","ERROR"); }
	}).send(null);
}
	
function show_img(){
	num = Math.round( (Math.random()*4) );
	var imgpath;
	show(num, imgpath);
	$("box_show").setStyle("background-image", "url(imgs/"+imgpath+")");
}	

show_img();

)};//END "domready"
Il framework javascript è Mootools.
Grazie in anticipo.