<?php 

/**

* Author: Gawesh Basnayake

* Email: gaweshademp@yhoo.com

* Module: Sub Items

* Version: 1.3.0

*/



// No Direct Access

defined('_JEXEC') or die('Restricted access'); 



if($showParent == "1"){

	$parentName = "";

	foreach($parent as $item){

		$parentName = $item->name;

	}

}else{

	$parentName = "";

}



if($parentLink == "1"){

	foreach($parent as $item){

		$pLink = $item->link.'&Itemid='.$parentId;

	}

	$parentLinkStart = "<a href=\"".$pLink."\" >";

	$parentLinkEnd = "</a>";

}else{

	$parentLinkStart = "";

	$parentLinkEnd = "";

}



if ($width == null) {

	$resize_w = "";

} else {

	$resize_w = " width=\"".$width."\"";

}



if ($height == null) {

	$resize_h = "";

} else {

	$resize_h = " height=\"".$height."\"";

}



if ($title_txt == null) {

	$title = "";

} else {

	$title = " title=\"".$title_txt."\"";

}



if ($image != null) {

	$image2 = "<img".$title." src=\"".$image."\"".$resize_w.$resize_h." >";

}



if ($page == "same_page") {

	$page2 = "";

} else if ($page == "new_page"){

	$page2 = "target=\"_blank\"";

}



if ($website == null){

	$weblink = "";

	$weblinkend = "";

} else {

	$weblink = "<a ".$page2." href=\"".$website."\" >";

	$weblinkend = "</a>";

}

?>



<link rel="stylesheet" href="<?php echo JURI::base(); ?>modules/mod_subitems/subitems.css" type="text/css" />



<div id="subitems">



<!-- Image starts here -->

<?php if($image != null){?>

<div style="text-align: <?php echo $align; ?>" class="img">

	<?php echo $weblink.$image2.$weblinkend; ?>

</div>

<?php }?>

<!-- Image Holder Ends here -->



<!-- Sub Menu List Starts here -->

<div class="list">



<?php if($showParent == "1"){?>

<div style="text-align: <?php echo $parentAlign; ?>" class="parent_name">

	<?php echo $parentLinkStart.$parentName.$parentLinkEnd; ?>

</div>

<?php }?>



<ul class="si-menulist">

    <?php

	foreach ($items as $item) {

		$link = $item->link.'&Itemid='.$item->id;

	?>

    <li class="si-menuitem">

		<a href="<?php echo $link; ?>" class="si-menulink">

			<?php echo JText::sprintf($item->name); ?>

		</a>

    </li>

	<?php } ?>

</ul>

</div>

<!-- Sub Menu List Ends here -->



</div>