function post_image_show_auto_size($permalink = false, $noimage = false, $custom_link = '')
    {
        global $post, $format, $single, $customlink, $data, $is_featured_post;
        $customlink['klass'] = $slide_imgs = $videoIcon = "";
        $size = array('small' => array(175, 370), 'medium' => array(214, 448), 'large' => array(272, 564), 'x-large' => array(370, 760));
        if (isset($data['item_size']) && $data['item_size'] != '') {
            $size = $size[$data['item_size']];
            $size = $is_featured_post != '' ? $size[1] : $size[0];
        } else {
            $size = 221;
        }
        $post_image_tumb = get_post_image();
        $image_meta = 'tt_slide_images';
        if ($image_meta != '') {
            $slide_imgs = get_post_meta($post->ID, $image_meta, true);
        }
        if (!has_post_thumbnail($post->ID) && !($slide_imgs != '' && count($slide_imgs) > 0)) {
            if ($format == 'video') {
                $videoThumb = get_youtube_vimeo_thumb_url(get_post_meta($post->ID, 'tt-video-embed', true));
                $youtube = 'src="http://www.youtube.com/embed/';
                $vimeo = 'src="http://player.vimeo.com/video/';
                if (strpos(get_post_meta($post->ID, 'tt-video-embed', true), $youtube)) {
                    $videoIcon = '<div class="instagram-link"><img src="' . get_template_directory_uri() . '/images/youtube-icon.png"></div>';
                } else {
                    if (strpos(get_post_meta($post->ID, 'tt-video-embed', true), $vimeo)) {
                        $videoIcon = '<div class="instagram-link"><img src="' . get_template_directory_uri() . '/images/vimeo-icon.png"></div>';
                    }
                }
                if ($videoThumb !== false) {
                    $post_image_tumb = $videoThumb;
                }
            }
        }
        if (!empty($post_image_tumb) || $slide_imgs != '' && count($slide_imgs) > 0) {
            $lrg_img = $post_image_tumb;
            $klass = $format == 'video' ? 'iconVideo' : 'iconImage';
            ?>
        <div class="item-image">
            <div class="entry-image clearfix">
                <div class="hover-content"> <?php 
            if (!empty($post_image_tumb) || $slide_imgs != '' && count($slide_imgs) == 1) {
                $ilink = $lrg_img;
                $pre_classes = "preload imgSmall item-preview ";
                $classes = $pre_classes;
                if (!empty($post_image_tumb)) {
                    $classes .= $klass;
                } elseif ($slide_imgs != '' && isset($slide_imgs[0])) {
                    $post_image_tumb = $slide_imgs[0]['image'];
                    $ilink = $lrg_img;
                    $classes .= $klass;
                }
                $rell = count($slide_imgs) > 1 ? "prettyPhoto[" . $post->ID . "]" : 'prettyPhoto';
                if (!$permalink) {
                    $ilink = $customlink['enable'] == 'true' ? $customlink['url'] : get_permalink($post->ID);
                    $rell = '';
                }
                if (!is_single() && !is_page()) {
                    ?>
							<a title="<?php 
                    the_title();
                    ?>
" href="<?php 
                    print $ilink;
                    ?>
"<?php 
                    echo $customlink['target'];
                    ?>
 class="<?php 
                    print $classes . $customlink['klass'];
                    ?>
 item-click-modal" rel="<?php 
                    print $rell;
                    ?>
">
                            <img src="<?php 
                    print $post_image_tumb;
                    ?>
" alt="" style="width:100%; height:auto;" />
							</a>
                        <?php 
                } else {
                    ?>
							<img src="<?php 
                    print $post_image_tumb;
                    ?>
" alt="" style="width:100%; height:auto;" />
						<?php 
                }
                echo $videoIcon;
            } elseif ($slide_imgs != '' && count($slide_imgs) > 1) {
                ?>
                        <div class="flexslider">
                            <ul class="slides item-click-modal<?php 
                echo $customlink['klass'];
                ?>
"><?php 
                foreach ($slide_imgs as $immg) {
                    $ilink = $immg['image'];
                    $pre_classes = "preload imgSmall item-preview ";
                    $classes = $pre_classes;
                    $classes .= $klass;
                    $rell = count($slide_imgs) > 1 ? "prettyPhoto[" . $post->ID . "]" : 'prettyPhoto';
                    if (!$permalink) {
                        $ilink = $customlink['enable'] == 'true' ? $customlink['url'] : get_permalink($post->ID);
                        $rell = '';
                        //$classes = $pre_classes . 'iconPost';
                    }
                    ?>
                                    <li>
                                        <?php 
                    if (!is_single() && !is_page()) {
                        ?>
                                            <a title="<?php 
                        the_title();
                        ?>
"<?php 
                        echo $customlink['target'];
                        ?>
 class="<?php 
                        print $classes;
                        ?>
" href="<?php 
                        echo $ilink;
                        ?>
" rel="<?php 
                        print $rell;
                        ?>
">
                                            <img src="<?php 
                        echo aq_resize($immg['image'], $size);
                        ?>
" alt="" style="width:100%; height:auto;" />
											</a>
											<?php 
                    } else {
                        ?>
                                            <img src="<?php 
                        echo $immg['image'];
                        ?>
" alt="" style="width:100%; height:auto;" />
                                        <?php 
                    }
                    ?>
                                    </li><?php 
                }
                ?>
                            </ul>
                        </div><?php 
            }
            ?>
                </div>
            </div>
        </div><?php 
            return true;
        } else {
            global $blogConf;
            $bool = isset($blogConf['hide_content']) && $blogConf['hide_content'] == true ? true : false;
            if ($bool) {
                get_template_part('post', 'title');
            }
        }
        return false;
    }
    function tt_prev_next_post()
    {
        global $formatimg, $format;
        //Get Previous
        $next_post = get_next_post();
        if (!empty($next_post)) {
            query_posts('p=' . $next_post->ID);
            if (have_posts()) {
                the_post();
                $format = get_post_format();
                $formatimg = $format == '' ? 'standart' : "format-{$format}";
                $btnImg = get_post_image_for_nextprev();
                if (!$btnImg) {
                    $btnImg = get_post_first_image();
                }
                if (!$btnImg) {
                    $btnImg = get_youtube_vimeo_thumb_url(get_post_meta($next_post->ID, 'tt-video-embed', true));
                }
                ?>
                <div id="prev" class="<?php 
                if (!$btnImg) {
                    echo 'no-thumb';
                }
                ?>
">
                    <a href="<?php 
                the_permalink();
                ?>
">
                        <div class="lightBoxNav navLeft"></div>
                    </a>
                    <a href="<?php 
                the_permalink();
                ?>
" class="link-content">
                        <div class="prev_post"><h3 class="item-title"><?php 
                the_title();
                ?>
</h3><?php 
                if ($btnImg) {
                    echo '<img src="' . $btnImg . '" alt="">';
                }
                ?>
                        </div>
                    </a>
                </div><?php 
            }
            wp_reset_query();
        }
        //Get Next
        $prev_post = get_previous_post();
        if (!empty($prev_post)) {
            query_posts('p=' . $prev_post->ID);
            if (have_posts()) {
                the_post();
                $format = get_post_format();
                $formatimg = $format == '' ? 'standart' : "format-{$format}";
                $btnImg = get_post_image_for_nextprev();
                if (!$btnImg) {
                    $btnImg = get_post_first_image();
                }
                if (!$btnImg) {
                    $btnImg = get_youtube_vimeo_thumb_url(get_post_meta($prev_post->ID, 'tt-video-embed', true));
                }
                ?>
                <div id="next" class="<?php 
                if (!$btnImg) {
                    echo 'no-thumb';
                }
                ?>
">
                    <a href="<?php 
                the_permalink();
                ?>
">
                        <div class="lightBoxNav navRight"></div>
                    </a>
                    <a href="<?php 
                the_permalink();
                ?>
" class="link-content">
                        <div class="next_post">
                            <h3 class="item-title"><?php 
                the_title();
                ?>
</h3><?php 
                if ($btnImg) {
                    echo '<img src="' . $btnImg . '" alt="">';
                }
                ?>
    </div>
                    </a>
                </div><?php 
            }
            wp_reset_query();
        }
    }