<?php
/*
 * ARI Easy Slider Joomla! module
 *
 * @package		ARI Easy Slider Joomla! module.
 * @version		1.0.0
 * @author		ARI Soft
 * @copyright	Copyright (c) 2009 www.ari-soft.com. All rights reserved
 * @license		GNU/GPL (http://www.gnu.org/copyleft/gpl.html)
 * 
 */

(defined('_JEXEC') && defined('ARI_FRAMEWORK_LOADED')) or die;

$defParams = AriUtils::getParam($params, '_default');
$cssStyles = AriUtils::getParam($params, 'styles');
$cntId = $sliderId;
$opt = AriUtils::getParam($params, 'opt');
$theme = AriUtils::getParam($defParams, 'theme', '');
$themeClasses = '';
if ($theme)
{
	$themeClasses .= 'es-theme-' . $theme;
	$themeClasses .= ' es-theme-' . $theme . '-' . ((bool)$opt['vertical'] ? 'vertical' : 'horizontal');
	if (strpos($theme, 'jui_') === 0)
		$themeClasses .= ' es-theme-jui';
}

$controlsShow = (bool)$defParams['controlsShow'];
$controlsPos = explode('_', $defParams['controlsPos']);
$width = $defParams['width'];
$height = $defParams['height'];
$zIndex = intval(AriUtils::getParam($defParams, 'zIndex'), 10);
$itemsPerPage = AriUtils::getParam($opt, 'itemsPerPage', 1);
$emptyItemsCount = count($items) % $itemsPerPage;
if ($emptyItemsCount > 0)
	$emptyItemsCount = $itemsPerPage - $emptyItemsCount; 

$extraWidth = 0;
if (!empty($cssStyles['container']['border-style']) && $cssStyles['container']['border-style'] != 'none')
	$extraWidth = 2 * @intval($cssStyles['container']['border-width'], 10);
?>
<div id="<?php echo $sliderId; ?>_wrapper" class="es-wrapper <?php if (!empty($opt['responsive'])):?>es-responsive <?php endif; ?>es-wrapper-<?php echo (bool)$opt['vertical'] ? 'vertical' : 'horizontal'; ?> <?php echo $themeClasses; ?>">
	<div class="es-overlay<?php if ((bool)$opt['auto']): ?> playing<?php endif; ?>"  id="<?php echo $cntId . '_overlay'; ?>" <?php if ($zIndex > -1): ?> style="z-index: <?php echo $zIndex; ?><?php endif; ?>">
		<?php
			if ($controlsShow && in_array('top', $controlsPos))
				require dirname(__FILE__) . '/menu.php';
		?>
		<div class="es-container" id="<?php echo $cntId; ?>">
			<ul class="es-items-container">
			<?php
				foreach ($items as $dataItem):
			?>
				<li class="es-news-item">
					<div class="es-news-item-out">
						<div class="es-news-item-in">
							<?php echo $dataItem['content']; ?>
						</div>
					</div>
				</li>
			<?php
				endforeach;
				
				while ($emptyItemsCount > 0):
			?>
				<li class="es-news-item es-news-item-empty">
					<div class="es-news-item-out">
						<div class="es-news-item-in">
						</div>
					</div>
				</li>
			<?php
					--$emptyItemsCount;
				endwhile; 
			?>
			</ul>
		</div>
		<?php
			if ($controlsShow && in_array('bottom', $controlsPos))
				require dirname(__FILE__) . '/menu.php';
		?>
	</div>
</div>