{include file='header.tpl'}


{* JAVASCRIPT FOR ADDING COMMENT *}
{literal}
<script type='text/javascript'>
<!--
var comment_changed = 0;
var first_comment = 1;
var last_comment = {/literal}{$comments|@count}{literal};
var next_comment = last_comment+1;
var total_comments = {/literal}{$total_comments}{literal};

function removeText(commentBody) {
  if(comment_changed == 0) {
    commentBody.value='';
    commentBody.style.color='#000000';
    comment_changed = 1;
  }
}

function addText(commentBody) {
  if(commentBody.value == '') {
    commentBody.value = '{/literal}{$group31}{literal}';
    commentBody.style.color = '#888888';
    comment_changed = 0;
  }
}

function checkText() {
  if(comment_changed == 0) { 
    var commentBody = document.getElementById('comment_body');
    commentBody.value=''; 
  }
  var commentSubmit = document.getElementById('comment_submit');
  commentSubmit.value = '{/literal}{$group32}{literal}';
  commentSubmit.disabled = true;
  
}

function addComment(is_error, comment_body, comment_date) {
  if(is_error == 1) {
    var commentError = document.getElementById('comment_error');
    commentError.style.display = 'block';
    if(comment_body == '') {
      commentError.innerHTML = '{/literal}{$group33}{literal}';
    } else {
      commentError.innerHTML = '{/literal}{$group34}{literal}';
    }
    var commentSubmit = document.getElementById('comment_submit');
    commentSubmit.value = '{/literal}{$group24}{literal}';
    commentSubmit.disabled = false;
  } else {
    var commentError = document.getElementById('comment_error');
    commentError.style.display = 'none';
    commentError.innerHTML = '';

    var commentBody = document.getElementById('comment_body');
    commentBody.value = '';
    addText(commentBody);

    var commentSubmit = document.getElementById('comment_submit');
    commentSubmit.value = '{/literal}{$group24}{literal}';
    commentSubmit.disabled = false;

    if(document.getElementById('comment_secure')) {
      var commentSecure = document.getElementById('comment_secure');
      commentSecure.value=''
      var secureImage = document.getElementById('secure_image');
      secureImage.src = secureImage.src + '?' + (new Date()).getTime();
    }

    total_comments++;
    var totalComments = document.getElementById('total_comments');
    totalComments.innerHTML = total_comments;

    if(total_comments > 10) {
      var oldComment = document.getElementById('comment_'+first_comment);
      if(oldComment) { oldComment.style.display = 'none'; first_comment++; }
    }

    var newComment = document.createElement('div');
    var divIdName = 'comment_'+next_comment;
    newComment.setAttribute('id',divIdName);
    var newTable = "<table cellpadding='0' cellspacing='0' width='100%'><tr><td class='profile_item1' width='80'>";
    {/literal}
      {if $user->user_info.user_id != 0}
        newTable += "<a href='{$url->url_create('profile',$user->user_info.user_username)}'><img src='{$user->user_photo('./images/nophoto.gif')}' class='photo' border='0' width='{$misc->photo_size($user->user_photo('./images/nophoto.gif'),'75','75','w')}'></a></td><td class='profile_item2'><table cellpadding='0' cellspacing='0' width='100%'><tr><td class='profile_comment_author'><b><a href='{$url->url_create('profile',$user->user_info.user_username)}'>{$user->user_info.user_username}</a></b> - {$datetime->cdate("`$setting.setting_timeformat` `$group35` `$setting.setting_dateformat`", $datetime->timezone($smarty.now, $global_timezone))}</td><td class='profile_comment_author' align='right' nowrap='nowrap'><a href='{$url->url_create('profile',$user->user_info.user_username)}#comments'>{$group40}</a>&nbsp;|&nbsp;<a href='user_messages_new.php?to={$user->user_info.user_username}'>{$group27}</a></td>";
      {else}
        newTable += "<img src='./images/nophoto.gif' class='photo' border='0' width='75'></td><td class='profile_item2'><table cellpadding='0' cellspacing='0' width='100%'><tr><td class='profile_comment_author'><b>{$group26}</b> - {$datetime->cdate("`$setting.setting_timeformat` `$group35` `$setting.setting_dateformat`", $datetime->timezone($smarty.now, $global_timezone))}</td><td class='profile_comment_author' align='right' nowrap='nowrap'>&nbsp;</td>";
      {/if}
      newTable += "</tr><tr><td colspan='2' class='profile_comment_body'>"+comment_body+"</td></tr></table></td></tr></table>";
    {literal}
    newComment.innerHTML = newTable;
    var profileComments = document.getElementById('profile_comments');
    var prevComment = document.getElementById('comment_'+last_comment);
    profileComments.insertBefore(newComment, prevComment);
    next_comment++;
    last_comment++;
  }
}
//-->
</script>
{/literal}



<div class='page_header'>{$group->group_info.group_title}</div>

<table width='100%' cellpadding='0' cellspacing='0'>
<tr>
<td class='profile_leftside' width='200'>
{* BEGIN LEFT COLUMN *}

  {* SHOW PHOTO *}
  <table cellpadding='0' cellspacing='0' width='100%' style='margin-bottom: 10px;'>
  <tr>
  <td class='profile_photo' width='182'><img class='photo' src='{$group->group_photo('./images/nophoto.gif')}' border='0'></td>
  </tr>
  </table>

  <table class='profile_menu' cellpadding='0' cellspacing='0' width='100%'>

  {* SHOW BROWSE MEMBERS BUTTON *}
  <tr><td class='profile_menu1'><a href='group_members.php?group_id={$group->group_info.group_id}'><img src='./images/icons/browsefriends16.gif' border='0' class='icon'>{$group2} ({$total_members})</a></td></tr>

  {* SHOW BROWSE IMAGES BUTTON *}
  {if $total_files != 0}
    <tr><td class='profile_menu1'><a href='group_album.php?group_id={$group->group_info.group_id}'><img src='./images/icons/album16.gif' border='0' class='icon'>{$group29} ({$total_files})</a></td></tr>
  {/if}

  {* SHOW JOIN GROUP BUTTON IF NOT ALREADY A MEMBER *}
  {if $group->user_rank == -1}
    <tr><td class='profile_menu1'><a href='user_group_join.php?group_id={$group->group_info.group_id}&return_url={$url->url_current()}'><img src='./images/icons/group_join16.gif' border='0' class='icon'>{$group3}</a></td></tr>
  {/if}

  {* SHOW LEAVE GROUP BUTTON IF ALREADY A MEMBER *}
  {if $group->user_rank != -1}
    <tr><td class='profile_menu1'><a href='user_group_leave.php?group_id={$group->group_info.group_id}'><img src='./images/icons/group_leave16.gif' border='0' class='icon'>{$group4}</a></td></tr>
  {/if}

  {* SHOW REPORT THIS GROUP MENU ITEM *}
  <tr>
  <td class='profile_menu1'><a href='user_report.php?return_url={$url->url_current()}'><img src='./images/icons/report16.gif' class='icon' border='0'>{$group38}</a></td>
  </tr>

  </table>


  {* DISPLAY IF GROUP IS PRIVATE TO VIEWING USER *}
  {if $is_group_private != 0}

    {* END LEFT COLUMN *}
    </td>
    <td class='profile_rightside'>
    {* BEGIN RIGHT COLUMN *}

      <img src='./images/icons/error48.gif' border='0' class='icon_big'>
      <div class='page_header'>{$group37}</div>
      {$group1}

  {* DISPLAY ONLY IF GROUP IS NOT PRIVATE TO VIEWING USER *}
  {else}


    {* SHOW STATS *}
    <table cellpadding='0' cellspacing='0' width='100%' style='margin-bottom: 10px;'>
    <tr>
    <td class='header'>{$group5}</td>
    </tr>
    <tr>
    <td class='profile'>
      <table cellpadding='0' cellspacing='0'>
      <tr><td width='70'>{$group6}</td><td><a href='{$url->url_create('profile', $groupowner_info.user_username)}'>{$groupowner_info.user_username}</a></td></tr>
      <tr><td>{$group7}</td><td>{$group->group_info.group_views} {$group8}</td></tr>
      <tr><td>{$group9}</td><td>{$total_members} {$group10}</td></tr>
      <tr><td>{$group11}</td><td>{$total_files} {$group12}</td></tr>
      {if $group->group_info.group_dateupdated != 0}<tr><td>{$group13}</td><td>{$datetime->time_since($group->group_info.group_dateupdated)}</td></tr>{/if}
      </table>
    </td>
    </tr>
    </table>
    {* END STATS *}


    {* END LEFT COLUMN *}
    </td>
    <td class='profile_rightside'>
    {* BEGIN RIGHT COLUMN *}


    {* SHOW GROUP INFORMATION *}
    <table cellpadding='0' cellspacing='0' width='100%' style='margin-bottom: 10px;'>
    <tr>
    <td class='header'>{$group14}</td>
    </tr>
    <tr>
    <td class='profile'>
      <table cellpadding='0' cellspacing='0'>
      {if $group->group_info.group_title != ""}<tr><td valign='top' nowrap='nowrap'>{$group15}</td><td>{$group->group_info.group_title}</td></tr>{/if}
      {if $group->group_info.group_desc != ""}<tr><td valign='top' nowrap='nowrap'>{$group16}</td><td>{$group->group_info.group_desc}</td></tr>{/if}
      {if $group_category != ""}<tr><td valign='top' nowrap='nowrap'>{$group17}</td><td><a href='user_group_browse.php?groupcat_id={$group->group_info.group_groupcat_id}'>{$group_category}</a></td></tr>{/if}
      {* LOOP THROUGH GROUP FIELDS, DISPLAY IF NOT BLANK *}
      {section name=field_loop loop=$fields}
        <tr>
        <td width='100' valign='top' nowrap='nowrap'>{$fields[field_loop].field_title}:</td>
        <td>{$fields[field_loop].field_value_group}</td>
        </tr>
      {/section}
      </table>
    </td>
    </tr>
    </table>
    {* END GROUP INFORMATION *}




    {* SHOW MEMBERS *}
    <table cellpadding='0' cellspacing='0' width='100%' style='margin-bottom: 10px;'>
    <tr>
    <td class='header'>
      {$group18} ({$total_members})
      &nbsp;<font class='profile_small'>[ <a href='group_members.php?group_id={$group->group_info.group_id}'>{$group19} {$total_members} {$group20}</a> ]</font>
    </td>
    </tr>
    <tr>
    <td class='profile'>
      {* LOOP THROUGH MEMBERS *}
      {section name=member_loop loop=$members}
        {* START NEW ROW *}
        {cycle name="startrow2" values="<table cellpadding='0' cellspacing='0' align='center'><tr>,,,,,"}
        <td class='profile_friend'><a href='{$url->url_create('profile', $members[member_loop].member->user_info.user_username)}'><img src='{$members[member_loop].member->user_photo('./images/nophoto.gif')}' class='photo' border='0' width='{$misc->photo_size($members[member_loop].member->user_photo('./images/nophoto.gif'),'75','75','w')}'><br>{$members[member_loop].member->user_info.user_username}</a></td>
        {* END ROW AFTER 4 RESULTS *}
        {if $smarty.section.member_loop.last == true}
          </tr></table>
        {else}
          {cycle name="endrow2" values=",,,,,</tr></table>"}
        {/if}
      {/section}
    </td>
    </tr>
    </table>
    {* END MEMBERS *}




    {* SHOW PHOTOS *}
    {if $total_files != 0}
      <table cellpadding='0' cellspacing='0' width='100%' style='margin-bottom: 10px;'>
      <tr>
      <td class='header'>
        {$group21} ({$total_files})
        &nbsp;<font class='profile_small'>[ <a href='group_album.php?group_id={$group->group_info.group_id}'>{$group22}</a> ]</font>
      </td>
      </tr>
      <tr>
      <td class='profile'>
        {* LOOP THROUGH PHOTOS *}
        {section name=file_loop loop=$files max=5}

          {* IF IMAGE, GET THUMBNAIL *}
          {if $files[file_loop].groupmedia_ext == "jpeg" OR $files[file_loop].groupmedia_ext == "jpg" OR $files[file_loop].groupmedia_ext == "gif" OR $files[file_loop].groupmedia_ext == "png" OR $files[file_loop].groupmedia_ext == "bmp"}
            {assign var='file_dir' value=$group->group_dir($group->group_info.group_id)}
            {assign var='file_src' value="`$file_dir``$files[file_loop].groupmedia_id`_thumb.jpg"}
          {* SET THUMB PATH FOR AUDIO *}
          {elseif $files[file_loop].groupmedia_ext == "mp3" OR $files[file_loop].groupmedia_ext == "mp4" OR $files[file_loop].groupmedia_ext == "wav"}
            {assign var='file_src' value='./images/icons/audio_big.gif'}
          {* SET THUMB PATH FOR VIDEO *}
          {elseif $files[file_loop].groupmedia_ext == "mpeg" OR $files[file_loop].groupmedia_ext == "mpg" OR $files[file_loop].groupmedia_ext == "mpa" OR $files[file_loop].groupmedia_ext == "avi" OR $files[file_loop].groupmedia_ext == "swf" OR $files[file_loop].groupmedia_ext == "mov" OR $files[file_loop].groupmedia_ext == "ram" OR $files[file_loop].groupmedia_ext == "rm"}
            {assign var='file_src' value='./images/icons/video_big.gif'}
          {* SET THUMB PATH FOR UNKNOWN *}
          {else}
            {assign var='file_src' value='./images/icons/file_big.gif'}
          {/if}

          {* START NEW ROW *}
          {cycle name="startrow2" values="<table cellpadding='0' cellspacing='0'><tr>,,,,"}
          <td class='profile_friend'><a href='group_album_file.php?group_id={$group->group_info.group_id}&groupmedia_id={$files[file_loop].groupmedia_id}'><img src='{$file_src}' class='photo' border='0' width='{$misc->photo_size($file_src,'75','75','w')}'></a></td>
          {* END ROW AFTER 5 RESULTS *}
          {if $smarty.section.file_loop.last == true}
            </tr></table>
          {else}
            {cycle name="endrow2" values=",,,,</tr></table>"}
          {/if}
        {/section}
      </td>
      </tr>
      </table>
    {/if}
    {* END PHOTOS *}





    {* BEGIN COMMENTS *}
    <table cellpadding='0' cellspacing='0' width='100%'>
    <tr>  
    <td class='header'>
      {$group23} (<span id='total_comments'>{$total_comments}</span>)
      &nbsp;[ <a href='group_comments.php?group_id={$group->group_info.group_id}'>{$group25}</a> ]
    </td>
    </tr>
      {if $allowed_to_comment != 0}
        <tr>
        <td class='profile_postcomment'>
        <form action='group_comments.php' method='post' target='AddCommentWindow' onSubmit='checkText()'>
        <textarea name='comment_body' id='comment_body' rows='2' cols='65' onfocus='removeText(this)' onblur='addText(this)' style='color: #888888; width: 100%;'>{$group31}</textarea>

          <table cellpadding='0' cellspacing='0' width='100%'>
          <tr>
          {if $setting.setting_comment_code == 1}
            <td width='75' valign='top'><img src='./images/secure.php' id='secure_image' border='0' height='20' width='67' class='signup_code'></td>
            <td width='68' style='padding-top: 4px;'><input type='text' name='comment_secure' id='comment_secure' class='text' size='6' maxlength='10'></td>
            <td width='10'><img src='./images/icons/tip.gif' border='0' class='icon' onMouseover="tip('{$group36}')"; onMouseout="hidetip()"></td>
          {/if}
          <td align='right' style='padding-top: 5px;'>
          <input type='submit' id='comment_submit' class='button' value='{$group24}'>
          <input type='hidden' name='group_id' value='{$group->group_info.group_id}'>
          <input type='hidden' name='task' value='dopost'>
          </form>
          </td>
          </tr>
          </table>
        <div id='comment_error' style='color: #FF0000; display: none;'></div>
        <iframe name='AddCommentWindow' style='display: none' src=''></iframe>
	</div>
	</div>
	</td>
	</tr>
      {/if}
	<tr>
	<td class='profile' id='profile_comments'>

      {* LOOP THROUGH PROFILE COMMENTS *}
      {section name=comment_loop loop=$comments}
        <div id='comment_{math equation='t-c' t=$comments|@count c=$smarty.section.comment_loop.index}'>
        <table cellpadding='0' cellspacing='0' width='100%'>
        <tr>
        <td class='profile_item1' width='80'>
          {if $comments[comment_loop].comment_author->user_info.user_id != 0}
            <a href='{$url->url_create('profile',$comments[comment_loop].comment_author->user_info.user_username)}'><img src='{$comments[comment_loop].comment_author->user_photo('./images/nophoto.gif')}' class='photo' border='0' width='{$misc->photo_size($comments[comment_loop].comment_author->user_photo('./images/nophoto.gif'),'75','75','w')}'></a>
          {else}
            <img src='./images/nophoto.gif' class='photo' border='0' width='75'>
          {/if}
        </td>
        <td class='profile_item2'>
          <table cellpadding='0' cellspacing='0' width='100%'>
          <tr>
          <td class='profile_comment_author'><b>{if $comments[comment_loop].comment_author->user_info.user_id != 0}<a href='{$url->url_create('profile',$comments[comment_loop].comment_author->user_info.user_username)}'>{$comments[comment_loop].comment_author->user_info.user_username}</a>{else}{$group26}{/if}</b> - {$datetime->cdate("`$setting.setting_timeformat` `$group35` `$setting.setting_dateformat`", $datetime->timezone($comments[comment_loop].comment_date, $global_timezone))}</td>
          <td class='profile_comment_author' align='right' nowrap='nowrap'><a href='{$url->url_create('profile',$comments[comment_loop].comment_author->user_info.user_username)}#comments'>{$group40}</a>&nbsp;|&nbsp;<a href='user_messages_new.php?to={$comments[comment_loop].comment_author->user_info.user_username}'>{$group27}</a></td>
          </tr>
          <tr>
          <td colspan='2' class='profile_comment_body'>{$comments[comment_loop].comment_body}</td>
          </tr>
          </table>
        </td>
        </tr>
        </table>
        </div>
      {/section}


    </td>
    </tr>
    </table>
    {* END COMMENTS *}


  {/if}
  {* END PRIVACY IF STATEMENT *}


{* END RIGHT COLUMN *}
</td>
</tr>
</table>

{include file='footer.tpl'}