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

	if ( post_password_required() ) { ?>

<p class="nocomments"><?php esc_attr_e('This post is password protected. Enter the password to view comments.','Aruna') ?></p>
<?php
		return;
	}
	global $redux_demo;
?>
<!-- You can start editing here. -->

<div class="comments-counter">
    <button class="btn btn-primary custom-button pull-right"><?php _e('Comment', 'Aruna');?></button>
    <div class="text">
        <ul class="nav nav-tabs" id="myTab">
            <li <?php if(!isset($redux_demo['default_comments']) || $redux_demo['facebook_apikey'] == '' || $redux_demo['default_comments'] == '1') echo 'class="active"';?>><a href="#normalComments"><?php comments_number(esc_attr__('No comments','Aruna'), esc_attr__('One comment','Aruna'), '% '.esc_attr__('comments','Aruna') );?></a></li>
            <?php if($redux_demo['facebook_apikey'] != '') { ?>
            	<li <?php if(isset($redux_demo['default_comments']) && $redux_demo['default_comments'] == '2') echo 'class="active"';?>><a href="#facebookComments"><?php _e('Facebook comments', 'Aruna');?></a></li>
            <?php } ?>
        </ul>
    </div>
</div>

<div class="tab-content">
    <div class="tab-pane <?php if(!isset($redux_demo['default_comments']) || $redux_demo['facebook_apikey'] == '' || $redux_demo['default_comments'] == '1') echo 'active';?>" id="normalComments">

<?php if ( have_comments() ) : ?>
        
        <div class="comments-wrap">
			
		<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
			<div class="paginate comment-paginate clearfix">
				<div class="nav-previous"><?php previous_comments_link( __( '<span class="meta-nav">&larr;</span> Older Comments', 'Aruna' ) ); ?></div>
				<div class="nav-next"><?php next_comments_link( __( 'Newer Comments <span class="meta-nav">&rarr;</span>', 'Aruna' ) ); ?></div>
			</div> <!-- .navigation -->
		<?php endif; // check for comment navigation ?>
		
		<?php if ( ! empty($comments_by_type['comment']) ) : ?>
			<ul id="comments">
				<?php global $comment_count; $comment_count = 1; wp_list_comments( array('type'=>'comment','callback'=>'teo_comment') ); ?>
			</ul>
		<?php endif; ?>
		
		<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
			<div class="paginate comment-paginate clearfix">
				<div class="nav-previous"><?php previous_comments_link( __( '<span class="meta-nav">&larr;</span> Older Comments', 'Aruna' ) ); ?></div>
				<div class="nav-next"><?php next_comments_link( __( 'Newer Comments <span class="meta-nav">&rarr;</span>', 'Aruna' ) ); ?></div>
			</div> <!-- .navigation -->
		<?php endif; // check for comment navigation ?>
			
		<?php if ( ! empty($comments_by_type['pings']) ) : ?>
			<div id="trackbacks">
				<ul class="pinglist">
					<?php //wp_list_comments('type=pings&callback=tilability_pings'); ?>
				</ul>
			</div>
		<?php endif; ?>	
	</div>
<?php else : // this is displayed if there are no comments so far ?>
    <?php if ('open' == $post->comment_status) : ?>
        <!-- If comments are open, but there are no comments. -->
    <?php else : // comments are closed ?>
        <!-- If comments are closed. -->
    <?php endif; ?>
<?php endif; ?>

<?php if ('open' == $post->comment_status) : ?>
    <div class="comments-form">
		<?php 
		$commenter = wp_get_current_commenter();
		$req = get_option( 'require_name_email' );
		$aria_req = ( $req ? " aria-required='true'" : '' );
		if($commenter['comment_author'] != '') 
			$name = esc_attr($commenter['comment_author']);
		else 
			$name = '';
		if($commenter['comment_author_email'] != '') 
			$email = esc_attr($commenter['comment_author_email']);
		else
			$email = '';
		if($commenter['comment_author_url'] != '') 
			$url = esc_attr($commenter['comment_author_url']);
		else 
			$url = '';
		$fields =  array(
		'author' => '
			<div class="input-group">
				<span class="input-group-addon">' . __('Your name:', 'Aruna') . '</span>
				<input class="form-control" id="author" placeholder="John Doe(*)" name="author" type="text" value="' . $name . '" ' . $aria_req . ' />
			</div>',
		'email'  => '
			<div class="input-group">
				<span class="input-group-addon">' . __('Your E-mail:', 'Aruna') . '</span>
				<input class="form-control" id="email" placeholder="john@doe.com(*)" name="email" type="text" value="' . $email . '" ' . $aria_req . ' />
			</div>',
		'url'    => '
			<div class="input-group">
				<span class="input-group-addon">' . __('Your Website:', 'Aruna') . '</span>
				<input class="form-control" id="url" placeholder="http://www.teothemes.com" name="url" type="text" value="' . $url . '" />
			</div>'
		); 

		$comment_textarea = '<textarea class="form-control" rows="10" placeholder="Your Message...(*)" id="comment" name="comment" aria-required="true"></textarea>';
		comment_form( array( 'fields' => $fields, 'comment_field' => $comment_textarea, 'id_submit' => 'contact_submit', 'label_submit' => esc_attr__( 'Submit Comment', 'Aruna' ), 'title_reply' => esc_attr__( 'Leave a Reply', 'Aruna' ), 'title_reply_to' => esc_attr__( 'Leave a Reply to %s', 'Aruna' )) ); ?>
	</div> 
	
<?php else: ?>

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

</div> <!-- closing the normal comments div -->

	<?php if($redux_demo['facebook_apikey'] != '') { ?>
		<div class="tab-pane <?php if(isset($redux_demo['default_comments']) && $redux_demo['default_comments'] == '2') echo 'active';?>" id="facebookComments">
		    <div class="fb-comments" data-href="<?php echo get_permalink();?>" data-colorscheme="light" data-numposts="15" data-width="550px"></div>
		</div>
	<?php } ?>
</div>