setXMLAutoLoading and loadOpenStates

I just purchased our code and I am trying to get the tree mode to load the cookie when the XML is auto loaded. Here is my code so far:



tree=new dhtmlXTreeObject(“treeboxbox_tree”,“100%”,“100%”,0);

tree.setXMLAutoLoading(“/core/xmlTree.php”);

tree.loadXML(“/core/xmlTree.php?id=1”);





dhtmlxEvent(window, “load”, function(){

window.setTimeout(function(){

tree.loadOpenStates(‘solodev’);



tree.attachEvent(“onOpenEnd”,function(){

tree.saveOpenStates(‘solodev’);

});

},100);});



Can someone please give me the right code to make this work.

a) loadOpenStates need to be initiated after main XML loaded ( onXLE event or second param of loadXML command )b) saveOpenStates called from onOpenEnd may block opening process.�