<?php
/**
 * @package ZT Headline module 
 * @author http://www.ZooTemplate.com
 * @copyright (C) 2010- ZooTemplate.com
 * @license PHP files are GNU/GPL
**/
defined('_JEXEC') or die('Restricted access');
JHTML::_('behavior.mootools');

$document 	= JFactory::getDocument();
$document->addScript(JURI::base() . 'modules/mod_zt_headline/assets/js/jquery-1.7.1.min.js');
$document->addScript(JURI::base() . 'modules/mod_zt_headline/assets/js/plugins.js');
$document->addScriptDeclaration('var Zoo = jQuery.noConflict();'); 
$document->addStyleSheet(JURI::base() . 'templates/zt_moscho/css/zt_scroller.css');
$document->addScript(JURI::base() . 'modules/mod_zt_headline/assets/js/zt_scroller.js');
$cssMod 	= "width:".$moduleWidth."px; height: ".$moduleHeight."px;";
$effect = $params->get('zt_scroller_effect');
$itemwidth = $params->get('itemWidth', 250);
$pagenav = $params->get('zt_scroller_enable_btn');
$noslide = $params->get('zt_scroller_no_item'); 
$enabledesc = $params->get('zt_scroller_enable_description');
$auto = $params->get('zt_scroller_autorun');
$ThumbWidth = $params->get('thumbWidth');
$ThumbHeight = $params->get('thumbHeight'); 
?>   
<div id="zt_scroller<?php echo $moduleId;?>" class="scroller-slider" style="<?php echo $cssMod;?>">  
	<ul style="margin: 0pt; padding: 0pt; position: relative; list-style-type: none; z-index: 1;">
	<?php
	$j=0;
	foreach($slides as $item) { ?>
		<li style="overflow: hidden; float: left; width: <?php echo $itemwidth;?>px; height: <?php echo $moduleHeight;?>px;"> 
				
					<?php if($item->thumbs) { ?>
						<div class="image-thumb">
							<span class="pos-top">&nbsp;</span>
							<span><img src="<?php echo JURI::root().'modules/mod_zt_headline/timthumb.php?src='.$item->thumbs.'&amp;h='.$ThumbHeight.'&amp;w='.$ThumbWidth; ?>" alt="<?php echo $item->title; ?>" title="<?php echo $item->title;?>" /></span>
							<span class="pos-bot">&nbsp;</span>
						</div>
						
					<?php } ?>
				
				<?php if($enabledesc){?>
				<div class="info-slide">
					<a class="title-slide" title="" href="<?php echo $item->link;?>"><?php echo $item->title; ?>&nbsp;</a>							
					<?php						
						echo "<p>".$item->introtext."</p>";
					 ?>
					<a class="readonslide" title="" href="<?php echo $item->link;?>"><span><?php echo JText::_('Read more'); ?></span></a>
				</div>
				<?php }?>
								
		</li>
	<?php
	$j++;
	}
	?> 
	</ul> 
</div> 
	<?php if($pagenav){?>
	<div class="pagenave">
		<button id="prev<?php echo $moduleId;?>" class="prev">&lt;&lt;</button>
		<button id="next<?php echo $moduleId;?>" class="next">&gt;&gt;</button>
	</div>
	<?php }?>
<script type="text/javascript">  
Zoo(document).ready(function() { 
	Zoo(function() {
		Zoo("#zt_scroller<?php echo $moduleId;?>").jCarouselLite({
			<?php if($pagenav){?>
			btnNext: "#next<?php echo $moduleId;?>",
			btnPrev: "#prev<?php echo $moduleId;?>", 
			<?php }?>
			visible: <?php echo $noslide;?>,
			<?php if($auto){?> 
			auto: 5000, 
			<?php }?>
			easing: "<?php echo $effect;?>",
			speed: 1000
		});
	}); 
});
</script>