function html_show_spider_cat($rows, $pageNav, $sort)
{
    global $wpdb;
    $serch_value = "";
    if (!isset($sort["sortid_by"])) {
        $sort["sortid_by"] = "id";
    }
    if (!isset($sort["custom_style"])) {
        $sort["custom_style"] = "";
    }
    if (!isset($sort["1_or_2"])) {
        $sort["1_or_2"] = "1";
    }
    ?>
    <script language="javascript">
	function ordering(name,as_or_desc)
	{
		document.getElementById('asc_or_desc').value=as_or_desc;		
		document.getElementById('order_by').value=name;
		document.getElementById('admin_form').submit();
	}
	
	
				 	function doNothing() {  
var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
    if( keyCode == 13 ) {


        if(!e) var e = window.event;

        e.cancelBubble = true;
        e.returnValue = false;

        if (e.stopPropagation) {
                e.stopPropagation();
                e.preventDefault();
        }
}
}
	</script>
    <form method="post"  onkeypress="doNothing()" action="admin.php?page=Spider_Faq_Categories" id="admin_form" name="admin_form">
	 <?php 
    $sp_faq_nonce = wp_create_nonce('nonce_sp_faq');
    ?>
	 <div style="display:block;width:95%;text-align:right"><a href="http://web-dorado.com/files/fromFAQWP.php" target="_blank" style="color:red; text-decoration:none;">
            <img src="<?php 
    echo plugins_url('images/header.png', __FILE__);
    ?>
" border="0" alt="http://web-dorado.com/files" width="215"><br>
            Get the full version&nbsp;&nbsp;&nbsp;&nbsp;
            </a>
			</div>
	<table cellspacing="10" width="100%">
	 <tr>
        	<td width="100%" style="font-size:14px; font-weight:bold"><a href="http://web-dorado.com/spider-faq-wordpress-guide-step-2.html" target="_blank" style="color:blue; text-decoration:none;">User Manual</a><br>
This section allows you to create categories of questions <a href="http://web-dorado.com/spider-faq-wordpress-guide-step-2.html" target="_blank" style="color:blue; text-decoration:none;">More...</a></td>
           
   			</tr>
    <tr>
    <td style="width:80px">
    <?php 
    echo "<h2>" . 'Categories' . "</h2>";
    ?>
    </td>
    <td  style="width:90px; text-align:right;"><p class="submit" style="padding:0px; text-align:left"><input type="button" value="Add a Category" name="custom_parametrs" onclick="window.location.href='admin.php?page=Spider_Faq_Categories&task=add_Spider_Faq_Categories'" /></p></td>
<td style="text-align:right;font-size:16px;padding:20px; padding-right:30px">

	</td>

    </tr>
    </table>
    <?php 
    if (isset($_POST['serch_or_not'])) {
        if (esc_html($_POST['serch_or_not']) == "search") {
            $serch_value = esc_js(esc_html(stripslashes($_POST['search_events_by_title'])));
        } else {
            $serch_value = "";
        }
    }
    $serch_fields = '<div class="alignleft actions" style="width:204px;">
    	<label for="search_events_by_title" style="font-size:14px">Title: </label>
        <input type="text" name="search_events_by_title" value="' . $serch_value . '" id="search_events_by_title" onchange="clear_serch_texts()" >
    </div>
	<div class="alignleft actions" style="padding: 2px 18px 0 0px">
   		<input type="button" value="Search" onclick="document.getElementById(\'page_number\').value=\'1\'; document.getElementById(\'serch_or_not\').value=\'search\';
		 document.getElementById(\'admin_form\').submit();" class="button-secondary action">
		 <input type="button" value="Reset" onclick="window.location.href=\'admin.php?page=Spider_Faq_Categories\'" class="button-secondary action">
    </div>';
    print_html_nav1($pageNav['total'], $pageNav['limit'], $serch_fields);
    ?>
  <table class="wp-list-table widefat fixed pages" style="width:95%">
 <thead>
 <TR>
   <th scope="col" id="id" class="<?php 
    if ($sort["sortid_by"] == "id") {
        echo $sort["custom_style"];
    }
    ?>
" style="width:44px;padding: 2px 11px 2px 0px;" ><a style="padding: 8px 4px 7px 10px;" href="javascript:ordering('id',<?php 
    if ($sort["sortid_by"] == "id") {
        echo $sort["1_or_2"];
    } else {
        echo "1";
    }
    ?>
)"><span>ID</span><span style="margin-top:6px; margin-left:5px" class="sorting-indicator"></span></a></th>
 <th scope="col" id="title" class="<?php 
    if ($sort["sortid_by"] == "title") {
        echo $sort["custom_style"];
    }
    ?>
" style="" ><a href="javascript:ordering('title',<?php 
    if ($sort["sortid_by"] == "title") {
        echo $sort["1_or_2"];
    } else {
        echo "1";
    }
    ?>
)"><span>Title</span><span class="sorting-indicator"></span></a></th>
<th scope="col" id="description" class="<?php 
    if ($sort["sortid_by"] == "description") {
        echo $sort["custom_style"];
    }
    ?>
" style="" ><a href="javascript:ordering('description',<?php 
    if ($sort["sortid_by"] == "description") {
        echo $sort["1_or_2"];
    } else {
        echo "1";
    }
    ?>
)"><span>Description</span><span class="sorting-indicator"></span></a></th>
  <th scope="col" id="published"  class="<?php 
    if ($sort["sortid_by"] == "published") {
        echo $sort["custom_style"];
    }
    ?>
" style="width:100px" ><a href="javascript:ordering('published',<?php 
    if ($sort["sortid_by"] == "published") {
        echo $sort["1_or_2"];
    } else {
        echo "1";
    }
    ?>
)"><span>Published</span><span class="sorting-indicator"></span></a></th>
 <th style="width:80px">Edit</th>
 <th style="width:80px">Delete</th>
 </TR>
 </thead>
 <tbody>
 <?php 
    for ($i = 0; $i < count($rows); $i++) {
        ?>
 <tr>
         <td style="padding-left: 10px;padding-top: 8px; padding-bottom: 0px; padding-right: 0px;"><?php 
        echo $rows[$i]->id;
        ?>
</td>
         <td><a  href="admin.php?page=Spider_Faq_Categories&task=edit_Spider_Faq_Categories&id=<?php 
        echo $rows[$i]->id;
        ?>
"><?php 
        echo $rows[$i]->title;
        ?>
</a></td>
         <td><?php 
        echo $rows[$i]->description;
        ?>
</td>
         
         <td><a  href="admin.php?page=Spider_Faq_Categories&task=unpublish_Spider_Faq_Categories&id=<?php 
        echo $rows[$i]->id;
        ?>
&_wpnonce=<?php 
        echo $sp_faq_nonce;
        ?>
"<?php 
        if (!$rows[$i]->published) {
            ?>
 style="color:#C00;" <?php 
        }
        ?>
 ><?php 
        if ($rows[$i]->published) {
            echo "Yes";
        } else {
            echo "No";
        }
        ?>
</a></td>
         <td ><a  href="admin.php?page=Spider_Faq_Categories&task=edit_Spider_Faq_Categories&id=<?php 
        echo $rows[$i]->id;
        ?>
">Edit</a></td>
         
		 <td><a href="javascript:confirmation('admin.php?page=Spider_Faq_Categories&task=remove_Spider_Faq_Categories&id=<?php 
        echo $rows[$i]->id;
        ?>
&_wpnonce=<?php 
        echo $sp_faq_nonce;
        ?>
','<?php 
        if ($rows[$i]->title != "") {
            echo addslashes($rows[$i]->title);
        } else {
            echo "";
        }
        ?>
')">Delete</a> </td>
  </tr> 
 <?php 
    }
    ?>
 </tbody>
 </table>
 <?php 
    wp_nonce_field('nonce_sp_faq', 'nonce_sp_faq');
    ?>
 <input type="hidden" name="oreder_move" id="oreder_move" value="" />
 <input type="hidden" name="asc_or_desc" id="asc_or_desc" value="<?php 
    if (isset($_POST['asc_or_desc'])) {
        echo esc_js(esc_html(stripslashes($_POST['asc_or_desc'])));
    }
    ?>
"  />
 <input type="hidden" name="order_by" id="order_by" value="<?php 
    if (isset($_POST['order_by'])) {
        echo esc_js(esc_html(stripslashes($_POST['order_by'])));
    }
    ?>
"  />
 <input type="hidden" name="saveorder" id="saveorder" value="" />

 <?php 
    ?>
    
    
   
 </form>
    <?php 
}
function html_show_spider_theme($rows, $pageNav, $sort)
{
    global $wpdb;
    $serch_value = "";
    if (!isset($sort["sortid_by"])) {
        $sort["sortid_by"] = "id";
    }
    if (!isset($sort["custom_style"])) {
        $sort["custom_style"] = "";
    }
    if (!isset($sort["1_or_2"])) {
        $sort["1_or_2"] = "1";
    }
    ?>
    <script language="javascript">
	function ordering(name,as_or_desc)
	{ 
		document.getElementById('asc_or_desc').value=as_or_desc;		
		document.getElementById('order_by').value=name;
		document.getElementById('admin_form').submit();
	}
	function saveorder()
	{
		document.getElementById('saveorder').value="save";
		document.getElementById('admin_form').submit();
		
	}
	function listItemTask(this_id,replace_id)
	{
		document.getElementById('oreder_move').value=this_id+","+replace_id;
		document.getElementById('admin_form').submit();
	}
				 	function doNothing() {  
var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
    if( keyCode == 13 ) {


        if(!e) var e = window.event;

        e.cancelBubble = true;
        e.returnValue = false;

        if (e.stopPropagation) {
                e.stopPropagation();
                e.preventDefault();
        }
}
}
	</script>
    <form method="post"  onkeypress="doNothing()" action="admin.php?page=Spider_Faq_Themes" id="admin_form" name="admin_form">
	<table cellspacing="10" width="100%">
	 <tr>
        <td width="100%" style="font-size:14px; font-weight:bold"><a href="http://web-dorado.com/step-4-adding-themes/spider-faq-wordpress-guide-step-4-1.html" target="_blank" style="color:blue; text-decoration:none;">User Manual</a><br>
This section allows you to create/edit themes for the FAQs. <a href="http://web-dorado.com/step-4-adding-themes/spider-faq-wordpress-guide-step-4-1.html" target="_blank" style="color:blue; text-decoration:none;">More...</a></td>
   
   			</tr>
	
    <tr>
    <td style="width:80px">
    <?php 
    echo "<h2>" . 'Themes' . "</h2>";
    ?>
    </td>
    <td  style="width:90px; text-align:right;"><p class="submit" style="padding:0px; text-align:left"><input type="button" value="Add a Theme" name="custom_parametrs" onclick="window.location.href='admin.php?page=Spider_Faq_Themes&task=add_Spider_Faq_Themes'" /></p></td>
<td style="text-align:right;font-size:16px;padding:20px; padding-right:30px">

	</td>

    </tr>
    </table>
    <?php 
    if (isset($_POST['serch_or_not'])) {
        if (esc_html($_POST['serch_or_not']) == "search") {
            $serch_value = esc_sql(esc_html(stripslashes($_POST['search_events_by_title'])));
        } else {
            $serch_value = "";
        }
    }
    $serch_fields = '<div class="alignleft actions" style="width:204px;">
    	<label for="search_events_by_title" style="font-size:14px">Title: </label>
        <input type="text" name="search_events_by_title" value="' . $serch_value . '" id="search_events_by_title" onchange="clear_serch_texts()">
    </div>
	<div class="alignleft actions">
   		<input type="button" value="Search" onclick="document.getElementById(\'page_number\').value=\'1\'; document.getElementById(\'serch_or_not\').value=\'search\';
		 document.getElementById(\'admin_form\').submit();" class="button-secondary action">
		 <input type="button" value="Reset" onclick="window.location.href=\'admin.php?page=Spider_Faq_Themes\'" class="button-secondary action">
    </div>';
    print_html_nav1($pageNav['total'], $pageNav['limit'], $serch_fields);
    ?>
  <table class="wp-list-table widefat fixed pages" style="width:95%">
 <thead>
 <TR>
   <th scope="col" id="id" class="<?php 
    if ($sort["sortid_by"] == "id") {
        echo $sort["custom_style"];
    }
    ?>
" style="width:45px;padding: 2px 11px 2px 0px;" ><a style="padding: 8px 4px 7px 10px;" href="javascript:ordering('id',<?php 
    if ($sort["sortid_by"] == "id") {
        echo $sort["1_or_2"];
    } else {
        echo "1";
    }
    ?>
)"><span>ID</span><span style="margin-top:6px; margin-left:5px" class="sorting-indicator"></span></a></th>
 <th scope="col" id="title" class="<?php 
    if ($sort["sortid_by"] == "title") {
        echo $sort["custom_style"];
    }
    ?>
" style="" ><a href="javascript:ordering('title',<?php 
    if ($sort["sortid_by"] == "title") {
        echo $sort["1_or_2"];
    } else {
        echo "1";
    }
    ?>
)"><span>Title</span><span class="sorting-indicator"></span></a></th>


 <th style="width:80px">Edit</th>
 <th style="width:80px">Delete</th>
 </TR>
 </thead>
 <tbody>
 <?php 
    for ($i = 0; $i < count($rows); $i++) {
        if (isset($rows[$i - 1]->id)) {
            $move_up = '<span><a href="#reorder" onclick="return listItemTask(\'' . $rows[$i]->id . '\',\'' . $rows[$i - 1]->id . '\')" title="Move Up">   <img src="' . plugins_url('images/uparrow.png', __FILE__) . '" width="16" height="16" border="0" alt="Move Up"></a></span>';
        } else {
            $move_up = "";
        }
        if (isset($rows[$i + 1]->id)) {
            $move_down = '<span><a href="#reorder" onclick="return listItemTask(\'' . $rows[$i]->id . '\',\'' . $rows[$i + 1]->id . '\')" title="Move Down">  <img src="' . plugins_url('images/downarrow.png', __FILE__) . '" width="16" height="16" border="0" alt="Move Down"></a></span>';
        } else {
            $move_down = "";
        }
        ?>
 <tr>
         <td style="padding-left: 10px;padding-top: 8px; padding-bottom: 0px; padding-right: 0px;"><?php 
        echo $rows[$i]->id;
        ?>
</td>
         <td><a  href="admin.php?page=Spider_Faq_Themes&task=edit_Spider_Faq_Themes&id=<?php 
        echo $rows[$i]->id;
        ?>
"><?php 
        echo $rows[$i]->title;
        ?>
</a></td>
  
         
         <td ><a  href="admin.php?page=Spider_Faq_Themes&task=edit_Spider_Faq_Themes&id=<?php 
        echo $rows[$i]->id;
        ?>
">Edit</a></td>
         
		 <td><a href="javascript:confirmation('admin.php?page=Spider_Faq_Themes&task=remove_Spider_Faq_Themes&id=<?php 
        echo $rows[$i]->id;
        ?>
','<?php 
        if ($rows[$i]->title != "") {
            echo addslashes($rows[$i]->title);
        } else {
            echo "";
        }
        ?>
')">Delete</a> </td>
  </tr> 
 <?php 
    }
    ?>
 </tbody>
 </table>
 <input type="hidden" name="oreder_move" id="oreder_move" value="" />
 <input type="hidden" name="asc_or_desc" id="asc_or_desc" value="<?php 
    if (isset($_POST['asc_or_desc'])) {
        echo esc_sql(esc_html(stripslashes($_POST['asc_or_desc'])));
    }
    ?>
"  />
 <input type="hidden" name="order_by" id="order_by" value="<?php 
    if (isset($_POST['order_by'])) {
        echo esc_sql(esc_html(stripslashes($_POST['order_by'])));
    }
    ?>
"  />
 <input type="hidden" name="saveorder" id="saveorder" value="" />

 <?php 
    ?>
    
    
   
 </form>
    <?php 
}
function html_select_standcategory($rows, $pageNav, $sort)
{
    $serch_value = "";
    if (!isset($sort["sortid_by"])) {
        $sort["sortid_by"] = "term_id";
    }
    if (!isset($sort["custom_style"])) {
        $sort["custom_style"] = "";
    }
    if (!isset($sort["1_or_2"])) {
        $sort["1_or_2"] = "2";
    }
    ?>
<script type="text/javascript">

function submitbutton(pressbutton) {

var form = document.adminForm;

if (pressbutton == 'cancel') 

{

submitform( pressbutton );

return;

}

submitform( pressbutton );

}
function yyy()
{

	var cid =[];
	var titles =[];
	
	for(i=0; i<<?php 
    echo count($rows);
    ?>
; i++)
		if(document.getElementById("c"+i))
			if(document.getElementById("c"+i).checked)
			{
				cid.push(document.getElementById("c"+i).value);
				titles.push(document.getElementById("titles_"+i).value);
				
			}
	window.parent.jSelectStandCategories(cid, titles);
}
function ordering(name,as_or_desc)
	{
		document.getElementById('asc_or_desc').value=as_or_desc;		
		document.getElementById('order_by').value=name;
		document.getElementById('admin_form').submit();
	}
function checkAll( n, fldName ) {
  if (!fldName) {
     fldName = 'cb';
  }
	var f = document.adminForm;
	var c = f.toggle.checked;
	var n2 = 0;
	for (i=0; i < n; i++) {
		cb = eval( 'f.' + fldName + '' + i );
		if (cb) {
			cb.checked = c;
			n2++;
		}
	}
	if (c) {
		document.adminForm.boxchecked.value = n2;
	} else {
		document.adminForm.boxchecked.value = 0;
	}
}
</script>
<style>
input[type=checkbox]:before {
 font: 400 21px/1 Dashicons !important; 
}
input[type=checkbox] {
 max-width:16px !important;
 max-height:16px !important;
}
</style>
    <link media="all" type="text/css" href="<?php 
    echo get_admin_url();
    ?>
load-styles.php?c=1&amp;dir=ltr&amp;load=admin-bar,wp-admin,dashicons,buttons,wp-auth-check" rel="stylesheet">
    <link media="all" type="text/css" href="<?php 
    echo get_admin_url();
    ?>
css/colors<?php 
    echo get_bloginfo('version') < '3.8' ? '-fresh' : '';
    ?>
.min.css" id="colors-css" rel="stylesheet">	  
	<form action="<?php 
    echo admin_url('admin-ajax.php?action=spiderFaqselectstandcategory');
    ?>
" method="post" id="admin_form" name="adminForm">
    
		<table style="width:98%">
           <td align="right" width="100%">
           <button onclick="yyy();" style="width:98px; height:34px; background:url(<?php 
    echo plugins_url("images/add_but.png", __FILE__);
    ?>
) no-repeat;border:none;cursor:pointer;">&nbsp;</button>        
             </td>

       </tr>
		</table>    
    
        <?php 
    if (isset($_POST['serch_or_not'])) {
        if ($_POST['serch_or_not'] == "search") {
            $serch_value = esc_sql(esc_html(stripslashes($_POST['search_events_by_title'])));
        } else {
            $serch_value = "";
        }
    }
    $serch_fields = '<div class="alignleft actions" style="width:180px;">
    	<label for="search_events_by_title" style="font-size:14px">Title: </label>
        <input type="text" name="search_events_by_title" value="' . $serch_value . '" id="search_events_by_title" onchange="clear_serch_texts()">
    </div>
	<div class="alignleft actions">
   		<input type="button" value="Search" onclick="document.getElementById(\'page_number\').value=\'1\'; document.getElementById(\'serch_or_not\').value=\'search\';
		 document.getElementById(\'admin_form\').submit();" class="button-secondary action">
		 <input type="button" value="Reset" onclick="window.location.href=\'' . admin_url('admin-ajax.php?action=spiderFaqselectstandcategory') . '\'" class="button-secondary action">
    </div>';
    print_html_nav1($pageNav['total'], $pageNav['limit'], $serch_fields);
    ?>
    <table class="wp-list-table widefat plugins" style="margin:25px; width:93%" >
    <thead>
    	<tr style="position:inherit">
         <th style="width:44px;position:inherit;padding:19px 3px 6px 4px" class="manage-column column-cb check-column"><input  type="checkbox" name="toggle" id="toggle" value="" onclick="checkAll(<?php 
    echo count($rows);
    ?>
, 'c')" style="margin-top: -9px;"></th>
         <th style="width:70px;padding-left:60px" scope="col" id="id" class="table_small_col <?php 
    if ($sort["sortid_by"] == "term_id") {
        echo $sort["custom_style"];
    }
    ?>
" style="width:110px" ><a style="padding:0px;" href="javascript:ordering('term_id',<?php 
    if ($sort["sortid_by"] == "term_id") {
        echo $sort["1_or_2"];
    } else {
        echo "1";
    }
    ?>
)"><span style="align:center">ID</span><span class="sorting-indicator"></span></a></th>
         <th style="width: 79%;padding-left: 89px;" scope="col" id="title" class="<?php 
    if ($sort["sortid_by"] == "name") {
        echo $sort["custom_style"];
    }
    ?>
" style="" ><a style="padding:0px;" href="javascript:ordering('name',<?php 
    if ($sort["sortid_by"] == "name") {
        echo $sort["1_or_2"];
    } else {
        echo "1";
    }
    ?>
)"><span>Title</span><span class="sorting-indicator"></span></a></th>
       </tr>
    </thead>	
    <?php 
    $k = 0;
    for ($i = 0, $n = count($rows); $i < $n; $i++) {
        $row =& $rows[$i];
        ?>
        <tr class="<?php 
        echo "row{$k}";
        ?>
">
        	<td class="table_small_col check-column" style="padding:9px 4px 6px 13px">
            <input type="checkbox" id="c<?php 
        echo $i;
        ?>
" value="<?php 
        echo $row->term_id;
        ?>
" />
            <input type="hidden" id="titles_<?php 
        echo $i;
        ?>
" value="<?php 
        echo htmlspecialchars($row->catname);
        ?>
" />          
            </td>
        	<td class="table_small_col"><?php 
        echo $row->term_id;
        ?>
</td>
        	<td style="padding-left: 105px;"><a style="cursor: pointer;" onclick="window.parent.jSelectStandCategories(['<?php 
        echo $row->term_id;
        ?>
'],['<?php 
        echo htmlspecialchars(addslashes($row->catname));
        ?>
'])"><?php 
        echo $row->catname;
        ?>
</a></td>            
                
        </tr>
        <?php 
        $k = 1 - $k;
    }
    ?>
    </table>
    <input type="hidden" name="asc_or_desc" id="asc_or_desc" value="<?php 
    if (isset($_POST['asc_or_desc'])) {
        echo esc_sql(esc_html(stripslashes($_POST['asc_or_desc'])));
    } else {
        echo "1";
    }
    ?>
"  />
 	<input type="hidden" name="order_by" id="order_by" value="<?php 
    if (isset($_POST['order_by'])) {
        echo esc_sql(esc_html(stripslashes($_POST['order_by'])));
    } else {
        echo "term_id";
    }
    ?>
"  />
    <input type="hidden" name="option" value="com_Spider_Video_Player">
    <input type="hidden" name="task" value="select_playlist">    
    <input type="hidden" name="boxchecked" value="0">     
    </form>
    <?php 
}