<?php get_header(); ?>
       
    <!-- Content Starts -->
    <div id="content" class="wrap">
		<div class="col-left">
			<div id="main">
			
			<?php $blog_id = get_option('woo_blog_cat'); ?>
            <?php $audio_id = get_option('woo_audio_cat'); ?>
			<?php $post_meta = get_option('woo_post_meta'); ?>
            <?php $lightbox = get_option('woo_gallery_image_lightbox_single'); ?>
            
            <?php if (in_category($audio_id) OR post_is_in_descendant_category( $audio_id ,get_the_id())) { 
					   
					   include TEMPLATEPATH . '/single-audio.php';
					   
					   } else { // Do 
			?>

            
            
            <?php if (have_posts()) : $count = 0; ?>
            <?php while (have_posts()) : the_post(); $count++; ?>
                                                                        
                <!-- Post Starts -->
                
                <div class="post wrap">
					
					<?php 
					if(is_attachment()){
							$back_to_gallery = '<a class="post-parent" href="'. get_permalink($post->post_parent) .'"><strong>&rarr;</strong> ' . __('Back to','woothemes') .' '. get_the_title($post->post_parent) .'</a>';
													}
					?>
					
                    <h3><?php echo $back_to_gallery; ?><?php the_title(); ?></h3>
                    
                    <?php if($post_meta == 'true'){ ?>
                	    <p class="post-details single-details"><?php _e('Posted on','woothemes'); ?> <?php the_time('d. M, Y'); ?> by  <?php the_author_posts_link(); ?> in <?php the_category(', ') ?></p>
 					<?php }?>
 					
 					<?php if (in_category($blog_id) OR post_is_in_descendant_category( $blog_id ,get_the_id())) { ?>
	                    <div class="post-image">
	                    	<?php woo_get_image('image','80','80'); ?>
	                    </div>
                    <?php } ?>
                    
                    <div class="intro att-caption">
                    	<?php the_excerpt(); ?>
                    </div>
                    <?php
                        	if(is_attachment()){
                        		$src = wp_get_attachment_image_src($id, 'large', true); // Thumb.php makes use of the Largest wordpres image and not the source file.
                        		?>
                               
								<p class="att-desc"><?php echo get_the_content(); ?></p>
                                <img src="<?php echo woo_thumb_url($src[0],640) ?>" alt="<?php the_title(); ?>" />
                                
								
                                <?php
                        	}
                        	?>
                    
                    <div class="fix"></div>

                    <div class="post-content">
                    	
                    	<?php
                    	if (in_category($blog_id) OR post_is_in_descendant_category( $blog_id ,get_the_id())) { 
                         
                       the_content();
                       
                       
                       } 
					   
					   else {
                        // Media rich Content   
                        $instance = array(
                            'post_id' => get_the_id(),
                            'size' => 'thumb',
                            'image_caption' => 'off',
                            'image_title' => 'off',
							'image_width' => get_option('woo_gallery_image_width'),
							'image_height' => get_option('woo_gallery_image_height'),
                            'video_width' => 400,
                            'video_height' => 280,
                            'audio_width' => 300,
                            'audio_height' => 19,
                            'max' => 0,
                            "rows" => 0,
                            "lightbox" => $lightbox
                        );
						
                        
                        woo_media_add($instance);
                       ?>
                        <div class="clear"></div>
                        <?php
                        	if(!is_attachment()){
                    
                          	 	the_content();   
                        
                        	}
                        }
                        ?>
                    	
                    	<?php the_tags('<p class="tags">Tags: ', ', ', '</p>'); ?>
                    	
                    </div>
                    
                    <div class="fix"></div>
                    
                    <div id="comments">
                        <?php comments_template(); ?>
                    </div>  

                </div>
                <!-- Post Ends -->
                                                    
			<?php endwhile; else: ?>
                <p><?php _e('Sorry, no posts matched your criteria.','woothemes'); ?></p>
            <?php endif; ?>  
            
            <?php } // End Audio Single Page ?>
        
            </div><!-- main ends -->
        </div><!-- .col-left ends -->

        <?php get_sidebar(); ?>

    </div><!-- Content Ends -->
		
<?php get_footer(); ?>