function chiama(par,nano2){
var nano, voce, pagina
var xmlHttp = null
//qui decide se mettere il risultato in un oggetto di cui è noto l'ID o se scrivere direttamente
function stateChanged() {
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
if (xmlHttp.responseText=="sessionscaduta") {
//alert("Sessione scaduta!");
top.location.href="index.asp";
}
if (nano == "£") {
voce = xmlHttp.responseText.split("|#");
voci();
} else{
//alert("chiamato per esecuzione asp")
document.getElementById(nano).innerHTML=xmlHttp.re sponseText ;
voci()
}
}
//document.getElementById("bodi").style.cursor="defa ult";
//alert("inviato");
}
//questa serve a individuare l'oggetto xmlhttp più adatto
function GetXmlHttpObject(handler)
{
var objXMLHttp=null
try {
objXMLHttp=new ActiveXObject("Msxml2.XMLHTTP")
}
catch(e) {
try {
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
}
catch(f){
objXMLHttp=new XMLHttpRequest()
}
}
return objXMLHttp
}
// questa l'ho fatta io: distribuisce nei vari oggetti i valori dell'array
function voci(){
try {
for (i=0; i<voce.length; i++) {
if (document.getElementById("id"+i)){
document.getElementById("id"+i).innerHTML=voce[i];
//} else {
//alert("elemento id"+ i + " not found");
}
}
} catch(y) {
}
}
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null){
alert ("Browser does not support HTTP Request");
return
}
document.getElementById("bodi").style.cursor="wait ";
var url=par;
nano = nano2
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
document.getElementById("bodi").style.cursor="defa ult";
}