// variabili globali per inserimento apostrofo e apici
var apostrofo = "'";
var apici = '"';

//<!-- Standard function
function MM_swapImgRestore() 
{ 
  var i;
  var x;
  var a=document.MM_sr; 
  for(i=0; a&&i<a.length&&(x=a[i])&&x.oSrc; i++) 
  {
     x.src=x.oSrc;
  }
}

function MM_preloadImages() 
{
  var d=document; 
  if(d.images)
  { 
    if(!d.MM_p) 
    {
      d.MM_p=new Array();
    }
    var i;
    var j=d.MM_p.length;
    var 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) 
{
  var p;
  var i;
  var 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 && document.getElementById)
  {
     x=document.getElementById(n);
  }
   return x;
}

function MM_swapImage() 
{
  var i;
  var j=0;
  var x;
  var 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];
      }
  }
}
// End Standart Funcion -->

//******************************************
//*********  Funzioni comuni a tutti i file  ********
//******************************************

// Funzione per apertura dei file con i reader specifici
function ShowFile(file)
{
  newWindow = window.open(file, "ShowFile",  "resizable=yes, scrollbars=yes, menubar=yes");
}

// Funzione per apertura finestra con foto
function MostraFoto(arg,width,height) 
{ 
  return window.open(arg,'foto','width='+width+',height='+height+',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0,screenX=0,left=0,screenY=0,top=0'); 
} 

// Funzione per apertura finestra con foto con ridimensionamento
function MostraFoto2(arg,width,height) 
{ 
  return window.open(arg,'foto','width='+width+',height='+height+',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=1,screenX=0,left=0,screenY=0,top=0'); 
} 

//<!-- Funzioni per il fading delle immagini
function high(oggetto)
{
   object=oggetto;
   highlighting=setInterval("highlightit(object)",50);
}

function low(oggetto)
{
  clearInterval(highlighting)
  oggetto.filters.alpha.opacity=30
}

function low2(which2)
{
  clearInterval(highlighting);
  which2.filters.alpha.opacity=0;
}

function highlightit(cur2)
{
  if (cur2.filters.alpha.opacity<100)
  {
     cur2.filters.alpha.opacity+=5;
  }
  else if (window.highlighting)
  {
     clearInterval(highlighting);
  }
}
// End Funzioni per il fading delle immagini -->

//<!-- Gestione Ultima Modifica
function ultimaModifica()
{
   var UpDate = new Date(document.lastModified);
   document.write("Ultima Modifica: " + UpDate.getDate() + "/" + (1 + UpDate.getMonth()) + "/" + UpDate.getFullYear() + "<br><br>");
}
// End Gestione Ultima Modifica -->

//<!-- Gestione Barra di Stato
function SetStatus() 
{
   // testo da inserire nella barra
   window.status = "Anche tu... sei importante! - Il sito della P.G.V.R. della Provincia Romana";
   // chiamata ricorsiva dopo 100 millisecondi
   setTimeout("SetStatus()", 100);
}
// Esegui
SetStatus();

// End Gestione Barra di Stato -->

//<!-- Gestione pop-up di avvisi e altro
function avviso()
{
  var mostra=false;
//    Avviso=showModelessDialog("pagine/buonNatale.html","Auguri","help:0;resizable:0;scroll:0;status:0;dialogWidth:400px;dialogHeight:570px");
//    Avviso=showModelessDialog("immagini/ludovicoNatale.jpg","Auguri","help:0;resizable:0;scroll:0;status:0;dialogWidth:198px;dialogHeight:282px");   
//    Avviso=showModelessDialog("pagine/avviso.html","Avviso","help:0;resizable:0;scroll:0;status:0;dialogWidth:205px;dialogHeight:350px");
//    Avviso=showModelessDialog("pagine/messaggioscritto.html","Avviso","help:0;resizable:0;scroll:0;status:0;dialogWidth:300px;dialogHeight:180px");
//    Avviso=showModelessDialog("pagine/x_Blok.html","Avviso","help:0;resizable:0;scroll:0;status:0;dialogWidth:300px;dialogHeight:360px");
//    mostra=true;
  if (mostra) { Avviso.setTimeout("self.close()",16000); }
}
// Fine gestione pop-up di avvisi e altro -->

//<!-- Gestione resize della Window di Explorer
function sizeWindow(w, h) 
{
  // Adattare larghezza e altezza per sistemare l'area dello schermo.
  w -= screen.width  - screen.availWidth;
  h -= screen.height - screen.availHeight;
  // Adattamento per il bordo della finestra che sparisce quando è a tutto schermo.
  w += 8;
  h += 8;
  // Adattamento dellla finestra per NS.
  if (document.layers) 
  {
    w -= window.outerWidth  - window.innerWidth;
    h -= window.outerHeight - window.innerHeight;
  }
  if (w > 0 && h > 0)
    window.resizeTo(w, h);
}
// End Gestione resize della Window di Explorer -->


//<!-- Gestione Pop-up Centrale
function popup_centrale(url, width, height) 
{ 
     if (document.all) 
    { 
       var x = window.screenLeft;    
       var y = window.screenTop;    
       var w = window.document.body.offsetWidth;    
       var h = window.document.body.offsetHeight;  
    }  
    else 
    {    
       var x = window.screenX;    
       var y = window.screenY;    
       var w = window.outerWidth;    
       var h = window.outerHeight;  
     }  
     
     var cntx = x + Math.round((w - width) / 2);  
     var cnty = y + Math.round((h - height) / 2);  
     window.open (url, null, 'left=' + cntx + ',top=' + cnty + ',width=' + width + ',height=' + height);
 
}
// End Gestione Pop-up Centrale -->

//<!-- Gestione del Countdown
// variabile when = (mese_in_inglese, giorno, anno) per esempio (april, 27, 1966)
function countDown(when)
{
  var appuntamento   = new Date(when);                     // la data d'inizio
  var oggi = new Date();                                                            // la data odierna
  var differenza  = appuntamento.getTime() - oggi.getTime();       // questo valore è espresso in millisecondi
  var countdown = Math.floor(differenza / (1000 * 60 * 60 * 24));  // quindi.....

  if (countdown < 0)
  {
     var trascorsi = -(countdown + 1)
  }
  else
  {
     var trascorsi = (countdown + 1)  
  }
  document.write("<b>" + trascorsi + "</b>");
}
// End Gestione del Countdown -->


// <!-- Gestione Livelli Espandibili

function ShowAndHide(id1,id2,img,where)
{
   var path='immagini/';
   var path2='../immagini/';

   if(document.getElementById)
   {
      el1=document.getElementById(id1);
      el2=document.getElementById(id2);

      if(el1.style.display=="none")
      {
         el1.style.display="block";
         el2.style.display="none";
         if(where==0)
         {
            MM_swapImage(img,'',''+path+'giu_bianco.gif',1);
         }
         if(where==1)
         {
            MM_swapImage(img,'',''+path2+'giu_bianco.gif',1);
         }
      }
      else
      {
         el1.style.display="none";
         el2.style.display="block";
         if(where==0)
         {
            MM_swapImage(img,'',''+path+'su_bianco.gif',1);
         }
         if(where==1)
         {
            MM_swapImage(img,'',''+path2+'su_bianco.gif',1);
         }
      }
   }
}


var head="display:''"
var folder=''

var rowId=new Array();
//menù sito
rowId[0]='men0';
rowId[1]='men1';
rowId[2]='men2';
rowId[3]='men3';
rowId[4]='men4';
rowId[5]='men5';
rowId[6]='men6';
rowId[7]='men7';
//links ext
rowId[8]='men8';
rowId[9]='men9';
rowId[10]='men10';
rowId[11]='men11';
rowId[12]='men12';
rowId[13]='men13';
rowId[14]='men14';

rowId[15]='men15';
rowId[16]='men16';
rowId[17]='men17';
rowId[18]='men18';
rowId[19]='men19';
rowId[20]='men20';

// End Gestione Livelli Espandibili -->

// <!-- Gestione Cambio Colore
 function CambioColore(obj,coloreSf,coloreT)
{
   if(document.getElementById(obj).style)
   {
     document.getElementById(obj).style.backgroundColor = coloreSf;
     document.getElementById(obj).style.color=coloreT;
   }
}
// End Cambio Colore -->

//<!-- Gestione Utilities
function DoHomePage() 
{
  if(document.all)
  {
    document.body.style.behavior='url(#default#homepage)';
    document.body.setHomePage('http://www.anchetu6importante.it');
  }
}

function AddPrefer()
{
  var link="http://www.anchetu6importante.it";
  var nome="P.G.V.R. della Provincia Romana Redentoristi";

  if (document.all)
    window.external.AddFavorite(link,nome);
}

function Aggiorna()
{
  if (document.all)
  location.reload();
}

function MailFriend()
{
  var email = 'Indirizzo di posta elettronica del tuo amico';
  var oggetto = 'Ti consiglio qualcosa di interessante...';
  var testo = 'Il sito www.anchetu6importante.it  - Sito della Pastorale Giovanile Vocazionale Redentorista. Buona visione, Ciao.';
  location.href = 'mailto:' + email + '?Subject=' + oggetto + '&Body=' + testo;
}

function sizeWindow(w, h) 
{
  // Adattare larghezza e altezza per sistemare l'area dello schermo.
  w -= screen.width  - screen.availWidth;
  h -= screen.height - screen.availHeight;
  // Adattamento per il bordo della finestra che sparisce quando è a tutto schermo.
  w += 8;
  h += 8;
  // Adattamento dellla finestra per NS.
  if (document.layers) 
  {
    w -= window.outerWidth  - window.innerWidth;
    h -= window.outerHeight - window.innerHeight;
  }
  if (w > 0 && h > 0)
    window.resizeTo(w, h);
}

function PrintIt()
{
  window.print();
}
//End Gestione Utilities -->
