//Process XML xajaxResponses returned from the request
this.processResponse = function(xml)
{
if (xajaxStatusMessages == true) window.status = 'Processing...';
var tmpXajax = null;
xml = xml.documentElement;
if (xml == null) {
alert("Error: the XML response that was returned from the server cannot be processed.");
document.body.style.cursor = 'default';
if (xajaxStatusMessages == true) window.status = 'XML response processing error';
return;
}
for (i=0; i<xml.childNodes.length; i++)
{
if (xml.childNodes[i].nodeName == "cmd")
{
var cmd;
var id;
var property;
var data;
var search;
var type;
var before;
for (j=0; j<xml.childNodes[i].attributes.length; j++)
{
if (xml.childNodes[i].attributes[j].name == "n")
{
cmd = xml.childNodes[i].attributes[j].value;
}
if (xml.childNodes[i].attributes[j].name == "t")
{
id = xml.childNodes[i].attributes[j].value;
}
if (xml.childNodes[i].attributes[j].name == "p")
{
property = xml.childNodes[i].attributes[j].value;
}
if (xml.childNodes[i].attributes[j].name == "c")
{
type = xml.childNodes[i].attributes[j].value;
}
}
if (xml.childNodes[i].childNodes.length > 1)
{
for (j=0; j<xml.childNodes[i].childNodes.length; j++)
{
if (xml.childNodes[i].childNodes[j].nodeName == "s")
{
if (xml.childNodes[i].childNodes[j].firstChild)
search = xml.childNodes[i].childNodes[j].firstChild.nodeValue;
}
if (xml.childNodes[i].childNodes[j].nodeName == "r")
{
if (xml.childNodes[i].childNodes[j].firstChild)
data = xml.childNodes[i].childNodes[j].firstChild.data;
}
}
}
else if (xml.childNodes[i].firstChild)
data = xml.childNodes[i].firstChild.nodeValue;
else
data = "";
var objElement = this.$(id);
try
{
if (cmd=="al")
{
alert(data);
}
if (cmd=="js")
{
eval(data);
}
if (cmd=="in")
{
this.include(data);
}
if (cmd=="as")
{
if (this.willChange(id,property,data))
{
eval("objElement."+property+"=data;");
}
}
if (cmd=="ap")
{
eval("objElement."+property+"+=data;");
}
if (cm*=="**")
{
eval("objElement."+property+"=data+objElement."+property);
}
if (cmd=="rp")
{
this.replace(id,property,search,data)
}
if (cmd=="rm")
{
this.remove(id);
}
if (cmd=="ce")
{
this.create(id,data,property);
}
if (cmd=="ie")
{
this.insert(id,data,property);
}
if (cmd=="ci")
{
this.createInput(id,type,data,property);
}
if (cmd=="ii")
{
this.insertInput(id,type,data,property);
}
if (cmd=="ev")
{
eval("this.$('"+id+"')."+property+"= function(){"+data+";}");
}
if (cmd=="ah")
{
this.addHandler(id, property, data);
}
if (cmd=="rh")
{
this.removeHandler(id, property, data);
}
}
catch(e)
{
alert(e);
}
delete objElement;
delete cmd;
delete id;
delete property;
delete search;
delete data;
delete type;
delete before;
}
}
delete xml;
document.body.style.cursor = 'default';
if (xajaxStatusMessages == true) window.status = 'Done';
}
}
var xajax = new Xajax();

