function savecategory($option, $task)
{
    global $option, $mainframe;
    $row =& JTable::getInstance('Category', 'Table');
    if (!$row->bind(JRequest::get('post'))) {
        echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
        exit;
    }
    if (!$row->store()) {
        if (!$row->bind(JRequest::getget('post'))) {
            echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
            exit;
        }
    }
    $mainframe->redirect('index.php?option=' . $option . '&task=categories', 'Category changes saved');
}