var lajax={}; var __count__ = 0; lajax.getXmlHttp = function(){ var xmlHttp = null; try { xmlHttp = new XMLHttpRequest(); } catch (e) { var progIds = ['MSXML2.XMLHTTP', 'Microsoft.XMLHTTP', 'MSXML2.XMLHTTP.5.0', 'MSXML2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0']; var success = false; for (var iterator = 0; (iterator < progIds.length) && (!success); iterator++) { try { xmlHttp = new ActiveXObject(progIds[iterator]); success = true; } catch (e) { } } if (!success) { return null; } } return xmlHttp; }; lajax.sendRequest = function(method,url,requestData,callBack) { var xmlHttp = lajax.getXmlHttp(); xmlHttp.open(method,url,true); if (method=="POST") xmlHttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4) { if (xmlHttp.status == 200) { callBack(xmlHttp); } } } if (method=="POST") xmlHttp.send(requestData); else xmlHttp.send(null); } lajax.loadJS = function(jsPath, callBack) { var _callBack = function(xmlHttp) { __count__++; _includeJS("js" + __count__, xmlHttp.responseText); callBack(); } lajax.sendRequest('GET',jsPath, null, _callBack); } function _includeJS(sId, source) { if (( source != null ) && (!document.getElementById(sId))){ var oHead = document.getElementsByTagName('HEAD').item(0); var oScript = document.createElement( "script" ); oScript.language = "javascript"; oScript.type = "text/javascript"; oScript.id = sId; oScript.defer = true; oScript.text = source; oHead.appendChild(oScript); } }