gg = new Array("Dom","Lun","Mar","Mer","Gio","Ven","Sab");
mesi = new Array("Gen","Feb","Mar","Apr","Mag","Giu","Lug","Ago","Set","Ott","Nov","Dic");
function ora_data() 
   { 
   var ora = new Date(); 
   var aa = ora.getDate(); 
   var mm = ora.getMonth(); 
   var yy = ora.getYear(); 
   var oo = ora.getHours(); 
   var mn = ora.getMinutes(); 
   var sec = ora.getSeconds(); 
   var dd = ora.getDay(); 
   var aa2  = ((aa < 10) ? "0" : "");
   var oo2  = ((oo < 10) ? "0" : ""); 
   var mn2  = ((mn < 10) ? ":0" : ":"); 
   var sec2  = ((sec < 10) ? ":0" : ":"); 
   var Data = aa2 + aa + " " + mesi[mm] +" " + yy; 
   var hh = oo2 + oo + mn2 + mn + sec2 + sec; 
   if(document.all) 
      document.all.Timer.innerHTML = hh + " " + gg[dd] + ", " + Data; 
   else 
      if(document.getElementById) 
         document.getElementById('Timer').innerHTML  = hh + " " + gg[dd] + ", " + Data; 
   window.setTimeout("ora_data()",1000); 
   }


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_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')?'block':(v=='hide')?'none':v; }
    obj.display=v; }
}

function OpenLink(url){
	window.opener.location.href = url;
    window.opener.focus();
}


function OpenFinestra(url){
    finestra = 'tabella'
    aa = window.open(url, finestra, 'height=600, width=1200,toolbar=no, location=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,left=20, top=100') 
    aa.focus()
}

function ctrl_num(e){
	if (window.event)
		var code = window.event.keyCode;    
	else if (e)
	   var code =  e.which ; 
	else
	   var code=0;  
	   if( (code<48 || code >57) &&  (code!=8 &&  code!=0 &&  code!=46) ){	    
		   alert("Attenzione, inserire solo caratteri numerici");
		   return false;
		} 
	return true;
}

function ControllaRicerca(){

	i = 0;
	if (document.cerca.testo.value.length < 3)
	{	
		alert("Specifia un testo di ricerca di almeno 3 caratteri");
		i++;
		return(false);
	}
}

function aprichiudi( targetId ){
    if( document.getElementById ){
	target = document.getElementById(targetId);
	if( target.style.display == "block" ){
	    target.style.display = "none";
	}
	else{
	    target.style.display = "block";
	}
    }
}

function Controlla(){
	var response = window.confirm("Confermi l'operazione?");
	if (!response) return(false);
}