<?php get_header(); ?>
<div class="wrap background">
	

<!-- Feature Post Markup -->
<?php query_posts('showposts=1'); ?>
<?php $posts = get_posts('numberposts=1&offset=0&cat='.get_option('envira_featured_cat')); foreach ($posts as $post) : start_wp(); ?>
<?php static $count1 = 0; if ($count1 == "1") { break; } else { ?>


<?php $thumb = get_post_meta($post->ID, 'Thumbnail', $single = true); ?>
<?php if($thumb !== '') { ?>
<div class="featurephoto">
<a href="<?php the_permalink() ?>"><img style="border: none;" alt="" src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php echo $thumb; ?>&amp;h=265&amp;w=265&amp;zc=1" /></a></div>
<?php } else { echo ''; } ?>
	

<div class="featuretext">
<h1><?php the_title(); ?></h1>
<?php the_excerpt(); ?>
<a href="<?php the_permalink() ?>" class="moreinfo">More Info</a>
</div>

	
<?php $count1++; } ?>
<?php endforeach; ?>
<!-- End Feature Post Markup -->
				
			
<!-- Ribbon Markup -->
<div class="ribbon <?php if ( get_option('envira_banner_color') <> "" ) { ?><?php echo get_option('envira_banner_color'); ?><?php } else { ?>blue<?php } ?>-banner">
<?php if ( get_option('envira_banner_text') <> "" ) { echo get_option('envira_banner_text'); ?><?php } else { ?>You can edit this text in the enVirashop Theme Settings<?php } ?>
</div>
<!-- End Ribbon Markup -->


<div id="mycarousel" class="jcarousel-skin-tango">

    <ul>
    
<!-- Carousel Post Markup -->
<?php query_posts('showposts='.get_option('envira_carousel_num')); ?>
<?php $posts = get_posts('offset=0&numberposts='.get_option('envira_carousel_num'));; foreach ($posts as $post) : start_wp(); ?>
<?php static $count2 = 0; if ($count2 == "8") { break; } else { ?>

<li>
<?php $thumb = get_post_meta($post->ID, 'Thumbnail', $single = true); ?>
<?php if($thumb !== '') { ?>
<a href="<?php the_permalink() ?>"><img style="border: none;" alt="" src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php echo $thumb; ?>&amp;h=120&amp;w=120&amp;zc=1" /></a>
<div class="carouseltitle"><?php the_title(); ?></div>
<?php $price = get_post_meta($post->ID, 'price', $single = true);?>
<?php if($price !== '') { ?>
<div class="carouselprice"><?php echo $price; ?></div>
<?php } else { echo ''; } ?>

<?php } else { echo ''; } ?>
</li>
	
<?php $count2++; } ?>
<?php endforeach; ?>
<!-- End Carousel Post Markup -->
     
    </ul>

</div>

<script type="text/javascript">
/**
 * We use the initCallback callback
 * to assign functionality to the controls
 */
function mycarousel_initCallback(carousel) {
    jQuery('.jcarousel-control a').bind('click', function() {
        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
        return false;
    });

    jQuery('.jcarousel-scroll select').bind('change', function() {
        carousel.options.scroll = jQuery.jcarousel.intval(this.options[this.selectedIndex].value);
        return false;
    });

    jQuery('#mycarousel-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#mycarousel-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};

// Ride the carousel...
jQuery(document).ready(function() {
    jQuery("#mycarousel").jcarousel({
        wrap: 'both',
        scroll: <?php if ( get_option('envira_carousel_scroll') <> "" ) { ?><?php echo get_option('envira_carousel_scroll'); ?><?php } else { ?>1<?php } ?>,
        animation: '<?php if ( get_option('envira_carousel_animation') <> "" ) { ?><?php echo get_option('envira_carousel_animation'); ?><?php } else { ?>fast<?php } ?>',
        auto: '<?php if ( get_option('envira_carousel_auto') <> "" ) { ?><?php echo get_option('envira_carousel_auto'); ?><?php } else { ?>0<?php } ?>',

       initCallback: mycarousel_initCallback,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
});

</script>


</div>
</div>

	
<?php get_footer(); ?>