Get current Category

<?php  $layer = Mage::getSingleton(‘catalog/layer’);

$_category = $layer->getCurrentCategory();

$currentCategoryId = $_category->getId();

$parentCategoryId = $_category->parent_id;

echo $currentCategoryId;

echo $parentCategoryId;   ?>