function pageload(){
	gload();
}



function edit(){
	var editableContent = ReplaceTags(document.getElementById('description_content').innerHTML);
	
	document.getElementById('descriptionbox').innerHTML = "<form name='description' action='" +
	 window.location + "' method='POST'><TEXTAREA id='descarea' name='newdescription' style='font-size:11px;' rows='10' cols='45'>" +
	 editableContent +	 "</TEXTAREA><input type='hidden' name='PreviousDescriptionID' value='"+document.getElementById('description_content').getAttribute('PreviousDescriptionID')+"'></form>";
	document.getElementById('buttonholder').innerHTML = '<button class="smallbutton" onClick="document.description.submit()">Opslaan</button>'
	
}


function moreTowns(){
	RequestXMLHTTP('towns','/stad/meer/',processTowns);
}

function processTowns(towns){

	var nodeCount = 0;

	// Only proper way to count the nodes, so that it works in all browsers	
	for (var nodes = towns.childNodes, i = nodes.length, nodeCount = 0; i--;) if (nodes[i].nodeType == 1) nodeCount++;

	var resultHTML = "<ul class='towns'>";
	
	for(var i=0;i<nodeCount;i++){
	
		var townName = towns.getElementsByTagName("TownName")[i].childNodes[0].nodeValue;
		var provinceName = towns.getElementsByTagName("ProvinceName")[i].childNodes[0].nodeValue;
		var townCount = towns.getElementsByTagName("Count")[i].childNodes[0].nodeValue;
		
		if(townName!=CurrentTown){
			resultHTML += "<li class='town' onClick='window.location=\"/stad/" +  provinceName + "/" + townName + "/\"'><a class='mapicon' href=\"/stad/" + provinceName + "/" + townName  + "/kaart/\"><img class='mapicon' src='/images/mapicon-small.jpg' alt='Kaart'></a><a class='townlink' href='/stad/" +  provinceName + "/" + townName + "/'>" + townName + "</a> (" + townCount + ")</li> ";
		}
		
	}
	
	resultHTML += "</ul>";
	
	document.getElementById('towns_list').innerHTML = resultHTML;
	
	NiftyLoad();
}
