function xmlhttpPost(strURL) {
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            updatepage(self.xmlHttpReq.responseText);
        }
    }
    self.xmlHttpReq.send(getquerystring());
}

//   The following function obtains two variables from your form (email and message) 
//   and builds a string that gets sent to your PHP script.  Change this function to
//   obtain whatever fields you want from your form.

function getquerystring() {
    var form     = document.forms['form1'];
    var email = form.email.value;
    var message = form.message.value;
	var toEmail = form.toEmail.value;
	var string = form.string.value;
    qstr = 'email=' + escape(email) + '&message=' + escape(message) + '&toEmail=' + escape(toEmail) + '&string=' + escape(string); 
    return qstr;
}

function updatepage(str){
    document.getElementById("result").innerHTML = str;
}
