
function ajax_loadContent(strURL, target, field_id) {
	if (!target)
		alert('No container for ajax content.');

    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){
	        if (self.xmlHttpReq.readyState == 4) {
	            updatepage(target, self.xmlHttpReq.responseText);
            }
        }
    }
    if (field_id)
	    self.xmlHttpReq.send(getquerystring(field_id));
	else
		self.xmlHttpReq.send();

}

function getquerystring(field_id) {

    var word = document.getElementById(field_id).value;
    qstr = 'value=' + escape(word);  // NOTE: no '?' before querystring
    return qstr;
}

function updatepage(target, str){
    document.getElementById(target).innerHTML = str;
    document.getElementById(target).value = str;
}

