<?php // Do not delete these lines
	if (isset($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
		die ('Please do not load this page directly. Thanks!');

	if (!empty($post->post_password)) { // if there's a password
		if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) {  // and it doesn't match the cookie
			?>

			<p class="nocomments"><?php _e('Enter your password to view comments.',TS_DOMAIN); ?></p>

			<?php
			return;
		}
	}
?>

<!-- You can start editing here. -->

<?php if ('open' == $post->comment_status && !empty($comments_by_type['comment']) && empty($comments_by_type['ping'])) : ?>

	<?php $comments_count = count($comments_by_type['comment']); ?>
	<h3 class="comments-title"><?php echo $comments_count; ?> <?php if($comments_count==1) : _e('Comment',TS_DOMAIN); else : _e('Comments',TS_DOMAIN); endif; ?></h3>

<?php endif; ?>

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

<div id="comments" class="clearfix">
	
	<div class="comments-paging"><?php paginate_comments_links(); ?></div>

	<?php if(!empty($comments_by_type['comment'])) : ?>
	<ul id="commentlist">
		<?php wp_list_comments('type=comment&callback=deluxe_comments'); ?>
	</ul>
	<?php endif; ?>
	
	<?php if(!empty($comments_by_type['pings'])) : ?>
	<?php $trackbacks_count = count($comments_by_type['pings']); ?>
	<h3 class="comments-title"><?php echo $trackbacks_count; ?> <?php if($trackbacks_count==1) : _e('Trackback',TS_DOMAIN); else : _e('Trackbacks',TS_DOMAIN); endif; ?></h3>
	<ul id="trackbacklist">
		<?php wp_list_comments('type=pings&callback=deluxe_pings'); ?>
	</ul>
	<?php endif; ?>
	
</div><!-- end comments -->

<?php else : // this is displayed if there are no comments so far ?>

	<?php if ('open' == $post->comment_status) : ?>
	
		<h3 class="comments-title"><?php _e('Comments',TS_DOMAIN); ?></h3>
	
		<p class="no-comments"><?php _e('There are no comments yet.',TS_DOMAIN); ?></p>
		
	<?php endif; ?>

<?php endif; // endif comments ?>

<?php if ('open' == $post->comment_status) : ?>

<div id="respond">

<h3><?php comment_form_title(__('Leave a Reply',TS_DOMAIN), __('Leave a Reply to %s',TS_DOMAIN)); ?></h3>

<?php if ( get_option('comment_registration') && !$user_ID ) : ?>
<p id="commenterror">
	<?php _e('Users must be registered and logged in to comment.',TS_DOMAIN); ?> <?php printf(__('<a href="%s">Log in to Reply</a>',TS_DOMAIN), get_option('siteurl')."/wp-login.php?redirect_to=".urlencode(get_permalink()));?>
</p>
<?php else : ?>

<p id="cancel-reply">
	<?php cancel_comment_reply_link(__('Cancel reply',TS_DOMAIN)) ?>
</p>

<div id="commentform" class="clearfix">

<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post">

	<textarea class="text required" name="comment" id="comment-message" defaultvalue="<?php _e('Your message',TS_DOMAIN); ?>..." tabindex="4" cols="4" rows="10"></textarea>
	
	<?php if($user_ID) : ?>
					
	<p id="comment-logged"><img src="<?php echo TS_IMG; ?>logged.png" align="absmiddle" width="16" height="16" alt="logged" /> <?php printf(__('Logged in as %s',TS_DOMAIN), '<br /><a href="'.get_option('siteurl').'/wp-admin/profile.php">'.$user_identity.'</a>'); ?> | <a href="<?php echo wp_logout_url(); ?>" id="logout" title="<?php _e('Logout',TS_DOMAIN) ?>"><?php _e('Logout',TS_DOMAIN); ?></a></p>
					
	<?php else : ?>

	<input type="text" name="author" id="comment-name" class="text required" value="<?php echo $comment_author; ?>" defaultvalue="<?php _e('Your name',TS_DOMAIN); ?>..." tabindex="1" />
					
	<input type="text" name="email" id="comment-email" class="text required" value="<?php echo $comment_author_email; ?>" defaultvalue="<?php _e('Your email',TS_DOMAIN); ?>..." tabindex="2" />
					
	<input type="text" name="url" id="comment-url" class="text" value="<?php echo $comment_author_url; ?>" defaultvalue="<?php _e('Your website',TS_DOMAIN); ?>..." tabindex="3" />
	
	<?php endif; // endif user_ID ?>
	
	<input type="submit" id="comment-submit" class="submit" value="<?php _e('Submit comment',TS_DOMAIN); ?>" />
	
	<p><?php _e('<a href="http://en.gravatar.com/" target="_blank" title="Gravatar - Globally Recognized Avatars">Gravatars</a> are enabled. Register for free!',TS_DOMAIN); ?></p>

<?php comment_id_fields(); ?>

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

</form>

</div><!-- end commentform -->

<?php endif; // If registration required and not logged in ?>

</div><!-- end respond -->

<?php endif; // if you delete this the sky will fall on your head ?>