<!-- Featured Posts -->
<div class="app">
	<?php
		$featured_category_ID = get_option('gpp_featured_cat');
		$featured_category = get_cat_name($featured_category_ID);
		if($featured_category_ID=="0") {$featured_category = __('Latest','gpp_i18n');}
	?>
	<div id="featured-section">
		<div class="span-15 colborder home">
			<h3 class="sub"><?php echo "$featured_category"; ?></h3>
			<?php 	
			$featured_query_args = array (    
				'cat' => $featured_category_ID,
				'showposts' => 1,
				/*Sticky posts functionality is very buggy in WordPress right now. The commented out code
				  will remain in the theme files until WP sticky bugs are ironed out.*/				
				//'post__in' => get_option('sticky_posts'),
				//'caller_get_posts' => 1
			);
			$featured_query = new WP_Query($featured_query_args);
			while ($featured_query->have_posts()) : $featured_query->the_post();
			//$is_sticky_check = (is_sticky()) ? 0 : 1;		
			//$is_sticky_count = (is_sticky()) ? 4 : 3;		
			?>
			<div <?php if(function_exists('post_class')) : ?><?php post_class(); ?><?php else : ?>class="post post-<?php the_ID(); ?>"<?php endif; ?>>
				<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s','gpp_i18n'),the_title_attribute('echo=0')); ?>">
					<?php the_title(); ?>
					</a></h2>
				<div class="entry">
					<?php if ( !post_password_required() ) { ?>
						<?php include (TEMPLATEPATH . '/apps/multimedia.php'); ?>
						<?php include (TEMPLATEPATH . '/apps/video.php'); ?>
					<?php } ?>
					<?php the_content(); ?>
				</div>
				<div class="clear"></div>
				<p class="postmetadata"><?php the_time(__('M d, Y', 'gpp_i18n')); ?> | <?php _e('Categories:','gpp_i18n'); if (the_category(', '))  the_category(); ?> <?php if (get_the_tags()) the_tags(__('| Tags: ','gpp_i18n')); ?> | <?php comments_popup_link(__('Leave A Comment &#187;', 'gpp_i18n'), __('1 Comment &#187;', 'gpp_i18n'),__ngettext('% Comment &#187;', '% Comments &#187;',get_comments_number (),'gpp_i18n')); ?> <?php edit_post_link(__('Edit','gpp_i18n'), '| ', ''); ?></p>
			</div>
			<?php endwhile; wp_reset_query(); ?>
			<div class="clear"></div>
			<?php include (TEMPLATEPATH . '/apps/ad-main.php'); ?>
		</div>
		<div class="span-8 last">
			<h3 class="sub"><?php _e('Previously','gpp_i18n'); ?></h3>
			<?php 
			$featured = 0;
			$my_query_args = array (    
				'cat' => $featured_category_ID,
				//'showposts' => $is_sticky_count,
				//'offset' => $is_sticky_check,
				'showposts' => 3,
				'offset' => 1,
				'caller_get_posts' => 1
			);
			$my_query = new WP_Query($my_query_args);
			while ($my_query->have_posts()) : $my_query->the_post(); $featured++; $do_not_duplicate = $post->ID; /*if ( is_sticky() ) continue*/;	
			?>
			<div <?php if(function_exists('post_class')) : ?><?php post_class(); ?><?php else : ?>class="post post-<?php the_ID(); ?>"<?php endif; ?>>
				<?php get_the_image(); ?>
				<h6><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s','gpp_i18n'),the_title_attribute('echo=0')); ?>">
					<?php the_title() ?>
					</a></h6>
				<p class="byline"><?php the_time(__('M d, Y', 'gpp_i18n')); ?> | <a href="<?php the_permalink(); ?>"><?php _e('Read','gpp_i18n'); ?></a> | <?php comments_popup_link(__('Discuss','gpp_i18n'), __('1 Comment','gpp_i18n'), __ngettext('% Comment', '% Comments', get_comments_number(), 'gpp_i18n')); ?></p>
				<p><?php echo substr(get_the_excerpt(),0,100); ?>&hellip;</p>
			</div>
			<?php if ($featured < 3) { ?>
			<hr />
			<?php  } ?>
			<?php endwhile; wp_reset_query(); ?>
			<?php $featured = 0; ?>
			<?php include (TEMPLATEPATH . '/apps/ad-sidebar.php'); ?>
		</div>
	</div>
</div>
<hr />