<?php
	$rand_id = substr(md5(uniqid(rand(), true)), 0, 10);
?>
<div class="module category_mobile" id="category_mobile_<?php echo $rand_id; ?>">
	<h2 class="box-heading"><?php echo ''; ?></h2>
	<nav id="secondary">
		<ul class="nav">
			<?php foreach ($categories as $category) { ?>
			<li>
				<?php if ($category['category_id'] == $category_id) { ?>
				<a href="<?php echo $category['href']; ?>" class="active"><?php echo $category['name']; ?></a>
				<?php } else { ?>
				<a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a>
				<?php } ?>
				<?php if ($category['children']) { ?>
				<ul>
					<?php foreach ($category['children'] as $child) { ?>
					<li>
						  <?php if ($child['category_id'] == $child_id) { ?>
						  <a href="<?php echo $child['href']; ?>" class="active"><?php echo $child['name']; ?></a>
						  <?php } else { ?>
						  <a href="<?php echo $child['href']; ?>"><?php echo $child['name']; ?></a>
						  <?php } ?>
					</li>
					<?php } ?>
				</ul>	
				<?php } ?>
			</li>
			<?php } ?>
		</ul>    
	</nav>
</div>
<script type="text/javascript">
(function($) {
	$(document).ready(function($) {
		if ($('.category-info').length > 0) {
			$('html, body').scrollTop($('.category-info').offset().top - 10);
		}
	});
})(jQuery);
</script>