function moveCategory()
 {
     $session = Session::singletone();
     $db = Database::singletone()->db();
     $cid = Utils::pg("cid", 0);
     $dir = Utils::pg("direction", 0);
     $this->_query->appendChild($this->_dom->createElement("category-id", $cid));
     $this->_query->appendChild($this->_dom->createElement("direction", $dir));
     if ($cid <= 0 || $dir == 0) {
         $this->error("bad-arguments");
         return;
     }
     if (!$session->checkPerm("edit-categories")) {
         $this->error("permission-denied");
         return;
     }
     $category = new Category($cid);
     $old_order = $category->dbdata('category_order', 0);
     $cid2 = $category->moveCategory($dir);
     $this->_response->appendChild($this->_dom->createElement('category2-id', $cid2));
     $this->_response->appendChild($this->_dom->createElement('old-order', $old_order));
     $this->_response->appendChild($this->_dom->createElement('new-order', $category->dbdata('category_order', 0)));
     $this->success();
 }