<?php $related = get_related_posts($post->ID); ?>
<?php if($related->have_posts()): ?>

<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-angle-left"></i></a> <a class="carousel-next buttonShadow" href="#"><i class="icon-angle-right"></i></a> </div>
    <!--End Control--></div>
  <div id="relatedCarousel" class="rt-carousel-wrapper" st>
    <div class="rt-carousel">
      <ul id="related-carousel-list">
        <?php while($related->have_posts()): $related->the_post(); ?>
        <?php if(has_post_thumbnail()): ?>
        <?php 
			$thumb = get_post_thumbnail_id();
			$img_url = wp_get_attachment_url( $thumb,'full' ); 
			$image = $img_url; 
		?>
        <li <?php post_class(); ?>>
        
          <div class="latestPostThumb">
           
           <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">
                                        <?php the_post_thumbnail('main-block', array('title' => strip_tags(get_the_title()))); ?>
                                        </a></div>
          <!--End LatestPostThumb--> 
          
        </li>
        <?php endif; endwhile; ?>
        <?php wp_reset_query(); ?>
      </ul>
    </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 endif; ?>
