Hacked By AnonymousFox

Current Path : C:/AppServ/www/bkup/bhz/system/
Upload File :
Current File : C:/AppServ/www/bkup/bhz/system/department_manager.php

<? 
include("../lib/session.php"); 
include("../lib/config.php");
include("../lib/connect.php");
include("../lib/function.php");
?>
<html ><!-- InstanceBegin template="/Templates/WebEngine-Adminpanel1.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" /> 
<title><?=$System_Variable_Title?></title>
<link rel="stylesheet" type="text/css" href="../css/mystyle.css" />
<script language="javascript" type="text/javascript">
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->

<!--
function myMenuLink(Action, MenuID, ModuleKey) { //link from main menu
//alert(Action+","+MenuID+","+ModuleKey);
  var myMenuForm = document.myMenuForm;
  myMenuForm.action = Action;
  myMenuForm.SystemMenuID.value = MenuID;
  myMenuForm.SystemModuleKey.value = ModuleKey;
  myMenuForm.submit();
}
//-->

<!--
function menuHideSubShow(myIdName) { //show hide menu
	if(document.getElementById(myIdName).style.display=='none') { 
		document.getElementById(myIdName).style.display=''
	} else {
		document.getElementById(myIdName).style.display='none';
	}
}
//-->
</script>
<style type="text/css">
<!--
.style11 {font-size: 14; font-weight: bold; }
.style4 {	color: #B61B15;
	font-size: 12px;
}
.style5 {color: #FFFFFF}
.style7 {	color: #FFFFFF;
	font-size: 14;
	font-weight: bold;
}
.style8 {font-size: 14}
.style12 {
	color: #B4B4D3;
	font-weight: bold;
}
.style13 {color: #B4B4D3; font-size: 14; font-weight: bold; }
-->
</style>
</head>
<body onLoad="MM_preloadImages('../../images/home/lanTh_mover.gif','../../images/home/lanEng_mover.gif')">
<table style="border-collapse: collapse" border="1" bordercolor="#ECECEC" width="1003" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>
	<table width="873" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td class="head1"></td>
    <td align="right" class="head2"><a href="setlanguage.php?setlang=Thai&&action=setlanguage">  
	<? if($_SESSION[System_Session_Language]=="Thai") { ?>
      <img src="../images/home/lanTh_mover.gif" alt="" width="44" height="24" border="0" />
      <? } else { ?>
      <img src="../images/home/lanTh_mout.gif" alt="" name="btnTh" width="44" height="24" id="btnTh" onMouseOver="MM_swapImage('btnTh','','../images/home/lanTh_mover.gif',1)" onMouseOut="MM_swapImgRestore()" border="0" />
      <? } ?>
	  </a>
      <img src="../images/home/head4.gif" width="14" height="24" />
	<a href="setlanguage.php?setlang=Eng&&action=setlanguage">  
      <? if($_SESSION[System_Session_Language]=="Eng") { ?>
      <img src="../images/home/lanEng_mover.gif" alt="" width="44" height="24" border="0" />
      <? } else { ?>
      <img src="../images/home/lanEng_mout.gif" alt="" name="btnEng" width="44" height="24" id="btnEng" onMouseOver="MM_swapImage('btnEng','','../images/home/lanEng_mover.gif',1)" onMouseOut="MM_swapImgRestore()" border="0"/>
      <? } ?></a>&nbsp;
    </td>
    <td class="head3"></td>
  </tr>
</table>
<table width="1003" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td class="engine_header">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" class="bar01"><table width="1003" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="65" class="lmenu">&nbsp;</td>
          <td width="191" valign="top"><form action="../../Templates/" method="get" name="myMenuForm" id="myMenuForm">
              <input type="hidden" name="SystemMenuID">
              <input type="hidden" name="SystemModuleKey">
              <table width="191" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                  <td width="4"><img src="../images/home/menubox01-1.gif" alt="" width="4" height="36" /></td>
                  <td colspan="2" class="menubox01">&nbsp;</td>
                  <td width="6"><img src="../images/home/menubox01-2.gif" alt="" width="5" height="36" /></td>
                </tr>
                <tr>
                  <td width="4" class="menubox02"></td>
                  <td colspan="2">
				  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                 
                    <tr onMouseOver="this.className='table_rowover1'" >
                      <td height="1" <? if($SystemMenuID=="-5") { ?>class="menunameselect" <? } else { ?>  class="menuname" onMouseOut="this.className='table_rowover2'"<? } ?>><table width="100%" height="22" border="0" cellpadding="2" cellspacing="0">
                        <tr >
                          <td width="22" align="center"><img src="../images/icon/ico517.gif" alt="" width="16" height="16" border="0" align="absmiddle" /></td>
                          <td><div onClick="myMenuLink('../home/home.php', '-5', '')"><a href="javascript:void(0)">
                      <? if($SystemMenuID=="-5") { ?>
                      <span class="onmenu" style="cursor:pointer "> <?=$MenuHome?></span>
                      <? } else { ?>
                <?=$MenuHome?>
                      <? } ?>
                      </a></div></td>
                        </tr>
                      </table></td>
                    </tr>
					   <? if($System_Session_User_ID>0) { ?>
                    <tr> 
                      <td class="menuline">&nbsp;</td>
                    </tr>
                    <tr   > 
                      <td height="22"  <? if($SystemMenuID==-3) { ?>class="menunameselect" <? } else { ?>  class="menuname" onMouseOut="this.className='table_rowover2'"<? } ?> onMouseOver="this.className='table_rowover1'" onClick="myMenuLink('../system/user_information.php','-3','');">
					  <table width="100%" height="22" border="0" cellpadding="2" cellspacing="0">
                          <tr> 
                            <td width="22" align="center"><img src="../images/icon/ico559.gif" width="15" height="16"></td>
                            <td> 
                              <? if($SystemMenuID==-3) { ?>
                              <span class="onmenu" style="cursor:pointer "><?=$MeunuUser?></span>
                              <? } else { ?>
                          <span style="cursor:pointer "><?=$MeunuUser?> </span> 
                              <? } ?>                            </td>
                          </tr>
                        </table></td>
                    </tr>
                   <? } ?>
                    <!---------------------------------------------------------------------------->
                    <? if($System_Session_Level=="Admin") { ?>
                    <tr> 
                      <td class="menuline"></td>
                    </tr>
                    <tr <? if($SystemMenuID==-4) { ?>class="menunameselect" <? } else { ?>  class="menuname" onMouseOut="this.className='table_rowover2'"<? } ?>onMouseOver="this.className='table_rowover1'" > 
                      <td height="22" onClick="myMenuLink('../system/user_management.php','-4','');">
					  <table width="100%" height="22" border="0" cellpadding="2" cellspacing="0">
                          <tr  > 
                            <td width="22" align="center"><img src="../images/icon/ico051.gif" alt="" width="13" height="19" align="absmiddle" border="0" /></td>
                            <td> 
                              <? if($SystemMenuID==-4) { ?>
                              <span class="onmenu" style="cursor:pointer "> <?=$MenuAdmin?></span> 
                              <? } else { ?>
                            <span style="cursor:pointer ">  <?=$MenuAdmin?></span> 
                              <? } ?>                            </td>
                          </tr>
                        </table></td>
                    </tr>
                     <? } ?>
                    <!---------------------------------------------------------------------------->
                    <? if($System_Session_User_ID==0 && $System_Session_Level=="Admin") { ?>
                    <tr> 
                      <td class="menuline"></td>
                    </tr>
                    <tr > 
                      <td onMouseOver="this.className='table_rowover1'" height="22" <? if($SystemMenuID==-2) { ?>class="menunameselect" <? } else { ?>  class="menuname"  onMouseOut="this.className='table_rowover2'"<? } ?>onClick="myMenuLink('../mod_menumanagement/index.php','-2','');">
					  <table width="100%" height="22" border="0" cellpadding="2" cellspacing="0">
                          <tr  > 
                            <td width="22" align="center"><img src="../images/icon/ico509.gif" width="16" height="13"></td>
                            <td> 
                              <? if($SystemMenuID==-2) { ?>
                              <span class="onmenu" style="cursor:pointer "><?=$Menumenu?></span> 
                              <? } else { ?>
                          <span style="cursor:pointer " ><?=$Menumenu?></span>
                              <? } ?>                            </td>
                          </tr>
                        </table></td>
                    </tr>
                    <? } ?>
                    <? if($System_Session_User_ID>0) { ?>
                    <?
$sql = "SELECT * FROM ".$System_TableName_Menu." WHERE ".$System_TableName_Menu."_ParentID=0 AND ".$System_TableName_Menu."_Language = '$System_Session_Language' ORDER BY ".$System_TableName_Menu."_Order ASC ";
$Query=mysql_query($sql);
$MenuRecordCount=mysql_num_rows($Query);

$index=1;
if($MenuRecordCount>0) {
	while($index<$MenuRecordCount+1) {
		$Row=mysql_fetch_array($Query);
		
		// checking for User Permission
		
		$myUserID = $System_Session_User_ID;
		$myMenuID = $Row[$System_TableName_Menu."_ID"];
		$myMenuPermission = getUserPermissionOnMenu($myUserID,$myMenuID);

		if($Row[$System_TableName_Menu."_Type"]=="Group") {
			$isUserOnGroup=isUserOnGroup($myUserID,$myMenuID);
		} else {
			$isUserOnGroup=1;
		}
		if( strlen($myMenuPermission)>0 && $myMenuPermission!="NA" && $isUserOnGroup>0) {
		?>
                    <tr> 
                      <td class="menuline"></td>
                    </tr>
                    <tr> 
                      <td  onMouseOver="this.className='table_rowover1'"  height="22" <? if($SystemMenuID==$Row[$System_TableName_Menu."_ID"]) { ?>class="menunameselect" <? } else { ?>  class="menuname" onMouseOut="this.className='table_rowover2'" <? } ?>  onClick="
<? if($Row[$System_TableName_Menu."_ModuleType"]=="Group") { ?>
	menuHideSubShow('idMenuSub<?=$Row[$System_TableName_Menu."_ID"]?>');
<? } else { ?>
with(document.myMenuForm) {
	SystemMenuID.value=<?=$Row[$System_TableName_Menu."_ID"]?>; 
	SystemModuleKey.value='<?=$Row[$System_TableName_Menu."_ModuleKey"]?>'; 
	action='<?=$Row[$System_TableName_Menu."_LinkPath"]?>'; 
	submit();
}
<? } ?>
"><table width="100%" height="22" border="0" cellpadding="2" cellspacing="0">
                          <tr  > 
                            <td width="22" align="center"><? if($Row[$System_TableName_Menu."_Icon"]==""){ ?>
                              <img src="../images/icon/145.gif"><? }else{ ?>
							<img src="<?=$Row[$System_TableName_Menu."_Icon"]?>"><? } ?></td>
                            <td> 
                              <? if($SystemMenuID==$Row[$System_TableName_Menu."_ID"]) { ?>
                              <span class="onmenu" style="cursor:pointer ">
                              <?=$Row[$System_TableName_Menu."_Name".$System_Session_Language]?>
                              </span>
                              <? } else { ?>
							  <span style="cursor:pointer ">     <?=$Row[$System_TableName_Menu."_Name".$System_Session_Language]?> </span>
                              <? } ?>
</td>
                            <? if($Row[$System_TableName_Menu."_ModuleType"]=="Group") { ?>
                            <td width="14" align="left"><img src="../images/bullet/arrow-down-active.gif" alt="" width="12" height="8" /></td>
                            <? } ?>
                          </tr>
                        </table></td>
                    </tr>
                    <?
		$ParentID=$Row[$System_TableName_Menu."_ID"];
		
		$sql1 = "SELECT * FROM ".$System_TableName_Menu." WHERE ".$System_TableName_Menu."_ParentID='$ParentID' ORDER BY ".$System_TableName_Menu."_Order ASC ";
		$Query1=mysql_query($sql1) OR DIE("Error: เกิดความผิดพลาด <br>$sql1<br>\n");
		$RecordCount1=mysql_num_rows($Query1);
	
		// checking for this sub menu active
		$sql2 = "SELECT * FROM ".$System_TableName_Menu." WHERE ".$System_TableName_Menu."_ID='$SystemMenuID' AND ".$System_TableName_Menu."_ParentID='$ParentID' ";
		
		$Query2=mysql_query($sql2) OR DIE("Error: เกิดความผิดพลาด <br>$sql2<br>\n");
		$isActiveMenu=mysql_num_rows($Query2);

		if($RecordCount1>0) {
		?>
                    <tr  id="idMenuSub<?=$ParentID?>" <? if($isActiveMenu==0) { ?> style="display:none" <? } ?>  onMouseOver="this.className='table_rowover1'" onMouseOut="this.className='table_rowover2'"> 
                      <td height="22" align="center" style="background:url(../images/home/shadowsubmenu.gif) repeat-x top #eff3fc;"> 
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td><img src="../images/home/shadowsubmenu.gif" /></td>
                          </tr>
                        </table>
                        <?
		$index1=1;
		
		while($index1<$RecordCount1+1) {
			$Row1=mysql_fetch_array($Query1);
			$myID=$Row1[$System_TableName_Menu."_ID"];

			// checking for User Permission
			$myUserID = $System_Session_User_ID;
			$myMenuID = $myID;
			$Permission = getUserPermissionOnMenu($myUserID,$myMenuID);
			if($Permission!="NA") {
				?>
                        <table width="100%" border="0" cellspacing="0" cellpadding="0" >
                          <tr <? if($SystemMenuID==$Row1[0]) { ?>class="menunameselect" <? } else { ?>  class="menuname" <? } ?>> 
                            <td width="5"><img src="../images/blank.gif" width="1" height="1"></td>
                            <td width="172"><table width="100%" height="22" border="0" cellpadding="2" style="border-top:1px dotted #CCCCCC;" cellspacing="0"
 onClick="
myMenuLink('<?=$Row1[$System_TableName_Menu."_LinkPath"]?>', '<?=$Row1[$System_TableName_Menu."_ID"]?>', '<?=$Row1[$System_TableName_Menu."_ModuleKey"]?>');
">
                                <tr> 
                                  <td width="22" align="center"><img src="<?=$Row1[$System_TableName_Menu."_Icon"]?>"></td>
                                  <td align="left"> 
                                    <? if($SystemMenuID==$Row1[$System_TableName_Menu."_ID"]) { ?> 
                                    <span class="onmenu" style="cursor:pointer ">
                                    <?=stripslashes($Row1[$System_TableName_Menu."_Name".$System_Session_Language])?>
                                    </span>
                                    <? } else { ?>
                                 <span style="cursor:pointer ">       <?=stripslashes($Row1[$System_TableName_Menu."_Name".$System_Session_Language])?> </span>
                                    <? } ?></td>
                                </tr>
                              </table></td>
                          </tr>
                        </table>
                      <? 
					} // if Permission
					$index1++;
				} // while
			 } // if RecordCount1
			 ?></td>
                    </tr>
                    <?
		} // if myMenuPermission
		$index++;
	} // while
} // if RecordCount
?>
                    <? } ?>  <tr>
                      <td class="menuline">&nbsp;</td>
                    </tr>
                    <tr  onMouseOver="this.className='table_rowover1'" onMouseOut="this.className='table_rowover2'"> 
                      <td height="22"><table width="100%" height="22" border="0" cellpadding="2" cellspacing="0">
                          <tr> 
                            <td width="22" align="center"><img src="../images/icon/ico569.gif" width="13" height="13"></td>
                            <td> <a href="logout.php"><?=$Menulogout?></a></td>
                          </tr>
                        </table></td>
                    </tr>
                    <tr>
                      <td class="menuline">&nbsp;</td>
                    </tr>
                  </table>				  </td>
                  <td width="6" class="menubox03"></td>
                </tr>
                <tr>
                  <td class="menubox04-1"><img src="../images/home/menubox04-1.gif" alt="" width="4" height="25" /></td>
                  <td colspan="2" class="menubox04">&nbsp;</td>
                  <td class="menubox04-2"><img src="../images/home/menubox04-2.gif" alt="" width="5" height="25" /></td>
                </tr>
              </table>
            </form></td>
          <td width="747" height="338" valign="top"><!-- InstanceBeginEditable name="EditRegion1" --> 
            <table width="95%" height="22" border="0" cellpadding="0" cellspacing="0" id="barmenu" align="center">
              <tr> 
                <td width="9" align="center" class="left">&nbsp;</td>
                <td width="26" align="center" class="center"><img src="../images/icon/ico051.gif" width="13" height="19" /></td>
                <td width="663" class="center">Manage User Admin</td>
              <td width="11" align="center" class="right">&nbsp;</td>
              </tr>
            </table>
			   <table width="94%" border="0" cellpadding="0" cellspacing="0" align="center">
                                                                <tr> 
                                                                                <td height="1" class="bar_tab_enable"><img src="../images/blank.gif" width="10" height="2" /></td>
                                                                </tr>
                  </table>
            <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
              <form action="?" method="get" name="myPageRedirectForm" id="myPageRedirectForm">
				<input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>" />
                <input name="System_MenuGroupID" type="hidden" id="System_MenuGroupID" value="<?=$System_MenuGroupID?>" />
                <input name="type" type="hidden" id="type" value="<?=$type?>" />
                <input name="ShowID" type="hidden" id="ShowID" />
                <tr>
                  <td height="20" align="right">
                    <table height="20" border="0" cellpadding="0" cellspacing="0">
                      <tr>
                        <td width="5" align="left" valign="bottom" class="table_col2"><img src="images/tab-w.gif" width="1" height="1" /></td>
                        <td width="100" align="center" class="table_col2">
                           <a href="#" class="link_tabdisable" onclick="
document.myPageRedirectForm.action='user_management.php';
document.myPageRedirectForm.submit();
">User</a>
                          </td>
                        <td width="20" class="table_col2"><span class="table_col2"><img src="images/tab-w-slop-down.gif" width="20" height="20" /></span></td>
                        <td width="5" align="left" valign="bottom" class="table_col3"><img src="images/tab-w.gif" width="1" height="1" /></td>
                        <td width="100" align="center" class="table_col3"><a href="#" class="link_tabenable" onclick="
document.myPageRedirectForm.action='department_manager.php';
document.myPageRedirectForm.submit();
">Department</a></td>
                        <td width="20" class="table_col3"><span class="table_col3"><img src="images/tab-w-slop-down.gif" width="20" height="20" /></span></td>
                        <td width="5" align="left" valign="bottom" class="table_col2" style="display:none; "><img src="images/tab-w.gif" width="1" height="1" /></td>
                        <td width="100" align="center" class="table_col2" style="display:none; "><strong><a href="#"  style="font-weight: bold" onclick="
document.myPageRedirectForm.action='position_manager.php';
document.myPageRedirectForm.submit();
">Position</a></strong></td>
                        <td width="20" class="table_col2" style="display:none; "><img src="images/tab-w-slop-down.gif" width="20" height="20" /></td>
                        <td width="30"></td>
                      </tr>
                    </table></td>
                </tr>
              </form>
            </table>
            <br/>
            <? 
//# Default Value ############################################
$SystemModule_defaultPageSize = 15;
$SystemModule_defaultPageShow = 1;
$SystemModule_MaxPage = 20;
$SystemModule_ReduceRange = 10; 		// +,- from current page show
$SystemModule_ASCDESC = "ASC";
$SystemModule_OrderBy = $System_TableName_CSTDepartment."_ID";

//########################################################
?>
            <? 
####################################################################
if($action=="add") { 
?>
        
            <table width="500" border="0" align="center" cellpadding="0" cellspacing="1" class="table_border">
              <form action="" method="post" name="myReturnForm" id="myReturnForm">
       <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>" />
                <input name="System_MenuGroupID" type="hidden" id="System_MenuGroupID" value="<?=$System_MenuGroupID?>" />
                <input name="action" type="hidden" id="action" value="" />
                <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>" />
                <input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>" />
                <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>" />
                <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>" />
                <input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>" />
              </form>
              <form action="" method="post" name="myForm" id="myForm" onsubmit=" if(!verifySubmit()) { return false; } ">
          <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>" />
                <input name="System_MenuGroupID" type="hidden" id="System_MenuGroupID" value="<?=$System_MenuGroupID?>" />
                <input name="action" type="hidden" id="action" value="addnew" />
                <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>" />
                <input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>" />
                <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>" />
                <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>" />
                <input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>" />
                <tr> 
                  <td bgcolor="#FFFFFF"> <table width="100%" border="0" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF">
                      <tr> 
                        <td height="24" colspan="4" align="center" class="menu_table_header">Add New Department</td>
                      </tr>
                      <tr> 
                        <td width="135" height="22" align="right" class="table_col1">Department Name&nbsp;</td>
                        <td width="352" height="22" colspan="3" class="table_col2"> <input name="inputName" type="text" class="input_left" id="inputName" size="60" maxlength="200" /></td>
                      </tr>
                    </table>
                    <table width="100%" height="24" border="0" cellpadding="3" cellspacing="0">
                      <tr align="right"> 
                        <td height="30" colspan="4" align="center" class="table_footer"> 
                          <table width="300" border="0" cellspacing="0" cellpadding="2">
                            <tr align="center"> 
                              <td> <script language="JavaScript" type="text/javascript">
function isBlank(myObj) {
		if(myObj.value=='') { return true; }
		return false;
}
function verifySubmit() {
	with(document.myForm) {
		if(isBlank(inputName)) {	inputName.focus(); return false; }
	}
	return true;
}
						</script> <input name="btAdd" type="submit" class="button_60" id="btAdd" value="Add" /> 
                              </td>
                              <td> <input name="btCalcel" type="button" class="button_60" id="btCalcel" onclick="
document.myReturnForm.submit();
						" value="Cancel" /> </td>
                            </tr>
                          </table></td>
                      </tr>
                    </table></td>
                </tr>
              </form>
            </table>
            <br />
            <? 
//########################################################
} else if ($action=="addnew") { 

	$sql = "INSERT INTO ".$System_TableName_Department."(".$System_TableName_Department."_Name) VALUES('$inputName') ";
	$Query=mysql_query($sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");

		?>
            <form action="?" method="post" name="myForm" id="myForm">
                     <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>" />
              <input name="System_MenuGroupID" type="hidden" id="System_MenuGroupID" value="<?=$System_MenuGroupID?>" />
              <input name="action" type="hidden" id="action" />
              <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>" />
              <input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>" />
              <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>" />
              <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>" />
              <input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>" />
            </form>
            <script language="JavaScript" type="text/javascript"> document.myForm.submit(); </script>
            <? 
//########################################################
} else if ($action=="edit") { 
	$myCheckBoxID=0;
	for($i=1;$i<=$TotalCheckBoxID;$i++) {
		$myVar="CheckBoxID".$i;
		if(strlen($$myVar)>0) {
			$myCheckBoxID=$$myVar;
		}
	}
	$sql="SELECT * FROM ".$System_TableName_Department." WHERE ".$System_TableName_Department."_ID=".$myCheckBoxID;
	$Query=mysql_query($sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	$Row=mysql_fetch_array($Query);
?>
            <br />
            <br />
            <table width="500" border="0" align="center" cellpadding="0" cellspacing="1" class="table_border">
              <form action="?" method="post" name="myReturnForm" id="myReturnForm">
                       <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>" />
                <input name="System_MenuGroupID" type="hidden" id="System_MenuGroupID" value="<?=$System_MenuGroupID?>" />
                <input name="action" type="hidden" id="action" value="" />
                <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>" />
                <input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>" />
                <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>" />
                <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>" />
                <input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>" />
                <input name="CheckBoxID1" type="hidden" id="CheckBoxID1" value="<?=$myCheckBoxID?>" />
                <input name="TotalCheckBoxID" type="hidden" id="TotalCheckBoxID" value="1" />
              </form>
              <form action="?" method="post" name="myForm" id="myForm" onsubmit=" if(!verifySubmit()) { return false; } ">
                       <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>" />
                <input name="System_MenuGroupID" type="hidden" id="System_MenuGroupID" value="<?=$System_MenuGroupID?>" />
                <input name="action" type="hidden" id="action" value="update" />
                <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>" />
                <input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>" />
                <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>" />
                <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>" />
                <input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>" />
                <input name="CheckBoxID1" type="hidden" id="CheckBoxID1" value="<?=$myCheckBoxID?>" />
                <input name="TotalCheckBoxID" type="hidden" id="TotalCheckBoxID" value="1" />
                <tr> 
                  <td bgcolor="#FFFFFF"> <table width="100%" border="0" cellpadding="2" cellspacing="1"  bgcolor="#FFFFFF">
                      <tr> 
                        <td height="24" colspan="2" align="center" class="menu_table_header">Edit Department </td>
                      </tr>
                      <tr> 
                        <td width="137" height="22" align="right" class="table_col1">Department Name&nbsp;</td>
                        <td width="350" height="22" class="table_col2"> <input name="inputName" type="text" class="input_left" id="inputName" value="<?=$Row[$System_TableName_Department."_Name"]?>" size="60" maxlength="50" /></td>
                      </tr>
                    </table>
                    <table width="100%" height="24" border="0" cellpadding="3" cellspacing="0">
                      <tr align="right"> 
                        <td height="30" colspan="4" align="center" class="table_footer"> 
                          <table width="300" border="0" cellspacing="0" cellpadding="2">
                            <tr align="center"> 
                              <td> <script language="JavaScript" type="text/javascript">
function isBlank(myObj) {
		if(myObj.value=='') { return true; }
		return false;
}
function verifySubmit() {
	with(document.myForm) {
		if(isBlank(inputName)) {	inputName.focus(); return false; }
	}
	return true;
}
						</script> <input name="btSave" type="submit" class="button_60" id="btSave" value="Update" /> 
                              </td>
                              <td> <input name="btCalcel" type="button" class="button_60" id="btCalcel" onclick="
if(confirm('คุณต้องการกลับไปPageViewRecord?')) {
	document.myReturnForm.submit();
}
						" value="Cancel" /> </td>
                            </tr>
                          </table></td>
                      </tr>
                    </table></td>
                </tr>
              </form>
            </table>
            <br />
            <? 
//########################################################
} else if ($action=="update") { 

		$sql = "UPDATE ".$System_TableName_Department." SET ".$System_TableName_Department."_Name='$inputName' WHERE ".$System_TableName_Department."_ID=".$CheckBoxID1;
		$Query=mysql_query($sql) OR DIE("Error: เกิดความผิดพลาด55 <br>$sql<br>\n");

?>
            <form action="?" method="post" name="myForm" id="myForm">
                     <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>" />
              <input name="System_MenuGroupID" type="hidden" id="System_MenuGroupID" value="<?=$System_MenuGroupID?>" />
              <input name="action" type="hidden" id="action" />
              <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>" />
              <input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>" />
              <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>" />
              <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>" />
              <input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>" />
            </form>
            <script language="JavaScript" type="text/javascript"> document.myForm.submit(); </script>
            <? 
//########################################################
} else if ($action=="delete") { 
	for($i=1;$i<=$TotalCheckBoxID;$i++) {
		$myVar="CheckBoxID".$i;
		if(strlen($$myVar)>0) {
			// update relate data
			$sql = "UPDATE ".$System_TableName_Staff." SET ".$System_TableName_Staff."_DepartmentID=0 WHERE ".$System_TableName_Staff."_DepartmentID=".$$myVar;
			$Query=mysql_query($sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
			// delete owner data
			$sql = "DELETE FROM ".$System_TableName_Department." WHERE ".$System_TableName_Department."_ID=".$$myVar;
			$Query=mysql_query($sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
		}
	}
?>
            <form action="?" method="post" name="myForm" id="myForm">
                     <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>" />
              <input name="System_MenuGroupID" type="hidden" id="System_MenuGroupID" value="<?=$System_MenuGroupID?>" />
              <input name="action" type="hidden" id="action" />
              <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>" />
              <input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>" />
              <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>" />
              <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>" />
              <input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>" />
            </form>
            <script language="JavaScript" type="text/javascript"> document.myForm.submit(); </script>
            <?	
//########################################################
} else { ?>
            <?
// Check to set default value #########################
if($PageSize=="") { $PageSize = $SystemModule_defaultPageSize; }
if($PageShow=="") { $PageShow = $SystemModule_defaultPageShow; }
if($ASCDESC=="") { $ASCDESC = $SystemModule_ASCDESC; } 
if($OrderBy=="")  { $OrderBy = $System_TableName_Department."_ID"; } 
if($action=="switchorder") { 
	if($ASCDESC=="ASC") { $ASCDESC = "DESC"; }  else { $ASCDESC="ASC"; } 
} 
if($PageSearch!="") { $PageSearch=trim($PageSearch); }

// Count total record size #########################
if($PageSearch=="") {
	$sql = "SELECT * FROM ".$System_TableName_Department;
} else {
	$sql = "SELECT * FROM ".$System_TableName_Department." WHERE ".
	$System_TableName_Department."_Name LIKE '%$PageSearch%'  ";
}
$Query=mysql_query($sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
$TotalRecordCount=mysql_num_rows($Query);

// Find max page size #########################
if($TotalRecordCount>$PageSize) {
	$NoOfPage= ceil($TotalRecordCount/$PageSize);
} else {
	$NoOfPage=1;
}
// Recover page show into range #########################
if($PageShow>$NoOfPage) { $PageShow=$NoOfPage; }

// Select only paging range #########################
$RecordStart = ($PageShow-1)*$PageSize;
$sql = $sql." ORDER BY $OrderBy $ASCDESC LIMIT $RecordStart , $PageSize ";
$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
$RecordCount=MYSQL_NUMROWS($Query);
?>
            <script language="JavaScript" type="text/javascript">
function Paging_CheckAll(objCheckHeader,txtCheckBoxFirstName,intTotalItems) {
	if(intTotalItems>0)
		for(i=1;i<=intTotalItems;i++)
			document.getElementById(txtCheckBoxFirstName+i).checked = objCheckHeader.checked;			
	return true;
}
function Paging_CheckAllHandle(objCheckHeader,txtCheckBoxFirstName,intTotalItems) {
	var isCheckedAll = true;
	if(intTotalItems>0)
		for(i=1;i<=intTotalItems;i++)
			if(!document.getElementById(txtCheckBoxFirstName+i).checked) 
				isCheckedAll = false;
	objCheckHeader.checked = isCheckedAll;
	return true;
}
function Paging_CountChecked(txtCheckBoxFirstName,intTotalItems) {
	var intChecked = 0;
	if(intTotalItems>0)
		for(i=1;i<=intTotalItems;i++)
			if(document.getElementById(txtCheckBoxFirstName+i).checked) 
				intChecked ++;
	return intChecked ;
}
function Paging_CheckedThisItem(objCheckHeader,indexing,txtCheckBoxFirstName,intTotalItems) {
	if(intTotalItems>0)
		for(i=1;i<=intTotalItems;i++)
			if(i==indexing) {
				document.getElementById(txtCheckBoxFirstName+i).checked = true;
			} else {
				document.getElementById(txtCheckBoxFirstName+i).checked = false;
			}
	objCheckHeader.checked = false;
	return true;
}
</script>
            <? if($System_Session_Level=="Admin") { ?>  
		<table width="95%" height="22" border="0" align="center" cellpadding="2" cellspacing="0">
     
          <tr valign="bottom"> 
            <td width="71%"> <table border="0" cellspacing="0" cellpadding="2">
			   <form action="?" method="post" name="myHeaderButton" id="myHeaderButton" onsubmit="return false;">
          <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>" />
          <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>" />
                <tr> 
                  <td><input name="btAdd" type="button" class="button_80" id="btAdd" value="Add New" onclick="
document.myForm.action.value='add';
document.myForm.submit();
				" /></td>
                  <td><input name="btEdit" type="button" class="button_60" id="btEdit" onclick="
if(Paging_CountChecked('CheckBoxID',document.myForm.TotalCheckBoxID.value)==1) {
	document.myForm.action.value='edit';
	document.myForm.submit();
} else {
	alert('Please checked 1 item to edit this record.');
}
				  " value="Edit" /></td>
                  <td><input name="btDelete" type="button" class="button_60" id="btDelete" onclick="
if(Paging_CountChecked('CheckBoxID',document.myForm.TotalCheckBoxID.value)&gt;0) {
	if(confirm('Are you sure to delete selected record?')) {
		document.myForm.action.value='delete';
		document.myForm.submit();
	}
} else {
	alert('Please checked 1 or more item to delete record.');
}
				  " value="Delete" /></td>
                </tr>
		    </form>
              </table>
              </td>
			  <td width="29%" align="right"><table border="0" cellpadding="2" cellspacing="0" >
			   <form action="?" method="post" name="mySearchForm1" id="mySearchForm1" onsubmit="return false;">
                <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>" />
                <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>" />
                <tr>
                  <td>&nbsp;</td>
                  <td><input name="toolbarPageSearch1" type="text"  style="height:15px"class="input_left" id="toolbarPageSearch1" value="<?=$PageSearch?>" size="20" maxlength="50" /></td>
                  <td><input name="btPageSearch" type="button" class="button_60" id="btPageSearch" value="Search" onclick="
document.myForm.PageSearch.value=document.mySearchForm1.toolbarPageSearch1.value;
document.myForm.submit();
						" /></td>
                </tr>
				</form>
              </table></td>
          </tr>
		 
    
      </table>
	  <? }?>

            <table width="95%" height="26" border="0" align="center" cellpadding="0" cellspacing="0" class="table_toolbar">
              <form action="?" method="post" name="myToolbarForm" id="myToolbarForm" onsubmit="return false;">
                       <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>" />
                <input name="System_MenuGroupID" type="hidden" id="System_MenuGroupID" value="<?=$System_MenuGroupID?>" />
                <tr> 
                  <td width="5" align="left" valign="top"> <img src="images/bgborder1w.gif" width="5" height="5" /></td>
                  <td valign="bottom"> <table border="0" cellpadding="2" cellspacing="0" class="toolbar">
                      <tr> 
                        <td width="10">&nbsp;</td>
                        <td>Page</td>
                        <td> 
                          <? 
				  if($NoOfPage>1) { 
				  ?>
                          <select name="toolbarPageShow" class="select" onchange="document.myForm.PageShow.value=this.value; document.myForm.submit(); ">
                            <? 
if($NoOfPage<$SystemModule_MaxPage) {
	// Show page list #########################
	for($i=1;$i<=$NoOfPage;$i++) { 
		echo "<option value=\"$i\"";
		if($i==$PageShow) { echo " selected"; }
		echo ">$i</option>";
	} 
}  else {
	// # If total page count greater than default max page  value then reduce page select size #########################
	$starti = $PageShow-$SystemModule_ReduceRange;
	if($starti<1) { $starti=1; }
	$endi = $PageShow+$SystemModule_ReduceRange;
	if($endi>$NoOfPage) { $endi=$NoOfPage; }
	//#####################
	for($i=$starti ;$i<=$endi;$i++) { 
		echo "<option value=\"$i\"";
		if($i==$PageShow) { echo " selected"; }
		echo ">$i</option>";
	} 
}
?>
                          </select> 
                          <? 
 } else { 
	echo "1";
 }
 ?>
                        </td>
                        <td> of 
                          <?=$NoOfPage?>
                        </td>
                        <td width="10">&nbsp;</td>
                        <td>size</td>
                        <td> <input name="toolbarPageSize" type="text" class="input_left" id="toolbarPageSize" value="<?=$PageSize?>" size="3" maxlength="3" /></td>
                        <td> <input name="btChangePageSize" type="button" class="button_normal" id="btChangePageSize" value="Go" onclick="
if(isNaN(document.myToolbarForm.toolbarPageSize.value*1)) {
	document.myToolbarForm.toolbarPageSize.value='<?=$PageSize?>';
	document.myToolbarForm.toolbarPageSize.focus();
	return false;
}
if(document.myToolbarForm.toolbarPageSize.value&lt;=0) {
	document.myToolbarForm.toolbarPageSize.value='<?=$PageSize?>';
	document.myToolbarForm.toolbarPageSize.focus();
	return false;
}
document.myForm.PageSize.value=document.myToolbarForm.toolbarPageSize.value; 
document.myForm.submit(); 
				  " /> </td>
                      </tr>
                    </table></td>
                  <td align="right" valign="bottom"> <table border="0" cellpadding="0" cellspacing="0">
                      <tr> 
                        <td>Found 
                          <?=$TotalRecordCount?>
                          Record</td>
                        <td width="10">&nbsp;</td>
                        <? if($PageShow>1) { ?>
                        <td width="21" align="center"> <img src="images/controlpage/playset_start.gif" width="21" height="21" 
				  onmouseover="this.src='images/controlpage/playset_start_active.gif'; this.style.cursor='hand';" 
				  onmouseout="this.src='images/controlpage/playset_start.gif';" 
				  onclick="document.myForm.PageShow.value=1; document.myForm.submit();" /></td>
                        <? } else { ?>
                        <td width="21" align="center"><img src="images/controlpage/playset_start_disable.gif" width="21" height="21" /></td>
                        <? } ?>
                        <? if($PageShow>1) { ?>
                        <td width="21" align="center"> <img src="images/controlpage/playset_backward.gif" width="21" height="21" 
				  onmouseover="this.src='images/controlpage/playset_backward_active.gif'; this.style.cursor='hand';" 
				  onmouseout="this.src='images/controlpage/playset_backward.gif';" 
				  onclick="document.myForm.PageShow.value--; document.myForm.submit();" /></td>
                        <? } else { ?>
                        <td width="21" align="center"><img src="images/controlpage/playset_backward_disable.gif" width="21" height="21" /></td>
                        <? } ?>
                        <td width="21" align="center"> <img src="images/controlpage/playset_stop.gif" width="21" height="21" 
				  onmouseover="this.src='images/controlpage/playset_stop_active.gif'; this.style.cursor='hand';" 
				  onmouseout="this.src='images/controlpage/playset_stop.gif';" 
				  onclick="
					with(document.myForm) {
						PageShow.value='';
						PageSize.value='';
						ASCDESC.value='';
						OrderBy.value='';
						PageSearch.value='';
						submit();
					}
					" /></td>
                        <? if($PageShow<$NoOfPage) { ?>
                        <td width="21" align="center"> <img src="images/controlpage/playset_forward.gif" width="21" height="21" 
				  onmouseover="this.src='images/controlpage/playset_forward_active.gif'; this.style.cursor='hand';" 
				  onmouseout="this.src='images/controlpage/playset_forward.gif';" 
				  onclick="document.myForm.PageShow.value++; document.myForm.submit();" /></td>
                        <? } else { ?>
                        <td width="10" align="center"><img src="images/controlpage/playset_forward_disable.gif" width="21" height="21" /></td>
                        <? } ?>
                        <? if($PageShow<$NoOfPage) { ?>
                        <td width="10" align="center"><img src="images/controlpage/playset_end.gif" width="21" height="21" 
				  onmouseover="this.src='images/controlpage/playset_end_active.gif'; this.style.cursor='hand';" 
				  onmouseout="this.src='images/controlpage/playset_end.gif';" 
				  onclick="document.myForm.PageShow.value='<?=$NoOfPage?>'; document.myForm.submit();" /></td>
                        <? } else { ?>
                        <td width="10" align="center"><img src="images/controlpage/playset_end_disable.gif" width="21" height="21" /></td>
                        <? } ?>
                      </tr>
                    </table></td>
                  <td width="5" align="right" valign="top"><img src="images/bgborder2w.gif" width="5" height="5" /></td>
                </tr>
              </form>
            </table>
            <table width="95%" border="0" align="center" cellpadding="0" cellspacing="1" class="table_border">
              <tr> 
                <td bgcolor="#FFFFFF"> <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
                    <form action="?" method="post" name="myForm" id="myForm">
          <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>" />
                      <input name="System_MenuGroupID" type="hidden" id="System_MenuGroupID" value="<?=$System_MenuGroupID?>" />
                      <input name="action" type="hidden" id="action" />
                      <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>" />
                      <input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>" />
                      <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>" />
                      <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>" />
                      <input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>" />
                      <input name="SelectStatus" type="hidden" id="SelectStatus" />
                      <tr align="center" class="menu_table_header"> 
                        <td width="24" height="24"><input name="CheckBoxAll" type="checkbox" class="myform_checkbox" id="CheckBoxAll" value="Yes" onclick="Paging_CheckAll(this,'CheckBoxID',document.myForm.TotalCheckBoxID.value)" /></td>
                        <td width="45" height="24" align="center"> 
                          <? 
$myOrderBy = $System_TableName_Department."_ID";
if($OrderBy==$myOrderBy) { 
	if($ASCDESC=="DESC") { ?>
                          <img src="images/controlpage/desc_order.gif" width="7" height="7" /> 
                          <? }
	if($ASCDESC=="ASC") { ?>
                          <img src="images/controlpage/asc_order.gif" width="7" height="7" /> 
                          <? }
} 
?>
                          <a href="#" class="link_headbar" onclick="
with(document.myForm) { 
	<? if($OrderBy==$myOrderBy) { echo "action.value='switchorder';\n"; } ?>
	OrderBy.value='<?=$myOrderBy?>';
	submit(); 
}
					">No.</a></td>
                        <td height="24"> 
                          <? 
$myOrderBy = $System_TableName_Department."_Name";
if($OrderBy==$myOrderBy) { 
	if($ASCDESC=="DESC") { ?>
                          <img src="images/controlpage/desc_order.gif" width="7" height="7" /> 
                          <? }
	if($ASCDESC=="ASC") { ?>
                          <img src="images/controlpage/asc_order.gif" width="7" height="7" /> 
                          <? }
} 
?>
                          <a href="#" class="link_headbar" onclick="
with(document.myForm) { 
	<? if($OrderBy==$myOrderBy) { echo "action.value='switchorder';\n"; } ?>
	OrderBy.value='<?=$myOrderBy?>';
	submit(); 
}
					"> Department Name </a></td>
                        <td width="100">No. of Member</td>
                        <td width="75" height="24">Action</td>
                      </tr>
                      <?
$index=1;
if($RecordCount>0) {
	while($index<$RecordCount+1) {
		if($myClassRow=="table_row1") { $myClassRow="table_row2"; } else { $myClassRow="table_row1";  }
		$Row=mysql_fetch_array($Query);

		$sql="SELECT ".$System_TableName_Staff."_ID FROM ".$System_TableName_Staff." WHERE ".$System_TableName_Staff."_DepartmentID=".$Row[$System_TableName_Department."_ID"]." ";
		$Query1=mysql_query($sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
		$NoOfMemberCount=mysql_num_rows($Query1);
	?>                      
                      <tr class="<?=$myClassRow?>" onmouseover="this.className='table_rowover'" onmouseout="this.className='<?=$myClassRow?>'"> 
                        <td width="24" height="24" align="center"> <input name="CheckBoxID<?=$index?>" type="checkbox" class="myform_checkbox" id="CheckBoxID<?=$index?>" onclick="Paging_CheckAllHandle(document.myForm.CheckBoxAll,'CheckBoxID',document.myForm.TotalCheckBoxID.value)" value="<?=$Row[$System_TableName_Department."_ID"]?>" /></td>
                        <td width="45" height="24" align="center"> 
                          <?=$RecordStart+$index?>
                          <!--?=$Row[$System_TableName_CSTDepartment."_ID"]?-->
                        </td>
                        <td height="24"><br />
                          &nbsp; 
						<a href="#" class="link_topic" >
                          <?=$Row[$System_TableName_Department."_Name"]?></a>
						  <br />
						  &nbsp; 
                        </td>
                        <td width="100" align="center"><?=$NoOfMemberCount?>
                        <input name="CheckUsedData<?=$index?>" type="hidden" id="CheckUsedData<?=$index?>" value="<?=$NoOfMemberCount?>" /></td>
                        <td width="75" height="24" align="center" valign="middle"> 
                          <table border="0" cellspacing="0" cellpadding="1">
                            <tr align="center" valign="bottom"> 
                              <td><img src="images/icon/ico425.gif" alt="Edit" width="16" height="16" border="0" onmouseover="this.style.cursor='hand'" onclick="
if(confirm('Are you sure to edit this record??')) {
	Paging_CheckedThisItem( document.myForm.CheckBoxAll, <?=$index?>, 'CheckBoxID', document.myForm.TotalCheckBoxID.value );
	document.myForm.action.value='edit';
	document.myForm.submit();
}
						" /></td>
                              <td><img src="images/icon/ico417.gif" alt="Delete" width="16" height="16" border="0" onmouseover="this.style.cursor='hand'" onclick="
if (<?=$NoOfMemberCount?>&gt;0) {
	alert('Can not delete because this data be used');
} else {
	if(confirm('Are you sure to delete this record?')) {
		Paging_CheckedThisItem( document.myForm.CheckBoxAll, <?=$index?>, 'CheckBoxID', document.myForm.TotalCheckBoxID.value );
		document.myForm.action.value='delete';
		document.myForm.submit();
	}
}" /></td>
                            </tr>
                          </table></td>
                      </tr>
                      <?
		$index++;
	}
} else {  ?>
                      <tr class="mytable_row1"> 
                        <td height="120" colspan="5" align="center" class="table_row1"> Data not found!</td>
                      </tr>
                      <? } ?>
                      <input name="TotalCheckBoxID" type="hidden" id="TotalCheckBoxID" value="<?=$index-1?>" />
                    </form>
                  </table>
                  <table width="100%" height="24" border="0" cellpadding="0" cellspacing="0">
  
                      <tr align="right"> 
                        <td colspan="4" align="right" class="table_footer">&nbsp;                          </td>
                      </tr>
            
                  </table></td>
              </tr>
            </table>
            <? if($System_Session_Level=="Admin") { ?>
		<table width="95%" height="22" border="0" align="center" cellpadding="2" cellspacing="0">
     
          <tr valign="bottom"> 
            <td width="71%"> <table border="0" cellspacing="0" cellpadding="2">
			   <form action="?" method="post" name="myHeaderButton" id="myHeaderButton" onsubmit="return false;">
          <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>" />
          <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>" />
                <tr> 
                  <td><input name="btAdd" type="button" class="button_80" id="btAdd" value="Add New" onclick="
document.myForm.action.value='add';
document.myForm.submit();
				" /></td>
                  <td><input name="btEdit" type="button" class="button_60" id="btEdit" onclick="
if(Paging_CountChecked('CheckBoxID',document.myForm.TotalCheckBoxID.value)==1) {
	document.myForm.action.value='edit';
	document.myForm.submit();
} else {
	alert('Please checked 1 item to edit this record.');
}
				  " value="Edit" /></td>
                  <td><input name="btDelete" type="button" class="button_60" id="btDelete" onclick="
if(Paging_CountChecked('CheckBoxID',document.myForm.TotalCheckBoxID.value)&gt;0) {
	if(confirm('Are you sure to delete selected record?')) {
		document.myForm.action.value='delete';
		document.myForm.submit();
	}
} else {
	alert('Please checked 1 or more item to delete record.');
}
				  " value="Delete" /></td>
                </tr>
		    </form>
              </table>
              </td>
			  <td width="29%" align="right"><table border="0" cellpadding="2" cellspacing="0" >
			   <form action="?" method="post" name="mySearchForm" id="mySearchForm" onsubmit="return false;">
                <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>" />
                <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>" />
                <tr>
                  <td>&nbsp;</td>
                  <td><input name="toolbarPageSearch" type="text" style="height:15px" class="input_left" id="toolbarPageSearch" value="<?=$PageSearch?>" size="20" maxlength="50" /></td>
                  <td><input name="btPageSearch" type="button" class="button_60" id="btPageSearch" value="Search" onclick="
document.myForm.PageSearch.value=document.mySearchForm.toolbarPageSearch.value;
document.myForm.submit();
						" /></td>
                </tr>
				</form>
              </table></td>
          </tr>
		 
    
      </table>
	  <? }?>
            <br />
            <? 
}
//########################################################
?>
            <!-- InstanceEndEditable -->  </td>
        </tr>
      </table>
      <br />    </td>
  </tr>
  <tr>
    <td align="center" class="footerline"><strong>สำนักงานเลขาธิการคุรุสภา </strong><span lang="th" xml:lang="th">128/1 ถนนนครราชสีมา เขตดุสิต   กรุงเทพฯ 10300</span><span class="style4"><span class="style8"><br>
        </span></span>โทร.   02280-4331 , 0 2280-4334-8    e-mail :webkuru@ksp.or.th<br />
    <br /></td>
  </tr>
</table>
	</td>
  </tr>
</table>

</body>
<!-- InstanceEnd --></html>

Hacked By AnonymousFox1.0, Coded By AnonymousFox