function initFocus()
{
  if (document.getElementById("tipoRice") != null)
  {
    if (document.getElementById("tipoRice").value == "riceTitolo")
    {
      document.getElementById("DCTITLE").focus();
    }
    else if (document.getElementById("tipoRice").value == "riceLibera")
    {
      document.getElementById("keyworks").focus();
    }
    else if (document.getElementById("tipoRice").value == "riceBase")
    {
      document.getElementById("value_1").focus();
    }
    else if (document.getElementById("tipoRice").value == "riceMultipla")
    {
      document.getElementById("value_DCTITLE").focus();
    }
    else
    {
      document.getElementById("value").focus();
    }
  }

  if (document.getElementById("logo") != null)
  {
    document.getElementById("logo").innerHTML="<a href='http://www.regione.piemonte.it' title='Regione Piemonte home page'><span>Regione Piemonte home page</span></a>";
  }

  if (document.getElementById("navigatore") != null)
  {
    document.getElementById("navigatore").innerHTML="<p><a href=\"http://www.regione.piemonte.it/cultura/bdp/index.htm\" class=\"biblio\">Biblioteca digitale piemontese</a><span class=\"hidden\">|</span><a href=\"home.jsp\">Scegli una diversa modalit&agrave; di ricerca</a></p>";
  }

  if (document.getElementById("testoW3c") != null)
  {
    document.getElementById("testoW3c").innerHTML="<img src=\"images/teca.gif\" alt=\"Teca digitale\" width=\"164\" height=\"54\" border=\"0\" />";
  }

  if (document.getElementById("logoHeader") != null)
  {
    document.getElementById("logoHeader").style.visibility="hidden";
  }

  if (document.getElementById("legenda") != null)
  {
    testo = "";
    testo += "<p>";
    testo += "Selezionare <img src=\"images/showMag.png\" width=\"22\" alt=\"Dettaglio Mag\" title=\"Dettaglio Mag\" border=\"0\"/>";
    testo += " per visulizzare la scheda del periodico. Selezionare <img src=\"images/visimage.gif\" alt=\"Visualizza Immagini\" title=\"Visualizza Immagini\" border=\"0\"/>";
    testo += " per visualizzarne il contenuto.<br/>";
    testo += "Selezionare <img src=\"images/showAudio.png\" alt=\"Ascolta audio\" title=\"Ascolta audio\" width=\"22\" border=\"0\" height=\"22\"> per ascoltare il file audio. ";
    testo += "Selezionare <img src=\"images/showVideo.png\" alt=\"Visualizza Video\" title=\"Visualizza Video\" width=\"22\" border=\"0\" height=\"22\"> per visualizzare il file video collegato.";
    testo += "</p>";

    document.getElementById("legenda").cells[0].colSpan="2";
    document.getElementById("legenda").cells[0].className="documentResult";
    document.getElementById("legenda").cells[0].innerHTML= testo;
  }

  if (document.getElementById("menuLegendariceLibera") != null)
  {
    document.getElementById("menuLegendariceLibera").style.visibility="hidden";
  }

  if (document.getElementById("menuLegendariceLibera_Show") != null)
  {
    document.getElementById("menuLegendariceLibera_Show").style.visibility="hidden";
  }

  if (document.getElementById("menuLegendariceBase") != null)
  {
    document.getElementById("menuLegendariceBase").innerHTML ="<td colspan=\"2\"><p class=\"spiega\">Digitare i termini di ricerca nelle caselle di testo presenti sulla destra dei campi Autore, Titolo ecc. <br />&Egrave; possibile selezionare campi di ricerca diversi cliccando sui menu a tendina. Si possono combinare pi&ugrave; campi di ricerca.</p></td>";
  }

  if (document.getElementById("menuLegendariceAvanzata") != null)
  {
    testo = "<td colspan=\"2\"><p class=\"spiega\">";
    testo += "Selezionare un campo di ricerca dal menu a tendina; digitare il termine di ricerca e cliccare sul pulsante &quot;<em>Aggiungi</em>&quot;. Si possono combinare campi diversi selezionandoli successivamente dal menu a tendina ricordandosi di cliccare sempre sul pulsante &quot;<em>Aggiungi</em>&quot; dopo aver digitato la parola da ricercare.</p>";
    testo += "<a href=\"legenda.html\" class=\"spiega\" target=\"_blank\">Utilizzo degli operatori logici e delle funzioni messe a disposizione</a>";
    testo += "</td>";
    document.getElementById("menuLegendariceAvanzata").innerHTML = testo;
  }

  if (document.getElementById("logo1") != null)
  {
    document.getElementById("logo1").style.visibility="hidden";
  }

  if (document.getElementById("logo2") != null)
  {
    document.getElementById("logo2").style.visibility="hidden";
  }

  if (document.getElementById("head_text2") != null)
  {
    document.getElementById("head_text2").innerHTML="";
  }

  waitBoxStop();

  return false;
}

/**
 * Questo metodo viene utilizzato per visualizzare la pagina di Help
 */
function showHelp()
{

  var url = "";
  url = location.protocol;
  url += "//";
  url += location.host;
  url += "/TecaRicerca/help.html";
  location.href= url;
//  help = window.open("help.html", "help", "width=600,height=500,fullscreen=no, menubar=no, resizable=no, status=no, titlebar=no, toolbar=no, scrollbars=yes");
//  help.focus();
}

/**
 * Questo metodo viene utilizzato per cambiare il filtro della ricerca
 */
function changeFiltro(level, fondi)
{
  document.getElementById("DCLEVEL").value = level;
  document.getElementById("DCFONDI").value = fondi;
  document.getElementById("pageAtt").value = "1";
  document.getElementById("pageStart").value = "1";
  return changePagina(1);
}

/**
 * Questo metodo viene utilizzato per cambiare la pagina da visualizzare
 */
function changePagina(numPagina)
{
  document.getElementById("pageAtt").value = numPagina;
  document.getElementById("fSearch").submit();
  return false;
}

/**
 * Questo metodo viene utilizzato per cambiare la pagina da visualizzare
 */
function chanePaginaStart(numPagina)
{
  document.getElementById("pageStart").value = numPagina;
  document.getElementById("fSearch").submit();
  return false;
}

function showImg(Idr, keyworks, pagina, valueContenuti)
{
  var url = "";
  url = location.protocol;
  url += "//";
  url += location.host;
  url += "/TecaViewer/index.jsp?RisIdr="+Idr;
  if (keyworks != "")
  {
    url += "&keyworks="+keyworks;
  }
  if (pagina != "" && pagina !="1")
  {
    url += "&pagina="+pagina;
  }
  if (valueContenuti != "")
  {
    url += "&valueContenuti="+valueContenuti;
  }
  location.href= url;
  return false;
}

function resetAll()
{

  key = new Array("DCCREATOR","DCTITLE","DCSUBJECT","DCPUBLISHER","DCAGENCY","DCIDENTIFIER","DCDESCRIPTION","DCCONTRIBUTOR",
                  "DCDATE","DCTYPE","DCFORMAT","DCLANGUAGE","DCINVENTARY","DCSHELFMARK","KEYWORDS","STRU","OCR");
  
  if (document.getElementById("DCTITLE") != null)
  {
    document.getElementById("DCTITLE").value ="";
  }

  if (document.getElementById("keyworks") != null)
  {
    document.getElementById("keyworks").value ="";
  }

  for(y=0; y<10; y++)
  {
    if (document.getElementById("value_"+y) != null)
    {
      document.getElementById("value_"+y).value ="";
    }
  }

  for(y=0; y<key.length; y++)
  {
    if (document.getElementById("value_"+key[y]) != null)
    {
      document.getElementById("value_"+key[y]).value ="";
    }
  }

  if (document.getElementById("searchLucene") != null)
  {
    document.getElementById("searchLucene").value ="";
  }
  if (document.getElementById("value") != null)
  {
    document.getElementById("value").value = "";
  }
}

// Aggiornamento Versione 3.2.20
function checkAgency(value, pos)
{
  if (value == "DCAGENCY")
  {
    document.getElementById("divValue_"+pos).className ="divValueHidden";
    document.getElementById("divValueAgency_"+pos).className ="divValue";
  }
  else
  {
    document.getElementById("divValue_"+pos).className ="divValue";
    document.getElementById("divValueAgency_"+pos).className ="divValueHidden";
  }
}

