<?php session_start();
if($_SESSION[id]!=""){ ?>
<html dir="rtl">
<head>
<title>
صفحه موضوعات
</title>
<style>
td
{
  padding-top:10px;
  padding-bottom:10px;
}

</style>
</head>
<body>
<?php //include ('header.php');
include('dbf.php');


?>
<br>
<table dir="rtl" border="0" align="center">
	<tr>
		<td valign="top">
			<table border="0" width="750" align="center">
			<tr>
				<td align="center">
				<?php
				 if($_GET['mode']=='update')
				 {
				$q=$_GET[q2];
				$p=mysql_query("select * from `mozo` where id='{$_GET['q2']}'");
				$fp=mysql_fetch_assoc($p);
				 ?>
					<form name="f1" action="subject.php"  method="post">
					<div class="divfieldset">
	                    <fieldset style="width:250px;height:150px"><legend align="right" >ویرایش موضوع </legend>
					<table align="center" border="0" dir="rtl" ><br>
						<tr>
							<td class="label">
							<span> موضوع</span>
							</td>
							<td>
								<input type="text" tabindex="1" title="ویرایش موضوع"  value="<?php echo $fp['moz']; ?>" name="moz" id="moz" size="20">
							</td>
						</tr>
						<input type="hidden"  id="val" name="val" value="" >
						<tr>
							<td colspan="2" align="center"></br>
								<input type="hidden" name="id" id="id" value="<?php echo $fp['id']; ?>">
								<button  name="mozo" value="1" title="ویرایش" type="button" onClick="param('moz,moz'),update(document.getElementById('val').value,'a_subject.php','<?php echo $q;?>',ajaxload('subject.php'))" tabindex="2"><img src="images/sabtf2.png" border="0" height="20" width="20"></button>
								<button   name="ret" value="1" title="بازگشت" type="button"  onClick="ajaxload('subject.php')" tabindex="3"><img src="images/r1.png" border="0" height="20" width="20"></button>
							</td>
						</tr>
					</table>
					</fieldset>
                  </div>
					</form>
					</td>
				</tr>
				<?php
				}
				 elseif($_GET['mode']=='delete')
				 {
				$q=$_GET[q2];
				$p=mysql_query("select * from `mozo` where id='{$_GET['q2']}'");
				$fp=mysql_fetch_assoc($p);
				 ?>
					<form name="f1" action="subject.php"  method="post">
					<div class="divfieldset">
	                    <fieldset style="width:250px;height:150px"><legend align="right" >حذف موضوع </legend>
					<table align="center" border="0" dir="rtl" ><br>

						<tr>
							<td class="label">
							<span> موضوع :</span>
							</td>
							<td>
								<span class="blacktext"><?php echo $fp['moz']; ?>
							</td>
						</tr>
						<input type="hidden"  id="val" name="val" value="" >
						<tr>
							<td colspan="2" align="center"></br>
								<input type="hidden" name="id" id="id" value="<?php echo $fp['id']; ?>">
								<button  name="mozo" value="1" title="حذف" type="button" onClick="dele('a_subject.php','<?php echo $q;?>',ajaxload('subject.php'))" tabindex="2"><img src="images/b_drop.png"  name="del"  border="0" width="20" height="20" ></button>
								<button   name="ret" value="1" title="بازگشت" type="button"  onClick="ajaxload('subject.php')" tabindex="3"><img src="images/r1.png" border="0" height="20" width="20"></button>
							</td>
						</tr>
					</table>
				    </fieldset>
                  </div>
					</form>
					</td>
				</tr>
				<?php
				}
				elseif($_GET['new']){ ?>
					<form name="f2"  action=""  method="post">
				  <div class="divfieldset">
	                <fieldset style="width:250px;height:150px"><legend align="right" >ثبت موضوع </legend>
					<table align="center" border="0" dir="rtl" ><br>

						<tr>

							<td class="label">
							<span >موضوع :</span>
							</td>
							<td>
								<input type="text" tabindex="1" title="درج موضوع جدید"  name="moz" id="moz" size="20">
							</td>
						</tr>
                        <div id="m"></div>
						<tr>
							<td colspan="2" align="center"></br>
								<button  type="button" onClick="insert1(document.getElementById('moz').value,'<?php echo 'a_subject.php' ; ?>','moz')" name="mozo" value="2" title="تایید" tabindex="2"><img src="images/sabtf2.png" border="0" height="20" width="20"></button>
								<button  type="button" onClick="ajaxload('subject.php')" value="1" title="بازگشت" tabindex="3"><img src="images/r1.png" border="0" height="20" width="20"></button>
							</td>
						</tr>
					</table>
					  </fieldset>
                  </div>
					</form>
					</td>
				</tr>


				<?php }?>
		</td>
		<td valign="top">
	<?php
	//include ('menu.html');
	//include ('back.htm');
	?>
		</td>
	</tr>
</table>
<?php
//include ('foteer.php');
}
else
include('index.php');
?>
</body>
</html>
