<?php
/**
* @Copyright Copyright (C) 2010 VTEM . All rights reserved.
* @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
* @link     	http://www.vtem.net
**/

// no direct access
defined('_JEXEC') or die('Restricted access'); 
$slideID = $params->get( 'slideID', 'vtemimageshow01');
$navigation = $params->get('navigation', 1);
$navigation_align = $params->get('navigation_align', "center");
$prev_next = $params->get( 'prev_next' );
$fx = $params->get( 'fx', 'fade' );
$slideSpeed = $params->get( 'slideSpeed', 3000 );
$target = $params->get( 'target', 0 ) ? "_blank" : "_self";
$fit = $params->get('fit', 1);
$css = $params->get('css');
$link_images = $params->get('link_images', 0);
$keyarr=explode(";",$params->get('url'));
foreach($keyarr  as  $key=>$value){
if  (!empty($value)){
   $urls[] = $value;
   }
}

if($navigation == 1){$numbers ="true"; $dots="false"; $thumbs="false";}
elseif($navigation == 0){$numbers ="false"; $dots="true"; $thumbs="false";}
elseif($navigation == 2){$numbers ="false"; $dots="false"; $thumbs="true";}
elseif($navigation == 3){$numbers ="false"; $dots="false"; $thumbs="false";}
$doc =& JFactory::getDocument();
if($fit == 1){
$style1 = '#'.$slideID.' .container_skitter img{width:'.$width.'px;height:'.$height.'px;}'; 
}
$style = '#'.$slideID.'{width:'.$width.'px;height:'.$height.'px;}'.$css.$style1; 
$doc->addStyleDeclaration( $style );
if($params->get('jquery', 1) == 1){	
?>
<script type="text/javascript" src="<?php echo JURI::root();?>modules/mod_vtem_imageshow/js/jquery-1.5.2.min.js"></script>
<?php }?>
<script type="text/javascript" src="<?php echo JURI::root();?>modules/mod_vtem_imageshow/js/jquery-ui-1.8.12.custom.min.js"></script>
<script type="text/javascript" src="<?php echo JURI::root();?>modules/mod_vtem_imageshow/js/jquery.skitter.js"></script>
<script type="text/javascript">
var vtemimageshow = jQuery.noConflict();
(function($) {
$(document).ready(function(){
$('#<?php echo $slideID;?>').skitter({
		interval: 				<?php echo $slideSpeed;?>, 
		animation: 				'<?php echo $fx;?>',
		numbers: 				<?php echo $numbers;?>,
		navigation:			 	<?php echo $prev_next;?>,
		label:					false,
		enable_navigation_keys: true,
		link_target:            '<?php echo $target;?>',
		thumbs: 				<?php echo $thumbs;?>,
		dots: 					<?php echo $dots;?>,
		numbers_align: '<?php echo $navigation_align;?>'
});
$('#hideslideshow').click(function () {
            $(this).stop().css({'display':'none'});
            $('#showslideshow').stop().css({'display':'block'});
			$('.vtem_image_show').stop().css({'overflow':'hidden'}).animate({'height':0},500);
        });
$('#showslideshow').click(function () {
            $(this).stop().css({'display':'none'});
            $('#hideslideshow').stop().css({'display':'block'});
			$('.vtem_image_show').stop().css({'overflow':'visible'}).animate({'height':<?php echo $height;?>},500);
        });

});
})(jQuery);
</script>
<div id="<?php echo $slideID;?>" class="vtem_image_show box_skitter box_skitter_large">
<ul>
<?php
foreach($images as $key => $img):
?>
  <li class="vtem-image-feature">
    <?php if($link_images == 1) {echo "<a href='".$urls[$key]."'>";}
	echo '<img class="vtem-carousel-image" src="'.$imagePath.$img.'" alt="VTEM Image Show" />';
	if($link_images == 1) echo "</a>";?>
  </li>
<?php endforeach;?>
</ul>
</div>
 <a id="showslideshow">Show Slideshow</a>