<?php $_categories = $this->getStoreCategories() ?>
<?php if(count($_categories)): ?>
<!-- <nav class="nav-container"> -->
	<div class="nav-inner">
    <div id="advancedmenu">
	
		<div class="mega_menu">
			<div class="mega_bkg"> 
				<div class="block-title">
				<span><?php echo $this->__('Shop By Categories') ?></span>
				<h2 class="toggle_arrow"></h2>
				</div>
			</div>
			<ul class="block-content">  
				<li>

		<?php $m=0; ?>
         <?php $n=0; ?>
        <?php foreach ($_categories as $_category): ?>
        	<?php $m++; 
            if($m<9){	 ?>
            <?php echo $this->drawAdvancedMenuItem($_category) ?>
            <?php }else{ ?>
		<div class="menu seeall">
            <div class="subparentMenu menu0 seeall">
			
                <a href="<?php echo $this->getUrl('') ?>">
                    <span><?php echo $this->__('Show All Category'); ?></span>
                </a>
                <div class="subparentmenu-hover">
				<div class="super-sub">
               <?php foreach ($_categories as $_category): ?>
                <?php $n++;
				if($n<9){}else{ ?>
                 <?php echo $this->drawAdvancedMenuItem($_category) ?>
                 <?php } ?>
               <?php endforeach ?>
               </div>
                </div>
            </div>
        </div>				
			<?php break;	}?>
        <?php endforeach ?>

		
       <?php /*?> <?php if ($this->showHomeLink()) : ?>
        <div class="menu">
            <div class="parentMenu menu0 home_link">
                <a href="<?php echo $this->getUrl('') ?>">
                    <span><?php echo $this->__('Home'); ?></span>
                </a>
            </div>
        </div>
        <?php endif ?><?php */?>
	
		<?php if ($this->isActivecustomBlock()) : 
			$custom_block_name =  Mage::getStoreConfig('advanced_menu/customblock/menucustomblock_name'); 
			$custom_block_identifier =  Mage::getStoreConfig('advanced_menu/customblock/customblock_identifier'); 
			$custom_topoffset = Mage::getStoreConfig('advanced_menu/popup/top_offset') + 0;
		?>
			
			<div class="custom_menu">
			<a><span><?php echo $custom_block_name; ?></span></a>
			<div class="customblock_inner" style="top:<?php echo $custom_topoffset; ?>px">
			<div class="custom_menu_inner">
			<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId($custom_block_identifier)->toHtml() ?> 
			</div>	
			</div>
			</div>
		<?php  endif;?>	
		
        </li>
			</ul>
		</div>

		<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('tm_header_links')->toHtml() ?>		
		
		
		<?php /*?><div class="clearBoth"></div><?php */?>
    </div>
	
	<!-- Code for responsive menu start -->
	<?php $_menu = $this->renderCategoriesMenuHtml(0,'level-top') ?>
	<div class="nav-responsive" style="display:none;"><span>Menu</span><div class="expandable"> <span class="menu_icon"></span> </div></div>
		<div class="responsive_menu">
			<ul id="nav" class="advanced_nav">
				<?php echo $_menu ?>
			</ul>
		</div>
	</div>	
	<!-- Code for responsive menu end -->

<!-- </nav> -->
<script type="text/javascript">
//<![CDATA[
var CUSTOMMENU_POPUP_WIDTH = <?php echo Mage::getStoreConfig('advanced_menu/popup/width') + 0; ?>;
var CUSTOMMENU_POPUP_TOP_OFFSET = <?php echo Mage::getStoreConfig('advanced_menu/popup/top_offset') + 0; ?>;
var CUSTOMMENU_POPUP_RIGHT_OFFSET_MIN = <?php echo Mage::getStoreConfig('advanced_menu/popup/right_offset_min') + 0; ?>;
var CUSTOMMENU_POPUP_DELAY_BEFORE_DISPLAYING = <?php echo Mage::getStoreConfig('advanced_menu/popup/delay_displaying') + 0; ?>;
var CUSTOMMENU_POPUP_DELAY_BEFORE_HIDING = <?php echo Mage::getStoreConfig('advanced_menu/popup/delay_hiding') + 0; ?>;
var megnorCustommenuTimerShow = {};
var megnorCustommenuTimerHide = {};
//]]>
</script>
<?php endif ?>

 