var PrStyle;
function colle(obj, NwStyle, NrStyle){
	PrStyle = obj.className;
	obj.className = NwStyle;
	PrSelection = obj;
	return;
}
function stampa(){
	parent.window.print();
}
function popup(indirizzo,larg,alte){
	var win = window.open(indirizzo,"popup","width="+larg+", height="+alte+", top=20, left=20");
	win.focus();
}
function ridimensiona(){
	window.resizeTo(larg,alte);
}
function contraut(){
	if (document.modulo.controllo.checked == true){
		document.modulo.autorizzazione.value='si';
	}else{
		document.modulo.autorizzazione.value='no';
	}
}
function mod() {
     // Variabili associate ai campi del modulo
     var nome = document.modulo.nome.value;
     var cognome = document.modulo.cognome.value;
     var citta = document.modulo.citta.value;
     var email = document.modulo.email.value;
     var username = document.modulo.username.value;
     var password = document.modulo.password.value;
     var cfrpassword = document.modulo.cfrpassword.value;
     var autorizzazione = document.modulo.autorizzazione.value;
     // Espressione regolare dell'email
     var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
        //Effettua il controllo sul campo NOME
        if ((nome == "") || (nome == "undefined")) {
           alert("Il campo Nome è obbligatorio.");
           document.modulo.nome.focus();
           return false;
        }
        //Effettua il controllo sul campo COGNOME
        else if ((cognome == "") || (cognome == "undefined")) {
           alert("Il campo Cognome è obbligatorio.");
           document.modulo.cognome.focus();
           return false;
        }
        //Effettua il controllo sul campo EMAIL
        else if (!email_reg_exp.test(email) || (email == "") || (email == "undefined")) {
           alert("Inserire un indirizzo email corretto.");
           document.modulo.email.focus();
           return false;
        }
        //Effettua il controllo sul campo citta
        else if ((citta == "") || (citta == "undefined")) {
           alert("Il campo città è obbligatorio.");
           document.modulo.citta.focus();
           return false;
        }
        //Effettua il controllo sul campo username
        else if ((username == "") || (username == "undefined")) {
           alert("Inserire un nome utente corretto.");
           document.modulo.username.focus();
           return false;
        }
        //Effettua il controllo sul campo password
        else if ((password == "") || (password == "undefined")) {
           alert("Inserire una password corretta.");
           document.modulo.password.focus();
           return false;
        }
        //Effettua il controllo sul campo cfrpassword
        else if (password != cfrpassword) {
           alert("Verificare la corrispondenza della\npassword con il compo di conferma password.");
           document.modulo.cfrpassword.focus();
           return false;
        }
        //Effettua il controllo sul checkbox
        else if (autorizzazione == "no"){
          alert("Perché l'invio dei dati vada a buon fine\nè necessario autorizzare il trattamento dei dati personali\nspuntando la casella di controllo.");
          document.modulo.controllo.focus();
          return false;
        }
        //INVIA IL MODULO
        else {
           document.modulo.action = "register.php";
           document.modulo.submit();
           return true;
        }
}
function artisti(ind){
	var win=window.open(ind,'new','width=600, height=600');
	win.focus();
}
