
salvavalori = new Array(32);
var Nav4 = ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))
var myWin = new Object();	

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_findObj(n, d) { //v3.0
  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); return x;
}

function MM_validateForm() { //v3.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (val!=''+num) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function VaiAllaPagina( Indice )  {
	
	document.forms["frmInvia"].PaginaCorrente.value = Indice;
	document.forms["frmInvia"].submit();
	}

function selezionatutto() {

 i = 0
 if (document.frm.tutto.checked)
   for (var i = 0; i < document.frm.giorno.length; i++) {
    salvavalori[i] = document.frm.giorno[i].checked
    document.frm.giorno[i].checked = true;
       }
 else
       {
   for (var i = 0; i < document.frm.giorno.length; i++)
     document.frm.giorno[i].checked = salvavalori[i]
       }

 return false;
}

function controllagiorno() {

 ok = false;

   for (var i = 0; i < document.frm.giorno.length; i++)
     if (document.frm.giorno[i].checked)
        ok = true;

 document.valore = ok
 if (!ok)
   alert("Per effettuare la ricerca occorre selezionare almeno un giorno del mese.");

 return false;
}

function VaiOffset( i ) {

  document.frmGiorni.elements['OffSet'].value = Number(document.frmGiorni.elements['OffSet'].value) + Number(i)
  document.frmGiorni.submit()
}

// Apre una finestra centrata con testo passato da funzione

function openToolTipWindow(theText,winName,width,height,features)
{
  myWin.width = width;
  myWin.height = height;
  theText = theText.replace("'","\'"); 

  if (Nav4) {
   // Center on the main window.
   myWin.left = window.screenX +
      ((window.outerWidth - myWin.width) / 2)
   myWin.top = window.screenY +
      ((window.outerHeight - myWin.height) / 2)
  } else {
   // The best we can do is center in screen.
   myWin.left = (screen.width - myWin.width) / 2;
   myWin.top = (screen.height - myWin.height) / 2;
  }
  myWin.html = 	'<html>'+
  		'<head><title>Help</title><link rel="stylesheet" href="/stili/seit/stili.css" type="text/css"></head>' +
  		'<body bgcolor="#FFFFFF" text="#000000" leftmargin="5" topmargin="5" marginwidth="5" marginheight="5">' +
		'<img src="/immagini/pagamenti/help.gif" width="14" height="14"><br><span class="testo">' +
		theText + '<br><br><div align="center"><a href="#" onClick="window.close();">CHIUDI</a></div></span></body></html>';

  myWin.win = window.open('about:blank', winName, 'width='+width+',height='+height+','+features);
  		  
  myWin.win.moveTo(Math.ceil(myWin.left), Math.ceil(myWin.top));
  myWin.win.document.open();
  myWin.win.document.write(myWin.html);
  myWin.win.document.close();		
  myWin.win.focus();

}

function controllaradio(obj)
{
ncheck = obj.length;
for (i=0; i<ncheck;i++)
{
    if (obj[i].checked)	
		{
        return obj[i].value;
       break;
	   }
}
}


function VaiOffset( i ) {

  document.frmGiorni.elements['OffSet'].value = Number(document.frmGiorni.elements['OffSet'].value) + Number(i)
  document.frmGiorni.submit()
}

function TipoRicerca ( Tipo ){
	  
  frmInvia.PaginaCorrente.value=1;
  frmInvia.action='page.asp?Speciale=Ricerca&Tipo=' + Tipo;
  frmInvia.submit();
	}