function LivelliImmediati(Livelli, Titolo)
{
   this.window = null;
   this.levels = Livelli;
   this.caption = Titolo;

   // metodi
   this.initWindow  = function ()
   {
      var rLevels = '';
      rLevels += '<DIV align="center" class="mapDefaultFont mapHeaderColor" STYLE="height: 100%"> ';
      rLevels += '<BR>';
   	rLevels += '<form ID="ftImmediate" name="ftImmediate" >';
      rLevels += '    <CENTER>';
      rLevels += '       <TABLE ID="TableImmediati" cellSpacing=5 cellPadding=0 border=0 CLASS="smallfont">';
      
      for (var i = 0; i < this.levels.length; i++)
      {
         var l = this.levels[i];
         rLevels += ' <TR CLASS="smallfont" STYLE="padding-bottom:5px" align="top"> ';
         rLevels += '   <TD> <IMG id="item' + l.id + '" name="item' + l.id + '" src="'+ l.image +'" border="0"></TD>';
         rLevels += '   <TD> <INPUT id=Chk' + l.id + ' onclick="top.LivelliImmediati.oncheck(\''+ l.id +'\', false)" type=checkbox CHECKED></TD>';
         rLevels += '   <TD> <SPAN onclick="top.LivelliImmediati.oncheck(\''+ l.id +'\', true)">'+ l.description + '</SPAN></TD>';
         rLevels += ' </TR> ';
      }

      rLevels += '       </TABLE>';
      rLevels += '    </CENTER>';
      rLevels += '    <BR>';
      rLevels += '</form>';
      rLevels += '</div> ';
   
      /*
      var rLevels = "<BR><BR><BR><BR><BR>Ciao ciao";
      */
         
      var wLivelli = new LayerWindow("LivelliImmediati", top.document, rLevels);
      var iH = parseInt(screen.height * 0.8);
      wLivelli.open (10, 10, 300, iH, this.caption, true, true, true);
      with (wLivelli.layer.style)
      {
         backgroundColor="Infobackground";
         color = "Infotext";
      } 
      
      wLivelli.onactivemouse   = function () { top.Mappa.enabled = false; }
      wLivelli.oninactivemouse = function () { top.Mappa.enabled = true; }

      this.window = wLivelli;
   },
   
   this.disposeWindow = function (mapCoord, menCoord)
   {
      var mapL = mapCoord[0];
      var mapT = mapCoord[1];
      
      with (this.window.layer)
      {
         style.top = mapT  + "px";
         style.left = (mapL - parseInt(style.width)) + "px";
      }
   },
   
   this.activate = function () 
   { 
      for (i = 0; i < this.levels.length; i++)
      {
         document.ftImmediate.elements['Chk' + this.levels[i].id].checked = !this.levels[i].off;   
      } 

      this.window.show(); 
   },
   
   this.oncheck = function (strID, booFlip)
   {
      if (booFlip)   document.ftImmediate.elements['Chk' + strID].checked = !document.ftImmediate.elements['Chk' + strID].checked;
   
      var booChecked = document.ftImmediate.elements['Chk' + strID].checked;      
      var H = top.objHotSpots.hotspots;

      for (var i = 0; i < H.length; i++)
      {
         if (H[i].id == strID)
         {
            H[i].off = !booChecked;
            H[i].show(top.Mappa.doc, top.Mappa, true);
         }
      }      
   
      for (var i = 0; i < this.levels.length; i++)
      {
         if (strID == this.levels[i].id)   
         {
            this.levels[i].off = !booChecked;
            break;
         }
      } 
   }
}   
