rem:  var nextMessage = currentMessage.nextSibling; 
add: var nextMessage;  if(currentMessage) nextMessage = currentMessage.nextSibling; else nextMessage = FindFirstMessage(tree);   if(!nextMessage && startFromBeginning) { dump('no next message\n'); var parent = currentMessage.parentNode; nextMessage = parent.firstChild; }   
context: function GetNextMessage(currentMessage, nextFunction, startFromBeginning){	var foundMessage = false;		var nextMessage = currentMessage.nextSibling;	while(nextMessage && (nextMessage != currentMessage))	{		if(nextFunction(nextMessage))		 break;		nextMessage = nextMessage.nextSibling;		/*If there's no nextMessage we may have to start from top.*/		if(!nextMessage && startFromBeginning)		{			dump('We need to start from the top\n');			var parent = currentMessage.parentNode;			nextMessage = parent.firstChild;		}	}	if(nextMessage)	{		var id = nextMessage.getAttribute('id');		dump(id + '\n');	}	else		dump('No next message\n');	return nextMessage;}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/aa5e2f67eae16c5c9d8f1c4985ac6f9e152696a3/msgViewNavigation.js/clean/mailnews/base/resources/content/msgViewNavigation.js