// JavaScript Document
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_validateForm() { //v4.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('@');
		q=val.indexOf('.');
        if ((p<1 || p==(val.length-1))||(q<1 || q==(val.length-1))) errors+='- '+nm+'  deve contenere un indirizzo e-mail.\n';
      } else if (test!='R') {
        if (isNaN(val)) errors+='- '+nm+' deve contenere un numero.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (val<min || max<val) errors+='- '+nm+' deve contenere un numero tra '+min+' e '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' è un campo richiesto.\n'; }
  } if (errors) alert('Si sono verificati i seguenti errori:\n'+errors);
  document.MM_returnValue = (errors == '');
}
var bName = navigator.appName;
var bVer = parseInt(navigator.appVersion);

var NS6 = (bName == "Netscape" && bVer >=5 && bVer < 7); //alternativa check su getElementById
var NS4= document.layers;
var IE4=  document.all;

//LAYER SWITCHING CODE

     if (NS4) {
       layerStyleRef="layer.";
       layerRef="document.layers[";
       styleSwitch="]"; layerDoc=".document."
     }
	 else if (IE4) {
        layerStyleRef="layer.style.";
        layerRef="document.all[";
        styleSwitch="].style"; layerDoc=".";
     }
	 else if (NS6) { 
       layerStyleRef="style.";
       layerRef="document.getElementById(";
       styleSwitch=").style"; layerDoc=".";
     }	
     else {
		//vedi un po' tu che vuoi fare. Se uno ha un browser per conto suo?
     }

	 menutop = new Array ()
menutop[0]="menuopenso";
menutop[1]="menuopenco";
menutop[2]="menuopenlp";
menutop[3]="menuopenbp";
menutop[4]="Pmenuopenso";
menutop[5]="Pmenuopenpo";
menutop[6]="Pmenuopenbp";
	 
function showLayer(layerName){
        if (NS4 || IE4 || NS6) {
                eval(layerRef+'"'+layerName+'"'+styleSwitch+'.visibility="visible"');
        }       
}
        
   function hideLayer(layerName){
        if (NS4 || IE4 || NS6) {
                eval(layerRef+'"'+layerName+'"'+styleSwitch+'.visibility="hidden"');
                }       
        }
		
		function hideAll () {
	for (i_loc=0; i_loc < menutop.length; i_loc ++) {
		hideLayer (menutop[i_loc]);
	}return false;
}

function setVariables(){
if (navigator.appName == "Netscape") {
if (parseInt(navigator.appVersion) >= 5){v=".top=";h=".left=";dS="document.getElementById(\"";sD="\").style";
y="window.pageYOffset";x="window.pageXOffset";}
else {v=".top=";h=".left=";dS="document.";sD="";
y="window.pageYOffset";x="window.pageXOffset";}
}
else {h=".pixelLeft=";v=".pixelTop=";dS="";sD=".style";
y="document.body.scrollTop";x="document.body.scrollLeft";}checkLocationA()}
movex=0,movey=0,xdiff=0,ydiff=0,ystart=0,xstart=0

function checkLocation(){
object="object1";yy=eval(y);xx=eval(x);ydiff=ystart-yy;xdiff=xstart-xx;
if ((ydiff<(-1))||(ydiff>(1))) movey=Math.round(ydiff/10),ystart-=movey
if ((xdiff<(-1))||(xdiff>(1))) movex=Math.round(xdiff/10),xstart-=movex
if (ystart>=10){eval(dS+object+sD+v+(ystart+15));
} else {eval(dS+object+sD+v+10);}


eval(dS+object+sD+h+xstart);
setTimeout("checkLocation()",10);
}

function checkLocationA(){ystart=eval(y);xstart=eval(x);}

function tmt_winOpen(u,id,f,df){
	if(eval(id)==null||eval(id+".closed")){
	eval(id+"=window.open('"+u+"','"+id+"','"+f+"')");eval(id+".focus()");}
	else if(df){eval(id+".focus()");}
	else{eval(id+"=window.open('"+u+"','"+id+"','"+f+"')");eval(id+".focus()");}
}
 function noSpam(user,domain) {
 locationstring = "mailto:" + user + "@" + domain;
 window.location = locationstring;
 }
 