// get xml
// loop though build nav
// showData

var xmlHttp;
var showFirst;


var url = '/index.php?id=5'


function makeMenu(id){ 
	
	var url = id;
	
	xmlHttp = GetXmlHttpObject();
	if (xmlHttp==null) {
	  alert ("Your browser does not support AJAX!");
	  return;
	  }
	xmlHttp.onreadystatechange = onResponse;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function onResponse(){
	if(xmlHttp.readyState!=4) return;
	if(xmlHttp.status!=200) {
		alert("Problem retrieving XML data");
		return;
	  } 
	  
	  
	alert(xRecords = xmlHttp.responseXML.firstChild.tagName)
	//$('contentBlok').update(xmlHttp.responseXML.firstChild.textContent) 
	$('contentBlok').innerHTML = unescape(xmlHttp.responseXML.firstChild.textContent);
	
	//xRecords = xmlHttp.responseXML.documentElement.getElementsByTagName("content")[0].firstChild.nodeValue;

	/*for (i=0;i<xRecords.length;i++){
	 	xx=xRecords[i].getElementsByTagName("naam");  	   
		var l = u.appendChild(document.createElement('li'));
		var a = new Element('a',{'id': 'subBtn'+i,'class':'deleteButton',href:'#',onclick:'showEvent(this); return false','title':xx[0].firstChild.nodeValue});
		a.onclick = function() { showEvent(this); return false; };
		l.appendChild(a);
		a.appendChild(document.createTextNode( xx[0].firstChild.nodeValue));
	}		*/	 
	//alert(xRecords)
	//showPage(0)
}

//===============================
function showPage(id){
	var data  = xmlHttp.responseXML.documentElement.getElementsByTagName("content");
	alert(data.nodeValue)
	var content = data[id].getElementsByTagName("content")[0].textContent;
	if(content==undefined){
		var content = data[id].getElementsByTagName("content")[0].firstChild.nodeValue;
		}
	$('contentBlok').update() = unescape(content);
	selectMenu(id);	
	}
//===================================

//===============================	
function GetXmlHttpObject(){
	var xmlHttp=null;
	try	{
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  }
	catch (e) {
	  // Internet Explorer
	  try{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	  catch (e)	{
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	  }
	return xmlHttp;
}



