Hacked By AnonymousFox

Current Path : C:/AppServ/www/th/controlweb/manage/mod_intro/
Upload File :
Current File : C:/AppServ/www/th/controlweb/manage/mod_intro/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>
<?=$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/home.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" --> 
	   <!-- import the calendar script -->
                    <link rel="stylesheet" type="text/css" href="../css/myCalendarStyle.css">
                    <script type="text/javascript" src="../lib/calendar.js"></script>
                    <script type="text/javascript" src="../lib/lang/calendar-th.js"></script>
                    <script type="text/javascript" src="../lib/loadcalendar.js"></script>
                    <!-- end the calendar script -->
                    <br>
				<table width="100%" height="22" border="0" cellpadding="2" cellspacing="0" class="table_header">
				  <tr> 
					<td width="30" align="center"><img src="../../images/bullet/bullet01.gif" width="12" height="5" hspace="3"></td>
					<td><?=getMenuName($SystemMenuID)?>&nbsp;</td>
				  </tr>
				</table>
				<table width="99%" border="0" cellpadding="0" cellspacing="0">
				  <tr> 
					<td height="1" class="table_col3"><img src="../images/blank.gif" width="10" height="2"></td>
				  </tr>
				</table>
                    <script language="JavaScript" src="../lib/popup.js" type="text/JavaScript"></script>
                    <br>
                    <? 
## Load Module Configuration Variable ############################################
include("config.php");

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

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

if ($bannerType=="Graphics") {
/////////// insert type = Graphics

		if($inputWidth=="") { $inputWidth=0; }
		if($inputHeight=="") { $inputHeight=0; }

		// Check to create module data directory. ---------
		if(!is_dir($System_RelativePath_Upload."/".$SystemModuleKey)) { mkdir($System_RelativePath_Upload."/".$SystemModuleKey,0777); }
		if(!is_dir($myModule_Path_ThumbnailPicture)) { mkdir($myModule_Path_ThumbnailPicture,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_XML)) { mkdir($myModule_Path_XML,0777); }
		// ------------------------------------------------

		$sql = "INSERT INTO ".$myModule_Table."(".$myModule_Table."_ModuleKey,"
		.$myModule_Table."_Title,"
		.$myModule_Table."_URL,"
		.$myModule_Table."_Detail,"
		.$myModule_Table."_HTMLCode,"
		.$myModule_Table."_BannerType,"
		.$myModule_Table."_PictureFileType,"
		.$myModule_Table."_Width,"
		.$myModule_Table."_Height,"
		.$myModule_Table."_CreateByID,"
		.$myModule_Table."_CreateBy,"
		.$myModule_Table."_CreateDate,"
		.$myModule_Table."_LastUpdate ,"
		.$myModule_Table."_StartDate ,"
		.$myModule_Table."_ExpireDate ,"
		.$myModule_Table."_Language ,"
		.$myModule_Table."_Status)"
		." VALUES( "
		."'$SystemModuleKey','$inputTitle','$inputURL','$inputDetail','','$bannerType','$inputImageType','$inputWidth','$inputHeight',"
		."'$System_Session_User_ID','$System_Session_UserName',NOW(),NOW(),'$inputStartDate','$inputExpireDate','$System_Session_Language','Enable')"; 
		$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) or die(mysql_error());
	
		$sql = "SELECT MAX(".$myModule_Table."_ID) FROM ".$myModule_Table;
		$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
		$Row=MYSQL_FETCH_ARRAY($Query);
		$MaxID = $Row[0];

		srand(make_seed());
		$myrand = rand(1111,9999);

		if(isset($_FILES['inputGraphic'])){

			$ThumbnailPictureName = "intro-$MaxID-$myrand.$inputImageType";
			if(file_exists($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName)) {
				unlink($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName);
			}
			if(move_uploaded_file($_FILES['inputGraphic']['tmp_name'],$myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName)) {
				chmod($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName,0777);
			}
			$sql = "UPDATE ".$myModule_Table." SET ".$myModule_Table."_PictureFile='$ThumbnailPictureName' WHERE ".$myModule_Table."_ID=".$MaxID;
			$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
		}

//--------------------gen XML
//include("../lib/config.php");
//include("../lib/connect-utf.php");

   $sql = "SELECT * FROM ".$myModule_Table." WHERE ".	
					 $myModule_Table . "_Language='$System_Session_Language'" . 
					" AND (" . $myModule_Table."_Status='Home' OR ". $myModule_Table."_Status='Enable')".
					" AND " . $myModule_Table . "_ModuleKey='$SystemModuleKey'" . 
					" AND ((".$myModule_Table."_StartDate='0000-00-00 00:00:00' AND ".  $myModule_Table."_ExpireDate='0000-00-00 00:00:00') " .
					" OR (".$myModule_Table."_StartDate='0000-00-00 00:00:00' AND TO_DAYS(".$myModule_Table."_ExpireDate) >= TO_DAYS(NOW()))" .
					" OR (TO_DAYS(".$myModule_Table."_StartDate) <= TO_DAYS(NOW()) AND ".  $myModule_Table."_ExpireDate='0000-00-00 00:00:00' )" .
					" OR (TO_DAYS(".$myModule_Table."_StartDate) <= TO_DAYS(NOW()) AND TO_DAYS(".$myModule_Table."_ExpireDate)>=TO_DAYS(NOW()))) ORDER BY ".$myModule_Table."_ID DESC ";

				$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: <br>$sql<br>\n");
				$RecordCountTotal=MYSQL_NUMROWS($Query);
				
		$strXML = "&lt;?xml version=\"1.0\" encoding=\"windows-874\"?&gt;\n";
		$strXML .= "&lt;xmldata&gt;\n";
			$index = 1;
			while($Row = MYSQL_FETCH_ARRAY($Query)){
			 $RowPicName = $Row[$myModule_Table."_Title"];
			 $RowPath = $myModule_Path_ThumbnailPicture."/".$Row[$myModule_Table."_PictureFile"];
			  $RowUrl = $Row[$myModule_Table."_URL"];
					$strXML .= "&lt;img id=\"".$index."\" url=\"".$RowUrl."\" tag=\"".$RowPicName."\"  path=\"".$RowPath."\"/&gt;\n";
			$index++;
			}	
		
		$strXML .= "&lt;/xmldata&gt;\n";
		//echo $strXML;
		$XMLFileName = "top-graphic.xml";
		$HTMLToolContent=stripslashes($strXML);
		$fp = fopen ($myModule_Path_XML."/".$XMLFileName, "w+");
		fwrite($fp,str_replace("&gt;",">",str_replace("&lt;","<",$strXML)));
		fclose($fp);

}elseif($bannerType="HTML"){
/////////// insert type = HTML
		$sql = "INSERT INTO ".$myModule_Table."("
		.$myModule_Table."_ModuleKey,"
		.$myModule_Table."_Title,"
		.$myModule_Table."_URL,"
		.$myModule_Table."_HTMLCode,"
		.$myModule_Table."_BannerType,"
		.$myModule_Table."_PictureFileType,"
		.$myModule_Table."_Width,"
		.$myModule_Table."_Height,"
		.$myModule_Table."_CreateByID,"
		.$myModule_Table."_CreateBy,"
		.$myModule_Table."_CreateDate,"
		.$myModule_Table."_LastUpdate ,"
		.$myModule_Table."_StartDate ,"
		.$myModule_Table."_ExpireDate ,"
		.$myModule_Table."_Status)"
		." VALUES( "
		."'$SystemModuleKey','$inputTitle','$inputURL','$inputHTMLCode','$bannerType','$inputImageType','$inputWidth','$inputHeight',"
		."'$System_Session_User_ID','$System_Session_UserName',NOW(),NOW(),'$inputStartDate','$inputExpireDate','Enable')"; 
		$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
			}
			include("../lib/config.php");
include("../lib/connect.php");
		?>
                    <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?>">
                    </form>
                    <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
                    <? 
} 
?>
                    <? 
####################################################################
if($action=="add") { 
?>
                   
                    <table width="95%" border="0" cellpadding="0" cellspacing="1" class="table_header">
                      <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="<?=$PageShow?>">
                        <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>">
                        <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>">
                      </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="<?=$PageShow?>">
                        <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>">
                        <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>">
                        <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 <?=getMenuName($SystemMenuID)?></td>
                        </tr>
                        <tr> 
                          <td height="26" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../images/bullet/box21.gif" width="11" height="11">&nbsp;Header Information </td>
                        </tr>
                        <tr> 
                          <td width="176" height="22" align="right" class="table_col1">Title</td>
                          <td width="521" height="22" class="table_col2"> <input name="inputTitle" type="text" class="input_left" id="inputTitle" size="50" maxlength="200"></td>
                        </tr>
                        <tr> 
                          <td height="22" align="right" class="table_col1">URL&nbsp;</td>
                          <td height="22" class="table_col2"> <input name="inputURL" type="text" class="input_left" id="inputURL" value="http://" size="50" maxlength="300"></td>
                        </tr>
                        <tr>
                          <td height="22" align="right" class="table_col1">Detail</td>
                          <td height="22" class="table_col2"><textarea name="inputDetail" cols="50" rows="6" class="input_textarea" id="textarea"></textarea></td>
                        </tr>
                        <tr> 
                          <td height="26" colspan="2" class="table_col3"><input name="bannerType" type="radio" class="form_checkbox" value="Graphics" checked>&nbsp;<img src="../images/bullet/box21.gif" width="11" height="11">&nbsp;Graphic File </td>
                        </tr>
						<tr>
							<td colspan="2" align="center">
								<div  style="height:130;width:500;overflow:auto" align="center" valign="middle">
									<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
                                      <tr> 
                                        <td height="130" align="center" valign="middle">
											<table border="0" cellpadding="4" cellspacing="0" id="ImagePreviewTable" style="display:none">
												<tr> 
													<td align="center" valign="middle"><img src="../images/blank.gif" name="PreviewImage" id="PreviewImage"></td>
												</tr>
											</table>
											<table border="0" cellpadding="4" cellspacing="0" id="FlashPreviewTable" style="display:none">
												<tr> 
													<td align="center" valign="middle"><font color="#666666">Not support to live preview .swf file.</font></td>
												</tr>
											</table>										</td>
                                      </tr>
                                    </table>									
								</div>							</td>
						</tr>
						<tr>
							<td colspan="2" class="table_col2">
								<table width="100%" border="0">
								<tr> 
								  <td width="176" height="22" align="right" class="table_col1">Graphic File&nbsp;</td>
								  <td width="528" height="22" ><input name="inputGraphic" type="file" class="input_left" id="inputGraphic" size="50" accept="application/msexcel" onChange="
myfile = this.value;
if(myfile!='') {
	myfile = myfile.toLowerCase();
	Temp = myfile.charAt(myfile.length-4) + myfile.charAt(myfile.length-3) + myfile.charAt(myfile.length-2) + myfile.charAt(myfile.length-1);
	if(Temp=='.jpg' || Temp=='.gif' || Temp=='.swf' || Temp=='jpeg') {
		if(Temp=='.jpg') { document.myForm.inputImageType.value='jpg'; }
		if(Temp=='.gif') { document.myForm.inputImageType.value='gif'; }
		if(Temp=='jpeg') { document.myForm.inputImageType.value='jpg'; }
		if(Temp=='.swf') { document.myForm.inputImageType.value='swf'; }
		if(Temp=='.swf') {
			document.getElementById('ImagePreviewTable').style.display='none';
			document.getElementById('FlashPreviewTable').style.display='';
			document.myForm.inputWidth.value='<?=$myGraphic_Width?>';
			document.myForm.inputHeight.value='<?=$myGraphic_Height?>';
		} else {
			document.getElementById('PreviewImage').src=myfile;
			document.myForm.inputWidth.value=document.getElementById('PreviewImage').width;
			document.myForm.inputHeight.value=document.getElementById('PreviewImage').height;
			document.getElementById('ImagePreviewTable').style.display='';
			document.getElementById('FlashPreviewTable').style.display='none';
		}
	} else {
		document.getElementById('ImagePreviewTable').style.display='none';
		document.getElementById('FlashPreviewTable').style.display='none';
		alert('System allow to upload image files only.');
		document.myForm.inputWidth.value='';
		document.myForm.inputHeight.value='';
		this.focus();
	}
}
" onMouseOut="
if(document.getElementById('PreviewImage').width>1 && document.getElementById('PreviewImage').height>1) {
		document.myForm.inputWidth.value=document.getElementById('PreviewImage').width;
		document.myForm.inputHeight.value=document.getElementById('PreviewImage').height;
}
"> 
								  <input name="inputImageType" type="hidden" id="inputImageType"></td>
								</tr>
								<tr> 
								  <td height="22" align="right" class="table_col1">Width x Height&nbsp;</td>
								  <td height="22" ><input name="inputWidth" type="text" class="input_center" id="inputWidth" size="3" maxlength="10"> <strong> x </strong> <input name="inputHeight" type="text" class="input_center" id="inputHeight" size="3" maxlength="10"> pixel recommened <?=$myGraphic_Width?> x <?=$myGraphic_Height?></td>
								</tr>
								<tr> 
								  <td height="41" align="right" class="table_col1">&nbsp;</td>
								  <td height="41">Recommened to use graphic<br>file type .jpg .jpeg .gif .swf only.</td>
								</tr>
                              </table>							</td>
						</tr>
                        <tr> 
                          <td height="26" colspan="2" class="table_col3"><input name="bannerType" type="radio" class="form_checkbox" value="HTML">&nbsp;<img src="../images/bullet/box21.gif" width="11" height="11">&nbsp;HTML Code</td>
                        </tr>
                        <tr> 
                          <td height="22" align="right" class="table_col1">Your  html code.&nbsp;</td>
                          <td height="22" class="table_col2"> <textarea name="inputHTMLCode" cols="50" rows="4" class="input_textarea" id="inputHTMLCode"></textarea></td>
                        </tr>    
						<tr> 
							<td height="26" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../images/bullet/box21.gif" width="11" height="11">&nbsp;Expiration</td>
						</tr>
						<tr> 
							<td height="22" align="right" class="table_col1">Start Date&nbsp;</td>
							<td height="22" class="table_col2"><input name="inputStartDate" type="text" class="input_center" id="inputStartDate" size="10" maxlength="10"> <input type="reset" class="button_normal" onClick="return showCalendar('inputStartDate', 'y-mm-dd');" value=" ... "></td>
						</tr>
						<tr> 
							<td height="22" align="right" class="table_col1">Expire  Date&nbsp;</td>
							<td height="22" class="table_col2"><input name="inputExpireDate" type="text" class="input_center" id="inputExpireDate" size="10" maxlength="10">  <input type="reset" class="button_normal" onClick="return showCalendar('inputExpireDate', 'y-mm-dd');" value=" ... "></td>
						</tr>
						<tr> 
							<td height="22" align="right" class="table_col1">&nbsp;</td>
							<td height="22" class="table_col2">Keep blank to Always On.</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) { if(!isNaN(myObj.value*1)) { return true; } return false; }
function verifySubmit() {

	with(document.myForm) {
		if(isBlank(inputTitle)) {	inputTitle.focus(); return false; }
		//if(isBlank(inputURL)) {	inputURL.focus(); return false; }		
		if(document.myForm.bannerType[0].checked==true){
				
				if(isBlank(inputGraphic)) {	
						alert("คุณยังไม่ได้เลือกภาพ กรุณาเลือกภาพด้วยครับ");
						inputGraphic.focus(); 
						return false; 
				}else{
						test = 0;
				}

		}

		if(document.myForm.bannerType[1].checked==true){
				
				if(isBlank(inputHTMLCode)) {	
						alert("คุณยังไม่ได้ใส่ข้อมูล HTML code กรุณาใส่ด้วย");
						inputHTMLCode.focus(); 
						return false; 
				}else{
						test = 0;
				}
		}
		test = 0;
		
		myfile = inputGraphic.value;
		if(myfile!='') {
			myfile = myfile.toLowerCase();
			Temp = myfile.charAt(myfile.length-4) + myfile.charAt(myfile.length-3) + myfile.charAt(myfile.length-2) + myfile.charAt(myfile.length-1);
			// if image file
			if(Temp=='.jpg' || Temp=='.gif' || Temp=='.swf' || Temp=='jpeg') {
				if(Temp=='.jpg') { inputImageType.value='jpg'; }
				if(Temp=='.gif') { inputImageType.value='gif'; }
				if(Temp=='jpeg') { inputImageType.value='jpg'; }
				if(Temp=='.swf') { inputImageType.value='swf'; }
				// if flash file type
				if(Temp=='.swf') {
					document.getElementById('ImagePreviewTable').style.display='none';
					document.getElementById('FlashPreviewTable').style.display='';
					if(isBlank(inputWidth)) { alert('Please input flash width pixel in numberic.'); inputWidth.focus(); return false; }
					if(!isNumber(inputWidth)) { 
						alert('Please input flash width pixel in numberic.'); 
						inputWidth.value='';
						inputWidth.focus(); 
						return false; 
					}
					if(isBlank(inputHeight)) { alert('Please input flash height pixel in numberic.'); inputHeight.focus(); return false; }
					if(!isNumber(inputHeight)) { 
						alert('Please input flash height pixel in numberic.');
						inputHeight.value='';
						inputHeight.focus(); 
						return false; 
					}
				// if image file type
				} else {//ที่ไม่ใช้.swf
					document.getElementById('PreviewImage').src=myfile;
					inputWidth.value=document.getElementById('PreviewImage').width;
					inputHeight.value=document.getElementById('PreviewImage').height;
					document.getElementById('ImagePreviewTable').style.display='';
					document.getElementById('FlashPreviewTable').style.display='none';
				}
			// if not image file hidden preview image
			} else {
				document.getElementById('ImagePreviewTable').style.display='none';
				document.getElementById('FlashPreviewTable').style.display='none';
				alert('System allow to upload image files only.');
				inputWidth.value='';
				inputHeight.value='';
				inputGraphic.focus();
				return false; 
			}
		}
	if (test==0){
				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" id="btCalcel" onClick="document.myReturnForm.submit();" value="Back"> </td>
                                    </tr>
                                  </table></td>
                              </tr>
                            </table></td>
                        </tr>
                      </form>
            </table>
                    <br>
                    <br>
                    <br>
                    <? 
#########################################################
} else if ($action=="edit") { 
	$myCheckBoxID=0;
	for($i=1;$i<=$TotalCheckBoxID;$i++) {
		$myVar="CheckBoxID".$i;
		if(strlen($$myVar)>0) {
			$myCheckBoxID=$$myVar;
		}
	}
	$sql="SELECT * FROM ".$myModule_Table." WHERE ".$myModule_Table."_ID=".$myCheckBoxID;
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	$Row=MYSQL_FETCH_ARRAY($Query);
?>
                    <table width="95%" border="0" cellpadding="0" cellspacing="1" class="table_header">
                      <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?>">
                      </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="CheckBoxID1" type="hidden" id="CheckBoxID1" value="<?=$myCheckBoxID?>">
                        <input name="inputImageType" type="hidden" id="inputImageType">
                        <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 <?=getMenuName($SystemMenuID)?></td>
                        </tr>
                        <tr> 
                          <td height="26" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../images/bullet/box21.gif" width="11" height="11">&nbsp;Header Information </td>
                        </tr>
                        <tr> 
                          <td width="176" height="22" align="right" class="table_col1">Title&nbsp;</td>
                          <td width="397" height="22" class="table_col2"> <input name="inputTitle" type="text" class="input_left" id="inputTitle" value="<?=$Row[$myModule_Table."_Title"]?>" size="50" maxlength="200"></td>
                        </tr>
                        <tr> 
                          <td height="22" align="right" class="table_col1">URL&nbsp;                          </td>
                          <td height="22" class="table_col2"> <input name="inputURL" type="text" class="input_left" id="inputURL" value="<?=$Row[$myModule_Table."_URL"]?>" size="50" maxlength="300"></td>
                        </tr>
                        <tr>
                          <td height="22" align="right" class="table_col1">Detail</td>
                          <td height="22" class="table_col2"><textarea name="inputDetail" cols="50" rows="6" class="input_textarea" id="inputDetail"><?=$Row[$myModule_Table."_Detail"]?>
                          </textarea></td>
                        </tr>
                        <tr> 
                          <td height="26" colspan="2" class="table_col3"><input name="bannerType" type="radio" class="form_checkbox" value="Graphics" <? if($Row[$myModule_Table."_BannerType"]=="Graphics") echo "checked"; ?>>&nbsp;<img src="../images/bullet/box21.gif" width="11" height="11">&nbsp;Graphic File </td>
                        </tr>
                        <tr> 
                          <td height="130" colspan="2" align="center" valign="middle" class="table_col2"> 
                            <div  style="height:130;width:500;overflow:auto" align="center" valign="middle"> 
							<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
								<tr> 
									<td height="130" align="center" valign="middle">
										<table border="0" cellpadding="4" cellspacing="0" id="ImagePreviewTable" <? if( strlen($Row[$myModule_Table."_PictureFileType"])==0 || $Row[$myModule_Table."_PictureFileType"]=="swf") { ?>style="display:none"<? } ?>>
											<tr> 
											  <td align="center" valign="middle"><img src="<?=$myModule_Path_ThumbnailPicture?>/<?=$Row[$myModule_Table."_PictureFile"]?>" name="PreviewImage" id="PreviewImage"></td>
											</tr>
										</table>
										<table border="0" cellpadding="4" cellspacing="0" id="FlashPreviewTable" <? if( strlen($Row[$myModule_Table."_PictureFileType"])==0 || $Row[$myModule_Table."_PictureFileType"]=="jpg" || $Row[$myModule_Table."_PictureFileType"]=="gif" || $Row[$myModule_Table."_PictureFileType"]=="jpeg") { ?>style="display:none"<? } ?>>
											<tr> 
											  <td align="center" valign="middle"><font color="#666666">Not support to live preview .swf file.</font></td>
											</tr>
										</table>									</td>
								</tr>
								<tr>
								  <td height="130" align="center" valign="middle">&nbsp;</td>
							  </tr>
							</table>
                            </div>						  </td>
                        </tr>
						<tr align="center"><td colspan="2" class="table_col2"><table width="100%" border="0">
                          <tr>
                            <td width="88" height="22" align="right" class="table_col1">Graphic File&nbsp; </td>
                            <td width="198" height="22" ><input name="inputGraphic" type="file" class="input_left" id="inputGraphic" onChange="
myfile = this.value;
if(myfile!='') {
	myfile = myfile.toLowerCase();
	Temp = myfile.charAt(myfile.length-4) + myfile.charAt(myfile.length-3) + myfile.charAt(myfile.length-2) + myfile.charAt(myfile.length-1);
	if(Temp=='.jpg' || Temp=='.gif' || Temp=='.swf' || Temp=='jpeg') {
		if(Temp=='.jpg') { document.myForm.inputImageType.value='jpg'; }
		if(Temp=='.gif') { document.myForm.inputImageType.value='gif'; }
		if(Temp=='jpeg') { document.myForm.inputImageType.value='jpg'; }
		if(Temp=='.swf') { document.myForm.inputImageType.value='swf'; }
		if(Temp=='.swf') {
			document.getElementById('ImagePreviewTable').style.display='none';
			document.getElementById('FlashPreviewTable').style.display='';
			document.myForm.inputWidth.value='<?=$myGraphic_Width?>';
			document.myForm.inputHeight.value='<?=$myGraphic_Height?>';
			
		} else {
			document.getElementById('PreviewImage').src=myfile;
			document.myForm.inputWidth.value=document.getElementById('PreviewImage').width;
			document.myForm.inputHeight.value=document.getElementById('PreviewImage').height;
			document.getElementById('ImagePreviewTable').style.display='';
			document.getElementById('FlashPreviewTable').style.display='none';
		}
	} else {
		document.getElementById('ImagePreviewTable').style.display='none';
		document.getElementById('FlashPreviewTable').style.display='none';
		alert('System allow to upload image files only.');
		document.myForm.inputWidth.value='';
		document.myForm.inputHeight.value='';
		this.focus();
	}
}
" onMouseOut="
if(document.getElementById('PreviewImage').width>1 && document.getElementById('PreviewImage').height>1) {
		document.myForm.inputWidth.value=document.getElementById('PreviewImage').width;
		document.myForm.inputHeight.value=document.getElementById('PreviewImage').height;
}
" size="50" accept="application/msexcel">
                                <input name="inputImageType2" type="hidden" id="inputImageType2"></td>
                          </tr>
                          <tr>
                            <td height="22" align="right" class="table_col1">Width x Height&nbsp;</td>
                            <td height="22" ><input name="inputWidth" type="text" class="input_center" id="inputWidth" value="<?=$Row[$myModule_Table."_Width"]?>" size="3" maxlength="10"><strong> x </strong><input name="inputHeight" type="text" class="input_center" id="inputHeight" value="<?=$Row[$myModule_Table."_Height"]?>" size="3" maxlength="10">pixel recommened <?=$myGraphic_Width?> x <?=$myGraphic_Height?></td>
                          </tr>
                          <tr>
                            <td height="41" align="right" class="table_col1">&nbsp;</td>
                            <td height="41"> Recommened to use graphic<br> file type .jpg .jpeg .gif .swf only.</td>
                          </tr>
                        </table></td>
						</tr>
                        <tr> 
                          <td height="26" colspan="2" class="table_col3"><input name="bannerType" type="radio" class="form_checkbox" value="HTML" <? if($Row[$myModule_Table."_BannerType"]=="HTML") echo "checked"; ?>>&nbsp;<img src="../images/bullet/box21.gif" width="11" height="11">&nbsp;HTML Code </td>
                        </tr>
                        <tr> 
                          <td height="22" align="right" class="table_col1">Your html code.&nbsp; </td>
                          <td height="22" class="table_col2"><textarea name="inputHTMLCode" cols="50" rows="4" class="input_textarea" id="inputHTMLCode"><?=$Row[$myModule_Table."_HTMLCode"]?></textarea></td>
                        </tr>
						<tr> 
							<td height="26" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../images/bullet/box21.gif" width="11" height="11">&nbsp;Expiration</td>
						</tr>
						<tr> 
						  <td height="22" align="right" class="table_col1">Start Date&nbsp;</td>
						  <td height="22" class="table_col2"><input name="inputStartDate" type="text" class="input_center" id="inputStartDate" value="<?
$myTmpDate = substr($Row[$myModule_Table."_StartDate"],0,10);
if($myTmpDate!="0000-00-00") { echo $myTmpDate; }
?>" size="10" maxlength="10"> <input type="reset" class="button_normal" onClick="return showCalendar('inputStartDate', 'y-mm-dd');" value=" ... "></td>
						</tr>
						<tr> 
						  <td height="22" align="right" class="table_col1">Expire Date&nbsp;</td>
						  <td height="22" class="table_col2"><input name="inputExpireDate" type="text" class="input_center" id="inputExpireDate" size="10" maxlength="10" value="<?
$myTmpDate = substr($Row[$myModule_Table."_ExpireDate"],0,10);
if($myTmpDate!="0000-00-00") { echo $myTmpDate; }
?>"> <input type="reset" class="button_normal" onClick="return showCalendar('inputExpireDate', 'y-mm-dd');" value=" ... "></td>
						</tr>
						<tr> 
						  <td height="22" align="right" class="table_col1">&nbsp;</td>
						  <td height="22" class="table_col2">Keep blank to Always On.</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) { if(!isNaN(myObj.value*1)) { return true; } return false; }
function verifySubmit() {

	with(document.myForm) {
		if(isBlank(inputTitle)) {	inputTitle.focus(); return false; }
		//if(isBlank(inputURL)) {	inputURL.focus(); return false; }		
		if(document.myForm.bannerType[0].checked==true){
/*				
				if(isBlank(inputGraphic)) {	
						alert("คุณยังไม่ได้เลือกภาพ กรุณาเลือกภาพด้วยครับ");
						inputGraphic.focus(); 
						return false; 
				}else{
						test = 0;
				}
*/
		}

		if(document.myForm.bannerType[1].checked==true){
				
				if(isBlank(inputHTMLCode)) {	
						alert("คุณยังไม่ได้ใส่ข้อมูล HTML code กรุณาใส่ด้วย");
						inputHTMLCode.focus(); 
						return false; 
				}else{
						test = 0;
				}
		}
		test = 0;
		
		myfile = inputGraphic.value;
		if(myfile!='') {
			myfile = myfile.toLowerCase();
			Temp = myfile.charAt(myfile.length-4) + myfile.charAt(myfile.length-3) + myfile.charAt(myfile.length-2) + myfile.charAt(myfile.length-1);
			// if image file
			if(Temp=='.jpg' || Temp=='.gif' || Temp=='.swf' || Temp=='jpeg') {
				if(Temp=='.jpg') { inputImageType.value='jpg'; }
				if(Temp=='.gif') { inputImageType.value='gif'; }
				if(Temp=='jpeg') { inputImageType.value='jpg'; }
				if(Temp=='.swf') { inputImageType.value='swf'; }
				// if flash file type
				if(Temp=='.swf') {
					document.getElementById('ImagePreviewTable').style.display='none';
					document.getElementById('FlashPreviewTable').style.display='';
					if(isBlank(inputWidth)) { alert('Please input flash width pixel in numberic.'); inputWidth.focus(); return false; }
					if(!isNumber(inputWidth)) { 
						alert('Please input flash width pixel in numberic.'); 
						inputWidth.value='';
						inputWidth.focus(); 
						return false; 
					}
					if(isBlank(inputHeight)) { alert('Please input flash height pixel in numberic.'); inputHeight.focus(); return false; }
					if(!isNumber(inputHeight)) { 
						alert('Please input flash height pixel in numberic.');
						inputHeight.value='';
						inputHeight.focus(); 
						return false; 
					}
				// if image file type
				} else {//ที่ไม่ใช้.swf
					document.getElementById('PreviewImage').src=myfile;
					inputWidth.value=document.getElementById('PreviewImage').width;
					inputHeight.value=document.getElementById('PreviewImage').height;
					document.getElementById('ImagePreviewTable').style.display='';
					document.getElementById('FlashPreviewTable').style.display='none';
				}
			// if not image file hidden preview image
			} else {
				document.getElementById('ImagePreviewTable').style.display='none';
				document.getElementById('FlashPreviewTable').style.display='none';
				alert('System allow to upload image files only.');
				inputWidth.value='';
				inputHeight.value='';
				inputGraphic.focus();
				return false; 
			}
		}
	if (test==0){
				document.myForm.submit();
	}						 
	

	}
}
						</script> 
                                  <input name="btSave" type="button" class="button_80" id="btSave" value="Save" onClick="verifySubmit();"> 
                                      </td>
                                      <td> <input name="btCalcel" type="button" class="button_80" id="btCalcel" onClick="document.myReturnForm.submit();" value="Back"> </td>
                                    </tr>
                                  </table></td>
                              </tr>
                            </table></td>
                        </tr>
                      </form>
            </table>
                    <br>
                    <br>
                    <br>
                    <? 
#########################################################
} else if ($action=="update") { 
if ($bannerType=="Graphics") {
		$MaxID = $CheckBoxID1;
		$sql = "UPDATE ".$myModule_Table." SET "
		.$myModule_Table."_Title='".$inputTitle."',"
		.$myModule_Table."_URL='".$inputURL."',"
		.$myModule_Table."_Detail='".$inputDetail."',"
		.$myModule_Table."_Width='".$inputWidth."',"
		.$myModule_Table."_Height='".$inputHeight."',"
		.$myModule_Table."_BannerType='".$bannerType."',"
		.$myModule_Table."_HTMLCode='',"
		.$myModule_Table."_StartDate='".$inputStartDate."',"
		.$myModule_Table."_ExpireDate='".$inputExpireDate."',"
		.$myModule_Table."_LastUpdate=NOW() WHERE "
		.$myModule_Table."_ID=".$MaxID;
		$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");

		srand(make_seed());
		$myrand = rand(1111,9999);

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

		if($isDeletePicture=="Yes") {
			$sql = "SELECT * FROM ".$myModule_Table." WHERE ".$myModule_Table."_ID=".$MaxID;
			$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
			$Row=MYSQL_FETCH_ARRAY($Query);
			if(file_exists($myModule_Path_ThumbnailPicture."/".$Row[$myModule_Table."_PictureFile"])) {
				unlink($myModule_Path_ThumbnailPicture."/".$Row[$myModule_Table."_PictureFile"]);
			}
			$sql = "UPDATE ".$myModule_Table." SET "
			.$myModule_Table."_PictureFile='', "
			.$myModule_Table."_Width=0 ,"
			.$myModule_Table."_Height=0,"
			.$myModule_Table."_PictureFileType='' WHERE "
			.$myModule_Table."_ID=".$MaxID;
			$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
		}
		
		if(isset($_FILES['inputGraphic'])) {
			$sql = "SELECT * FROM ".$myModule_Table." WHERE ".$myModule_Table."_ID=".$MaxID;
			$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
			$Row=MYSQL_FETCH_ARRAY($Query);

			if($Row[$myModule_Table."_PictureFile"]!=""){			
				if(file_exists($myModule_Path_ThumbnailPicture."/".$Row[$myModule_Table."_PictureFile"])) {
					unlink($myModule_Path_ThumbnailPicture."/".$Row[$myModule_Table."_PictureFile"]);
				}
			}			
			
			$ThumbnailPictureName = "intro-$MaxID-$myrand.$inputImageType";
			if(move_uploaded_file($_FILES['inputGraphic']['tmp_name'],$myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName)) {
				chmod($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName,0777);
			}
			$sql = "UPDATE ".$myModule_Table." SET "
			.$myModule_Table."_PictureFile='$ThumbnailPictureName',"
			.$myModule_Table."_PictureFileType='$inputImageType',"
			.$myModule_Table."_Width=$inputWidth,"
			.$myModule_Table."_Height=$inputHeight WHERE "
			.$myModule_Table."_ID=".$MaxID;
			$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
		
		//--------------------gen XML
   $sql = "SELECT * FROM ".$myModule_Table." WHERE ".	
					 $myModule_Table . "_Language='$System_Session_Language'" . 
					" AND (" . $myModule_Table."_Status='Home' OR ". $myModule_Table."_Status='Enable')".
					" AND " . $myModule_Table . "_ModuleKey='$SystemModuleKey'" . 
					" AND ((".$myModule_Table."_StartDate='0000-00-00 00:00:00' AND ".  $myModule_Table."_ExpireDate='0000-00-00 00:00:00') " .
					" OR (".$myModule_Table."_StartDate='0000-00-00 00:00:00' AND TO_DAYS(".$myModule_Table."_ExpireDate) >= TO_DAYS(NOW()))" .
					" OR (TO_DAYS(".$myModule_Table."_StartDate) <= TO_DAYS(NOW()) AND ".  $myModule_Table."_ExpireDate='0000-00-00 00:00:00' )" .
					" OR (TO_DAYS(".$myModule_Table."_StartDate) <= TO_DAYS(NOW()) AND TO_DAYS(".$myModule_Table."_ExpireDate)>=TO_DAYS(NOW()))) ORDER BY ".$myModule_Table."_ID DESC ";

				$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: <br>$sql<br>\n");
				$RecordCountTotal=MYSQL_NUMROWS($Query);
				
		$strXML = "&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n";
		$strXML .= "&lt;xmldata&gt;\n";
			$index = 1;
			while($Row = MYSQL_FETCH_ARRAY($Query)){
			 $RowPicName = $Row[$myModule_Table."_Title"];
			 $RowPath = $myModule_Path_ThumbnailPicture."/".$Row[$myModule_Table."_PictureFile"];
			  $RowUrl = $Row[$myModule_Table."_URL"];
					$strXML .= "&lt;img id=\"".$index."\" url=\"".$RowUrl."\" tag=\"".$RowPicName."\"  path=\"".$RowPath."\"/&gt;\n";
			$index++;
			}	
		
		$strXML .= "&lt;/xmldata&gt;\n";
		//echo $strXML;
		$XMLFileName = "top-graphic.xml";
		$HTMLToolContent=stripslashes($strXML);
		$fp = fopen ($myModule_Path_XML."/".$XMLFileName, "w+");
		fwrite($fp,str_replace("&gt;",">",str_replace("&lt;","<",$strXML)));
		fclose($fp);

		}
}elseif($bannerType=="HTML") {
		$MaxID = $CheckBoxID1;
		$sql = "UPDATE ".$myModule_Table." SET "
		.$myModule_Table."_Title='".$inputTitle."',"
		.$myModule_Table."_URL='".$inputURL."',"
		.$myModule_Table."_BannerType='".$bannerType."',"
		.$myModule_Table."_HTMLCode='".$inputHTMLCode."',"
		.$myModule_Table."_StartDate='".$inputStartDate."',"
		.$myModule_Table."_ExpireDate='".$inputExpireDate."',"
		.$myModule_Table."_LastUpdate=NOW() WHERE "
		.$myModule_Table."_ID=".$MaxID;
		$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");

			$sql = "SELECT ".$myModule_Table."_PictureFile FROM ".$myModule_Table." WHERE ".$myModule_Table."_ID=".$MaxID;
			$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
			$Row=MYSQL_FETCH_ARRAY($Query);
						
			if($Row[$myModule_Table."_PictureFile"]!=""){			
				if(file_exists($myModule_Path_ThumbnailPicture."/".$Row[$myModule_Table."_PictureFile"])) {
					unlink($myModule_Path_ThumbnailPicture."/".$Row[$myModule_Table."_PictureFile"]);
				}
			}
			$sql = "UPDATE ".$myModule_Table." SET "
			.$myModule_Table."_PictureFile='', "
			.$myModule_Table."_Width=0 ,"
			.$myModule_Table."_Height=0,"
			.$myModule_Table."_PictureFileType='' WHERE "
			.$myModule_Table."_ID=".$MaxID;
			$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?>">
                    </form>
                    <script language="JavaScript" type="text/JavaScript">document.myForm.submit(); </script>
<?
#########################################################
} else if ($action=="view") { 
	$myCheckBoxID=0;
	for($i=1;$i<=$TotalCheckBoxID;$i++) {
		$myVar="CheckBoxID".$i;
		if(strlen($$myVar)>0) {
			$myCheckBoxID=$$myVar;
		}
	}
	$sql="SELECT * FROM ".$myModule_Table." WHERE ".$myModule_Table."_ID=".$myCheckBoxID;
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	$Row=MYSQL_FETCH_ARRAY($Query);
	$imgWidth=$Row[$myModule_Table."_Width"]; 
	$imgHeight=$Row[$myModule_Table."_Height"]; 
?>
                    <table width="95%" 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="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="CheckBoxID1" type="hidden" id="CheckBoxID1" value="<?=$myCheckBoxID?>">
                        <input name="TotalCheckBoxID" type="hidden" id="TotalCheckBoxID" value="1">
                        <tr> 
                          <td bgcolor="#FFFFFF"> <table width="100%" border="0" cellpadding="2" cellspacing="1" >
                              <tr align="center"> 
                                <td height="24" colspan="2" align="center" class="table_header"><?=getMenuName($SystemMenuID)?> Information</td>
                              </tr>
                              <tr> 
                                <td height="26" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../images/bullet/box21.gif" width="11" height="11">&nbsp;Header Information </td>
                              </tr>
                              <tr> 
                                <td width="90" height="22" align="right" class="table_col1">Title&nbsp;</td>
                                <td width="460" height="22" class="table_col2"><?=$Row[$myModule_Table."_Title"]?>
                                </td>
                              </tr>
                              <tr> 
                                <td width="90" height="22" align="right" class="table_col1">URL&nbsp;</td>
                                <td width="460" height="22" class="table_col2"><a href="<?=$Row[$myModule_Table."_URL"]?>" target="_blank"><?=$Row[$myModule_Table."_URL"]?></a></td>
                              </tr>
<? if($Row[$myModule_Table."_BannerType"]=="Graphics"){ ?>
                              <tr>  
								  <td height="26" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../images/bullet/box21.gif" width="11" height="11">&nbsp;ImagePreview</td>
                              </tr>
                              <tr> 
                                <td height="130" colspan="2" align="center" valign="middle" class="table_col2"> 
                                  <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
									  <tr> 
										<td align="center" valign="middle">
										<? if($Row[$myModule_Table."_PictureFileType"]=="swf") {?>
												<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="<?=$Row[$myModule_Table."_Width"]?>" height="<?=$Row[$myModule_Table."_Height"]?>">
												<param name="movie" value="../../cgi-bin/<?=$SystemModuleKey?>/thumbnail/<?=$Row[$myModule_Table."_PictureFile"]?>">
												<param name="quality" value="high">
												<embed src="../../cgi-bin/<?=$SystemModuleKey?>/thumbnail/<?=$Row[$myModule_Table."_PictureFile"]?>" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="<?=$Row[$myModule_Table."_Width"]?>" height="<?=$Row[$myModule_Table."_Height"]?>"></embed></object>
										<? } else if($Row[$myModule_Table."_PictureFileType"]=="") { 
												echo "<table width=\"".$myGraphic_Width."\" height=\"".$myGraphic_Height."\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"".$Row[$myModule_Table."_HTMLBG"]."\"><tr><td>";
												if($Row[$myModule_Table."_HTMLCode"]!="") {
													echo $Row[$myModule_Table."_HTMLCode"];
												} else {
													echo "&nbsp;";
												}
												echo "</td></tr></table>";
										 } else { 
										 ?>
												<img src="../../upload/<?=$SystemModuleKey?>/thumbnail/<?=$Row[$myModule_Table."_PictureFile"]?>" width="<?=$Row[$myModule_Table."_Width"]?>" height="<?=$Row[$myModule_Table."_Height"]?>" border="0">
										<?
										}
										?>							
									 </td>
                                    </tr>
                                  </table>
								</td>
							</tr>
<? }else if($Row[$myModule_Table."_BannerType"]=="HTML") {?>
							<tr>								  
								<td height="26" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../images/bullet/box21.gif" width="11" height="11">&nbsp;HTML Preview</td>
							</tr>
							<tr> 
								<td height="60" colspan="2" align="center" valign="middle" class="table_col2"> 
								<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
									<tr> 
										<td align="center" valign="middle"><?=$Row[$myModule_Table."_HTMLCode"]?></td>
                                    </tr>
                                  </table>
							  </td>
						    </tr>
<? }?>								  
							  <tr> 
								  <td height="26" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../images/bullet/box21.gif" width="11" height="11">&nbsp;Expiration</td>
							  </tr>
								<tr> 
								  <td height="22" align="right" class="table_col1">Start Date&nbsp;</td>
								  <td height="22" class="table_col2"> 
									<?
										$myTmpDate = substr($Row[$myModule_Table."_StartDate"],0,10);
										if($myTmpDate=="0000-00-00") { echo "No start date limit."; } else { echo $myTmpDate; }
									?>
								  </td>
								</tr>
								<tr> 
								  <td height="22" align="right" class="table_col1">Expire Date&nbsp;</td>
								  <td height="22" class="table_col2"> 
									<?
										$myTmpDate = substr($Row[$myModule_Table."_ExpireDate"],0,10);
										if($myTmpDate=="0000-00-00") { echo "No expire date limit."; } else { echo $myTmpDate; }
									?>
								  </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 height="22" align="right" class="table_col1">Create  Date&nbsp;</td>
                                <td 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> 
                                <td height="22" align="right" class="table_col1">Status&nbsp;</td>
                                <td height="22" class="table_col2"><?=$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"> 
                                  <table width="300" border="0" cellspacing="0" cellpadding="2">
                                    <tr align="center"> 
<? if($System_Session_Permission[$SystemMenuID]=="RW" ){ ?> 
                                      <td> <input name="btEdit" type="submit" class="button_80" id="btEdit" value="Edit" onClick="document.myForm.submit();	"> </td>
<? }?>						
                                      <td> <input name="btCalcel" type="button" class="button_80" id="btCalcel" onClick="
document.myForm.submit();
						" value="Back"> </td>
                                    </tr>
                                  </table></td>
                              </tr>
                            </table></td>
                        </tr>
                      </form>
            </table>
                    <? 
#########################################################
} else if ($action=="delete") { 
	for($i=1;$i<=$TotalCheckBoxID;$i++) {
		$myVar="CheckBoxID".$i;
		if(strlen($$myVar)>0) {
			$sql = "SELECT * FROM ".$myModule_Table." WHERE ".$myModule_Table."_ID=".$$myVar;
			$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
			$Row=MYSQL_FETCH_ARRAY($Query);
			if(strlen($Row[$myModule_Table."_PictureFile"])>0) {
				if(file_exists($myModule_Path_ThumbnailPicture."/".$Row[$myModule_Table."_PictureFile"])) {
					unlink($myModule_Path_ThumbnailPicture."/".$Row[$myModule_Table."_PictureFile"]);
				}
			}			
			if(strlen($Row[$myModule_Table."_BackgroundPictureFile"])>0) {
				if(file_exists($myModule_Path_ThumbnailPicture."/".$Row[$myModule_Table."_BackgroundPictureFile"])) {
					unlink($myModule_Path_ThumbnailPicture."/".$Row[$myModule_Table."_BackgroundPictureFile"]);
				}
			}			
			$sql = "DELETE FROM ".$myModule_Table." WHERE ".$myModule_Table."_ID=".$$myVar;
			$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
		}
	}

//--------------------gen XML
   $sql = "SELECT * FROM ".$myModule_Table." WHERE ".	
					 $myModule_Table . "_Language='$System_Session_Language'" . 
					" AND (" . $myModule_Table."_Status='Home' OR ". $myModule_Table."_Status='Enable')".
					" AND " . $myModule_Table . "_ModuleKey='$SystemModuleKey'" . 
					" AND ((".$myModule_Table."_StartDate='0000-00-00 00:00:00' AND ".  $myModule_Table."_ExpireDate='0000-00-00 00:00:00') " .
					" OR (".$myModule_Table."_StartDate='0000-00-00 00:00:00' AND TO_DAYS(".$myModule_Table."_ExpireDate) >= TO_DAYS(NOW()))" .
					" OR (TO_DAYS(".$myModule_Table."_StartDate) <= TO_DAYS(NOW()) AND ".  $myModule_Table."_ExpireDate='0000-00-00 00:00:00' )" .
					" OR (TO_DAYS(".$myModule_Table."_StartDate) <= TO_DAYS(NOW()) AND TO_DAYS(".$myModule_Table."_ExpireDate)>=TO_DAYS(NOW()))) ORDER BY ".$myModule_Table."_ID DESC ";

				$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: <br>$sql<br>\n");
				$RecordCountTotal=MYSQL_NUMROWS($Query);
				
		$strXML = "&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n";
		$strXML .= "&lt;xmldata&gt;\n";
			$index = 1;
			while($Row = MYSQL_FETCH_ARRAY($Query)){
			 $RowPicName = $Row[$myModule_Table."_Title"];
			 $RowPath = $myModule_Path_ThumbnailPicture."/".$Row[$myModule_Table."_PictureFile"];
			  $RowUrl = $Row[$myModule_Table."_URL"];
					$strXML .= "&lt;img id=\"".$index."\" url=\"".$RowUrl."\" tag=\"".$RowPicName."\"  path=\"".$RowPath."\"/&gt;\n";
			$index++;
			}	
		
		$strXML .= "&lt;/xmldata&gt;\n";
		//echo $strXML;
		$XMLFileName = "top-graphic.xml";
		$HTMLToolContent=stripslashes($strXML);
		$fp = fopen ($myModule_Path_XML."/".$XMLFileName, "w+");
		fwrite($fp,str_replace("&gt;",">",str_replace("&lt;","<",$strXML)));
		fclose($fp);

?>
                    <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?>">
                    </form>
                    <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
                    <? 
#########################################################
} else if ($action=="setstatus") { 
	$myCheckBoxID=0;
	for($i=1;$i<=$TotalCheckBoxID;$i++) {
		$myVar="CheckBoxID".$i;
		if(strlen($$myVar)>0) {
			$myCheckBoxID=$$myVar;
		}
	}
	$sql="UPDATE ".$myModule_Table." SET ".$myModule_Table."_Status='$SelectStatus' WHERE ".$myModule_Table."_ID=".$myCheckBoxID;
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	
	//--------------------gen XML
   $sql = "SELECT * FROM ".$myModule_Table." WHERE ".	
					 $myModule_Table . "_Language='$System_Session_Language'" . 
					" AND (" . $myModule_Table."_Status='Home' OR ". $myModule_Table."_Status='Enable')".
					" AND " . $myModule_Table . "_ModuleKey='$SystemModuleKey'" . 
					" AND ((".$myModule_Table."_StartDate='0000-00-00 00:00:00' AND ".  $myModule_Table."_ExpireDate='0000-00-00 00:00:00') " .
					" OR (".$myModule_Table."_StartDate='0000-00-00 00:00:00' AND TO_DAYS(".$myModule_Table."_ExpireDate) >= TO_DAYS(NOW()))" .
					" OR (TO_DAYS(".$myModule_Table."_StartDate) <= TO_DAYS(NOW()) AND ".  $myModule_Table."_ExpireDate='0000-00-00 00:00:00' )" .
					" OR (TO_DAYS(".$myModule_Table."_StartDate) <= TO_DAYS(NOW()) AND TO_DAYS(".$myModule_Table."_ExpireDate)>=TO_DAYS(NOW()))) ORDER BY ".$myModule_Table."_ID DESC ";

				$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: <br>$sql<br>\n");
				$RecordCountTotal=MYSQL_NUMROWS($Query);
				
		$strXML = "&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n";
		$strXML .= "&lt;xmldata&gt;\n";
			$index = 1;
			while($Row = MYSQL_FETCH_ARRAY($Query)){
			 $RowPicName = $Row[$myModule_Table."_Title"];
			 $RowPath = $myModule_Path_ThumbnailPicture."/".$Row[$myModule_Table."_PictureFile"];
			  $RowUrl = $Row[$myModule_Table."_URL"];
					$strXML .= "&lt;img id=\"".$index."\" url=\"".$RowUrl."\" tag=\"".$RowPicName."\"  path=\"".$RowPath."\"/&gt;\n";
			$index++;
			}	
		
		$strXML .= "&lt;/xmldata&gt;\n";
		//echo $strXML;
		$XMLFileName = "top-graphic.xml";
		$HTMLToolContent=stripslashes($strXML);
		$fp = fopen ($myModule_Path_XML."/".$XMLFileName, "w+");
		fwrite($fp,str_replace("&gt;",">",str_replace("&lt;","<",$strXML)));
		fclose($fp);

?>
                    <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?>">
                    </form>
                    <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
                    <?	
#########################################################
} else { ?>
<?
# Check to set default value #########################
if($PageSize=="") { $PageSize = $SystemModule_defaultPageSize; }
if($PageShow=="") { $PageShow = $SystemModule_defaultPageShow; }
if($ASCDESC=="") { $ASCDESC = $SystemModule_ASCDESC; } 
if($OrderBy=="") { $OrderBy = $SystemModule_OrderBy; } 
if($action=="switchorder") { 
	if($ASCDESC=="ASC") { $ASCDESC = "DESC"; }  else { $ASCDESC="ASC"; } 
} 

# Count total record size #########################
$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");

$sql = "SELECT * FROM ".$myModule_Table." WHERE ".$myModule_Table."_ModuleKey='$SystemModuleKey'";
$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
$TotalRecordCount=MYSQL_NUMROWS($Query);

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

# Select only paging range #########################
$RecordStart = ($PageShow-1)*$PageSize;
$sql .= " ORDER BY $OrderBy $ASCDESC LIMIT $RecordStart , $PageSize";
$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
$RecordCount=MYSQL_NUMROWS($Query);
?>
                    <script language="JavaScript" type="text/JavaScript">
function Paging_CheckAll(objCheckHeader,txtCheckBoxFirstName,intTotalItems) {
	if(intTotalItems>0)
		for(i=1;i<=intTotalItems;i++)
			document.getElementById(txtCheckBoxFirstName+i).checked = objCheckHeader.checked;			
	return true;
}
function Paging_CheckAllHandle(objCheckHeader,txtCheckBoxFirstName,intTotalItems) {
	var isCheckedAll = true;
	if(intTotalItems>0)
		for(i=1;i<=intTotalItems;i++)
			if(!document.getElementById(txtCheckBoxFirstName+i).checked) 
				isCheckedAll = false;
	objCheckHeader.checked = isCheckedAll;
	return true;
}
function Paging_CountChecked(txtCheckBoxFirstName,intTotalItems) {
	var intChecked = 0;
	if(intTotalItems>0)
		for(i=1;i<=intTotalItems;i++)
			if(document.getElementById(txtCheckBoxFirstName+i).checked) 
				intChecked ++;
	return intChecked ;
}
function Paging_CheckedThisItem(objCheckHeader,indexing,txtCheckBoxFirstName,intTotalItems) {
	if(intTotalItems>0)
		for(i=1;i<=intTotalItems;i++)
			if(i==indexing) {
				document.getElementById(txtCheckBoxFirstName+i).checked = true;
			} else {
				document.getElementById(txtCheckBoxFirstName+i).checked = false;
			}
	objCheckHeader.checked = false;
	return true;
}
</script>
                    <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">
                                <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';
Paging_CheckedThisItem(document.myForm.CheckBoxAll, StatusIndex ,'CheckBoxID', document.myForm.TotalCheckBoxID.value );
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="95%" height="22" border="0" cellpadding="2" cellspacing="0">
                      <form action="?" method="post" name="myHeaderButton" id="myHeaderButton" onSubmit="return false;">
                        <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                        <tr valign="bottom"> 
                          <td> <table border="0" cellspacing="0" cellpadding="2">
                              <tr> 
							  <? if($System_Session_Permission[$SystemMenuID]=="RW" ){ ?>
                                <td><input name="btAdd" type="button" class="button_80" id="btAdd" value="Add New" onClick="
document.myForm.action.value='add';
document.myForm.submit();
				"></td>
				<? } ?>
                                <td><input name="btView" type="button" class="button_60" id="btView" onClick="
if(Paging_CountChecked('CheckBoxID',document.myForm.TotalCheckBoxID.value)==1) {
	document.myForm.action.value='view';
	document.myForm.submit();
} else {
	alert('Please checked 1 item to view this record.');
}
				  " value="View"></td>  
				  <? if($System_Session_Permission[$SystemMenuID]=="RW" ){ ?>
                                <td><input name="btEdit" type="button" class="button_60" id="btEdit" onClick="
if(Paging_CountChecked('CheckBoxID',document.myForm.TotalCheckBoxID.value)==1) {
	document.myForm.action.value='edit';
	document.myForm.submit();
} else {
	alert('Please checked 1 item to edit this record.');
}
				  " value="Edit"></td>
                                <td><input name="btDelete" type="button" class="button_60" id="btDelete" onClick="
if(Paging_CountChecked('CheckBoxID',document.myForm.TotalCheckBoxID.value)>0) {
	if(confirm('Are you sure to delete selected record?')) {
		document.myForm.action.value='delete';
		document.myForm.submit();
	}
} else {
	alert('Please checked 1 or more item to delete record.');
}
				  " value="Delete"></td>
				  <? } ?>
                              </tr>
                            </table></td>
                        </tr>
                      </form>
            </table>
                    <table width="95%" height="26" border="0" cellpadding="0" cellspacing="0" class="table_toolbar">
                      <form action="?" method="post" name="myToolbarForm" id="myToolbarForm" onSubmit="return false;">
                        <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                        <tr> 
                          <td width="5" align="left" valign="top"> <img src="../images/bgborder1w.gif" width="5" height="5"></td>
                          <td valign="bottom"> <table border="0" cellpadding="2" cellspacing="0" class="toolbar">
                              <tr> 
                                <td width="10">&nbsp;</td>
                                <td>Page</td>
                                <td> 
                                  <? 
				  if($NoOfPage>1) { 
				  ?>
                                  <select name="toolbarPageShow" class="select" onChange="document.myForm.PageShow.value=this.value; document.myForm.submit(); ">
                                    <? 
if($NoOfPage<$SystemModule_MaxPage) {
	// Show page list #########################
	for($i=1;$i<=$NoOfPage;$i++) { 
		echo "<option value=\"$i\"";
		if($i==$PageShow) { echo " selected"; }
		echo ">$i</option>";
	} 
}  else {
	// # If total page count greater than default max page  value then reduce page select size #########################
	$starti = $PageShow-$SystemModule_ReduceRange;
	if($starti<1) { $starti=1; }
	$endi = $PageShow+$SystemModule_ReduceRange;
	if($endi>$NoOfPage) { $endi=$NoOfPage; }
	//#####################
	for($i=$starti ;$i<=$endi;$i++) { 
		echo "<option value=\"$i\"";
		if($i==$PageShow) { echo " selected"; }
		echo ">$i</option>";
	} 
}
?>
                                  </select> 
                                  <? 
 } else { 
	echo "1";
 }
 ?>
                                </td>
                                <td>of <?=$NoOfPage?></td>
                                <td width="10">&nbsp;</td>
                                <td>Page size</td>
                                <td> <input name="toolbarPageSize" type="text" class="input_center" id="toolbarPageSize" value="<?=$PageSize?>" size="3" maxlength="3"></td>
                                <td> <input name="btChangePageSize" type="button" class="button_normal" id="btChangePageSize" value=" Go " onClick="
if(isNaN(document.myToolbarForm.toolbarPageSize.value*1)) {
	document.myToolbarForm.toolbarPageSize.value='<?=$PageSize?>';
	document.myToolbarForm.toolbarPageSize.focus();
	return false;
}
if(document.myToolbarForm.toolbarPageSize.value<=0) {
	document.myToolbarForm.toolbarPageSize.value='<?=$PageSize?>';
	document.myToolbarForm.toolbarPageSize.focus();
	return false;
}
document.myForm.PageSize.value=document.myToolbarForm.toolbarPageSize.value; 
document.myForm.submit(); 
				  "> </td>
                              </tr>
                            </table></td>
                          <td align="right" valign="bottom"> <table border="0" cellpadding="0" cellspacing="0">
                              <tr> 
                                <td>Found <?=$TotalRecordCount?> record</td>
                                <td width="10">&nbsp;</td>
                                <? if($PageShow>1) { ?>
                                <td width="21" align="center"> <img src="../images/controlpage/playset_start.gif" width="21" height="21" 
				  onMouseOver="this.src='../images/controlpage/playset_start_active.gif'; this.style.cursor='hand';" 
				  onMouseOut="this.src='../images/controlpage/playset_start.gif';" 
				  onClick="document.myForm.PageShow.value=1; document.myForm.submit();"></td>
                                <? } else { ?>
                                <td width="21" align="center"><img src="../images/controlpage/playset_start_disable.gif" width="21" height="21"></td>
                                <? } ?>
                                <? if($PageShow>1) { ?>
                                <td width="21" align="center"> <img src="../images/controlpage/playset_backward.gif" width="21" height="21" 
				  onMouseOver="this.src='../images/controlpage/playset_backward_active.gif'; this.style.cursor='hand';" 
				  onMouseOut="this.src='../images/controlpage/playset_backward.gif';" 
				  onClick="document.myForm.PageShow.value--; document.myForm.submit();"></td>
                                <? } else { ?>
                                <td width="21" align="center"><img src="../images/controlpage/playset_backward_disable.gif" width="21" height="21"></td>
                                <? } ?>
                                <td width="21" align="center"> <img src="../images/controlpage/playset_stop.gif" width="21" height="21" 
				  onMouseOver="this.src='../images/controlpage/playset_stop_active.gif'; this.style.cursor='hand';" 
				  onMouseOut="this.src='../images/controlpage/playset_stop.gif';" 
				  onClick="
					with(document.myForm) {
						PageShow.value='';
						PageSize.value='';
						ASCDESC.value='';
						OrderBy.value='';
						submit();
					}
					"></td>
                                <? if($PageShow<$NoOfPage) { ?>
                                <td width="21" align="center"> <img src="../images/controlpage/playset_forward.gif" width="21" height="21" 
				  onMouseOver="this.src='../images/controlpage/playset_forward_active.gif'; this.style.cursor='hand';" 
				  onMouseOut="this.src='../images/controlpage/playset_forward.gif';" 
				  onClick="document.myForm.PageShow.value++; document.myForm.submit();"></td>
                                <? } else { ?>
                                <td width="10" align="center"><img src="../images/controlpage/playset_forward_disable.gif" width="21" height="21"></td>
                                <? } ?>
                                <? if($PageShow<$NoOfPage) { ?>
                                <td width="10" align="center"><img src="../images/controlpage/playset_end.gif" width="21" height="21" 
				  onMouseOver="this.src='../images/controlpage/playset_end_active.gif'; this.style.cursor='hand';" 
				  onMouseOut="this.src='../images/controlpage/playset_end.gif';" 
				  onClick="document.myForm.PageShow.value='<?=$NoOfPage?>'; document.myForm.submit();"></td>
                                <? } else { ?>
                                <td width="10" align="center"><img src="../images/controlpage/playset_end_disable.gif" width="21" height="21"></td>
                                <? } ?>
                              </tr>
                            </table></td>
                          <td width="5" align="right" valign="top"><img src="../images/bgborder2w.gif" width="5" height="5"></td>
                        </tr>
                      </form>
            </table>
                    <table width="95%" border="0" cellpadding="0" cellspacing="1" class="table_border">
                      <tr> 
                        <td bgcolor="#FFFFFF"> <table width="100%" border="0" cellpadding="2" cellspacing="1">
                            <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="SelectStatus" type="hidden" id="SelectStatus">
                              <tr align="center" class="menu_table_header"> 
                                <td width="20" height="24" align="center"><input name="CheckBoxAll" type="checkbox" class="form_checkbox" id="CheckBoxAll" value="Yes" onClick="Paging_CheckAll(this,'CheckBoxID',document.myForm.TotalCheckBoxID.value)"></td>
                                <td width="30" height="24" align="center"> 
                                  <? 
$myOrderBy = $myModule_Table."_ID";
if($OrderBy==$myOrderBy) { 
	if($ASCDESC=="DESC") { ?>
                                  <img src="../images/controlpage/desc_order.gif" width="7" height="7"> 
                                  <? }
	if($ASCDESC=="ASC") { ?>
                                  <img src="../images/controlpage/asc_order.gif" width="7" height="7"> 
                                  <? }
} 
?>
                                  <a href="#" class="link_headbar" onClick="
with(document.myForm) { 
	<? if($OrderBy==$myOrderBy) { echo "action.value='switchorder';\n"; } ?>
	OrderBy.value='<?=$myOrderBy?>';
	submit(); 
}
					">No.</a></td>
                                <td width="108" height="24" align="center">Picture</td>
                                <td width="109" align="center"><? 
$myOrderBy = $myModule_Table."_Title";
if($OrderBy==$myOrderBy) { 
	if($ASCDESC=="DESC") { ?>
                                  <img src="../images/controlpage/desc_order.gif" width="7" height="7">
                                  <? }
	if($ASCDESC=="ASC") { ?>
                                  <img src="../images/controlpage/asc_order.gif" width="7" height="7">
                                  <? }
} 
?>
                                  <a href="#" class="link_headbar" onClick="
with(document.myForm) { 
	<? if($OrderBy==$myOrderBy) { echo "action.value='switchorder';\n"; } ?>
	OrderBy.value='<?=$myOrderBy?>';
	submit(); 
}
					">Title</a></td>
                                <td width="85" align="center">
                                  <? 
$myOrderBy = $myModule_Table."_StartDate";
if($OrderBy==$myOrderBy) { 
	if($ASCDESC=="DESC") { ?>
                                  <img src="../images/controlpage/desc_order.gif" width="7" height="7">
                                  <? }
	if($ASCDESC=="ASC") { ?>
                                  <img src="../images/controlpage/asc_order.gif" width="7" height="7">
                                  <? }
} 
?>
                                  <a href="#" class="link_headbar" onClick="
with(document.myForm) { 
	<? if($OrderBy==$myOrderBy) { echo "action.value='switchorder';\n"; } ?>
	OrderBy.value='<?=$myOrderBy?>';
	submit(); 
}
					"> Date Limit</a> / <br>
                                  <? 
$myOrderBy = $myModule_Table."_LastUpdate";
if($OrderBy==$myOrderBy) { 
	if($ASCDESC=="DESC") { ?>
                                  <img src="../images/controlpage/desc_order.gif" width="7" height="7">
                                  <? }
	if($ASCDESC=="ASC") { ?>
                                  <img src="../images/controlpage/asc_order.gif" width="7" height="7">
                                  <? }
} 
?>
                                  <a href="#" class="link_headbar" onClick="
with(document.myForm) { 
	<? if($OrderBy==$myOrderBy) { echo "action.value='switchorder';\n"; } ?>
	OrderBy.value='<?=$myOrderBy?>';
	submit(); 
}
					"> Last Update</a></td>
                                <td width="60" height="24" align="center"> 
                                  <? 
$myOrderBy = $myModule_Table."_Status";
if($OrderBy==$myOrderBy) { 
	if($ASCDESC=="DESC") { ?>
                                  <img src="../images/controlpage/desc_order.gif" width="7" height="7"> 
                                  <? }
	if($ASCDESC=="ASC") { ?>
                                  <img src="../images/controlpage/asc_order.gif" width="7" height="7"> 
                                  <? }
} 
?>
                                  <a href="#" class="link_headbar" onClick="
with(document.myForm) { 
	<? if($OrderBy==$myOrderBy) { echo "action.value='switchorder';\n"; } ?>
	OrderBy.value='<?=$myOrderBy?>';
	submit(); 
}
					">Status</a></td>
                                <td width="62" height="24" align="center">Action</td>
                              </tr>
                              <?
$index=1;
if($RecordCount>0) {
	while($index<$RecordCount+1) {
		if($myClassRow=="table_row1") { $myClassRow="table_row2"; } else { $myClassRow="table_row1";  }
		$Row=MYSQL_FETCH_ARRAY($Query);
		if($Row[$myModule_Table."_Width"]<380) { $imgWidth=$Row[$myModule_Table."_Width"]; } else { $imgWidth=380; }
		if($Row[$myModule_Table."_Height"]<80) { $imgHeight=$Row[$myModule_Table."_Height"]; } else { $imgHeight=80; }
	?>
                              <tr class="<?=$myClassRow?>" onMouseOver="this.className='table_rowover'" onMouseOut="this.className='<?=$myClassRow?>'"> 
                                <td height="24" align="center"> <input name="CheckBoxID<?=$index?>" type="checkbox" class="form_checkbox" id="CheckBoxID<?=$index?>" onClick="Paging_CheckAllHandle(document.myForm.CheckBoxAll,'CheckBoxID',document.myForm.TotalCheckBoxID.value)" value="<?=$Row[$myModule_Table."_ID"]?>"></td>
                                <td width="30" height="24" align="center"><?=$RecordStart+$index?></td>
                                <td height="24" align="center" valign="middle">
						<?
						if($Row[$myModule_Table."_PictureFileType"]=="swf") {
							?>
							  <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="205" height="60">
							    <param name="movie" value="<?=$myModule_Path_ThumbnailPicture?>/<?=$Row[$myModule_Table."_PictureFile"]?>">
							    <param name="quality" value="high">
							    <embed src="<?=$myModule_Path_ThumbnailPicture?>/<?=$Row[$myModule_Table."_PictureFile"]?>" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="205" height="60"></embed>
						      </object>
				    <?
						}else if($Row[$myModule_Table."_PictureFileType"]==""){ 
							echo "<table width=205 height=60 border=\"0\" cellpadding=\"0\" cellspacing=\"0\" ><tr><td>";
							if($Row[$myModule_Table."_HTMLCode"]!="") {
								echo $Row[$myModule_Table."_HTMLCode"];
							} else {
								echo "&nbsp;";
							}
							echo "</td></tr></table>";
					}else { ?>
								<img src="<?=$myModule_Path_ThumbnailPicture?>/<?=$Row[$myModule_Table."_PictureFile"]?> " height="60">
							<?
							}
						?></td>
                                <td height="24" align="center" valign="middle">&nbsp; <a href="#" onClick="
Paging_CheckedThisItem( document.myForm.CheckBoxAll, <?=$index?>, 'CheckBoxID', document.myForm.TotalCheckBoxID.value );
document.myForm.action.value='view';
document.myForm.submit();
								  " class="link_submenu"> <strong>
                                <?=$Row[$myModule_Table."_Title"]?>
                                </strong></a></td>
                                <td align="center" valign="middle">
                                  <table border="0" cellspacing="0" cellpadding="0">
                                    <? if(substr($Row[$myModule_Table."_StartDate"],0,10)!="0000-00-00") { ?>
                                    <tr>
                                      <td align="center">
                                        <?
									  echo "<font color=\"#000099\"><b>Date Start</b></font><br>&nbsp;&nbsp;";
									  echo DateDate($Row[$myModule_Table."_StartDate"]);
									  ?>
                                      </td>
                                    </tr>
                                    <? } ?>
                                    <? if(substr($Row[$myModule_Table."_ExpireDate"],0,10)!="0000-00-00") { ?>
                                    <tr>
                                      <td align="center">
                                        <?
									  echo "<font color=\"#000099\"><b>Date Expire</b></font><br>&nbsp;&nbsp;";
									  echo DateDate($Row[$myModule_Table."_ExpireDate"]);
									  ?>
                                      </td>
                                    </tr>
                                    <? } ?>
                                    <? if(substr($Row[$myModule_Table."_StartDate"],0,10)=="0000-00-00" && substr($Row[$myModule_Table."_ExpireDate"],0,10)=="0000-00-00") { ?>
                                    <tr>
                                      <td align="center">
                                        <?
									  echo "<font color=\"#000099\"><b>Date Limit</b></font><br>&nbsp;&nbsp;Always On";
									  ?>
                                      </td>
                                    </tr>
                                    <? } ?>
                                    <tr>
                                      <td align="center">
                                        <?
									  echo "<font color=\"#000099\"><b>Last Update</b></font><br>&nbsp;&nbsp;";
									  echo  ampmDate($Row[$myModule_Table."_LastUpdate"]);
									  ?>
                                      </td>
                                    </tr>
                                </table></td>
                                <td height="24" align="center"> <img src="../images/icon/ico442.gif" width="8" height="14">&nbsp; 
<font  color="#990000"><span onMouseOver="this.style.cursor='hand'" onClick="


if('<?=$Row[$myModule_Table."_Status"]?>'=='Enable') {
	document.myStatusForm.toolbarStatus[0].checked=true;
}
if('<?=$Row[$myModule_Table."_Status"]?>'=='Disable') {
	document.myStatusForm.toolbarStatus[1].checked=true;
}
StatusIndex = <?=$index?>;
ShowDataPicker('divDataPicker',-230,-150)
"> 
<?=$Row[$myModule_Table."_Status"]?>
</span></font>
</td>
                                <td height="24" align="center" valign="middle"> 
                                  <table border="0" cellspacing="0" cellpadding="1">
                                    <tr> 
                                      <td><img src="../images/icon/ico416.gif" alt="View" width="16" height="21" border="0" onMouseOver="this.style.cursor='hand'" onClick="
Paging_CheckedThisItem( document.myForm.CheckBoxAll, <?=$index?>, 'CheckBoxID', document.myForm.TotalCheckBoxID.value );
document.myForm.action.value='view';
document.myForm.submit();
						"></td>
                                      <td>&nbsp;<a href="#" onClick="
Paging_CheckedThisItem( document.myForm.CheckBoxAll, <?=$index?>, 'CheckBoxID', document.myForm.TotalCheckBoxID.value );
document.myForm.action.value='view';
document.myForm.submit();
						"></a>
						<? if($System_Session_Permission[$SystemMenuID]=="RW" ){ ?>
						<img src="../images/icon/ico425.gif" alt="Edit" width="16" height="16" border="0" onMouseOver="this.style.cursor='hand'" onClick="
	Paging_CheckedThisItem( document.myForm.CheckBoxAll, <?=$index?>, 'CheckBoxID', document.myForm.TotalCheckBoxID.value );
	document.myForm.action.value='edit';
	document.myForm.submit();

						"></td>
                                      <td><img src="../images/icon/ico417.gif" alt="Delete" width="16" height="16" border="0" onMouseOver="this.style.cursor='hand'" onClick="
if(confirm('Are you sure to delete selected record?')) {
	Paging_CheckedThisItem( document.myForm.CheckBoxAll, <?=$index?>, 'CheckBoxID', document.myForm.TotalCheckBoxID.value );
	document.myForm.action.value='delete';
	document.myForm.submit();
}
						"><? } ?></td>
                                    </tr>
                                </table></td>
                              </tr>
                              <?
		$index++;
	}
} else {  ?>
                              <tr class="table_row1"> 
                                <td height="80" colspan="7" align="center"> Data not found!</td>
                              </tr>
                              <? } ?>
                              <input name="TotalCheckBoxID" type="hidden" id="TotalCheckBoxID" value="<?=$index-1?>">
                            </form>
                          </table>
                          <table width="100%" height="24" border="0" cellpadding="3" cellspacing="0">
                            <form action="?" method="post" name="mySearchForm" id="mySearchForm" onSubmit="return false;">
                              <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                              <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                              <tr align="right"> 
								  <td colspan="4" align="right" class="table_footer">&nbsp;&nbsp;</td>
                              </tr>
                            </form>
                          </table></td>
                      </tr>
            </table>
                    <table width="95%" height="22" border="0" cellpadding="2" cellspacing="0">
                      <form action="?" method="post" name="myFooterButton" id="myFooterButton" onSubmit="return false;">
                        <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                        <tr> 
                          <td valign="top"><table border="0" cellspacing="0" cellpadding="2">
                              <tr>   
							  <? if($System_Session_Permission[$SystemMenuID]=="RW" ){ ?>
                                <td><input name="btAdd" type="button" class="button_80" id="btAdd" value="Add New" onClick="
document.myForm.action.value='add';
document.myForm.submit();
				"></td>
				<? } ?>
                                <td><input name="btView" type="button" class="button_60" id="btView" onClick="
if(Paging_CountChecked('CheckBoxID',document.myForm.TotalCheckBoxID.value)==1) {
	document.myForm.action.value='view';
	document.myForm.submit();
} else {
	alert('Please checked 1 item to view this record.');
}
				  " value="View"></td>  
				  <? if($System_Session_Permission[$SystemMenuID]=="RW" ){ ?>
                                <td><input name="btEdit" type="button" class="button_60" id="btEdit" onClick="
if(Paging_CountChecked('CheckBoxID',document.myForm.TotalCheckBoxID.value)==1) {
	document.myForm.action.value='edit';
	document.myForm.submit();
} else {
	alert('Please checked 1 item to edit this record.');
}
				  " value="Edit"></td>
                                <td><input name="btDelete" type="button" class="button_60" id="btDelete" onClick="
if(Paging_CountChecked('CheckBoxID',document.myForm.TotalCheckBoxID.value)>0) {
	if(confirm('Are you sure to delete selected record?')) {
		document.myForm.action.value='delete';
		document.myForm.submit();
	}
} else {
	alert('Please checked 1 or more item to delete record.');
}
				  " value="Delete"></td>  
				  <? } ?>
                              </tr>
                            </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>
<? 
include("../lib/disconnect.php");
?>

Hacked By AnonymousFox1.0, Coded By AnonymousFox