var AggiungiFunzioni =
{
  attachBehavior: function()
   {
       if (   !document.getElementById
           || !document.createElement
           || !document.getElementsByTagName)
       {
           return;
       }

     var anchorTags = document.getElementsByClassName("terzolivello");
   for (var i = 0; i < anchorTags.length ; i++)
       {
           element = anchorTags[i];
          Event.observe(element, "click", AggiungiFunzioni.aprichiudi, false);
     }

     var anchorTagsTabs = document.getElementsByClassName("tab");
   for (var t = 0; t < anchorTagsTabs.length ; t++)
       {
           element = anchorTagsTabs[t];
          Event.observe(element, "click", AggiungiFunzioni.apriTab, false);
     }

    var anchorTagsquarto = document.getElementsByClassName("quartolivello");
   for (var k = 0; k < anchorTagsquarto.length ; k++)
       {

           element = anchorTagsquarto[k];
          Event.observe(element, "click", AggiungiFunzioni.aprichiudiquarto, false);
       }
     var anchorTagsClick = document.getElementsByClassName("optionLink");
   for (var j = 0; j < anchorTagsClick.length ; j++)
       {
           element = anchorTagsClick[j];
          Event.observe(element, "click", AggiungiFunzioni.show, false);
     }
     var anchorTagschooseRoomclass = document.getElementsByClassName("chooseRoomclass");
   for (var l = 0; l < anchorTagschooseRoomclass.length ; l++)
       {
           element = anchorTagschooseRoomclass[l];
          Event.observe(element, "click", AggiungiFunzioni.showChooseRoom, false);
     }
     var anchorTagschooseLoggati = document.getElementsByClassName("chooseLoggati");
   for (var z = 0; z < anchorTagschooseLoggati.length ; z++)
       {
           element = anchorTagschooseLoggati[z];
          Event.observe(element, "click", AggiungiFunzioni.showChooseLoggati, false);
     }
     var anchorTagschooseRegistrati = document.getElementsByClassName("chooseRegistrati");
   for (var y = 0; y < anchorTagschooseRegistrati.length ; y++)
       {
           element = anchorTagschooseRegistrati[y];
          Event.observe(element, "click", AggiungiFunzioni.showChooseRegistrati, false);
     }
   },
   aprichiudi: function(nodoPadre)
  {
     var targ = nodoPadre.srcElement? nodoPadre.srcElement : nodoPadre.target
    nodo = targ.nextSibling;
     if ((nodo.style.display == "none")||(nodo.style.display == ""))
     {
          nodo.style.display = "block";
      targ.style.borderBottom = "none";
        } else {
            nodo.style.display = "none";
       targ.style.borderBottom = "1px solid #FFFFFF";
       }
   },
   apriTab:function(nodoPadre){
     var targ = nodoPadre.srcElement? nodoPadre.srcElement : nodoPadre.target
     var idtarget = targ.id;
     var idt= "opzioniHotel" + idtarget.substring(idtarget.indexOf("_"))
     nodo = document.getElementById(idt);
     if ((nodo.style.display == "none")||(nodo.style.display == ""))
     {
          nodo.style.display = "block";
          targ.parentNode.style.fontWeight  = "bold";
          targ.parentNode.style.backgroundColor ="#CCCCCC";
          var listeOpzioni = document.getElementsByClassName("opzioniHotel");
      for (var k = 0; k < listeOpzioni.length ; k++)
           {
              element = listeOpzioni[k];
              var elementid = element.id;
              var riga = idtarget.substring(idtarget.lastIndexOf("_"))
              var rigaconfronto = elementid.substring(elementid.lastIndexOf("_"))
             if (rigaconfronto == riga)
                {
                if ((element.style.display == "block")&&(nodo.id!=element.id))
             {
               element.style.display = "none";
               var idelem = element.id;
            var idtab = "tab"+idelem.substring(idelem.indexOf("_"));
            nodotab = document.getElementById(idtab);
            nodotab.parentNode.style.fontWeight  = "normal";
                nodotab.parentNode.style.backgroundColor ="#FFFFFF";
             }
            }
         }

        } else {
            nodo.style.display = "none";
            targ.parentNode.style.fontWeight  = "normal";
           targ.parentNode.style.backgroundColor ="#FFFFFF";
       }
   },
   show: function(nodoPadre)
  {
    var targ = nodoPadre.srcElement? nodoPadre.srcElement : nodoPadre.target
    nodo = targ.nextSibling;
    if (nodo.style.display == "none"){nodo.style.display = "block"}
    else if(nodo.style.display == "block"){nodo.style.display = "none"}
    else{nodo.style.display = "block"}
    return false;
  },
  showChooseLoggati: function()
  {
    nodo = document.getElementById('loggati');
    if (nodo.style.display == "none"){nodo.style.display = "block"}
    else if(nodo.style.display == "block"){nodo.style.display = "none"}
    else{nodo.style.display = "block"}
    return false;
  },
  showChooseRegistrati: function()
  {
    nodo = document.getElementById('registrati');
    if (nodo.style.display == "none"){nodo.style.display = "block"}
    else if(nodo.style.display == "block"){nodo.style.display = "none"}
    else{nodo.style.display = "block"}
    return false;
  },
  showChooseRoom: function()
  {
    nodo = document.getElementById('chooseRoom');
    if (nodo.style.display == "none"){nodo.style.display = "block"}
    else if(nodo.style.display == "block"){nodo.style.display = "none"}
    else{nodo.style.display = "block"}
    return false;
  },

  aprichiudiquarto: function(nodoPadre)
  {
     var targ = nodoPadre.srcElement? nodoPadre.srcElement : nodoPadre.target
    nodo = targ.nextSibling;
     if ((nodo.style.display == "none")||(nodo.style.display == ""))
     {
          nodo.style.display = "block";
      targ.style.backgroundImage = "url(img/meno.gif)";
        } else {
            nodo.style.display = "none";
       targ.style.backgroundImage = "url(img/piu.gif)";
       }
   }
}

Event.observe(window, "load", AggiungiFunzioni.attachBehavior, false);



function mostra(urlimg){
    document.getElementById("mostraimmagine").innerHTML = "<img src="+urlimg+" width='435'/>";
}

function colorapadre(idtarget){
     var idnodoPadre = idtarget.replace("opzioniHotel","tab");
     var nodoPadre = document.getElementById(idnodoPadre);
     nodoPadre.parentNode.style.fontWeight  = "bold";
     nodoPadre.parentNode.style.backgroundColor ="#CCCCCC";
   }
