* - $field_type_css: The css-compatible field type.
 * - $classes_array: Array of html class attribute values. It is flattened
 *   into a string within the variable $classes.
 *
 * @see template_preprocess_field()
 * @see theme_field()
 */
?>

<?php 
// ocultem el nid de la IBC
//print render($item);
//...i fem servir el template només per engantxar-hi el comments thread
//print render($content['comments']);
if (arg(0) == 'node' && is_numeric(arg(1)) && ($node = menu_get_object('node'))) {
    $node = menu_get_object();
    $rendered = render(comment_node_page_additions($node));
    if ($node->comment_count == '0') {
        print '<p>No comments yet</p>';
    }
    /*else {
        print '<p>' . $node->comment_count . ' comments so far.</p>';
      }*/
    print $rendered;
    global $user;
    if (empty($user->roles[5]) && empty($user->roles[6]) && empty($user->roles[7]) && empty($user->roles[4]) && empty($user->roles[3])) {
        print '<div class="avis"><p>Only members are able to post public commments. To make the most of all of HBW\'s features, discover our subscriptions now!<div class="btn-container"><a title="Compare subscriptions" class="btn" href="/pricing">HBW Alive Plans & Pricing</a>&nbsp;&nbsp;' . l('Why subscribe', 'subscription-plans', array('attributes' => array('title' => t('Why subscribe ?'), 'class' => 'btn'))) . '<div class="sign-in">or <a title="Sign in now if you already have a membership" href="/user">sign in</a> if you already have a membership</div></div></div>';
    }
}
/*$collapsed_content = render($content['comments']);
  print theme('ctools_collapsible', array('handle' => 'Click here to view/add comments', 'content' => $collapsed_content, 'collapsed' => TRUE));*/
" target="_blank">Read More</a></div>
    <?php 
    }
    ?>
</div>
  <div class="alpha-comments-container">
		<div class="node-comments" id="node-comments"><?php 
    print 'Comments   <span class="dot"></span><span class="comment-count">' . $comment_count . '</span>';
    ?>
</div>
		<div id="goal-comments-wrapper" class="goal-comment-wrapper">
			<?php 
    $nid = $node->nid;
    $comment = new stdClass();
    $comment->nid = $nid;
    $node = node_load($nid);
    $form = drupal_get_form('comment_form', $comment);
    //print render($form);
    //$node = node_load($id);
    $node_view = node_view($node);
    $node_view['comments'] = comment_node_page_additions($node);
    print drupal_render($node_view['comments']);
    ?>
		</div>
  </div>
</div>
<?php 
}
?>

">
<?php 
$build = drupal_get_form("comment_node_component_form", (object) array('nid' => $node->nid));
unset($build['author']);
$build['actions']['submit']['#attributes']['class'][] = 'tiny';
print render($build);
?>
</div>
<hr>
<div style="overflow:hidden; max-height:200px;" id="comments-<?php 
print $node->nid;
?>
">
<?php 
$num_comments = 0;
$comments = comment_node_page_additions($node);
if (isset($comments['comments'])) {
    $num_comments = count($comments['comments']);
    //kpr($comments);
    print render($comments['comments']);
}
?>
</div>
<?php 
if ($num_comments > 1) {
    ?>
<a href="#_" onclick="jQuery('#comments-<?php 
    print $node->nid;
    ?>
').css('max-height',jQuery(this).text() == 'Show All' ? '' : 200); jQuery(this).text('Show Less');">Show All</a>
<?php 
/**
 * hook_fasttoggle_ajax_alter
 *
 * Hook allowing callees to modify the ajax sent back to a browser after a link
 * is toggled.
 *
 * @param $ajax_commands
 *   The default ajax commands (arg to ajax_render).
 * @param $object_type
 *   The type of object being handled.
 * @param $object
 *   An instance of the object that has been modified, as saved.
 * @param $params
 *   An array of further parameters, since drupal_alter only supports 3
 *   parameters. The array contains the group, option and view strings
 *   that describe what option was toggled and what view (if any) was
 *   applied to the object in its original render.
 */
function fasttoggle_node_fasttoggle_ajax_alter(&$ajax_commands, $object_type, $object, $params)
{
    if ($object_type != "node") {
        return;
    }
    // Replace the original content with that the updated content, so far as we're able (we don't
    // get it exactly right yet).
    $unrendered = node_view($object, $params['view']);
    if ($object->comment > 0 && module_exists('comment') && $params['view'] == 'full') {
        $unrendered['comments'] = comment_node_page_additions($object);
    }
    $replacement_content = drupal_render($unrendered);
    $ajax_commands[] = ajax_command_replace('.' . 'node-content-' . $object->nid, $replacement_content);
}