// crea l'oggetto per la comunicazione AJAX con il server   
// compatibile con tutti i browser che supportano AJAX   
function crea_http_req() {   
    var req = false;   
    if (typeof XMLHttpRequest != "undefined")   
        req = new XMLHttpRequest();   
    if (!req && typeof ActiveXObject != "undefined") {   
        try {   
            req=new ActiveXObject("Msxml2.XMLHTTP");   
        } catch (e1) {   
            try {   
                req=new ActiveXObject("Microsoft.XMLHTTP");   
            } catch (e2) {   
                try {   
                    req=new ActiveXObject("Msxml2.XMLHTTP.4.0");   
                } catch (e3) {   
                    req=null;   
                }   
            }   
        }   
    }   
  
    if(!req && window.createRequest)   
        req = window.createRequest();   
  
    if (!req) alert("Il browser non supporta AJAX");   
  
    return req;   
}   
  
// l'oggetto per comunicare con il server   
var http_req = crea_http_req();

   
var http_req = crea_http_req();   
// invia i dati del form al server   
function invia_dati_nuovoUtente() {   
    var dati_post = "email=" + encodeURIComponent( document.getElementById("email").value ) + "&sesso=" + encodeURIComponent( document.getElementById("sesso").value ) + "&username1=" + encodeURIComponent( document.getElementById("username1").value ) + "&password1=" + encodeURIComponent( document.getElementById("password1").value );    
    http_req.open('GET', 'new/inc/preIscrizione.asp?' + dati_post, true);   
    http_req.onreadystatechange = gestisci_risposta1;
	http_req.send(null);
  
}   
// recupero e gestisco la risposta inviata dal server   
function gestisci_risposta1() {   
    if(http_req.readyState == 4) {   
        var esito = http_req.responseText; 
        
 if (esito==0){ 
window.alert('ATTENZIONE!!! NickName scelto gia\' in uso');
 }
  
if (esito==2){ 
window.alert('ATENZIONE!!! Il moduolo di iscrizione va compilato in tutti i campi.');
 }
 if (esito==3){ 
window.alert('ATTENZIONE!!! Indirizzo E-Mail gia\' in uso');
 }

if(esito==4){
document.getElementById('email').value='';
document.getElementById('username1').value='';
document.getElementById('password1').value='';
window.alert(' Iscrizione effettuata con successo.\n ATTENZIONE!!!!!, questa iscrizione ti permettera\' \n di accedere  al sito per un periodo di tempo limitato. Per rendere questa iscrizione \n permanente ti invito a seguire con attenzione i passi riportati \n nella e-mail che riceverai allindirizzo che hai utilizzato nel modulo. \n Grazie.');
}
}  
}