<?php get_header();

global $gp_settings;

?>

<?php 

$args = "cat=".$gp_settings['cats']."&caller_get_posts=1&orderby=$orderby&order=$order&gdsr_sort=$gdsr_sort&gdsr_order=$gdsr_order&paged=$paged&posts_per_page=".$gp_settings['posts_per_page'];
query_posts($args); 

?>

	
<div id="content"<?php if($gp_settings['dropdown_filter'] == "0") { ?> class="shift-down"<?php } ?>>

	<?php if (have_posts()) : while (have_posts()) : the_post(); include('loop-data.php'); ?>
	
		<div <?php post_class('post-loop'); ?>>
		
			<!--Begin Image-->
			<?php if(has_post_thumbnail()) { ?>					
				<div class="post-thumbnail<?php if($gp_settings['image_wrap'] == "Disable") { ?> thumbnail-no-wrap<?php } ?>">					
					<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
						<?php $image = vt_resize(get_post_thumbnail_id(), '', $gp_settings['image_width'], $gp_settings['image_height'], false); ?>
						<img src="<?php echo $image[url]; ?>" alt="<?php if(get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true)) { echo get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true); } else { echo get_the_title(); } ?>" />		
					</a>				
				</div>					
			<?php } ?>
			<!--End Image-->
			
			<!--Begin Post Text-->
			<div class="post-text">
                             <?php 
                             $artist = get_post_meta($post->ID, 'ghostpool_dedication_artist', true);
                             $song = get_post_meta($post->ID, 'ghostpool_dedication_song', true);
                             $to_user_id = get_post_meta($post->ID, 'ghostpool_destination_user_id', true);
                             $to_user = get_user_by ('id', $to_user_id);
                             ?>
                            <h2><a href="<?php the_permalink(); ?>" title="<?php $artist.'. '.$song; ?>"><span><?php echo $artist;?></span>.&nbsp;<?php echo $song; ?></a></h2>
                            
                            <?php if ($to_user) { gp_the_flag($to_user->ID, 24); ?>
                                <span>TO: <?php echo bp_core_get_userlink($to_user->ID); ?></span>
                            <?php } else { ?>
                                <?php gp_the_flag('', 24); ?>
                                <span>TO: <?php echo $to_user->user_nicename; ?></span>
                            <?php } ?>                            
			</div>
			<!--End Post Text-->
		
		</div>
	<?php endwhile; ?>
        
                <?php if($gp_settings['pagination'] == "0") { gp_pagination(); } ?>

		<?php if($gp_settings['dropdown_filter'] == "0") { require_once('dropdown-filter.php'); } ?>
	
	<?php else : ?>	

		<h4><?php _e('Try searching for a different term.', 'gp_lang'); ?></h4>
		
	<?php endif; ?>
        <?php wp_reset_query(); ?>

</div>
	
<?php get_sidebar(); ?>
				
<?php get_footer(); ?>