$category = JTable::getInstance('category');
$category->load($catid);
echo $category->parent_id;