<div class="scroll-container">

    <!-- ************** - UI Scroller - ************** -->
    <h3><?php echo $title ?></h3>
    <?php $posts_ids = explode(',', $content); ?>
	
	
    <div class="scroller_wrap">
        <div class="scroller_block">
            <ul style="width:<?php echo count($posts_ids) * 250 - 20 ?>px">
				
                <?php for ($i = 0; $i < count($posts_ids); $i++): ?>

                    <?php
                    $post_id = $posts_ids[$i];
                    $post = get_post($post_id);
					
                    $permalink = get_permalink($post_id);
					
					if (empty ($post)) {
						
						$video_url_id=$post_id;
						$video_type = 'youtube.com';
						$allows_array = array('youtube.com', 'vimeo.com', '.mp4');

								foreach ($allows_array as $needle) {
									$count = substr_count($video_url_id, $needle);
									if ($count) {
										$video_type = $allows_array[$key];
										$video_url=$post_id;
										//echo "video_url=".$video_url;
									
								?>
								
								
								
								
					<li>
						<div class="scroll-caption small-custom-frame">
							
							
							<?php
							$video_width = 222;
							$video_height = 137;
							
                           
	
							if (!empty($video_url)) {
								$video_type = 'youtube.com';
								$allows_array = array('youtube.com', 'vimeo.com', '.mp4');

								foreach ($allows_array as $key => $needle) {
									$count = substr_count($video_url, $needle);
									if ($count) {
										$video_type = $allows_array[$key];
									}
								}

								switch ($video_type) {
									case $allows_array[0]:
										$video_url = explode("?v=", $video_url);
										$video_url = explode("&", $video_url[1]);
										if (is_array($video_url)) {
											$video_url = $video_url[0];
										}
										echo do_shortcode('[video type="youtube" html5_poster="" html5_video_url="" src_webm="" src_ogg="" width="' . $video_width . '" height="' . $video_height . '"]' . $video_url . '[/video]');
										break;
									case $allows_array[1]:
										$video_url = explode("/", $video_url);
										if (is_array($video_url)) {
											$video_url = $video_url[count($video_url) - 1];
										}
										echo do_shortcode('[video type="vimeo" html5_poster="" html5_video_url="" src_webm="" src_ogg="" width="' . $video_width . '" height="' . $video_height . '"]' . $video_url . '[/video]');
										break;

									default:
										$html5_poster = THEMEMAKERS_THEME_URI . "/images/video_poster.jpg";
										if (has_post_thumbnail($first_preview->ID)) {
											$html5_poster = ThemeMakersHelper::get_post_featured_image($first_preview->ID, 'slider_showcase');
										}
										echo do_shortcode('[video type="html5" html5_poster="' . $html5_poster . '" html5_video_url="' . $video_url . '" src_webm="" src_ogg="" width="' . $video_width . '" height="' . $video_height . '"][/video]');
										break;
								}
							} 
							
							?>
							
						</div>
					</li>
							
								
					<?php
							}
					
						}
					}
					else{
                    ?>

                    <li>
                        <?php $img_src = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'single-post-thumbnail'); ?>
                        <a href="<?php echo $permalink ?>"><img class="small-custom-frame" src="<?php echo ThemeMakersHelper::get_image($img_src[0], 'carusell_thumb') ?>" width="222" height="137" alt="<?php echo $post->post_title ?>" /></a>
                        <div class="scroll-caption">
                            <span><?php
                    if ($post->post_type != "post") {
                        echo get_the_term_list($post_id, 'cons', '', ', ', '');
                    } else {
                        echo get_the_term_list($post_id, 'category', '', ', ', '');
                    }
                        ?></span>
                            <h6><a href="<?php echo $permalink ?>"><?php echo $post->post_title ?></a></h6>
                            <?php echo Thememakers_Entity_Rating::draw_rating($post_id) ?>
                        </div><!--/ .scroll-caption-->
                    </li>
					<?php } ?>
					

                <?php endfor; ?>
					
					

            </ul>
        </div><!--/ .sroller_block-->
        <div class="scroller_slider">
            <a href="#" class="scroller_slider_prev"></a>
            <a href="#" class="scroller_slider_next"></a>
            <div class="scroller_slider_bar"></div>
        </div><!--/ .scroller_slider-->
    </div><!--/ .scroller_wrap-->


    <!-- ************** - END UI Scroller - ************** -->


</div><!--/ .content-container-->
