
function Chiudi()
{
self.opener=self 
self.close();
}


function mmenu(mID) {
	var menu = document.getElementById(mID);
	var display = menu.style.display;
	menu.style.display = (display == "block") ? "none" : "block";
	menu.parentNode.style.listStyleImage = (display == "block") ? "url(images/chiusa.gif)" : "url(images/aperta.gif)";
}

window.onload = function() {
	var uls = document.getElementsByTagName("ul");
	for (i=0;i<uls.length;i++) {
		if(uls[i].className=="submenu")uls[i].style.display = "none";
	}
}



// Restituisce una istanza dell'oggetto XMLHttp (cross-browser)
function getXMLHttp()
{
  var xmlhttp=false;
  // Utilizziamo la compilazione condizionale di JScript
  // per far fronte alle vecchie versioni di
  // Internet Explorer che non supportano i blocchi try/catch.
  /*@cc_on @*/
  /*@if (@_jscript_version >= 5)
  // Prova la creazione dell'oggetto ActiveX XMLHTTP
  try
  {
    xmlhttp = new ActiveXObject('Msxml2.XMLHTTP');
  }
  catch (e)
  {
    try
    {
      xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
    }
    catch (E)
    {
      xmlhttp = false;
    }
  }
  @end @*/
  // Se il browser non è Internet Explorer viene creato
  // l'oggetto XMLHttpRequest (Netscape, Mozilla)


  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
    xmlhttp = new XMLHttpRequest();
  }
  return xmlhttp;
}

// Si connette all'URL specificato, ne preleva i contenuti
// e li visualizza come contenuto del tag avente l'ID specificato
function getURL(url, id)
{
  var xmlhttp = getXMLHttp();
  if (!xmlhttp)
  {
    alert('XMLHttp non supportato dal browser');
    return false;
  }

 // showLoading(true);
  xmlhttp.open('GET', url, true);
  xmlhttp.onreadystatechange=function()
  {
    if (xmlhttp.readyState==4)
    {
//      showLoading(false);
      if (xmlhttp.status == 200)
      {
        var elem = document.getElementById(id);
        if(elem == null)
          alert('Elemento inesistente: ' + id);
        else
          elem.innerHTML = xmlhttp.responseText;
	  onComplete= setTarget(); 

      }
      else if (xmlhttp.status == 404)
        alert('URL inesistente: ' + url);
      else
        alert('Errore: ' + xmlhttp.status);
    }
  }
  xmlhttp.send(null);
}


