<?php get_header(); ?>
<?php if(get_option('tigu_homepage-news-ticker') == 'true' && get_option('tigu_newsticker_single_post') == 'true'): ?>
<div class="newstickers" style="height:36px;"><?php jnewsticker_display( get_option('tigu_ticker_choosed_id') ) ?></div>
<?php endif; ?>
<?php $featured_image = get_post_meta(get_the_ID(), 'tiguan_featured_image', true); ?>
<!-- START SINGLE -->

<div id="below">
<?php if(get_option('tigu_lights') == 'true'): ?><div id="shadow"></div><?php endif; ?>

<?php
$custom_meta = get_post_custom($post->ID);
$instructions = !empty($custom_meta['custom_meta_instructions'][0]) ? $custom_meta['custom_meta_instructions'][0] : NULL;
$difficulty = !empty($custom_meta['custom_meta_difficulty'][0]) ? $custom_meta['custom_meta_difficulty'][0] : NULL;
$gamefile = !empty($custom_meta['custom_meta_gamefile'][0]) ? $custom_meta['custom_meta_gamefile'][0] : NULL;
if ( !$instructions && is_myarcade_game() && !empty($custom_meta['mabp_instructions'][0]) ) {
$instructions = $custom_meta['mabp_instructions'][0];
}
?>

<!-- ************************************************************ -->

<!-- START GAME FILE -->

<?php if( $gamefile || is_myarcade_game() ): ?>

<div class="game-title">
<?php if(get_option('tigu_lights') == 'true'): ?>
<div id="above">
<?php endif; ?>
<h3>
<?php if(get_option('tigu_now_playing') == 'true'): ?>
<?php echo get_option('tigu_nowplaying_text', 'You are now playing'); ?> 
<span style="color:#<?php echo get_option('tigu_global-style'); ?>">&raquo;</span>
<?php endif; ?>
<?php the_title(); ?> 

<?php if(get_option('tigu_lights') == 'true'): ?><span class="lights-on" style="width:<?php echo get_option('tigu_toggle_light_width'); ?>px;" onclick="clicksound.playclip(); toggle();"><?php echo get_option('tigu_toggle_light_text'); ?></span><?php endif; ?></h3>
<?php if(get_option('tigu_lights') == 'true'): ?>
</div>
<?php endif; ?>
</div>

<div class="game-background">

<?php if(get_option('tigu_banner728x90_on') == 'true'): ?>
<!-- START 728x90 BANNER -->
<?php if(get_option('tigu_post_728x90_image')): ?>
<div id="banner728x90" class="banner728x90" style="margin-bottom:<?php echo (get_option('tigu_marginbottom_adsensetos')); ?>;">
<a target="<?php echo (get_option('tigu_post_728x90_target')); ?>" href="<?php echo (get_option('tigu_post_728x90_url')); ?>" title="<?php echo (get_option('tigu_post_728x90_title')); ?>"><img src="<?php echo (get_option('tigu_post_728x90_image')); ?>" alt="<?php echo (get_option('tigu_post_728x90_alt')); ?>"></a>
</div>
<?php else: ?>
<div id="banner728x90" class="banner728x90" style="margin-bottom:<?php echo (get_option('tigu_marginbottom_adsensetos')); ?>">
<?php echo stripslashes (get_option('tigu_banner728x90')); ?>
</div>
<?php endif; ?>
<!-- END 728x90 BANNER -->
<?php endif; ?>

<div id="above">

  <?php 
  if ( get_option('tigu_progressbar_enable') == 'true' ) {
    $gamesize='0px';
    get_template_part('/includes/progressbar');
    ?>
    <div align="center">
    <div id="showprogressbar" style="display:block;"> 
<div id="loadinggame_ad">

<?php if(get_option('tigu_banner_game_load') == 'true'): ?>

<?php if(get_option('tigu_banner_game_load_image')): ?>
<div id="banner_gamead" class="banner_gamead">
<a target="<?php echo (get_option('tigu_banner_game_load_target')); ?>" href="<?php echo (get_option('tigu_banner_game_load_url')); ?>" title="<?php echo (get_option('tigu_banner_game_load_title')); ?>"><img src="<?php echo (get_option('tigu_banner_game_load_image')); ?>" alt="<?php echo (get_option('tigu_banner_game_load_alt')); ?>"></a>
</div>
<?php else: ?>
<div id="banner_gamead" class="banner_gamead">
<?php echo stripslashes (get_option('tigu_banner_game_load_code')); ?>
</div>
<?php endif; ?>
<?php else: ?>
 <div style="margin-top:160px;"></div>  
<?php endif; ?>

</div>                  
        <div id="progressbar" style="width:400px; background-color: #<?php echo get_option('tigu_progressbarbackgroundcolor'); ?>; border: solid 1px #<?php echo get_option('tigu_progressbarbordercolor'); ?>;"> 
        <span id="progresstext" style="color: #<?php echo get_option('tigu_progressbartextcolor'); ?>">0%</span> 
        <div id="progressbarloadbg" style="background-color: #<?php echo get_option('tigu_progressbarloadcolor'); ?>; border-right: solid 1px #<?php echo get_option('tigu_progressbarbordercolor'); ?>; z-index: 2;">&thinsp;</div>
      </div>
    </div>
    </div>
    
    <div id="progressbarloadtext" style="display:none; text-align: center; color: #<?php echo get_option('tigu_progressbarmessagetextcolor'); ?>; margin-top: 10px;"  onclick="window.hide();"> 
      <?php echo stripslashes (get_option('tigu_progressbar_text')); ?>
    </div>
    <?php
  }
  else {  
    $gamesize='100%';
  }
  ?>   
  
  <div class="clear"></div>
 <div id="my_game" style="overflow:hidden; height: <?php echo $gamesize; ?>; width: <?php echo $gamesize; ?>;">
<?php if ($gamefile) : ?>
<?php echo do_shortcode( $gamefile ) ?>
<?php else: ?>
<?php
if (function_exists('get_game')) {
$embedcode = get_game($post->ID);
global $mypostid; $mypostid = $post->ID;
echo myarcade_get_leaderboard_code();
echo $embedcode;
}
?>
<?php endif; ?>
</div>
</div>
</div>

<!-- END GAME FILE -->

<!-- ************************************************************ -->

<!-- START GAME NAVIGATION & STATISTICS -->

<div class="gamestuffbelow">
<div class="navigation-game">
<?php
$prev_post = get_previous_post();
if (!empty( $prev_post )): ?>
<a class="btn_backward tooltip" title="<?php echo $prev_post->post_title; ?>" href="<?php echo get_permalink( $prev_post->ID ); ?>"></a>
<?php endif; ?>

<?php
$next_post = get_next_post();
if (!empty( $next_post )): ?>
<a class="btn_forward tooltip" title="<?php echo $next_post->post_title; ?>" href="<?php echo get_permalink( $next_post->ID ); ?>"></a>
<?php endif; ?>
</div>

<div class="gamestuffcenter">
<?php if(get_option('tigu_post_counters') == 'true'): ?>
<div class="gamestuff">

<?php if ( !defined('MYARCADE_VERSION') ): ?>
<?php if(get_option('tigu_difficulty') == 'true'): ?>
<span class="stick">
<span class="difficulty"><?php _e('Difficulty', 'Gameleon'); ?> : <span class="difficultytext"><?php echo $difficulty; ?></span>
</span></span>
<?php endif; ?>
<?php endif; ?>

<?php if(get_option('tigu_mostplayed_post') == 'true'): ?>
<span class="stick">
<span class="clubs"><?php echo getMostPlayed(get_the_ID()); ?></span> <span style="color:#009ed2; text-transform:uppercase"><?php _e('plays', 'Gameleon'); ?></span>
</span>
<?php endif; ?>

<?php if(get_option('tigu_likes_post') == 'true'): ?>
<span class="stick">
<?php _e('Likes', 'Gameleon'); ?>: <?php echo $wp_superlike->show_likes($post->ID);?>
</span>
<?php endif; ?>

<?php if(get_option('tigu_comments_post') == 'true'): ?>
<span class="stick-com">
<?php $comment_count = get_comment_count($post->ID); ?>
<?php if ($comment_count['approved'] > 0) : ?>
<span class="heading-comments-exist">

<?php if( get_option('tigu_comments_type', 'WordPress') == 'WordPress') : ?>
<?php comments_popup_link('0','1','%'); ?>
<?php else: ?>
<fb:comments-count href="<?php echo get_permalink($post->ID); ?>"></fb:comments-count>
<?php endif; ?>

</span>
<?php else: ?>
<span class="heading-comments">
<?php if( get_option('tigu_comments_type', 'WordPress') == 'WordPress') : ?>
<?php comments_popup_link('0','1','%'); ?>
<?php else: ?>
<fb:comments-count href="<?php echo get_permalink($post->ID); ?>"></fb:comments-count>
<?php endif; ?>

</span>
<?php endif; ?>
</span>
<?php endif; ?>
<?php if(get_option('tigu_replay') == 'true'): ?>
<input type="button" class="replay" value="<?php echo get_option('tigu_replay_text', 'Play Again'); ?>" onClick="window.location.href=window.location.href">
<?php endif; ?>
</div>
<?php endif; ?>
</div>
</div>
<?php endif; ?>

<!-- END GAME NAVIGATION & STATISTICS -->

<?php if(get_option('tigu_all_tabs') == 'true'): ?>
<?php include(TEMPLATEPATH.'/single-tabs-games.php'); ?>
<?php endif; ?>

<div id="main">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php setMostPlayed(get_the_ID()); ?>

<?php if(get_option('tigu_categories') == 'true'): ?>
<div class="grids_box_sidebar" style="border-bottom:#d5d5d5 solid 1px !important"><div class="widget-title-2"><h3><?php the_category(', ') ?> &raquo;</h3><h1><?php the_title(); ?></h1></div></div>
<?php else: ?>
<div class="grids_box_sidebar" style="border-bottom:#d5d5d5 solid 1px !important"><div class="widget-title"><h1><?php the_title(); ?></h1></div></div>
<?php endif; ?>

<!-- ADS START -->
<div class="gamepage">
 
<!-- ************************************* -->
<?php if(get_option('tigu_featured-ads') == 'Advertisement and text content'): ?>

<?php if ($featured_image == 'No'): ?>
<?php else: ?>

<?php if(get_option('tigu_banner300x250_on') == 'true'): ?>
<!-- START 300x250 BANNER -->

<?php if(get_option('tigu_post_300x250_image')): ?>
   <div id="banner300x250" class="banner300x250" style="margin-bottom:5px;">
<a target="<?php echo (get_option('tigu_post_300x250_target')); ?>" href="<?php echo (get_option('tigu_post_300x250_url')); ?>" title="<?php echo (get_option('tigu_post_300x250_title')); ?>"><img src="<?php echo (get_option('tigu_post_300x250_image')); ?>" alt="<?php echo (get_option('tigu_post_300x250_alt')); ?>"></a>
</div>
<?php else: ?>
<div id="banner300x250" class="banner300x250" style="margin-bottom:5px;">
<?php echo stripslashes (get_option('tigu_banner300x250')); ?>
</div>
<?php endif; ?>

<!-- END 300x250 BANNER -->
<?php endif; ?>
<?php endif; ?>

<div class="post-entry">
<?php the_content(); ?>
</div>

<!-- ADS END -->
<?php endif; ?>

<!-- **************************************** -->

<?php if(get_option('tigu_featured-ads', 'Featured Image and text content') == 'Featured Image and text content'): ?>
<!-- START FEATURED IMAGE -->
  <script type="text/javascript">
  jQuery(document).ready(function($) {
    $('.post-entry a').has('img').addClass('prettyPhoto');
  });
  </script>  

<?php if ($featured_image == 'No'): ?>
 

<?php else: ?>

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

<?php if(get_option('tigu_myarcade_image_post') == 'Small size - 100x100 px'): ?>
<div class="game-image-myarcade">
<?php else: ?>
<div class="game-image">
<?php endif; ?>

<a href="<?php echo $image[0]; ?>" rel="prettyPhoto">
<?php if(get_option('tigu_myarcade_image_post') == 'Small size - 100x100 px'): ?>
<img src="<?php echo $image[0]; ?>" width="100" height="100" alt="<?php the_title(); ?>" />
<?php else: ?>
<img src="<?php echo $image[0]; ?>" width="292" height="242" alt="<?php the_title(); ?>" />
<?php endif; ?>
</a>
</div>
<?php else: ?>
<?php if(get_option('tigu_myarcade_image_post') == 'Small size - 100x100 px'): ?>
<div class="game-image-myarcade">
<img src="<?php echo get_template_directory_uri(); ?>/images/thumbnail-post.png" width="100" height="100" alt="<?php the_title(); ?>" />
</div>
<?php else: ?>
<div class="game-image">
<img src="<?php echo get_template_directory_uri(); ?>/images/thumbnail-post.png" width="292" height="242" alt="<?php the_title(); ?>" />

</div>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>

<div class="post-entry">
<?php the_content(); ?>
</div>

<!-- END FEATURED IMAGE -->
<?php endif; ?>

<!-- ************************************************************************************ -->

<?php if(get_option('tigu_featured-ads') == 'Random'): ?>
<!-- RANDOM START -->
<ul id="randomize">

<li>

<?php if ($featured_image == 'No'): ?>
<?php else: ?>

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

<?php if(get_option('tigu_myarcade_image_post') == 'Small size - 100x100 px'): ?>
<div class="game-image-myarcade">
<?php else: ?>
<div class="game-image">
<?php endif; ?>

<?php if(get_option('tigu_myarcade_image_post') == 'Small size - 100x100 px'): ?>
<img src="<?php echo $image[0]; ?>" width="100" height="100" alt="<?php the_title(); ?>" />
<?php else: ?>
<img src="<?php echo $image[0]; ?>" width="292" height="242" alt="<?php the_title(); ?>" />
<?php endif; ?>
</a>
</div>
<?php else: ?>

<?php if(get_option('tigu_myarcade_image_post') == 'Small size - 100x100 px'): ?>
<div class="game-image-myarcade">
<?php else: ?>
<div class="game-image">
<?php endif; ?>

<?php if(get_option('tigu_myarcade_image_post') == 'Small size - 100x100 px'): ?>
<img src="<?php echo $image[0]; ?>" width="100" height="100" alt="<?php the_title(); ?>" />

<?php else: ?>
<img src="<?php echo get_template_directory_uri(); ?>/images/thumbnail-post.png" width="292" height="242" alt="<?php the_title(); ?>" />

<?php endif; ?>
</div>

<?php endif; ?>
<?php endif; ?>
<div class="post-entry">
<?php the_content(); ?>
</div>

</li>
<li>

<?php if ($featured_image == 'No'): ?>
<?php else: ?>

<?php if(get_option('tigu_banner300x250_on') == 'true'): ?>
<!-- START 300x250 BANNER -->
<?php if(get_option('tigu_post_300x250_image')): ?>
<div id="banner300x250" class="banner300x250">
<a target="<?php echo (get_option('tigu_post_300x250_target')); ?>" href="<?php echo (get_option('tigu_post_300x250_url')); ?>" title="<?php echo (get_option('tigu_post_300x250_title')); ?>"><img src="<?php echo (get_option('tigu_post_300x250_image')); ?>" alt="<?php echo (get_option('tigu_post_300x250_alt')); ?>"></a>
</div>
<?php else: ?>
<div id="banner300x250" class="banner300x250">
<?php echo stripslashes (get_option('tigu_banner300x250')); ?>
</div>
<?php endif; ?>
<?php endif; ?>
<!-- END 300x250 BANNER -->
<?php endif; ?>

<div class="post-entry">
<?php the_content(); ?>
</div>

</li>

</ul>
<!-- RANDOM END -->
<?php endif; ?>

<!-- ************************************************************************************ -->

</div>
<?php if(get_option('tigu_postshare_box') == 'true'): ?>
<!-- START POST SHARE -->
<?php get_template_part('post-share'); ?>
<!-- END POST SHARE -->
<?php endif; ?>

<?php if(get_option('tigu_banner468x60_on') == 'true'): ?>
<!-- START 468X60 BANNER -->
<?php if(get_option('tigu_post_468x60_image')): ?>
<div id="banner468x60" class="banner468x60">
<a target="<?php echo (get_option('tigu_post_468x60_target')); ?>" href="<?php echo (get_option('tigu_post_468x60_url')); ?>" title="<?php echo (get_option('tigu_post_468x60_title')); ?>"><img src="<?php echo (get_option('tigu_post_468x60_image')); ?>" alt="<?php echo (get_option('tigu_post_468x60_alt')); ?>"></a>
</div><div class="toppad"></div>
<?php else: ?>
<div id="banner468x60" class="banner468x60">
<?php echo stripslashes (get_option('tigu_banner468x60')); ?>
</div><div class="toppad"></div>
<?php endif; ?>
<!-- END 468X60 BANNER -->
<?php endif; ?>


<div class='clear'></div>

<?php wp_reset_query(); ?>

<!-- START COMMENTS AREA -->

<?php if( get_option('tigu_comments_type', 'WordPress') == 'WordPress') : ?>
<div class="grids_box_sidebar" style="border-bottom:#d5d5d5 solid 1px !important">
<div class="widget-title">

<h3><?php _e('Comments', 'Gameleon'); ?>:</h3>

</div>
</div>
<div id="comments">
<div class="gamepage">
<div class="gamepagewhite">
<?php comments_template(); ?>

</div>
</div>
</div>

<?php elseif( get_option('tigu_comments_type', 'WordPress') == 'Facebook') : ?>
<div class="grids_box_sidebar" style="border-bottom:#d5d5d5 solid 1px !important">
<div class="widget-title">

<h3><?php _e('Facebook Comments', 'Gameleon'); ?>:</h3>

</div>
</div>
<div id="comments">
<div class="gamepage">
<div class="gamepagewhite">
<?php $url = (!empty($_SERVER['HTTPS'])) ? "https://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] : "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; ?>	
<div class="fb-comments" data-href="<?php echo $url; ?>" data-num-posts="10" data-width="630"></div>

</div>
</div>
</div>


<?php elseif( get_option('tigu_comments_type', 'None') == 'None') : ?>

<?php else: ?>

<?php comments_template(); ?>

<?php endif; ?>

<?php if(get_option('tigu_pagination') == 'true'): ?>
<div class="hide-pagination-code">
<?php paginate_links();
$args="";
wp_link_pages( $args );
?>
</div>
<?php endif; ?>


<!-- END COMMENTS AREA -->

<br class='clear'>
<?php endwhile; endif; ?>

</div>
</div>

<!-- END SINGLE -->
<script>var clicksound=createsoundbite("<?php echo get_template_directory_uri(); ?>/sounds/click.ogg", "<?php echo get_template_directory_uri(); ?>/sounds/click.mp3")</script>
<?php get_sidebar(); ?>
<?php get_footer(); ?>