<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
// +----------------------------------------------------------------------+
// | PHP version 4/5                                                      |
// +----------------------------------------------------------------------+
// | This source file is a part of iScripts Multicart                     |
// +----------------------------------------------------------------------+
// | Authors: Santhosh Thomas Alexander<santhosh.thomas@armiasystems.com>        		              |
// +----------------------------------------------------------------------+
// | Copyrights Armia Systems, Inc and iScripts.com � 2005                |
// | All rights reserved                                                  |
// +----------------------------------------------------------------------+
// | This script may not be distributed, sold, given away for free to     |
// | third party, or used as a part of any internet services such as      |
// | webdesign etc.                                                       |
// +----------------------------------------------------------------------+
?>
<?php
include "includes/config.php";
include "includes/session.php";
include "includes/functions.php";


/*display the active template*/

$active_template = displayTemplate();


include "includes/htmltop.php";

/* Top File Name */

include_once ("includes/".$active_template[0]);

?>
<div align="left" class="main_body">
			<!--mainbody area start -->
	<div class="reg_wrapper">
			<div class="reg_wrapper_header">
			<h2><?php echo HELP_TEXT;?></h2>
			</div>
		
			
		<div align="left" id="item_details">
	
	
		<!--items display area start -->
	
		
		
		<div class="text_information" align="center"><?php echo $message?></div>
	
	
		<div class="cms_content_area">

		
<table width="100%"  border="0" cellspacing="1" cellpadding="3" >
	<tr>
		<td width="1%" colspan="2">
			<table width="100%" border="0" cellspacing="0" cellpadding="5" >
<?php 
 $help="SELECT h.*,hc.* 
			FROM ".$tableprefix."help h 
			INNER JOIN ".$tableprefix."helpcategory hc on h.hcid=hc.hcid 
			WHERE hc.htype='client' AND h.active='1' 
			GROUP BY h.hcid 
			ORDER BY h.hposition ASC";


$result = mysql_query($help) or die(mysql_error());
if(mysql_num_rows($result)>0)
{
$onThisPage = mysql_num_rows($result);
?>
				
<?php
for($i=0;$i<mysql_num_rows($result);$i++)
{
$contents=mysql_query("SELECT * FROM ".$tableprefix."help where active='1' and 
hcid='".mysql_result($result,$i,'hcid')."' ORDER BY hposition ASC") or die(mysql_error());
if(mysql_num_rows($contents)>0)
{	
if($k==4)
{
echo '</tr><tr class="help_hdrs"><td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0" class="help">
<tr><td colspan="2"><b>'.ucfirst(mysql_result($result,$i,'hctitle')).'</b></td></tr><tr><td>&nbsp;</td></tr>';

$k=1;
}//end if
else
{
echo '<td align="left" valign="top"><table width="100%"  border="0" cellspacing="1" cellpadding="5" class="help_tblestyle1">
<tr class="help_hdrs"><td colspan="2"><b>'.ucfirst(mysql_result($result,$i,'hctitle')).'</b></td></tr>';
$k++;
}//end else


for($j=0;$j<mysql_num_rows($contents);$j++)
{
?>

				<tr>
                                    
					<td width="96%" align="left" class="help_text"><a href="help_details.php?id=<?php echo mysql_result($contents,$j,'hid');?>"><?php echo str_replace('{SITE_NAME}', SITE_NAME, mysql_result($contents,$j,'htitle'));?></a>
					</td>
					<td width="4%" align="center"><a href="help_details.php?id=<?php echo mysql_result($contents,$j,'hid');?>"><img src="./help/<?php echo mysql_result($contents,$j,'himage');?>" width="22" height="20" alt="<?php echo str_replace('{SITE_NAME}', SITE_NAME, mysql_result($contents,$j,'htitle'));?>" border="0">
					</a></td>
				</tr>
<?php
}//end inner for loop
}//end if
echo '</table></td>';
}//end out for loop
}//end if
else {
echo '<tr bgcolor="#F2F9FD"><td height="51"  align="center" colspan="2" class="help_text"><p>&nbsp;</p><p>&nbsp;</p>
<strong>'.NO_RECORDS_MSG.'<p>&nbsp;</p><p>&nbsp;</p></strong></td></tr>';
}//end else
if(rightpaging()!='')
{
?>
				<tr bgcolor="#FEFFF9"><td align="right" colspan="5"><?php echo rightpaging();?></td></tr>
<?php }//end if?>
			</table>
		</td>
	</tr>
</table>

           
		</div>	
 <!--items display area end -->
  </div>
  </div>
<!--center content area end-->	
<!--mainbody area end -->
</div>
<?php
include "includes/".$active_template[2];	
/* Bottom File Name */
?>