<!--
function reg(form) {
stringau = form.usr.value;
stringap = form.pass.value;
espressione = /^[a-zA-Z0-9]+$/;

if (form.usr.value == "") {alert("Devi inserire un Username."); form.usr.focus();  return false;}

else if(form.pass.value == "") {alert("Inserisci una password."); form.pass.focus(); return false;}

else if(!espressione.test(stringau)) {alert("L'username può contenere solo caratteri alfanumerici e non può contenere spazi."); form.usr.focus(); return false;}

else if(!espressione.test(stringap)) {alert("La password può contenere solo caratteri alfanumerici e non può contenere spazi."); form.pass.focus(); return false;}

else {form.action = "createst.php";  form.submit();}
  }

function log(form) {
stringau = form.usr.value;
stringap = form.pass.value;
espressione = /^[a-zA-Z0-9\.\-]+$/;
if ( (form.usr.value == "") ) { alert("Devi inserire un Username."); 	form.usr.focus();  return false; }

else if ((form.pass.value == "")){ alert("Inserisci una password."); form.pass.focus(); return false;}

else
form.submit();
  }

function comm(form) {
espressione1 = /^[a-zA-Z0-9]+$/;
espressione2 = /^([:/~a-zA-Z0-9_\-\.]+)\.([:/~a-zA-Z0-9])/;
espressione3 = /^[a-z0-9][_\.a-z0-9-]+@([a-z0-9][0-9a-z-]+\.)+([a-z]{2,4})/;
if (form.nome.value == "") { alert("Inserisci un nome."); form.nome.focus();  return false; }
else if (form.nome.value != "" && !espressione1.test(form.nome.value)){ alert("Il nome può contenere solo caratteri alfanumerici."); form.nome.focus(); return false;}
else if (form.email.value != "" && !espressione3.test(form.email.value)){ alert("Inserisci un email valida."); form.email.focus(); return false;}
else if (form.messaggio.value == ""){ alert("Scrivi qualcosa no?"); form.messaggio.focus(); return false;}
else if (form.userdigit.value == ""){ alert("Insericsi il codice di sicurezza."); form.userdigit.focus(); return false;}

else
form.action = "";
form.submit();
}
function test(form) {
if ( (form.tit.value == "") )
	 { alert("Devi inserire un titolo per il test."); 	form.tit.focus();  return false; }

else if ((form.d1.value == "")){ alert("Inserisci almeno una domanda."); form.d1.focus(); return false;}

else
form.action = "script/crea.php";
form.submit();
  }

function testvf(form) {
if ( (form.tit.value == "") )
	 { alert("Devi inserire un titolo per il test."); 	form.tit.focus();  return false; }

else if ((form.a1.value == "")){ alert("Inserisci almeno una affermazione."); form.a1.focus(); return false;}

else
form.action = "script/crea.php";
form.submit();
  }

function testsond(form) {
if ( (form.tit.value == "") )
	 { alert("Devi inserire un titolo per il sondaggio."); 	form.tit.focus();  return false; }

else if ((form.o1.value == "")){ alert("Inserisci almeno un'opzione."); form.o1.focus(); return false;}

else
form.action = "script/crea.php";
form.submit();
  }

function visualizza(id){
if (document.getElementById){
if(document.getElementById(id).style.display == 'none'){
document.getElementById(id).style.display = 'block';
} else {
document.getElementById(id).style.display = 'none';
}
}
}

function subformtest(){
alert('Hai impiegato molto tempo per creare il tuo test. Questo può causare la perdita di ciò che hai scritto. Ora verrà salvato e reso invisibile, e potrai modificarlo recandoti in "Gestisci il tuo test".')
document.formtest.prpu.value = "inv";
document.formtest.action = "script/crea.php";
document.formtest.submit();
}

function subformtestm(){
alert('Hai impiegato molto tempo per creare il tuo test. Questo può causare la perdita di ciò che hai scritto. Ora il test verrà salvato e sarà ricaricata la pagina. Così continuerai le tue modifiche. Per qualsiasi informazione contattare il webmaster.')
document.formtest.action = "";
document.formtest.submit();
}

function out(id,idiv){
if(!document.getElementById(id).checked){
document.getElementById(idiv).style.backgroundColor='#ffffff';
}
}

function radio(){
for (i=1; i<6; i++) {
id="risp"+i;
idiv="r"+i;
if(!document.getElementById(id).checked){
document.getElementById(idiv).style.backgroundColor='#ffffff';
}
}
}

function testati(form) {
if (form.n.value == "") { alert("Devi inserire un nick."); 	form.n.focus();  return false; }

else
form.submit();
  }

function rrandom(colore){
for (j=1; j<=5; j++) {
idr="r"+j;
if(document.getElementById(idr)){
document.getElementById(idr).className="rispoff";}
}
r=Math.floor(Math.random()*6);
idiv="r"+r;
document.getElementById(idiv).className="rispon";
document.getElementById('risposta').value=r;
}

function del() {
if(confirm('ATTENZIONE: Eliminando il test non sarà più possibile recuperarlo.')){
return true}
else return false
}

function apass(form) {
var x=document.getElementById("prpu");
if(x.selectedIndex=='3'){document.getElementById('text').style.display ='block'; form.pro.focus();}
else document.getElementById('text').style.display ='none';
}

function aa(val){
for (j=1; j<=5; j++) {
idr="r"+j;
if(document.getElementById(idr)){
document.getElementById(idr).className="rispoff";}
}
idr="r"+val;
document.getElementById(idr).className="rispon";
document.getElementById('risposta').value=val;
}

function vftest(vf,n){
idv="v"+n;
idf="f"+n;
idvf=vf+n;

document.getElementById(idv).className="rispoff_vf";
document.getElementById(idf).className="rispoff_vf";
document.getElementById(idvf).className="rispon_vf";

idr="risposta"+n;
document.getElementById(idr).value=vf;
}

function sondaggio(val){
for (j=1; j<=20; j++) {
ido="o"+j;
if(document.getElementById(ido)){
document.getElementById(ido).className="rispoff";}
}
ido="o"+val;
document.getElementById(ido).className="rispon_sond";
document.getElementById('opzione').value=val;
}

function domaperta(numero){
var dom='Domanda aperta';
eval("document.formtest.r1_d" + numero + ".value = dom");
}

//-->