function getXMLHttpRequestInstance() {

var xmlhttp;

// Prova il metodo Microsoft usando la versione pił recente:
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {

try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}

if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
xmlhttp = false;
}
}

// Restituisce infine l'oggetto:
return xmlhttp;
}

function updateContent(nodeId, html) {

var node = document.getElementById(nodeId);
if(null == node) {
//alert("[ERRORE] L'elemento " + nodeId + " non esiste");
return;
}
//alert(html+ html.length);
node.innerHTML = html;
node.style.visibility = "visible";
}

function showSlide(nodeId, url) {
var xmlhttp = getXMLHttpRequestInstance();
if(!xmlhttp) {
alert("Il browser non supporta l'oggetto XMLHttpRequest");
return false;
}
updateContent(nodeId,"" );
updateContent(nodeId,"<span style='font-size: 16pt; color: #960018; font-style: italic; font-family: Tahoma;'><img src='/ajax/working-anim.gif'></span>");

xmlhttp.open("GET", url,true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
if (xmlhttp.status==200) {
updateContent(nodeId, xmlhttp.responseText);
//alert (xmlhttp.responseText);
} else if (xmlhttp.status==404) {
alert("[ERRORE] l'URL "+url+"non esiste!");
} else {
alert("[ERRORE] errore non gestito (" + xmlhttp.status + ")");
}
}
}

xmlhttp.send(null);
}


function showSlide2(nodeId, url) {
var xmlhttp = getXMLHttpRequestInstance();
if(!xmlhttp) {
alert("Il browser non supporta l'oggetto XMLHttpRequest");
return false;
}
updateContent2(nodeId,"","0");
updateContent2(nodeId,"<span style='font-size: 16pt; color: #960018; font-style: italic; font-family: Tahoma;'><img src='/ajax/working-anim.gif'></span>","0");

xmlhttp.open("GET", url,true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
if (xmlhttp.status==200) {
updateContent2(nodeId, xmlhttp.responseText,"1");
//alert (xmlhttp.responseText);
} else if (xmlhttp.status==404) {
alert("[ERRORE] l'URL "+url+"non esiste!");
} else {
alert("[ERRORE] errore non gestito (" + xmlhttp.status + ")");
}
}
}

xmlhttp.send(null);
}



function updateContent2(nodeId, html,scelta) {

var node = document.getElementById(nodeId);
if(null == node) {
//alert("[ERRORE] L'elemento " + nodeId + " non esiste");
return;
}
if (((scelta!="0") && (html.length>179) && (html.length<197))|| ((scelta!="0") && (html.length==0)))
//103
//185
{
//alert(html+ html.length);
hide('visible');
node.innerHTML = html;
//node.style.visibility = "visible";
}
else
//alert(html+ html.length);
{
//alert(html+ html.length);
unhide('visible');
node.innerHTML = html;
node.style.visibility = "visible";
}
}




function showSlide3(nodeId, url) {
var xmlhttp = getXMLHttpRequestInstance();
if(!xmlhttp) {
alert("Il browser non supporta l'oggetto XMLHttpRequest");
return false;
}
updateContent3(nodeId,"" );
updateContent3(nodeId,"<span style='font-size: 16pt; color: #960018; font-style: italic; font-family: Tahoma;'><img src='/ajax/working-anim.gif'></span>");

xmlhttp.open("GET", url,true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
if (xmlhttp.status==200) {
updateContent(nodeId, xmlhttp.responseText);
//alert (xmlhttp.responseText);
} else if (xmlhttp.status==404) {
alert("[ERRORE] l'URL "+url+"non esiste!");
} else {
alert("[ERRORE] errore non gestito (" + xmlhttp.status + ")");
}
}
}

xmlhttp.send(null);
}


function updateContent3(nodeId, html,scelta) {

var node = document.getElementById(nodeId);
if(null == node) {
//alert("[ERRORE] L'elemento " + nodeId + " non esiste");
return;
}
if (((scelta!="0") && (html.length>185) && (html.length<197))|| ((scelta!="0") && (html.length==0)))
{
//alert(html+ html.length);
hide('visible2');
node.innerHTML = html;
//node.style.visibility = "visible";
}
else
//alert(html+ html.length);
{
//alert(html+ html.length);
unhide('visible2');
node.innerHTML = html;
node.style.visibility = "visible";
}
}








function showSlideno(nodeId, url) {
var xmlhttp = getXMLHttpRequestInstance();
if(!xmlhttp) {
alert("Il browser non supporta l'oggetto XMLHttpRequest");
return false;
}
updateContent(nodeId,"");

xmlhttp.open("GET", url,true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
if (xmlhttp.status==200) {
updateContent(nodeId, xmlhttp.responseText);
//alert (xmlhttp.responseText);
} else if (xmlhttp.status==404) {
alert("[ERRORE] l'URL "+url+"non esiste!");
} else {
alert("[ERRORE] errore non gestito (" + xmlhttp.status + ")");
}
}
}

xmlhttp.send(null);
}

