<?php get_header(); ?>

	<div id="body">	
		<h3 class="bcrumb">
			<?php gabfire_breadcrumb(); ?>
		</h3>	
		
		<div id="main_content">
		
			<?php if (have_posts()) : while (have_posts()) : the_post(); ?>				
					
				<article id="post-<?php the_ID(); ?>" <?php post_class('post'); ?>>
						
					<div class="head">
						<h1 class="entry-title">
							<?php
							$parent_title = get_the_title($post->post_parent);
							echo $parent_title;
							?>
						</h1>
						
						<p class="metadata-top">
							<?php echo get_the_date('') ?> 
							<?php _e('by','gabfire'); ?> 
							<?php the_author_posts_link(); ?> - 
							<?php comments_popup_link(__('No Comment','gabfire'), __('1 Comment','gabfire'), __('% Comments','gabfire'));?>
							<?php edit_post_link(__('Edit','gabfire'),' / ',''); ?>
						</p>
					</div><!-- /post head -->
					
					<div class="entry">
					
						<?php $image = wp_get_attachment_image_src( $post->id, "qs-innerslide"); ?>
						<img src="<?php echo $image[0]; ?>" alt="<?php the_title(); ?>" class="attachment-full" />
						<p class="imagecaption"><?php echo get_post(get_post_thumbnail_id())->post_excerpt; ?></p>
						<div class="attachment-nav">
							<?php previous_image_link( false, __('&laquo; Previous Image','gabfire')); ?> <a href="<?php echo get_permalink($post->post_parent); ?>"><?php _e('Back to Post','gabfire'); ?></a> <?php next_image_link( false, __('Next Image &raquo;','gabfire')); ?>
						</div>
						
						<div class="gallery attachment-gallery">
							<?php
								$count = 1;
								$args = array(
								'post_type' => 'attachment',
								'numberposts' => -1,
								'order' => 'ASC',
								'post_parent' => $post->post_parent);
								$attachments = get_posts($args);

								if ($attachments){
									foreach ($attachments as $attachment){
										echo '<dl class="gallery-item"><dt class="gallery-icon">';
										echo '<a href="'.get_attachment_link($attachment->ID, false).'">'.wp_get_attachment_image($attachment->ID, 'thumbnail').'</a>';
										echo '</dt></dl>';
										$count++;
									}
								}
							?>
						</div>
						<div class="clear"></div>
					</div><!-- /entry -->
						
				</article><!-- /post -->
				
			<?php endwhile; endif; ?>
			
			<div class="post commentswrapper">
				<?php comments_template(); ?>
			</div>

		</div><!-- /main_content -->
		
		<aside id="sidebar">
			<?php get_sidebar(); ?> 
		</aside>

	</div><!-- /body -->

<?php get_footer(); ?>