<?
/*
FAQs Manager Plugin 1.0 (General Use)
Build Date 1.29.2003
*/
?>

					<table width="95%" cellpadding="0" cellspacing="0">
					
						<tr>
						
							<td width="50%" valign="top">
							
								<table width="95%">
									
									<script language="javascript">
						
										function vdelete() {
											var agree=confirm("Are you sure you want to delete the selected FAQs?");
											if (agree) {
												document.faqs.action = "actions.php?a_mode=delete_faqs";
												document.faqs.submit();
											}
											else {
												false
											}
										}
														
									</script>
									
									<form name="faqs" method="post">
									<input type="hidden" name="return" value="<? echo "mgr.index.php?n=" . $n . "&p_mode=" . $p_mode; ?>">
									
									<tr bgcolor="#eeeeee">
									
										<td align="center" style="border-bottom: 1px solid #CCCBCB;border-right: 1px solid #CCCBCB"><font face="verdana" size="2" color="#8C8E91"><b>ID</b></td>
									
										<td align="left" style="border-bottom: 1px solid #CCCBCB;border-right: 1px solid #CCCBCB"><font face="verdana" size="2" color="#8C8E91"><b>FAQ</b> <font face="verdana" size="1">(click to edit)</td>
										
										<td align="center" style="border-bottom: 1px solid #CCCBCB;border-right: 1px solid #CCCBCB"><font face="verdana" size="2" color="#8C8E91"><b>Delete</b></td>
									
									</tr>
									
									<?									
									$faqs_result = mysql_query("SELECT * FROM faqs order by 'faq_id'", $db);
									$rows = mysql_num_rows($faqs_result);
									while($faqs = mysql_fetch_object($faqs_result)){
										if(strlen($faqs->question) > 30){
											$trim_title = substr($faqs->question, 0, 30) . "...";
										}
										else {
											$trim_title = $faqs->question;
										}
										
										$row_color++;	
										if ($row_color%2 == 0) {
											echo "<tr bgcolor=\"#ECF6F8\">";
										}
										else {
											echo "<tr>";
										}
									?>
									
										<td align="center"><font face="verdana" size="1" color="#A4A3A3"><? echo $faqs->faq_id; ?></a></td>
									
										<td><font face="verdana" size="1"><a href="mgr.index.php?n=<? echo $n; ?>&p_mode=<? echo $p_mode; ?>&f_id=<? echo $faqs->faq_id; ?>"><? echo $trim_title; ?></a></td>
										
										<td align="center"><input type="checkbox" name="<? echo $faqs->faq_id; ?>" value="1"></td>
										
									</tr>
									
									<?
									}
										if($rows == 0){
									?>
										<tr>
										
											<td colspan="3" align="center"><font face="verdana" size="2" color="#8C8E91">There are no FAQ's at this time.</td>
											
										</tr>
									<?
										}
										else{
									?>
										<tr>
										
											<td></td>
										
											<td></td>
											
											<td align="center"><? if($mgr_login_type == "demo"){ ?><img src="images/b.delete.gif" onclick="demo_mode()"><? } else { ?><a href="#" onclick="vdelete();"><img src="images/b.delete.gif" border="0"></a><? } ?></td>
											
										</tr>
									<?
										}
									?>
									</form>
									
									<tr bgcolor="#eeeeee">
						
										<td align="left" colspan="3" style="border-bottom: 1px solid #CCCBCB;border-right: 1px solid #CCCBCB"><font face="verdana" size="1" color="#8C8E91"><b> &nbsp; </b></td>
										
									</tr>
									
								</table>
							
							</td>
							
							<td width="50%" valign="top">
							
								<table width="95%">
					
									<?
									if($f_id != ""){
										
										$faqs_result = mysql_query("SELECT * FROM faqs where faq_id = '$f_id'", $db);
										$faqs = mysql_fetch_object($faqs_result);
										
										echo "<form action=\"actions.php?a_mode=save_edit_faq\" method=\"post\">";
										echo "<input type=\"hidden\" name=\"f_id\" value=\"" . $f_id . "\">";
										echo "<input type=\"hidden\" name=\"return\" value=\"mgr.index.php?n=" . $n . "&p_mode=" . $p_mode . "\">";
									}
									else {
										echo "<form action=\"actions.php?a_mode=save_new_faq\" method=\"post\">";
										echo "<input type=\"hidden\" name=\"return\" value=\"mgr.index.php?n=" . $n . "&p_mode=" . $p_mode . "\">";
									}
									?>
								
									<tr bgcolor="#eeeeee">
									
										<td colspan="2" align="center" style="border-bottom: 1px solid #CCCBCB;border-right: 1px solid #CCCBCB"><font face="verdana" size="2" color="#8C8E91"><b><? if($f_id != ""){ echo "Edit"; } else { echo "Add"; } ?> FAQ</b></td>
									
									</tr>
									
									<tr>
						
										<td align="right"><font face="verdana" size="2" color="#8C8E91"><b>Question</b></font></td>
										<td align="right"><input type="text" name="question" value="<? echo $faqs->question; ?>" style="font-size: 10; width: 300" maxlength="256"></td>
										
									</tr>
									
									<tr>
						
										<td align="right" valign="top"><font face="verdana" size="2" color="#8C8E91"><b>Answer</b></font></td>
										<td align="right"><textarea name="answer" style="width: 300;height:125;"><? echo $faqs->answer; ?></textarea></td>
										
									</tr>
									
									<tr>
									
										<td colspan="2" align="right"><a href="mgr.index.php?n=<? echo $n; ?>&p_mode=<? echo $p_mode; ?>&f_id="><img src="images/b.cancel.gif" border="0"></a><? if($mgr_login_type == "demo"){ ?><img src="images/b.save.gif" onclick="demo_mode()"><? } else { ?><input type="image" src="images/b.save.gif"><? } ?></td>
										
									</tr>
									</form>
									
									<tr bgcolor="#eeeeee">
						
										<td align="right" colspan="2" style="border-bottom: 1px solid #CCCBCB;border-right: 1px solid #CCCBCB"><font face="verdana" size="1" color="#B3B3B3">FAQs Plugin &nbsp; </td>
										
									</tr>			
									
								</table>							
							
							</td>
							
						</tr>
						
					</table>