// Esempio
// MM_openBrWindow('http://www.cassaforense.it','fullW','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes','100','80','true') 
function MM_openBrWindow(theURL,winName,features, myWidth, myHeight, isCenter) { //v3.0
  if(window.screen)if(isCenter)if(isCenter=="true"){
    var myLeft = (screen.width-myWidth)/2;
    var myTop = (screen.height-myHeight)/2;
    features+=(features!='')?',':'';
    features+=',left='+myLeft+',top='+myTop;
  }
  window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}
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];}
}
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_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')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function tmt_findObj(n){
	var x,t; if((n.indexOf("?"))>0&&parent.frames.length){t=n.split("?");
	x=eval("parent.frames['"+t[1]+"'].document.getElementById('"+t[0]+"')");
	}else{x=document.getElementById(n)}return x;
}
function tmt_divBoxOut(tl,dur,incr) {
	var nn4=(document.layers)?true:false;transNo=parseInt(1);arHidden=new Array(1,3,14,16);
	var t=(document.getElementById)?tmt_findObj(tl):MM_findObj(tl);
	if(document.all&&t){t.style.filter="revealTrans(duration="+dur+",transition=1)";endState="hidden";
	for(i=0;i<arHidden.length;i++){if(arHidden[i]==transNo){endState="visible";t.style.visibility="hidden";}}
    t.filters.revealTrans.apply();t.style.visibility=endState;t.filters.revealTrans.play();return;}
	if(navigator.appName=='Netscape'&&t){intval=100;if(incr==0){if(nn4){t.origLeft=t.Left=t.clip.left;
	t.origTop=t.Top=t.clip.top;t.origRight=t.Right=t.clip.right;t.origBottom=t.Bottom=t.clip.bottom;
	t.Width=t.clip.width;t.Height=t.clip.height;}else{t.style.overflow='hidden';
	t.Left=t.origLeft=t.Top=t.origTop=0;t.Right=t.Width=t.offsetWidth;t.Bottom=t.Height=t.offsetHeight;}
	mSecs=dur*1000;visits=(mSecs/intval);fullW=t.Width;fullH=t.Height;halfW=fullW/2;halfH=fullH/2;
	alternateW=alternateH=true;incW=halfW/visits;incrementW=(incW>=1)?parseInt(incW):0;
	xtraPixW=Math.round((incW-incrementW)*visits);incH=halfH/visits;incrementH=(incH>=1)?parseInt(incH):0;
	xtraPixH=Math.round((incH-incrementH)*visits);t.Left+=halfW;t.Right-=halfW;t.Top+=halfH;t.Bottom-=halfH;
    if(nn4){t.clip.left=t.Left;t.clip.right=t.Right;t.clip.top=t.Top;t.clip.bottom=t.Bottom;t.visibility="show";}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";
	t.style.visibility='visible';}if((t.Left-t.origLeft)<=incrementW){
	if(nn4){t.clip.left=t.origLeft;t.clip.right=t.origRight;}else{
	t.style.clip="rect("+t.Top+"px auto "+t.Bottom+"px auto)";}}
	else{if(xtraPixW>0){if(xtraPixW<=visits){if(alternateW){t.Left--;t.Right++;
	if(nn4){t.clip.left=t.Left;t.clip.right=t.Right;}else{
    t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
    xtraPixW--;}alternateW=!alternateW;}else{t.Left--;t.Right++;
	if(nn4){t.clip.left=t.Left;t.clip.right=t.Right;}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
	xtraPixW--;}}}t.Left-=incrementW;t.Right+=incrementW;
    if(nn4){t.clip.left=t.Left;t.clip.right=t.Right;}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
    if((t.Top-t.origTop)<=incrementH){
    if(nn4){t.clip.top=t.origTop;t.clip.bottom=t.origBottom;}else{
    t.style.clip="rect(auto "+t.Right+"px auto"+t.Left+"px)";}}else{
    if(xtraPixH>0){if(xtraPixH<=visits){if(alternateH){t.Top--;t.Bottom++;
	if(nn4){t.clip.top=t.Top;t.clip.bottom=t.Bottom;}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
	xtraPixH--;}alternateH=!alternateH;}else{t.Top--;t.Bottom++;
	if(nn4){t.clip.top=t.Top;t.clip.bottom=t.Bottom;}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
	xtraPixH--;}}}t.Top-=incrementH;t.Bottom+=incrementH;
	if(nn4){t.clip.top=t.Top;t.clip.bottom=t.Bottom;}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
	visits--;}else{if((t.Left-t.origLeft)<=incrementW){
	if(nn4){t.clip.left=t.origLeft;t.clip.right=t.origRight;}else{
	t.style.clip="rect("+t.Top+"px auto "+t.Bottom+"px auto)";}}else{
	if(xtraPixW>0){if(xtraPixW<=visits){if(alternateW){t.Left--;t.Right++;
	if(nn4){t.clip.left=t.Left;t.clip.right=t.Right;}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
	xtraPixW--;}alternateW=!alternateW;}else{t.Left--;t.Right++;
	if(nn4){t.clip.left=t.Left;t.clip.right=t.Right;}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
	xtraPixW--;}}}t.Left-=incrementW;t.Right+=incrementW;
    if(nn4){t.clip.left=t.Left;t.clip.right=t.Right;}else{
    t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
    if((t.Top-t.origTop)<=incrementH){
	if(nn4){t.clip.top=t.origTop;t.clip.bottom=t.origBottom;}else{
	t.style.clip="rect(auto "+t.Right+"px auto "+t.Left+"px)";}}else{
	if(xtraPixH>0){if(xtraPixH<=visits){if(alternateH){t.Top--;t.Bottom++;
	if(nn4){t.clip.top=t.Top;t.clip.bottom=t.Bottom;}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
	xtraPixH--;}alternateH=!alternateH;}else{t.Top--;t.Bottom++;
	if(nn4){t.clip.top=t.Top;t.clip.bottom=t.Bottom;}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
	xtraPixH--;}}}t.Top-=incrementH;t.Bottom+=incrementH;
    if(nn4){t.clip.top=t.Top;t.clip.bottom=t.Bottom;}else{
    t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}visits--;}
	if(t.Left<=t.origLeft&&t.Top<=t.origTop){
	if(nn4){t.clip.left=t.origLeft;t.clip.top=t.origTop;t.clip.right=t.origRight;
	t.clip.bottom=t.origBottom;}else{t.style.clip="rect(auto)";}}else{
	setTimeout('tmt_divBoxOut("'+tl+'",'+dur+',1)',intval);}}
}

function tmt_divBoxIn(tl,dur,incr){
	var nn4=(document.layers)?true:false;transNo=parseInt(0);arHidden=new Array(1,3,14,16);
	var t=(document.getElementById)?tmt_findObj(tl):MM_findObj(tl);
	if(document.all&&t){t.style.filter="revealTrans(duration=" + dur + ",transition=0)";endState="hidden";
	for(i=0;i<arHidden.length;i++){if(arHidden[i]==transNo){endState="visible";t.style.visibility="hidden";}}
	t.filters.revealTrans.apply();t.style.visibility = endState;t.filters.revealTrans.play();return;}
	if(navigator.appName=="Netscape"&&t){intval=100;if(incr==0){if(nn4&&t){
	t.origLeft=t.Left=t.clip.left;t.origTop=t.Top=t.clip.top;t.origRight=t.Right=t.clip.right;
	t.origBottom=t.Bottom=t.clip.bottom;t.Width=t.clip.width;t.Height=t.clip.height;}else{
	t.style.overflow='hidden';t.Left=t.Top=0;t.Right=t.Width=t.offsetWidth;t.Bottom=t.Height=t.offsetHeight;}
    mSecs=dur*1000;visits=(mSecs/intval);fullW=t.Width;fullH=t.Height;halfW=fullW/2;halfH=fullH/2;
    alternateW=alternateH=true;incW=halfW/visits;incrementW=(incW>=1)?parseInt(incW):0;
    xtraPixW=Math.round((incW-incrementW)*visits);incH=halfH/visits;
    incrementH=(incH>=1)?parseInt(incH):0;xtraPixH=Math.round((incH-incrementH)*visits);        
    if(xtraPixW>0){if(xtraPixW<=visits){if(alternateW){t.Left++;t.Right--;
	if(nn4){t.clip.left=t.Left;t.clip.right=t.Right;}else{
    t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
    xtraPixW--;}alternateW=!alternateW;}else{t.Left++;t.Right--;
	if(nn4){t.clip.left=t.Left;t.clip.right=t.Right;}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
    xtraPixW--;}}t.Left+=incrementW;t.Right-=incrementW;
	if(nn4){t.clip.left=t.Left;t.clip.right=t.Right;}else{
    t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
    if(xtraPixH>0){if(xtraPixH<=visits){if(alternateH){t.Top++;t.Bottom--;
	if(nn4){t.clip.top=t.Top;t.clip.bottom=t.Bottom;}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
    xtraPixH--;}alternateH=!alternateH;}else{t.Top++;t.Bottom--;
	if(nn4){t.clip.top=t.Top;t.clip.bottom=t.Bottom;}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
	xtraPixH--;}}t.Top+=incrementH;t.Bottom-=incrementH;
	if(nn4){t.clip.top=t.Top;t.clip.bottom=t.Bottom;}else{
    t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
    visits--;}else{if(xtraPixW>0){if(xtraPixW<=visits){if(alternateW){
    t.Left++;t.Right--;if(nn4){t.clip.left=t.Left;t.clip.right=t.Right;}else{
    t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
    xtraPixW--;}alternateW=!alternateW;}else{t.Left++;t.Right--;
	if(nn4){t.clip.left=t.Left;t.clip.right=t.Right;}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
    xtraPixW--;}}t.Left+=incrementW;t.Right-=incrementW;
    if(nn4){t.clip.left=t.Left;t.clip.right=t.Right;}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
    if(xtraPixH>0){if(xtraPixH<=visits){if(alternateH){t.Top++;t.Bottom--;
	if(nn4){t.clip.top=t.Top;t.clip.bottom=t.Bottom;}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
    xtraPixH--;}alternateH=!alternateH;}else{t.Top++;t.Bottom--;
	if(nn4){t.clip.top=t.Top;t.clip.bottom=t.Bottom;}else{
	t.style.clip = "rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
    xtraPixH--;}}t.Top+=incrementH;t.Bottom-=incrementH;
    if(nn4){t.clip.top=t.Top;t.clip.bottom=t.Bottom;}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
    visits--;}t.Width=t.Right-t.Left;t.Height=t.Bottom-t.Top;if(t.Height<=0&&t.Width<=0){
    if(nn4){t.visibility="hide";t.clip.left=t.origLeft;t.clip.top=t.origTop;
	t.clip.right=t.origRight;t.clip.bottom=t.origBottom;
    }else{t.style.visibility='hidden';t.style.clip="rect(auto)";}
	}else{setTimeout('tmt_divBoxIn("'+tl+'",'+dur+',1)',intval);}}
}
function P7_autoLayers() { //v1.2 by PVII
 var g,b,k,f,args=P7_autoLayers.arguments;
 var a = parseInt(args[0]);if(isNaN(a))a=0;
 if(!document.p7setc) {p7c=new Array();document.p7setc=true;
  for (var u=0;u<10;u++) {p7c[u] = new Array();}}
 for(k=0; k<p7c[a].length; k++) {
  if((g=MM_findObj(p7c[a][k]))!=null) {
   b=(document.layers)?g:g.style;b.visibility="hidden";}}
 for(k=1; k<args.length; k++) {
  if((g=MM_findObj(args[k])) != null) {
   b=(document.layers)?g:g.style;b.visibility="visible";f=false;
   for(j=0;j<p7c[a].length;j++) {
    if(args[k]==p7c[a][j]) {f=true;}}
  if(!f) {p7c[a][p7c[a].length++]=args[k];}}}
}
function P7AniMagic(el, x, y, a, b, c, s) { //v2.5 PVII
 var g,elo=el,f="",m=false,d="";x=parseInt(x);y=parseInt(y);
 var t = 'g.p7Magic = setTimeout("P7AniMagic(\''+elo+'\','; 
 if ((g=MM_findObj(el))!=null) {d=(document.layers)?g:g.style;}else{return;}
 if (parseInt(s)>0) {eval(t+x+','+y+','+a+','+b+','+c+',0)",' + s+')');return;}
 var xx=(parseInt(d.left))?parseInt(d.left):0;
 var yy=(parseInt(d.top))?parseInt(d.top):0;
 if(parseInt(c)==1) {x+=xx;y+=yy;m=true;c=0;}
 else if (c==2) {m=false;clearTimeout(g.p7Magic);}
 else {var i=parseInt(a);
  if (eval(g.moved)){clearTimeout(g.p7Magic);}
  if (xx<x){xx+=i;m=true;if(xx>x){xx=x;}}
  if (xx>x){xx-=i;m=true;if(xx<x){xx=x;}}
  if (yy<y){yy+=i;m=true;if(yy>y){yy=y;}}
  if (yy>y){yy-=i;m=true;if(yy<y){yy=y;}}}
 if (m) {if((navigator.appName=="Netscape") && parseInt(navigator.appVersion)>4){
    xx+="px";yy+="px";}
  d.left=xx;d.top=yy;g.moved=true;eval(t+x+','+y+','+a+','+b+','+c+',0)",'+b+')');
  }else {g.moved=false;}
}
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('@');
        if (p<1 || p==(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 compreso tra '+min+' e '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' e\' obbligatorio.\n'; }
  } if (errors) alert('Si e\' verificato il seguente errore(i):\n'+errors);
  document.MM_returnValue = (errors == '');
}

function YY_checkform() { //v4.04
//copyright (c)1998,2001 Yaromat.com
  var args = YY_checkform.arguments; var myDot=true; var myV=''; var myErr='';var addErr=false;
  var myForm = MM_findObj(args[0]);
  for (var i=1; i<args.length;i=i+4){
    if (args[i+1].charAt(0)=='#'){var myReq=true; args[i+1]=args[i+1].substring(1);}else{myReq=false}
    var myObj = MM_findObj(args[i].replace(/\[\d+\]/ig,""));
    myV=myObj.value;
    if (myObj.type=='text'||myObj.type=='password'){
      if (myReq&&myObj.value.length==0){addErr=true}
      if ((myV.length>0)&&(args[i+2]==1)){ //fromto
        if (!(myV/1)||myV<args[i+1].split('_')[0]/1||myV > args[i+1].split('_')[1]/1){addErr=true}
      }
      if ((myV.length>0)&&(args[i+2]==2)&&!myV.match("^[\\w\\.=-]+@[\\w\\.-]+\\.[a-z]{2,4}$")){addErr=true}// email
      if ((myV.length>0)&&(args[i+2]==3)){ // date
        var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);
        if(myAt){
          var myD=(myAt[myMa[1]])?myAt[myMa[1]]:1; var myM=myAt[myMa[2]]-1; var myY=myAt[myMa[3]];
          var myDate=new Date(myY,myM,myD);
          if(myDate.getFullYear()!=myY||myDate.getDate()!=myD||myDate.getMonth()!=myM){addErr=true};
        }else{addErr=true}
      }
      if ((myV.length>0)&&(args[i+2]==4)){ // time
        var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);if(!myAt){addErr=true}
      }
      if (myV.length>0&&args[i+2]==5){ // check this 2
            var myObj1 = MM_findObj(args[i+1].replace(/\[\d+\]/ig,""));
            if(!myObj1[args[i+1].replace(/(.*\[)|(\].*)/ig,"")].checked){addErr=true}
      }
      if (myV.length>0&&args[i+2]==6){ // the same
            var myObj1 = MM_findObj(args[i+1]);
            if(myV!=myObj1.value){addErr=true}
      }
    }else
    if (!myObj.type&&myObj.length>0&&myObj[0].type=='radio'){
          var myTest = args[i].match(/(.*)\[(\d+)\].*/i);
          var myObj1=(myObj.length>1)?myObj[myTest[2]]:myObj;
      if (args[i+2]==1&&myObj1&&myObj1.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}
      if (args[i+2]==2){
        var myDot=false;
        for(var j=0;j<myObj.length;j++){myDot=myDot||myObj[j].checked}
        if(!myDot){myErr+='[ ' +args[i+3]+'\n'}
      }
    }else
    if (myObj.type=='checkbox'){
      if(args[i+2]==1&&myObj.checked==false){addErr=true}
      if(args[i+2]==2&&myObj.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}
    }else
    if (myObj.type=='select-one'||myObj.type=='select-multiple'){
      if(args[i+2]==1&&myObj.selectedIndex/1==0){addErr=true}
    }else
    if (myObj.type=='textarea'){
      if(myV.length<args[i+1]){addErr=true}
    }
    if (addErr){myErr+='[ '+args[i+3]+'\n'; addErr=false}
  }
  if (myErr!=''){alert('L\'informazione richiesta non e\' valida o contiene errori:\n\n'+myErr)}
  document.MM_returnValue = (myErr=='');
}