Hacked By AnonymousFox

Current Path : C:/AppServ/www/new_msd/webengine/mod_about/
Upload File :
Current File : C:/AppServ/www/new_msd/webengine/mod_about/index_.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>
<!-- InstanceBeginEditable name="doctitle" -->
<title>Web Engine : 
<?=$System_Variable_Title?>
</title>
<!-- InstanceEndEditable --> 
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable --> 
<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];}
}
//-->
</script>
<link href="../css/mystyle.css" rel="stylesheet" type="text/css">  
</head> 
<body bgcolor="#E9E6DF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('../../images/thai.gif','../../images/eng.gif','../../images/chaina.gif','../../images/object/topbar-thai-over.gif','../../images/object/topbar-english-over.gif','../images/bullet/lang_over_02_1.gif','../images/bullet/lang_over_01_1.gif','../images/bullet/lang_over_03.gif')">

<table width="95%" height="26" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td width="1" bgcolor="#A13626"><img src="../../images/blank.gif" width="1" height="1"></td>
    <td background="../../images/main/main-t-bg.gif" bgcolor="#831B0E"><table width="100%" height="26" border="0" cellpadding="0" cellspacing="0">
          <tr> 
            <td width="867" valign="top"><img src="../../images/main/logo.gif" width="273" height="70" alt="กระทรวงศึกษาธิการ" />&nbsp;</td>
            <td width="115" align="right" valign="top"><a href="../system/setlanguage.php?setlang=Thai&&action=setlanguage" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('TopBarTh','','../images/bullet/lang_over_04.gif',1)"><? if($System_Session_Language=="Thai"){$Use = "_over";} else { $Use = "_nor";}?><img src="../images/bullet/lang<?=$Use?>_04.gif" alt="Thai Language" name="TopBarTh" border="0"></a><a href="../system/setlanguage.php?setlang=Eng&&action=setlanguage" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('TopBarEn','','../images/bullet/lang_over_03.gif',1)"><? if($System_Session_Language=="Eng"){$Use = "_over";} else { $Use = "_nor";}?>
                <img src="../images/bullet/lang<?=$Use?>_03.gif" alt="English Language" name="TopBarEn"border="0"></a> </td>
          </tr>
    </table></td><td width="1" bgcolor="#A13626"><img src="../../images/blank.gif" width="1" height="1"></td>
  </tr>
</table>
<table width="95%" height="6" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr> 
    <td width="1" bgcolor="#A13626"><img src="../../images/blank.gif" width="1" height="1"></td>
    <td width="587" bgcolor="#A13626"><img src="../../images/blank.gif" width="1" height="1"></td>
    <td width="1" bgcolor="#A13626"><img src="../../images/blank.gif" width="1" height="1"></td>
  </tr>
</table>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr> 
    <td width="1" bgcolor="#A13626"><img src="../../images/blank.gif" width="1" height="1"></td>
    <td align="center" valign="top"><table width="100%" height="480" border="0" cellpadding="0" cellspacing="0">
        <tr> 
          <td width="215" align="center" valign="top" bgcolor="#9C9994" style="background-repeat:repeat-x; "><br>
            <!--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="97%" height="18" border="0" cellpadding="0" cellspacing="0">
              <tr> 
                <td width="8"><img src="../../images/blank.gif" width="1" height="1"></td>
                <td ><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="97%" border="0" cellpadding="0" cellspacing="0" bgcolor="#DFDFDF">
              <tr> 
                <td width="6" height="6"><img src="../../images/object/dot-border-1.gif" width="6" height="6"></td>
                <td height="6" background="../../images/object/dot-border-2.gif"><img src="../../images/blank.gif" width="1" height="1"></td>
                <td width="6" height="6"><img src="../../images/object/dot-border-3.gif" width="6" height="6"></td>
              </tr>
              <tr> 
                <td width="6" background="../../images/object/dot-border-4.gif"><img src="../../images/blank.gif" width="1" height="1"></td>
                <td align="center" valign="top">
<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="#990000"><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="#990000"><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_60" value="LogIn"></td>
                            </tr>
                          </table>
                        </form></td>
                    </tr>
                  </table></td>
                <td width="6" background="../../images/object/dot-border-5.gif"><img src="../../images/blank.gif" width="1" height="1"></td>
              </tr>
              <tr> 
                <td width="6" height="6"><img src="../../images/object/dot-border-6.gif" width="6" height="6"></td>
                <td height="6" background="../../images/object/dot-border-7.gif"><img src="../../images/blank.gif" width="1" height="1"></td>
                <td width="6" height="6"><img src="../../images/object/dot-border-8.gif" width="6" height="6"></td>
              </tr>
            </table>
            <br>
            <? } else { ?>
            <? if($SystemMenuID=="") { $SystemMenuID=-1; } ?>
            <table width="205" height="21" border="0" align="center" cellpadding="0" cellspacing="0" background="../images/bg-search.gif" style="background-repeat:repeat-x; ">
              <tr>
                <td width="5%" >&nbsp;</td> 
                <td width="95%" height="43" ><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="205" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr> 
                <td bgcolor="#F3F3F3"><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
                    <form action="../../Templates/" 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="1" class="menu_table_bg_normal" onMouseOver="this.className='menu_table_bg_over'; " onMouseOut="this.className='menu_table_bg_normal'; " onClick="document.myMenuForm.action='../home/index.php'; document.myMenuForm.submit();">
					  <table width="100%" height="24" border="0" cellpadding="2" cellspacing="0" class="menu_table_text">
        <tr>
          <td width="22" align="center"><img src="../images/icon/ico516.gif" width="16" height="14"></td>
          <td>Home</td>
        </tr>
    </table></td>
                    </tr>
                    <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="25" 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>
                    <? } ?>
                    <!---------------------------------------------------------------------------->
                    <? 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="25" 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>
                    <? } ?>
                    <!---------------------------------------------------------------------------->
                    <? 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='../mod_dmenu/index.php'; 
document.myMenuForm.SystemMenuID.value=-2;
document.myMenuForm.submit();
"><table width="100%" height="25" 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>
                    <? } ?>
                    <? 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="25" 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"]) { ?>
                              <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/arrow1.gif" width="13" height="10"></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_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="left" class="menu_table_bg_sub" > 
                        <table width="100%"  border="0" cellspacing="0" cellpadding="0">
<tr height="8" >
                            <td height="8" background="../images/rare1.gif" bgcolor="#EACFD3" style="background-position:top; background-repeat:repeat-x; "><img src="../images/spacer.gif" width="24" height="8" /></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;
			$myMenuPermission = getUserPermissionOnMenu($myUserID,$myMenuID);
			if( strlen($myMenuPermission)>0 && $myMenuPermission!="NA") {

				?>
                        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="menu_table_bg_sub" onMouseOver="this.className='menu_table_bg_oversub'; " onMouseOut="this.className='menu_table_bg_sub'; " >
                          <tr> 
                            <td width="4">&nbsp;</td>
                            <td width="171" align="left"><table width="100%" height="25" border="0" cellpadding="1" cellspacing="0"  
 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="left"><? if($Row1[$System_TableName_Menu."_Icon"]==""){ ?>-<? }else{ ?><img src="<?=$Row1[$System_TableName_Menu."_Icon"]?>"><? }?></td>
                                  <td align="left"> 
                                    <? if($SystemMenuID==$Row1[$System_TableName_Menu."_ID"]) { ?>
                                    <b><font color="#990000"> 
                                    <?=$Row1[$System_TableName_Menu."_Name".$System_Session_Language]?>
                                    </font></b> 
                                    <? } else { ?>
							  <font color="#6666AA"><?=$Row1[$System_TableName_Menu."_Name".$System_Session_Language]?></font>
                                    <? } ?>                                  </td>
                                </tr>
                            </table></td>
                          </tr>
                          <tr align="left">
                            <td colspan="2"><img src="../images/line3.gif" width="195"></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="25" 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>
            </table></td>
              </tr>
            </table>
            
            <table width="205" height="30" border="0" align="center" cellpadding="0" cellspacing="0" background="../images/bg-search2.gif">
              <tr>
                <td>&nbsp;</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 ----------------------------------------------------------------------------------->          </td>
          <td align="center" valign="top" bgcolor="#E9E6DF"> 
            <table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="16" valign="top" bgcolor="#C4BDB1">&nbsp;</td>
        <td align="center" valign="top" bgcolor="#C4BDB1">&nbsp;</td>
        <td valign="top" bgcolor="#C4BDB1">&nbsp;</td>
      </tr>
      <tr>
        <td width="20" valign="top" background="../images/object/border_03.gif"><img src="../images/object/border_16.gif" width="20" height="83"></td>
        <td align="center" valign="top" bgcolor="#FFFFFF">
		   <? if(strlen($System_Session_User_ID)>0) { ?>
            <!-- InstanceBeginEditable name="Programmable Region" --> 
            <br>
            <table width="98%" height="22" border="0" cellpadding="2" cellspacing="0" class="table_header">
              <tr> 
                <td width="30" align="center"><img src="<?=getMenuIcon($SystemMenuID)?>"></td>
                <td> <?=getMenuName($SystemMenuID)?></td>
              </tr>
            </table>
            <table width="97%" 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="?" 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>
			<br>
            <script language="JavaScript" src="../lib/popup.js" type="text/JavaScript"></script>
                     
            <? 
## Load Module Configuration Variable ############################################
include("config.php");

## Default Value ############################################
$SystemModule_defaultPageSize = 10;
$SystemModule_defaultPageShow = 1;
$SystemModule_MaxPage = 20;
$SystemModule_ReduceRange = 10; 		// +,- from current page show
$ASCDESC = "ASC";
$SystemModule_OrderBy = $myModule_Table."_ID";

#########################################################
?>
            <? 
#########################################################
if ($action=="addnew") {

	if ($PageShow=="") $PageShow = 0;
	
	// move page after
	$CurrentOrdering = 0;
	$sql = "SELECT * FROM ".$myModule_Table." WHERE ".$myModule_Table."_ID=".$PageShow." AND ".$myModule_Table." _Language='$System_Session_Language'";
	$Query = mysql_query($sql);
	if (mysql_num_rows($Query)>0) {
		$Row = mysql_fetch_array($Query);
		$CurrentOrdering = $Row[$myModule_Table."_Order"];
		
	}
	$sql = "SELECT * FROM ".$myModule_Table." WHERE ".$myModule_Table."_ModuleKey='".$SystemModuleKey.
	"' AND ".$myModule_Table."_Order>".$CurrentOrdering." ORDER BY ".$myModule_Table."_Order ".$ASCDESC."";
	$Query = mysql_query($sql);
	if (mysql_num_rows($Query)>0) {
		$Ordering = $CurrentOrdering +1;
		while ($Row = mysql_fetch_array($Query)) {
			$Ordering++;
			$sql = "UPDATE ".$myModule_Table." SET ".$myModule_Table."_Order=".$Ordering." WHERE ".$myModule_Table."_ID=".$Row[$myModule_Table."_ID"];
			$Query1 = mysql_query($sql);
		}
	}
	
	$NextOrdering = $CurrentOrdering +1;
	/*
	$NextOrdering = 0;
	$sql = "SELECT MAX(".$myModule_Table."_Ordering) FROM ".$myModule_Table." WHERE ".$myModule_Table."_ModuleKey=".$SystemMenuID;
	$Query = mysql_query($sql);
	if (mysql_num_rows($Query)>0) {
		$Row = mysql_fetch_row($Query);
		$NextOrdering = $Row[0];
	}
	$NextOrdering++;
	*/

	$sql = "INSERT INTO ".$myModule_Table."(".
	$myModule_Table."_ModuleKey,".
	$myModule_Table."_Order,".
	$myModule_Table."_CreateByID,".
	$myModule_Table."_CreateBy,".
	$myModule_Table."_CreateDate,".
	$myModule_Table."_Language,".
	$myModule_Table."_Status,".
	$myModule_Table."_LastUpdate".
	") VALUES('".$SystemModuleKey."',".$NextOrdering.",$System_Session_User_ID,'$System_Session_UserName',NOW(),'$System_Session_Language','".Enable."',NOW())";
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) or die(mysql_error());
	$MaxID = mysql_insert_id();

	srand(make_seed());
	$myrand = rand(1111,9999);
	if(!is_dir($System_RelativePath_Upload."/".$SystemModuleKey)) { mkdir($System_RelativePath_Upload."/".$SystemModuleKey,0777); }
	if(!is_dir($myModule_Path_HTMLFiles)) { mkdir($myModule_Path_HTMLFiles,0777); }
	if(!is_dir($myModule_Path_ImageLibrary)) { mkdir($myModule_Path_ImageLibrary,0777); }
	/* Check to create module data directory. ---------
	chmod("../../".$System_Path_Relative_Upload,0777);
	if(!is_dir("../../".$System_Path_Relative_Upload."/".$SystemModuleKey)) { mkdir("../../".$System_Path_Relative_Upload."/".$SystemModuleKey,0777); }
	if(!is_dir($myModule_Path_HTMLFiles)) { mkdir($myModule_Path_HTMLFiles,0777); }
	if(!is_dir($myModule_Path_ImageLibrary)) { mkdir($myModule_Path_ImageLibrary,0777); }
	/ ------------------------------------------------*/
		if(!is_dir($myModule_Path_HTMLFiles)) { mkdir($myModule_Path_HTMLFiles,0777); }
		if(!is_dir($myModule_Path_ImageLibrary)) { mkdir($myModule_Path_ImageLibrary,0777); }
		if(!is_dir($myModule_Path_FileUpload)) { mkdir($myModule_Path_FileUpload,0777); }


	$HTMLFileName = "$MaxID-$myrand.html";
	$HTMLToolContent=stripslashes($HTMLToolContent);
	$fp = fopen ($myModule_Path_HTMLFiles."/".$HTMLFileName, "w+");
	fwrite($fp,$HTMLToolContent);
	fclose($fp);

	$sql = "UPDATE ".$myModule_Table." SET ".$myModule_Table."_HTMLFileName='$HTMLFileName' WHERE ".$myModule_Table."_ID=".$MaxID;
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) or die(mysql_error());


// ------------------------------------------------
		for($i=0; $i<=count($inputFile); $i++){
					srand(make_seed());
					$myrand = rand(1111,9999);
		
					$LastFileArray=explode(".",$inputFile_name[$i]);
					$LastFile=$LastFileArray[count($LastFileArray)-1];
					$StrFileName=$MaxID."_".$myrand.".".$LastFile;
					
					if($inputFile[$i]!=""){
					if(file_exists($myModule_Path_FileUpload."/".$StrFileName)) {
							unlink($myModule_Path_FileUpload."/".$StrFileName);
					}
					if(copy($inputFile[$i],$myModule_Path_FileUpload."/".$StrFileName)) {
							chmod($myModule_Path_FileUpload."/".$StrFileName,0777);
					}
				$sql = " INSERT INTO ".$myModule_Table_FileUpload."(".$myModule_Table_FileUpload."_NewsID ,".$myModule_Table_FileUpload."_FileUpload , ".$myModule_Table_FileUpload."_UploadFileName)".
				" VALUES ($MaxID,'$StrFileName','$LastFileArray[0]') ";
				$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error : เกิดความผิดพลาด <br>$sql<br>\n");
						
					}
		}//end for
		
		$inputSubject=$SystemModuleKey.$NextOrdering;
		// Send to Content Approve System
		$ViewPath = "http://".$HTTP_HOST.$PHP_SELF."?SystemModuleKey=".$SystemModuleKey."&SystemMenuID=".$SystemMenuID."&action=view&myCheckBoxID=".$MaxID;
		$QueryUpdate = "UPDATE ".$myModule_Table." SET ".$myModule_Table."_Status=\'[mystatus]\' WHERE ".$myModule_Table."_ID=".$MaxID;
		// Search All Site 
if($_SESSION[System_Session_Language]=="Thai"){
$Lang="th";
}elseif($_SESSION[System_Session_Language]=="Eng"){
$Lang="en";
}
include ("config.php");
$insert[$myModule_SearchAllSite."_RecordID"] = "'".$MaxID."'";
	$insert[$myModule_SearchAllSite."_ModuleKey"] = "'".$SystemModuleKey."'";
	$insert[$myModule_SearchAllSite."_Language"] = "'".$_SESSION[System_Session_Language]."'";
	$insert[$myModule_SearchAllSite."_Content"] = "'".strip_tags($inputSubject)." , ".strip_tags($inputTitle)." , ".strip_tags($HTMLToolContent)."'";
	$insert[$myModule_SearchAllSite."_Path"] = "'".$myModule_Path_Search."'";
	$insert[$myModule_SearchAllSite."_Status"] = "'Enable'";
	$sql2 = "INSERT INTO ".$myModule_SearchAllSite."(".implode(",",array_keys($insert)).") VALUES (".implode(",",array_values($insert)).")";
	$Query2 = mysql_query($sql2);
	
	?>
	        <form action="?" method="post" name="myForm" id="myForm">
	          <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
	          <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
	          <input name="action" type="hidden" id="action">
	          <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>">
	          <input name="PageShow" type="hidden" id="PageShow" value="<?=$MaxID?>">
	          <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=="add") { 
	$HTMLToolContentBG = "#FFFFFF";
?>
            <? include("htmltool/header.php"); ?>
            <table width="650" border="0" cellpadding="0" cellspacing="1" class="table_border">
              <form action="?" method="post" name="myReturnForm" id="myReturnForm">
                <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                <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="<?=$CheckBoxID1?>">
                <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" enctype="multipart/form-data" name="myForm" id="myForm">
                <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                <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="<?=$CheckBoxID1?>">
                <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">
                      <tr>
                        <td height="24" align="center" class="table_header">Add&nbsp;                          <?=getMenuName($SystemMenuID)?>
                        </td>
                      </tr>
                      <tr>
                        <td height="26" class="table_col3">&nbsp;&nbsp;<img src="../images/bullet/box21.gif" width="11" height="11">&nbsp;Content</td>
                      </tr>
                      <tr align="center" valign="top">
                        <td height="350" class="table_col2"><table width="100%" height="500" border="0" align="center" cellpadding=1 cellspacing=1  bordercolorlight="#000000" bordercolordark="#E0E0E0" bgcolor="#AAAAAA" class="table_border" id="htmltool_table">
                            <tr>
                              <td height="50" align="center" class="table_col3">
                                <? include("htmltool/toolbar.php"); ?>
                              </td>
                            </tr>
                            <tr>
                              <td align="center" class="table_col2">
                                <? include("htmltool/textarea.php"); ?>
                              </td>
                            </tr>
                          </table>
                          <script language="JavaScript" type="text/JavaScript">
fnInit(idContent);
              </script></td>
                      </tr>
                      <tr align="left" valign="top">
                        <td class="table_col2">&nbsp;</td>
                      </tr>
                      <tr align="left" valign="top">
                        <td class="table_col3"><img src="../images/bullet/box21.gif" width="11" height="11"> &nbsp;Document File </td>
                      </tr>
                      <tr align="left" valign="top">
                        <td class="table_col2"><table border="0" align="center" cellpadding="2" cellspacing="0" id="contentTable">
                            <tr>
                              <td><input name="inputFile[]" type="file" class="input_left" id="inputFile" size="35"></td>
                              <td align="center"><img src="../system/images/bullet/minus_disable.gif" width="11" height="11"></td>
                            </tr>
                            <tr>
                              <td align="right">&nbsp;</td>
                              <td align="center"><img src="../system/images/bullet/ico481.gif" width="16" height="10" onMouseOver="this.style.cursor='hand'" onClick="insertRow('contentTable')" alt="add"></td>
                            </tr>
                          </table>
						  <script language="JavaScript" type="text/JavaScript">
function insertRow(tableName) {
	var myObj=document.getElementById(tableName);
	var myNumRow = myObj.rows.length;
	var myNumCol = myObj.rows[0].cells.length;
	myObj.insertRow(myNumRow-1);
	for(i=0;i<myNumCol;i++) {
		myObj.rows[myNumRow-1].insertCell();
	}
	myObj.rows[myNumRow-1].cells[0].innerHTML = '<input name="inputFile[]" type="file" class="input_left" id="inputFile" size="35">';
	myObj.rows[myNumRow-1].cells[1].align  = "center";
	myObj.rows[myNumRow-1].cells[1].innerHTML = '<img src="../system/images/bullet/minus.gif" width="11" height="11" onMouseOver="this.style.cursor=\'hand\'" onClick="deleteRow(\'ContentTable\','+(myNumRow-1)+')">';

	formatTable(tableName);
}

function deleteRow(tableName,myRowDelete) {
	var myObj=document.getElementById(tableName);
	myObj.deleteRow(myRowDelete);
	formatTable(tableName);
}

function formatTable(tableName) {
	var myObj=document.getElementById(tableName);
	var myNumRow = myObj.rows.length;
	var myNumCol = myObj.rows[0].cells.length;
	if(myNumRow>2) {
		for(i=0;i<myNumRow-1;i++) {
			myObj.rows[i].cells[1].innerHTML = '<img src="../system/images/bullet/minus.gif" width="11" height="11" onMouseOver="this.style.cursor=\'hand\'" onClick="deleteRow(\'contentTable\','+i+')" alt="delete">';
		}
	} else {
		myObj.rows[0].cells[1].innerHTML = '<img src="../system/images/bullet/minus_disable.gif" width="11" height="11">';
	}
}

function funcMultipleAddNew(myListObj,myText) {
	if(myText!='') myListObj.options[myListObj.options.length] = new Option(myText,myText,0,false);
}
						  </script>
						  <span class="mytable_col2">
						  <script language="JavaScript" type="text/JavaScript">
restoreContentData();

function restoreContentData() {
//alert($inputFile[0]);
	<?
	for ($index=0;$index<count($inputFile)-1;$index++) {
		echo "insertRow('contentTable');";
	}
	
	for ($index=0;$index<count($inputFile);$index++) {
		$array_visible = "";
		if (count($inputFile)>1) $array_visible = "[".$index."]";
		echo "document.myForm.inputFile".$array_visible.".value = '".$inputFile[$index]."';";
	}
	?>
}

function insertRow(tableName) {
	var myObj=document.getElementById(tableName);
	var myNumRow = myObj.rows.length;
	var myNumCol = myObj.rows[0].cells.length;
	myObj.insertRow(myNumRow-1);
	for(i=0;i<myNumCol;i++) {
		myObj.rows[myNumRow-1].insertCell();
	}
	myObj.rows[myNumRow-1].cells[0].innerHTML = '<input name="inputFile[]" type="file" class="input_left" id="inputFile" size="35">';
	myObj.rows[myNumRow-1].cells[1].align  = "center";
	myObj.rows[myNumRow-1].cells[1].innerHTML = '<img src="../system/images/bullet/minus.gif" width="11" height="11" onMouseOver="this.style.cursor=\'hand\'" onClick="deleteRow(\'ContentTable\','+(myNumRow-1)+')">';

	formatTable(tableName);
}

function deleteRow(tableName,myRowDelete) {
	var myObj=document.getElementById(tableName);
	myObj.deleteRow(myRowDelete);
	formatTable(tableName);
}

function formatTable(tableName) {
	var myObj=document.getElementById(tableName);
	var myNumRow = myObj.rows.length;
	var myNumCol = myObj.rows[0].cells.length;
	if(myNumRow>2) {
		for(i=0;i<myNumRow-1;i++) {
			myObj.rows[i].cells[1].innerHTML = '<img src="../system/images/bullet/minus.gif" width="11" height="11" onMouseOver="this.style.cursor=\'hand\'" onClick="deleteRow(\'contentTable\','+i+')" alt="delete">';
		}
	} else {
		myObj.rows[0].cells[1].innerHTML = '<img src="../system/images/bullet/minus_disable.gif" width="11" height="11">';
	}
}

function AddList(fromList,toList) {
				var array_insert_value = new Array();
				var array_insert_name = new Array();
				var mysize = 0;
				for (i=0;i<fromList.options.length;i++) {
					if (fromList.options[i].selected) {
						found = false;
						for (j=0;j<toList.options.length;j++) {
							if (toList.options[j].value==fromList.options[i].value) found = true;
						}
						if (!found) {
							array_insert_name[mysize] = fromList.options[i].text;
							array_insert_value[mysize] = fromList.options[i].value;
							mysize++;
						}
					}
				}
				for (i=0;i<array_insert_value.length;i++) toList.options[toList.options.length] = new Option(array_insert_name[i],array_insert_value[i]);
			}
			function funcMultipleRemoveOnly(myListObj) {
				var Len = myListObj.options.length;
				
				if(Len>0) {
					for(var i=0;i<Len;i++) {
						if (myListObj.options[i]!=null && myListObj.options[i].selected) {
							myListObj.options[i--] = null;
							
						}
					}
				}
			}
									  </script></td>
                      </tr>
                      <tr align="left" valign="top">
                        <td align="right" class="table_col2">&nbsp;</td>
                      </tr>
                      <tr align="left" valign="top">
                        <td align="right" class="table_col2">กดปุ่ม <span class="text_hilight">Shift+Enter</span> เมื่อต้องการขึ้นบรรทัดใหม่</td>
                      </tr>
                    </table>
                    <table width="100%" height="24" border="0" cellpadding="3" cellspacing="0">
                      <tr align="right">
                        <td height="30" 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="btAdd3" value="Save" onClick="
								fnSave();
								document.myForm.submit();
								">
                              </td>
                              <td>
                                <input name="btCalcel" type="button" class="button_80" id="btCalcel3" value="Cancel" onClick="document.myReturnForm.submit()">
                              </td>
                            </tr>
                        </table></td>
                      </tr>
                  </table></td>
                </tr>
              </form>
            </table>
            <? 
#########################################################
} else if ($action=="edit") { 
	$myCheckBoxID = $CheckBoxID1;
	$sql="SELECT * FROM ".$myModule_Table." WHERE ".$myModule_Table."_ModuleKey='".$SystemModuleKey."' AND ".$myModule_Table."_ID=".$myCheckBoxID;
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) or die(mysql_error());
	$Row=MYSQL_FETCH_ARRAY($Query);
	$HTMLsrc = $myModule_Path_HTMLFiles."/".$Row[$myModule_Table."_HTMLFileName"];
	$HTMLToolContentBG = $Row[$myModule_Table."_BackgroudColor"];
?>
            <? include("htmltool/header.php"); ?>
            
            <table width="700" border="0" cellpadding="0" cellspacing="1" class="table_border">
              <form action="?" method="post" name="myReturnForm" id="myReturnForm">
                <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                <input name="action" type="hidden" id="action">
                <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>">
                <input name="PageShow" type="hidden" id="PageShow" value="<?=$CheckBoxID1?>">
                <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" enctype="multipart/form-data" name="myForm" id="myForm">
                <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                <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 type="hidden" id="PID" name="PID" value="">
				<input type="hidden" id="NID" name="NID" value="">
				<input type="hidden" id="FileName" name="FileName" value="">

                <tr>
                  <td bgcolor="#FFFFFF">
                    <table width="100%" border="0" cellpadding="2" cellspacing="1">
                      <tr>
                        <td height="24" align="center" class="table_header">Edit 
                          <?=getMenuName($SystemMenuID)?>
                        </td>
                      </tr>
                      <tr>
                        <td height="26" class="table_col3">&nbsp;&nbsp;<img src="../images/bullet/box21.gif" width="11" height="11">&nbsp;Content</td>
                      </tr>
                      <tr align="center" valign="top">
                        <td height="350" class="table_col2"><table width="100%" height="500" border="0" align="center" cellpadding=1 cellspacing=1  bordercolorlight="#000000" bordercolordark="#E0E0E0" bgcolor="#AAAAAA" class="table_border" id="htmltool_table">
                            <tr>
                              <td height="50" align="center" class="table_col3">
                                <? include("htmltool/toolbar.php"); ?>
                              </td>
                            </tr>
                            <tr>
                              <td align="center" class="table_col2">
                                <? include("htmltool/textarea.php"); ?>
                              </td>
                            </tr>
                          </table>
                          <script language="JavaScript" type="text/JavaScript">
fnInit(idContent);
              </script></td>
                      </tr>
                      <tr align="right" valign="top">
                        <td align="left" class="table_col3"><img src="../images/bullet/box21.gif" width="11" height="11"> &nbsp;Document File </td>
                      </tr>
                      <tr align="right" valign="top">
                        <td class="table_col2"><table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="2">
            <tr>
              <td width="50%"><input name="inputTypeFile" type="radio" id="inputTypeFile1" onClick="document.getElementById('File1').style.display='';document.getElementById('File2').style.display='none';" value="insert" checked>
            <label for="inputTypeFile1" style="cursor:pointer;">เพิ่มไฟล์ ใหม่</label></td>
              </tr>
            <tr>
              <td id="File1"><?
		$sqlFile = "SELECT * FROM ".$myModule_Table_FileUpload." WHERE ".$myModule_Table_FileUpload."_NewsID = '".$myCheckBoxID."'";
		$QueryFile=MYSQL_DB_QUERY($System_DataBase_Name,$sqlFile) or die(mysql_error());				
		while ($RowFile=MYSQL_FETCH_ARRAY($QueryFile)){
						$LinkRelativePath = $myModule_Path_FileUpload."/".$RowFile[$myModule_Table_FileUpload."_FileUpload"];
						$DownloadFile = $RowFile[$myModule_Table_FileUpload."_FileUpload"];
						$ImageType = strstr($DownloadFile,'.');
						if($ImageType==".pdf"){
							$TypeImgFile="../../images/bullet/pdf.gif";
						}elseif($ImageType==".txt"){
							$TypeImgFile="../../images/bullet/file.gif";
						}elseif($ImageType==".xls"){
							$TypeImgFile="../../images/bullet/excel.gif";
						}elseif($ImageType==".ppt"){
							$TypeImgFile="../../images/bullet/pp.gif";
						}elseif($ImageType==".rtf" || $ImageType==".doc"){
							$TypeImgFile="../../images/bullet/word.gif";
						}elseif($ImageType==".rar"){
							$TypeImgFile="../../images/bullet/rar.gif";
						}else{
							$TypeImgFile="../../images/bullet/application.gif";
						}
		?><a href="<?=$LinkRelativePath?>" target="_blank"><strong><br>
                &nbsp;<img src="<?=$TypeImgFile?>" border="0">&nbsp;
                <?=$RowFile[$myModule_Table_FileUpload."_UploadFileName"];?>
                </strong></a><a href="#" onclick="if(confirm('Are you sure to delete this picture?'))
						{
							document.myForm.FileName.value='<?=$RowFile[$myModule_Table_FileUpload."_FileUpload"]?>';
							document.myForm.PID.value='<?=$RowFile[$myModule_Table_FileUpload."_NewsID"]?>';
							document.myForm.NID.value='<?=$Row[$myModule_Table."_ID"]?>';
							document.myForm.action.value='deleteFile';
							document.myForm.submit();
						}
					"><img src="../images/icon/ico417.gif" border=0 alt="Delete"></a>&nbsp;&nbsp;
                <? }?><br>
                <table border="0" cellpadding="2" cellspacing="0" id="contentTable">
                  <tr>
                    <td><input name="inputFile[]" type="file" class="input_left" id="inputFile[]" size="35"></td>
                    <td align="center"><img src="../system/images/bullet/minus_disable.gif" width="11" height="11"></td>
                  </tr>
                  <tr>
                    <td align="right">&nbsp;</td>
                    <td align="center"><img src="../system/images/bullet/ico481.gif" width="16" height="10" onMouseOver="this.style.cursor='hand'" onClick="insertRow('contentTable')" alt="add"></td>
                  </tr>
                </table>
                <span class="mytable_col2">
                <script language="JavaScript" type="text/JavaScript">
restoreContentData();

function restoreContentData() {
//alert($inputFile[0]);
	<?
	for ($index=0;$index<count($inputFile)-1;$index++) {
		echo "insertRow('contentTable');";
	}
	
	for ($index=0;$index<count($inputFile);$index++) {
		$array_visible = "";
		if (count($inputFile)>1) $array_visible = "[".$index."]";
		echo "document.myForm.inputFile".$array_visible.".value = '".$inputFile[$index]."';";
	}
	?>
}

function insertRow(tableName) {
	var myObj=document.getElementById(tableName);
	var myNumRow = myObj.rows.length;
	var myNumCol = myObj.rows[0].cells.length;
	myObj.insertRow(myNumRow-1);
	for(i=0;i<myNumCol;i++) {
		myObj.rows[myNumRow-1].insertCell();
	}
	myObj.rows[myNumRow-1].cells[0].innerHTML = '<input name="inputFile[]" type="file" class="input_left" id="inputFile" size="35">';
	myObj.rows[myNumRow-1].cells[1].align  = "center";
	myObj.rows[myNumRow-1].cells[1].innerHTML = '<img src="../system/images/bullet/minus.gif" width="11" height="11" onMouseOver="this.style.cursor=\'hand\'" onClick="deleteRow(\'ContentTable\','+(myNumRow-1)+')">';

	formatTable(tableName);
}

function deleteRow(tableName,myRowDelete) {
	var myObj=document.getElementById(tableName);
	myObj.deleteRow(myRowDelete);
	formatTable(tableName);
}

function formatTable(tableName) {
	var myObj=document.getElementById(tableName);
	var myNumRow = myObj.rows.length;
	var myNumCol = myObj.rows[0].cells.length;
	if(myNumRow>2) {
		for(i=0;i<myNumRow-1;i++) {
			myObj.rows[i].cells[1].innerHTML = '<img src="../system/images/bullet/minus.gif" width="11" height="11" onMouseOver="this.style.cursor=\'hand\'" onClick="deleteRow(\'contentTable\','+i+')" alt="delete">';
		}
	} else {
		myObj.rows[0].cells[1].innerHTML = '<img src="../system/images/bullet/minus_disable.gif" width="11" height="11">';
	}
}
function funcMultipleAddNew(myListObj,myText) {
	if(myText!='') myListObj.options[myListObj.options.length] = new Option(myText,myText,0,false);
}
						  </script>
                </span></td>
              </tr>
          </table></td>
                      </tr>
                      <tr align="right" valign="top">
                        <td class="table_col2">กดปุ่ม <span class="text_hilight">Shift+Enter</span> เมื่อต้องการขึ้นบรรทัดใหม่</td>
                      </tr>
                    </table>
                    <table width="100%" height="24" border="0" cellpadding="3" cellspacing="0">
                      <tr align="right">
                        <td height="30" 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="
								fnSave();
								document.myForm.submit();
								">
                              </td>
                              <td>
                                <input name="btCalcel" type="button" class="button_80" id="btCalcel3" value="Cancel" onClick="document.myReturnForm.submit()">
                              </td>
                            </tr>
                        </table></td>
                      </tr>
                  </table></td>
                </tr>
              </form>
            </table>
			<?
			} else if ($action=="deleteFile") { 
	$sql="SELECT * FROM ".$myModule_Table_FileUpload." WHERE ".$myModule_Table_FileUpload."_NewsID='".$PID."' AND ".$myModule_Table_FileUpload."_FileUpload='".$FileName."' ";
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	$RowFile=mysql_fetch_array($Query);
	if(file_exists($myModule_Path_FileUpload."/".$FileName)) {
					unlink($myModule_Path_FileUpload."/".$FileName);
		}
		$sql="DELETE  FROM ".$myModule_Table_FileUpload." WHERE ".$myModule_Table_FileUpload."_NewsID = '$PID' AND ".$myModule_Table_FileUpload."_FileUpload='".$FileName."' ";
		$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
?>
            <form action="?" method="post" name="myForm" id="myForm">
                
              <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
              <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
              <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=="update") { 

		$MaxID = $CheckBoxID1;

		srand(make_seed());
		$myrand = rand(1111,9999);
		if(!is_dir($System_RelativePath_Upload."/".$SystemModuleKey)) { mkdir($System_RelativePath_Upload."/".$SystemModuleKey,0777); }
		if(!is_dir($myModule_Path_HTMLFiles)) { mkdir($myModule_Path_HTMLFiles,0777); }
		if(!is_dir($myModule_Path_ImageLibrary)) { mkdir($myModule_Path_ImageLibrary,0777); }

		/* Check to create module data directory. ---------
		chmod("../../".$System_Path_Relative_Upload,0777);
		if(!is_dir("../../".$System_Path_Relative_Upload."/".$SystemModuleKey)) { mkdir("../../".$System_Path_Relative_Upload."/".$SystemModuleKey,0777); }
		if(!is_dir($myModule_Path_HTMLFiles)) { mkdir($myModule_Path_HTMLFiles,0777); }
		if(!is_dir($myModule_Path_ImageLibrary)) { mkdir($myModule_Path_ImageLibrary,0777); }  */
		// ------------------------------------------------

		$sql = "SELECT * FROM ".$myModule_Table." WHERE ".$myModule_Table."_ID=".$MaxID;
		$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) or die(mysql_error());
		$Row=MYSQL_FETCH_ARRAY($Query);

		$inputSubject="Profile ".$Row[$myModule_Table."_Order"];

		$HTMLFileName = $Row[$myModule_Table."_HTMLFileName"];		
		if(file_exists($myModule_Path_HTMLFiles."/".$HTMLFileName)) {
			unlink($myModule_Path_HTMLFiles."/".$HTMLFileName);
		}
		$HTMLFileName = "$MaxID-$myrand.html";

		$HTMLToolContent=stripslashes($HTMLToolContent);
		$fp = fopen ($myModule_Path_HTMLFiles."/".$HTMLFileName, "w+");
		fwrite($fp,$HTMLToolContent);
		fclose($fp);

		$sql = "UPDATE ".$myModule_Table." SET ".
		$myModule_Table."_HTMLFileName='$HTMLFileName', ".
		$myModule_Table."_CreateByID=$System_Session_User_ID,".
		$myModule_Table."_CreateBy='$System_Session_UserName' ,".
		$myModule_Table."_Status='".Enable."',".
		$myModule_Table."_LastUpdate=NOW()  WHERE ".$myModule_Table."_ID=".$MaxID;
		$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) or die(mysql_error());

				for($i=0; $i<=count($inputFile); $i++){
							srand(make_seed());
							$myrand = rand(1111,9999);
							$LastFileArray=explode(".",$inputFile_name[$i]);
							$LastFile=$LastFileArray[count($LastFileArray)-1];
							$StrFileName=$MaxID."_".$myrand.".".$LastFile;
							
							if($inputFile[$i]!=""){
								if(file_exists($myModule_Path_FileUpload."/".$StrFileName)) {
									unlink($myModule_Path_FileUpload."/".$StrFileName);
							}
							if(copy($inputFile[$i],$myModule_Path_FileUpload."/".$StrFileName)) {
									chmod($myModule_Path_FileUpload."/".$StrFileName,0777);
							}
									
									$sql =  " INSERT INTO ".$myModule_Table_FileUpload."(".$myModule_Table_FileUpload."_NewsID ,".$myModule_Table_FileUpload."_FileUpload , ".$myModule_Table_FileUpload."_UploadFileName)".
				" VALUES ($MaxID,'$StrFileName','$LastFileArray[0]') ";
									//die($sql);
									$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error : เกิดความผิดพลาด <br>$sql<br>\n");
								
							}
				}//end for
//Search All Site
	$updateS[] = $myModule_SearchAllSite."_ModuleKey='".$SystemModuleKey."' ";
	$updateS[] = $myModule_SearchAllSite."_Content='".strip_tags($inputSubject)." , ".strip_tags($inputTitle)." , ".strip_tags($HTMLToolContent)."'";
	$sql="UPDATE ".$myModule_SearchAllSite." SET ".implode(" , " , $updateS)." WHERE ".$myModule_SearchAllSite."_RecordID='".$MaxID."'";
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Updated Error: <br>$sql<br>\n");
?>
            <form action="?" method="post" name="myForm" id="myForm">
                
              <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
              <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
              <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") { 

		$sql = "SELECT * FROM ".$myModule_Table." WHERE ".$myModule_Table."_ID=".$CheckBoxID1;
		$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) or die(mysql_error());
		$Row=MYSQL_FETCH_ARRAY($Query);

		$HTMLFileName = $Row[$myModule_Table."_HTMLFileName"];		
		if(file_exists($myModule_Path_HTMLFiles."/".$HTMLFileName)) {
			unlink($myModule_Path_HTMLFiles."/".$HTMLFileName);
		}

		$sql = "DELETE FROM ".$myModule_Table." WHERE ".$myModule_Table."_ID=".$CheckBoxID1;
		$Query = mysql_query($sql);
		//Search All Site
			$sql = "DELETE FROM ".$myModule_SearchAllSite." WHERE ".$myModule_SearchAllSite."_ModuleKey='".$SystemModuleKey."' AND ".$myModule_SearchAllSite."_RecordID='".$CheckBoxID1."'";
			$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	
	// Delete attach file
	$sql = "SELECT * FROM ".$myModule_Table_FileUpload." WHERE ".$myModule_Table_FileUpload."_NewsID = ".$CheckBoxID1;
		$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error : เกิดความผิดพลาด <br>$sql<br>\n");
		while($RowUnlink=MYSQL_FETCH_ARRAY($Query)){
				unlink($myModule_Path_FileUpload."/".$RowUnlink[$myModule_Table_FileUpload."_FileUpload"]);
		}
		$sql="DELETE FROM ".$myModule_Table_FileUpload." WHERE ".$myModule_Table_FileUpload."_NewsID=".$CheckBoxID1;
		$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error : เกิดความผิดพลาด <br>$sql<br>\n");
?>
            <form action="?" method="post" name="myForm" id="myForm">
              <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
              <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
              <input name="action" type="hidden" id="action">
              <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>">
              <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=="updateordering") { 

	for($i=0;$i<count($inputProfileID);$i++) {
		$sql="UPDATE ".$myModule_Table." SET ".
		$myModule_Table."_Order=".($i+1).
		" WHERE ".$myModule_Table."_ID=".$inputProfileID[$i];
		$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) or die(mysql_error());
	}
?>
              
            <form action="?" method="post" name="myForm" id="myForm">
              <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
              <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
              <input name="action" type="hidden" id="action">
              <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>">
              <input name="PageShow" type="hidden" id="PageShow" value="0">
              <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=="makeorder") { 
	// Load Education Data
	$sql = "SELECT * FROM ".$myModule_Table." WHERE ".$myModule_Table."_ModuleKey='".$SystemModuleKey."' AND ".$myModule_Table."_Language='$System_Session_Language'  ".
	" ORDER BY ".$myModule_Table."_Order ".$ASCDESC."";
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) or die(mysql_error());
?>
            <br>
			<script language="JavaScript">
			function moveUp(myListObj) {
				var array_list_value = new Array();
				var array_list_text = new Array();
				myListObj = document.getElementById(myListObj);
				currentPos=-1;
				listNum=myListObj.options.length;
				if(listNum==0){
					 return false;
				} else {
						for (i=0;i<listNum;i++) {
							  if (myListObj.options[i].selected==true) currentPos=i;
							  array_list_value[i]=myListObj.options[i].value;
							  array_list_text[i]=myListObj.options[i].text;
						 }
						 if(currentPos!=-1&&currentPos!=(0)){
								temp_value=myListObj.options[currentPos-1].value;
								temp_text=myListObj.options[currentPos-1].text;
								array_list_value[currentPos-1]=myListObj.options[currentPos].value;
								array_list_text[currentPos-1]=myListObj.options[currentPos].text;
								array_list_value[currentPos]=temp_value;
								array_list_text[currentPos]=temp_text;
								for (i=listNum-1;i>=0;i--) myListObj.options[i]=null;
								for (i=0;i<listNum;i++) myListObj.options[myListObj.options.length] = new Option(array_list_text[i],array_list_value[i]);
								myListObj.options[currentPos-1].selected=true;
							} else {
								return false;
							}						
					}								
			}
			function moveDown(myListObj) {
				var array_list_value = new Array();
				var array_list_text = new Array();
				myListObj = document.getElementById(myListObj);
				currentPos=-1;
				listNum=myListObj.options.length;
				if(listNum==0){
					 return false;
				} else {
						for (i=0;i<listNum;i++) {
							  if (myListObj.options[i].selected==true) currentPos=i;
							  array_list_value[i]=myListObj.options[i].value;
							  array_list_text[i]=myListObj.options[i].text;
						 }
						 if(currentPos!=-1&&currentPos!=(listNum-1)){
									temp_value=myListObj.options[currentPos+1].value;
									temp_text=myListObj.options[currentPos+1].text;
									array_list_value[currentPos+1]=myListObj.options[currentPos].value;
									array_list_text[currentPos+1]=myListObj.options[currentPos].text;
									array_list_value[currentPos]=temp_value;
									array_list_text[currentPos]=temp_text;
									for (i=listNum-1;i>=0;i--) myListObj.options[i]=null;
									for (i=0;i<listNum;i++) myListObj.options[myListObj.options.length] = new Option(array_list_text[i],array_list_value[i]);
									myListObj.options[currentPos+1].selected=true;
							} else {
								return false;
							}
					}								
			}
			</script>
            <table width="400" border="0" cellpadding="0" cellspacing="1" class="table_border">
              <form action="?" method="post" name="myReturnForm" id="myReturnForm">
                <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                <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>
              <form action="?" method="post" name="myForm" id="myForm">
                <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                <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?>">
                <tr>
                  <td bgcolor="#FFFFFF">
                    <table width="100%" border="0" cellpadding="2" cellspacing="1">
                      <tr>
                        <td height="24" align="center" class="table_header">Manage Order Content</td>
                      </tr>
                      <tr>
                        <td height="250" align="center" class="table_col2">
                          <table border="0" cellpadding="0" cellspacing="1" class="mytable">
                            <tr>
                              <td height="22" class="mymainpage_headbar">
                                <table width="100%" height="22" border="0" cellpadding="0" cellspacing="0" class="table_col3">
                                  <tr>
                                    <td width="22" align="center"><img src="../images/icon/ico531.gif" width="16" height="14"></td>
                                    <td>Content List</td>
                                  </tr>
                              </table></td>
                            </tr>
                            <tr>
                              <td align="center" class="table_row1">
                                <table border="0" cellspacing="0" cellpadding="0">
                                  <tr>
                                    <td><select name="inputProfileID[]" size="15" multiple class="myform_myinput_textarea" id="inputProfileID" style="width:206">
									    <?
									$index = 0;
									while ($Row = mysql_fetch_array($Query)) {
										$index++;
										echo "<option value='".$Row[$myModule_Table."_ID"]."'>หน้าที่ ".$index."</option>";
									}
									?>
									</select></td>
                                    <td>
                                      <table height="100" border="0" cellpadding="0" cellspacing="0">
                                        <tr>
                                          <td><img src="../images/icon/ico623.gif" alt="เลื่อนขึ้น" width="16" height="11" onClick="moveUp('inputProfileID')" style="cursor:hand; "></td>
                                        </tr>
                                        <tr>
                                          <td><br>
                                              <img src="../images/icon/ico481.gif" alt="เลื่อนลง" width="16" height="10" onClick="moveDown('inputProfileID')" style="cursor:hand; "></td>
                                        </tr>
                                    </table></td>
                                  </tr>
                              </table></td>
                            </tr>
                            <tr>
                              <td height="6" class="table_footer"><img src="../system/images/blank.gif" width="1" height="1"></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 width="146"><input name="btnSave" type="button" class="button_80" id="btnSave" value="Save" onClick="
if(confirm('คุณต้องการบันทึกการเปลี่ยนแปลงนี้ ใช่หรือไม่?')) {
	// select all Education
	for (i=0;i<document.myForm.inputProfileID.options.length;i++) document.myForm.inputProfileID.options[i].selected=true;
	document.myForm.action.value='updateordering';
	document.myForm.submit();
}	
 ">
                              </td>
                              <td width="146"><input name="btCalcel2" type="button" class="button_80" id="btCalcel2" onClick="document.myReturnForm.submit()" value="Cancel"></td>
                            </tr>
                        </table></td>
                      </tr>
                  </table></td>
                </tr>
              </form>
            </table>
            <br>
            <? 
###########################################
} else if ($action=="setstatus") { 
	$myCheckBoxID=$CheckBoxID1;
	$sql="UPDATE ".$myModule_Table." SET ".$myModule_Table."_Status='$SelectStatus' WHERE ".$myModule_Table."_ID=".$myCheckBoxID;
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) or die(mysql_error());

	// Update Content Approve Status
	UpdateApproveStatus($SystemModuleKey,$myCheckBoxID,$SelectStatus);
	
?>
            <form action="?" method="post" name="myForm" id="myForm">
              <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
              <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
              <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=="view" || $action=="") {
	$sql = "SELECT * FROM ".$myModule_Table." WHERE ".$myModule_Table."_Language='$System_Session_Language'  ";
	$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");

	$sql = "SELECT * FROM ".$myModule_Table." WHERE ".$myModule_Table."_ModuleKey='".$SystemModuleKey."' AND ".$myModule_Table."_Language='$System_Session_Language'  ";
	
	if ($PageShow>0) $sql .= " AND ".$myModule_Table."_ID=".$PageShow;
	else $sql .= " ORDER BY ".$myModule_Table."_Order ".$ASCDESC."";
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) or die(mysql_error());
	if (mysql_num_rows($Query)>0) {
		$Row=MYSQL_FETCH_ARRAY($Query);
		$myCheckBoxID = $Row[$myModule_Table."_ID"];
	}
?>
                    <div id="divDataPicker" style="display:none; position:absolute; top:-115px; left:180px; width: 200px; z-index: 1;Filter:Alpha(opacity=95)"> 
                      <table width="100%" border="0" cellpadding="0" cellspacing="1" class="table_border">
                        <form action="?" method="post" name="myStatusForm" id="myStatusForm">
                          <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                          <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">
                                <? for ($i=1;$i<=$System_Approve_ContentStatus_Count;$i++) { ?>
								<? if (strstr($System_StaffLevel_StatusManage[$System_Session_Level],$System_Approve_ContentStatus_Value[$i])) { ?>
								<tr> 
                                  <td width="26" height="22" align="center"><input name="toolbarStatus" type="radio" class="form_checkbox" value="<?=$System_Approve_ContentStatus_Value[$i]?>"></td>
                                  <td height="22" class="text_bold"><font color="#<?=$System_Approve_ContentStatus_Color[$System_Approve_ContentStatus_Value[$i]]?>"><?=$System_Approve_ContentStatus_Name[$System_Approve_ContentStatus_Value[$i]]?></font></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.length>1) {
	for (var i=0;i<document.myStatusForm.toolbarStatus.length;i++) {
		if (document.myStatusForm.toolbarStatus[i].checked) {
			document.myForm.SelectStatus.value = document.myStatusForm.toolbarStatus[i].value;
		}
	}
} else {
	if (document.myStatusForm.toolbarStatus.checked) {
		document.myForm.SelectStatus.value = document.myStatusForm.toolbarStatus.value;
	}
}
document.myForm.action.value='setstatus';
document.myForm.action.value='setstatus';
document.myForm.CheckBoxID1.value='<?=$myCheckBoxID?>';
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>
<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>
            <table width="650" border="0" cellpadding="0" cellspacing="1" class="table_border">
              <form action="?" method="post" name="myForm" id="myForm">
                <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                <input name="action" type="hidden" id="action">
                <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>">
                <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="SelectStatus" type="hidden" id="SelectStatus">
                <input name="TotalCheckBoxID" type="hidden" id="TotalCheckBoxID" value="1">
                <tr>
                  <td bgcolor="#FFFFFF">
                    <table width="100%" border="0" cellpadding="2" cellspacing="1" >
                      <tr align="center">
                        <td width="100%" height="24" align="center" class="table_header">View  <?=getMenuName($SystemMenuID)?></td>
                      </tr>
                      <tr>
                        <td height="26" class="table_col3"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                            <tr>
                              <td width="50%" class="table_col3">&nbsp;&nbsp;<img src="../images/bullet/box21.gif" width="11" height="11">&nbsp;Content 
                                <?
							 $sql = "SELECT * FROM ".$myModule_Table." WHERE ".$myModule_Table."_ModuleKey='".$SystemModuleKey."' AND ".$myModule_Table."_Language='$System_Session_Language'  ".
							" ORDER BY ".$myModule_Table."_Order ".$ASCDESC."";
							$Query_Page = mysql_query($sql);
							if (mysql_num_rows($Query_Page)>1) {
								echo "Page ";
							?>
                              <select name="PageShow" class="select" onChange="document.myForm.submit()">
								  <?
								$page_index = 0;
								while ($Row_Page = mysql_fetch_array($Query_Page)) {
									$page_index++;
									echo "<option value='".$Row_Page[$myModule_Table."_ID"]."'>".$page_index."</option>";
								}
								?>
							</select>
							    <?
							}
							if ($PageShow>0 && mysql_num_rows($Query_Page)>1) echo "<script language='JavaScript'> document.myForm.PageShow.value='".$PageShow."'; </script>";
							?>
                              </td>
                              <td width="50%" align="right">
                                <? if (mysql_num_rows($Query_Page)>1) { ?>
									<? if($System_Session_Permission[$SystemMenuID]=="RW" ){ ?>	  							  
                                <input name="Sort" type="button" value="Sort Page" class="button_80" onClick="
							document.myForm.action.value = 'makeorder';
							document.myForm.submit();
							">
							<? }?>
                                <? } ?>
                              </td>
                            </tr>
                        </table></td>
                      </tr>
                    </table>
                    <table width="100%" height="100" border="0" cellpadding="2" cellspacing="0"  bgcolor="#FFFFFF">
                      <tr>
                        <td align="left" valign="top">
                          <?
if ($Row[$myModule_Table."_HTMLFileName"]<>"") {
	$filename = $myModule_Path_HTMLFiles."/".$Row[$myModule_Table."_HTMLFileName"];
	$fd = fopen ($filename, "r");
	$contents = fread ($fd, filesize ($filename));
	fclose ($fd);
	echo $contents;
}
						?>
                        </td>
                      </tr>
                    </table>
                    <table width="100%" border="0" cellpadding="2" cellspacing="1" >
                      <tr>
                        <td height="27" colspan="2" class="table_col2">&nbsp;</td>
                      </tr>
                      <tr>
                        <td height="27" colspan="2" class="table_col3"><img src="../images/bullet/box21.gif" width="11" height="11"> &nbsp;Document File </td>
                      </tr>
                      <tr>
                        <td height="27" colspan="2" class="table_col2"><?
		$sqlFile = "SELECT * FROM ".$myModule_Table_FileUpload." WHERE ".$myModule_Table_FileUpload."_NewsID = '".$myCheckBoxID."'";
	$QueryFile=MYSQL_DB_QUERY($System_DataBase_Name,$sqlFile) or die(mysql_error());				
		while ($RowFile=MYSQL_FETCH_ARRAY($QueryFile)){
						$LinkRelativePath = $myModule_Path_FileUpload."/".$RowFile[$myModule_Table_FileUpload."_FileUpload"];
						$DownloadFile = $RowFile[$myModule_Table_FileUpload."_FileUpload"];
						$ImageType = strstr($DownloadFile,'.');							
						if($ImageType==".pdf"){
							$TypeImgFile="../../images/bullet/pdf.gif";
						}elseif($ImageType==".txt"){
							$TypeImgFile="../../images/bullet/file.gif";
						}elseif($ImageType==".xls"){
							$TypeImgFile="../../images/bullet/excel.gif";
						}elseif($ImageType==".ppt"){
							$TypeImgFile="../../images/bullet/pp.gif";
						}elseif($ImageType==".rtf"){
							$TypeImgFile="../../images/bullet/word.gif";
						}elseif($ImageType==".rar"){
							$TypeImgFile="../../images/bullet/rar.gif";
						}else{
							$TypeImgFile="../../images/bullet/application.gif";
						}
		?><a href="<?=$LinkRelativePath?>" target="_blank"><strong>
                        &nbsp;<img src="<?=$TypeImgFile?>" border="0" alt="<?=$ImageType?>">&nbsp;<?=$RowFile[$myModule_Table_FileUpload."_UploadFileName"];?>
                        <br>
                        </strong></a>
		<? }?></td>
                      </tr>
                      <tr>
                        <td height="27" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../images/bullet/box21.gif" width="11" height="11">&nbsp;More Information</td>
                      </tr>
                      <tr>
                        <td width="19%" height="22" align="right" class="table_col1">Create Date&nbsp;</td>
                        <td width="81%" height="22" class="table_col2">
                          <?=$Row[$myModule_Table."_CreateDate"]?>
                        </td>
                      </tr>
                      <tr>
                        <td height="22" align="right" class="table_col1">Last Update&nbsp;</td>
                        <td height="22" class="table_col2">
                          <?=$Row[$myModule_Table."_LastUpdate"]?>
                        </td>
                      </tr>
                      <tr>
                        <td height="22" align="right" class="table_col1">Update By&nbsp;</td>
                        <td height="22" class="table_col2">
                          <?=$Row[$myModule_Table."_CreateBy"]?>
                        </td>
                      </tr>
                      <tr style="display:none; ">
                        <td height="22" align="right" class="table_col1">Status&nbsp;</td>
                        <td height="22" class="table_col2">
<? if($System_Session_Permission[$SystemMenuID]=="RW" ){ ?>
<? if ($System_StaffLevel_StatusManage[$System_Session_Level]<>"") { ?>
			<img src="../images/icon/ico442.gif" width="8" height="14">&nbsp; 
		    <font  color="#990000">
			<span onMouseOver="this.style.cursor='hand'" onClick="
if (document.myStatusForm.toolbarStatus.length>1) {
	var i = 0;
	while (i<(document.myStatusForm.toolbarStatus.length-1) && document.myStatusForm.toolbarStatus[i].value!='<?=$Row[$myModule_Table."_Status"]?>') i++;
	if (document.myStatusForm.toolbarStatus[i].value=='<?=$Row[$myModule_Table."_Status"]?>') {
		document.myStatusForm.toolbarStatus[i].checked = true;
	}
	StatusIndex = 1;
	ShowDataPicker('divDataPicker',-100,-150);
} else if (document.myStatusForm.toolbarStatus=='[object]') {
	if (document.myStatusForm.toolbarStatus.value=='<?=$Row[$myModule_Table."_Status"]?>') {
		document.myStatusForm.toolbarStatus.checked = true;
	}
	StatusIndex = 1;
	ShowDataPicker('divDataPicker',-100,-100);
}
			"> 
											  <?=$Row[$myModule_Table."_Status"]?>
						</span>
						</font>
<? }?><? }else{?>								
		  <?=$Row[$myModule_Table."_Status"]?>  
<? }?>
                        </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">
<? if($System_Session_Permission[$SystemMenuID]=="RW"){ ?>	  							  						
                          <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="
<?
if ($myCheckBoxID>0) echo "document.myForm.action.value='edit';";
else echo "document.myForm.action.value='add';";
?>
document.myForm.submit();
						">
                              </td>
                              <? if($myCheckBoxID>0){?>
							  <td>
                                <input name="btDelete" type="button" class="button_80" id="btDelete" value="Delete" onClick="
if (confirm('คุณต้องการลบเนื้อหาหน้านี้ ใช่หรือไม่?')) {
	document.myForm.action.value='delete';
	document.myForm.submit();
}
						">
                              </td>
                              <? }?>
							  <? if($myCheckBoxID>0){?>
							  <td>
                                <input name="btAdd" type="button" class="button_100" id="btAdd" value="Add Next Page" onClick="
document.myForm.action.value='add';
document.myForm.submit();
						">
                              </td>
                              <? }?>
							</tr>
                        </table>
<? }?>						
						</td>
                      </tr>
                  </table></td>
                </tr>
              </form>
            </table>
            <? 
}
#########################################################
?>
            <br>
            <br>
                  <!-- InstanceEndEditable --> 
            <? }  else { echo "&nbsp;&nbsp;&nbsp;"; } ?>		</td>
        <td width="17" valign="top" background="../images/object/border_07.gif"><img src="../images/object/border_17.gif" width="17" height="119"></td>
      </tr>
      <tr>
        <td height="16"><img src="../images/object/border_09.gif" width="20" height="16"></td>
        <td height="16" background="../images/object/border_11.gif"><img src="../images/object/border_11.gif" width="1" height="16"></td>
        <td><img src="../images/object/border_13.gif" width="17" height="16"></td>
      </tr>
    </table></td>
        </tr>
      </table></td>
    <td width="1" bgcolor="#A13626"><img src="../../images/blank.gif" width="1" height="1"></td> 
  </tr>
</table>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td width="4" height="3" align="center" bgcolor="#A13626"><img src="../../images/blank.gif" width="1" height="1"></td>
    <td height="3" align="center" bgcolor="#A13626"><img src="../../images/blank.gif" width="1" height="1"></td>
    <td width="4" height="3" align="center" bgcolor="#A13626"><img src="../../images/blank.gif" width="1" height="1"></td>
  </tr>
  <tr> 
    <td width="4" height="30" align="left" valign="bottom" background="../../images/main/main-t-bg.gif">&nbsp;</td>
    <td height="30" align="center" background="../../images/main/main-t-bg.gif">&nbsp;</td>
    <td width="4" height="30" align="right" valign="bottom" background="../../images/main/main-t-bg.gif">&nbsp;</td>
  </tr>
</table>
<table width="95%" height="22" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td align="left"><font color="#666666">Copyrights <img src="../../images/web/copyright.gif" width="8" height="9"> 
      2008  MOE. All rights are reserved.</font></td>
    <td align="right"><font color="#666666">Powered by <strong><a href="http://www.net-com.co.th">Net-Com</a></strong></font></td>
  </tr>
</table>
</body>
<!-- InstanceEnd --></html>

Hacked By AnonymousFox1.0, Coded By AnonymousFox