Get Customer group id in magento

While i was working on one Magento site one of my client wants to show a page only for wholesale customer. I knew How to assign customer group in Magento But didn’t know how to check it.I had to made this condition on Aw_blog module page, I opened that module and wrote the Following code and worked correctly.

First I check whether a Customer logged in or not ,then I fetch the value of customer group id to know in which customer group visited this page.In my website Wholesale customer Id was 2.

<?php
$login = Mage::getSingleton( 'customer/session' )->isLoggedIn(); //Check if User is Logged In
if($login)
{
 $groupId = Mage::getSingleton('customer/session')->getCustomerGroupId(); //Get Customers Group ID
 if($groupId == 2) //My wholesale customer id was 2 So I checked for 2. You can check according to your requirement
 {
   echo 'You are a wholesale Customer';
 }
}
?>
DOWNLOAD SOLUTION HERE