var aspettando = '<div class=aspettando> &nbsp </div>'
var i = 0;

function vs( iddiv , url ) {

$(iddiv).innerHTML = aspettando ;
  
 var ajax = new Ajax( url , {
			method: 'get',
			evalScripts: true,
			update: $(iddiv),
			onComplete: function() {
			
			switch (url) {
			
				case 'newsvetrina.asp':
				  vs( 'vetrina1' , 'ministr.asp?p=1' );
				  vs( 'vetrina2' , 'ministr.asp?p=2' );
				break;

				case 'elencoministr.asp':
				  vs( 'vetrina3' , 'ministr.asp?p=3' );
				  vs( 'vetrina4' , 'ministr.asp?p=4' );
				  vs( 'vetrina5' , 'ministr.asp?p=5' );
				  vs( 'vetrina6' , 'ministr.asp?p=6' );
				break;
								
				} 
			
			},
			
			onFailure: function() {
				alert("Non e' stato possibile eseguire la richiesta correttamente");
			}
		});
		
		// ora effettuiamo la richiesta
		ajax.request();
	
}

function sf( idform , iddiv , url ) {

var ajax = new Ajax( url , {
			method: 'post',
			evalScripts: true,
			update: $(iddiv),
			data: $(idform),
			onRequest: function() {
				$(iddiv).innerHTML = aspettando ;			},
			onFailure: function() {
				alert("Non è stato possibile eseguire la richiesta correttamente");
			}
		});
		
		// il form con id 'send' che abbiamo utilizzato per impostare il corpo della richiesta
		$(idform).addEvent('submit', function(event) {
			var event = new Event(event).stop();
			ajax.request();
		});
	
}

function startGallery() {
var myGallery = new gallery($('myGallery'), {
timed: true,
showArrows: false,
showCarousel: false
});
}

function swapImage(imgobj,trigobj,img){
 if (typeof(imgobj)!='object'){
  imgobj=document.getElementById(imgobj);
 }
 if (!imgobj.outimg){
  imgobj.outimg=imgobj.src;
 }
 imgobj.src=imgobj.src.substring(0,(imgobj.src.lastIndexOf('/')+1))+img
 trigobj.tar=imgobj;
 trigobj.onmouseout=function(){ this.tar.src=this.tar.outimg; }
}
