function noCache(uri){return uri.concat(/\?/.test(uri)?"&":"?","noCache=",(new Date).getTime(),".",Math.random()*1234567)};

// SELEZIONA INDICE SCELTO NELLA SELECT LIST ////////////////////////////////////////////////////////////////////////////////////////////////

function set_select(_form,campo,valore){
	for(i = 0; i < $(campo).length; i++) {
		if($(campo)[i].value == valore)
		$(campo).selectedIndex = i;
	}			
}

// AJAX CALL ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	function ajax_call(url,overlay_el,destinazione, destinazione_loadscripts, parametri,tempo){
		if(overlay_el!='') Overlay(overlay_el)
		new PeriodicalExecuter(function(exec_req) {	
			new Ajax.Updater(destinazione, noCache(url), {
				evalScripts: true,
				method: 'post',
				parameters: parametri
			});	
			exec_req.stop();
		}, tempo)			
	}

// EVENTO ONPASTE PER FIREFOX ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	function checkForPaste(event) {
		var e = event.element();
		if ((e.previousValue && e.value.length > e.previousValue.length + 1) || (!e.previousValue && e.value.length > 1)) { 
			if (e.onpaste) {
				e.onpaste(e)
			} else if (e.readAttribute("onpaste")) {
				eval(e.readAttribute("onpaste"));
			}
		}
		e.previousValue = e.value;
	}
