<?php get_header(); ?>

<div id="content">

<div id="contentmiddle3">

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

<div class="sm"><?php _e('You are here:', 'ines') ?> <a href="/"><?php _e('Home', 'ines') ?></a> &raquo; <?php the_category(', ') ?> &raquo; <?php the_title(); ?></div>
<div class="sl"></div>

<div class="content-title">
            <?php the_category(' <span>/</span> '); ?>
            <a href="http://facebook.com/share.php?u=<?php the_permalink() ?>&amp;t=<?php echo urlencode(the_title('','', false)) ?>" target="_blank" class="f" title="Share on Facebook"></a>
            <a href="http://twitter.com/home?status=<?php the_title(); ?> <?php echo getTinyUrl(get_permalink($post->ID)); ?>" target="_blank" class="t" title="Spread the word on Twitter"></a>
            <a href="http://digg.com/submit?phase=2&amp;url=<?php the_permalink() ?>&amp;title=<?php the_title(); ?>" target="_blank" class="di" title="Bookmark on Del.icio.us"></a>
            <a href="http://stumbleupon.com/submit?url=<?php the_permalink() ?>&amp;title=<?php echo urlencode(the_title('','', false)) ?>" target="_blank" class="su" title="Share on StumbleUpon"></a>
</div>

<h1><?php the_title(); ?></h1>

<div class="smeta">
<?php if ( get_the_author_meta( 'description' ) ) :  ?>
<div class="author-avatar">
<?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'author_bio_avatar_size', 20 ) ); ?>
</div>
<?php endif; ?><?php _e('by', 'ines') ?> <?php the_author_posts_link(); ?> | 
<?php comments_popup_link('Leave a Comment', '1 Comment', '% Comments'); ?><?php if(function_exists('the_tags')) {$my_tags = get_the_tags();if ( $my_tags != "" ){ the_tags(' | Tags: ', ', ', ' '); } else {echo " | Tags: None";} }?>
<?php if(function_exists('UTW_ShowTagsForCurrentPost')) { echo ' | Tags: ';UTW_ShowTagsForCurrentPost("commalist");echo ' '; } ?>
 | <?php edit_post_link(' | Edit','',''); ?> <div class="sdate"><?php the_time('M'); ?> <?php the_time('j'); ?></div>
</div>
	
<div class="entry">
<?php the_content(__('Read more'));?>
<div class="clearfix"></div><hr class="clear" />
<?php wp_link_pages('before=<p><strong>Pages:</strong> &after=</p>&next_or_number=number'); ?>
</div>

<div class="smeta">

<div class="rel">
<?php if ( get_the_author_meta( 'description' ) ) :  ?>
<div class="author-avatar">
<?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'author_bio_avatar_size', 60 ) ); ?>
</div>

<div id="author-description">
<h3><?php printf( esc_attr__( 'About %s', 'Bruce' ), get_the_author() ); ?> :</h3>
<?php the_author_meta( 'description' ); ?> | <a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>"><?php printf( __( 'View all posts by %s <span class="meta-nav">&rarr;</span>', 'Bruce' ), get_the_author() ); ?></a>
</div>
<?php endif; ?>
</div>

<div class="social">
<h3><?php _e('Related Posts', 'ines') ?></h3>
<?php 
$max_articles = 4; // How many articles to display 
echo '<ul class="list columns">'; 
$cnt = 0; $article_tags = get_the_tags(); 
$tags_string = ''; 
if ($article_tags) { 
foreach ($article_tags as $article_tag) { 
$tags_string .= $article_tag->slug . ','; 
} 
} 
$tag_related_posts = get_posts('exclude=' . $post->ID . '&numberposts=' . $max_articles . '&tag=' . $tags_string); 
if ($tag_related_posts) { 
foreach ($tag_related_posts as $related_post) { 
$cnt++; 
echo '<li class="child-' . $cnt . '">'; 
echo '<a href="' . get_permalink($related_post->ID) . '">'; 
echo $related_post->post_title . '</a></li>'; 
} 
} 
if ($cnt < $max_articles) { 
$article_categories = get_the_category($post->ID); 
$category_string = ''; 
foreach($article_categories as $category) { 
$category_string .= $category->cat_ID . ','; 
} 
$cat_related_posts = get_posts('exclude=' . $post->ID . '&numberposts=' . $max_articles . '&category=' . $category_string); 
if ($cat_related_posts) { 
foreach ($cat_related_posts as $related_post) { 
$cnt++; 
if ($cnt > $max_articles) break; 
echo '<li class="child-' . $cnt . '">'; 
echo '<a href="' . get_permalink($related_post->ID) . '">'; 
echo $related_post->post_title . '</a></li>'; 
} 
} 
} 
echo '</ul>'; 
?>
</div>

</div>

<div class="clearfix"></div><hr class="clear" />
<div class="post-navigation clear">
                <?php
                    $prev_post = get_adjacent_post(false, '', true);
                    $next_post = get_adjacent_post(false, '', false); ?>
                    <?php if ($prev_post) : $prev_post_url = get_permalink($prev_post->ID); $prev_post_title = $prev_post->post_title; ?>
                        <a class="post-prev" href="<?php echo $prev_post_url; ?>"><em>Previous post</em><span><?php echo $prev_post_title; ?></span></a>
                    <?php endif; ?>
                    <?php if ($next_post) : $next_post_url = get_permalink($next_post->ID); $next_post_title = $next_post->post_title; ?>
                        <a class="post-next" href="<?php echo $next_post_url; ?>"><em>Next post</em><span><?php echo $next_post_title; ?></span></a>
                    <?php endif; ?>
                <div class="line"></div>
</div>

<div class="postspace"></div>
<div class="sl"></div>

<div class="postspace"></div>
<?php comments_template(); // Get wp-comments.php template ?>
<div class="clearfix"></div><hr class="clear" />

<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>

</div>

<?php get_template_part('bar'); ?>

</div>
<?php get_template_part('sbar'); ?>
</div>
<?php get_footer(); ?>