	function spedisci(){
	flag=true;
	checkMail();	
	if (flag ==true)
		{
		this.document.forms["regForm2"].submit();
		}
	}
	
	
	function swapper1(){
			this.document.img1.src="images/img_active2.jpg";
			this.document.img2.src="images/img_selected.gif";
			this.document.img3.src="images/image_2.jpg";
			cart1=this.document.forms["regForm"].img3.value="1";
			//alert(cart1);
	}
			
	function swapper2(){
			this.document.img2.src="images/img_selected2.jpg";
			this.document.img1.src="images/img_active.gif";
			this.document.img3.src="images/image_1.gif";
			cart2=this.document.forms["regForm"].img3.value="2";
			//alert(cart2);
	}	
	
	function checkMail() 
		{
			for(ccc=1;ccc<6;ccc++){
			//alert('contenuto email: '+this.document.forms["regForm2"]["email"+ccc].value);
			var x=this.document.forms["regForm2"]["email"+ccc].value;
			var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
			//if ((filter.test(x))&&(x!='')) alert('YES! Correct email address');
			
			if ((!filter.test(x))&&(x!='')){
				alert('Indirizzo email inserito non corretto.');
				flag=false;
				}
			//if (x=='') flag=false;
			//ci vuole un controllo sui campi lasciati vuoti... attenzione col flag
			}
		}
	
	function checknum(ii) {
		return !isNaN(ii);
	}
	function init()
			{
			//TUTTI I CAMPI OBBLIGATORI DEL FORM	
			define('nome','string','nome');
			define('cognome','string','cognome');
			define('email','email','email');
			}
	function invia() {
	        validate();
	        flag = true;
	        if (returnVal) {
			//alert('img3: '+this.document.forms["regForm"].img3.value);
				valoreasso=this.document.regForm.associazione.value;
				controlasso=this.document.regForm.check[0].checked;
				ceta=this.document.regForm.eta.value;
				if (!this.document.regForm.checkpri.checked)	{
					alert('Per procedere e\' necessario accettare il trattamento dei dati personali.');	
					flag = false;
				} else if (!this.document.regForm.checkpri.checked) {
					alert('Per procedere e\' necessario accettare il regolamento del concorso.');
					flag = false;
				} else if (!controlasso && valoreasso!='') {	
					alert('Spunta SI per inserire l\'associazione');
					flag = false;
				} else if (controlasso && valoreasso=='') {
					alert('Inserisci la tua associazione');	
					flag = false;						
				} else if (!checknum(ceta)) {
					alert('Eta\' inserita non corretta');	
					flag = false;
				} 
				//iiiimmm=this.document.forms["regForm"].img3.value;
				//alert(iiiimmm);
				//flag=false;
				if (flag == true) {
					this.document.forms["regForm"].submit();
				}
			}
	}