var requestCount; var loadingImage; function onLoad() { requestCount = 0; loadingImage = document.getElementById("loadingImage"); } function changeDisplay(idname, type) { document.getElementById(idname).style.display = type; } function lang(key) { return document.getElementById(key).title; } function isArray(obj) { return obj.constructor == Array; } function changeTokenType(el) { document.getElementById("clearLink").focus(); switch(el.selectedIndex) { case 1: document.getElementById("tokentype0").style.display = "block"; document.getElementById("tokentype1").style.display = "none"; document.getElementById("tokenAddSubmit").disabled = false; break; case 2: document.getElementById("tokentype0").style.display = "none"; document.getElementById("tokentype1").style.display = "block"; document.getElementById("tokenAddSubmit").disabled = false; break; default: document.getElementById("tokentype0").style.display = "none"; document.getElementById("tokentype1").style.display = "none"; document.getElementById("tokenAddSubmit").disabled = true; } } function setvserverstate(action) { document.getElementById("clearLink").focus(); if( action.toUpperCase() != "START" && action.toUpperCase() != "STOP" ) return; var vserver = document.getElementsByName("vserver"); var sid = 0; for(var i=0; i 0 ) { loadingImage.style.visibility = "visible"; } else { loadingImage.style.visibility = "hidden"; } setTimeout("window.location.href=window.location.href;",500); } // class function Ajax() { this.url = ""; this.params = ""; this.method = "GET"; this.onSuccess = null; this.onError = function(msg) { alert(msg); } } Ajax.prototype.doRequest = function() { if( !this.url ) { this.onError("There was no URL. The request will be aborted."); return false; } if( !this.method ) { this.method = "GET"; } else { this.method = this.method.toUpperCase(); } var _this = this; var xmlHttpRequest = getXMLHttpRequest(); if( !xmlHttpRequest ) { this.onError("There was no XMLHttpRequest object can be created."); return false; } switch(this.method) { case "GET": xmlHttpRequest.open(this.method, this.url+"?"+this.params, true); xmlHttpRequest.onreadystatechange = readyStateHandler; xmlHttpRequest.send(null); break; case "POST": xmlHttpRequest.open(this.method, this.url, true); xmlHttpRequest.onreadystatechange = readyStateHandler; xmlHttpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xmlHttpRequest.send(this.params); break; } function readyStateHandler() { if( xmlHttpRequest.readyState < 4 ) { return false; } if( xmlHttpRequest.status == 200 || xmlHttpRequest.status == 304 ) { if(_this.onSuccess) { _this.onSuccess(xmlHttpRequest.responseText, xmlHttpRequest.responseXML); } } else { if(_this.onError) { _this.onError("["+xmlHttpRequest.status+" "+xmlHttpRequest.statusText+"] There was an error in data transmission."); } } } } // returns XMLHttpRequest object function getXMLHttpRequest() { if(window.XMLHttpRequest) { // for firefox, opera, etc... return new XMLHttpRequest(); } else { if(window.ActiveXObject) { try { // new for ie return new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { // old for ie return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { return null; } } } } return null; }