

function the_size() {
          colonna_destra_style = Element.getDimensions( 'linkList_dx' );
          colonna_destra_style = colonna_destra_style.height;
          supportingText_style = Element.getDimensions( 'supportingText' );
          supportingText_style = supportingText_style.height-30;
          linkList_style = Element.getDimensions( 'linkList' );;
          linkList_style = linkList_style.height;

	supportingText_style=supportingText_style*1;
	supportingText_style=(supportingText_style+50);

        var myWidth = 0, myHeight = 0;
        if( typeof( window.innerWidth ) == 'number' ) {
          //Non-IE
          myWidth = window.innerWidth;
          myHeight = window.innerHeight;
        } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
          //IE 6+ in 'standards compliant mode'
           myWidth = document.documentElement.clientWidth;
           myHeight = document.documentElement.clientHeight;
        } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
           //IE 4 compatible
           myWidth = document.body.clientWidth;
           myHeight = document.body.clientHeight;
        }
        myHeight_rid=myHeight-200;
	// var altezza=Math.max(myHeight_rid,linkList_style, supportingText_style, colonna_destra_style);
	// altezza=altezza + 110;
        altezza_senza_barra=altezza - 29;
        altezza=altezza + "px";
        altezza_senza_barra=altezza_senza_barra + "px";

      //  document.getElementById("linkList_dx").style.height=altezza_senza_barra;
      //  document.getElementById("supportingText").style.height=altezza_senza_barra;
      //  document.getElementById("linkList").style.height=altezza;
//        document.body.style.marginLeft=distanza;
	}




function controlla(){

	var msg="";
	msg="Messaggi di errore\n\n";
	var campo=document.dati.elements;

	if(!campo.azienda.value||campo.azienda.value.length<2) {msg=msg+'\n Non è stato inserito correttamente la Ragione Sociale  (' + campo.azienda.value + ')';}

	if(!campo.referente.value||campo.referente.value.length<2) {msg=msg+'\n non è stato inserito correttamente il referente (' + campo.referente.value + ')';}

	if(!campo.cap.value||campo.cap.value.length<4) {msg=msg+'\n non è stato inserito correttamente il CAP (' + campo.cap.value + ')';}
	if(!campo.citta.value||campo.citta.value.length<2) {msg=msg+'\n non è stato inserito correttamente la Città (' + campo.citta.value + ')';}
	if(!campo.provincia.value||campo.provincia.value.length<2) {msg=msg+'\n non è stato inserito correttamente la Provincia (' + campo.provincia.value + ')';}
	if(!campo.tel.value||campo.tel.value.length<2) {msg=msg+'\n non è stato inserito correttamente il numero di Telefono (' + campo.tel.value + ')';}

	var emailStr=campo.email.value;
	if (campo.email.value.length < 7) {
	msg=msg+'\n non è stato inserito correttamente il campo Email (' + campo.email.value + ')';
	} else {
	var emailPat=/^(.+)@(.+)$/;
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]";
	var validChars="\[^\\s" + specialChars + "\]";
	var quotedUser="(\"[^\"]*\")";
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	var atom=validChars + '+';
	var word="(" + atom + "|" + quotedUser + ")";
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

	var matchArray=emailStr.match(emailPat);
	if (matchArray==null) {
	   msg=msg+"\nL'indirizzo di email sembra non essere corretto controllare la presenza di @ e punti."
	} else {
	var user=matchArray[1]
	var domain=matchArray[2]
	if (user.match(userPat)==null) {
	    // user is not valid
	   msg=msg+"\nL'indirizzo di email ha il nome utente non scritto correttamente"}
	var IPArray=domain.match(ipDomainPat)
	if (IPArray!=null) {
	    // this is an IP address
		  for (var i=1;i<=4;i++) {
		    if (IPArray[i]>255) {
		        alert("Destination IP address is invalid!")
		    }
	    }
	    return true
	}
	var domainArray=domain.match(domainPat)
	if (domainArray==null) {
	   msg=msg+"\nL'indirizzo di email è scritto con un dominio non corretto"
	}

	}
	}

	  if (msg.length>20){
	    alert(msg)
	    return false;
	  }
	  else {
	    var agree=confirm("Tutti i controlli sono stati effettuati e non essendo stati rilevati errori \neventuali modifiche o inserimento di dati verranno archiviati\nrisulta quindi possibile continuare con la navigazione.\nLa pressione sul tasto OK implica esplicita accettazione delle\nnorme sulla tutela privacy attualmente in vigore.\n");
	    if (agree) {
	    document.dati.submit();
	    } else {
	    return false;
	    }
	  }

}


function muovi(direzione) {
	var esterno='esterno_news';
	var interno='interno_news';
		var dim_int=$(interno).getHeight();
		var dim_est=$(esterno).getHeight();
		var dim=dim_int-dim_est;
		dim=dim*-1;
		tempo=$('numero_news').value*8;
	//	alert(dim)
	//	if(dim.indexOf('px')>0) {dim=dim.substring(0,dim.length-2);}
	
		if(direzione=="down") {
			new Effect.Move(interno, { x: 0, y: dim, mode: 'absolute', duration: tempo });
			muovi.delay(tempo,'up')
		}
		if(direzione=="up") {
			new Effect.Move(interno, { x: 0, y: 0, mode: 'absolute', duration: tempo });
			muovi.delay(tempo,'down')
		}
}

