<?php
/**
* The template for displaying Comments.
*
 */
?>

<section class="comments">
	<?php if ( $comments ) : ?>
		<h3 class="comment-count"><?php comments_number('No Comments', 'One Comment', '% Comments' );?></h3>
		<ol id="commentlist">

		<?php foreach ($comments as $comment) : ?>
			<li <?php comment_class(); ?> id="comment-<?php comment_ID() ?>">
				<span class="avatar"><?php echo get_avatar( $comment, 32 ); ?></span>
				<p><cite><strong><?php comment_author_link() ?></strong> says:<br /><span class="c-meta"><?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></span></cite> <?php edit_comment_link(__("Edit This"), ' |'); ?></p>
				<?php comment_text() ?>
			</li>
		<?php endforeach; ?>
		</ol>

	<?php else : // If there are no comments yet ?>
	<?php endif; ?>

	<?php if ( comments_open() ) : ?>

	<?php if ( get_option('comment_registration') && !$user_ID ) : ?>
		<p><?php printf(__('You must be <a href="%s">logged in</a> to post a comment.'), get_option('siteurl')."/wp-login.php?redirect_to=".urlencode(get_permalink()));?></p>
	<?php else : ?>
		<h4>Leave a Comment</h4>
	<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">

		<?php if ( $user_ID ) : ?>

		<p><?php printf(__('Logged in as %s.'), '<a href="'.get_option('siteurl').'/wp-admin/profile.php">'.$user_identity.'</a>'); ?> <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="<?php _e('Log out of this account') ?>"><?php _e('Log out &raquo;'); ?></a></p>

		<?php else : ?>

		<fieldset>
			<label for="author"><small><?php _e('Name'); ?> <span><?php if ($req) _e('(required)'); ?></span></small></label><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" />
		</fieldset>

		<fieldset>
			<label for="email"><small><?php _e('Mail (will not be published)');?> <span><?php if ($req) _e('(required)'); ?></span></small></label><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" />
		</fieldset>

		<fieldset>
			<label for="url"><small><?php _e('Website'); ?></small></label><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" />
		</fieldset>

		<?php endif; ?>

		<fieldset>
			<label for="comment"><small>Your comment</small></label>
			<textarea name="comment" id="comment" cols="100%" rows="10" tabindex="4"></textarea>
		</fieldset>

		<input name="submit" type="submit" id="submit" tabindex="5" value="<?php echo attribute_escape(__('Submit Comment')); ?>" />
		<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />

		<?php do_action('comment_form', $post->ID); ?>

	</form>

	<?php endif; ?>
</section>