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+='- il campo '+nm+' deve contenere un indirizzo e-mail valido.\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 += '- il campo '+nm+' e` obbligatorio.\n'; }
  } if (errors) alert('Rilevati i seguenti errori:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}

function tS(){ x=new Date(); x.setTime(x.getTime()); return x; } 
function lZ(x){ return (x>9)?x:'0'+x; } 
function fY(x){ x=(x<500)?x+1900:x; return String(x).substring(2,4) } 
function dT(){ window.status=''+eval(oT)+''; if(fr==0){ fr=1; document.write('<span id="tP">'+eval(oT)+'</span>'); } tP.innerText=eval(oT); setTimeout('dT()',1000); } 
var dN=new Array('Dom','Lun','Mar','Mer','Gio','Ven','Sab'),mN=new Array('Gen','Feb','Mar','Apr','Mag','Giu','Lug','Ago','Set','Ott','Nov','Dic'),fr=0,oT="dN[tS().getDay()]+' '+tS().getDate()+' '+mN[tS().getMonth()]+' '+fY(tS().getYear())+' '+':'+':'+' '+lZ(tS().getHours())+':'+lZ(tS().getMinutes())+':'+lZ(tS().getSeconds())+' '";

function openMain(){
  var widthOfWindow = 360;
  var heightOfWindow = 400;

  // set this to the URL you want to go to
  var URL="http://www.blsgroup.it/prove/bacheca/popup.asp";

  // do not modify
  //this.moveTo(0,0);
  //this.resizeTo(screen.width, screen.height);

  var giddyWindow = window.open('','','width=' + widthOfWindow + ',height=' + heightOfWindow + ',statusbar=yes,scrollbars=yes');
  var sX = (screen.width - widthOfWindow) / 2;
  var sY = (screen.height - heightOfWindow) / 2;
  giddyWindow.moveTo(sX,sY);
  giddyWindow.document.location.href = URL; 
  //window.close();
  }

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 (ystart>=192){eval(dS+object+sD+v+(ystart+10));
} else {eval(dS+object+sD+v+192);}


setTimeout("checkLocation()",10);
}

function checkLocationA(){ystart=eval(y);xstart=eval(x);}

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]+"'");
}

// fill the month table with column headings
function day_title(day_name){
     document.write("<td width=14%><div align=center><b>"+day_name+"</b></div></td>")
}

// fills the month table with numbers
function fill_table(month,month_length)
{ 
  day=1
  // begin the new month table
  document.write("<table width=100% border=0 cellspacing=0 cellpadding=0 class=verd><tr><td width=16><img src=images/win_top_sx.gif width=16 height=20></td><td class=bghead><div align=center><b>"+month+"   "+year+"</b></div></td><td width=20><img src=images/win_top_dx.gif width=20 height=20></td></tr><tr> <td valign=bottom class=bglatsx>&nbsp;</td><td>")
  document.write("<table width=100% border=0 cellspacing=0 cellpadding=0 class=verd><tr>")
  // column headings
  day_title("l")
  day_title("m")
  day_title("m")
  day_title("g")
  day_title("v")
  day_title("s")
  day_title("d")
  // pad cells before first day of month
  document.write("</TR><TR>")
  for (var i=1;i<start_day;i++){
      	document.write("<TD>")
  }
  // fill the first week of days
  for (var i=start_day;i<8;i++){
	document.write("<td><div align=center>"+day+"</div></td>")
        day++
  }
  document.write("<TR>")

  // fill the remaining weeks
  while (day <= month_length) {
     for (var i=1;i<=7 && day<=month_length;i++){
	 document.write("<TD ALIGN=center>"+day+"</TD>")
 	 day++
     }
     document.write("</TR><TR>")
     // the first day of the next month
     start_day=i
  }
  document.write("</TR></TABLE></td><td valign=bottom class=bglatdx>&nbsp;</td></tr><tr><td valign=bottom class=bglatsx><img src=images/win_buttom_sx.gif width=16 height=17></td><td height=17 class=bgbuttom> <div align=left></div></td><td valign=bottom class=bglat><img src=images/win_buttom_dx20.gif width=20 height=17></td></tr></table><br>")
}

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>=140){eval(dS+object+sD+v+(ystart+20));
} else {eval(dS+object+sD+v+140);}


eval(dS+object+sD+h+xstart+33);
setTimeout("checkLocation()",10);
}

function checkLocationA(){ystart=eval(y);xstart=eval(x);}
var val50 =1936.27
var dec5 =2
var val51 =(1/val50)
var dec =2

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();
}
MM_reloadPage(true);

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 toggle(id){
    ul = "ul_" + id;
    img = "img_" + id;
    ulElement = document.getElementById(ul);
    imgElement = document.getElementById(img);
    if (ulElement){
            if (ulElement.className == 'closed'){
                    ulElement.className = "open";
                    imgElement.src = "images/minus.gif";
                    }else{
                    ulElement.className = "closed";
                    imgElement.src = "images/plus.gif";
                    }
            }
    }