<?php
/*
# ------------------------------------------------------------------------
# SlideShow Pro SP2 module for Joomla 2.5
# ------------------------------------------------------------------------
# Copyright (C) 2010 - 2012 JoomShaper.com. All Rights Reserved.
# @license - PHP files are GNU/GPL V2. CSS / JS are Copyrighted Commercial,
# Author: JoomShaper.com
# Websites:  http://www.joomshaper.com
# Redistribution, Modification or Re-licensing of this file in part of full, 
# is bound by the License applied. 
# ------------------------------------------------------------------------
*/

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
$pre_src 	= '';
?>
<script type="text/javascript">
//<![CDATA[
window.addEvent('domready', function() {
	var spSlide<?php echo $uniqid ?> = new slideshow_sp2($('sp-slide<?php echo $uniqid ?>'), {
		size: {width: <?php echo $width; ?>, height: <?php echo $height; ?>},
		interval: <?php echo $interval ?>,
		fxOptions: {duration:  <?php echo $speed; ?>, transition: Fx.Transitions.<?php echo $transition; ?>},
		transition: <?php echo "'" .$effects. "'"; ?>,
		walkers: {
			container: $('handlers<?php echo $uniqid ?>'),
			depth:<?php echo $thumb_width ?>,
			wmode:'horizontal',
			mouse_wheel: <?php echo $mouse_wheel ?>,
			display:<?php echo $maxitem ?>
		},
		
		onWalk: function (i, j) {
			this.walkers.items.removeClass('active');
			this.walkers.items[i].addClass('active');
		},
		onInitialized: function () {
			this.walkers.items[0].addClass('active');
		}		
	});

	var images = [
		<?php 
			foreach ($list as $item) {
				$pre_src .= '"' . $item->image . '",';
			}		
			$pre_src=rtrim($pre_src,',');
			echo $pre_src;
		?>	
	];
	var images_elements = document.getElements('#sp-slide<?php echo $uniqid ?> img');

	var loader = Asset.images(images, {
		onComplete: function () {
			spSlide<?php echo $uniqid ?>.play();
		},

		onProgress: function (i) {
			images_elements[i-1].src = images[i-1];
		}
	});	
	
});
//]]>
</script>
<div class="sp-slide" style="position:relative">
	<div id="sp-slide<?php echo $uniqid ?>" style="overflow:hidden;position:relative;height:<?php echo $height ?>px;width:<?php echo $width ?>px">
		<?php foreach ($list as $item): ?>
			<div class="sp-slide-content">
				<div class="image-block" style="width:<?php echo $width ?>px;height:<?php echo $height ?>px">
					<?php if($imagelinked) { ?>
						<a href="<?php echo $item->link ?>"><img src="<?php echo $item->none ?>" alt="" style="width:<?php echo $width ?>px;height:<?php echo $height ?>px" /></a>
					<?php } else { ?>
						<img src="<?php echo $item->none ?>" alt="" style="width:<?php echo $width ?>px;height:<?php echo $height ?>px" />
					<?php } ?>
				</div>	
				<?php if($showarticle) { ?>
					<div class="sp-slide-intro"><?php echo $item->text; ?></div>
				<?php } ?>	
			</div>			
		<?php endforeach; ?>
	</div>
	<div id="handlers<?php echo $uniqid ?>" class="controllers" style="<?php echo 'width:' .$cwidth. 'px;left:' .$left. 'px;height:' . ($itemheight) . 'px;' ?>">
		<?php foreach ($list as $item) { ?>
			<div class="handles" style="<?php echo 'width:' . $thumb_width. 'px;height:' .  ($itemheight) . 'px'?>">
				<div class="thumb_bg" style="<?php echo 'width:' . $thumb_width. 'px;height:' . $itemheight . 'px'?>">
					<div class="sp-slide-inside clearfix">
						<?php if ($show_c_title) echo '<h4 class="title">' . $item->c_title . '</h4>'; ?>
					</div>
				</div>
			</div>	
		<?php } ?>
	</div>
	<div class="controller_left"></div>
	<div class="controller_right"></div>	
</div>
