
<script>
/* <![CDATA[ */

/**
 * Revolution Slider Template file
 * For more settings see: http://www.orbis-ingenieria.com/code/documentation/documentation.html#!/documenter_cover
 */
jQuery(document).ready(function() 
{	
	// add class tp-resizeme to nested elements
	jQuery('<?php echo $this->selector; ?>').find('.tp-caption,.caption').find('*').addClass('tp-resizeme');
	
	var options = 
	{
		// general settings
		delay:				<?php echo $this->delay; ?>,
		startwidth:			<?php echo $this->startWidth; ?>,
		startheight:		<?php echo $this->startHeight; ?>,
		startWithSlide:		<?php echo $this->startWithSlide; ?>,
		// add controls
		navigationType:		'<?php echo $this->navigationType; ?>',
		navigationStyle:	'<?php echo $this->navigationStyle; ?>',
		navigationArrows:	'<?php echo $this->arrowStyle; ?>',
		touchenabled:"on",
		onHoverStop: '<?php echo $this->stopOnHover; ?>',
		swipe_velocity: 0.7,
		swipe_min_touches: 1,
		swipe_max_touches: 1,
		drag_block_vertical: false,
		// arrow navigation alignment
		soloArrowLeftHalign:"left",
		soloArrowLeftValign:"center",
		soloArrowLeftHOffset:20,
		soloArrowLeftVOffset:0,
		soloArrowRightHalign:"right",
		soloArrowRightValign:"center",
		soloArrowRightHOffset:20,
		soloArrowRightVOffset:0,
		// lopp settings
		stopAtSlide: <?php echo $this->stopAtSlide; ?>,
		stopAfterLoops: <?php echo $this->stopAfterLoops; ?>,
		shadow:0
	};

	<?php if($this->fullwidth): ?>
	// fullwidth
	options.fullWidth = "on";
	options.forceFullWidth = "off";
	<?php endif; ?>
		
	<?php if($this->fullscreen): ?>
	// fullscreen
	options.fullWidth = "off";
	options.fullScreen = "on";
	options.forceFullWidth = "off";
	options.fullScreenOffsetContainer = '#<?php echo $this->fullScreenOffsetContainer; ?>';
	<?php endif; ?>
	
	// thumbnails
	<?php if($this->addThumbs): ?>
	options.thumbWidth = <?php echo $this->thumbWidth; ?>;
	options.thumbHeight = <?php echo $this->thumbHeight; ?>;
	options.thumbAmount = <?php echo $this->thumbAmount; ?>;
	// hide thumbs when there is no mouse contact
	options.hideThumbs = 1;
	<?php endif;?>
	
	// shuffle
	<?php if($this->shuffle): ?>
	options.shuffle = 'on';
	<?php endif;?>
	
	// overlay
	<?php if($this->overlay): ?>
	options.dottedOverlay = "<?php echo $this->overlay; ?>";
	<?php endif; ?>
	
	// mobile
	//if( jQuery('body').hasClass('mobile') )
	//{
	//	options.startwidth = 767;
	//}
	
	// init slider  
	var api = jQuery('<?php echo $this->selector; ?>').show().revolution(options);
});

/* ]]> */
</script>

<?php if($GLOBALS['TL_CONFIG']['minifyMarkup']) :?>
<script>
/* <![CDATA[ */

/**
 * Fix slider script bug
 * Remove the obsolute copy of a split text element when using compressed markup
 */
jQuery(document).ready(function() 
{
	var api = jQuery('<?php echo $this->selector; ?>');
	
	api.bind("revolution.slide.onloaded",function (e)	{removeSplitElement(e.currentTarget);});
	api.bind("revolution.slide.onchange",function (e) {removeSplitElement(e.currentTarget);});
	function removeSplitElement(slider)
	{
		var elems = jQuery(slider).find('.splitted');
		if(elems == undefined || elems.length < 1)
		{
			return;
		}
		elems.each(function(index,elem)
		{
			// check if the first element already has child elements. if not, remove it (this is the unwanted copy)
			var childs = jQuery(elem).children().first().children().children();
			if(childs == undefined || childs.length < 1)
			{
				jQuery(elem).children().first().remove();
			}	
		});
	}	
});

/* ]]> */
</script>
<?php endif; ?>