<?php
	if('comments.php' == basename( $_SERVER[ 'SCRIPT_FILENAME' ] ) )
		die( 'Please do not load this page directly. Thanks!' );

	if( !empty( $post->post_password ) ) {
		if( $_COOKIE[ 'wp-postpass_' . COOKIEHASH ] != $post->post_password ) {
?>
			<div id="comments">
            <h2><?php _e( "Ups!", "sofa_shoppr" ); ?></h2>
			<p><?php _e( "This post has been password protected. Enter the password in order to view reviews.", "sofa_shoppr" ); ?></p>
            </div>
<?php
		return;
		}
	}
	$oddcomment = '';
?> 

     
			<!-- comments -->
            <div id="comments">
                 <h2><?php _e( "USER REVIEWS", "sofa_shoppr" ); ?> ( <?php comments_number( '0', '1', '%' ); ?> )</h2>
                 
                 
                            <?php if( ( 'open' == $post->comment_status ) && ( 'open' == $post->ping_status ) ) { ?>
                            <p class="comments-intro">
                            <?php comments_rss_link( __( "Follow Reviews via RSS feed.", "sofa_shoppr" ) ); ?>
                            <a href="<?php trackback_url(); ?>" rel="trackback"><?php _e( "Trackback Reviews from your website.", "sofa_shoppr" ); ?></a>
                            </p>
                            <?php } else if( !( 'open' == $post->comment_status ) && ( 'open' == $post->ping_status ) ) { ?>
                            <p class="comments-intro">
                            <?php _e( "Reviews are closed.", "sofa_shoppr" ); ?> <a href="<?php trackback_url(); ?>" rel="trackback"><?php _e( "Trackback Reviews from your website.", "sofa_shoppr" ); ?></a> 
                            </p>
                            <?php } else if( !( 'open' == $post->comment_status ) && !( 'open' == $post->ping_status ) ) { ?>
                            <p class="comments-intro">
                            <?php _e( "Reviews and pings are not allowed!", "sofa_shoppr" ); ?>
                            </p>
                            <?php } ?>
                    
                    <ol class="comment-list">
                    
<?php
// start comments list 
if( $comments ) : 
?>
                   
				   <?php wp_list_comments( array( 'callback' => 'savatar_comments' ) ); ?>
                   
<?php endif; ?>
                   
                   </ol>
                   
<?php if( 'open' == $post->comment_status ) : ?>
                                            
<?php if( get_option( 'comment_registration' ) && !$user_ID ) : ?>
                  			<ol class="comment-list">
                   			<li class="comment even">                 
                            <div class="comment-text">
                            <a href="<?php echo get_option( 'siteurl' ); ?>/wp-login.php?redirect_to=<?php echo urlencode( get_permalink() ); ?>">
                            <?php _e( "You must be logged in to post the Review!", "sofa_shoppr" ); ?>
                            </a>
                            </div>
                            </li>
                            </ol>           
<?php else : ?>
                        	<div id="respond">
                            
							<form id="commentform" method="post" action="<?php echo get_option( 'siteurl' ); ?>/wp-comments-post.php">
                            
<?php if( $user_ID ) : ?>
                                            
                            <p>
                            <?php _e( "Logged in as", "sofa_shoppr" ); ?> <a href="<?php echo get_option( 'siteurl' ); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. 
                            <a href="<?php echo wp_logout_url( get_permalink() ); ?>" title="Log out of this account"><?php _e( "Would you like to LOGOUT", "sofa_shoppr" ); ?></a>?
                            </p>
                                            
<?php else : ?>
                            
								<p>
									<label for="author"><?php if( $req ) echo "* "; ?> <?php _e( "Your name", "sofa_shoppr" ); ?></label>
									<input type="text" size="22" id="author" name="author" value="<?php echo $comment_author; ?>" tabindex="1" />
								</p>
								<p>
									<label for="email"><?php if( $req ) echo "* "; ?> <?php _e( "E-mail address", "sofa_shoppr" ); ?></label>
									<input type="text" size="22" id="email" name="email" value="<?php echo $comment_author_email; ?>" tabindex="2" />

								</p>
								<p>
									<label for="url"><?php _e( "Website", "sofa_shoppr" ); ?></label>
									<input type="text" size="22" id="url" name="url" value="<?php echo $comment_author_url; ?>" tabindex="3" />
								</p>
                                
<?php endif; ?>
                            
								<p>
                                <?php cancel_comment_reply_link(); ?>
                                </p>
                                <p>
									<label for="comment"><?php comment_form_title( __( "Review" ), __( "Your Reply to %s" ) ); ?></label>
									<textarea rows="6" cols="52" id="comment" name="comment" tabindex="4"></textarea>
								</p>
                                
                                <p><strong>XHTML</strong> <?php _e( "Allowed tags", "sofa_shoppr" ); ?>: <code><?php echo allowed_tags(); ?></code></p>
                                
                                <p class="submitMe">
                                <!--
                                	<input type="hidden" value="<?php //echo $id; ?>" name="comment_post_ID" />
                                -->
                                	<?php comment_id_fields(); ?>
                                    <button type="submit" value="" id="submitcomment" name="submitcomment"><span><?php _e( "SUBMIT", "sofa_shoppr" ); ?></span></button>
                                </p>

                                <p style="display: none;">
                                <?php do_action( 'comment_form', $post->ID ); ?>
                                </p>
                            
							</form>
                            </div>
                            
<?php endif; ?>

<?php else : ?>
                            <p><i><?php _e( "No reviews allowed!", "sofa_shoppr" ); ?></i></p>
<?php endif; ?>
                   
</div>