function xmlhttpPostForm(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) {
            updateFormPage(self.xmlHttpReq.responseText);
        }
    }
    self.xmlHttpReq.send(getFormquerystring());
	updateFormPage('<div class="loading2"></div>');
	// switch div with a loading div
}

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

function getFormquerystring() {
    var form     = document.forms['comments'];
	var item_id = form.item_id.value;
    var comment_name = form.comment_name.value;
    var comment_email = form.comment_email.value;
	var comment_url = form.comment_url.value;
	var comment_data = form.comment_data.value;
	var string = form.string.value;
    qstr = 'item_id=' + escape(item_id) + '&comment_name=' + escape(comment_name) + '&comment_email=' + escape(comment_email) + '&comment_url=' + escape(comment_url) + '&comment_data=' + escape(comment_data) + '&string=' + escape(string); 
    return qstr;
}

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