 //v3.0
//No need to edit beyond here

var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1
var ns6=document.getElementById&&!document.all
var ns4=document.layers

function get_aess_path()
{
   return('/aco_wrk/');
}

function showmenu(e,which)
{
   if (!document.all&&!document.getElementById&&!document.layers)
      return

   clearhidemenu()

   menuobj=ie4? document.all.popmenu : ns6? document.getElementById("popmenu") : ns4? document.popmenu : ""
   menuobj.thestyle=(ie4||ns6)? menuobj.style : menuobj

   if (ie4||ns6)
      menuobj.innerHTML=which
   else
   {
      menuobj.document.write('<layer name=gui bgColor=#E6E6E6 width=165 onmouseover="clearhidemenu()" onmouseout="hidemenu()">'+which+'</layer>')
      menuobj.document.close()
   }

   menuobj.contentwidth=(ie4||ns6)? menuobj.offsetWidth : menuobj.document.gui.document.width
   menuobj.contentheight=(ie4||ns6)? menuobj.offsetHeight : menuobj.document.gui.document.height
   eventX=ie4? event.clientX : ns6? e.clientX : e.x
   eventY=ie4? event.clientY : ns6? e.clientY : e.y

   //Find out how close the mouse is to the corner of the window
   var rightedge=ie4? document.body.clientWidth-eventX : window.innerWidth-eventX
   var bottomedge=ie4? document.body.clientHeight-eventY : window.innerHeight-eventY

   //if the horizontal distance isn't enough to accomodate the width of the context menu
   if (rightedge<menuobj.contentwidth)
      //move the horizontal position of the menu to the left by it's width
      menuobj.thestyle.left=(ie4? document.body.scrollLeft+eventX-menuobj.contentwidth : ns6? window.pageXOffset+eventX-menuobj.contentwidth : eventX-menuobj.contentwidth) - 50
   else
      //position the horizontal position of the menu where the mouse was clicked
      menuobj.thestyle.left=(ie4? document.body.scrollLeft+eventX : ns6? window.pageXOffset+eventX : eventX) - 50

   //same concept with the vertical position
   if (bottomedge<menuobj.contentheight)
      menuobj.thestyle.top=(ie4? document.body.scrollTop+eventY-menuobj.contentheight : ns6? window.pageYOffset+eventY-menuobj.contentheight : eventY-menuobj.contentheight) + 20
   else
      menuobj.thestyle.top=(ie4? document.body.scrollTop+event.clientY : ns6? window.pageYOffset+eventY : eventY) + 20
   
   menuobj.thestyle.visibility="visible"
   return false
}

function contains_ns6(a, b)
{
   //Determines if 1 element in contained in another- by Brainjar.com
   while (b.parentNode)
      if ((b = b.parentNode) == a)
         return true;
   return false;
}

function hidemenu()
{
   if (window.menuobj)
      menuobj.thestyle.visibility=(ie4||ns6)? "hidden" : "hide"
}

function dynamichide(e)
{
   if (ie4&&!menuobj.contains(e.toElement))
      hidemenu(ie4,ns6)
   else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
      hidemenu(ie4,ns6)
}

function delayhidemenu()
{
   if (ie4||ns6||ns4)
      delayhide=setTimeout("hidemenu()",500)
}

function clearhidemenu()
{
   if (window.delayhide)
      clearTimeout(delayhide)
}

function highlightmenu(e,state)
{
   if (document.all)
      source_el=event.srcElement
   else if (document.getElementById)
      source_el=e.target
   if (source_el.className=="menuitems")
   {
      source_el.id=(state=="on")? "mouseoverstyle" : ""
   }
   else
   {
      while(source_el.id!="popmenu")
      {
         source_el=document.getElementById? source_el.parentNode : source_el.parentElement
         if (source_el.className=="menuitems")
         {
            source_el.id=(state=="on")? "mouseoverstyle" : ""
         }
      }
   }
}

function MM_swapImgRestore() {
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() {
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() {
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

function load_to_2_frame(w, page, w1, page1)
{
   w.location.href=page;
   w1.location.href=page1;
}

function load_to_frame(w, page)
{
   w.location.href=page;
}

function load_plsql_to_frame(w, page)
{
   w.location.href=get_aess_path()+page;
}

function show(w, object) 
{
   if (w.document.layers && w.document.layers[object] != null)
       w.document.layers[object].visibility = 'visible';
   else if (document.all)
       w.document.all[object].style.visibility = 'visible';
}

function hide(w, object)
{
   if (w.document.layers && w.document.layers[object] != null)
       w.document.layers[object].visibility = 'hidden';
   else if (document.all)
       w.document.all[object].style.visibility = 'hidden';
} 

function lista(NomeArea, Titolo, fld_name, frm_name)
{
   win_voc = window.open(get_aess_path() + "aco_apri_voc?camposcelto=" + NomeArea + "&tabellascelta=" + Titolo + "&fld_name=" + fld_name + "&frm_name=" + frm_name, "win_voc", "scrollbars=no,toolbar=no,scrolling=no,location=no,resizable=yes,status=no,width=650,height=370")
   windowWidth=650;
   windowHeight=370;
   if (parseInt(navigator.appVersion) >= 4) win_voc.moveTo((screen.width/2)-(windowWidth/2+10),(screen.height/2)-(windowHeight/2+20));
   win_voc.focus();
}

function lista_chi(arg1, campo1, tabella1, arg2, campo2, tabella2, fld_name, frm_name)
{
   win_voc = window.open(get_aess_path() + "aco_apri_voc_chi?arg1=" + arg1 + "&campo1=" + campo1 + "&tabella1=" + tabella1 + "&arg2=" + arg2 + "&campo2=" + campo2 + "&tabella2=" + tabella2 + "&fld_name=" + fld_name + "&frm_name=" + frm_name, "win_voc", "scrollbars=no,toolbar=no,scrolling=no,location=no,resizable=yes,status=no,width=650,height=370")
   windowWidth=650;
   windowHeight=370;
   if (parseInt(navigator.appVersion) >= 4) win_voc.moveTo((screen.width/2)-(windowWidth/2+10),(screen.height/2)-(windowHeight/2+20));
   win_voc.focus();
}

function apri_lista_doc(page_to_open)
{
   var lista_doc = window.open(get_aess_path() + page_to_open, "lista_doc", "scrollbars=yes,toolbar=no,statusbar=yes,scrolling=yes,location=no,resizable=yes,status=no,width=800,height=600")
   windowWidth=800;
   windowHeight=600;
   if (parseInt(navigator.appVersion) >= 4) lista_doc.moveTo((screen.width/2)-(windowWidth/2+10),(screen.height/2)-(windowHeight/2+20));
   lista_doc.focus();
}

function apri_pagina(page_to_open)
{
   var doc_win = window.open(page_to_open, "doc_win", "scrollbars=yes,toolbar=no,statusbar=yes,scrolling=yes,location=no,resizable=yes,status=no,width=700,height=435")
   doc_win.focus();
}

function apri_scheda_doc(page_to_open)
{
   var doc_win = window.open(get_aess_path() + page_to_open, "doc_win", "scrollbars=yes,toolbar=no,statusbar=yes,scrolling=yes,location=no,resizable=yes,status=no,width=700,height=435")
   windowWidth=700;
   windowHeight=435;
   if (parseInt(navigator.appVersion) >= 4) doc_win.moveTo((screen.width/2)-(windowWidth/2+10),(screen.height/2)-(windowHeight/2+20));
   doc_win.focus();
}

function apri_scheda_eve(page_to_open)
{
   var eve_win = window.open(get_aess_path() + page_to_open, "eve_win", "scrollbars=yes,toolbar=no,statusbar=yes,scrolling=yes,location=no,resizable=yes,status=no,width=700,height=435")
   windowWidth=700;
   windowHeight=435;
   if (parseInt(navigator.appVersion) >= 4) eve_win.moveTo((screen.width/2)-(windowWidth/2+10),(screen.height/2)-(windowHeight/2+20));
   eve_win.focus();
}

function apri_scheda_sup(page_to_open)
{
   var sup_win = window.open(get_aess_path() + page_to_open, "sup_win", "scrollbars=yes,toolbar=no,statusbar=yes,scrolling=yes,location=no,resizable=yes,status=no,width=700,height=435")
   windowWidth=700;
   windowHeight=435;
   if (parseInt(navigator.appVersion) >= 4) sup_win.moveTo((screen.width/2)-(windowWidth/2+10),(screen.height/2)-(windowHeight/2+20));
   sup_win.focus();
}

function apri_scheda_imm(page_to_open)
{
   var imm_win = window.open(get_aess_path() + page_to_open, "imm_win", "scrollbars=yes,toolbar=no,statusbar=yes,scrolling=yes,location=no,resizable=yes,status=no,width=700,height=435")
   windowWidth=700;
   windowHeight=435;
   if (parseInt(navigator.appVersion) >= 4) imm_win.moveTo((screen.width/2)-(windowWidth/2+10),(screen.height/2)-(windowHeight/2+20));
   imm_win.focus();
}

function chiudi_finestra()
{
   window.close();
}

function go_back()
{
   window.history.back();
}

function immagine_grande(url)
{
   zoom = window.open("/zoom.htm?"+url, "zoom", "height=550,width=550");
   windowWidth=550;
   windowHeight=550;
   if (parseInt(navigator.appVersion) >= 4) zoom.moveTo((screen.width/2)-(windowWidth/2+10),(screen.height/2)-(windowHeight/2+20));
/*
   var my_zoom = window.open(get_aess_path() + "pagina_immagine?img_path=" + url, "Zoom", "scrollbars=yes,toolbar=no,locationbar=no,resizable=yes,statusbar=no,width=600,height=600,left=10,top=10")
   my_zoom.focus();
*/
}

function disappear()
{
   otext.otext1.style.visibility="hidden"; 
}

function reappear()
{
   otext.otext1.style.visibility="visible"; 
}

function apri_percorso(page_to_open, w, h)
{
   win_percorso = window.open(page_to_open, "win_percorso", "scrollbars=no,toolbar=no,scrolling=no,location=no,resizable=no,status=no,width="+w+",height="+h)
 
   windowWidth=w;
   windowHeight=h;
   if (parseInt(navigator.appVersion) >= 4) win_percorso.moveTo((screen.width/2)-(windowWidth/2+10),(screen.height/2)-(windowHeight/2+20));
 
   win_percorso.focus();
}

function apri_popup(page_to_open, w, h)
{
   win_pop = window.open(page_to_open, "win_pop", "scrollbars=yes,scrolling=yes,toolbar=no,location=no,resizable=no,statusbar=no,width="+w+",height="+h)

   windowWidth=w;
   windowHeight=h;
   if (parseInt(navigator.appVersion) >= 4) win_pop.moveTo((screen.width/2)-(windowWidth/2+10),(screen.height/2)-(windowHeight/2+20));

   win_pop.focus();
}

function apri_mappa_sito(page_to_open)
{
   win_mappa = window.open(page_to_open, "win_mappa", "scrollbars=no,toolbar=no,scrolling=no,location=no,resizable=yes,status=no,width=760,height=458")

   windowWidth=760;
   windowHeight=458;
   if (parseInt(navigator.appVersion) >= 4) win_mappa.moveTo((screen.width/2)-(windowWidth/2+10),(screen.height/2)-(windowHeight/2+20));

   win_mappa.focus();
}

function update_page_with_link(link_name)
{
   if (link_name != null)
   {
      window.close();
      opener.location.href = link_name;
   }
}

function apri_help(page_to_open)
{
   win_help = window.open(page_to_open, "win_help", "scrollbars=no,toolbar=no,scrolling=no,location=no,resizable=yes,status=no,width=760,height=500")
   win_help.focus();
}

function apri_plug_in(page_to_open)
{
   win_plug = window.open(page_to_open, "win_plug", "scrollbars=no,toolbar=no,scrolling=no,location=no,resizable=yes,status=no,width=760,height=500")
   windowWidth=760;
   windowHeight=500;
   if (parseInt(navigator.appVersion) >= 4) win_plug.moveTo((screen.width/2)-(windowWidth/2+10),(screen.height/2)-(windowHeight/2+20));

   win_plug.focus();
}

function apri_glossario(page_to_open)
{
   win_gloss = window.open(get_aess_path() + "aco_glossario", "win_gloss", "scrollbars=yes,toolbar=no,statusbar=yes,scrolling=yes,location=no,resizable=yes,status=no,width=760,height=460")
   windowWidth=760;
   windowHeight=460;
   if (parseInt(navigator.appVersion) >= 4) win_gloss.moveTo((screen.width/2)-(windowWidth/2+10),(screen.height/2)-(windowHeight/2+20));
   win_gloss.focus();
}

function aggiorna(form_name, NomeArea)
{
   num = document.forms[0].valorescelto.selectedIndex;
   aaa = document.forms[0].valorescelto.options[num].text;

   window.close();
   Campo = eval("opener.document." + form_name + "." + NomeArea);
   Campo.value = aaa;
/*
   -- ricorda il contenuto precedente e aggiunge quello attuale scelto da vocab.
   exVal = Campo.value
   if(exVal!=null && exVal!="")
   {
      Campo.value = Campo.value + "; " + aaa
   }
   else
   { 
      Campo.value = aaa
   } 
*/
}

function aggiorna_chi(form_name, fld_name, chi_specifier)
{
   num = eval("document.forms[0].valore" + chi_specifier + ".selectedIndex");
   aaa = eval("document.forms[0].valore" + chi_specifier + ".options[" + num + "].text");

   window.close();
   Campo = eval("opener.document." + form_name + "." + fld_name + "_" + chi_specifier);
   Campo.value = aaa;
}

function scrolldown()
{         
   for (I=100;I>=0;I--)
     parent.dati.window.scrollBy(0,1);
}    

function scrollup()
{
   for (I=100;I>=0;I--)
     parent.dati.window.scrollBy(0,-1);
}    

// Replaces oldS with newS in the string fullS
function replaceString(oldS, newS, fullS)
{
   for (var i=0; i<fullS.length; i++)
   { 
      if (fullS.substring(i, i+oldS.length) == oldS)
         fullS = fullS.substring(0, i) + newS + fullS.substring(i+oldS.length, fullS.length);
   }
   return fullS;
}

function apri_catalogo()
{
   win_catalogo = window.open(get_aess_path() + "aco_apri_catalogo", "win_catalogo", "scrollbars=yes,toolbar=no,statusbar=yes,scrolling=yes,location=no,resizable=yes,status=no,width=800,height=600");
   win_catalogo.focus();
}

function frase_ricerca(page_to_open)
{
   var frase = window.open(get_aess_path() + page_to_open, "frase", "scrollbars=yes,toolbar=no,statusbar=yes,scrolling=yes,location=no,resizable=yes,status=no,width=600,height=400")
   frase.focus();
}

function apri_cluster_page()
{ 
   document.location.href=(get_aess_path() + "cluster_page");
}

function apri_ric_avanzata(page_to)
{ 
   document.location.href=(get_aess_path() + "ava_init_ricerca?page_to="+page_to);
}

function apri_ric_avanzata_doc()
{ 
   document.location.href=(get_aess_path() + "ava_init_ricerca?page_to=doc");
}

function apri_ric_avanzata_eve()
{ 
   document.location.href=(get_aess_path() + "ava_init_ricerca?page_to=eve");
}

function apri_ric_avanzata_sup()
{ 
   document.location.href=(get_aess_path() + "ava_init_ricerca?page_to=sup");
}

function apri_ric_avanzata_imm()
{ 
   document.location.href=(get_aess_path() + "ava_init_ricerca?page_to=imm");
}

/* sostituisce il carattere spazio con %20, 
   il carattere apice singolo con | (pipe)
   il carattere apice doppio con *$* (asterisco dollaro asterisco) 
   il carattere & con =!= (uguale punto esclamativo uguale) */
function change_key(key)
{ 
   var space = " ";
   var apice = "'";
   var doppio_apice = "\"";
   var e_commerciale = "&";

   key = replaceString(space, "%20", key);
   key = replaceString(apice, "|", key);
   key = replaceString(doppio_apice, "*$*", key);
   key = replaceString(e_commerciale, "=!=", key);
   return key;
}

function ricerca_guidata(query_name)
{
   document.location.href=(get_aess_path() + "aco_ricerca_guidata?query_name="+query_name);
}

function apri_ric_guidata(page_to_open)
{
   win_guidata = window.open(get_aess_path() + page_to_open, "win_guidata", "scrollbars=yes,toolbar=no,statusbar=yes,scrolling=yes,location=no,resizable=yes,status=no,width=800,height=600");
   windowWidth=800;
   windowHeight=600;
   if (parseInt(navigator.appVersion) >= 4) win_guidata.moveTo((screen.width/2)-(windowWidth/2+10),(screen.height/2)-(windowHeight/2+20));
   win_guidata.focus();
}


function ricerca_avanzata(page_from, page_to, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, e1, e2, e3, e4, e5, e6, s1, s2, s3, s4, s5, f1, f2, f3, f4, f5, f6, f7, f8)
{
   if (page_from == 'doc')
   {
      d1 = change_key(eval("window.document.form_ava_doc.doc_incipit.value"));
      d2 = change_key(eval("window.document.form_ava_doc.doc_contenuti.value"));
      d3 = change_key(eval("window.document.form_ava_doc.doc_localizzazione.value"));
      d4 = change_key(eval("window.document.form_ava_doc.doc_titolo_aco.value"));
      d5 = change_key(eval("window.document.form_ava_doc.doc_genere.value"));
      d6 = change_key(eval("window.document.form_ava_doc.doc_arg_funzione.value"));
      d7 = change_key(eval("window.document.form_ava_doc.doc_descrizione.value"));
      d8 = change_key(eval("window.document.form_ava_doc.doc_argomento.value"));
      d9 = change_key(eval("window.document.form_ava_doc.doc_audio.checked"));
      d10 = change_key(eval("window.document.form_ava_doc.doc_testo.checked"));
      d11 = change_key(eval("window.document.form_ava_doc.doc_pentagramma.checked"));
   }
   if (page_from == 'eve')
   {
      e1 = change_key(eval("window.document.form_ava_eve.eve_denominazione.value"));
      e2 = change_key(eval("window.document.form_ava_eve.eve_descrizione.value"));
      e3 = change_key(eval("window.document.form_ava_eve.eve_categorie.value"));
      e4 = change_key(eval("window.document.form_ava_eve.eve_contenuti.value"));
      e5 = change_key(eval("window.document.form_ava_eve.eve_localizzazione.value"));
      e6 = change_key(eval("window.document.form_ava_eve.eve_rilevatori.value"));
   }
   if (page_from == 'sup')
   {
      s1 = change_key(eval("window.document.form_ava_sup.sup_tipo.value"));
      s2 = change_key(eval("window.document.form_ava_sup.sup_autore.value"));
      s3 = change_key(eval("window.document.form_ava_sup.sup_titolo.value"));
      s4 = change_key(eval("window.document.form_ava_sup.sup_edizione.value"));
      s5 = change_key(eval("window.document.form_ava_sup.sup_descrizione.value"));
   }
   if (page_from == 'imm')
   {
      f1 = change_key(eval("window.document.form_ava_imm.imm_descrizione.value"));
      f2 = change_key(eval("window.document.form_ava_imm.imm_autore.value"));
      f3 = change_key(eval("window.document.form_ava_imm.imm_genere.value"));
      f4 = change_key(eval("window.document.form_ava_imm.imm_occasione.value"));
      f5 = change_key(eval("window.document.form_ava_imm.imm_contenuti.value"));
      f6 = change_key(eval("window.document.form_ava_imm.imm_localizzazione.value"));
      f7 = change_key(eval("window.document.form_ava_imm.imm_fotografia.checked"));
      f8 = change_key(eval("window.document.form_ava_imm.imm_video.checked"));
   }

   if (page_to == 'go')
   {
      page_to_open = "aco_ricerca_avanzata?page_back="+page_from+"&d1="+d1+"&d2="+d2+"&d3="+d3+"&d4="+d4+"&d5="+d5+"&d6="+d6+"&d7="+d7+"&d8="+d8+"&d9="+d9+"&d10="+d10+"&d11="+d11+"&e1="+e1+"&e2="+e2+"&e3="+e3+"&e4="+e4+"&e5="+e5+"&e6="+e6+"&s1="+s1+"&s2="+s2+"&s3="+s3+"&s4="+s4+"&s5="+s5+"&f1="+f1+"&f2="+f2+"&f3="+f3+"&f4="+f4+"&f5="+f5+"&f6="+f6+"&f7="+f7+"&f8="+f8;
      win_avanzata = window.open(get_aess_path() + page_to_open, "win_avanzata", "scrollbars=yes,toolbar=no,statusbar=yes,scrolling=yes,location=no,resizable=yes,status=no,width=800,height=600");
      windowWidth=800;
      windowHeight=600;
      if (parseInt(navigator.appVersion) >= 4) win_avanzata.moveTo((screen.width/2)-(windowWidth/2+10),(screen.height/2)-(windowHeight/2+20));
      win_avanzata.focus();
   }

   else 
      document.location.href=(get_aess_path() + "ava_open_page?page_to="+page_to+"&d1="+d1+"&d2="+d2+"&d3="+d3+"&d4="+d4+"&d5="+d5+"&d6="+d6+"&d7="+d7+"&d8="+d8+"&d9="+d9+"&d10="+d10+"&d11="+d11+"&e1="+e1+"&e2="+e2+"&e3="+e3+"&e4="+e4+"&e5="+e5+"&e6="+e6+"&s1="+s1+"&s2="+s2+"&s3="+s3+"&s4="+s4+"&s5="+s5+"&f1="+f1+"&f2="+f2+"&f3="+f3+"&f4="+f4+"&f5="+f5+"&f6="+f6+"&f7="+f7+"&f8="+f8);
}

function ricerca_canti(titolo, genere)
{
   page_to_open = "aco_ricerca_avanzata?page_back=doc&d1=&d2=&d3=&d4="+titolo+"&d5="+genere+"&d6=&d7=&d8=&d9=&d10=&d11=&e1=&e2=&e3=&e4=&e5=&e6=&s1=&s2=&s3=&s4=&s5=&f1=&f2=&f3=&f4=&f5=&f6=&f7=&f8=";
   win_avanzata = window.open(get_aess_path() + page_to_open, "win_avanzata", "scrollbars=yes,toolbar=no,statusbar=yes,scrolling=yes,location=no,resizable=yes,status=no,width=800,height=600");
   windowWidth=800;
   windowHeight=600;
   if (parseInt(navigator.appVersion) >= 4) win_avanzata.moveTo((screen.width/2)-(windowWidth/2+10),(screen.height/2)-(windowHeight/2+20));
   win_avanzata.focus();
}

function mostra_query_avanzata(page_from, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, e1, e2, e3, e4, e5, e6, s1, s2, s3, s4, s5, f1, f2, f3, f4, f5, f6, f7, f8)
{
   if (page_from == 'doc')
   {
      d1 = change_key(eval("window.document.form_ava_doc.doc_incipit.value"));
      d2 = change_key(eval("window.document.form_ava_doc.doc_contenuto.value"));
      d3 = change_key(eval("window.document.form_ava_doc.doc_localizzazione.value"));
      d4 = change_key(eval("window.document.form_ava_doc.doc_titolo_aco.value"));
      d5 = change_key(eval("window.document.form_ava_doc.doc_genere.value"));
      d6 = change_key(eval("window.document.form_ava_doc.doc_arg_funzione.value"));
      d7 = change_key(eval("window.document.form_ava_doc.doc_descrizione.value"));
      d8 = change_key(eval("window.document.form_ava_doc.doc_argomento.value"));
      d9 = change_key(eval("window.document.form_ava_doc.doc_audio.checked"));
      d10 = change_key(eval("window.document.form_ava_doc.doc_testo.checked"));
      d11 = change_key(eval("window.document.form_ava_doc.doc_pentagramma.checked"));
   }
   if (page_from == 'eve')
   {
      e1 = change_key(eval("window.document.form_ava_eve.eve_denominazione.value"));
      e2 = change_key(eval("window.document.form_ava_eve.eve_descrizione.value"));
      e3 = change_key(eval("window.document.form_ava_eve.eve_categorie.value"));
      e4 = change_key(eval("window.document.form_ava_eve.eve_contenuti.value"));
      e5 = change_key(eval("window.document.form_ava_eve.eve_localizzazione.value"));
      e6 = change_key(eval("window.document.form_ava_eve.eve_rilevatori.value"));
   }
   if (page_from == 'sup')
   {
      s1 = change_key(eval("window.document.form_ava_sup.sup_tipo.value"));
      s2 = change_key(eval("window.document.form_ava_sup.sup_autore.value"));
      s3 = change_key(eval("window.document.form_ava_sup.sup_titolo.value"));
      s4 = change_key(eval("window.document.form_ava_sup.sup_edizione.value"));
      s5 = change_key(eval("window.document.form_ava_sup.sup_descrizione.value"));
   }
   if (page_from == 'imm')
   {
      f1 = change_key(eval("window.document.form_ava_imm.imm_titolo.value"));
      f2 = change_key(eval("window.document.form_ava_imm.imm_autore.value"));
      f3 = change_key(eval("window.document.form_ava_imm.imm_genere.value"));
      f4 = change_key(eval("window.document.form_ava_imm.imm_occasione.value"));
      f5 = change_key(eval("window.document.form_ava_imm.imm_contenuti.value"));
      f6 = change_key(eval("window.document.form_ava_imm.imm_localizzazione.value"));
      f7 = change_key(eval("window.document.form_ava_imm.imm_fotografia.checked"));
      f8 = change_key(eval("window.document.form_ava_imm.imm_video.checked"));
   }

   document.location.href=(get_aess_path() + "aco_mostra_frase?d1="+d1+"&d2="+d2+"&d3="+d3+"&d4="+d4+"&d5="+d5+"&d6="+d6+"&d7="+d7+"&d8="+d8+"&d9="+d9+"&d10="+d10+"&d11="+d11+"&e1="+e1+"&e2="+e2+"&e3="+e3+"&e4="+e4+"&e5="+e5+"&e6="+e6+"&s1="+s1+"&s2="+s2+"&s3="+s3+"&s4="+s4+"&s5="+s5+"&f1="+f1+"&f2="+f2+"&f3="+f3+"&f4="+f4+"&f5="+f5+"&f6="+f6+"&f7="+f7+"&f8="+f8);
}

function ricerca_libera(form_name)
{
   var i;
   var cosa = "";
   var come = "";
   var chi_pro = "";
   var chi_ril = "";
   var dove = "";
   var audio = "";
   var testo = "";
   var pentagramma = "";
   var foto = "";
   var video = "";
   var space = " ";
   
   var frm = eval("window.document." + form_name)

   for(i=0; i < frm.length; i++)
   {
      var field = frm.elements[i].name;
      var fvalue = change_key(frm.elements[i].value);

      if (field == "lib_cosa" && fvalue.length > 0)
         cosa = fvalue;

      if (field == "lib_chi_P" && fvalue.length > 0)
         chi_pro = fvalue;

      if (field == "lib_chi_R" && fvalue.length > 0)
         chi_ril = fvalue;

      if (field == "lib_come" && fvalue.length > 0)
         come = fvalue;

      if (field == "lib_dove" && fvalue.length > 0)
         dove = fvalue;

      if (field == "lib_pentagramma" && fvalue.length > 0)
      {
         var fvalue = frm.elements[i].checked;
         pentagramma = fvalue;
      }    

      if (field == "lib_audio" && fvalue.length > 0)
      {
         var fvalue = frm.elements[i].checked;
         audio = fvalue;
      }    

      if (field == "lib_testo" && fvalue.length > 0)
      {
         var fvalue = frm.elements[i].checked;
         testo = fvalue;
      }    

      if (field == "lib_foto" && fvalue.length > 0)
      {
         var fvalue = frm.elements[i].checked;
         foto = fvalue;
      }    

      if (field == "lib_video" && fvalue.length > 0)
      {
         var fvalue = frm.elements[i].checked;
         video = fvalue;
      }    

       /* alert("Field: " + i + " " + field + " value = " + fvalue); */
   }    
   page_to_open = "aco_ricerca_libera?cosa="+cosa+"&professione="+chi_pro+"&rilevatore="+chi_ril+"&come="+come+"&dove="+dove+"&audio="+audio+"&testo="+testo+"&pentagramma="+pentagramma+"&foto="+foto+"&video="+video;
   win_libera = window.open(get_aess_path() + page_to_open, "win_libera", "scrollbars=yes,toolbar=no,statusbar=yes,scrolling=yes,location=no,resizable=yes,status=no,width=800,height=600");
   windowWidth=800;
   windowHeight=600;
   if (parseInt(navigator.appVersion) >= 4) win_libera.moveTo((screen.width/2)-(windowWidth/2+10),(screen.height/2)-(windowHeight/2+20));
   win_libera.focus();
}

function mostra_query_libera(form_name)
{
   var i;
   var cosa = "";
   var come = "";
   var pro = "";
   var ril = "";
   var dove = "";
   var audio = "";
   var testo = "";
   var pentagramma = "";
   var foto = "";
   var video = "";
   var space = " ";
   var frm = eval("window.document." + form_name)

   for(i=0; i < frm.length; i++)
   {
      var field = frm.elements[i].name;
      var fvalue = frm.elements[i].value;

      fvalue = replaceString(space, "%20", fvalue);

      if (field == "lib_cosa" && fvalue.length > 0)
         cosa = fvalue;

      if (field == "lib_chi_P" && fvalue.length > 0)
         pro = fvalue;

      if (field == "lib_chi_R" && fvalue.length > 0)
         ril = fvalue;

      if (field == "lib_come" && fvalue.length > 0)
         come = fvalue;

      if (field == "lib_dove" && fvalue.length > 0)
         dove = fvalue;

      if (field == "lib_pentagramma" && fvalue.length > 0)
      {
         var fvalue = frm.elements[i].checked;
         pentagramma = fvalue;
      }    

      if (field == "lib_audio" && fvalue.length > 0)
      {
         var fvalue = frm.elements[i].checked;
         audio = fvalue;
      }    

      if (field == "lib_testo" && fvalue.length > 0)
      {
         var fvalue = frm.elements[i].checked;
         testo = fvalue;
      }    

      if (field == "lib_foto" && fvalue.length > 0)
      {
         var fvalue = frm.elements[i].checked;
         foto = fvalue;
      }    

      if (field == "lib_video" && fvalue.length > 0)
      {
         var fvalue = frm.elements[i].checked;
         video = fvalue;
      }    

      /* alert("Field: " + i + " " + field + " value = " + fvalue); */
   }    
   var query = window.open(get_aess_path() + "lib_mostra_frase?cosa="+cosa+"&pro="+pro+"&ril="+ril+"&come="+come+"&dove="+dove+"&audio="+audio+"&testo="+testo+"&pentagramma="+pentagramma+"&foto="+foto+"&video="+video, "query", "scrollbars=yes,toolbar=no,scrolling=yes,location=no,resizable=yes,status=no,width=650,height=450");
   query.focus();
}

function ricerca_cluster(id_cluster)
{
   page_to_open = "aco_ricerca_cluster?id_cluster="+id_cluster;
   win_cluster = window.open(get_aess_path() + page_to_open, "win_cluster", "scrollbars=yes,toolbar=no,statusbar=yes,scrolling=yes,location=no,resizable=yes,status=no,width=800,height=600");
   windowWidth=800;
   windowHeight=600;
   if (parseInt(navigator.appVersion) >= 4) win_cluster.moveTo((screen.width/2)-(windowWidth/2+10),(screen.height/2)-(windowHeight/2+20));
   win_cluster.focus();
}

function accetta_iscrizione(form_name)
{
   var i;
   var accetto = "no";
   var nome = "";
   var cognome = "";
   var professione = "";
   var ente = "";
   var indirizzo = "";
   var cap = "";
   var citta = "";
   var provincia = "";
   var stato = "";
   var email = "";
   var space = " ";
   
   var frm = eval("window.document." + form_name)

   for(i=0; i < frm.length; i++)
   {
      var field = frm.elements[i].name;
      var fvalue = change_key(frm.elements[i].value);

      if (field == "nome" && fvalue.length > 0)
         nome = fvalue;

      if (field == "cognome" && fvalue.length > 0)
         cognome = fvalue;

      if (field == "professione" && fvalue.length > 0)
         professione = fvalue;

      if (field == "ente" && fvalue.length > 0)
         ente = fvalue;

      if (field == "indirizzo" && fvalue.length > 0)
         indirizzo = fvalue;

      if (field == "cap" && fvalue.length > 0)
         cap = fvalue;

      if (field == "citta" && fvalue.length > 0)
         citta = fvalue;

      if (field == "provincia" && fvalue.length > 0)
         provincia = fvalue;

      if (field == "stato" && fvalue.length > 0)
         stato = fvalue;

      if (field == "email" && fvalue.length > 0)
         email = fvalue;

      if (field == "autorizzo")
      {
         if (frm.elements[i].checked == true)
         {
            /* alert("autorizzo: value = " + fvalue + " checked = " + frm.elements[i].checked); */
            accetto = fvalue;
         }    
      }    

      /* alert("Field: " + i + " " + field + " value = <" + fvalue + ">"); */
   }    
   if (accetto == "si") 
   {
      if (nome.length <= 0 || cognome.length <= 0 || email.length <= 0)
         alert("Indicare i campi obbligatori!");
      else  
         document.location.href=(get_aess_path() + "aco_iscrizione?nome="+nome+"&cognome="+cognome+"&professione="+professione+"&ente="+ente+"&indirizzo="+indirizzo+"&cap="+cap+"&citta="+citta+"&provincia="+provincia+"&stato="+stato+"&email="+email);
   }    
   else
      alert("Senza autorizzazione non posso completare l'iscrizione!");
}

