//
// Author M.Sacchi 07-2001
//

var text = "";
var name = "";

function Utility(Mydoc) {

   var list;
   var line = "";

   list = window.open('Blank.html','CmdAnchor','menubar=no,toolbar=no,resizable=no,status=yes,scrollbars=yes,height=500,width=230,top=20,left=20');
   //list.document.write(line);

   line  = '<HTML>\n';
   line += '<HEAD>\n';
   line += '<TITLE>Ricerca nell\'albo A.I.T.I.</TITLE>\n';
   line += '<link rel="stylesheet" type="text/css" href="styleAITI.css">\n';
   line += '</HEAD>\n';
   line += '<BODY>\n';
   list.document.write(line);
   line  = '<BR><div class="sum">\n';
   line += '<H3>Sommario</H3>\n';

   // elenca gli Anchors
   line += '<B>Iscritti selezionati:</B>\n';
   for (var i=0;i<=Mydoc.anchors.length;i++) {
      if (Mydoc.anchors[i]!=null) {
         if (document.all) {  // IE o NS6
            text = Mydoc.anchors[i].innerText;
         } else if (document.layers) { // NN
            text = Mydoc.anchors[i].text;
         } else if (document.getElementById) {
            text = Mydoc.anchors[i].innerHTML;
            text = text.SpecialChars();
         }
         name = Mydoc.anchors[i].name;
         if ((text == null) || (text == '')) text = name;

         //linea di sommario
         line += '<a href="#' + name + '"\n' +
                 ' onclick="window.opener.location.hash=\'' + name +
                 '\'; return false;">'+text+'</a>\n';

         //gestione testa
         if (name == 'Top') line += '<BR>';
      }
   }
   // chiude il documento
   line += '<FORM NAME=\"sommario\">\n';
   line += '<INPUT CLASS="but" TYPE="button" VALUE="Chiusura" onclick="window.close();">\n';
   line += '</FORM>\n';
   line += '</div>\n';
   line += '</BODY>\n';
   line += '</HTML>\n';
   list.document.write(line);
   list.document.close();
   return true;
}

// Elenco completo degli iscritti
function displayItem() {

   var list;
   var line = "";

   //list = window.open('Blank.html','Cmdlista','menubar=yes,toolbar=yes,resizable=yes,status=yes,scrollbars=yes,top=10,left=10');
   list = window.open('Blank.html','Cmdlista','menubar=no,toolbar=no,resizable=yes,status=yes,scrollbars=yes,top=10,left=10');

   line  = '<html>\n';
   line += '<head>\n';
   line += '   <title>Motore di ricerca</title>\n';
   line += '   <link rel="stylesheet" type="text/css" href="styleAITI.css">\n';
   line += '</head>\n';
   line += '<body>\n';
   list.document.write(line);
   line  = '   <h3>Elenco completo dei soci:</h3>\n';
   line += '   <div class="genlist">\n';
   list.document.write(line);
   for (c=1; c<=i; c++) {
       line  = '      <div class="genriga">\n';
       line += '         <div class="genname">\n';
       if (voce[c].curr != ' ') {
          line += '            <a class="gencurr" href="javascript:;" onClick="window.open(\'' + DirCur + voce[c].curr + '\',\'NewWin\',' +
                  '\'toolbar=no,status=no,resizable=yes,scrollbars=yes,width=540,height=450,top=100,left=100\');">' +
                  '<b class="genprof">' + voce[c].nome.SpecialChars() + '</b></a>\n';
       }else{
          line += '            <b class="genprof">' + voce[c].nome.SpecialChars() + '</b>\n';
       }
       line += '            <br>' + voce[c].pos + '\n';
		 line += '         </div>\n';
       //--------------
       code  = '         <div class="genspec">\n';
       mkLogo();
       code += '\n         </div>\n';
       //--------------
       line += code;
       //--------------
       code  = '         <div class="genlang">\n';
       // Lingue madre - attive -passive
       code += '            (LM ' + voce[c].lm;
       if (voce[c].la != ' ') {
          code += ' - LA ' + voce[c].la;
       }
       if (voce[c].lp != ' ') {
          code += ' - LP ' + voce[c].lp;
       }
       code += ')\n';
       code += '         </div>\n';
       //--------------
       line += code;
       //<a class="webmaster" href="mailto:infoaiti@aitifriulivg.it">Amministratore del Sito</a>
       if (voce[c].email != ' ') {
          line += '         <a class="genmail" href="mailto:' + voce[c].email +
                  '" target="_blank">'+ voce[c].email + '</a>\n';
                  //'" target="_blank">'+ 'e-mail' + '</a>\n';
                  //'" target="_blank">'+ '<img src="./images/konv14.gif" title="e-mail">' + '</a>\n';
       } else {
          line += "&nbsp;\n";
       }
       line += '      </div>\n';
       list.document.write(line);
   }
   line  = '      <form name=\"sommario\">\n';
   line += '      <input class=\"but\" type=\"button\" value=\"Chiusura\" onclick=\"window.close();\">\n';
   line += '      </form>\n';
   line += '      <br><br>Data ultima modifica: ' + last + '\n';
   line += '   </div>\n';
   line += '</body>\n';
   list.document.write(line);
   list.document.close();
   return true;
}
function togglespiega() {
   if (xx[0].style.visibility == "" || xx[0].style.visibility == "visible") {
      xx[0].style.visibility = "hidden";
      xx[0].style.position   = "absolute";
      xx[0].style.top        = 1340;
   }else{
      xx[0].style.visibility = "visible";
      xx[0].style.position   = "static";
    //xx[0].style.top        = 206;
   }
   return true;
}

/* -------------------------------------------------------------------------------------
   --- Libreria di Proprieta' e Metodi aggiuntivi per JavaScript                       -
   --- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   --- Gli script che seguono sono gratuiti e liberi da Copyright.                     -
   --- Il riutilizzo e la modifica sono consentiti senza alcuna limitazione sia per    -
   --- usi amatoriali che professionali.                                               -
   ---                                                                                 -
   --- Questa libreria e' disponibile alla URL: http://www.jsdir.com/LibreriaJs        -
   ---                                                                                 -
   --- Generata il: Lunedi' 31 Maggio  2004 - 4:15:33 PM                               -
   ---                                                                                 -
   --- E' fatta richiesta all'utilizzatore di lasciare inalterato questo commento      -
   --- iniziale quale "credit" per i realizzatori, ed i commenti successivi per dar    -
   --- modo, a successivi utilizzatori, di capire il funzionamento dei metodi e di     -
   --- reperire il sorgente originale con i relativi aggiornamenti.                    -
   ---                                                                                 -
   ---                                                         webmasterATjsdir.com     -
   ---                                                                                 -
   ---------------------------------------------------------------------------------- */

/* -----------------------------------------------------------------------------------
------- SpecialChars( [TipoSostituzione] ) -------------------------------------------
------- Metodo aggiuntivo per l'oggetto String, consente di sostituire,nella stringa
------- cui viene applicato, le lettere accentate con i corrispondenti codici HTML e
------- viceversa.
-------
------- Supponendo di avere: Str1=" però ", Str2= " partì "
-------
------- Str1.SpecialChars(); restituisce " però "
-------
------- Str1.SpecialChars(true); restituisce " però "
-------
------- Str2.SpecialChars(false); restituisce " partì "
-------
-------                                                                            --- */
function SpecialChars(_flag)
   {
   _flag=arguments.length?_flag?0:1:0;
   var _CharsArray= [
      ["à","&agrave;"],
      ["á","&aacute;"],
      ["è","&egrave;"],
      ["é","&eacute;"],
      ["ì","&igrave;"],
      ["ò","&ograve;"],
      ["ù","&ugrave;"]
      ];
   var _SpecialChars=this.toString();
   // Corretto un bug : la variabile <i> deve essere dichiarata qui per impedire l'utilizzo di una
   // omonima dichiarata esternamente alla routine.  Max.
      for (var i in _CharsArray)
         _SpecialChars=_SpecialChars.replace(new RegExp(_CharsArray[i][_flag],"g"),_CharsArray[i][1-_flag]);
   return _SpecialChars;
   }

String.prototype.SpecialChars=SpecialChars;
/* ----------------------------------------------------------------------------------- */
/* dal sito http://www.constile.org                                                    */
/* ----------------------------------------------------------------------------------- */
function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = '; expires='+date.toGMTString();
  }
  else expires = '';
  document.cookie = name+'='+value+expires+'; path=/';
}

function readCookie(name) {
  var nameEQ = name + '=';
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}
function setCSS(nome_file_css) {
createCookie('skinUtente',nome_file_css,365);
location.reload();
}
function setCSShref(nome_file_css) {
var link_ = document.getElementsByTagName("link");
for ($i=0;$i<link_.length;$i++)
   if(link_[$i].media=="screen") link_[$i].href=nome_file_css+".css";
}
window.onload = function() {
   nome_file_css = readCookie('skinUtente');
   if(nome_file_css) setCSShref(nome_file_css);
}

