function ApriFinestra (title, arg, width, height)
         {
          //msg = window.open ("", "", "toolbar=no, directories=no, menubar=no, width=500, height=500, resizable=yes, screenX=0, screenY=0");
          //msg = window.open ("", "", "toolbar=no, directories=no, menubar=no, width=screen.width, height=screen.height, resizable=yes, screenX=0, screenY=0");
          //msg = window.open ("", "", "toolbar=no, directories=no, menubar=no, width=400, height=400, resizable=yes, left=availLef, top=availTop");
          
          //msg = window.open ("", "", "toolbar=no, directories=no, menubar=no, width=screen.width/2, height=screen.height/2, resizable=yes, left=0, top=0, scrollbars=yes");
          
          // regolo le dimensioni della finestra
          if (width > screen.width)
             {
              width = screen.width - 200;
             }
          if (height > screen.height)
             {
              height = screen.height - 160;
             }
          
          
          var top = (screen.height - height - 80)/2
          var left = (screen.width - width - 50)/2 
          //window.alert("top="+top+"left="+left)
          msg = window.open ("", "", "toolbar=no, directories=no, menubar=no, width=" + (width + 50) + ", height=" + (height + 80) +", resizable=yes, left=" + left + ", top=" + top + ", scrollbars=yes");
          
          



          msg.document.writeln ("<html>");
          //msg.document.writeln ("<head><title>Camino de Los Incas (Expedition Bike 2004)</title></head>");
          msg.document.writeln ("<head><title>" + title + "</title></head>");
          msg.document.writeln ("<body>");
          //msg.document.writeln ("<b><center><font size=4>Figlio</font></center></b><br>");
          //msg.document.writeln (arg);

          msg.document.writeln ("<center>");
          
          // recupera il nome del file
          var filename_ = arg.split("/");
          var filename = filename_[filename_.length - 1]

          
          
          msg.document.writeln ("<img src=\"" + arg + "\" alt=\"" + filename + "\" + title=\"" + filename + "\">");
          msg.document.writeln ("<br><br>");
          msg.document.writeln ("<input type='button' value='chiudi' name='' onclick='window.close()'>");
          msg.document.writeln ("</center>");
          msg.document.writeln ("</body>");
          msg.document.writeln ("</html>");
         }

function tooltip (str)
         {
          str = str.slice(3, str.length);
          str = str.slice (0, str.length - 4);
          
          str = replace(str, "_", " ");
          return str;
         }

function replace(str_, old_, new_)
         {
          var t_ret = '',
              //str_ = this,
              old_I;
          while ((old_I = str_.indexOf(old_)) != -1)
                {
                 t_ret += str_.substring(0, old_I) + new_;
                 str_ = str_.substring(old_I + old_.length);
                }
          return t_ret+str_;
         }
         
