I'm currently working with a XML menu structure, and something really strange is happening. I have a textfield representing a value from a certain node, and I want to navigate through this using buttons.

When I use this code:

Code:
var selectednode = 0;

switchnode = function(upordown, side){
	sn_childPointer = menu_xml.firstChild;
	
	if (upordown == "up" && side == "leftmenu") {
		selectednode++;		
		message_txt = sn_childPointer.childNodes[selectednode].attributes.name;
        }
}
Everything works fine, it returns the needed values. But when I try to use an external 'childPointer' it doesn't work anymore:

Code:
childPointer = menu_xml.firstChild;
var selectednode = 0;

switchnode = function(upordown, side){
	sn_childPointer = childPointer;
	
	if (upordown == "up" && side == "leftmenu") {
		selectednode++;		
		message_txt = sn_childPointer.childNodes[selectednode].attributes.name;
	}
}
it only returns: 'undefined' !

Does anybody know what I am doing wrong?