<?
    global $vis_language;
    $paging_list='';
    for($i=0;$i<$view_info['page_count'];$i++) $paging_list.='<option value="'.$i.'" '.(($comments_info['page']==$i)?'selected="selected"':'').'>'.($i+1).'</option>';
?>
<section id="breadcrumb" class="row m-b m-l-none m-r-none">
	<div class="col-sm-4">
	  <h3 class="m-b-xs text-black"><? echo $operation['view_title']; ?><span id="total_cnt"> (<? echo $comments_info['total']; ?>)</span></h3>
	  <div>
		 <ul class="breadcrumb bg-empty no-border m-b-xxs no-padder">
			<li><a class="link" href="#/home/quick_view/<? echo $vis_language['TXTHOME']; ?>"><? echo $vis_language['TXTHOME']; ?></a></li>
			<li><a class="link" href="#/selfhelp/view_selfhelp/Solutions"><? echo $vis_language['TXTSELFHELP']; ?></a></li>
			<li class="active"><? echo $operation['view_title']; ?></li>
		 </ul>
	  </div>
	</div>
	<div class="col-sm-8 m-t-md pull-right">
		 <div class="btn-group pull-right">
			<button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"><i class="vh vh-action text-muted"></i> <b class="caret"></b></button>
     <ul class="dropdown-menu dropdown-menu-right text-left">
         <li><a class="link" href="#/selfhelp/view_categories/<? echo $vis_language['TXTCATEGORIES'];?>/<?= $select_domain_id[0];?>" onclick="$('#vis_workpanel_div').visExecution('load_module', '<? echo $vis_language['TXTCATEGORIES'].'/'.$domain; ?>', {'vis_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_operation':'<?php echo $operation['vis_operation3']; ?>','vis_domain_id':'<? echo $domains[0]['domain_id'];?>'})"><? echo $vis_language['TXTCATEGORIES']; ?></a></li>
			<li><a class="link" href="#/selfhelp/view_articles/<? echo $vis_language['TXTARTICLES']; ?>" onclick="$('#vis_workpanel_div').visExecution('load_module', '<? echo $vis_language['TXTARTICLES']; ?>', {'vis_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_operation':'<?php echo $operation['vis_operation2']; ?>'});"><? echo $vis_language['TXTARTICLES']; ?></a></li>
			<li><a class="link" href="#/selfhelp/view_comments/<? echo $vis_language['TXTCOMMENTS']; ?>" onclick="$('#vis_workpanel_div').visExecution('load_module', '<? echo $vis_language['TXTCOMMENTS']; ?>', {'vis_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_operation':'<?php echo $operation['vis_operation4']; ?>'})"><? echo $vis_language['TXTCOMMENTS']; ?></a></li>
         </ul>
   </div>
   <div class="btn-group pull-right m-l">&nbsp;
         <a class="btn btn-rounded btn-primary btn-sm dropdown-toggle" href="#/selfhelp/new_article/<? echo $vis_language['TXTADDARTICLE'];?>" onclick="$('#vis_workpanel_div').visExecution('load_module', '<? echo $vis_language['TXTADDARTICLE'];?>', {'vis_module':'selfhelp', 'vis_operation':'new_article', 'cache':'true','vis_article':1})"><i style="font-size:10px;" class="vh vh-plus"></i>  <? echo $vis_language['TXTADDARTICLE']; ?></a>
      </div> 
		<div class="col-sm-6 input-group b-a b-2x rounded pull-right">
			<input class="form-control rounded input-sm no-border" type="text" placeholder="<?php echo $vis_language['MSGSERART'];?>" value="<?php echo (isset($operation['criteria']))?$operation['criteria']:'';?>" id="search_language_variables">
			<span class="input-group-btn rounded b-l b-3x">
			<button class="btn btn-sm btn-rounded bg-white b-white btn-icon" type="button" onclick="display_articles();">
			<i class="vh vh-search"></i>
			</button>
			</span>
		</div>
	</div>
</section>
  <? if($view_info['page_count']>0)
   {
   ?>
<div class="col-lg-12">
   <form name="vis_<?php echo $operation['vis_operation']; ?>_form" id="vis_<?php echo $operation['vis_operation']; ?>_form">
   <input type="hidden" name="vis_current_operation" value="<?php echo $operation['vis_current_operation']; ?>" />
      <section class="panel panel-default">
         <div class="row wrapper clr">
            <div class="col-sm-3 tkt_left_menu">
               <div id="sorting">
                  <div class="btn-group pull-left vis_mass_action">
                     <button class="btn bg-empty btn-sm dropdown-toggle action_btn" data-toggle="dropdown">
                     <i class="vh vh-action"></i> <span class="caret"></span>
                     </button>
                     <ul class="dropdown-menu">
						<li><a href="#/selfhelp/view_comments/<? echo $vis_language['TXTCOMMENTS']; ?>" onclick="$(this).visExecution('submit_form',{'vis_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_operation':'mass_action', 'vis_form':'vis_<?php echo $operation['vis_operation']; ?>_form', 'vis_switch':'comment_toggle_approval','vis_current_operation':'<?php echo $operation['vis_current_operation']; ?>','vis_current_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_value':'1','vis_page':'<? echo $comments_info['page']; ?>'})"><? echo $vis_language['TXTAPPROVE']; ?></a></li>
						<li><a href="#/selfhelp/view_comments/<? echo $vis_language['TXTCOMMENTS']; ?>" onclick="$(this).visExecution('submit_form',{'vis_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_operation':'mass_action', 'vis_form':'vis_<?php echo $operation['vis_operation']; ?>_form', 'vis_switch':'comment_toggle_approval','vis_current_operation':'<?php echo $operation['vis_current_operation']; ?>','vis_current_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_value':'0','vis_page':'<? echo $comments_info['page']; ?>'})"><? echo $vis_language['TXTDISAPPROVE']; ?></a></li>
						<li><a href="#/selfhelp/view_comments/<? echo $vis_language['TXTCOMMENTS']; ?>" onclick="$(this).visExecution('submit_form',{'vis_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_operation':'mass_action', 'vis_form':'vis_<?php echo $operation['vis_operation']; ?>_form', 'vis_switch':'comment_toggle_spam_mark','vis_current_operation':'<?php echo $operation['vis_current_operation']; ?>','vis_current_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_value':'1','vis_page':'<? echo $comments_info['page']; ?>'})"><? echo $vis_language['TXTSPAM']; ?></a></li>
						<li><a href="#/selfhelp/view_comments/<? echo $vis_language['TXTCOMMENTS']; ?>" id="del_comment" onclick="delete_comments();"><? echo $vis_language['TXTDELETE']; ?></a></li>
                     </ul>
                  </div>
					  <? if(isset($operation['vis_form']) && $operation['vis_form']=='vis_view_selfhelp_form'){?>
					 <div class="label_page pull-right">
						  <ul class="navSeprator no-padder m-n">
							 <li><a class="<?php echo ($sort_by == '')?'vis_sub_header_selected':'link'; ?>" href="javascript:void(0);" value="0" onclick="$(this).parents('#vis_workpanel_div').visExecution('load_module','<? echo $vis_language['TXTCOMMENTS']; ?>',{'vis_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_operation':'<?php echo $operation['vis_current_operation']; ?>', 'vis_sorted_by':' ', 'vis_form':'vis_<?php echo $operation['vis_operation']; ?>_form'})"><? echo $vis_language['TXTALL'].' ( '.$quick_view['all'].' )'; ?></a></li>
							 <li><? if($quick_view['approved']!=0){?><a class="<?php echo ($sort_by == 'is_approved=1 and is_spam=0')?'vis_sub_header_selected':'link'; ?>" href="javascript:void(0);" value="is_approved=1 and is_spam=0" onclick="$(this).parents('#vis_workpanel_div').visExecution('load_module','<? echo $vis_language['TXTCOMMENTS']; ?>',{'vis_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_operation':'<?php echo $operation['vis_current_operation']; ?>', 'vis_sorted_by':'is_approved=1 and is_spam=0','vis_form':'vis_<?php echo $operation['vis_operation']; ?>_form'})"><? echo $vis_language['TXTAPPROVED'].' ( '.$quick_view['approved'].' )'; ?></a><?} else { ?><label class="text-muted"><? echo $vis_language['TXTAPPROVED'].' ( '.$quick_view['approved'].' )'; ?></label><? }?></li>
							 <li><? if($quick_view['disapproved']!=0){?><a class="<?php echo ($sort_by == 'is_approved=0 and is_spam=0')?'vis_sub_header_selected':'link'; ?>" href="javascript:void(0);" value="is_approved=0 and is_spam=0" onclick="$(this).parents('#vis_workpanel_div').visExecution('load_module','<? echo $vis_language['TXTCOMMENTS']; ?>',{'vis_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_operation':'<?php echo $operation['vis_current_operation']; ?>', 'vis_sorted_by':'is_approved=0 and is_spam=0','vis_form':'vis_<?php echo $operation['vis_operation']; ?>_form'})"><? echo $vis_language['TXTDISAPPROVED'].' ( '.$quick_view['disapproved'].' )'; ?></a><?} else { ?><label class="text-muted"><? echo $vis_language['TXTDISAPPROVED'].' ( '.$quick_view['disapproved'].' )'; ?></label><? }?></li>
							 <li><? if($quick_view['spam']!=0){?><a class="<?php echo ($sort_by == 'is_spam=1')?'vis_sub_header_selected':'link'; ?>" href="javascript:void(0);" value="is_spam=1" onclick="$(this).parents('#vis_workpanel_div').visExecution('load_module','<? echo $vis_language['TXTCOMMENTS']; ?>',{'vis_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_operation':'<?php echo $operation['vis_current_operation']; ?>', 'vis_sorted_by':'is_spam=1', 'vis_form':'vis_<?php echo $operation['vis_operation']; ?>_form'})"><? echo $vis_language['TXTSPAM'].' ( '.$quick_view['spam'].' )'; ?></a><?} else { ?><label class="text-muted"><? echo $vis_language['TXTSPAM'].' ( '.$quick_view['spam'].' )'; ?></label><? }?></li>
						  </ul>
						</div>
					  <? } else {?>
						  <div class="label_page pull-right">
						  <ul class="navSeprator no-padder m-n">
							 <li><a class="<?php echo ($sort_by == '')?'vis_sub_header_selected':'link'; ?>" href="javascript:void(0);" value="0" onclick="$(this).parents('#vis_workpanel_div').visExecution('load_module','<? echo $vis_language['TXTCOMMENTS']; ?>',{'vis_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_operation':'<?php echo $operation['vis_current_operation']; ?>', 'vis_sorted_by':' ','vis_form':'vis_<?php echo $operation['vis_operation']; ?>_form'})"><? echo $vis_language['TXTALL'].' ( '.$quick_view['all'].' )'; ?></a></li>
							 <li><? if($quick_view['approved']!=0){?><a class="<?php echo ($sort_by == 'is_approved=1 and is_spam=0')?'vis_sub_header_selected':'link'; ?>" href="javascript:void(0);" value="is_approved=1 and is_spam=0" onclick="$(this).parents('#vis_workpanel_div').visExecution('load_module','<? echo $vis_language['TXTCOMMENTS']; ?>',{'vis_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_operation':'<?php echo $operation['vis_current_operation']; ?>', 'vis_sorted_by':'is_approved=1 and is_spam=0', 'vis_form':'vis_<?php echo $operation['vis_operation']; ?>_form'})"><? echo $vis_language['TXTAPPROVED'].' ( '.$quick_view['approved'].' )'; ?></a><?} else { ?><label class="text-muted"><? echo $vis_language['TXTAPPROVED'].' ( '.$quick_view['approved'].' )'; ?></label><? }?></li>
							 <li><? if($quick_view['disapproved']!=0){?><a class="<?php echo ($sort_by == 'is_approved=0 and is_spam=0')?'vis_sub_header_selected':'link'; ?>" href="javascript:void(0);" value="is_approved=0 and is_spam=0" onclick="$(this).parents('#vis_workpanel_div').visExecution('load_module','<? echo $vis_language['TXTCOMMENTS']; ?>',{'vis_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_operation':'<?php echo $operation['vis_current_operation']; ?>', 'vis_sorted_by':'is_approved=0 and is_spam=0', 'vis_form':'vis_<?php echo $operation['vis_operation']; ?>_form'})"><? echo $vis_language['TXTDISAPPROVED'].' ( '.$quick_view['disapproved'].' )'; ?></a><?} else { ?><label class="text-muted"><? echo $vis_language['TXTDISAPPROVED'].' ( '.$quick_view['disapproved'].' )'; ?></label><? }?></li>
							 <li><? if($quick_view['spam']!=0){?><a class="<?php echo ($sort_by == 'is_spam=1')?'vis_sub_header_selected':'link'; ?>" href="javascript:void(0);" value="is_spam=1" onclick="$(this).parents('#vis_workpanel_div').visExecution('load_module','<? echo $vis_language['TXTCOMMENTS']; ?>',{'vis_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_operation':'<?php echo $operation['vis_current_operation']; ?>', 'vis_sorted_by':'is_spam=1', 'vis_form':'vis_<?php echo $operation['vis_operation']; ?>_form'})"><? echo $vis_language['TXTSPAM'].' ( '.$quick_view['spam'].' )'; ?></a><?} else { ?><label class="text-muted"><? echo $vis_language['TXTSPAM'].' ( '.$quick_view['spam'].' )'; ?></label><? }?></li>
						  </ul>
						</div>
							<? }?>
						<div class="text-muted pull-right label_page"><? echo $vis_language['TXTSORTBY']; ?>:</div>
               </div>
            </div>
			<div  class="col-sm-9 text-right text-center-xs tkt_right_menu" id="paging">
				<? if(isset($operation['vis_form']) && $operation['vis_form']=='vis_view_selfhelp_form'){?>
				 <select name="pageing" class="form-control input-sm selectpicker pull-right paging v-middle" onchange="$(this).parents('#vis_workpanel_div').visExecution('load_area',{'vis_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_operation':'<?php echo $operation['vis_current_operation']; ?>', 'vis_page':this.value,'vis_form':'<?echo $operation['vis_form'];?>'})">
					<? echo $paging_list;?>
				  </select>
				  <? } else {?>
					   <select name="pageing" class="form-control input-sm selectpicker pull-right paging v-middle" onchange="$(this).parents('#vis_workpanel_div').visExecution('load_area',{'vis_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_operation':'<?php echo $operation['vis_current_operation']; ?>', 'vis_page':this.value,'vis_sorted_by':'<?echo $operation['vis_sorted_by'];?>'})">
					<? echo $paging_list;?>
				  </select><? }?>

				  <div class="text-muted pull-right label_page"><? echo $vis_language['TXTPAGE']; ?>:</div>
			</div>
         </div>
         <div class="table-responsive scroll-x" id="vis_domain_list">
            <table class="table table-hover b-t b-light m-b-none" data-ride="datatables" id="tbl_comment">
               <thead class="table_head">
                  <tr>
                     <th>
                        <div class="btn-group">
                           <label class="checkbox m-n m-r-sm i-checks"  style="float: left;"><input type="checkbox"><i></i></label>
                        </div>
                     </th>
                     <th><? echo $vis_language['TXTCOMMENT']; ?></th>
                     <th class="txt_nowrap"><? echo $vis_language['TXTAUTHOR']; ?></th>
                     <th class="txt_nowrap"><? echo $vis_language['TXTARTICLE']; ?></th>
					 <th class="txt_nowrap"><? echo $vis_language['TXTDOMAIN']; ?></th>
					 <th class="txt_nowrap"><? echo $vis_language['TXTPOSTON']; ?></th>
        			 <th></th>
                  </tr>
               </thead>
               <tbody>
                  <?
                     if($comments!=-1) for($i=0;$i<count($comments);$i++) {
																						$postername=(trim($comments[$i]['postername'])!='')?$comments[$i]['postername']:$comments[$i]['poster_name'];
						 if(strlen($comments[$i]['article_title'])>35)
						 {
							 $selfhelp_title = substr($comments[$i]['article_title'], 0, 35);
							 $selfhelp_title.='...';
						 }
						 else $selfhelp_title=$comments[$i]['article_title'];
						 if(strlen(nl2br($comments[$i]['content']))>30)
						 {
							 $comment_content = substr(nl2br($comments[$i]['content']), 0, 30);
							 $comment_content.='...';
						 }
						 else $comment_content=nl2br($comments[$i]['content']);
						 $author=($comments[$i]['poster_id']!=1)?$comments[$i]['poster_email']:"";
                         echo '<tr id="'.$i.'"><td width="30" id="checkbox_data"><label class="checkbox m-n i-checks"><input type="checkbox" name="vis_global_mass_chk_'.$i.'" id="vis_global_mass_chk_'.$i.'" value="'.$comments[$i]['comment_id'].'" /><i></i></label></td>';
                         echo '<td><a href="javascript:void(0);" data-toggle="ajaxModal" data-modal-arguments="vis_module=selfhelp&vis_operation=edit_comment&vis_static_area=vis_comment_dialog&vis_comment_id='.$comments[$i]['comment_id'].'">'.$comment_content.'</a>' ?><div id="option_<? echo $i; ?>" style="display:none"><ul class="navSeprator no-padder m-n">
						 <li><a class="link" href="javascript:void(0);" onclick="$('#option_<? echo $i; ?>').visExecution('load_area',{'vis_module':'<?php echo $operation['vis_current_module']; ?>','vis_operation':'toggle_approval','vis_comment_id':<? echo $comments[$i]['comment_id']; ?>,'vis_value':<? echo $comments[$i]['is_approved'];?>,'vis_page':<? echo $comments_info['page']; ?>});"><? echo ($comments[$i]['is_approved']==1)?$vis_language['TXTDISAPPROVE']:$vis_language['TXTAPPROVE']; ?></a></li>
						 <li><a class="link" href="javascript:void(0);" onclick="$('#option_<? echo $i; ?>').visExecution('load_area',{'vis_module':'<?php echo $operation['vis_current_module']; ?>','vis_operation':'toggle_spam_mark','vis_comment_id':<? echo $comments[$i]['comment_id']; ?>,'vis_value':<? echo $comments[$i]['is_spam'];?>,'vis_page':<? echo $comments_info['page']; ?>});"><? echo ($comments[$i]['is_spam']==1)?$vis_language['TXTREMOVESPAM']:$vis_language['TXTMARKSPAM']; ?></a></li>
						 </ul></div><? echo '</td>';
						  echo '<td><a>'.$postername.'</br>';
						  ?><div id="author_email_<? echo $i; ?>" style="display:none"><? echo $author;?></div>
						  <?echo '</a></td>';
                         echo '<td><a href="#/selfhelp/view_article/'.$comments[$i]['article_title'].'/'.$comments[$i]['article_id'].'">'.$selfhelp_title.'</a></td>';
                         echo '<td><a>'.$comments[$i]['domain_name'].'</a></td>';
						 echo '<td><a>'.format_datetime($comments[$i]['entry_date']).'</a></td>';?>
 						<td align="center"> <a class="text-muted" data-toggle="ajaxModal" data-modal-arguments="vis_module=selfhelp&vis_operation=confirm_delete&vis_comment_id=<? echo $comments[$i]['comment_id']; ?>&vis_static_area=vis_comment_delete_form&vis_area=2&vis_page=<? echo $comments_info['page']; ?>" title="<? echo $vis_language['TXTDELETE']; ?>" href="javascript:void(0);" ><i class="vh vh-delete-round"></i></a></td></tr>
               <?     } ?>
               </tbody>
            </table>
         </div>
         <footer class="wrapper panel-footer bg-white">
            <div class="row">
               <div class="col-sm-9 tkt_left_menu">
                  <div class="vis_mass_action_footer">
                     <div class="btn-group">
                        <button type="button" class="btn bg-empty btn-sm dropdown-toggle action_btn" data-toggle="dropdown">
                        <i class="vh vh-action"></i>
                        <span class="caret"></span>
                        </button>
                        <ul class="dropdown-menu">
						<li><a href="#/selfhelp/view_comments/<? echo $vis_language['TXTCOMMENTS']; ?>" onclick="$(this).visExecution('submit_form',{'vis_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_operation':'mass_action', 'vis_form':'vis_<?php echo $operation['vis_operation']; ?>_form', 'vis_switch':'comment_toggle_approval','vis_current_operation':'<?php echo $operation['vis_current_operation']; ?>','vis_current_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_value':'1','vis_page':'<? echo $comments_info['page']; ?>'})"><? echo $vis_language['TXTAPPROVE']; ?></a></li>
						<li><a href="#/selfhelp/view_comments/<? echo $vis_language['TXTCOMMENTS']; ?>" onclick="$(this).visExecution('submit_form',{'vis_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_operation':'mass_action', 'vis_form':'vis_<?php echo $operation['vis_operation']; ?>_form', 'vis_switch':'comment_toggle_approval','vis_current_operation':'<?php echo $operation['vis_current_operation']; ?>','vis_current_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_value':'0','vis_page':'<? echo $comments_info['page']; ?>'})"><? echo $vis_language['TXTDISAPPROVE']; ?></a></li>
						<li><a href="#/selfhelp/view_comments/<? echo $vis_language['TXTCOMMENTS']; ?>" onclick="$(this).visExecution('submit_form',{'vis_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_operation':'mass_action', 'vis_form':'vis_<?php echo $operation['vis_operation']; ?>_form', 'vis_switch':'comment_toggle_spam_mark','vis_current_operation':'<?php echo $operation['vis_current_operation']; ?>','vis_current_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_value':'1','vis_page':'<? echo $comments_info['page']; ?>'})"><? echo $vis_language['TXTSPAM']; ?></a></li>
						<li><a href="#/selfhelp/view_comments/<? echo $vis_language['TXTCOMMENTS']; ?>" id="del_comment" onclick="delete_comments();"><? echo $vis_language['TXTDELETE']; ?></a></li>
                     </ul>
                     </div>
                  </div>
               </div>
			<div  class="col-sm-3 text-right text-center-xs tkt_right_menu" id="paging">
				 <? if(isset($operation['vis_form']) && $operation['vis_form']=='vis_view_selfhelp_form'){?>
				 <select name="pageing" class="form-control input-sm selectpicker pull-right paging v-middle" onchange="$(this).parents('#vis_workpanel_div').visExecution('load_area',{'vis_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_operation':'<?php echo $operation['vis_current_operation']; ?>', 'vis_page':this.value,'vis_form':'<?echo $operation['vis_form'];?>'})">
					<? echo $paging_list;?>
				  </select>
				  <? } else {?>
					   <select name="pageing" class="form-control input-sm selectpicker pull-right paging v-middle" onchange="$(this).parents('#vis_workpanel_div').visExecution('load_area',{'vis_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_operation':'<?php echo $operation['vis_current_operation']; ?>', 'vis_page':this.value,'vis_sorted_by':'<?echo $operation['vis_sorted_by'];?>'})">
					<? echo $paging_list;?>
				  </select><? }?>
				  <div class="text-muted pull-right label_page"><? echo $vis_language['TXTPAGE']; ?>:</div>
			</div>
            </div>
         </footer>
      </section>
   </form>
</div>
<script type="text/javascript">
	$("#sorted_bydis").addClass("badge bg-gray pull-right font-normal text-xs");
   $(".selectpicker").selectpicker();
   $("tr").hover(
	  function () {
	  var id=this.id;
	  	$("#option_"+id).css("display","block");
	  	$("#author_email_"+id).css("display","block");
	  });
   $("tr").mouseleave(
	  function () {
	  var id=this.id;
	  	$("#option_"+id).css("display","none");
	  	$("#author_email_"+id).css("display","none");
	});
   $(document).ready(function() {
   $('[data-ride="datatables"]').dataTable({
   	 "bPaginate" : false,
   		"sDom": 't', "bAutoWidth": false,
   		"aoColumns": [
   			{ "bSortable": false },
   		  	null,
   		  	null,
   		  	null,
   		  	null,
   		  	null,
   			{ "bSortable": false },
   		]
   	});
   });
    $('#search_language_variables').keyup(function(e){
    if(e.keyCode == 13)
    {
        var search_string = $("#search_language_variables").val();
        if(search_string.length < 3)
						$("#vis_global_msg_div").visInterface("load_global_message", "<? echo $vis_language['TXTGLOBALSEARCHERROR'];?>");
		else
        $.post("index.php?vis_module=selfhelp&vis_operation=view_articles&vis_tmpst="+new Date().getTime(), { 'vis_action':'no_load','criteria': search_string }, function(data) {
            $("#search_language_variables").parent().addClass('open');
            $('#vis_workpanel_div').show().html(data);
        });
    }
	});
    function display_articles()
    {
		var article = $('#search_language_variables').val();
		if(article.length < 3)
			$("#vis_global_msg_div").visInterface("load_global_message", "<? echo $vis_language['TXTGLOBALSEARCHERROR'];?>");
		else if(article!="")
		$('#vis_workpanel_div').visExecution('load_module', '<? echo $vis_language['TXTARTICLES']; ?>', {'vis_module':'selfhelp', 'vis_operation':'view_articles', 'vis_action':'no_load','criteria':article});
		else
		$("#vis_global_msg_div").visInterface("load_global_message", "<? echo $vis_language['MSGSERARTBOX'];?>");
	}
    function delete_comments()
   {
		var selected = [];
		var selected1 = [];
		var vis_action = "";
		$('#checkbox_data input:checked').each(function() {
		selected.push($(this).attr('name'));
		selected1.push($(this).attr('value'));
		vis_action +=$(this).attr('name')+"="+$(this).attr('value')+",";
		});
		if( selected.length > 0)
		 {
			 vis_action= vis_action.substring(0, vis_action.length-1);
			$('#del_comment').attr('data-toggle','ajaxModal');
			$('#del_comment').attr('data-modal-arguments','vis_module=<?php echo $operation['vis_current_module']; ?>&vis_operation=get_mass_delete&vis_value=1&vis_static_area=vis_comments_delete_area&vis_form=vis_<?php echo $operation['vis_operation']; ?>_form&vis_switch=Comments&vis_page=<? echo $comments_info['page']; ?>');
		}
		 else
		{
			$("#vis_global_msg_div").visInterface("load_global_message", "<? echo $vis_language['MSGCOMNTSEL'];?>");
			return false;
		}
	}
</script>
<script src="<?= VIS_PATH_SCRIPT; ?>dropdown_dropup.js"></script>
<?
}
else
{
 include(VIS_PATH_TEMPLATE.'no_record_yet.php');
} ?>
