function makeDiv(request){
    var ele = request.responseXML.documentElement;
	
	var id = ele.getAttribute("id");
	id = id.substr(2);
	
    var f = document.getElementById("id_"+id);
    
	ele = importNode(ele,true);
	var n = f.appendChild(ele);
  
}



function nameSubmit(id) {
    
    makeSelected(id);
	new ajax (webrootLang + '/_ajax/glossar/div_'+id+'.html', {
	method: 'get', 
    onComplete: makeDiv
    });
    
    return false;
}

function closeGlossar(id) {
	var f = document.getElementById("i_"+id);
	if (f) {
		f.parentNode.firstChild.className = '';
		f.parentNode.firstChild.onclick = function() {return nameSubmit(id)};
		f.parentNode.removeChild(f);
	}
	
	return false;
}

function makeSelected(id) {
	var f = document.getElementById("id_"+id);
    f.firstChild.className = 'selected';
	f.firstChild.onclick = function() {return closeGlossar(id)};
	
}
