<?php
/**
 * @version		$Id: default.php 834 2011-06-20 07:36:03Z joomlaworks $
 * @package		K2
 * @author		JoomlaWorks http://www.joomlaworks.gr
 * @copyright	Copyright (c) 2006 - 2011 JoomlaWorks, a business unit of Nuevvo Webware Ltd. All rights reserved.
 * @license		GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
 */

/*style="width: ?>"
// no direct access */
defined('_JEXEC') or die('Restricted access');

?>

<div id="k2ModuleBox<?php echo $module->id; ?>" class="k2ItemsBlock<?php if($params->get('moduleclass_sfx')) echo ' '.$params->get('moduleclass_sfx'); ?>">

	<?php if($params->get('itemPreText')): ?>
	<p class="modulePretext"><?php echo $params->get('itemPreText'); ?></p>
	<?php endif; ?>

	<?php if(count($items)): ?>

		<div id="camera-slideshow">

				<?php foreach ($items as $key=>$item):	?>

				    <?php
					   $datathumb="";
							if ($params->get('thumbnails') == true){
								$datathumb = $item->imageXSmall;
							} else {
								$datathumb='';
							}
				     ?>

						<div data-src="<?php echo $item->image; ?>" data-link="<?php echo $item->link; ?>" data-thumb="<?php echo $datathumb; ?>">
							<div class="camera_caption <?php echo $params->get('captionEffect'); ?>">

								<!-- Plugins: BeforeDisplay -->
							    <?php echo $item->event->BeforeDisplay; ?>

							    <!-- K2 Plugins: K2BeforeDisplay -->
							    <?php echo $item->event->K2BeforeDisplay; ?>
								 
							      <?php if($params->get('itemTitle')): ?>
							      <a class="moduleItemTitle" href="<?php echo $item->link; ?>"><?php echo $item->title; ?></a>
							      <?php endif; ?>
								 
									<?php if ($params->get('itemIntroText')): ?>
										<?php echo $item->introtext; ?>
									<?php endif; ?>
									
										<?php if($params->get('itemReadMore') && $item->fulltext): ?>
										<a class="moduleItemReadMore" href="<?php echo $item->link; ?>">
											<?php echo JText::_('K2_READ_MORE_SLIDER_THEME'); ?>
										</a>
										<?php endif; ?>

							      <?php if($params->get('itemAuthorAvatar')): ?>
							      <a class="k2Avatar moduleItemAuthorAvatar" rel="author" href="<?php echo $item->authorLink; ?>">
											<img src="<?php echo $item->authorAvatar; ?>" alt="<?php echo K2HelperUtilities::cleanHtml($item->author); ?>" style="width:<?php echo $avatarWidth; ?>px;height:auto;" />
										</a>
							      <?php endif; ?>

							      <?php if($params->get('itemAuthor')): ?>
							      <div class="moduleItemAuthor">
								      <?php echo K2HelperUtilities::writtenBy($item->authorGender); ?>
								
											<?php if(isset($item->authorLink)): ?>
											<a rel="author" title="<?php echo K2HelperUtilities::cleanHtml($item->author); ?>" href="<?php echo $item->authorLink; ?>"><?php echo $item->author; ?></a>
											<?php else: ?>
											<?php echo $item->author; ?>
											<?php endif; ?>
										</div>
										<?php endif; ?>

							      <!-- Plugins: AfterDisplayTitle -->
							      <?php echo $item->event->AfterDisplayTitle; ?>

							      <!-- K2 Plugins: K2AfterDisplayTitle -->
							      <?php echo $item->event->K2AfterDisplayTitle; ?>

							      <!-- Plugins: BeforeDisplayContent -->
							      <?php echo $item->event->BeforeDisplayContent; ?>

							      <!-- K2 Plugins: K2BeforeDisplayContent -->
							      <?php echo $item->event->K2BeforeDisplayContent; ?>

							      <?php if($params->get('itemExtraFields') && count($item->extra_fields)): ?>
							      <div class="moduleItemExtraFields">
								      <b><?php echo JText::_('K2_ADDITIONAL_INFO'); ?></b>
								      <ul>
								        <?php foreach ($item->extra_fields as $extraField): ?>
												<?php if($extraField->value): ?>
												<li class="type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>">
													<span class="moduleItemExtraFieldsLabel"><?php echo $extraField->name; ?></span>
													<span class="moduleItemExtraFieldsValue"><?php echo $extraField->value; ?></span>
													<div class="clr"></div>
												</li>
												<?php endif; ?>
								        <?php endforeach; ?>
								      </ul>
							      </div>
							      <?php endif; ?>

							      <div class="clr"></div>

							      <!-- Plugins: AfterDisplayContent -->
							      <?php echo $item->event->AfterDisplayContent; ?>

							      <!-- K2 Plugins: K2AfterDisplayContent -->
							      <?php echo $item->event->K2AfterDisplayContent; ?>

							      <?php if($params->get('itemDateCreated')): ?>
							      <span class="moduleItemDateCreated"><?php echo JText::_('K2_WRITTEN_ON') ; ?> <?php echo JHTML::_('date', $item->created, JText::_('K2_DATE_FORMAT_LC2')); ?></span>
							      <?php endif; ?>

							      <?php if($params->get('itemCategory')): ?>
							      <?php echo JText::_('K2_IN') ; ?> <a class="moduleItemCategory" href="<?php echo $item->categoryLink; ?>"><?php echo $item->categoryname; ?></a>
							      <?php endif; ?>

							      <?php if($params->get('itemTags') && count($item->tags)>0): ?>
							      <div class="moduleItemTags">
							      	<b><?php echo JText::_('K2_TAGS'); ?>:</b>
							        <?php foreach ($item->tags as $tag): ?>
							        <a href="<?php echo $tag->link; ?>"><?php echo $tag->name; ?></a>
							        <?php endforeach; ?>
							      </div>
							      <?php endif; ?>

							      <?php if($params->get('itemAttachments') && count($item->attachments)): ?>
										<div class="moduleAttachments">
											<?php foreach ($item->attachments as $attachment): ?>
											<a title="<?php echo K2HelperUtilities::cleanHtml($attachment->titleAttribute); ?>" href="<?php echo $attachment->link; ?>"><?php echo $attachment->title; ?></a>
											<?php endforeach; ?>
										</div>
							      <?php endif; ?>

										<?php if($params->get('itemCommentsCounter') && $componentParams->get('comments')): ?>		
											<?php if(!empty($item->event->K2CommentsCounter)): ?>
												<!-- K2 Plugins: K2CommentsCounter -->
												<?php echo $item->event->K2CommentsCounter; ?>
											<?php else: ?>
												<?php if($item->numOfComments>0): ?>
												<a class="moduleItemComments" href="<?php echo $item->link.'#itemCommentsAnchor'; ?>">
													<?php echo $item->numOfComments; ?> <?php if($item->numOfComments>1) echo JText::_('K2_COMMENTS'); else echo JText::_('K2_COMMENT'); ?>
												</a>
												<?php else: ?>
												<a class="moduleItemComments" href="<?php echo $item->link.'#itemCommentsAnchor'; ?>">
													<?php echo JText::_('K2_BE_THE_FIRST_TO_COMMENT'); ?>
												</a>
												<?php endif; ?>
											<?php endif; ?>
										<?php endif; ?>

										<?php if($params->get('itemHits')): ?>
										<span class="moduleItemHits">
											<?php echo JText::_('K2_READ'); ?> <?php echo $item->hits; ?> <?php echo JText::_('K2_TIMES'); ?>
										</span>
										<?php endif; ?>

							      <!-- Plugins: AfterDisplay -->
							      <?php echo $item->event->AfterDisplay; ?>

							      <!-- K2 Plugins: K2AfterDisplay -->
							      <?php echo $item->event->K2AfterDisplay; ?>

								</div>

								<!-- Use iframe to embed video -->
							      	<?php echo $item->video ; ?>

							</div>

				 <?php endforeach; ?>

			</div>
  <?php endif; ?>

	<?php if($params->get('itemCustomLink')): ?>
	<a class="moduleCustomLink" href="<?php echo $params->get('itemCustomLinkURL'); ?>" title="<?php echo K2HelperUtilities::cleanHtml($itemCustomLinkTitle); ?>"><?php echo $itemCustomLinkTitle; ?></a>
	<?php endif; ?>

</div>

<script type="text/javascript">
(function($){ 
   $(window).load(function(){
		$('#camera-slideshow').camera({
			alignment			: "<?php echo $params->get('alignment'); ?>", //topLeft, topCenter, topRight, centerLeft, center, centerRight, bottomLeft, bottomCenter, bottomRight
			autoAdvance			: <?php echo $params->get('autoAdvance'); ?>,	//true, false
			mobileAutoAdvance	: <?php echo $params->get('mobileAutoAdvance'); ?>, //true, false. Auto-advancing for mobile devices
			
			barDirection		: "<?php echo $params->get('barDirection'); ?>",	//'leftToRight', 'rightToLeft', 'topToBottom', 'bottomToTop'
			
			barPosition			: "<?php echo $params->get('barPosition'); ?>",	//'bottom', 'left', 'top', 'right'
			
			cols				: <?php echo $params->get('cols'); ?>,
			
			easing				: "<?php echo $params->get('easing'); ?>",	//for the complete list http://jqueryui.com/demos/effect/easing.html
			
			mobileEasing		: "<?php echo $params->get('mobileEasing'); ?>",	//leave empty if you want to display the same easing on mobile devices and on desktop etc.
			
			fx					: "<?php echo $params->get('fx'); ?>",	
//'random','simpleFade', 'curtainTopLeft', 'curtainTopRight', 'curtainBottomLeft', 'curtainBottomRight', 'curtainSliceLeft', 'curtainSliceRight', 'blindCurtainTopLeft', 'blindCurtainTopRight', 'blindCurtainBottomLeft', 'blindCurtainBottomRight', 'blindCurtainSliceBottom', 'blindCurtainSliceTop', 'stampede', 'mosaic', 'mosaicReverse', 'mosaicRandom', 'mosaicSpiral', 'mosaicSpiralReverse', 'topLeftBottomRight', 'bottomRightTopLeft', 'bottomLeftTopRight', 'bottomLeftTopRight'
											//you can also use more than one effect, just separate them with commas: 'simpleFade, scrollRight, scrollBottom'

			mobileFx			: "<?php echo $params->get('mobileFx'); ?>",	//leave empty if you want to display the same effect on mobile devices and on desktop etc.

			gridDifference		: <?php echo $params->get('gridDifference'); ?>,	//to make the grid blocks slower than the slices, this value must be smaller than transPeriod
			
			height				: "<?php echo $params->get('height'); ?>",	//here you can type pixels (for instance '300px'), a percentage (relative to the width of the slideshow, for instance '50%') or 'auto'
			
			imagePath			: 'images/',	//he path to the image folder (it serves for the blank.gif, when you want to display videos)
			
			hover				: <?php echo $params->get('hover'); ?>,	//true, false. Puase on state hover. Not available for mobile devices
					
			loader				: "<?php echo $params->get('loader'); ?>",	//pie, bar, none (even if you choose "pie", old browsers like IE8- can't display it... they will display always a loading bar)
			
			loaderColor			: "<?php echo $params->get('loaderColor'); ?>", 
			
			loaderBgColor		: "<?php echo $params->get('loaderBgColor'); ?>", 
			
			loaderOpacity		: <?php echo $params->get('loaderOpacity'); ?>,	//0, .1, .2, .3, .4, .5, .6, .7, .8, .9, 1
			
			loaderPadding		: <?php echo $params->get('loaderPadding'); ?>,	//how many empty pixels you want to display between the loader and its background
			
			loaderStroke		: <?php echo $params->get('loaderStroke'); ?>,	//the thickness both of the pie loader and of the bar loader. Remember: for the pie, the loader thickness must be less than a half of the pie diameter
					
			minHeight			: "<?php echo $params->get('minHeight'); ?>",	//you can also leave it blank
			
			navigation			: <?php echo $params->get('navigation'); ?>,	//true or false, to display or not the navigation buttons
			
			navigationHover		: <?php echo $params->get('navigationHover'); ?>,	//if true the navigation button (prev, next and play/stop buttons) will be visible on hover state only, if false they will be visible always
			
			mobileNavHover		: <?php echo $params->get('mobileNavHover'); ?>,	//same as above, but only for mobile devices
			
			opacityOnGrid		: <?php echo $params->get('opacityOnGrid'); ?>,	//true, false. Decide to apply a fade effect to blocks and slices: if your slideshow is fullscreen or simply big, I recommend to set it false to have a smoother effect 
			
			overlayer			: <?php echo $params->get('overlayer'); ?>,	//a layer on the images to prevent the users grab them simply by clicking the right button of their mouse (.camera_overlayer)
			
			pagination			: <?php echo $params->get('pagination'); ?>,
			
			playPause			: <?php echo $params->get('playPause'); ?>,	//true or false, to display or not the play/pause buttons
			
			pauseOnClick		: <?php echo $params->get('pauseOnClick'); ?>,	//true, false. It stops the slideshow when you click the sliders.
			
			pieDiameter			: <?php echo $params->get('pieDiameter'); ?>,
			
			piePosition			: "<?php echo $params->get('piePosition'); ?>",	//'rightTop', 'leftTop', 'leftBottom', 'rightBottom'
			
			portrait			: <?php echo $params->get('portrait'); ?>, //true, false. Select true if you don't want that your images are cropped
			
			rows				: <?php echo $params->get('rows'); ?>,
			
			slicedCols			: <?php echo $params->get('slicedCols'); ?>,	//if 0 the same value of cols
			
			slicedRows			: <?php echo $params->get('slicedRows'); ?>,	//if 0 the same value of rows
			
			slideOn				: "<?php echo $params->get('slideOn'); ?>",	//next, prev, random: decide if the transition effect will be applied to the current (prev) or the next slide
			
			thumbnails			: <?php echo $params->get('thumbnails'); ?>,
			
			time				: <?php echo $params->get('time'); ?>,	//milliseconds between the end of the sliding effect and the start of the nex one
			
			transPeriod			: <?php echo $params->get('transPeriod'); ?>,	//lenght of the sliding effect in milliseconds

			onEndTransition		: function() {  },	//this callback is invoked when the transition effect ends

			onLoaded			: function() {  },	//this callback is invoked when the image on a slide has completely loaded
			
			onStartLoading		: function() {  },	//this callback is invoked when the image on a slide start loading
			
			onStartTransition	: function() {  }	//this callback is invoked when the transition effect starts

		});
	});
})(jQuery);     

</script>
