var AJAXOutput = null; function AJAX(input, funcToCall) { var http = null; if(window.XMLHttpRequest) http = new XMLHttpRequest(); else if (window.ActiveXObject) { var msxmlhttp = new Array( 'Msxml2.XMLHTTP.5.0', 'Msxml2.XMLHTTP.4.0', 'Msxml2.XMLHTTP.3.0', 'Msxml2.XMLHTTP', 'Microsoft.XMLHTTP'); for (var i = 0; i < msxmlhttp.length; i++) { try { http = new ActiveXObject(msxmlhttp[i]); } catch (e) { http = null; } } } http.onreadystatechange = function() { if(http.readyState == 4) { if(http.status == 200) AJAXOutput = http.responseText; else AJAXOutput = null; if (AJAXOutput != null) { if (funcToCall == null) return; else if (funcToCall.indexOf('(') == -1) eval(funcToCall + '()'); //alert(funcToCall + '()'); else eval(funcToCall); //alert(funcToCall); } } }; http.open("GET", input, true); http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); http.send(null); }