hi, i tweaked xhr.js a bit below. interface to rest of kaMap is unchanged. might be cvs worthy.<br>
<br>
'garbage collection' for aXmlHttp via splicing. <br>
closure returned from XmlHttpGen means the ActiveX/xmlttprequest test is performed only on page load. <br>
<br>
may be __slight__ performance gains from the closure. <br>
<br>
// XMLhttpRequest stuff<br>
var aXmlHttp = new Array();<br>
function xmlResult() <br>
{<br>
for(var i=0;i<aXmlHttp.length;i++)<br>
{<br>
if(aXmlHttp[i][0] &&
aXmlHttp[i][0].readyState==4&&aXmlHttp[i][0].responseText)<br>
{<br>
var f = aXmlHttp[i][2];<br>
var o = aXmlHttp[i][1];<br>
var s = aXmlHttp[i][0].responseText;<br>
aXmlHttp.splice(i--,1);<br>
f.apply(o,[s]);<br>
}<br>
}<br>
// return aXmlHttp.length;<br>
}<br>
<br>
// u -> url<br>
// o -> object (can be null) to invoke function on<br>
// f -> callback function<br>
// p -> optional argument to specify POST<br>
function call(u,o,f)<br>
{<br>
var method = "GET";<br>
var dat;<br>
if (arguments.length==4){<br>
method = "POST";<br>
tmp = u.split(/\?/);<br>
u = tmp[0];<br>
dat = tmp[1];<br>
<br>
}<br>
var idx = aXmlHttp.length;<br>
aXmlHttp[idx]=new Array(2);<br>
aXmlHttp[idx][0] = getXMLHTTP();<br>
<br>
aXmlHttp[idx][1] = o;<br>
aXmlHttp[idx][2] = f;<br>
if(aXmlHttp[idx])<br>
{<br>
aXmlHttp[idx][0].open(method,u,true);<br>
if(method == "POST"){<br>
aXmlHttp[idx][0].setRequestHeader("Content-Type",
"application/x-www-form-urlencoded");<br>
<br>
aXmlHttp[idx][0].send(dat);<br>
}<br>
aXmlHttp[idx][0].onreadystatechange=xmlResult;<br>
<br>
if(method =="GET"){ aXmlHttp[idx][0].send(null);}<br>
}<br>
}<br>
<br>
<br>
getXMLHTTP = xmlHttpGen();<br>
<br>
<br>
function xmlHttpGen()<br>
{<br>
if(typeof XMLHttpRequest != "undefined")<br>
{<br>
return function(){return new XMLHttpRequest();}<br>
}<br>
var msv= ["Msxml2.XMLHTTP.7.0", "Msxml2.XMLHTTP.6.0",<br>
"Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0",<br>
"MSXML2.XMLHTTP", "Microsoft.XMLHTTP"];<br>
for(j=0;j<=msv.length;j++){<br>
<br>
try<br>
{<br>
A = new ActiveXObject(msv[j]);<br>
if(A){ <br>
return function(){return new ActiveXObject(msv[j]);}<br>
}<br>
}<br>
catch(e) { }<br>
}<br>
return false;<br>
}<br>
<br>