//assegna campo_____________________________________________________________
	function assegna(campo,valore){
		document.getElementById(campo).value=valore;
	}
//invio form________________________________________________________________
	function invia(modulo){
		document.getElementById(modulo).submit();
	}

function mostra(n){
	piu="piu"+n;
	meno="meno"+n;
	gruppo="gruppo"+n;
	if (document.getElementById(meno).style.display=='none'){
		document.getElementById(meno).style.display='block';
		document.getElementById(gruppo).style.display='block';
		document.getElementById(piu).style.display='none';
	}else{
		document.getElementById(meno).style.display='none';
		document.getElementById(gruppo).style.display='none';
		document.getElementById(piu).style.display='block';
	}
}
function dimensione(tipo){
	with(document){
		if (getElementById('article').style.fontSize==''){getElementById('article').style.fontSize="100%"}
		if (tipo=='+'){getElementById('article').style.fontSize="115%"}
		if (tipo=='-'){getElementById('article').style.fontSize="100%"}
	}
}
function visu(zona){
	document.getElementById(zona).style.display=='none' ? document.getElementById(zona).style.display='block' : document.getElementById(zona).style.display='none'
}
function visu2(zona,vis){
	vis==1 ? document.getElementById(zona).style.display='block' : document.getElementById(zona).style.display='none'
}
function cambia(imm,imm2){
	if (document.getElementById(imm).style.display=='none'){
		document.getElementById(imm2).style.display='none';
		document.getElementById(imm).style.display='block';
	}else{
		document.getElementById(imm).style.display='none';
		document.getElementById(imm2).style.display='block';
	}
}
//Funzione EMAIL_______________________________________________________
	function isEmail(campo){
		appo=true
		if (campo!=''){
			campo=campo.split('@');
			if (campo.length!=2){appo=false;}
			if (appo){
				if ((campo[0].length < 2) || (campo[1].length < 5)){
					appo=false;
				}
			}
			if (appo){
				campo=campo[1].split('.');
				if(campo.length < 2){appo=false}
				if (appo){
					if (campo[0].length<2){appo=false}
				}
				if(appo){
					if (campo[1].length<2){appo=false}
				}
			}
		}
		return appo;
	}
//WIKI form____________________________________________________________
function iscrizione_wiki(){
	err='';
	with(document){
		if (!getElementById('privacy').checked){
			err="  - E'obbligatorio dare il consenso al trattamento dei dati personali\n" + err;
			getElementById('privacy').focus();
		}
		if (getElementById('email').value != getElementById('email2').value){
			err="  - Il campo INDIRIZZO E-MAIL e CONFERMA INDIRIZZO E-MAIL devono essere uguali\n" + err;
			getElementById('email').focus();
		}
		if (!isEmail(getElementById('email').value)){
			err="  - Il campo INDIRIZZO E-MAIL non e' valido\n" + err;
			getElementById('email').focus();
		}
		if (getElementById('email').value == ''){
			err="  - Il campo INDIRIZZO E-MAIL e' obbligatorio\n" + err;
			getElementById('email').focus();
		}
		if (getElementById('nome').value == ''){
			err="  - Il campo NOME E COGNOME e' obbligatorio\n" + err;
			getElementById('nome').focus();
		}
		if (err!=''){
			alert('Attenzione!!!Riscontrati i seguenti errori:\n\n' + err)
		}else{
			invia('iscrizione_wiki');
		}
	}
}
//WIKI inserimento____________________________________________________________
function wiki_inserimento(){
	err='';
	with(document){
		if (!getElementById('privacy').checked){
			err="  - E'obbligatorio autorizzare al trattamento della scheda inserita\n" + err;
			getElementById('privacy').focus();
		}
		if (getElementById('passw').value == ''){
			err="  - Il campo PASSWORD e' obbligatorio\n" + err;
			getElementById('passw').focus();
		}
		if (!isEmail(getElementById('email').value)){
			err="  - Il campo INDIRIZZO E-MAIL non e' valido\n" + err;
			getElementById('email').focus();
		}
		if (getElementById('email').value == ''){
			err="  - Il campo INDIRIZZO E-MAIL e' obbligatorio\n" + err;
			getElementById('email').focus();
		}
		if (getElementById('descrizione').value == ''){
			err="  - Il campo DESCRIZIONE e' obbligatorio\n" + err;
			getElementById('descrizione').focus();
		}
		if (getElementById('titolo').value == ''){
			err="  - Il campo NOME E COGNOME e' obbligatorio\n" + err;
			getElementById('titolo').focus();
		}
		if (getElementById('categoria').value == ''){
			err="  - Il campo CATEGORIA e' obbligatorio\n" + err;
			getElementById('categoria').focus();
		}
		if (err!=''){
			alert('Attenzione!!!Riscontrati i seguenti errori:\n\n' + err)
		}else{
			invia('wiki_inserimento');
		}
	}
}