Questions about $., .parent(node) and nodes in javascript
<p>The following is a part of jstree, <a href="http://www.jstree.com/" rel="nofollow">http://www.jstree.com/</a> code.</p>

<p>And I have a couple of questions about this javascript/jquery to ask. (actually pretty much all)</p>

<pre><code>$('#pages-wrapper').tree({
callback:{
"onchange":function(node,tree){
document.location='pages.php?action=edit&amp;id='+node.id.replace(/.*_/,'');
},
"onmove":function(node){
var p=$.tree.focused().parent(node);
var new_order=[],nodes=node.parentNode.childNodes;
for(var i=0;i&lt;nodes.length;++i)new_order.push(nodes[i].id.replace(/.*_/,''));
$.getJSON('/ww.admin/pages/move_page.php?id='+node.id.replace(/.*_/,'')+
'&amp;parent_id='+(p==-1?0:p[0].id.replace(/.*_/,''))+'&amp;order='+new_order);
}
</code></pre>

<p>Q1. What $ in var p=$.tree is doing?</p>

<p>Q2. What is .parent(node) referencing to?</p>

<p>Q3. Is this line, var new_order=[],nodes=node.parentNode.childNodes; declearing two variables at the same time? And what is node.parentNode.childNodes doing?</p>

<p>Thanks in advance.</p>

<p>The followings are additional codes.</p>

<p>html is the following</p>

<pre><code>&lt;div id="pages-wrapper"&gt;
&lt;ul&gt;
&lt;li id="page_24"&gt;
&lt;a href="pages.php?id=24"&gt;&lt;ins&gt;&amp;nbsp;&lt;/ins&gt;Home&lt;/a&gt;
&lt;/li&gt;
&lt;li id="page_25"&gt;
&lt;a href="pages.php?id=25"&gt;&lt;ins&gt;&amp;nbsp;&lt;/ins&gt;Second Page&lt;/a&gt;
&lt;/li&gt;
&lt;li id="page_30"&gt;&lt;a href="pages.php?id=30"&gt;&lt;ins&gt;&amp;nbsp;&lt;/ins&gt;Information&lt;/a&gt;
     &lt;ul&gt;
     &lt;li id="page_31"&gt;&lt;a href="pages.php?id=31"&gt;&lt;ins&gt;&amp;nbsp;&lt;/ins&gt;Illustration&lt;/a&gt;&lt;/li&gt;
     &lt;/ul&gt;
&lt;/li&gt;
....
.... 
</code></pre>

<p>move_page.php</p>

<pre><code>require '../admin_libs.php';// this one does all the db queries

$id=(int)$_REQUEST['id'];
$to=(int)$_REQUEST['parent_id'];
$order=explode(',',$_REQUEST['order']);
dbQuery("update pages set parent=$to where id=$id");
for($i=0;$i&lt;count($order);++$i){
 $pid=(int)$order[$i];
 dbQuery("update pages set ord=$i where id=$pid");
 echo "update pages set ord=$i where id=$pid\n";
}
</code></pre>
