<?php
  /**
   * Copyright 2011 Zazavi - http://www.zazavi.com
   * Zazavi is free software released under the terms of the GNU General Public License.
   * You should have received a copy of the license.  If not, see <http://www.gnu.org/licenses/>.
   */
  if (!defined("_VALID_PHP"))
      die('Direct access to this location is not allowed.');
  
  require_once(ZAZAVILITE . "admin/modules/jqueryslider/admin_class.php");
  $slider = new jQuerySlider();
  $slides = $slider->getSliderImages();
  $conf = $slider->getConfiguration();
  //$totalslides = count($slides)
?>
<!-- Start jQuery Slider -->
<?php if($slides == 0):?>
<div class="error">You don't have any images uploaded yet</div>
<?php else:?>
<div id="slider-wrapper">
  <div id="slider" class="nivoSlider">
    <?php foreach ($slides as $slrow):?>
    <a href="<?php echo $slrow['url']?>" <?php echo ($slrow['urltype'] == "ext") ? "target=\"_blank\"" : "target=\"_self\"";?>><img src="<?php echo SITEURL;?>/modules/jqueryslider/slides/<?php echo $slrow['filename']?>" alt="" title="<?php echo ($conf['showcaption']) ? $slrow['title'.$core->dblang] : '';?>" /></a>
    <?php endforeach;?>
  </div>
</div>
<script type="text/javascript">
$(window).load(function() {
    $('#slider').nivoSlider({
        effect:'<?php echo $conf['animation'];?>', //Specify sets like: 'fold,fade,sliceDown,sliceUp,random'
        slices:15,
        animSpeed:<?php echo $conf['anispeed'];?>, //Slide transition speed
        pauseTime:<?php echo $conf['anitime'];?>,
        directionNav:<?php echo $conf['shownav'];?>, //Next & Prev
        directionNavHide:<?php echo $conf['shownavhide'];?>, //Only show on hover
        controlNav:<?php echo $conf['controllnav'];?>, //1,2,3...
        keyboardNav:true, //Use left & right arrows
        pauseOnHover:<?php echo $conf['hoverpause'];?>, //Stop animation while hovering
        captionOpacity:0.7 //Universal caption opacity
    });
});
</script>
<?php endif;?>
<!-- End jQuery Slider /-->