seregarem, ам!
function makeKiosk(tp, p) {
if (request.readyState == 4) if (request.status == 200) {
xmlDoc = request.responseXML.documentElement;
action = xmlDoc.getElementsByTagName("action")[0].firstChild.data;
kiosk = xmlDoc.getElementsByTagName("kiosk")[0].firstChild.data;
pages = xmlDoc.getElementsByTagName("pages")[0].firstChild.data;
var tk = document.getElementById(tp);
while (tk.firstChild) tk.removeChild(tk.firstChild);
if (action == "ok") {
var el = document.createElement("div");
el.innerHTML = "<table >" + kiosk + "</table>";
while (el.firstChild.rows[0]) tk.appendChild(el.firstChild.rows[0]);
document.getElementById(p).innerHTML = pages;
$("a.fancybox").fancybox({
"transitionIn": "elastic",
"transitionOut": "elastic"
})
}
} else alert("Не удалось получить данные от сервера:\n" + request.statusText)
};
и выкиньте $res = '<![CDATA[';
$pages.=']]>';