
var PARAM_HANDLER=new Array();
var myRequest_infoDBAsync = null;

function CreateXmlHttpReq(handler) {
var xmlhttp = null;
try {
xmlhttp = new XMLHttpRequest();
} catch(e) {
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
}
xmlhttp.onreadystatechange = handler;
return xmlhttp;
}








function getInfoDB(tabella,info,id_dest){
	var i=0;
	for(i=0;i<id_dest.length;i++){
		PARAM_HANDLER[i]=id_dest[i];
	}
	var app='getInfoClasse.php?classe='+tabella+'&param='+info+'&rand='+escape(Math.random());
	myRequest_infoDBAsync = CreateXmlHttpReq(stampaInfoDB);
	myRequest_infoDBAsync.open("GET",app);
	myRequest_infoDBAsync.send(null);
}




function stampaInfoDB(){
  if (myRequest_infoDBAsync.readyState == 4 && myRequest_infoDBAsync.status == 200) {
 		var a=null;
		var lista=myRequest_infoDBAsync.responseText.split("SEPINFO");
		//alert(myRequest_infoDBAsync.responseText);
		var j=0;
		for(j=0;j<(PARAM_HANDLER.length);j++){
			if(a=document.getElementById(PARAM_HANDLER[j])){
				a.options.length=0;
				if(myRequest_infoDBAsync.responseText!="VUOTO"){
					app=lista[j].split("SEPCAMPO");
					for(i=0;i<app.length;i++){
						a.options[i]=new Option(app[i],app[i]);
					}
				}else{
					a.options[0]=new Option("Nessuno","-1");
				}
				a.selectedIndex=0;
			}
		}

	}
}



