function makeDivs(node){

  if(node.nodeName=="item"){

        var divTd=document.getElementById("divs");
        
        var id=node.attributes.getNamedItem("id").nodeValue;
        iconURL="images/icons/"+node.attributes.getNamedItem("icon").nodeValue;
        title=node.attributes.getNamedItem(selectedLanguage+"title").nodeValue;
        date=node.attributes.getNamedItem("date").nodeValue;
        writer=node.attributes.getNamedItem("writer").nodeValue;
        
        var titlediv=document.createElement("div");
        titlediv.width="100%";
        titlediv.className="header";
        
        var iconImage=new Image();
        iconImage.src=iconURL;
        iconImage.height="16";
        
        var span=document.createElement("span");
        span.appendChild(iconImage);
        span.appendChild(document.createTextNode(" "+title));
        span.className="header";
        titlediv.appendChild(span);
        
        var contentdiv=document.createElement("div");
        contentdiv.id="contentdiv."+id;
        
        var a=document.createElement("a");                         
		//a.href=baseUrlFromMenuId(menuId)+"/comment."+id+".html"
		a.href=getContextURL("index.html")+"/comment.html?xmlFileName="+baseUrlFromMenuId(menuId)+"/comment."+id+".xml";
		a.target="_blank";
		a.onclick=function(event){
				window.open(getContextURL("index.html")+"/comment.html?xmlFileName="+baseUrlFromMenuId(menuId)+"/comment."+id+".xml",'Comments','resizable, scrollbars, width=800, height=300');
		        return false;
		}
		a.appendChild(document.createTextNode("    comments"));
        
        
        var footerdiv=document.createElement("div");
        footerdiv.className="footer";
 	    footerdiv.appendChild(document.createTextNode(writer+" / "+date));
        footerdiv.appendChild(a);
 
 		divTd.appendChild(titlediv);
 		divTd.appendChild(contentdiv);
 		divTd.appendChild(footerdiv); 
 		
        url=baseUrlFromMenuId(menuId)+"/div."+id+"."+selectedLanguage+".html";

        load(url,makeDivContent,true);
  }
}

function clearDivs(){
	var divTd=document.getElementById("divs");

	while(divTd.firstChild){
		divTd.removeChild(divTd.firstChild);
	}
}

function makeDivContent(node,URL){
  document.getElementById("contentdiv."+URL.substr(URL.lastIndexOf("/div.")+5,1)).innerHTML=node.responseText;
}