<?php if (!empty($this->images)) : ?>
<style type="text/css">
#slideshow-<?php echo $this->uniqueId; ?> {
    position:relative;    
}
#slideshow-<?php echo $this->uniqueId; ?> IMG {
    position:absolute;
    top:0;
    left:0;
 /*   z-index:98;*/
}
#slideshow-<?php echo $this->uniqueId; ?> IMG.active {
   /* z-index:100;*/
}
#slideshow-<?php echo $this->uniqueId; ?> IMG.last-active {
  /*  z-index:99;*/
}
</style>
<?php if ($this->slideshow === 1) : ?>
<script type="text/javascript">
function slide<?php echo $this->uniqueId; ?>()
{
	var uId = '<?php echo $this->uniqueId; ?>';
	//alert(uniqueId);
    var active = $('#slideshow-' + uId + ' IMG.active');
	//alert(active);
    if ( active.length == 0 ) active = $('#slideshow-' + uId + ' IMG:last');
    var next =  active.next().length ? active.next() : $('#slideshow-' + uId + ' IMG:first');
    active.addClass('last-active');
    next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 250, function() {
            active.removeClass('active last-active').animate({opacity: 0}, 150);
        });
}
$(function() {
	setInterval( "slide<?php echo $this->uniqueId; ?>()", <?php echo $this->time; ?>);
});
</script>
<div id="slideshow-<?php echo $this->uniqueId;?>" class="imgrotator" style="width:<?php echo $this->desiredWidth; ?>px;height:<?php echo $this->desiredHeight; ?>px;overflow:hidden;">
<?php foreach($this->images as $key => $image) : ?>
<?php if ($key == 0) : ?>
    <img width="<?php echo $this->desiredWidth; ?>" src="<?php echo $this->url . 'public/images/' . $this->folder . $this->sourceFolder . $image; ?>" class="active"/>
<?php else: ?>
    <img width="<?php echo $this->desiredWidth; ?>" src="<?php echo $this->url . 'public/images/' . $this->folder . $this->sourceFolder . $image; ?>" style="opacity:0;"/>
<?php endif; ?>
<?php endforeach; ?>
</div>
<?php else: ?>
<div id="slideshow-<?php echo $this->uniqueId;?>" class="imgrotator" style="width:<?php echo $this->desiredWidth; ?>px;height:<?php echo $this->desiredWidth; ?>px;overflow:hidden;">
<?php $key = array_rand($this->images,1); ?>
<img src="<?php echo $this->url . 'public/images/' . $this->folder . $this->sourceFolder . $this->images[$key]; ?>" class="active"/>
</div>
<?php endif; ?>
<?php endif; ?>