/*
.//GESTORE FOGLI DI STILE
//scrive il cookie
function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    //date.setTime(date.getTime()+(min*60*1000));
    var expires = '; expires='+date.toGMTString();
  }
  else expires = '';
  document.cookie = name+'='+value+expires+'; path=/';
}
//legge il cookie
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);
  }
}
//estrae il nome del foglio di stile
function setCSS(nome_file_css) { 
    createCookie('skinUtente',nome_file_css,365);
    location.reload();
}
//applica il foglio di stile
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";
}
function gestoreCSS() {
    nome_file_css = readCookie('skinUtente');
    if (nome_file_css) {
        setCSShref(nome_file_css);
    }
}
*/
//GESTIONE TASTO INVIO (per ricerca semplice e archivio)
var w3c = window.Event ? true : false
function ricercaW3C(e) {
    if (e.which==13) {
        cerca();
        return false
    } else { return e.keyCode }
}
function ricercaIE() {
    if(window.event.keyCode==13) {
        cerca();
        return false
    } else { return window.event.keyCode }       
}
function ricercaarcW3C(e) {
    if (e.which==13) {
        cercaARC();
        return false
    } else { return e.keyCode }
}
function ricercaarcIE() {
    if(window.event.keyCode==13) {
        cercaARC();
        return false
    } else { return window.event.keyCode }       
}
window.onload = function() {
    //gestoreCSS()
    if (w3c) {
        //il campo della ricerca deve avere id="txt"
        if(document.getElementById("txt")) 
            document.getElementById("txt").onkeypress = ricercaW3C
        //il campo della ricerca in archivo deve avere id="txtarc"
        if(document.getElementById("txtarc")) 
            document.getElementById("txtarc").onkeypress = ricercaarcW3C
        //il campo dal della ricerca in archivo deve avere id="arcdal"
        if(document.getElementById("arcdal"))
            document.getElementById("arcdal").onkeypress = ricercaarcW3C
        //il campo al della ricerca in archivo deve avere id="arcal"
        if(document.getElementById("arcal")) 
            document.getElementById("arcal").onkeypress = ricercaarcW3C
    } else {
        if(document.getElementById("txt")) 
            document.getElementById("txt").onkeypress = ricercaIE
        if(document.getElementById("txtarc"))
            document.getElementById("txtarc").onkeypress = ricercaarcIE
        if(document.getElementById("arcdal"))
             document.getElementById("arcdal").onkeypress = ricercaarcIE
        if(document.getElementById("arcal"))
            document.getElementById("arcal").onkeypress = ricercaarcIE
    }
}
// RICERCA SEMPLICE
function cerca() {
    campo = document.getElementById("txt");
    if (campo.value == '')
        alert("ATTENZIONE: Inserisci il testo da ricercare!");
    else
        document.location.href = "/suap/suapmo.nsf/search?SearchView&Query="+campo.value.replace(" ","%20")+"&searchorder=4&ric=norm"
}
//RICERCA IN ARCHIVIO
function cercaARC() {
    //testo della ricerca in archivio
    campo1 = document.getElementById("txtarc");
     testo = campo1.value.replace(" ","%20"); 
    
        //titolo della pagina
        campo2 = document.getElementById("titolo");
        if (testo=="")
	tit = "field%20archivio="+campo2.value.replace(" ","%20");
        else
        	tit = "%20and%20field%20archivio="+campo2.value.replace(" ","%20");
        campo3 = document.getElementById("arcdal");
        dal = "";
        if (campo3.value != "") { dal = "%20and%20field%20dal_evento>"+campo3.value.replace(" ","%20"); }
        campo4 = document.getElementById("arcal");
        al = "";
        if (campo4.value != "") { al = "%20and%20field%20finoal_evento<"+campo4.value.replace(" ","%20"); }
        sez = document.getElementById("sezione");
        query = testo + tit + dal + al + "&searchorder=4&"+sez.value;
        document.location.href = "/suap/suapmo.nsf/searcharchivio?SearchView&Query="+query
   
}
//PULSANTE PER SELECT
function vai(nome)  {
    campo=document.getElementById(nome);
    location.href=campo.value;
}
//ROLLOWER IMMAGINI
<!--
function MM_swapImgRestore() { //v3.0
  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() { //v3.0
  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() { //v3.0
  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];}
}
//-->

