<?php get_header();?>

<div id="main" class="container singleContent">
  <div class="row">
    <?php
				$sideoption = get_post_meta($post->ID, 'lioit_sideoption', true);
				$side_layout = get_post_meta($post->ID, 'lioit_side_layout', true);
				?>
    <div id="mainContentRight" class="span9">
      <div class="singlePost">
        <?php if(have_posts()) : while(have_posts()) : the_post('');?>
        <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
          <?php
								$slide_sh = get_post_meta($post->ID, 'lioit_slideshow_gallery', true);
								?>
          <?php if ($slide_sh == true) { ?>
          <script type="text/javascript">
								jQuery(document).ready(function($) {
						
										//inner slideshow
									$('.postSlideshow').cycle({
									timeout:0,
									speed: 'normal',
									pager:  '.slidePager',
									next:'.slide_next',
									prev:'.slide_prev',
									before: resize_slideshow
									});
						
						function resize_slideshow(curr, next, opts, fwd){
								//get the height of the current slide
								var $ht = $(this).height();
								//set the container's height to that of the current slide
								$(this).parent().animate({
								height : $ht
										 });
						}
						$('.postSlideshow').click(function() {
							$('.postSlideshow').cycle('next');
						});
						
								});
							</script>
          <div class="postSlideshow">
            <?php
										global $wpdb, $post;
										
										$meta = get_post_meta($post->ID, 'lioit_slideshow_gallery', false);
										if (!is_array($meta)) $meta = (array) $meta;
										if (!empty($meta)) {
										$meta = implode(',', $meta);
										$images = $wpdb->get_col("
										SELECT ID FROM $wpdb->posts
										WHERE post_type = 'attachment'
										AND ID in ($meta)
										ORDER BY menu_order ASC
										");
										foreach ($images as $att) {
										// get image's source based on size, can be 'thumbnail', 'medium', 'large', 'full' or registed post thumbnails sizes
										$src = wp_get_attachment_image_src($att, 'full');
										$src = $src[0];
										?>
           <img src="<?php echo $src ?>" alt="<?php the_title(); ?>" />
            <?php  }
										} ?>
          </div>
          <!--End Slideshow-->
          <div class="slideshowControl"> <a class="slide_next"><i class="icon-angle-right"></i></a> <a class="slide_prev"><i class="icon-angle-left"></i></a>
            <div class="slidePager"></div>
          </div>
          <!--Slideshow control-->
          <?php } ?>
          <div class="articleDetails">
            <div class="articleTitle">
              <h1>
                <?php the_title(); ?>
              </h1>
            </div>
            <!--End articleTitle-->
           
          </div>
          <!--End Article Details-->
          <div class="articleContent">
            <?php
							$show_review = get_post_meta($post->ID, 'lioit_review_setting_show', true);	
							if ( $show_review  == 1 ){ ?>
            <div class="review-container">
              <?php lioit_show_review();	?>
            </div>
            <?php } ?>
            <div class="mainpostconntents">
              <?php the_content('<span class="postMore btn darkBtn buttonShadow">'. __("Read More", lioit) . '</span>'); ?>
            </div>
          </div>
          <!--End ArticleContent-->
          
          <?php if(!empty($data['show_posttags'])) { ?>
          <div class="articleTags">
            <?php the_tags('<div class="postTags">','','</div>'); ?>
          </div>
          <!--End ArticleTags-->
          <?php } ?>
          <?php if(!empty($data['show_postsocial'])) { ?>
          <?php require Lioit_TM . '/single.share.php';?>
          <?php } ?>
          <?php require Lioit_TM . '/post.nav.php';?>
          <?php if(!empty($data['show_authorinfo'])) { ?>
          <?php require Lioit_TM . '/single.author.php';?>
          <?php } ?>
        </div>
        <!--End article-->
        
        <?php if(!empty($data['show_related'])) { ?>
        
			
        
        
        
        <div class="relatedPosts">
  <div class="widgetTitle">
    <h5><i class="icon-doc"></i>
      <?php _e('You May Also Like','lioit') ?>
    </h5>
    <div class="carouselControl"> <a class="carousel-prev buttonShadow" href="#"><i class="icon-left-open"></i></a> <a class="carousel-next buttonShadow" href="#"><i class="icon-right-open"></i></a> </div>
    <!--End Control--></div>
  <div id="relatedCarousel" class="rt-carousel-wrapper" st>
    <div class="rt-carousel">
     <?php global $post; $gallery =   get_related_gallery($post->ID); ?>
                <?php if($gallery->have_posts()): ?>
      <ul id="related-carousel-list">
        <?php  while($gallery->have_posts()): $gallery->the_post(); ?>
                                <?php if(has_post_thumbnail()): ?>
        <li <?php post_class(); ?>>
          
          <div class="latestPostThumb">
            <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"> <?php the_post_thumbnail('thumb-small', array('title' => strip_tags(get_the_title()))); ?> </a> </div>
          <!--End LatestPostThumb--> 
          
        </li>
         <?php endif; endwhile; ?>
        <?php wp_reset_query(); ?>
      </ul>
      <?php endif; ?>
    </div>
  </div>
</div>
<script type="text/javascript">
	jQuery(document).ready(function($){
		
		jQuery('#related-carousel-list').carouFredSel({
			auto: false,
			prev: '.carousel-prev',
			next: '.carousel-next',
			mousewheel: true,
			swipe: {
				onMouse: true,
				onTouch: true
			}
		});
	});
</script>
        
        <?php } ?>
        <?php endwhile; ?>
        <?php  else:  ?>
        <?php  endif; ?>
        <?php comments_template('', true); ?>
        <div class="disqusContainer"></div>
      </div>
      <!--End ContentBox--> 
    </div>
    <!--End Main Content--> 
    <div class="sidebar span3">
			<?php if  (function_exists('dynamic_sidebar') && dynamic_sidebar('Single Gallery')){ }else { ?><?php } ?>
    </div><!--End smallSidebar-->
  </div>
  <!--End row--> 
  
</div>
<!--End Main-->
</div>
<!--End Content-->
<?php get_footer();?>
