// ver. 1.0 Function.prototype.bind = function(object) { var __method = this; return function() { __method.apply(object, arguments); } } if (!Function.prototype.apply) { Function.prototype.apply = function(oScope, args) { var sarg = []; var rtrn, call; if (!oScope) oScope = window; if (!args) args = []; for (var i = 0; i < args.length; i++) { sarg[i] = "args["+i+"]"; } call = "oScope.__applyTemp__(" + sarg.join(",") + ");"; oScope.__applyTemp__ = this; rtrn = eval(call); return rtrn; } } function e3Ajax(){ this.debug = false; this.done = null; this.http_request = null; this.error = ""; this.cache = false; this.load = function(uri,toDo,loading) { if (window.XMLHttpRequest) { // Mozilla, Safari,... this.http_request = new XMLHttpRequest(); if (this.http_request.overrideMimeType) { this.http_request.overrideMimeType('text/xml'); } } else if (window.ActiveXObject) { // IE try { this.http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { this.http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!this.http_request){ if(window.ActiveXObject) alert("Attivare gli ActiveX"); else alert("Verificare la versione del browser"); return false; } if (loading) loading(); this.done = toDo; this.http_request.onreadystatechange = this.onStateChange.bind(this); this.xmlDom = null; if (this.debug){ var winerr =window.open(uri,"winerr","width=400,height=200,resizable=yes,scrollbars=yes"); winerr.focus(); } if (this.cache){ this.http_request.open('GET', uri, true); }else{ var time = new Date(); var timeUri ; if (uri.indexOf("?")>-1){ timeUri = uri + "&ajaxCacheDate"+time.getTime(); }else{ timeUri = uri + "?ajaxCacheDate"+time.getTime(); } this.http_request.open('GET', timeUri, true); } this.http_request.send(null); }; this.onStateChange = function() { if(this.http_request.readyState!=4) return; var status=this.http_request.status; if ((status!=200)&&(status!=0)) { alert("errore di caricamento!\nstatus: "+status); return; } this.responseText = this.http_request.responseText; var objDom = new XMLDoc(this.responseText,this.errorFn); this.xmlDom = objDom.docNode this.done(this); } this.errorFn = function() { alert("errore di caricamento!"); return false; } }