
function multiLoad(idbase,url,start,tmout,delay) {
    new ajax(url+escape(start)+(tmout?'&timeout='+tmout:''),{onComplete:function(req) {
	var div = document.createElement('div');
	div.innerHTML=req.responseText;
	var parent=null;
	var ins=null;
	var ct=0;
	var pending=0;
	var newstart=null;
	var first = null;
	var last = null;
	var fvert=null;
	var nextp=div.firstChild;
	while (1) {
	    var p = nextp;
	    nextp = p && p.nextSibling;
	    if (p && p.id=='multiLoadProgress') {
		var pp = $('multiLoadProgress');
		if (pp) {
		    var pn = pp.nextSiblimg;
		    var pr = pp.parentNode;
		    pr.removeChild(pp);
		    pr.insertBefore(p,pn);
		}
		continue;
	    }
	    if (!p || p.tagName) {
		var r = $(idbase+(++ct));
		if (r) {
		    parent=r.parentNode;
		    ins=r.nextSibling;
		    if (!last) for (last=r.previousSibling;last && !last.tagName;last=last.previousSibling);
		    if (last) {
			if (fvert==null) fvert=last.offsetTop!=r.offsetTop;
			if (!first) first=last;
		    }
		    if (p && p.style.position=='absolute') {
			p.style.top = r.style.top;
			p.style.left = r.style.left;
		    }
		    parent.removeChild(r);
		    if (p) first=p;
		} else {
		    if (p && p.style.position=='absolute' && last) {
			p.style.top = (last.offsetTop+(fvert?last.offsetHeight:0))+'px';
			p.style.left = (last.offsetLeft+(fvert?0:last.offsetWidth))+'px';
//		alert('='+p.style.top+' '+p.style.left);
		    }
		}
		if (!p) {
		    if (r) continue; else break;
		}
		parent.insertBefore(p,ins);
		last = p;
		if (p.id && p.id.substr(0,idbase.length)==idbase) {
		    pending++;
		    if (newstart==null) {
			var st = p.getAttribute('newstart');
			if (st!=null) newstart=st;
		    }
		}
	    }
	}
	if (first && first.style.position=='absolute') {
	    for (p=parent.firstChild;p;p=p.nextSibling) if (p.tagName) {
		if (p.offsetTop<=first.offsetTop && p.offsetLeft<=first.offsetLeft) break;
		p.style.top = (last.offsetTop+(fvert?last.offsetHeight:0))+'px';
		p.style.left = (last.offsetLeft+(fvert?0:last.offsetWidth))+'px';
//		alert(p.offsetLeft+' '+p.offsetTop);
		last = p;
	    }
	}
	if (newstart==null && pending) newstart=start+ct-pending;
	if (newstart!=null) window.setTimeout(function() {
	    multiLoad(idbase,url,newstart,tmout?tmout+1:null,delay);
	},delay?delay*100:100);
    }});
};

