<html>
<head>
<script language="Javascript">
<!--
if (parent.CAN_UPDATE) {
	var node_id      = <%category_id%>;
	var node_to_id   = <%category_to_id%>;

	var node      = parent.tree.lookup (node_id);
	var node_to   = parent.tree.lookup (node_to_id);

	var node_from_id = node.getFatherId();
	var node_from = parent.tree.lookup (node_from_id);

	var error_flag = false;
	var error      = "Software error:\n";
	error     += "---------------\n";

	if (node == null || node_from == null || node_to == null) error_flag = true;
	if (node == null)      error += "  + the node to move does not exist\n";
	if (node_from == null) error += "  + the original father node does not seem to exist\n";
	if (node_to   == null) error += "  + the target father node does not seem to exist\n";

	if (error_flag) alert (error);
	else
	{
		if (!node_to.isLoaded())
		{
			parent.tree.delNode (node_to);
			parent.tree.addNode (new parent.LoadedNode (node_to.getId(), node_to.getFatherId(), node_to.getName()));
	<%load_node_info%>	
		}
	}

	parent.tree.delNode (node);
	node.setFatherId (node_to_id);
	parent.tree.addNode (node);


	// Now update the links counters
	var old_id = <%old%>;
	var new_id = <%new%>;
	var number_of_links = <%number_of_links%>;

	var old_node = parent.tree.lookup (old_id);
	var new_node = parent.tree.lookup (new_id);

	// goes up in the tree, decreasing link counts by one
	// from the old node
	var fatherid = old_node.getFatherId();
	while (true)
	{
		if (old_node.getNumberOfLinks() != null) old_node.setNumberOfLinks (old_node.getNumberOfLinks() - number_of_links);
		if (fatherid == old_id) break;

		old_id   = fatherid;
		old_node = parent.tree.lookup (old_id);
		fatherid = old_node.getFatherId();
	}

	// goes up in the tree, increasing link counts by one
	// from the new node
	fatherid = new_node.getFatherId();
	while (true)
	{
		if (new_node.getNumberOfLinks() != null) new_node.setNumberOfLinks (new_node.getNumberOfLinks() + number_of_links);
		if (fatherid == new_id) break;

		new_id   = fatherid;
		new_node = parent.tree.lookup (new_id);
		fatherid = new_node.getFatherId();
	}

	// redisplays this info
        parent.draw_tree();
        parent.frames[parent.LEFT_FRAME_ID].navigate("#<%old%>");
}
// -->
</script>

<body bgcolor="#FFFFFF" onUnload="parent.CAN_UPDATE = 0;">

<table border="1" cellpadding="0" cellspacing="0"><tr><td>
	<table bgColor="#ffffff" border="0" cellPadding="3" cellSpacing="3" width="500" valign="top">
	  <tr>
		<td align="left" bgColor="navy"><b><font color="#ffffff" size="2" face="Tahoma,Arial,Helvetica">
Browse Category: <%Name%>
		</font></b></td>
	  </tr>
	  <tr>
		<td>
		  <p align="center"><b><font color="#000000" size="2" face="Tahoma,Arial,Helvetica">
Browse Category: <%Name%> <br>
<font color="green"><%Name%> has been successfully moved.</font>
		  </font></b></p>
		  <p><font size="2" face="Tahoma,Arial,Helvetica">
<%navbar%>
		  </font></p>
          </td>
	  </tr>
	</table>
	</td></tr>
</table>

<br>

<%if toolbar%>
	<p><font size="2" face="Tahoma,Arial,Helvetica">Pages: <%toolbar%></font></p>
<%endif%>
<%if links%>
	<table border=1 cellpadding=3 cellspacing=0>
		<tr><td colspan=6><font size="2" face="Tahoma,Arial,Helvetica">There are <b><%count%></b> links.</font></td></tr>
		<%links%>
	</table>
<%endif%>
<%if toolbar%>
	<p><font size="2" face="Tahoma,Arial,Helvetica">Pages: <%toolbar%></font></p>
<%endif%>

  </body>
</html>
