// Visualizza Data e Ora
gg = new Array("Domenica","Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato");
function visua()
   {
   var ora = new Date();
   var aa = ora.getDate();
   var mm = ora.getMonth() + 1;
   var yy = ora.getFullYear();
   var oo = ora.getHours();
   var mn = ora.getMinutes();
   var sec = ora.getSeconds();
   var dd = ora.getDay();
   var aa2  = ((aa < 10) ? "0" : "");
   var mm2  = ((mm < 10) ? ".0" : ".");
   var oo2  = ((oo < 10) ? "0" : "");
   var mn2  = ((mn < 10) ? ":0" : ":");
   var sec2  = ((sec < 10) ? ":0" : ":");
   var Data = aa2 + aa + mm2 + mm  + "." + yy;
   var hh = oo2 + oo + mn2 + mn + sec2 + sec;
   if(document.all)
       document.all.primo.innerHTML = gg[dd] + ", " + Data + " " + hh;
     else
       if(document.getElementById)
	     document.getElementById('primo').innerHTML  = " &nbsp;" + gg[dd] + ", " + Data + " " + hh;
         //document.getElementById('primo').innerHTML  = gg[dd] + ", " + Data + "<br/>" + hh;
         window.setTimeout("visua()",1000);
   }
 onload=visua;

// Manda mailto a admin
   function TransposeAdmin(){
     var var1 ='sciap.it'
     var var2 = 'admin';
	 var var3 = '@';
    NewString = var2 + var3 + var1;
    parent.location = 'mailto:' + NewString;
    }

// Fa il popup delle foto
function MM_openBrWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}

function popup_car(mylink, windowname){
    if (! window.focus)return true;
       var href;
          if (typeof(mylink) == 'string')
             href=mylink;
             else
              href=mylink.href;
               window.open(href, windowname, 'width=800,height=600,scrollbars=yes');
                 return false
                 }

function ViewImage(ifile,ix,iy,ititle) { 
  var win;
  var sWidth;
  var sHeight;
  var NS = (document.layers) ? 1 : 0;
  win = window.open("","imageviewer","width="+ix+",height="+iy+",menubar=no,toolbar=no");
  if (NS) {
    sWidth = win.innerWidth;
    sHeight = win.innerHeight;
  } else {
      sWidth = win.document.body.clientWidth;
      sHeight = win.document.body.clientHeight;
  }
  if(sWidth!=ix || sHeight!=iy) {
    win.close();
    setTimeout("ViewImage('"+ifile+"',"+ix+","+iy+",'"+ititle+"')", 250);
    return;
  }
  win.document.open();
  win.document.write("<html><head><title>"+ititle+"</title>");
  win.document.write("</head><body>");
  win.document.write('<div style="position:absolute;width:'+ix+'px;height:'+iy+'px;left:0px;top:0px">');
  win.document.write("<img src="+ifile+"></div></body></html>");
  win.document.close();
  }

// Mail automatica (contatti)
  function Modulo() {

        if ((document.modulo.nome.value == "")) {
           alert("Il campo Nome è obbligatorio");
           document.modulo.nome.focus();
           return false;
        }

        else if ((document.modulo.email.value == "")) {
          alert("Il campo Email è obbligatorio");
          document.modulo.email.focus();
          return false;
        }

        else if ((document.modulo.messaggio.value == "")) {
           alert("Il campo Messaggio è obbligatorio");
           document.modulo.messaggio.focus();
           return false;
        }

        else {
           document.modulo.action = "mailto.php";
           document.modulo.submit();
        }
  }