// JavaScript Document



function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}





function OpenPopUp(pagina,w,h){
	var apri1 = window.open('popup/'+pagina,'popup','width='+w+',height='+h+' ,toolbar=no, location=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes');
	apri1.moveTo(20,20);
}



/////////////////////// APRI PAGINA POPUP AL CENTRO DELLA FINESTRA //////////////////////
			
			function apri_popup_centrale(url, name, 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, name, 'left=' + cntx + ',top=' + cnty + ',width=' + 
			  width + ',height=' + height);
			}

/////////////////////// CONTROLLO FORM ISCRIZIONE NEWSLETTER /////////////////////////////////////


			function Controlla_form_iscrizione(){
			  ////////////////// NOME ////////////////////////
			  
			  var theForm = document.forms["formSubscribe"];
			  
			  if(theForm.nome.value==''){
			  alert("Attenzione, il campo 'Nome' è obbligatorio ai fini della registrazione.");
			  theForm.nome.focus();
			  return false;
			  }
			  ///////////////// COGNOME //////////////////////////
			  if(theForm.cognome.value==''){
			  alert("Attenzione, il campo 'Cognome' è obbligatorio ai fini della registrazione.");
			  theForm.cognome.focus();
			  return false;
			  }
			  /////////////////// email 1 ///////////////////////
			  if(theForm.email.value==''){
			  alert("Attenzione,  il campo 'Email' è obbligatorio ai fini della registrazione.");
			  theForm.email.focus();
			  return false;
			  }
			  /////////////////// email 2 ////////////////////////////
			  if(theForm.email.value!=''){
			   var goodemail = theForm.isc_email.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
			   if(!goodemail){
				  alert("Attenzione, il campo 'Email' non contiene un indirizzo email valido.");
				  return false;
			   }
			  }
			
			  ///// DATI PERSONALI //////////////
			  
			  if(theForm.trattamento.checked==false){
			  alert("Attenzione, per poter inviare la vostra richiesta di registrazione dovete accettare le condizioni di trattamento dei dati personali.");
			  return false;
			  }
			  
			
			return true;
			}

////////////////////////////////////////////////////////////////

function apri_pagina_download(pagina){
	var apri1 = window.open(pagina,'download','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,titlebar=0,resizable=0,scrolling=auto,width=600,height=600');
	apri1.moveTo(150,100);
}



function adjust_popup_zoom(){

        var w, h, fixedW, fixedH, diffW, diffH;

        if (document.getElementById("Photo") || document.all) {
                fixedW = document.getElementById("Photo").width;
                fixedH = document.getElementById("Photo").height;
				w = fixedW+90;
				h = fixedH+230;
				
				window.resizeTo(w,h);

                window.moveTo((screen.availWidth-w)/2, (screen.availHeight-h)/2);
		
		
		}
}


////////////////////////////////////////////////////////////////

function adjust_popup(){

        var w, h, fixedW, fixedH, diffW, diffH;

        if (document.all) {
                fixedW = document.body.clientWidth;
                fixedH = document.body.clientHeight;
                window.resizeTo(fixedW, fixedH);
                diffW = fixedW - document.body.clientWidth;
                diffH = fixedH - document.body.clientHeight;
        } else {
                fixedW = window.innerWidth;
                fixedH = window.innerHeight;
                window.resizeTo(fixedW, fixedH);
                diffW = fixedW - window.innerWidth;
                diffH = fixedH - window.innerHeight;
        }
		
		
		
        w = fixedW + diffW;
        h = fixedH + diffH;

		
        if (h >= screen.availHeight) w += 10;
        if (w >= screen.availWidth)  h += 10;
		
        w = Math.min(w,screen.availWidth);
        h = Math.min(h,screen.availHeight);
        window.resizeTo(w,h);
        window.moveTo((screen.availWidth-w)/2, (screen.availHeight-h)/2);
}

//////////////////////////////////////////////////////7

function on_riga_over(riga, color){
document.getElementById(riga).bgColor=color;
}

function on_riga_out(riga, color){
document.getElementById(riga).bgColor=color;
}

////////////////////////////////////////////////////////

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_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_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];}
}
//-->