     /* SCRIPT NECESSARIO PER IL LAYOUT CON VIDEO */
     var thisbrowser;
     if(document.layers){
        thisbrowser="NN4";
       }
     if(document.all){
        thisbrowser="ie"
       }
     if(!document.all && document.getElementById){
       thisbrowser="NN6";
       }

     function chInnerHTML(VALUE, PERCORSO) {

      if(document.layers) {
       for(i=0;i<document.layers.length;i++)
       {
        if(document.layers[i].id=='Video') {
          if(VALUE=='56 Kb') {
            document.layers[i].innerHTML = '<td class="video"><table><tr><td><table style="BORDER: #505050 1px solid;" width="242"  height="5"><tr><td align=right><font face=verdana size=1 color=black>56k</font></td></tr></table></td></tr></table><embed fullscreen="yes" width="240" type="video/x-msvideo" style="BACKGROUND-COLOR:#000000;BORDER: #505050 1px solid;"  src="' + PERCORSO +'" height="240"></embed>';
            }

        if(VALUE=='Adsl') {
          document.layers[i].innerHTML =   '<td class="video"><table><tr><td><table style="BORDER: #505050 1px solid;" width="242"  height="5"><tr><td align=right><font face=verdana size=1 color=black>Adsl</font></td></tr></table></td></tr></table><embed fullscreen="yes" width="240" type="video/x-msvideo" style="BACKGROUND-COLOR:#000000;BORDER: #505050 1px solid;" src="' + PERCORSO +'" height="240"></embed>';
          }
        }
       }
      }
      else if(document.all)
      {
       for(i=0;i<document.all.length;i++)
       {
        if(document.all[i].id=='Video' && VALUE=='56 Kb')
        {
         document.all[i].innerHTML = '<td class="video"><table style="BORDER: #505050 1px solid;" width="242"  height="5"><tr><td align=right><font face=verdana size=1 color=black>56k</font></td></tr></table></td><embed fullscreen="yes" width="240" type="video/x-msvideo" style="BACKGROUND-COLOR:#000000;BORDER: #505050 1px solid;" src="' + PERCORSO + '" height="240"></embed>';
        }
       if(document.all[i].id=='Video' && VALUE=='Adsl')
        {
         document.all[i].innerHTML = '<td class="video"><table style="BORDER: #505050 1px solid;" width="242"  height="5"><tr><td align=right><font face=verdana size=1 color=black>Adsl</font></td></tr></table></td><embed fullscreen="yes" width="240" type="video/x-msvideo" style="BACKGROUND-COLOR:#000000;BORDER: #505050 1px solid;" src="' + PERCORSO + '" height="240"></embed>';
        }
       }
      }
      else if(document.getElementById)
      { 
       for(i=0;i<document.getElementsByTagName("div").length;i++)
        {
         if(document.getElementsByTagName("div").item(i).id=='Video')
         {
          if(VALUE=='56 Kb')
           {
           document.getElementsByTagName("div").item(i).innerHTML = '<td class="video"><embed fullscreen="yes" width="240" type="video/x-msvideo" style="BACKGROUND-COLOR:#000000;BORDER: #505050 1px solid;" src="' + PERCORSO +'" height="240"></embed></td>';
           }
          if(VALUE=='Adsl')
           {
           document.getElementsByTagName("div").item(i).innerHTML = '<td class="video"><embed fullscreen="yes" width="240" type="video/x-msvideo" style="BACKGROUND-COLOR:#000000;BORDER: #505050 1px solid;" src="' + PERCORSO +'" height="240"></embed></td>';
           }
         }
       }
      }
     } 
     
     
var SubjectLine='Segnalazione pagina ' + top.document.title; 

var BodyText='Ti consiglio di visitare questa pagina web: '+ top.location.href;

var Message='<A HREF="mailto:?SUBJECT='+escape(SubjectLine)+'&BODY='+escape(BodyText)+'" OnMouseOver="status=\'Invia questo link a un amico\'; return true;" TITLE="Segnala questo sito via eMail">Segnala questa pagina</A> ';

var MessageIE='<A HREF="mailto:?SUBJECT='+(SubjectLine)+'&BODY='+(BodyText)+'" OnMouseOver="status=\'Invia questo link a un amico\'; return true;" TITLE="Segnala questa pagina via eMail">Segnala questa pagina</a> ';

var DivAperto=0;


function Apri(n)
   {
   if ( DivAperto != 0)
      {
      document.getElementById("ds"+DivAperto).style.display = "none" ;
      document.getElementById("tdmenu"+DivAperto).className=null;
   
   }
   if (DivAperto !=n )
      {
      document.getElementById("ds"+n).style.display="block";
          DivAperto=n;

      document.getElementById("tdmenu"+n).className="menutdhover";


      }
   else
      {
   document.getElementById("ds"+n).style.display="none";
      DivAperto=0;

      document.getElementById("tdmenu"+n).className=null;
      }
   }

        function codifica(stringa){
           stringa_new="";
         
           for (i=0;i<stringa.length;i++){
              if ((stringa.charCodeAt(i)>=123)||((stringa.charCodeAt(i)>=35)&&(stringa.charCodeAt(i)<=37))||((stringa.charCodeAt(i)>=40)&&(stringa.charCodeAt(i)<=42))||(stringa.charCodeAt(i)==44)||(stringa.charCodeAt(i)==46)||((stringa.charCodeAt(i)>=91)&&(stringa.charCodeAt(i)<=96))){
                 stringa_new=stringa_new+"&#"+stringa.charCodeAt(i)+";";
              }else{
                 stringa_new=stringa_new+stringa.charAt(i);
              }
           }
           return stringa_new;
        }       

        function codificaf(stringa){
           stringa_new="";
         
           for (i=0;i<stringa.length;i++){
              if ((stringa.charCodeAt(i)>=123)||((stringa.charCodeAt(i)>=35)&&(stringa.charCodeAt(i)<=37))||((stringa.charCodeAt(i)>=40)&&(stringa.charCodeAt(i)<=42))||(stringa.charCodeAt(i)==44)||(stringa.charCodeAt(i)==46)||((stringa.charCodeAt(i)>=91)&&(stringa.charCodeAt(i)<=96))){
                 stringa_new=stringa_new+"%";
              }else{
                 stringa_new=stringa_new+stringa.charAt(i);
              }
           }
           return stringa_new;
        }       

var bName = navigator.appName;
var bVer = parseInt(navigator.appVersion);
var NS4   = (bName == "Netscape" && bVer >= 4);
var IE472 = (bName == "Microsoft Internet Explorer" && bVer >= 4.72);
var IE4   = (bName == "Microsoft Internet Explorer" && bVer >= 4 && bVer < 4.72);
var NS3   = (bName == "Netscape" && bVer < 4);
var IE3   = (bName == "Microsoft Internet Explorer" && bVer < 4);
 
function selection(url_path)
{
   agent = navigator.userAgent;
   if (agent.toUpperCase().indexOf("MOZILLA/3.01 (MAC") > -1)
     location = url_path;
   else
   {
     max =window.open(url_path,'Documenti','width=500,height=300,top=50,left=10,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no');     /*self.close();*/
   }
}
 
    stImg = new Object();
    stImg.randomSeed = 9;
    stImg.img1 = "/ofmcap/images/testata1.jpg";
    stImg.img2 = "/ofmcap/images/testata2.jpg";
    stImg.img3 = "/ofmcap/images/testata3.jpg";
    stImg.img4 = "/ofmcap/images/testata4.jpg";
    stImg.img5 = "/ofmcap/images/testata5.jpg";
    stImg.img6 = "/ofmcap/images/testata6.jpg";
    stImg.img7 = "/ofmcap/images/testata7.jpg";
    stImg.img8 = "/ofmcap/images/testata8.jpg";
    stImg.img9 = "/ofmcap/images/testata9.jpg";

 
   //Generate random numbers for the central images.
   //To add additional images, just add them in sequence as shown above to the stImg object.
   function loadStimg() {
 
      randomImgNum = Math.floor(Math.random() * stImg.randomSeed);
      return(randomImgNum + 1);
   }
 
   function popWin(whichURL) {
      pfolio1 = window.open(whichURL,"z64win","resizeable=yes,scrollbars,width=542,height=343");
   }
 
 var imgDir = "img/home/";
 
 function imgSwap(imageName,swapTo) {
  if (browser.IE == true) {
  document[imageName].src = imgDir + swapTo;
  }
 }
// -->

function valida_frati(){

    document.formf1.p_nome.value = codificaf(document.formf.p_nome.value);
    document.formf1.p_cognome.value = codificaf(document.formf.p_cognome.value);
    document.formf1.p_nazione.value = codificaf(document.formf.p_nazione.value);
    document.formf1.p_circoscrizione.value = codificaf(document.formf.p_circoscrizione.value);

	document.formf1.submit();

}

function valida_domus(tipo){

    if (tipo==1)
    {
      document.formf1.p_nazione.value = codificaf(document.formf.p_nazione.options[document.formf.p_nazione.selectedIndex].value);

      document.formf1.p_id_circoscrizione.value = document.formf.p_id_circoscrizione.options[document.formf.p_id_circoscrizione.selectedIndex].value;

    }
	else if (tipo==2)
	{
      document.formf1.p_nazione.value = codificaf(document.formf.p_nazione.options[document.formf.p_nazione.selectedIndex].value);
      document.formf1.p_circoscrizione.value = codificaf(document.formf.p_circoscrizione.value);

	}

	document.formf1.submit();

}
     
function valida_arearis(){
	
	var var_message='Nome: '+document.form.p_nome.value +'<br>'+'Cognome: '+document.form.p_cognome.value+'<br>'+'Circoscrizione: '+document.form.p_circoscrizione.value+'<br>E-mail: '+document.form.mittente.value;

    document.form1.messaggio.value = var_message+'<br><br>'+document.form.messaggio.value;
	document.form1.subject.value = 	document.form.subject.value;
	document.form1.mittente.value = document.form.mittente.value;
	document.form1.cc.value = document.form.mittente.value;


	document.form1.submit();

}
