<?php if(get_option('tigu_featured_slider') == 'true' && get_option('tigu_featured_tags')): ?>
<?php
$post_types = get_post_types();
unset($post_types['page'], $post_types['attachment'], $post_types['revision'], $post_types['nav_menu_item']);
if ( defined('MYARCADE_VERSION') ) {
  $featured_posts = new WP_Query(array(
  'post_type' => $post_types,
  'showposts' => $posts_per_page,
  'tag' => get_option('tigu_featured_tags'),
  'meta_query' => array (
    array(
      'key' => 'mabp_screen1_url',
      'value' => 'http',
      'compare' => 'LIKE'
    )
  )
 ));  
}
 
if ( !is_object( empty($featured_posts) ) || !$featured_posts->have_posts() ) {
  // Try another query
  $featured_posts = new WP_Query(array(
  'post_type' => $post_types,
  'showposts' => get_option('tigu_slider_number', '3'),
  'tag' => get_option('tigu_featured_tags')
  ));  
}
?>

<?php if(get_option('tigu_featured_slider') == 'true' && get_option('tigu_slider_type') == 'Flexslider'): ?>
<?php wp_register_script('flexslider', get_template_directory_uri() . '/js/jquery.flexslider-min.js', 'jquery');
      wp_enqueue_script('flexslider');

   ?>
<!-- START FLEXSLIDER -->

<div class="flex-container">
<div class="flexslider">
<ul class="slides">    
<?php while($featured_posts->have_posts()): $featured_posts->the_post(); ?>
<?php if(has_post_thumbnail() || is_myarcade_game() ): ?>
<?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'slider-image'); ?>
<?php if ( empty($image[0]) ) $image[0] = myarcade_featured_image(); ?>

<li>
<a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'>

<img src="<?php echo $image[0]; ?>" width="633" height="270" alt="<?php the_title(); ?>" />

</a>
 
<?php if(get_option('tigu_sliders_caption') == 'true'): ?>
<div class="flex-caption">

    <table>
      <tr>
        <td><h1><a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'><?php the_title(); ?></a></h1></td>
        <td>
<?php if(get_option('tigu_flex_plays') == 'true'): ?>
<div class="paddgrey">
<span class="flex-caption-plays">
<?php if( get_option('tigu_template_type', 'WordPres Default') == 'WordPres Default') : ?>
<?php _e('Views', 'Gameleon'); ?>: <?php echo getMostPlayed(get_the_ID()); ?> 
<?php else: ?>
<?php _e('Played', 'Gameleon'); ?>: <?php echo getMostPlayed(get_the_ID()); ?> <?php _e('times', 'Gameleon'); ?>
<?php endif; ?>
</span>
</div> 
 <?php endif; ?>
        </td>
      </tr>
    </table>
<p class="flex-caption-text"><?php echo get_excerpt(190); ?></p>
     </div>
<?php endif; ?>

</li>

<?php else: ?>

 <li>
<a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'>

<img src="<?php echo get_template_directory_uri(); ?>/images/thumbnail-slider.png" width="633" height="270" alt="<?php the_title(); ?>" />
</a>
 </li>

<?php endif; ?>
<?php endwhile; ?>
</ul>

</div>  
</div> 
<script type="text/javascript">
jQuery(document).ready(function ($) {
 $('.flexslider').flexslider({
                animation: "<?php echo get_option('tigu_flexslider_animation', 'fade'); ?>", 
				direction: "horizontal",
				slideshow: "true",
				slideshowSpeed: "<?php echo get_option('tigu_flex_speed', '7000'); ?>",  
                animationSpeed: <?php echo get_option('tigu_flex_animspeed', '600'); ?>, 
                randomize: <?php echo get_option('tigu_flex_randomize', 'true'); ?>,
                controlNav: <?php echo get_option('tigu_flex_bullets', 'true'); ?>,
                pauseOnAction: true,
                pauseOnHover: <?php echo get_option('tigu_flex_pause_hover', 'true'); ?>,
				directionNav: "<?php if(get_option('tigu_flex_direction_nav') == 'true'): ?>true<?php endif; ?>"             
               });
});
</script>

<!-- END FLEXSLIDER-->

<?php endif; ?>

<?php if(get_option('tigu_featured_slider') == 'true' && get_option('tigu_slider_type') == 'Elastic Slideshow Slider'): ?>
<?php wp_register_script('eislideshow', get_template_directory_uri() . '/js/jquery.eislideshow.js', 'jquery');
      wp_enqueue_script('eislideshow');

   ?>
<!-- ELASTIC SLIDER -->

<div id="ei-slider" class="ei-slider" <?php if(get_option('tigu_elastic_thumbs') == 'false'): ?>style="height:270px;padding-bottom:15px;"<?php endif; ?>>
<ul class="ei-slider-large">

<?php while($featured_posts->have_posts()): $featured_posts->the_post(); ?>
<?php if(has_post_thumbnail() || is_myarcade_game() ): ?>
<?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'slider-image'); ?>
<?php if ( empty($image[0]) ) $image[0] = myarcade_featured_image(); ?>

<li>
<?php if ( empty($image[0]) ) $image[0] = myarcade_featured_image(); ?>
  <a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'>

<img src="<?php echo $image[0]; ?>" width="633" height="<?php if(get_option('tigu_elastic_thumbs') == 'false'): ?>270<?php else: ?>262<?php endif; ?>" alt="<?php the_title(); ?>" />

</a>
<?php else: ?>
  <a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'>

<img src="<?php echo get_template_directory_uri(); ?>/images/thumbnail-slider.png" width="633" height="<?php if(get_option('tigu_elastic_thumbs') == 'false'): ?>270<?php else: ?>262<?php endif; ?>" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" />

</a>
<?php endif; ?>
<?php if(get_option('tigu_sliders_caption') == 'true'): ?>
            <div class="ei-title">
                <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
                <h3><?php echo get_excerpt(150); ?></h3>
            </div>
<?php endif; ?>
</li>

<?php endwhile; ?>
    </ul>
    <ul class="ei-slider-thumbs" <?php if(get_option('tigu_elastic_thumbs') == 'false'): ?>style="display:none"<?php endif; ?>>
        <li class="ei-slider-element" <?php if(get_option('tigu_elastic_thumbs') == 'false'): ?>style="display:none"<?php endif; ?>>Current</li>
<?php while($featured_posts->have_posts()): $featured_posts->the_post(); ?>
<?php if(has_post_thumbnail() || is_myarcade_game() ): ?>
<?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'blog-style-image'); ?>
<?php if ( empty($image[0]) ) $image[0] = myarcade_featured_image(); ?>
        <li <?php if(get_option('tigu_elastic_thumbs') == 'false'): ?>style="display:none"<?php endif; ?>>
           <a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'></a>
<img src="<?php echo $image[0]; ?>" width="174" height="95" alt="<?php the_title(); ?>" />
<?php else: ?>
  <a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'>
<img src="<?php echo get_template_directory_uri(); ?>/images/thumbnail-post.png" width="174" height="100" alt="<?php the_title(); ?>" />

</a>
<?php endif; ?>
        </li>
      <?php endwhile;?>
    </ul> 
 
</div>

<script type="text/javascript">
            jQuery(function() {
                jQuery('#ei-slider').eislideshow({
					animation			: '<?php echo get_option('tigu_elastic_animation', 'center'); ?>',
					autoplay			: <?php echo get_option('tigu_elastic_autoplay', 'true'); ?>,
					slideshow_interval	: <?php echo get_option('tigu_elastic_interval', '4000'); ?>,
					speed          		: <?php echo get_option('tigu_elastic_speed', '800'); ?>,
					titlesFactor		: <?php echo get_option('tigu_elastic_titfactor', '0.60'); ?>,
					titlespeed          : <?php echo get_option('tigu_elastic_titspeed', '500'); ?>,
					thumbMaxWidth       : <?php echo get_option('tigu_elastic_thumbwidth', '174'); ?>
                });
            });
        </script>

<!-- END ELASTIC SLIDER-->
		
<?php endif; ?>

<?php if(get_option('tigu_featured_slider') == 'true' && get_option('tigu_slider_type') == 'Refineslide'): ?>
<!-- REFINESLIDE -->
<?php wp_register_script('refineslide', get_template_directory_uri() . '/js/jquery.refineslide.min.js', 'jquery');
      wp_enqueue_script('refineslide');

   ?>
<div class="refheight">
<ul class="rs-slider">
<?php while($featured_posts->have_posts()): $featured_posts->the_post(); ?>
<?php if(has_post_thumbnail() || is_myarcade_game() ): ?>
<?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'slider-image'); ?>
<?php if ( empty($image[0]) ) $image[0] = myarcade_featured_image(); ?>
    <li><a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'>

<img src="<?php echo $image[0]; ?>" width="633" height="270" <?php if(get_option('tigu_sliders_caption') == 'true'): ?>title="<?php the_title(); ?>"<?php endif; ?> alt="<?php the_title(); ?>" />

</a>

<?php if(get_option('tigu_sliders_caption') == 'true'): ?>    
<div class="rs-caption">
   <table>
      <tr>
        <td><h1><a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'><?php the_title(); ?></a></h1></td>
        <td>
<?php if(get_option('tigu_ref_plays') == 'true'): ?>
<div class="paddgrey">
<span class="rs-caption-plays">
<?php if( get_option('tigu_template_type', 'WordPres Default') == 'WordPres Default') : ?>
<?php _e('Views', 'Gameleon'); ?>: <?php echo getMostPlayed(get_the_ID()); ?> 
<?php else: ?>
<?php _e('Played', 'Gameleon'); ?>: <?php echo getMostPlayed(get_the_ID()); ?> <?php _e('times', 'Gameleon'); ?>
<?php endif; ?>
</span>
</div>
<?php endif; ?>
        </td>
      </tr>
    </table>
<p class="rs-caption-text"><?php echo get_excerpt(190); ?></p>         
 </div>
  <?php endif; ?>
</li>
<?php else: ?>
    <li><a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'>

<img src="<?php echo get_template_directory_uri(); ?>/images/thumbnail-slider.png" width="633" height="270" alt="<?php the_title(); ?>" />

</a>
    </li>
  <?php endif; ?>
<?php endwhile; ?>
</ul>
</div>
<script type='text/javascript'>
    jQuery(document).ready(function ($) {
           $('.rs-slider').refineSlide({
            maxWidth: 633,
            transition: '<?php echo get_option('tigu_ref_transition', 'random'); ?>',
            fallback3d: '<?php if(get_option('tigu_ref_fallback3d') == 'true'): ?>sliceV<?php endif; ?>',
            captionWidth: 100,
            transitionDuration: <?php echo get_option('tigu_ref_duration', '800'); ?>,
            autoPlay: <?php echo get_option('tigu_ref_autoplay', 'true'); ?>,
            keyNav: <?php echo get_option('tigu_ref_keyboard', 'true'); ?>,
            delay: <?php echo get_option('tigu_ref_delay', '5000'); ?>,
            arrowTemplate: '<?php if(get_option('tigu_ref_arrows') == 'true'): ?><div class="rs-arrows"><a href="#" class="rs-prev"></a><a href="#" class="rs-next"></a></div><?php endif; ?>',
            controls: 'arrows',
        });
    });
</script>

<!-- END REFINESLIDE -->

<?php endif; ?>

<?php endif; ?>