rem: sortDirection = "ascending"; var currentDirection = node.getAttribute('sortDirection'); if (currentDirection == "ascending") sortDirection = "descending"; else if (currentDirection == "descending") sortDirection = "ascending"; else    sortDirection = "ascending"; 
add: var sortDirection; if(direction) sortDirection = direction; else { var currentDirection = node.getAttribute('sortDirection'); if (currentDirection == "ascending") sortDirection = "descending"; else if (currentDirection == "descending") sortDirection = "ascending"; else    sortDirection = "ascending"; } 
context: function SortColumn(node, sortKey, secondarySortKey){	dump('In sortColumn\n');	var xulSortService = Components.classes["component://netscape/rdf/xul-sort-service"].getService();	if (xulSortService)	{		xulSortService = xulSortService.QueryInterface(Components.interfaces.nsIXULSortService);		if (xulSortService)		{			// sort!!!			sortDirection = "ascending";			var currentDirection = node.getAttribute('sortDirection');			if (currentDirection == "ascending")					sortDirection = "descending";			else if (currentDirection == "descending")					sortDirection = "ascending";			else    sortDirection = "ascending";			try			{				if(secondarySortKey)					node.setAttribute('rdf:resource2', secondarySortKey);				xulSortService.Sort(node, sortKey, sortDirection);			}			catch(e)			{                		//dump("Sort failed: " + e + "\n");			}		}	}}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/af8324911b9670530c1111fda2b99a22ec8f9523/commandglue.js/buggy/mailnews/base/resources/content/commandglue.js