function initFocus()
{
  waitBoxStop();
  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
    {
      document.getElementById("value").focus();
    }
  }
  
  if (document.getElementById("logo") != null)
  {
    document.getElementById("logo").innerHTML="<img src=\"./imagesTeca/banner_laurenziana_verde.jpg\" title=\"Logo\" alt=\"Logo\" border=\"0\"/>";
  }

  if (document.getElementById("navigatore") != null)
  {
    document.getElementById("navigatore").style.visibility="hidden";
  }
  
  if (document.getElementById("testoW3c") != null)
  {
    document.getElementById("testoW3c").innerHTML="&nbsp;<a href=\"http://validator.w3.org/check?uri=referer\"><img src=\"./images/valid-xhtml10%2022x62.png\" alt=\"Valid XHTML 1.0 Transitional\" border=\"0\" /></a><br/><a href=\"/analog/\">Statistiche sito</a>";
  }
  if (document.getElementById("logoHeader") != null)
  {
    document.getElementById("logoHeader").style.visibility="hidden";
  }
  if (document.getElementById("loghiButton") != null)
  {
    document.getElementById("loghiButton").style.visibility="hidden";
    testo = "<div class=\"loghiButton1\">";
    testo += "<img src=\"imagesTeca/logo_sismel_versione_standard.gif\" title=\"SISMEL Societ&agrave; internazionale per lo Studio del Medioevo Latino\" alt=\"SISMEL Societ&agrave; internazionale per lo Studio del Medioevo Latino\" border=\"0\"/>";
    testo += "</div>";
    testo += "<div class=\"loghiButton2\">";
    testo += "<img src=\"imagesTeca/linea_rossa_area_loghi.gif\" border=\"0\"/>";
    testo += "</div>";
    testo += "<div class=\"loghiButton3\">";
    testo += "<img src=\"imagesTeca/logo_siav_trasp.gif\" title=\"Siav\" alt=\"Siav\" border=\"0\"/>";
    testo += "</div>";
//    document.getElementById("loghiButton").innerHTML=testo;
  }
  
  
  if (document.getElementById("showVersion") != null)
  {
    document.getElementById("showVersion").rowSpan="2";
  }
  
  if (document.getElementById("showConsistenza") != null)
  {
    document.getElementById("showConsistenza").style.visibility="hidden";
    document.getElementById("showConsistenza").innerHTML="";
  }
  if (document.getElementById("logo1") != null)
  {
//    document.getElementById("logo1").style.visibility="hidden";
    document.getElementById("logo1").innerHTML="<img src=\"imagesTeca/logo_sismel_versione_standard.gif\" title=\"SISMEL Societ&agrave; internazionale per lo Studio del Medioevo Latino\" alt=\"SISMEL Societ&agrave; internazionale per lo Studio del Medioevo Latino\" border=\"0\"/>&nbsp;";
  }
  if (document.getElementById("logo2") != null)
  {
//    document.getElementById("logo2").style.visibility="hidden";
//    document.getElementById("logo2").innerHTML="<img src=\"./imagesTeca/logoMX.gif\" title=\"Massimiliano Randazzo\" alt=\"Massimiliano Randazzo\" border=\"0\"/>";
    document.getElementById("logo2").innerHTML="&nbsp;<img src=\"imagesTeca/logo_siav_trasp.gif\" title=\"Siav\" alt=\"Siav\" border=\"0\"/>";
  }

  if (document.getElementById("head_text2") != null)
  {
    document.getElementById("head_text2").innerHTML="<a href=\"index.html\">Help</a>";
  }
  return false;
}

/**
 * Questo metodo viene utilizzato per visualizzare la pagina di Help
 */
function showHelp()
{
  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)
{
  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;
  }
  location.href= url;
  return false;
}

function resetAll()
{

  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 ="";
    }
  }

  if (document.getElementById("searchLucene") != null)
  {
    document.getElementById("searchLucene").value ="";
  }
  if (document.getElementById("value") != null)
  {
    document.getElementById("value").value = "";
  }
}
