
<div id="sb_slider_box">

<ul id="sb-slider" class="sb-slider">

<?php 
    $featucat = get_option('op_feat_cat');
	$slides = get_option('op_feat_slides');
	if (get_option('op_recent_featured_flex') == 'Recent posts') {
	$my_query = new WP_Query('showposts='. $slides .'');	
	} else {
    $my_query = new WP_Query('showposts='. $slides .'&category_name='. $featucat .'');	
	}
    if ($my_query->have_posts()) :
    ?>					
		
    <?php while ($my_query->have_posts()) : $my_query->the_post();$do_not_duplicate = $post->ID; ?>	
	
	<?php $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'post-thumbnails', false, '' ); $thumbnailSrc = $src[0]; ?>	
	<?php $image = aq_resize( $thumbnailSrc, 1140, 600, true ); ?>

	<li>
		<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
		<img alt="<?php the_title(); ?>" src="<?php echo $image ?>" />
		</a>
		
		<div class="sb-description">
		<h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
		</div>
	</li>
	
	<?php endwhile; wp_reset_query(); ?> 
    <?php endif; ?>   
		
</ul>

<div id="shadow" class="shadow"></div>

<div id="nav-arrows" class="nav-arrows">
	<a href="#">Next</a>
	<a href="#">Previous</a>
</div>

</div>

<script type="text/javascript">
jQuery(document).ready(function($){  
   
var Page = (function() {

					var $navArrows = $( '#nav-arrows' ).hide(),
						$shadow = $( '#shadow' ).hide(),
						slicebox = $( '#sb-slider' ).slicebox( {
							onReady : function() {

								$navArrows.show();
								$shadow.show();

							},
							orientation : 'v',
							cuboidsRandom : true,
							autoplay : true,
                            interval: 5000,
					
						} ),
						
						init = function() {

							initEvents();
							
						},
						initEvents = function() {

							// add navigation events
							$navArrows.children( ':first' ).on( 'click', function() {

								slicebox.next();
								return false;

							} );

							$navArrows.children( ':last' ).on( 'click', function() {
								
								slicebox.previous();
								return false;

							} );

						};

						return { init : init };

				})();

				Page.init();

});
</script>
