function getItems() {
// only if req shows "loaded"
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
document.getElementById('fe_items').innerHTML="";
var response = req.responseXML;
//Get the xml root
var root = response.getElementsByTagName("items")[0];
var items = root.getElementsByTagName("item");
for(i=0;i<items.length;i++){
var iidp = items[i].getElementsByTagName("idp")[0].firstChild.nodeValue;
var ititle = items[i].getElementsByTagName("title")[0].firstChild.nodeValue;
var iprice = items[i].getElementsByTagName("price")[0].firstChild.nodeValue;
var ipicture = items[i].getElementsByTagName("picture")[0].firstChild.nodeValue;
var iservices = items[i].getElementsByTagName("services")[0].firstChild.nodeValue;
var icounter = items[i].getElementsByTagName("counter")[0].firstChild.nodeValue;
var iincome = items[i].getElementsByTagName("income")[0].firstChild.nodeValue;
var item = document.createElement("table");
item.className = "tabitem";
item.onclick = new Function("addItem(\""+iidp+"\",\""+ititle+"\",\""+iprice+"\",\""+ipicture+"\",\""+iservices+"\",\""+icounter+"\",\""+iincome+"\");");
var tbitem = document.createElement("tbody");
item.appendChild(tbitem);
var row1 = document.createElement("tr");
var row2 = document.createElement("tr");
tbitem.appendChild(row1);
tbitem.appendChild(row2);
var cell1 = document.createElement("td");
var cell2 = document.createElement("td");
row1.appendChild(cell1);
row2.appendChild(cell2);
im1 = document.createElement("img");
im1.setAttribute("src",ipicture);
cell1.appendChild(im1);
cell2.innerHTML = ititle;
document.getElementById('fe_items').appendChild(item);
}
} else {
alert("There was a problem retrieving the XML data:\n" + req.statusText);
}
}
}