

instXML = new Array();

function AjaxCall(Url, iProcessType, sId, iID) {  
	
	
	try {
		instXML [iID] = new ActiveXObject("Msxml2.XMLHTTP");
	} catch(e) {
		try {
			instXML [iID] = new ActiveXObject("Microsoft.XMLHTTP");
		} catch(oc) {
			instXML [iID] = null  // No XML Available  
	 	}  
	 }  

	if(!instXML [iID] && typeof XMLHttpRequest != "undefined") {
		instXML [iID] = new XMLHttpRequest() ;
	}  	
	
	
	if (instXML[iID]) {  
	 	Url = Url + '&XML=1'; // Mark this as an XML call  
	 	instXML[iID].open("GET", Url,true); 
		instXML[iID].onreadystatechange = function () {  
			if (instXML[iID].readyState==4) {   
				switch (iProcessType) {
					case 1:
						try {
							eval(instXML[iID].responseText);
						} catch(e) {
							alert('Kan response niet evalueren: \n\n'+instXML[iID].responseText);
						}  
					
					  break;

				}
			}  
		}  
		instXML[iID].send(null);  
		return true;
		
	 }  else  {   
		alert('AJAX fout: kan geen xml object aanmaken.');
	 }  
	 
	 
//  	instXML[iID] = null;
}  

function doAjaxCall (url, type, element, iid) {
	tempURL = url+'&uniqid='+Math.random()*10000000;
	setTimeout ("AjaxCall ('"+tempURL+"', "+type+", '"+element+"', '"+iid+"');", 500);

}

function doAjaxCall_Now (url, type, element, iid) {
	tempURL = url+'&uniqid='+Math.random()*10000000;
	AjaxCall (tempURL, type, element, iid);
	
}



