function ahah(url, target) {
    document.getElementById(target).innerHTML = ' Please wait...';
    if (window.XMLHttpRequest) {
	req = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
    }

    if (req != undefined) {
	req.onreadystatechange = function() {ahahDone(url, target);};
	req.open("GET", url, true);
	req.send("");
    }
}

function ahahDone(url, target) {
    if (req.readyState == 4) { // only if req is "loaded"
        if (req.status == 200) { // only if "OK"
	    var str = req.responseText;
	    var new_str = "<table width=100% border=1 cellspacing=0 cellpadding=2><tr><td class=heading2>Apartment</td><td class=heading2>Total floorage /square metre/</td><td class=heading2>Estimated price /Euro &#8364;/</td><td class=heading2>Price for a square metre /Euro &#8364;/</td></tr>";
	    var info = str.split("\n");
    for (i=0;i<info.length;i++)	{
	new_str += "<tr>";
	var info2 = info[i].split(",");
	for (j=0;j<info2.length;j++) {
	    new_str += "<td><div align=center>";
	    new_str += info2[j];
	    new_str += "</div></td>";
	}
	new_str += "</tr>";
    }
    new_str += "</table>";
    document.getElementById(target).innerHTML = new_str;
	    } else {
	 document.getElementById(target).innerHTML="Error:\n"+ req.status + "\n" +req.statusText;
	}
    }
}

function load(name, div) {
    ahah(name,div);
    return false;
}

