Hacked By AnonymousFox

Current Path : C:/AppServ/www/th/controlweb/manage/system_menu/
Upload File :
Current File : C:/AppServ/www/th/controlweb/manage/system_menu/index.php

<? 
include("../lib/session.php"); 
include("../lib/config.php");
include("../lib/connect.php");
include("../lib/function.php");
?>
<html><!-- InstanceBegin template="/Templates/WebEngine-Adminpanel.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<title> <?=$System_Variable_Title?></title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable --> 
<link href="../css/mystyle.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#CCCCCC" background="../../images/design-a/bg.gif" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<div align="center">
  <table width="1003" border="0" cellpadding="0" cellspacing="0" class="top-box">
    <tr> 
      <td background="../../images/top-bg.gif">&nbsp;</td>
      <td width="265"><a href="../../index.php"><img src="../../images/logo.gif" width="265" height="49" border="0"></a></td>
    </tr>
  </table>
  <table width="1003" height="29" border="0" cellpadding="0" cellspacing="0" background="../../images/menu-bg.gif" class="menu-box">
    <tr> 
      <td align="right"> 
        <? if($System_Session_Language=="Thai") { ?>
        <a href="../system/setlanguage.php?setlang=Thai&action=setlanguage"><strong><font color="#990000">TH</font></strong></a> 
        | <a href="../system/setlanguage.php?setlang=Eng&action=setlanguage">ENG</a> 
        <? } else { ?>
        <a href="../system/setlanguage.php?setlang=Thai&action=setlanguage">TH</a> 
        | <a href="../system/setlanguage.php?setlang=Eng&action=setlanguage"><strong><font color="#990000">ENG</font></strong></a> 
        <? } ?>
        &nbsp;&nbsp;&nbsp; </td>
    </tr>
  </table>
  <table width="1003" border="0" cellpadding="0" cellspacing="0" class="topgraphic-bg">
    <tr> 
      <td><img src="../../images/pixel.gif" width="1" height="1"></td>
    </tr>
  </table>
  <br>
  <table width="990" border="0" cellpadding="0" cellspacing="0">
    <tr> 
      <td width="10" height="10"><img src="../../images/design-a/border-a.gif" width="10" height="10"></td>
      <td height="10" background="../../images/design-a/border-top.gif"><img src="../../images/blank.gif" width="1" height="1"></td>
      <td width="10" height="10"><img src="../../images/design-a/border-b.gif" width="10" height="10"></td>
    </tr>
  </table>
  <table width="990" height="460" border="0" cellpadding="0" cellspacing="0">
    <tr> 
      <td width="10" height="30" background="../../images/design-a/border-left.gif" bgcolor="#FFFFFF"><img src="../../images/blank.gif" width="1" height="1"></td>
      <td width="200" align="center" valign="top" bgcolor="#EFEFEF">
        <!--Start Menu ----------------------------------------------------------------------------------->
        <? if(strlen($System_Session_User_ID)==0) { ?>
        <? if($alert=="yes") { ?>
        <table width="90%" border="0" cellpadding="1" cellspacing="0" class="messagebox_alert">
          <form name="myLoginForm" method="post" action="../../system/login.php" onSubmit="
with(document.myLoginForm) {
	if(inputUserName.value=='') {
		inputUserName.focus();
		return false;
	}
	if(inputPassword.value=='') {
		inputPassword.focus();
		return false;
	}
}
				">
            <tr align="center"> 
              <td height="40" colspan="2">Incorrect your<br>
                UserName or Password.</td>
            </tr>
          </form>
        </table>
        <br> 
        <? } ?>
        <table width="100%" height="24" border="0" cellpadding="0" cellspacing="0">
          <tr> 
            <td width="8" background="../images/object/bar-bg1.gif" bgcolor="#1945BF"><img src="../images/blank.gif" width="1" height="1"></td>
            <td background="../images/object/bar-bg.gif"><strong><font color="#FFFFFF">&nbsp;<img src="../images/object/bar-icon.gif" width="9" height="5" align="absmiddle">&nbsp;เข้าสู่ระบบ</font></strong></td>
          </tr>
        </table>
        <table width="100%" height="3" border="0" cellpadding="0" cellspacing="0">
          <tr> 
            <td><img src="../images/blank.gif" width="1" height="1"></td>
          </tr>
        </table>
        <table width="100%" height="120" border="0" cellpadding="0" cellspacing="0">
          <tr> 
            <td height="80" align="center" valign="middle"> <form name="myLoginForm" method="post" action="../system/login.php" onSubmit=" 
with(document.myLoginForm) {
	if(inputUserName.value=='') {
		inputUserName.focus();
		return false;
	}
	if(inputPassword.value=='') {
		inputPassword.focus();
		return false;
	}
}
				">
                <table border="0" cellspacing="0" cellpadding="1">
                  <tr> 
                    <td height="18" colspan="2" valign="bottom"><font color="#5C89BE"><strong>Username</strong></font><font color="#990000">&nbsp;</font></td>
                  </tr>
                  <tr> 
                    <td width="10">&nbsp;</td>
                    <td> <input name="inputUserName" type="text" class="input_left" id="inputUserName" size="20" maxlength="50"></td>
                  </tr>
                  <tr> 
                    <td height="18" colspan="2" valign="bottom"><font color="#5C89BE"><strong>Password</strong></font><font color="#990000">&nbsp;</font></td>
                  </tr>
                  <tr> 
                    <td width="10">&nbsp;</td>
                    <td><input name="inputPassword" type="password" class="input_left" id="inputPassword" size="20" maxlength="50"></td>
                  </tr>
                  <tr> 
                    <td width="10">&nbsp;</td>
                    <td align="right"><input name="Submit" type="submit" class="button_th_80" value="LogIn"></td>
                  </tr>
                </table>
              </form></td>
          </tr>
        </table>
        <br> 
        <? } else { ?>
        <? if($SystemMenuID=="") { $SystemMenuID=-1; } ?>
        <table width="100%" height="24" border="0" cellpadding="0" cellspacing="0">
          <tr> 
            <td width="8" background="../images/object/bar-bg1.gif" bgcolor="#1945BF"><img src="../images/blank.gif" width="1" height="1"></td>
            <td background="../images/object/bar-bg.gif"><strong><font color="#FFFFFF">&nbsp;<img src="../images/object/bar-icon.gif" width="9" height="5" align="absmiddle">&nbsp;เมนูหลัก</font></strong></td>
          </tr>
        </table>
        <table width="100%" height="3" border="0" cellpadding="0" cellspacing="0">
          <tr> 
            <td><img src="../images/blank.gif" width="1" height="1"></td>
          </tr>
        </table>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <form action="?" method="get" name="myMenuForm" id="myMenuForm">
            <input type="hidden" name="SystemMenuID">
            <input type="hidden" name="SystemModuleKey">
            <input type="hidden" name="System_EXID" value="<?=$System_EXID?>">
          </form>
          <? if($System_Session_User_ID>0) { ?>
          <tr> 
            <td height="1" class="menu_table_bg_hilight"><img src="../images/blank.gif" width="1" height="1"></td>
          </tr>
          <tr> 
            <td height="22" class="menu_table_bg_normal" onMouseOver="this.className='menu_table_bg_over'; " onMouseOut="this.className='menu_table_bg_normal'; " onClick="
document.myMenuForm.action='../system/user_information.php'; 
document.myMenuForm.SystemMenuID.value=-3;
document.myMenuForm.submit();
"><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) { ?>
                    <b><font color="#990000">User Information</font></b> 
                    <? } else { ?>
                    User Information 
                    <? } ?>
                  </td>
                </tr>
              </table></td>
          </tr>
          <tr> 
            <td height="1" class="menu_table_bg_shadow"><img src="../images/blank.gif" width="1" height="1"></td>
          </tr>
          <? } ?>
          <!---------------------------------------------------------------------------->
          <? if($System_Session_Level=="Admin") { ?>
          <tr> 
            <td height="1" class="menu_table_bg_hilight"><img src="../images/blank.gif" width="1" height="1"></td>
          </tr>
          <tr> 
            <td height="22" class="menu_table_bg_normal" onMouseOver="this.className='menu_table_bg_over'; " onMouseOut="this.className='menu_table_bg_normal'; " onClick="
document.myMenuForm.action='../system/user_management.php'; 
document.myMenuForm.SystemMenuID.value=-4;
document.myMenuForm.submit();
"><table width="100%" height="22" border="0" cellpadding="2" cellspacing="0">
                <tr> 
                  <td width="22" align="center"><img src="../images/icon/ico051.gif" width="13" height="19"></td>
                  <td> 
                    <? if($SystemMenuID==-4) { ?>
                    <b><font color="#990000">Manage User Admin</font></b> 
                    <? } else { ?>
                    Manage User Admin 
                    <? } ?>
                  </td>
                </tr>
              </table></td>
          </tr>
          <tr> 
            <td height="1" class="menu_table_bg_shadow"><img src="../images/blank.gif" width="1" height="1"></td>
          </tr>
          <? } ?>
          <!---------------------------------------------------------------------------->
          <? if($System_Session_User_ID==0) { ?>
          <tr> 
            <td height="1" class="menu_table_bg_hilight"><img src="../images/blank.gif" width="1" height="1"></td>
          </tr>
          <tr> 
            <td height="22" class="menu_table_bg_normal" onMouseOver="this.className='menu_table_bg_over'; " onMouseOut="this.className='menu_table_bg_normal'; " onClick="
document.myMenuForm.action='../system_menu/index.php'; 
document.myMenuForm.SystemMenuID.value=-2;
document.myMenuForm.submit();
"><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) { ?>
                    <b><font color="#990000">Menu Bulider</font></b> 
                    <? } else { ?>
                    Menu Bulider 
                    <? } ?>
                  </td>
                </tr>
              </table></td>
          </tr>
          <tr> 
            <td height="1" class="menu_table_bg_shadow"><img src="../../images/blank.gif" width="1" height="1"></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_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
$MenuRecordCount=MYSQL_NUMROWS($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 height="1" class="menu_table_bg_hilight"><img src="../../images/blank.gif" width="1" height="1"></td>
          </tr>
          <tr> 
            <td height="22" class="menu_table_bg_normal" onMouseOver="this.className='menu_table_bg_over'; " onMouseOut="this.className='menu_table_bg_normal'; " 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"><img src="<?=$Row[$System_TableName_Menu."_Icon"]?>"></td>
                  <td> 
                    <? if($SystemMenuID==$Row[$System_TableName_Menu."_ID"]) { ?>
                    <b><font color="#990000"> 
                    <?=$Row[$System_TableName_Menu."_Name".$System_Session_Language]?>
                    </font></b> 
                    <? } else { ?>
                    <?=$Row[$System_TableName_Menu."_Name".$System_Session_Language]?>
                    <? } ?>
                  </td>
                  <? if($Row[$System_TableName_Menu."_ModuleType"]=="Group") { ?>
                  <td width="14" align="left"><img src="../images/bullet/arrow-down-active.gif" width="12" height="8"></td>
                  <? } ?>
                </tr>
              </table></td>
          </tr>
          <tr> 
            <td height="1" class="menu_table_bg_shadow"><img src="../../images/blank.gif" width="1" height="1"></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_DB_QUERY($System_DataBase_Name,$sql1) OR DIE("Error: เกิดความผิดพลาด <br>$sql1<br>\n");
		$RecordCount1=MYSQL_NUMROWS($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_DB_QUERY($System_DataBase_Name,$sql2) OR DIE("Error: เกิดความผิดพลาด <br>$sql2<br>\n");
		$isActiveMenu=MYSQL_NUMROWS($Query2);

		if($RecordCount1>0) {
		?>
          <tr id="idMenuSub<?=$ParentID?>" <? if($isActiveMenu==0) { ?> style="display:none" <? } ?>> 
            <td height="22" align="center" bgcolor="#DFDFDF"> 
              <?
		$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;
			$myMenuPermission = getUserPermissionOnMenu($myUserID,$myMenuID);
			if( strlen($myMenuPermission)>0 && $myMenuPermission!="NA") {

				?>
              <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr> 
                  <td width="6"><img src="../images/blank.gif" width="1" height="1"></td>
                  <td><table width="100%" height="22" border="0" cellpadding="2" cellspacing="0"  class="menu_table_bg_normal" onMouseOver="this.className='menu_table_bg_over'; " onMouseOut="this.className='menu_table_bg_normal'; "
 onClick="
with(document.myMenuForm) {
	SystemMenuID.value=<?=$Row1[$System_TableName_Menu."_ID"]?>; 
	SystemModuleKey.value='<?=$Row1[$System_TableName_Menu."_ModuleKey"]?>'; 
	action='<?=$Row1[$System_TableName_Menu."_LinkPath"]?>'; 
	submit();
}
">
                      <tr> 
                        <td width="22" align="center"><img src="<?=$Row1[$System_TableName_Menu."_Icon"]?>"></td>
                        <td> 
                          <? if($SystemMenuID==$Row1[$System_TableName_Menu."_ID"]) { ?>
                          <b><font color="#990000"> 
                          <?=$Row1[$System_TableName_Menu."_Name".$System_Session_Language]?>
                          </font></b> 
                          <? } else { ?>
                          <font color="#333333"> 
                          <?=$Row1[$System_TableName_Menu."_Name".$System_Session_Language]?>
                          </font> 
                          <? } ?>
                        </td>
                      </tr>
                    </table></td>
                </tr>
              </table>
              <? 
					} // if Permission
					$index1++;
				} // while
			 } // if RecordCount1
			 ?>
            </td>
          </tr>
          <?
		} // if myMenuPermission
		$index++;
	} // while
} // if RecordCount
?>
          <? } ?>
          <tr> 
            <td height="1" class="menu_table_bg_hilight"><img src="../images/blank.gif" width="1" height="1"></td>
          </tr>
          <tr> 
            <td height="22" class="menu_table_bg_normal" onMouseOver="this.className='menu_table_bg_over'; " onMouseOut="this.className='menu_table_bg_normal'; " onClick="document.myMenuForm.action='../system/logout.php'; document.myMenuForm.submit();"><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>Logout</td>
                </tr>
              </table></td>
          </tr>
          <tr> 
            <td height="1" class="menu_table_bg_shadow"><img src="../images/blank.gif" width="1" height="1"></td>
          </tr>
        </table>
        <? } ?>
        <script language="JavaScript" type="text/JavaScript">
function menuHideSubShow(myIdName) {
	if(document.getElementById(myIdName).style.display=='none') { 
		document.getElementById(myIdName).style.display=''
	} else {
		document.getElementById(myIdName).style.display='none';
	}
}
			  </script> 
        <!--End Menu ----------------------------------------------------------------------------------->
        <br> <br> <br> </td>
      <td height="30" align="center" valign="top" bgcolor="#FFFFFF"> 
        <? if(strlen($System_Session_User_ID)>0) { ?>
        <!-- InstanceBeginEditable name="Programmable Region" --> 
      <? 
if($MID=="") { $MID=8; } 
if($MID<=0) { $MID=8; } 
?>
      <br>
      <table width="95%" height="22" border="0" cellpadding="2" cellspacing="0" class="table_header">
        <tr> 
          <td width="30" align="center"><img src="../images/icon/ico570.gif" border="0" align="absmiddle"></td>
          <td> 
            Menu Manage
          </td>
        </tr>
      </table>
      <table width="94%" border="0" cellpadding="0" cellspacing="0">
        <tr> 
          <td height="1" class="table_col3"><img src="../images/blank.gif" width="10" height="2"></td>
        </tr>
        <form action="../system_menu/?" method="get" name="myPageRedirectForm" id="myPageRedirectForm">
          <input name="MID" type="hidden" id="MID" value="<?=$MID?>">
          <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
          <input name="actionType" type="hidden" id="actionType" value="<?=$actionType?>">
        </form>
      </table>
      <br>
      <script language="JavaScript" src="../lib/popup.js" type="text/JavaScript"></script>
      <? 
## Load Module Configuration Variable ############################################
include("../system_menu/config.php");
$myModule_Table = $myModule_Table1;
#########################################################
?>
      <? 
####################################################################
if($action=="view") { 
	$sql="SELECT * FROM ".$myModule_Table." WHERE ".$myModule_Table."_ID=".$Module_MenuID;
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	$Row=MYSQL_FETCH_ARRAY($Query);
	?>
      <br>
      <table width="500" border="0" cellpadding="0" cellspacing="1" class="table_header">
        <form action="../system_menu/?" method="get" name="myReturnForm" id="myReturnForm">
          <input name="MID" type="hidden" id="MID" value="<?=$MID?>">
          <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
          <input name="action" type="hidden" id="action" value="">
        </form>
        <form action="../system_menu/?" method="post" name="myForm" id="myForm">
          <input name="MID" type="hidden" id="MID" value="<?=$MID?>">
          <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
          <input name="action" type="hidden" id="action" value="edit">
          <input name="Module_MenuID" type="hidden" id="Module_MenuID" value="<?=$Module_MenuID?>">
          <tr> 
            <td bgcolor="#FFFFFF"> <table width="100%" border="0" cellpadding="2" cellspacing="1">
                <tr> 
                  <td height="24" colspan="2" align="center" class="menu_table_header">View Menu Info</td>
                </tr>
                <tr> 
                  <td height="22" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../images/bullet/box21.gif" width="11" height="11" vspace="2"> 
                    Information </td>
                </tr>
                <tr> 
                  <td width="120" height="22" align="right" class="table_col1">Menu 
                    Name&nbsp;</td>
                  <td height="22" class="table_col2"> 
                    <?=$Row[$myModule_Table."_Name".$System_Session_Language]?>
                  </td>
                </tr>
                <? if($Row[$myModule_Table."_isModule"]==1) { ?>
                <tr> 
                  <td width="120" height="22" align="right" class="table_col1">Modules Key&nbsp;</td>
                  <td height="22" class="table_col2"> 
                    <?=$Row[$myModule_Table."_ModuleKey"]?>
                  </td>
                </tr>
				<tr>
                  <td height="22" align="right" class="table_col1">Module Path&nbsp;</td>
                  <td height="22" class="table_col2">
                    <?=nl2br($Row[$myModule_Table."_LinkPath"])?>
                  </td>
                </tr>				<? } else if($Row[$myModule_Table."_isModule"]==2) { ?>
                
                <tr> 
                  <td width="120" height="22" align="right" class="table_col1">Type&nbsp;</td>
                  <td height="22" class="table_col2"> 
                    Group Menu
                  </td>
                </tr>
                <? } else if($Row[$myModule_Table."_isModule"]==0) { ?>
                <tr id="rowURL" <? if($Row[$myModule_Table."_isModule"]!=0) { ?> style="display:none"<? } ?>> 
                  <td height="24" align="right" class="table_col1">Target Window &nbsp;</td>
                  <td height="24" class="table_col2"> 
                    <? 
if($Row[$myModule_Table."_Target"]=="") { 
	echo "Current Window";
} else {
	echo "New Window";
}
?>
                  </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><input name="btEdit" type="button" class="button_80" id="btEdit" value="Edit" onClick="
document.myForm.action.value='edit';
document.myForm.submit();
						"> </td>
                        <td> <input name="btCalcel" type="button" class="button_80_not" id="btCalcel" onClick="
//if(confirm('Are you sure to return to list?')) {
	document.myReturnForm.submit();
//}
						" value="Cancel"> </td>
                      </tr>
                    </table></td>
                </tr>
              </table></td>
          </tr>
        </form>
      </table>
      <br>
      <br>
      <? 
####################################################################
 } else if($action=="add") { 
	?>
      <br>
      <table width="500" border="0" cellpadding="0" cellspacing="1" class="table_header">
        <form action="../system_menu/?" method="get" name="myReturnForm" id="myReturnForm">
          <input name="MID" type="hidden" id="MID" value="<?=$MID?>">
          <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
          <input name="action" type="hidden" id="action" value="">
        </form>
        <form action="../system_menu/?" method="post"  name="myForm" id="myForm">
          <input name="MID" type="hidden" id="MID" value="<?=$MID?>">
          <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
          <input name="action" type="hidden" id="action" value="addnew">
          <input name="myParentID" type="hidden" id="myParentID" value="<?=$myParentID?>">
          <tr> 
            <td bgcolor="#FFFFFF"> <table width="100%" border="0" cellpadding="2" cellspacing="1">
                  <tr> 
                    <td height="24" colspan="2" align="center" class="menu_table_header">Add 
                      New Menu on Group " 
                      <?=getMenuName($myParentID)?>
                      "</td>
                  </tr>
                  <tr> 
                    <td height="22" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../images/bullet/box21.gif" width="11" height="11"> 
                      Information </td>
                  </tr>
                  <tr> 
                    <td height="22" align="right" class="table_col1">Icon&nbsp;</td>
                    <td height="22" class="table_col2"><table width="160" border="0" cellspacing="0" cellpadding="1">
                        <tr> 
                          <td width="30" align="center"><img src="../images/blank.gif" name="LibraryIconSample" id="LibraryIconSample"> 
                            <input name="inputIconName" type="hidden" id="inputIconName"></td>
                          <td align="right"><input name="btChoose" type="button" class="button_80" id="btChoose" onClick="
Popup('popupIconWindow','../system/popup_icon_library.php',500,420,1)
" value="Choose"></td>
                        </tr>
                      </table></td>
                  </tr>
                  <tr> 
                    <td width="120" height="22" align="right" class="table_col1">Menu 
                      Name&nbsp;</td>
                    <td height="22" class="table_col2"><input name="inputMenu_Name" type="text" class="input_left" id="inputMenu_Name" size="40"  maxlength="250"></td>
                  </tr>
                  <tr> 
                    <td height="22" align="right" class="table_col1">Go to &nbsp;</td>
                    <td height="22" class="table_col2"> <table border="0" cellspacing="0" cellpadding="0">
                        <tr> 
                          <td> <input name="inputMenu_LinkType" type="radio" class="form_checkbox" onClick="
document.getElementById('rowModule').style.display='';
document.getElementById('rowModuleKey').style.display='';
document.getElementById('rowURL').style.display='none';
document.getElementById('rowTarget').style.display='';
" value="1" checked> </td>
                          <td width="50">Module</td>
                          <td> <input name="inputMenu_LinkType" type="radio" class="form_checkbox" onClick="
document.getElementById('rowModule').style.display='none';
document.getElementById('rowModuleKey').style.display='none';
document.getElementById('rowURL').style.display='';
document.getElementById('rowTarget').style.display='';
" value="0" > </td>
                          <td width="80">Link</td>
                          <td> <input name="inputMenu_LinkType" type="radio" class="form_checkbox" onClick="
document.getElementById('rowModule').style.display='none';
document.getElementById('rowURL').style.display='none';
document.getElementById('rowTarget').style.display='none';
document.getElementById('rowModuleKey').style.display='none';
" value="2"> </td>
                          <td width="80">Group</td>
                        </tr>
                      </table></td>
                  </tr>
                  <tr id="rowModule"> 
                    <td align="right" class="table_col1">Include Path &nbsp; </td>
                    <td height="22" class="table_col2"><input name="inputLinkPath" type="text" class="input_left" id="inputLinkPath" value="<?=$Row[$myModule_Table."_LinkPath"]?>" size="45" maxlength="100"> 
                      <input name="btModuleChoose" type="button" class="button_30" id="btModuleChoose" onClick="
Popup('popupIconWindow','../system/popup_module_selecter.php',300,430,1)
" value=".."></td>
                  </tr>
                  <tr id="rowURL" style="display:none"> 
                    <td height="24" align="right" class="table_col1">URL&nbsp;</td>
                    <td height="24" class="table_col2"> <input name="inputMenu_URL" type="text" class="input_left" id="inputBasicInput" value="http://" size="40"  maxlength="250"> 
                    </td>
                  </tr>
                  <tr id="rowModuleKey"> 
                    <td height="22" align="right" class="table_col1">Module Key&nbsp;</td>
                    <td height="22" class="table_col2"> <input name="inputModuleKey" type="text" class="input_left" id="inputModuleKey" value="<?=$inputModuleKey?>" size="20" maxlength="20"></td>
                  </tr>
                  <tr> 
                    <td height="22" align="right" class="table_col1">&nbsp;</td>
                    <td height="22" class="table_col2"> <input name="isAddAgain" type="checkbox" id="isAddAgain" value="Yes" <? if($isAddAgain=="Yes") { echo " checked"; } ?>> 
                      <label for="isAddAgain">Add new category and go to add new 
                      again</label> </td>
                  </tr>
                  <tr id="rowTarget"> 
                    <td height="24" align="right" class="table_col1">Target Window&nbsp;</td>
                    <td height="24" class="table_col2"> <table border="0" cellspacing="0" cellpadding="0">
                        <tr> 
                          <td> <input name="inputMenu_Target" type="radio" class="form_checkbox" value="" checked> 
                          </td>
                          <td width="90">Current Window</td>
                          <td> <input name="inputMenu_Target" type="radio" class="form_checkbox" value="_blank"> 
                          </td>
                          <td width="90">New window</td>
                        </tr>
                      </table></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 isNumber(myObj) { return !isNaN(myObj.value*1) }
function verifySubmit() {
	with(document.myForm) {
		if(isBlank(inputMenu_Name)) { inputMenu_Name.focus(); return false; }
		if(inputMenu_LinkType[1].checked) {
			if(isBlank(inputMenu_URL)) { inputMenu_URL.focus(); return false; }
			if(inputMenu_URL.value=='http://') { inputMenu_URL.focus(); return false; }
		}
	}
	document.myForm.submit();
}
						</script> <input name="btAdd" type="button" class="button_80" id="btAdd" value="Add" onClick="verifySubmit();"> 
                        </td>
                        <td> <input name="btCalcel" type="button" class="button_80_not" id="btCalcel" onClick="
//if(confirm('Are you sure to return to list?')) {
	document.myReturnForm.submit();
//}
						" value="Cancel"> </td>
                      </tr>
                    </table></td>
                </tr>
              </table></td>
          </tr>
        </form>
      </table>
      <br>
      <br>
      <? 
#########################################################
} else if($action=="addnew") { 
		$inputMenu_Module='Module';
	if($inputMenu_LinkType==0) { $inputMenu_Module="Link"; $inputLinkPath=$inputMenu_URL;}
	if($inputMenu_LinkType==2) { $inputMenu_Module="Group"; }
	
	//$sql = "SELECT COUNT(*) FROM ".$myModule_Table." WHERE ".$myModule_Table."_ParentID='$myParentID' AND ".$myModule_Table."_MID='$MID'  ";
	$sql = "SELECT MAX(".$myModule_Table."_Order) FROM ".$myModule_Table;
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	$Row=MYSQL_FETCH_ARRAY($Query);
	$MaxOrder = $Row[0]+1;

	$sql = "INSERT INTO ".$myModule_Table."(".$myModule_Table."_Name".$System_Session_Language.",".$myModule_Table."_LinkPath,".$myModule_Table."_Icon,".$myModule_Table."_Order,".$myModule_Table."_Status,".$myModule_Table."_ModuleKey,".$myModule_Table."_ModuleType,".$myModule_Table."_isModule,".$myModule_Table."_Target,".$myModule_Table."_ParentID,".$myModule_Table."_Language,".$myModule_Table."_ShowMain) VALUES('$inputMenu_Name','$inputLinkPath','$inputIconName',$MaxOrder,'Enable','$inputModuleKey','$inputMenu_Module','$inputMenu_LinkType','$inputMenu_Target','$myParentID','$System_Session_Language','$inputShowmain') ";
	//die($sql);
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	
	include("../lib/loadpermission.php");
	
	if($isAddAgain=="Yes") {
		?>
      <form action="../system_menu/?" method="get" name="myForm" id="myForm">
        <input name="MID" type="hidden" id="MID" value="<?=$MID?>">
        <input name="isAddAgain" type="hidden" id="isAddAgain" value="Yes">
        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
        <input name="action" type="hidden" id="action" value="add">
        <input name="myParentID" type="hidden" id="myParentID" value="<?=$myParentID?>">
      </form>
      <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
      <? 
	} else {
		?>
      <form action="../system_menu/?" method="get" name="myForm" id="myForm">
        <input name="MID" type="hidden" id="MID" value="<?=$MID?>">
        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
        <input name="action" type="hidden" id="action">
      </form>
      <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
      <? 
	}
####################################################################
} else if($action=="edit") { 
	$sql="SELECT * FROM ".$myModule_Table." WHERE ".$myModule_Table."_ID=".$Module_MenuID;
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	$Row=MYSQL_FETCH_ARRAY($Query);
	?>
      <br>
      <table width="500" border="0" cellpadding="0" cellspacing="1" class="table_header">
        <form action="../system_menu/?" method="get" name="myReturnForm" id="myReturnForm">
          <input name="MID" type="hidden" id="MID" value="<?=$MID?>">
          <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
          <input name="action" type="hidden" id="action" value="">
        </form>
        <form action="../system_menu/?" method="post"  name="myForm" id="myForm">
          <input name="MID" type="hidden" id="MID" value="<?=$MID?>">
          <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
          <input name="action" type="hidden" id="action" value="update">
          <input name="Module_MenuID" type="hidden" id="Module_MenuID" value="<?=$Module_MenuID?>">
          <tr> 
            <td bgcolor="#FFFFFF"> <table width="100%" border="0" cellpadding="2" cellspacing="1">
                <tr> 
                  <td height="24" colspan="2" align="center" class="menu_table_header">Edit Menu
                  </td>
                </tr>
                <tr> 
                  <td height="22" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../images/bullet/box21.gif" width="11" height="11"> 
                    Information </td>
                </tr>
                <tr>
                  <td height="22" align="right" class="table_col1">Icon&nbsp;</td>
                  <td height="22" class="table_col2"><table width="160" border="0" cellspacing="0" cellpadding="1">
                      <tr>
                        <td width="30" align="center"><img src="<?=$Row[$myModule_Table."_Icon"]?>" name="LibraryIconSample" id="LibraryIconSample">
                            <input name="inputIconName" type="hidden" id="inputIconName" value="<?=$Row[$myModule_Table."_Icon"]?>"></td>
                        <td align="right"><input name="btChoose" type="button" class="button_80" id="btChoose" onClick="
Popup('popupIconWindow','../system/popup_icon_library.php',500,420,1)
" value="Choose"></td>
                      </tr>
                  </table></td>
                </tr>
                <tr> 
                  <td width="120" align="right" class="table_col1">Menu Name&nbsp;</td>
                  <td height="22" class="table_col2"> <input name="inputMenu_Name" type="text" class="input_left" id="input" size="40"  maxlength="250" value="<?=$Row[$myModule_Table."_Name".$System_Session_Language]?>"> 
                  </td>
                </tr>
                <tr> 
                  <td align="right" class="table_col1">Go to&nbsp;</td>
                  <td height="22" class="table_col2"> <table border="0" cellspacing="0" cellpadding="0">
                      <tr> 
                        <td> <input name="inputMenu_LinkType" type="radio" class="form_checkbox" onClick="
document.getElementById('rowModule').style.display='';
document.getElementById('rowModuleKey').style.display='';
document.getElementById('rowURL').style.display='none';
document.getElementById('rowTarget').style.display='';
" value="1" 
<? if($Row[$myModule_Table."_ModuleType"]=="Module"){
echo "checked";
}?>
> </td>
                        <td width="50">Module</td>
                        <td> <input name="inputMenu_LinkType" type="radio" class="form_checkbox" onClick="
document.getElementById('rowModule').style.display='none';
document.getElementById('rowModuleKey').style.display='none';
document.getElementById('rowURL').style.display='';
document.getElementById('rowTarget').style.display='';
" value="0" <? if($Row[$myModule_Table."_ModuleType"]=="Link"){
echo "checked";?>
<? }?>
> </td>
                          <td width="80">Link</td>
                        <td> <input name="inputMenu_LinkType" type="radio" class="form_checkbox" onClick="
document.getElementById('rowModule').style.display='none';
document.getElementById('rowURL').style.display='none';
document.getElementById('rowTarget').style.display='none';
document.getElementById('rowModuleKey').style.display='none';
" value="2" <? if($Row[$myModule_Table."_ModuleType"]=="Group"){
echo "checked";
}?>> </td>
                        <td width="80">Group</td>
                      </tr>
                    </table></td>
                </tr>
                <tr >
                  <td align="right" class="table_col1">&nbsp;</td>
                  <td height="22" class="table_col2"><input name="inputShowmain" type="checkbox" id="inputShowmain" value="Yes" <? if($Row[$myModule_Table."_ShowMain"]=="Yes") { echo " checked"; } ?>>
Show in mainpage.</td>
                </tr>
                <tr id="rowModule" <? if($Row[$myModule_Table."_ModuleType"]=="Group") { ?> style="display:none"<? } ?>>
                  <td align="right" class="table_col1">Include Path&nbsp; </td>
                  <td height="22" class="table_col2"><input name="inputLinkPath" type="text" class="input_left" id="inputLinkPath" value="<?=$Row[$myModule_Table."_LinkPath"]?>" size="45" maxlength="100">
                      <input name="btModuleChoose" type="button" class="button_30" id="btModuleChoose" onClick="
Popup('popupIconWindow','../system/popup_module_selecter.php',300,430,1)
" value=".."></td>
                </tr>
                <tr id="rowURL" <? if($Row[$myModule_Table."_isModule"]!=0) { ?> style="display:none"<? } ?>> 
                  <td height="24" align="right" class="table_col1">URL&nbsp;</td>
                  <td height="24" class="table_col2"> <input name="inputMenu_URL" type="text" class="input_left" id="inputBasicInput" value="<?
if($Row[$myModule_Table."_URL"]=="") {
	echo "http://";
} else {
	echo $Row[$myModule_Table."_URL"];
}
?>" size="40"  maxlength="250"> </td>
                </tr>
                <tr id="rowModuleKey" <? if($Row[$myModule_Table."_isModule"]==2) { ?> style="display:none"<? } ?>>
                  <td height="22" align="right" class="table_col1">Module 
                                  Key&nbsp;</td>
                                <td height="22" class="table_col2"> <input name="inputModuleKey" type="text" class="input_left" id="inputModuleKey" value="<?=$Row[$myModule_Table."_ModuleKey"]?>" size="20" maxlength="20"></td>
                </tr>
                <tr id="rowTarget" <? if($Row[$myModule_Table."_isModule"]==2) { ?> style="display:none"<? } ?>> 
                  <td height="24" align="right" class="table_col1">Target Window&nbsp;</td>
                  <td height="24" class="table_col2"> <table border="0" cellspacing="0" cellpadding="0">
                      <tr> 
                        <td> <input name="inputMenu_Target" type="radio" class="form_checkbox" value="" <? if($Row[$myModule_Table."_Target"]=="") { echo " checked"; } ?>> 
                        </td>
                        <td width="90">Current Window</td>
                        <td> <input name="inputMenu_Target" type="radio" class="form_checkbox" value="_blank" <? if($Row[$myModule_Table."_Target"]=="_blank") { echo " checked"; } ?>> 
                        </td>
                        <td width="90">New window</td>
                      </tr>
                    </table></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 isNumber(myObj) { return !isNaN(myObj.value*1) }
function verifySubmit() {
	with(document.myForm) {
		if(isBlank(inputMenu_Name)) { inputMenu_Name.focus(); return false; }
		if(inputMenu_LinkType[1].checked) {
			if(isBlank(inputMenu_URL)) { inputMenu_URL.focus(); return false; }
			if(inputMenu_URL.value=='http://') { inputMenu_URL.focus(); return false; }
		}
		<? if ($Row[$myModule_Table."_isModule"]==1) { ?>
		if (inputLinkPath.value!='<?=$Row[$myModule_Table."_ModuleType"]?>') {
			if (!confirm('การเปลี่ยนแปลงนี้จะทำให้ข้อมูลที่อยู่ภายในเมนูสูญหาย\nคุณแน่ใจว่าต้องการเปลี่ยนแปลงหรือไม่?')) {
				return false;
			}
		}
		<? } ?>
	}
	document.myForm.submit();
}
						</script> <input name="btAdd" type="button" class="button_80" id="btAdd" value="Save" onClick="verifySubmit();"> 
                        </td>
                        <td> <input name="btCalcel" type="button" class="button_80_not" id="btCalcel" onClick="
//if(confirm('Are you sure to return to list?')) {
	document.myReturnForm.submit();
//}
						" value="Cancel"> </td>
                      </tr>
                    </table></td>
                </tr>
              </table></td>
          </tr>
        </form>
      </table>
      <br>
      <br>
      <? 
#########################################################
} else if($action=="update") { 
$inputMenu_Module='Module';
	if($inputMenu_LinkType=="0") { $inputMenu_Module="Link"; $inputLinkPath=$inputMenu_URL;}
	if($inputMenu_LinkType==2) { $inputMenu_Module="Group"; }
	$sql = "UPDATE ".$myModule_Table." SET ".$myModule_Table."_Target = '$inputMenu_Target', "
	.$myModule_Table."_Icon = '$inputIconName', "
	.$myModule_Table."_Name".$System_Session_Language." = '$inputMenu_Name',"
	.$myModule_Table."_isModule = '$inputMenu_LinkType',"
	.$myModule_Table."_ModuleType= '$inputMenu_Module',".$myModule_Table."_ModuleKey= '$inputModuleKey',".$myModule_Table."_LinkPath= '$inputLinkPath',".$myModule_Table."_ShowMain= '$inputShowmain'  WHERE ".$myModule_Table."_ID=". $Module_MenuID;
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	?>
      <form action="../system_menu/?" method="get" name="myForm" id="myForm">
        <input name="MID" type="hidden" id="MID" value="<?=$MID?>">
        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
        <input name="action" type="hidden" id="action">
      </form>
      <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
      <? 
####################################################################
} else if($action=="move") { 
	include("../system_menu/function.php");
	$sql="SELECT * FROM ".$myModule_Table." WHERE ".$myModule_Table."_ID=".$Module_MenuID;
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	$Row=MYSQL_FETCH_ARRAY($Query);
	?>
      <br>
      <table width="500" border="0" cellpadding="0" cellspacing="1" class="table_header">
        <form action="../system_menu/?" method="get" name="myReturnForm" id="myReturnForm">
          <input name="MID" type="hidden" id="MID" value="<?=$MID?>">
          <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
          <input name="action" type="hidden" id="action" value="">
        </form>
        <form action="../system_menu/?" method="post"  name="myForm" id="myForm">
          <input name="MID" type="hidden" id="MID" value="<?=$MID?>">
          <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
          <input name="action" type="hidden" id="action" value="movegroup">
          <input name="Module_MenuID" type="hidden" id="Module_MenuID" value="<?=$Module_MenuID?>">
          <tr>
            <td bgcolor="#FFFFFF">
              <table width="100%" border="0" cellpadding="2" cellspacing="1">
                <tr>
                  <td height="24" colspan="2" align="center" class="menu_table_header">Move Menu </td>
                </tr>
                <tr>
                  <td height="22" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../images/bullet/box21.gif" width="11" height="11"> Information </td>
                </tr>
                <tr>
                  <td width="120" align="right" class="table_col1">Group Menu &nbsp;</td>
                  <td height="22" class="table_col2">
                    <select name="GroupMenuID" class="select">
						<option value="0">Main Menu</option>
						<? loadResidenceGroupSelect(0,1); ?>
					</select>
					<?
					if ($Row[$myModule_Table."_ParentID"]>0) echo "<script language='JavaScript'> document.myForm.GroupMenuID.value='".$Row[$myModule_Table."_ParentID"]."'; </script>";
					?>
                  </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>
                          <input name="btAdd" type="button" class="button_80" id="btAdd" value="Save" onClick="document.myForm.submit()">                        </td>
                        <td>
                          <input name="btCalcel" type="button" class="button_80_not" id="btCalcel" onClick="
//if(confirm('Are you sure to return to list?')) {
	document.myReturnForm.submit();
//}
						" value="Cancel">
                        </td>
                      </tr>
                  </table></td>
                </tr>
            </table></td>
          </tr>
        </form>
      </table>
      <br>
      <br>
      <? 
#########################################################
} else if($action=="movegroup") { 
	$sql = "SELECT Max(".$myModule_Table."_Order) FROM ".$myModule_Table." WHERE ".$myModule_Table."_ParentID='$GroupMenuID'";
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	$Row=MYSQL_FETCH_ARRAY($Query);
	$MaxOrder = $Row[0]+1;
	
	$sql="UPDATE ".$myModule_Table." SET ".$myModule_Table."_ParentID=$GroupMenuID,".$myModule_Table."_Order=$MaxOrder WHERE ".$myModule_Table."_ID=".$Module_MenuID;
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
?>
      <form action="../system_menu/?" method="get" name="myForm" id="myForm">
        <input name="MID" type="hidden" id="MID" value="<?=$MID?>">
        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
        <input name="action" type="hidden" id="action">
      </form>
      <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
      <? 
#########################################################
} else if($action=="delete") { 
	$sql = "DELETE FROM ".$myModule_Table." WHERE ".$myModule_Table."_ID=".$Module_MenuID;
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
?>
      <form action="../system_menu/?" method="get" name="myForm" id="myForm">
        <input name="MID" type="hidden" id="MID" value="<?=$MID?>">
        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
        <input name="action" type="hidden" id="action">
      </form>
      <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
      <? 
#########################################################
} else if($action=="setstatus") { 
	$sql="UPDATE ".$myModule_Table." SET ".$myModule_Table."_Status='$SelectStatus' WHERE ".$myModule_Table."_ID=".$Module_MenuID;
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
?>
      <form action="../system_menu/?" method="get" name="myForm" id="myForm">
        <input name="MID" type="hidden" id="MID" value="<?=$MID?>">
        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
        <input name="action" type="hidden" id="action">
      </form>
      <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
<?	  
} else if($action=="setnewstatus") { 
	$sql="UPDATE ".$myModule_Table." SET ".$myModule_Table."_NewStatus='$SelectStatus' WHERE ".$myModule_Table."_ID=".$Module_MenuID;
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
?>
      <form action="../system_menu/?" method="get" name="myForm" id="myForm">
        <input name="MID" type="hidden" id="MID" value="<?=$MID?>">
        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
        <input name="action" type="hidden" id="action">
      </form>
      <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
<?  
	  
//########################################################
} else if($action=="makeordering") { 
	$sql = "SELECT * FROM ".$myModule_Table." WHERE ".$myModule_Table."_ParentID='$myParentID'";
	$sql .= " AND ".$myModule_Table."_Language = '$System_Session_Language'";
	$sql .= " ORDER BY ".$myModule_Table."_Order ASC ";
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	$RecordCount=MYSQL_NUMROWS($Query);
?>
      <table width="500" border="0" cellpadding="0" cellspacing="1" class="table_border">
        <form action="../system_menu/?" method="get" name="myRedirectForm" id="myRedirectForm">
          <input name="MID" type="hidden" id="MID" value="<?=$MID?>">
          <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
          <input name="action" type="hidden" id="action">
        </form>
        <form action="../system_menu/?" method="post" name="myForm" id="myForm">
          <input name="MID" type="hidden" id="MID" value="<?=$MID?>">
          <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
          <input name="action" type="hidden" id="action">
          <input name="myParentID" type="hidden" id="myParentID" value="<?=$myParentID?>">
          <tr> 
            <td bgcolor="#FFFFFF"> <table width="100%" border="0" cellpadding="2" cellspacing="1" class="mytable_inner">
                <tr align="center"> 
                  <td height="24" colspan="2" align="center" class="table_header">Make 
                    Ordering 
                  </td>
                </tr>
                <tr> 
                  <td width="100" align="right" valign="top" class="table_col1"><br> 
                    List&nbsp;</td>
                  <td height="40" align="left" class="table_col2"> <table height="60" border="0" cellpadding="2" cellspacing="0">
                      <tr> 
                        <td align="center"> <select name="listUser[]" size="15" multiple class="input_textarea" id="listUser" style="width:200">
                            <?
if($RecordCount>0) {
	$index=1;
	while($index<$RecordCount+1) {
		$Row=MYSQL_FETCH_ARRAY($Query);
		echo "<option value=\"".$Row[$myModule_Table."_ID"]."\">";
		if(strlen($Row[$myModule_Table."_Name".$System_Session_Language])>30) {
			echo substr($Row[$myModule_Table."_Name".$System_Session_Language],0,30);
		} else {
			echo $Row[$myModule_Table."_Name".$System_Session_Language];
		}
		echo "</option>\n";
		$index++;
	}
}
?>
                          </select> </td>
                        <td valign="top"><table height="100%" border="0" cellpadding="1" cellspacing="0">
                            <tr> 
                              <td height="10"><input type="button"  class="button_100" id="RemoveUp" name="RemoveUp"  value="Move Up" onClick="funcMultipleMoveUp(document.myForm.elements['listUser[]'])"></td>
                            </tr>
                            <tr> 
                              <td> <script language="JavaScript" type="text/JavaScript">
function funcMultipleSelectAll(myListObj) {
	var Len = myListObj.options.length;
	if(Len>0) 
		for(var i=0;i<Len;i++)
		   myListObj.options[i].selected=true;
}
function funcMultipleMoveUp(myListObj) {
	var Len = myListObj.options.length;
	var tmpID,tmpValue;
	if(Len>0) 
		for(var i=1;i<Len;i++)
	    	if (myListObj.options[i]!=null && myListObj.options[i].selected==true) {
					if(!myListObj.options[i-1].selected) {
					   myListObj.options[i].selected=false;
					   tmpID = myListObj.options[i].value;
					   tmpValue = myListObj.options[i].text;
					   myListObj.options[i].value = myListObj.options[i-1].value;
					   myListObj.options[i].text = myListObj.options[i-1].text;
					   myListObj.options[i-1].value = tmpID;
					   myListObj.options[i-1].text = tmpValue;
					   myListObj.options[i-1].selected=true;
				}
			}
}
function funcMultipleMoveDown(myListObj) {
	var Len = myListObj.options.length;
	var tmpID,tmpValue;
	if(Len>0) 
		for(var i=Len-2;i>=0;i--)
	    	if (myListObj.options[i]!=null && myListObj.options[i].selected==true) {
					if(!myListObj.options[i+1].selected) {
					   myListObj.options[i].selected=false;
					   tmpID = myListObj.options[i].value;
					   tmpValue = myListObj.options[i].text;
					   myListObj.options[i].value = myListObj.options[i+1].value;
					   myListObj.options[i].text = myListObj.options[i+1].text;
					   myListObj.options[i+1].value = tmpID;
					   myListObj.options[i+1].text = tmpValue;
					   myListObj.options[i+1].selected=true;
				}
			}
}
								  </script> </td>
                            </tr>
                            <tr> 
                              <td height="10"><input type="button"  class="button_100" id="MoveDown" name="MoveDown"  value="Move Down" onClick="funcMultipleMoveDown(document.myForm.elements['listUser[]'])"></td>
                            </tr>
                          </table></td>
                      </tr>
                    </table></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> <input name="btSave" type="button" class="button_80" id="btSave" value="Save"  onClick="
if(confirm('Are you sure to save a change?')) {
	document.myForm.action.value='updateordering';
	funcMultipleSelectAll(document.myForm.elements['listUser[]']);
	document.myForm.submit();
}
						"></td>
                        <td> <input name="btCalcel" type="button" class="button_80_not" id="btCalcel" onClick="
//if(confirm('Are you sure to return to list?')) {
	document.myRedirectForm.submit();
//}
						" value="Cancel"> </td>
                      </tr>
                    </table></td>
                </tr>
              </table></td>
          </tr>
        </form>
      </table>
      <br>
      <? 
//########################################################
} else if($action=="updateordering") { 
$index=1;
if($listUser!="") {
	while (list ($key, $val) = each ($listUser)) {
		$sql="UPDATE ".$myModule_Table." SET ".$myModule_Table."_Order='$index' WHERE ".$myModule_Table."_ID=".$val;
		$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
		$index++;
	}
}
?>
      <form action="../system_menu/?" method="get" name="myForm" id="myForm">
        <input name="MID" type="hidden" id="MID" value="<?=$MID?>">
        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
        <input name="action" type="hidden" id="action">
      </form>
      <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
      <?
#########################################################
} else {
$sql = "SELECT * FROM ".$myModule_Table;
$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("<br><br><b><font color=#FF0000>ไม่สามารถใช้งานระบบได้<br>หากคุณเข้าใช้งานเป็นครั้งแรก<br><a href=\"#\" onClick=\"Popup('popupCreateDatabaseWindow','createdatabase.php',220,180,1);\">กรุณาคลิ๊กที่นี่</a><br>เพื่อทำการสร้างฐานข้อมูลใหม่</font></b>\n");
?>
      <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>
      <div id="divDataPicker" style="display:none; position:absolute; top:-61px; left:11px; width: 200px; z-index: 1;Filter:Alpha(opacity=95)"> 
        <table width="100%" border="0" cellpadding="0" cellspacing="1" class="table_border">
          <form action="../system_menu/?" method="post" name="myStatusForm" id="myStatusForm">
            <input name="MID" type="hidden" id="MID" value="<?=$MID?>">
            <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
            <tr> 
              <td height="22"><table width="100%" height="22" border="0" cellpadding="0" cellspacing="0" class="table_header">
                  <tr> 
                    <td width="28" align="center"><img src="../images/icon/ico439.gif" width="19" height="15"></td>
                    <td align="center">Select Status</td>
                    <td width="22" align="center"><img src="../images/icon/ico215.gif" width="16" height="16" onMouseOver="this.style.cursor='hand'" onClick="document.getElementById('divDataPicker').style.display='none'; "></td>
                  </tr>
                </table></td>
            </tr>
            <tr> 
              <td height="120" align="center" class="table_row1"><br> <table width="120" border="0" cellpadding="2" cellspacing="0">
                  <tr> 
                    <td width="26" height="22" align="center"><input name="toolbarStatus" type="radio" class="form_checkbox" value="Enable" checked></td>
                    <td height="22" class="text_bold">Enable</td>
                  </tr>
                  <tr> 
                    <td width="26" height="22" align="center"><input name="toolbarStatus" type="radio" class="form_checkbox" value="Disable"></td>
                    <td height="22" class="text_bold">Disable</td>
                  </tr>
                </table>
                <br> <table border="0" cellspacing="0" cellpadding="6">
                  <tr> 
                    <td><input name="btSave" type="button" class="button_th_60" id="btSave" value="Save" onClick="
if(document.myStatusForm.toolbarStatus[0].checked) {
	document.myForm.SelectStatus.value=document.myStatusForm.toolbarStatus[0].value;
}
if(document.myStatusForm.toolbarStatus[1].checked) {
	document.myForm.SelectStatus.value=document.myStatusForm.toolbarStatus[1].value;
}
document.myForm.action.value='setstatus';
document.myForm.submit();
"></td>
                    <td><input name="btClose" type="button" class="button_th_60" id="btClose" value="Close" onClick="document.getElementById('divDataPicker').style.display='none';"></td>
                  </tr>
                </table></td>
            </tr>
            <tr> 
              <td height="6" class="table_footer"><img src="../images/blank.gif" width="1" height="1"></td>
            </tr>
          </form>
        </table>
      </div>
	   <div id="divDataPicker2" style="display:none; position:absolute; top:-61px; left:11px; width: 200px; z-index: 1;Filter:Alpha(opacity=95)"> 
        <table width="100%" border="0" cellpadding="0" cellspacing="1" class="table_border">
          <form action="../system_menu/?" method="post" name="myNewForm" id="myNewForm">
            <input name="MID" type="hidden" id="MID" value="<?=$MID?>">
            <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
            <tr> 
              <td height="22"><table width="100%" height="22" border="0" cellpadding="0" cellspacing="0" class="table_header">
                  <tr> 
                    <td width="28" align="center"><img src="../images/icon/ico439.gif" width="19" height="15"></td>
                    <td align="center">Select Status</td>
                    <td width="22" align="center"><img src="../images/icon/ico215.gif" width="16" height="16" onMouseOver="this.style.cursor='hand'" onClick="document.getElementById('divDataPicker2').style.display='none'; "></td>
                  </tr>
                </table></td>
            </tr>
            <tr> 
              <td height="120" align="center" class="table_row1"><br> <table width="120" border="0" cellpadding="2" cellspacing="0">
                  <tr> 
                    <td width="26" height="22" align="center"><input name="toolbarStatus" type="radio" class="form_checkbox" value="Yes" checked></td>
                    <td height="22" class="text_bold">Yes</td>
                  </tr>
                  <tr> 
                    <td width="26" height="22" align="center"><input name="toolbarStatus" type="radio" class="form_checkbox" value="No"></td>
                    <td height="22" class="text_bold">No</td>
                  </tr>
                </table>
                <br> <table border="0" cellspacing="0" cellpadding="6">
                  <tr> 
                    <td><input name="btSave" type="button" class="button_th_60" id="btSave" value="Save" onClick="
if(document.myNewForm.toolbarStatus[0].checked) {
	document.myForm.SelectStatus.value=document.myNewForm.toolbarStatus[0].value;
}
if(document.myNewForm.toolbarStatus[1].checked) {
	document.myForm.SelectStatus.value=document.myNewForm.toolbarStatus[1].value;
}
document.myForm.action.value='setnewstatus';
document.myForm.submit();
"></td>
                    <td><input name="btClose" type="button" class="button_th_60" id="btClose" value="Close" onClick="document.getElementById('divDataPicker2').style.display='none';"></td>
                  </tr>
                </table></td>
            </tr>
            <tr> 
              <td height="6" class="table_footer"><img src="../images/blank.gif" width="1" height="1"></td>
            </tr>
          </form>
        </table>
      </div>
      <script language="JavaScript" type="text/JavaScript">
var StatusIndex=0;
function ShowDataPicker(myDivName,RefX,RefY) {
	document.getElementById(myDivName).style.display=''; 
	document.getElementById(myDivName).style.left = document.body.scrollLeft + window.event.clientX + RefX;
	document.getElementById(myDivName).style.top= document.body.scrollTop+ window.event.clientY + RefY;
}
	  </script>
      <div id="divLinker" style="display:none; position:absolute; top:-16px; left:21px; width: 209px; z-index: 1; height: 68px;"> 
        <table width="100%" border="0" cellpadding="0" cellspacing="1" class="table_border">
          <tr> 
            <td height="22"><table width="100%" height="22" border="0" cellpadding="0" cellspacing="0" class="table_header">
                <tr> 
                  <td width="28" align="center"><img src="../images/icon/ico439.gif" width="19" height="15"></td>
                  <td align="center">Select where to go..</td>
                  <td width="22" align="center"><img src="../images/icon/ico215.gif" width="16" height="16" onMouseOver="this.style.cursor='hand'" onClick="document.getElementById('divLinker').style.display='none'; "></td>
                </tr>
              </table></td>
          </tr>
          <tr> 
            <td height="60" align="center" class="table_row1" id="idGoHTML"> <table width="120" border="0" cellpadding="1" cellspacing="0">
                <tr> 
                  <td width="18" height="18" align="center"><img src="../images/bullet/red-circle-arrow.gif" width="9" height="9"></td>
                  <td height="18" class="text_bold">Enable</td>
                </tr>
                <tr> 
                  <td width="18" height="18" align="center"><img src="../images/bullet/red-circle-arrow.gif" width="9" height="9"></td>
                  <td height="18" class="text_bold">Disable</td>
                </tr>
              </table></td>
          </tr>
          <tr> 
            <td height="6" class="table_footer"><img src="../images/blank.gif" width="1" height="1"></td>
          </tr>
        </table>
      </div>
      <table width="90%" border="0" cellspacing="0" cellpadding="2">
        <form action="../system_menu/?" method="get" name="myMenuSelectForm" id="myMenuSelectForm">
          <input name="MID" type="hidden" id="MID" value="<?=$MID?>">
          <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
          <input name="actio2" type="hidden" id="action">
          <tr>
            <td align="right"> </td>
          </tr>
        </form>
      </table>
      <table width="95%" border="0" cellpadding="0" cellspacing="1" class="table_border">
        <form action="../system_menu/?" method="get" name="myForm" id="myForm">
          <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
          <input name="MID" type="hidden" id="MID" value="<?=$MID?>">
          <input name="action" type="hidden" id="action">
          <input name="myParentID" type="hidden" id="myParentID" value="0">
          <input name="Module_MenuID" type="hidden" id="Module_MenuID" value="0">
          <input name="SelectStatus" type="hidden" id="SelectStatus">
          <tr> 
            <td bgcolor="#FFFFFF"> <table width="100%" border="0" cellpadding="0" cellspacing="1">
                <tr align="center" class="menu_table_header"> 
                  <td width="376" height="24" align="left"> &nbsp;&nbsp;&nbsp;Menu List</td>
                  <td width="70">Type</td>
                  <td width="64">Show</td>
                  <td width="66" height="24">Status</td>
                  <td width="91" height="24">Action</td>
                </tr>
              </table>
              <table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tr class="table_row1"> 
                  <td height="80" align="center" valign="top"> 
                    <? 
include("../system_menu/config.php"); 
include("../system_menu/function.php"); 
$myParentGroupID=0;
$MID=0;
loadTreeMenu($myParentGroupID,$MID,0);
?>
                  </td>
                </tr>
              </table>
              <table width="100%" height="10" border="0" cellpadding="3" cellspacing="1">
                <tr> 
                  <td class="table_footer">&nbsp;</td>
                </tr>
              </table></td>
          </tr>
        </form>
      </table>
      <br>
     <br>
      <? 
}
#########################################################
?>
      <!-- InstanceEndEditable --> 
        <? }  else { echo "&nbsp;&nbsp;&nbsp;"; } ?>
      </td>
      <td width="10" height="30" background="../../images/design-a/border-right.gif" bgcolor="#FFFFFF"><img src="../../images/blank.gif" width="1" height="1"></td>
    </tr>
  </table>
  <table width="990" border="0" cellpadding="0" cellspacing="0">
    <tr> 
      <td width="10" height="10"><img src="../../images/design-a/border-c.gif" width="10" height="10"></td>
      <td height="10" background="../../images/design-a/border-bottom.gif" bgcolor="#FFFFFF"><img src="../../images/blank.gif" width="1" height="1"></td>
      <td width="10" height="10"><img src="../../images/design-a/border-d.gif" width="10" height="10"></td>
    </tr>
  </table>
  <table width="970" height="22" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr> 
      <td align="left"><font color="#333333">Jigsaw Office Engine &amp; Modules. 
        Copyrights 2008. All rights reserved.</font></td>
      <td align="right"><font color="#333333">Powered by </font><strong><a href="http://www.net-com.co.th"><font color="#333333">Net-Com</font></a></strong></td>
    </tr>
  </table>
</div>
</body>
<!-- InstanceEnd --></html>
<? 
include("../lib/disconnect.php");
?>

Hacked By AnonymousFox1.0, Coded By AnonymousFox