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_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 Pag(Testo,Opzione,id)
	 {
		document.Paginazione.ricerca.value = Testo;	
		document.Paginazione.id.value = id;
		document.Paginazione.Opzione.value = Opzione;
		document.Paginazione.submit();
	 }

function WebmailSubmit()
	{ document.Webmail.submit();}
//-->

function modulo() {
     var errore="Attenzione!" 
     var nominativo = document.modulo.nominativo.value;
     var azienda = document.modulo.azienda.value;
     var messaggio = document.modulo.messaggio.value;
     var telefono = document.modulo.telefono.value;
     var email = document.modulo.email.value;
     var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
     programma='ajax/invio.asp?nominativo='+nominativo+'&azienda='+azienda+'&tel='+telefono+'&email='+email+'&messaggio='+messaggio;
     if (nominativo == ""){errore = errore + '\n Il campo Nominativo è obbligatorio'}
     if (messaggio == ""){errore = errore + '\n Il campo Messaggio deve essere compilato'}
     if ((isNaN(telefono)) || (telefono == "") || (telefono == "undefined")) {
           errore = errore + '\n Il campo Telefono è obbligatorio e deve essere numerico' }
     if (!email_reg_exp.test(email) || (email == "") || (email == "undefined")) {
     errore = errore + '\n Inserire un indirizzo email corretto'} 
     if (!document.modulo.privacy1.checked) {errore = errore + '\n Autorizzare il trattamento dei dati'} 
     if (errore == 'Attenzione!'){
     	if (window.XMLHttpRequest) {
        	ricerca_pro = new XMLHttpRequest();
        	ricerca_pro.onreadystatechange = ricevi1;
        	ricerca_pro.open("GET", programma,false);
        	ricerca_pro.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" );
			ricerca_pro.send(null);}
        else if (window.ActiveXObject) {
        	ricerca_pro = new ActiveXObject("Microsoft.XMLHTTP");
        	if (ricerca_pro) {ricerca_pro.onreadystatechange = ricevi1;
        		ricerca_pro.open("GET", programma,false);
        		ricerca_pro.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" );
        		ricerca_pro.send();}
    			}

 	}
     else {alert(errore);}
  }
function ricevi1() {   
    var strRes;       
    var arrValori;      
	  if (ricerca_pro.readyState == 4) {
	  strRes=ricerca_pro.responseText;
		  alert(strRes);
		  document.modulo.nominativo.value='';
          document.modulo.azienda.value='';
          document.modulo.messaggio.value='';
          document.modulo.telefono.value='';
          document.modulo.email.value='';
          document.modulo.privacy1.checked=false;}
	}
function Cerca(Ricerca)
	 {		
		document.formRicerca.Ricerca.value = Ricerca;
		document.formRicerca.submit();
	 }

function PopupCentrata(miofile,a,b) {
   	var w = a;
   	var h = b;
   	var l = Math.floor((screen.width-w)/2);
   	var t = Math.floor((screen.height-h)/2);
   	window.open(miofile,"","width=" + w + ",height=" + h + ",top=" + t + ",left=" + l + ", title=no,menubar=no,scrollbars=yes,resizable=yes");
}	
