function AjaxRequest(cmd, data, callback, callbackdata, nocache) {
    var iframe = document.createElement('IFRAME');
    iframe.width="1";
    iframe.height="1";
    iframe.style.display="none";
    iframe.style.position="absolute";
    iframe.style.width="0px";
    iframe.style.height="0px";
    iframe.src="about:blank";
    document.body.appendChild(iframe);
    
    var url = "/ajaxserver.php?";
    url = url + "cmd=" + cmd + "&"
    url = url + "data=" + bin2hex(data);
    if(nocache != undefined)
        url = url + "&nocache=" + nocache;

    iframe.time = new Date();
    iframe.loading = true;
    iframe.callback = callback;
    iframe.callbackdata = callbackdata;
    iframe.cmd = cmd;
    iframe.data = data;
    iframe.onload = AjaxLoaded;
    iframe.onreadystatechange = AjaxLoaded;
    iframe.src = url+'&time='+(new Date).getTime();

}

function AjaxLoaded(e) {
    
    if(!e)
        e = window.event;
    
    if(this.readyState && this.readyState != "complete")
        return false;
    
    var objE = new Object();
    objE.returnData = this.contentWindow.document.body.innerHTML; 
    objE.requestTime = this.time;
    objE.responseTime = new Date();
    objE.requestCommand = this.cmd;
    objE.requestData = this.data;
    
    this.callback(objE, this.callbackdata);
    
    this.onload = null;
    this.onreadystatechange = null;    
    this.contentWindow.location.href = "about:blank";
    
    document.body.removeChild(this);
    return true;
}
