function invia_email(destinatario) {
// 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   
   //encodeURIComponent( document.getElementById("destinatario").value )
    var dati_post = "mittente=" + encodeURIComponent( document.getElementById("mittente").value ) + "&destinatario=" + destinatario + "&oggetto=" + encodeURIComponent( document.getElementById("oggetto").value ) +"&testo_email=" + encodeURIComponent( document.getElementById("testo_email").value );    
    http_req.open('GET', 'new/inc/sendEmail.asp?' + dati_post, true);   
    http_req.onreadystatechange = gestisci_risposta;
	http_req.send(null);
  
   
// recupero e gestisco la risposta inviata dal server   
function gestisci_risposta() {   
    if(http_req.readyState == 4) {   
        var esito = http_req.responseText;
        document.getElementById('contCanale_sx').innerHTML="<br /><br /><p align=\"center\"><b><a style=\"text-decoration:none;color:#ffffff\" href=\"javascript:void(0)\" onclick=\"contatto('email','"+document.getElementById("mittente").value+"','"+destinatario+"')\">"+esito+"</a></b></p>";

   
}  
}
}
var risposta=0;
function invia_msg(destinatario,risposta) {
// 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   
   //alert(document.getElementById("destinatario").value);document.getElementById("destinatario").value
    var dati_post = "mittente=" + document.getElementById("mittente").value + "&destinatario=" + destinatario + "&oggetto=messaggio privato da ABIBEX.COM&testo_email=" + document.getElementById("testo_email").value;    
    http_req.open('GET', 'new/inc/sendMessaggio.asp?' + dati_post, true);   
    http_req.onreadystatechange = gestisci_risposta;
	http_req.send(null);
  
   
// recupero e gestisco la risposta inviata dal server   
function gestisci_risposta() {   
    if(http_req.readyState == 4) {   

if(risposta==1){

document.getElementById('imgInvia').style.display="none";
document.getElementById('testo_email').value=" ------------ \n Risposta inviata corretamente. \n --------------";}

else
{
        var esito = http_req.responseText;
        document.getElementById('contCanale_sx').innerHTML="<br /><br /><p align=\"center\"><b><a style=\"text-decoration:none;color:#ffffff\" href=\"javascript:void(0)\" onclick=\"contatto('pvt','"+document.getElementById("mittente").value+"','"+destinatario+"')\">"+esito+"</a></b></p>";
}
   
}  
}
}