<?php
/*
 * Art Total menu: simple template
 *
 * @version		1.0.0
 * @author		Artetics
 * @copyright	Copyright (c) 2009 www.artetics.com. All rights reserved
 * @license		GNU/GPL (http://www.gnu.org/copyleft/gpl.html)
 */

$moduleParams = $params['moduleParams'];
$moduleId = $params['moduleId'];
$menu = $params['menu']; 
$selectedId = $params['selectedId'];
$selectedIndex = $params['selectedIndex'];
?>

<?php

if (!function_exists('artMenuSimple_traverseMenuChildrenItems')) {
	function artMenuSimple_traverseMenuChildrenItems($menu, $parentId = 0) {
		foreach ($menu as $menuItem) {
			if ($menuItem->parent != $parentId || $menuItem->type == 'separator') continue;

			$link = $menuItem->link;
			if ($link && ($menuItem->type == 'component' || strpos($link, 'http') !== 0)) { 
				$link .= (strpos($link, '?') !== false) ? '&' : '?';
				$link .= 'Itemid=' . $menuItem->id;
			}
			$app = &JFactory::getApplication();
			$router = &$app->getRouter();
			$link = JRoute::_($link, false);

	?>
			<li><a href="<?php echo $link;?>"><?php echo $menuItem->name;?></a>
	<?php
			if (isset($menuItem->children) && count($menuItem->children) > 0) {
				echo '<ul class="sub_menu">';
				artMenuSimple_traverseMenuChildrenItems($menuItem->children, $menuItem->id);
				echo '</ul>';
			}
	?>
			</li>
	<?php
		}
	}
}

if ($menu) {
	$document = &JFactory::getDocument();
	$document->addScript( JURI::root() . 'modules/mod_arttotalmenu/mod_arttotalmenu/showtype/js/jquery-1.3.2.min.js' );
	$document->addScript( JURI::root() . 'modules/mod_arttotalmenu/mod_arttotalmenu/showtype/simple/js/jquery.dropdownplain.js' );
	$document->addStyleSheet( JURI::root() . 'modules/mod_arttotalmenu/mod_arttotalmenu/showtype/simple/css/style.css' );
?>

<div id="arttotalmenucontent_<?php echo $moduleId; ?>" class="hidden">
	<ul class="dropdown">
	<?php
		artMenuSimple_traverseMenuChildrenItems($menu);
	?>
	</ul>
</div>
<script type="text/javascript">
	<?php
		if ($moduleParams['noConflict']) {
	?>
		jQuery.noConflict();
	<?php
		}
	?>
</script>
<?php
}
?>

<!-- Art Total Menu Joomla! module. Copyright (c) 2009 Artetics, www.artetics.com.com -->
<!-- http://www.artetics.com/ARTools/art-totalmenu -->