Hacked By AnonymousFox

Current Path : C:/AppServ/www/new_msd2/webengine/mod_s2/
Upload File :
Current File : C:/AppServ/www/new_msd2/webengine/mod_s2/_index.php

<? 
include("../lib/session.php"); 
include("../lib/config.php");
include("../lib/connect.php");
include("../lib/function.php");
?>
<html><!-- InstanceBegin template="/Templates/WebEngine-Adminpanel.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>Web Engine : 
<?=$System_Variable_Title?>
</title>
<!-- InstanceEndEditable --> 
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">

<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
<link href="../css/mystyle.css" rel="stylesheet" type="text/css">
</head>

<body  leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<div align="center">
  <?
if($action=="setlanguage") {
	$System_Session_Language=$language;
	$action="";
}
?>
<table  border="0" align="center" cellpadding="0" cellspacing="0">
    <tr> 
      <td width="7" valign="top" background="../../images/web/bg-blue-shadow-left.gif">&nbsp;</td>
      <td width="778" align="center" valign="top" bgcolor="#FFFFFF"><img src="../images/topgraphic.gif" width="778" height="192"></td>
      <td width="7" valign="top" background="../../images/web/bg-blue-shadow-right.gif">&nbsp;</td>
    </tr>
  </table>
  <table height="100" width="770" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr> 
      <td  align="center" valign="top" bgcolor="#FFFFFF"><table width="100%" height="400" border="0" cellpadding="0" cellspacing="0">
         <tr>
            <td colspan="3" align="left" valign="bottom" height="5"></td>
          </tr>
		 <tr>
            <td width="113" align="left" valign="top" bgcolor="#EEEEEE"><img src="../images/bgborder1w.gif" width="5" height="5"></td>
            <td width="61" align="right" valign="top" bgcolor="#EEEEEE"><img src="../images/bgborder2w.gif" width="5" height="5"></td>
          </tr>
		  <tr>
            <td colspan="2" align="center" valign="top" bgcolor="#EEEEEE"><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> 
              <? } ?>
              <font color="#990000"><strong>Language : 
              <?=$System_Session_Language?>
              <br>
              <br>
              </strong></font><strong> </strong> <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr> 
                  <td height="22" align="center" class="menu_table_header">Administrator 
                    Login</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="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 colspan="2"><font color="#990000"><strong>UserName</strong></font></td>
                        </tr>
                        <tr> 
                          <td width="10">&nbsp;</td>
                          <td> <input name="inputUserName" type="text" class="input_left" id="inputUserName" size="15" maxlength="50"></td>
                        </tr>
                        <tr> 
                          <td colspan="2"><font color="#990000"><strong>Password</strong></font></td>
                        </tr>
                        <tr> 
                          <td width="10">&nbsp;</td>
                          <td><input name="inputPassword" type="password" class="input_left" id="inputPassword" size="15" maxlength="50"></td>
                        </tr>
                        <tr> 
                          <td width="10">&nbsp;</td>
                          <td align="right"><input name="Submit" type="submit" class="button_th_normal" value="LogIn"></td>
                        </tr>
                      </table>
                    </form></td>
                </tr>
              </table>
              <? } else { ?>
              <font color="#990000"><strong>Language : 
              <?=$System_Session_Language?>
              <br>
              <br>
              </strong></font><strong> </strong> <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <form action="?" method="get" name="myMenuForm" id="myMenuForm">
                  <input type="hidden" name="SystemMenuID">
                  <input type="hidden" name="SystemModuleKey">
                </form>
                <tr> 
                  <td height="22" align="center" class="menu_table_header">Main 
                    Menu</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="24" 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_shadow"><img src="../../images/blank.gif" width="1" height="1"></td>
                </tr>
                <? if($System_Session_User_ID==0) { ?>
                <tr> 
                  <td height="1" class="menu_table_bg_hilight"><img src="../../images/blank.gif" width="1" height="1"></td>
                </tr>
                <tr> 
                  <td height="24" class="menu_table_bg_normal" onMouseOver="this.className='menu_table_bg_over'; " onMouseOut="this.className='menu_table_bg_normal'; " onClick="document.myMenuForm.action='../system/module_management.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/ico509.gif" width="16" height="13"></td>
                        <td>Menu Bulider</td>
                      </tr>
                    </table></td>
                </tr>
                <tr> 
                  <td height="1" class="menu_table_bg_shadow"><img src="../../images/blank.gif" width="1" height="1"></td>
                </tr>
                <? } ?>
                <? if($System_Session_User_ID>0) { ?>
                <tr> 
                  <td height="1" class="menu_table_bg_hilight"><img src="../../images/blank.gif" width="1" height="1"></td>
                </tr>
                <tr> 
                  <td height="24" 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.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/ico559.gif" width="15" height="16"></td>
                        <td>User Information</td>
                      </tr>
                    </table></td>
                </tr>
                <tr> 
                  <td height="1" class="menu_table_bg_shadow"><img src="../../images/blank.gif" width="1" height="1"></td>
                </tr>
                <? } ?>
                <? if($System_Session_Level=="Admin") { ?>
                <tr> 
                  <td height="1" class="menu_table_bg_hilight"><img src="../../images/blank.gif" width="1" height="1"></td>
                </tr>
                <tr> 
                  <td height="24" 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.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/ico051.gif" width="13" height="19"></td>
                        <td>Manage User Admin</td>
                      </tr>
                    </table></td>
                </tr>
                <tr> 
                  <td height="1" class="menu_table_bg_shadow"><img src="../../images/blank.gif" width="1" height="1"></td>
                </tr>
                <? } ?>
                <!---------------------------------------------------------------------------->
                <? if($System_Session_User_ID>0) { ?>
                <?
$sql = "SELECT * FROM ".$System_TableName_Menu." WHERE ".$System_TableName_Menu."_Status='Enable' 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);
		//if( isUserOnMenu($System_Session_User_ID,$Row[$System_TableName_Menu."_ID"]) ) {
		?>
		<?
		if($System_Session_Permission[$Row[$System_TableName_Menu."_ID"]] !="Hide"){
		?>
                <tr> 
                  <td height="1" class="menu_table_bg_hilight"><img src="../../images/blank.gif" width="1" height="1"></td>
                </tr>
                <tr> 
                  <td height="24" class="<? if ($SystemMenuID==$Row[$System_TableName_Menu."_ID"]) { ?>menu_table_bg_over<? } else { ?>menu_table_bg_normal<? } ?>" onMouseOver="this.className='menu_table_bg_over'; " onMouseOut="this.className='<? if ($SystemMenuID==$Row[$System_TableName_Menu."_ID"]) { ?>menu_table_bg_over<? } else { ?>menu_table_bg_normal<? } ?>'; " onClick="
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="24" border="0" cellpadding="2" cellspacing="0" class="menu_table_text">
                      <tr> 
                        <td width="22" align="center"><img src="<?=$Row[$System_TableName_Menu."_Icon"]?>"></td>
                        <td> 
                          <?=$Row[$System_TableName_Menu."_Name"]?>
                        </td>
                      </tr>
                    </table></td>
                </tr>
                <tr> 
                  <td height="1" class="menu_table_bg_shadow"><img src="../../images/blank.gif" width="1" height="1"></td>
                </tr>
                <? 
				}
		//}
		$index++;
	}
}
?>
                <? } ?>
                <!---------------------------------------------------------------------------->
                <tr> 
                  <td height="1" class="menu_table_bg_hilight"><img src="../../images/blank.gif" width="1" height="1"></td>
                </tr>
                <tr> 
                  <td height="24" 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="24" border="0" cellpadding="2" cellspacing="0" class="menu_table_text">
                      <tr> 
                        <td width="22" align="center"><img src="../images/icon/ico569.gif" width="13" height="13"></td>
                        <td>Logout</td>
                      </tr>
                    </table></td>
                </tr>
                <tr> 
                  <td height="1" class="menu_table_bg_shadow"><img src="../../images/blank.gif" width="1" height="1"></td>
                </tr>
              </table>
              <? } ?>
              <!--End Menu ----------------------------------------------------------------------------------->
            <br> <br> </td>
            <td width="596" rowspan="2" align="center" valign="top"><br>
              <? if(strlen($System_Session_User_ID)>0) { ?>
              <!-- InstanceBeginEditable name="Programmable Region" -->
	   
                  <br>
                  <table width="95%" height="22" border="0" cellpadding="2" cellspacing="0" class="table_header">
                    <tr> 
                      <td width="30" align="center"><img src="<?=getMenuIcon($SystemMenuID)?>"></td>
                      <td>
                        <?=getMenuName($SystemMenuID)?>
                        &nbsp;
                        <script type="text/javascript" src="lib/calendar.js"></script></td>
                    </tr>
                  </table>
				  <table width="95%" border="0" cellpadding="0" cellspacing="0">
              <form action="?" method="post" name="myPageRedirectForm" id="myPageRedirectForm">
                  <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                  <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                  
                </form>
            </table>
				  <script language="JavaScript" src="../lib/popup.js" type="text/JavaScript"></script>
                  <br>
                  <? 
## Load Module Configuration Variable ############################################

include("config.php");

## Default Value ############################################
$SystemModule_defaultPageSize = 10;
$SystemModule_defaultPageShow = 1;
$SystemModule_MaxPage = 20;
$SystemModule_ReduceRange = 10; 		// +,- from current page show
$SystemModule_ASCDESC = "DESC";
//$myModule_Table = $myModule_Table1;
$SystemModule_OrderBy = $myModule_Table."_ID";
#########################################################
?>
<script language="JavaScript" src="../lib/popup.js" type="text/JavaScript"></script>
                  <!-- import the calendar script -->
                  <link rel="stylesheet" type="text/css" href="../css/myCalendarStyle.css">
                  <script type="text/javascript" src="lib/lang/calendar-th.js"></script>
                  <script type="text/javascript" src="lib/loadcalendar.js"></script>
                  <!-- end the calendar script -->
<? 
if($action=="checkuser"){
	$sql="SELECT ".$myModule_Table."_User FROM ".$myModule_Table." WHERE ".$myModule_Table."_User='".$inputUser."'" ;
	$query=mysql_query($sql);
	if($row=mysql_fetch_array($query)){
?>		
	<script language="javascript">
		alert("ชื้อผู้ใช้ นี้มีอยู่แล้วในระบบ กรุณากรอกใหม่");
	</script>
<?		
		$action = "add";
	}else{
		$action = "addnew";
	}
	
}
####################################################################
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);
	
	$inputUser = $Row[$myModule_Table."_User"];
	$inputPrefix = $Row[$myModule_Table."_Prefix"];
	$inputFName = $Row[$myModule_Table."_FName"];
	$inputLName = $Row[$myModule_Table."_LName"];
	$inputNickName = $Row[$myModule_Table."_NickName"];
	$inputEmail = $Row[$myModule_Table."_Email"];
	$inputOccupationID = $Row[$myModule_Table."_OccupationID"];
	$inputOccupation = $Row[$myModule_Table."_Occupation"];
	$inputBusinessTypeID = $Row[$myModule_Table."_BusinessTypeID"];
	$inputBusinessType = $Row[$myModule_Table."_BusinessType"];
	$inputPosition = $Row[$myModule_Table."_Position"];
	$inputQuestion = $Row[$myModule_Table."_Question"];
	$inputAnswer = $Row[$myModule_Table."_Answer"];
	$inputAlias = $Row[$myModule_Table."_Alias"];
	$inputComment = $Row[$myModule_Table."_Comment"];
	$inputAddress1 = $Row[$myModule_Table."_Address1"];
	$inputAddress2 = $Row[$myModule_Table."_Address2"];
	$inputDistrict = $Row[$myModule_Table."_District"];
	$inputProvinceID = $Row[$myModule_Table."_ProvinceID"];
	$inputPostcode = $Row[$myModule_Table."_Postcode"];
	$inputMobile = $Row[$myModule_Table."_Mobile"];
	$inputEnableSMSNews = $Row[$myModule_Table."_EnableSMSNews"];
	$inputTelephone = $Row[$myModule_Table."_Telephone"];
	$inputFax = $Row[$myModule_Table."_Fax"];
	$inputCompany_Name = $Row[$myModule_Table."_Company_Name"];
	$inputCompany_BusinessTypeID = $Row[$myModule_Table."_Company_BusinessTypeID"];
	$inputCompany_BusinessType = $Row[$myModule_Table."_Company_BusinessType"];
	$inputCompany_Address1 = $Row[$myModule_Table."_Company_Address1"];
	$inputCompany_Address2 = $Row[$myModule_Table."_Company_Address2"];
	$inputCompany_District = $Row[$myModule_Table."_Company_District"];
	$inputCompany_ProvinceID = $Row[$myModule_Table."_Company_ProvinceID"];
	$inputCompany_Postcode = $Row[$myModule_Table."_Company_Postcode"];
	$inputCompany_Telephone = $Row[$myModule_Table."_Company_Telephone"];
	$inputCompany_Fax = $Row[$myModule_Table."_Company_Fax"];
	$inputCompany_Website = $Row[$myModule_Table."_Company_Website"];
	
	$BirthArr=explode('-',$Row[$myModule_Table."_BirthDate"]);
	$inputDate=$BirthArr[2];
	$inputMonth=$BirthArr[1];
	$inputYear=$BirthArr[0];
	
	$inputBirthDate = $Row[$myModule_Table."_BirthDate"];
	?>
                  <br>
                  <table width="90%" border="0" cellpadding="0" cellspacing="0">
                    <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?>">
                      <input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>">
                    </form>
                    <form action="?" method="post" name="myForm" id="myForm">
                      <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                      <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                      <input name="action" type="hidden" id="action" value="edit">
                      <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>">
                      <input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>">
                      <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>">
                      <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>">
                      <input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>">
                      <input name="CheckBoxID1" type="hidden" id="CheckBoxID1" value="<?=$myCheckBoxID?>">
                      <input name="TotalCheckBoxID" type="hidden" id="TotalCheckBoxID" value="1">
                      <tr> 
                        <td  bgcolor="#FFFFFF" class="table_col2"> <table width="100%" border="0" cellpadding="2" cellspacing="1">
                            <tr> 
                              <td height="24" colspan="2" align="center" class="menu_table_header">View 
                                <?=getMenuName($SystemMenuID)?>
                              </td>
                            </tr>
                          </table>
						<table width="100%" border="0"  cellpadding="0" cellspacing="1">
                              <tr> 
                                <td> <table width="100%" border="0" cellpadding="2" cellspacing="1" class="table_border">
                                  <tr>
                                    <td height="22" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../../webengine/images/bullet/box21.gif" width="11" height="11">&nbsp;&nbsp;ข้อมูลระบบ</td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1"> ชื่อผู้ใช้ &nbsp;</td>
                                    <td height="22" class="table_col2">
                                      <?=$inputUser?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1"> รหัสผ่าน *&nbsp;</td>
                                    <td height="22" class="table_col2"> &lt;&lt; hidden &gt;&gt; </td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1"> คำถามกันลืม *&nbsp;</td>
                                    <td height="22" class="table_col2"><?=$inputQuestion?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1"> คำตอบกันลืม *&nbsp;</td>
                                    <td height="22" class="table_col2"> &lt;&lt; hidden &gt;&gt;
                                    </td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1"> นามแฝง *&nbsp;</td>
                                    <td height="22" class="table_col2"><?=$inputAlias?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1"> คำแนะนำตัวสั้น &nbsp;</td>
                                    <td height="22" class="table_col2"><?=$inputComment?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../../webengine/images/bullet/box21.gif" width="11" height="11">&nbsp;&nbsp;ข้อมูลส่วนตัว</td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1"> คำนำหน้า *&nbsp;</td>
                                    <td height="22" class="table_col2"><?=$inputPrefix?></td>
                                  </tr>
                                  <tr>
                                    <td width="31%" height="22" align="right" class="table_col1"> ชื่อ *&nbsp;</td>
                                    <td width="72%" height="22" class="table_col2"><?=$inputFName?></td>
                                  </tr>
                                  <tr>
                                    <td width="31%" height="22" align="right" class="table_col1">นามสกุล *&nbsp; </td>
                                    <td width="72%" height="22" class="table_col2"><?=$inputLName?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">ชื่อเล่น &nbsp; </td>
                                    <td height="22" class="table_col2"><?=$inputNickName?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">Email *&nbsp; </td>
                                    <td height="22" class="table_col2"><?=$inputEmail?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">วันเกิด &nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><? if ($inputBirthDate<>"0000-00-00") echo ShowDateLong($inputBirthDate); ?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../../webengine/images/bullet/box21.gif" width="11" height="11">&nbsp;&nbsp;ข้อมูลการทำงาน</td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">อาชีพ&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><?
									  if ($inputOccupationID>0) {
										  $sql = "SELECT * FROM ".$System_TableName_Occupation." WHERE ".$System_TableName_Occupation."_ID=".$inputOccupationID;
										  $Query_Occupation = mysql_query($sql);
										  $Row_Occupation = mysql_fetch_array($Query_Occupation);
										  echo $Row_Occupation[$System_TableName_Occupation."_Name".$System_Session_Language];
									  }
									  ?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">อาชีพอื่นๆ&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><?=$inputOccupation?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">ประเภทธุรกิจ&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><?
									  if ($inputBusinessTypeID>0) {
										  $sql = "SELECT * FROM ".$System_TableName_BusinessType." WHERE ".$System_TableName_BusinessType."_ID=".$inputBusinessTypeID;
										  $Query_BusinessType = mysql_query($sql);
										  $Row_BusinessType = mysql_fetch_array($Query_BusinessType);
										  echo $Row_BusinessType[$System_TableName_BusinessType."_Name".$System_Session_Language];
									  }
									  ?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">ประเภทอื่นๆ&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><?=$inputBusinessType?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">ตำแหน่ง&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><?=$inputPosition?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../../webengine/images/bullet/box21.gif" width="11" height="11">&nbsp;&nbsp;ข้อมูลที่อยู่ปัจจุบัน</td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">ที่อยู่&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><?=$inputAddress1?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">&nbsp;</td>
                                    <td height="22" class="table_col2"><?=$inputAddress2?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">อำเภอ/เขต&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><?=$inputDistrict?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">จังหวัด&nbsp;&nbsp;</td>
                                    <td class="table_col2"><?
									  if ($inputProvinceID>0) {
										  $sql = "SELECT * FROM ".$System_TableName_Province." WHERE ".$System_TableName_Province."_ID=".$inputProvinceID;
										  $Query_Province = mysql_query($sql);
										  $Row_Province = mysql_fetch_array($Query_Province);
										  echo $Row_Province[$System_TableName_Province."_Name".$System_Session_Language];
									  }
									  ?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">รหัสไปรษณีย์ &nbsp; </td>
                                    <td height="22" class="table_col2"><?=$inputPostcode?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">โทรศัพท์มือถือ&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><?=$inputMobile?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">&nbsp;</td>
                                    <td height="22" class="table_col2"> ต้องการรับข่าวสารจาก JigsawOffice.com ผ่านทาง SMS ฟรี หรือไม่ ? </td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">&nbsp; </td>
                                    <td height="22" class="table_col2"><? if ($inputEnableSMSNews=="" || $inputEnableSMSNews=="1") { ?><img src="../../webengine/images/bullet/p_true.gif"><? } else { ?><img src="../../webengine/images/bullet/ico268_dot.gif"><? } ?>
									ต้องการรับ
									<? if ($inputEnableSMSNews=="0") { ?><img src="../../webengine/images/bullet/p_true.gif"><? } else { ?><img src="../../webengine/images/bullet/ico268_dot.gif"><? } ?>
									ไม่ต้องการรับ</td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">โทรศัพท์บ้าน &nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><?=$inputTelephone?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">โทรสาร&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><?=$inputFax?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../../webengine/images/bullet/box21.gif" width="11" height="11">&nbsp;&nbsp;ข้อมูลสถานที่ทำงาน</td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">ชื่อบริษัท&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><?=$inputCompany_Name?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">ประเภทธุรกิจ&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><?
									  if ($inputCompany_BusinessTypeID>0) {
										  $sql = "SELECT * FROM ".$System_TableName_BusinessType." WHERE ".$System_TableName_BusinessType."_ID=".$inputCompany_BusinessTypeID;
										  $Query_BusinessType = mysql_query($sql);
										  $Row_BusinessType = mysql_fetch_array($Query_BusinessType);
										  echo $Row_BusinessType[$System_TableName_BusinessType."_Name".$System_Session_Language];
									  }
									  ?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">ที่อยู่&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><?=$inputCompany_Address1?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">&nbsp;</td>
                                    <td height="22" class="table_col2"><?=$inputCompany_Address2?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">อำเภอ/เขต&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><?=$inputCompany_District?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">จังหวัด&nbsp;&nbsp;*</td>
                                    <td class="table_col2"><?
									  if ($inputCompany_ProvinceID>0) {
										  $sql = "SELECT * FROM ".$System_TableName_Province." WHERE ".$System_TableName_Province."_ID=".$inputCompany_ProvinceID;
										  $Query_Province = mysql_query($sql);
										  $Row_Province = mysql_fetch_array($Query_Province);
										  echo $Row_Province[$System_TableName_Province."_Name".$System_Session_Language];
									  }
									  ?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">รหัสไปรษณีย์ *&nbsp; </td>
                                    <td height="22" class="table_col2"><?=$inputCompany_Postcode?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">โทรศัพท์&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><?=$inputCompany_Telephone?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">โทรสาร&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><?=$inputCompany_Fax?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">เวบไซต์&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><?=$inputCompany_Website?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../../webengine/images/bullet/box21.gif" width="11" height="11">&nbsp;&nbsp;ข้อมูลรูปภาพ</td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">รูปภาพ&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><table border="0" cellspacing="0" cellpadding="2">
										  <tr>
											<td width="120" valign="middle"><img src="<? if ($Row[$myModule_Table."_FullPhoto"]<>"" && file_exists($myModule_Path_ThumbnailPicture."/".$Row[$myModule_Table."_FullPhoto"])) { ?><?=$myModule_Path_ThumbnailPicture."/".$Row[$myModule_Table."_FullPhoto"]?><? } else { ?>../../webengine/images/blank.gif<? } ?>" name="PreviewImage_FullPhoto" id="PreviewImage_FullPhoto"></td>
											<td align="right"><div id="PreviewImageText_FullPhoto">&nbsp;</div></td>
										  </tr>
									  </table></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">รูปภาพขนาดเล็ก&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><table border="0" cellspacing="0" cellpadding="2">
										  <tr>
											<td width="120" valign="middle"><img src="<? if ($Row[$myModule_Table."_ThumbnailPhoto"]<>"" && file_exists($myModule_Path_ThumbnailPicture."/".$Row[$myModule_Table."_ThumbnailPhoto"])) { ?><?=$myModule_Path_ThumbnailPicture."/".$Row[$myModule_Table."_ThumbnailPhoto"]?><? } else { ?>../../webengine/images/blank.gif<? } ?>" name="PreviewImage_ThumbnailPhoto" id="PreviewImage_ThumbnailPhoto"></td>
											<td align="right"><div id="PreviewImageText_ThumbnailPhoto">&nbsp;</div></td>
										  </tr>
									  </table></td>
                                  </tr>
                                  <tr>
                                    <td height="22" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../../webengine/images/bullet/box21.gif" width="11" height="11">&nbsp;&nbsp;ข้อมูลอื่นๆ</td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">สร้างโดย&nbsp; </td>
                                    <td height="22" class="table_col2">
                                      <?=$Row[$myModule_Table."_CreateBy"]?>
                                    </td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">วันที่สร้าง&nbsp; </td>
                                    <td height="22" class="table_col2">
                                      <?=$Row[$myModule_Table."_CreateDate"]?>
                                    </td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">แก้ไขโดย&nbsp; </td>
                                    <td height="22" class="table_col2">
                                      <?=$Row[$myModule_Table."_CreateBy"]?>
                                    </td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">วันที่แก้ไขล่าสุด&nbsp; </td>
                                    <td height="22" class="table_col2">
                                      <?=$Row[$myModule_Table."_LastUpdate"]?>
                                    </td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">สถานะการยืนยัน&nbsp; </td>
                                    <td height="22" class="table_col2">
                                      <?
									  if ($Row[$myModule_Table."_Activate"]==0) echo "ยังไม่ได้ยืนยันการเป็นสมาชิก";
									  else echo "ยืนยันการเป็นสมาชิกแล้ว";
									  ?>
                                    </td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">สถานะ&nbsp; </td>
                                    <td height="22" class="table_col2">
                                      <?=$Row[$myModule_Table."_Status"]					?>
                                    </td>
                                  </tr>
                                </table></td>
                              </tr>
                          </table>
                          <table width="100%" height="24" border="0" cellpadding="3" cellspacing="0">
                            <tr align="right"> 
                              <td height="30" colspan="4" align="center" class="table_footer"> 
                                <table width="300" border="0" cellspacing="0" cellpadding="2">
                                  <tr align="center"> 
<? if($System_Session_Permission[$SystemMenuID]=="Write" ||  $System_Session_Permission[$SystemMenuID]=="Manage"){ ?>
                                    <td><input name="btEdit" type="button" class="button_80" id="btEdit" value="Edit" onClick="
document.myForm.action.value='edit';
document.myForm.submit();
						"> </td>
<? }?>
                                  <td> <input name="btCalcel" type="button" class="button_80" id="btCalcel" onClick="

	document.myReturnForm.submit();

						" value="Back"> </td>
                                  </tr>
                                </table></td>
                            </tr>
                          </table></td>
                      </tr>
                    </form>
                  </table>
                  <br>
              
                  <br>
<script language="JavaScript">
HideCheckBox();
function HideCheckBox() {
	for( i =0; i < document.myForm.elements.length; i++ ) {
			//  hide check box
			if( document.myForm.elements[ i ].type.toLowerCase( ) == "checkbox" ) {
				document.myForm.elements[ i ].disabled=true;
			}
	}
}
</script>				  
                  <? 
####################################################################
 } else if($action=="add") { 
	?>
                  <br>
                  <table width="90%" border="0" cellpadding="0" cellspacing="0" >
                    <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?>">
                      <input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>">
                    </form>
                    <form action="?" method="post" enctype="multipart/form-data" name="myForm" id="myForm">
                      <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                      <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                      <input name="action" type="hidden" id="action" value="checkuser">
                     <input name="inputInformation" type="hidden" id="inputInformation" >
                      <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>">
                      <input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>">
                      <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>">
                      <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>">
                      <input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>">
                      <tr> 
                        <td bgcolor="#FFFFFF" class="table_col2"> <table width="100%" border="0"  cellpadding="0" cellspacing="1">
                            <tr> 
                              <td height="24" colspan="2" align="center" class="menu_table_header">Add 
                                New     <?=getMenuName($SystemMenuID)?></td>
                            </tr>
                          </table>
                          <table width="100%" border="0"  cellpadding="0" cellspacing="1">
                              <tr> 
                                <td> <table width="100%" border="0" cellpadding="2" cellspacing="1" class="table_border">
								<tr> 
                                      <td height="22" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../../webengine/images/bullet/box21.gif" width="11" height="11">&nbsp;&nbsp;ข้อมูลระบบ</td>
                                  </tr>

									<tr> 
                                      <td height="22" align="right" class="table_col1"> ชื่อผู้ใช้ *&nbsp;</td>
                                      <td height="22" class="table_col2"> <input name="inputUser" type="text" class="input_left" id="inputUser" size="20"  maxlength="30" value="<?=$inputUser?>"></td>
                                    </tr>
									<tr> 
                                      <td height="22" align="right" class="table_col1"> รหัสผ่าน *&nbsp;</td>
                                      <td height="22" class="table_col2"> <input name="inputPass" type="password" class="input_left" id="inputPass" size="20"  maxlength="30" >
                                      &nbsp;&nbsp;* ความยาวอย่างน้อย 4 ตัวอักษร </td>
                                    </tr>
									<tr> 
                                      <td height="22" align="right" class="table_col1">                                       ใส่รหัสผ่านอีกครั้ง *&nbsp;</td>
                                      <td height="22" class="table_col2"> <input name="inputConfirm" type="password" class="input_left" id="inputConfirm" size="20"  maxlength="30" ></td>
                                    </tr>
									<tr>
                                      <td height="22" align="right" class="table_col1"> คำถามกันลืม *&nbsp;</td>
                                      <td height="22" class="table_col2">
                                        <input name="inputQuestion" type="text"   class="input_left" id="inputQuestion" value="<?=$inputQuestion?>" size="40" maxlength="100" >
                                      </td>
								  </tr>
									<tr>
                                      <td height="22" align="right" class="table_col1"> คำตอบกันลืม *&nbsp;</td>
                                      <td height="22" class="table_col2">
                                        <input name="inputAnswer" type="text"   class="input_left" id="inputAnswer" value="<?=$inputAnswer?>" size="40" maxlength="100" >
                                      </td>
								  </tr>
									<tr>
                                      <td height="22" align="right" class="table_col1"> นามแฝง *&nbsp;</td>
                                      <td height="22" class="table_col2">
                                        <input name="inputAlias" type="text"   class="input_left" id="inputAlias" value="<?=$inputAlias?>" size="30" maxlength="50" >
                                      </td>
								  </tr>
									<tr>
                                      <td height="22" align="right" class="table_col1"> คำแนะนำตัวสั้น &nbsp;</td>
                                      <td height="22" class="table_col2">
                                        <input name="inputComment" type="text"   class="input_left" id="inputComment" value="<?=$inputComment?>" size="30" maxlength="100" >
                                      </td>
								  </tr>
                                    <tr> 
                                      <td height="22" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../../webengine/images/bullet/box21.gif" width="11" height="11">&nbsp;&nbsp;ข้อมูลส่วนตัว</td>
                                    </tr>
                                    <tr>
                                      <td height="22" align="right" class="table_col1"> คำนำหน้า *&nbsp;</td>
                                      <td height="22" class="table_col2">
 <input name="inputPrefix" type="radio" value="นาย" <? if ($inputPrefix=="" || $inputPrefix=="นาย") { ?>checked<? } ?>>
 นาย 
 <input name="inputPrefix" type="radio" value="นาง" <? if ($inputPrefix=="นาง") { ?>checked<? } ?>>
 นาง 
 <input name="inputPrefix" type="radio" value="น.ส." <? if ($inputPrefix=="น.ส.") { ?>checked<? } ?>>
 น.ส. 
 <input name="inputPrefix" type="radio" value="ด.ช." <? if ($inputPrefix=="ด.ช.") { ?>checked<? } ?>>
 ด.ช. 
 <input name="inputPrefix" type="radio" value="ด.ญ." <? if ($inputPrefix=="ด.ญ.") { ?>checked<? } ?>>
 ด.ญ.
                                      </td>
                                    </tr>
                                    
                                    <tr> 
                                      <td width="31%" height="22" align="right" class="table_col1"> 
                                        ชื่อ *&nbsp;</td>
                                      <td width="72%" height="22" class="table_col2"> 
                                        <input name="inputFName" type="text"   class="input_left" id="inputFName" value="<?=$inputFName?>" size="30" maxlength="30" > 
                                        </td>
                                    </tr>
									<tr> 
                                      <td width="31%" height="22" align="right" class="table_col1">นามสกุล *&nbsp;
                                      </td>
                                      <td width="72%" height="22" class="table_col2"><input name="inputLName" type="text"   class="input_left" id="inputLName" value="<?=$inputLName?>" size="30" maxlength="30"></td>
                                    </tr>
									<tr>
                                      <td height="22" align="right" class="table_col1">ชื่อเล่น &nbsp; </td>
                                      <td height="22" class="table_col2"><input name="inputNickName" type="text"   class="input_left" id="inputNickName" value="<?=$inputNickName?>" size="30" maxlength="30"></td>
								  </tr>
									<tr>
                                      <td height="22" align="right" class="table_col1">Email *&nbsp; </td>
                                      <td height="22" class="table_col2"><input name="inputEmail" type="text"   class="input_left" id="inputEmail" value="<?=$inputEmail?>" size="30" maxlength="50"></td>
								  </tr>
									<tr> 
                                      <td height="22" align="right" class="table_col1">วันเกิด &nbsp;&nbsp;</td>
                                      <td height="22" class="table_col2">&nbsp;วัน&nbsp;&nbsp;
									  <select name="inputDate" class="select">
									  <? for($i=1;$i<=31;$i++){
									  			if ($i<10) $myi = "0".$i;
												else $myi = $i;
									  ?>
									  <option value="<?=$myi?>"><?=$myi?></option>
									  <? }?>
									  </select>&nbsp;&nbsp;เดือน&nbsp;&nbsp;
									  <select name="inputMonth" class="select">
									  <option value="01">มกราคม</option>
									  <option value="02">กุมภาพันธ์</option>
									  <option value="03">มีนาคม</option>
									  <option value="04">เมษายน</option>
									  <option value="05">พฤษภาคม</option>
									  <option value="06">มิถุนายน</option>
									  <option value="07">กรกฎาคม</option>
									  <option value="08">สิงหาคม</option>
									  <option value="09">กันยายน</option>
									  <option value="10">ตุลาคม</option>
									  <option value="11">พฤศจิกายน</option>
									  <option value="12">ธันวาคม</option>
                                      </select>&nbsp;&nbsp;ปี&nbsp;&nbsp;
									  <select name="inputYear" class="select">
									  <?
									   $currentYear =date(Y);
									   for($i=$currentYear-8;$i>=$currentYear-70;$i--) { ?>
									<option value="<?=$i?>"> 
									<?=$i+543?>
									</option>
									<? } ?>
                                      </select>
									  <? if($inputDate>0){?>
									 <script language="javascript">
									  document.myForm.inputDate.value='<?=$inputDate?>';
									  document.myForm.inputMonth.value='<?=$inputMonth?>';
									  document.myForm.inputYear.value='<?=$inputYear?>';
									  </script>
									  <? }?>
									  </td>
                                    </tr>
									<tr>
                                      <td height="22" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../../webengine/images/bullet/box21.gif" width="11" height="11">&nbsp;&nbsp;ข้อมูลการทำงาน</td>
								  </tr>
									<tr>
                                      <td height="22" align="right" class="table_col1">อาชีพ&nbsp;&nbsp;</td>
                                      <td height="22" class="table_col2"><select name="inputOccupationID" class="select" id="inputOccupationD">
                                        <?
										  $sql = "SELECT * FROM ".$System_TableName_Occupation." WHERE ".$System_TableName_Occupation."_Status='Enable' ORDER BY ".$System_TableName_Occupation."_ID";
										  $Query_Occupation = mysql_query($sql);
										  ?>
                                        <? while ($Row_Occupation = mysql_fetch_array($Query_Occupation)) { ?>
                                        <option value="<?=$Row_Occupation[$System_TableName_Occupation."_ID"]?>">
                                        <?=$Row_Occupation[$System_TableName_Occupation."_Name".$System_Session_Language]?>
                                        </option>
                                        <? } ?>
                                      </select>
                                        <? if($inputOccupationID>0){?>
                                        <script language="javascript">
	document.myForm.inputOccupationID.value='<?=$inputOccupationID?>';
	                                    </script>
                                        <? }?></td>
								  </tr>
									<tr>
                                      <td height="22" align="right" class="table_col1">อาชีพอื่นๆ&nbsp;&nbsp;</td>
                                      <td height="22" class="table_col2"><input name="inputOccupation" type="text" class="input_left" id="inputOccupation" value="<?=$inputOccupation?>" size="40" maxlength="100"></td>
								  </tr>
									<tr>
                                      <td height="22" align="right" class="table_col1">ประเภทธุรกิจ&nbsp;&nbsp;</td>
                                      <td height="22" class="table_col2"><select name="inputBusinessTypeID" class="select" id="inputBusinessTypenD">
                                        <?
										  $sql = "SELECT * FROM ".$System_TableName_BusinessType." WHERE ".$System_TableName_BusinessType."_Status='Enable' ORDER BY ".$System_TableName_BusinessType."_ID";
										  $Query_BusinessType = mysql_query($sql);
										  ?>
                                        <? while ($Row_BusinessType = mysql_fetch_array($Query_BusinessType)) { ?>
                                        <option value="<?=$Row_BusinessType[$System_TableName_BusinessType."_ID"]?>">
                                        <?=$Row_BusinessType[$System_TableName_BusinessType."_Name".$System_Session_Language]?>
                                        </option>
                                        <? } ?>
                                      </select>
                                        <? if($inputBusinessTypeID>0){?>
                                        <script language="javascript">
	document.myForm.inputBusinessTypeID.value='<?=$inputBusinessTypeID?>';
	                                    </script>
                                        <? }?></td>
								  </tr>
									<tr>
                                      <td height="22" align="right" class="table_col1">ประเภทอื่นๆ&nbsp;&nbsp;</td>
                                      <td height="22" class="table_col2"><input name="inputBusinessType" type="text" class="input_left" id="inputBusinessType" value="<?=$inputBusinessType?>" size="40" maxlength="100"></td>
								  </tr>
									<tr>
                                      <td height="22" align="right" class="table_col1">ตำแหน่ง&nbsp;&nbsp;</td>
                                      <td height="22" class="table_col2"><input name="inputPosition" type="text" class="input_left" id="inputPosition" value="<?=$inputPosition?>" size="40" maxlength="100"></td>
								  </tr>
									<tr>
                                      <td height="22" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../../webengine/images/bullet/box21.gif" width="11" height="11">&nbsp;&nbsp;ข้อมูลที่อยู่ปัจจุบัน</td>
								  </tr>
                                    <tr> 
                                      <td height="22" align="right" class="table_col1">ที่อยู่&nbsp;&nbsp;</td>
                                      <td height="22" class="table_col2"><input name="inputAddress1" type="text" class="input_left" id="inputAddress1" value="<?=$inputAddress1?>" size="40" maxlength="100"></td>
                                    </tr>
                                    <tr>
                                      <td height="22" align="right" class="table_col1">&nbsp;&nbsp;</td>
                                      <td height="22" class="table_col2"><input name="inputAddress2" type="text" class="input_left" id="inputAddress2" value="<?=$inputAddress2?>" size="40" maxlength="100"></td>
                                    </tr>
                                    <tr>
                                      <td height="22" align="right" class="table_col1">อำเภอ/เขต&nbsp;&nbsp;</td>
                                      <td height="22" class="table_col2"><input name="inputDistrict" type="text" class="input_left" id="inputDistrict" value="<?=$inputDistrict?>" size="40" maxlength="50"></td>
                                    </tr>
                                    <tr>
                                      <td height="22" align="right" class="table_col1">จังหวัด&nbsp;&nbsp;</td>
                                      <td class="table_col2">
                                        <select name="inputProvinceID" class="select" id="inputProvinceID">
                                          <?
										  $sql = "SELECT * FROM ".$System_TableName_Province." WHERE ".$System_TableName_Province."_Status='Enable' ORDER BY ".$System_TableName_Province."_ID";
										  $Query_Province = mysql_query($sql);
										  ?>
										  <? while ($Row_Province = mysql_fetch_array($Query_Province)) { ?>
										  <option value="<?=$Row_Province[$System_TableName_Province."_ID"]?>"><?=$Row_Province[$System_TableName_Province."_Name".$System_Session_Language]?></option>
										  <? } ?>
                                        </select>
                                        <? if($inputProvinceID>0){?>
                                        <script language="javascript">
	document.myForm.inputProvinceID.value='<?=$inputProvinceID?>';
	                                </script>
                                        <? }?>
                                      </td>
                                    </tr>
                                    <tr> 
                                      <td height="22" align="right" class="table_col1">รหัสไปรษณีย์ &nbsp; </td>
                                      <td height="22" class="table_col2"><input name="inputPostcode" type="text" class="input_left" id="inputPostcode" value="<?=$inputPostcode?>" size="40" maxlength="20"></td>
                                    </tr>
                                    <tr>
                                      <td height="22" align="right" class="table_col1">โทรศัพท์มือถือ&nbsp;&nbsp;</td>
                                      <td height="22" class="table_col2"><input name="inputMobile" type="text" class="input_left" id="inputMobile" value="<?=$inputMobile?>" size="40" maxlength="25"></td>
                                    </tr>
                                    <tr>
                                      <td height="22" align="right" class="table_col1">&nbsp;</td>
                                      <td height="22" class="table_col2"> ต้องการรับข่าวสารจาก JigsawOffice.com ผ่านทาง SMS ฟรี หรือไม่ ? </td>
                                    </tr>
                                    <tr>
                                      <td height="22" align="right" class="table_col1">&nbsp; </td>
                                      <td height="22" class="table_col2">
                                        <input name="inputEnableSMSNews" type="radio" value="1" <? if ($inputEnableSMSNews=="" || $inputEnableSMSNews=="1") { ?>checked<? } ?>> 
                                        ต้องการรับ    
                                        <input name="inputEnableSMSNews" type="radio" value="0" <? if ($inputEnableSMSNews=="0") { ?>checked<? } ?>>
    ไม่ต้องการรับ</td>
                                    </tr>
                                    <tr> 
                                      <td height="22" align="right" class="table_col1">โทรศัพท์บ้าน &nbsp;&nbsp;</td>
                                      <td height="22" class="table_col2"><input name="inputTelephone" type="text" class="input_left" id="inputTelephone" value="<?=$inputTelephone?>" size="40" maxlength="25"></td>
                                    </tr>
                                    <tr> 
                                      <td height="22" align="right" class="table_col1">โทรสาร&nbsp;&nbsp;</td>
                                      <td height="22" class="table_col2"><input name="inputFax" type="text" class="input_left" id="inputFax" value="<?=$inputFax?>" size="40" maxlength="25"></td>
                                    </tr>
									<tr>
                                      <td height="22" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../../webengine/images/bullet/box21.gif" width="11" height="11">&nbsp;&nbsp;ข้อมูลสถานที่ทำงาน</td>
								  </tr>
									<tr>
                                      <td height="22" align="right" class="table_col1">ชื่อบริษัท&nbsp;&nbsp;</td>
                                      <td height="22" class="table_col2"><input name="inputCompany_Name" type="text" class="input_left" id="inputCompany_Name" value="<?=$inputCompany_Name?>" size="40" maxlength="100"></td>
								  </tr>
									<tr>
                                      <td height="22" align="right" class="table_col1">ประเภทธุรกิจ&nbsp;&nbsp;</td>
                                      <td height="22" class="table_col2"><select name="inputCompany_BusinessTypeID" class="select" id="inputBusinessTypenD">
                                          <?
										  $sql = "SELECT * FROM ".$System_TableName_BusinessType." WHERE ".$System_TableName_BusinessType."_Status='Enable' ORDER BY ".$System_TableName_BusinessType."_ID";
										  $Query_BusinessType = mysql_query($sql);
										  ?>
                                          <? while ($Row_BusinessType = mysql_fetch_array($Query_BusinessType)) { ?>
                                          <option value="<?=$Row_BusinessType[$System_TableName_BusinessType."_ID"]?>" selected>
                                          <?=$Row_BusinessType[$System_TableName_BusinessType."_Name".$System_Session_Language]?>
                                          </option>
                                          <? } ?>
                                                                              </select>
                                          <? if($inputCompany_BusinessTypeID>0){?>
                                          <script language="javascript">
	document.myForm.inputCompany_BusinessTypeID.value='<?=$inputCompany_BusinessTypeID?>';
	                                    </script>
                                          <? }?></td>
								  </tr>
									<tr>
                                      <td height="22" align="right" class="table_col1">ที่อยู่&nbsp;&nbsp;</td>
                                      <td height="22" class="table_col2"><input name="inputCompany_Address1" type="text" class="input_left" id="inputCompany_Address1" value="<?=$inputCompany_Address1?>" size="40" maxlength="100"></td>
								  </tr>
									<tr>
                                      <td height="22" align="right" class="table_col1">&nbsp;</td>
                                      <td height="22" class="table_col2"><input name="inputCompany_Address2" type="text" class="input_left" id="inputCompany_Address2" value="<?=$inputCompany_Address2?>" size="40" maxlength="100"></td>
								  </tr>
									<tr>
                                      <td height="22" align="right" class="table_col1">อำเภอ/เขต&nbsp;&nbsp;</td>
                                      <td height="22" class="table_col2"><input name="inputCompany_District" type="text" class="input_left" id="inputCompany_District" value="<?=$inputCompany_District?>" size="40" maxlength="50"></td>
								  </tr>
									<tr>
                                      <td height="22" align="right" class="table_col1">จังหวัด&nbsp;&nbsp;*</td>
                                      <td class="table_col2">
                                        <select name="inputCompany_ProvinceID" class="select" id="inputCompany_ProvinceID">
                                          <?
										  $sql = "SELECT * FROM ".$System_TableName_Province." WHERE ".$System_TableName_Province."_Status='Enable' ORDER BY ".$System_TableName_Province."_ID";
										  $Query_Province = mysql_query($sql);
										  ?>
                                          <? while ($Row_Province = mysql_fetch_array($Query_Province)) { ?>
                                          <option value="<?=$Row_Province[$System_TableName_Province."_ID"]?>">
                                          <?=$Row_Province[$System_TableName_Province."_Name".$System_Session_Language]?>
                                          </option>
                                          <? } ?>
                                        </select>
                                        <? if($inputCompany_ProvinceID>0){?>
                                        <script language="javascript">
	document.myForm.inputCompany_ProvinceID.value='<?=$inputCompany_ProvinceID?>';
	                                </script>
                                        <? }?>
                                      </td>
								  </tr>
									<tr>
                                      <td height="22" align="right" class="table_col1">รหัสไปรษณีย์ *&nbsp; </td>
                                      <td height="22" class="table_col2"><input name="inputCompany_Postcode" type="text" class="input_left" id="inputCompany_Postcode" value="<?=$inputCompany_Postcode?>" size="40" maxlength="20"></td>
								  </tr>
									<tr>
                                      <td height="22" align="right" class="table_col1">โทรศัพท์&nbsp;&nbsp;</td>
                                      <td height="22" class="table_col2"><input name="inputCompany_Telephone" type="text" class="input_left" id="inputCompany_Telephone" value="<?=$inputCompany_Telephone?>" size="40" maxlength="25"></td>
								  </tr>
									<tr>
                                      <td height="22" align="right" class="table_col1">โทรสาร&nbsp;&nbsp;</td>
                                      <td height="22" class="table_col2"><input name="inputCompany_Fax" type="text" class="input_left" id="inputCompany_Fax" value="<?=$inputCompany_Fax?>" size="40" maxlength="25"></td>
								  </tr>
									<tr>
                                      <td height="22" align="right" class="table_col1">เวบไซต์&nbsp;&nbsp;</td>
                                      <td height="22" class="table_col2"><input name="inputCompany_Website" type="text" class="input_left" id="inputCompany_Website" value="<?=$inputCompany_Website?>" size="40" maxlength="100"></td>
								  </tr>
									<tr>
                                      <td height="22" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../../webengine/images/bullet/box21.gif" width="11" height="11">&nbsp;&nbsp;ข้อมูลรูปภาพ</td>
								  </tr>
									<tr>
                                      <td height="22" align="right" class="table_col1">รูปภาพ&nbsp;&nbsp;</td>
                                      <td height="22" class="table_col2"><input name="inputFullPhoto" type="file" class="input_left" id="inputFullPhoto" size="35" 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=='jpeg') {
		document.getElementById('PreviewImage_FullPhoto').src=myfile;
		document.getElementById('PreviewImageText_FullPhoto').innerHTML= document.getElementById('PreviewImage_FullPhoto').width + 'x' + document.getElementById('PreviewImage_FullPhoto').height + ' pixel';
	} else {
		alert('System allow to upload image files only.');
		this.focus();
	}
} else {
	alert('Please click Browse button to select picture file.');
	this.focus();
}
" onMouseOut="
if(document.getElementById('PreviewImage_FullPhoto').width>1 && document.getElementById('PreviewImage_FullPhoto').height>1) {
	document.getElementById('PreviewImageText_FullPhoto').innerHTML= document.getElementById('PreviewImage_FullPhoto').width + 'x' + document.getElementById('PreviewImage_FullPhoto').height + ' pixel';
}
"></td>
									</tr>
									<tr>
                                      <td height="22" align="right" class="table_col1">&nbsp;</td>
                                      <td class="table_col2"> แนะนำให้ใช้ภาพ ประเภท gif , jpeg หรือ jpg </td>
								  </tr>
									<tr>
									  <td height="22" align="right" class="table_col1">&nbsp;</td>
									  <td class="table_col2"><table border="0" cellspacing="0" cellpadding="2">
                                        <tr>
                                          <td width="120" align="center" valign="middle"><img src="../../webengine/images/blank.gif" name="PreviewImage_FullPhoto" id="PreviewImage_FullPhoto"></td>
                                          <td align="right"><div id="PreviewImageText_FullPhoto">&nbsp;</div></td>
                                        </tr>
                                      </table></td>
								  </tr>
									<tr>
                                      <td height="22" align="right" class="table_col1">รูปภาพขนาดเล็ก&nbsp;&nbsp;</td>
                                      <td height="22" class="table_col2"><input name="inputThumbnailPhoto" type="file" class="input_left" id="inputThumbnailPhoto" size="35" 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=='jpeg') {
		document.getElementById('PreviewImage_ThumbnailPhoto').src=myfile;
		document.getElementById('PreviewImageText_ThumbnailPhoto').innerHTML= document.getElementById('PreviewImage_ThumbnailPhoto').width + 'x' + document.getElementById('PreviewImage_ThumbnailPhoto').height + ' pixel';
	} else {
		alert('System allow to upload image files only.');
		this.focus();
	}
} else {
	alert('Please click Browse button to select picture file.');
	this.focus();
}
" onMouseOut="
if(document.getElementById('PreviewImage_ThumbnailPhoto').width>1 && document.getElementById('PreviewImage_ThumbnailPhoto').height>1) {
	document.getElementById('PreviewImageText_ThumbnailPhoto').innerHTML= document.getElementById('PreviewImage_ThumbnailPhoto').width + 'x' + document.getElementById('PreviewImage_ThumbnailPhoto').height + ' pixel';
}
"></td>
									</tr>
									<tr>
                                      <td height="22" align="right" class="table_col1">&nbsp;</td>
                                      <td class="table_col2"> แนะนำให้ใช้ภาพ ประเภท gif , jpeg หรือ jpg และขนาดไม่เกิน 80x80 pixel</td>
								  </tr>
									<tr>
									  <td height="22" align="right" class="table_col1">&nbsp;</td>
									  <td class="table_col2"><table border="0" cellspacing="0" cellpadding="2">
                                        <tr>
                                          <td width="120" align="center" valign="middle"><img src="../../webengine/images/blank.gif" name="PreviewImage_ThumbnailPhoto" id="PreviewImage_ThumbnailPhoto"></td>
                                          <td align="right"><div id="PreviewImageText_ThumbnailPhoto">&nbsp;</div></td>
                                        </tr>
                                      </table></td>
								  </tr>
									
                                  </table></td>
                              </tr>
                              <tr> 
                              <td><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" src="../../webengine/lib/checkemail.js"></script> 
<script language="JavaScript" type="text/JavaScript">
function isBlank(myObj) { if(myObj.value=='') { return true; } return false; }
function isNumber(myObj) { return !isNaN(myObj.value*1) }
function isEqual(myObj1,myObj2) {	if(myObj1.value==myObj2.value) { return true; }	return false;}
function verifySubmit() {
	with(document.myForm) {
		if(isBlank(inputUser)) {	alert("กรุณากรอก ชื่อผู้ใช้");  inputUser.focus(); return false; }
		if(isBlank(inputPass)) {	alert("กรุณากรอก รหัสผ่าน");  inputPass.focus(); return false; }
		if(inputPass.value.length<4){ alert("กรุณากรอก รหัสผ่าน อย่างน้อย 4 ตัวอักษร");  inputPass.focus(); return false; }
		if(!isEqual(inputPass,inputConfirm)) { alert("รหัสผ่าน กับ ยืนยันรหัสผ่าน ของท่านไม่ตรงกันกรุณากรอกใหม่!"); inputPass.focus(); return false; }
		if(isBlank(inputQuestion)) {	alert("กรุณากรอก คำถามกันลืม");  inputQuestion.focus(); return false; }
		if(isBlank(inputAnswer)) {	alert("กรุณากรอก คำตอบกันลืม");  inputAnswer.focus(); return false; }
		if(isBlank(inputAlias)) {	alert("กรุณากรอก นามแฝง");  inputAlias.focus(); return false; }

		if(isBlank(inputFName)) {alert("กรุณากรอกชื่อ");  inputFName.focus(); return false; }
		if(isBlank(inputLName)) {alert("กรุณากรอกนามสกุล");  inputLName.focus(); return false; }
		if(isBlank(inputEmail)) {alert("กรุณากรอกอีเมล์");  inputEmail.focus(); return false; }
		if(!isBlank(inputEmail)){
		    if(!isEmail(inputEmail.value)) { alert('กรุณากรอกอีเมล์ให้ถูกต้อง'); inputEmail.focus(); return false; }
		}
	}
	 document.myForm.submit();
}
</script>
										 <input name="btAdd2" type="button" class="button_80" id="btAdd2" value="Add" onClick="verifySubmit();"> </td>
                                          <td> <input name="btCalcel" type="button" class="button_80" id="btCalcel" onClick="document.myReturnForm.submit();" value="Cencel"> </td>
                                        </tr>
                                      </table></td>
                                  </tr>
                                </table></td>
                            </tr>
                          </table></td>
                      </tr>
                    </form>
                  </table>
                  <br>
                  <br>
                  <? 
#########################################################
} else if($action=="addnew") { 
	$inputBirthDate=$inputYear."-".$inputMonth."-".$inputDate;
	
    $sql = "INSERT INTO ".$myModule_Table."(".
	$myModule_Table."_ModuleKey,".
	$myModule_Table."_Language,".
	$myModule_Table."_User,".
	$myModule_Table."_Pass,".
	$myModule_Table."_Prefix,".
	$myModule_Table."_FName,".
	$myModule_Table."_LName,".
	$myModule_Table."_NickName,".
	$myModule_Table."_Email,".
	$myModule_Table."_BirthDate,".
	$myModule_Table."_OccupationID,".
	$myModule_Table."_Occupation,".
	$myModule_Table."_BusinessTypeID,".
	$myModule_Table."_BusinessType,".
	$myModule_Table."_Position,".
	$myModule_Table."_Question,".
	$myModule_Table."_Answer,".
	$myModule_Table."_Alias,".
	$myModule_Table."_Comment,".
	$myModule_Table."_Address1,".
	$myModule_Table."_Address2,".
	$myModule_Table."_District,".
	$myModule_Table."_ProvinceID,".
	$myModule_Table."_Postcode,".
	$myModule_Table."_Mobile,".
	$myModule_Table."_EnableSMSNews,".
	$myModule_Table."_Telephone,".
	$myModule_Table."_Fax,".
	$myModule_Table."_Company_Name,".
	$myModule_Table."_Company_BusinessTypeID,".
	$myModule_Table."_Company_BusinessType,".
	$myModule_Table."_Company_Address1,".
	$myModule_Table."_Company_Address2,".
	$myModule_Table."_Company_District,".
	$myModule_Table."_Company_ProvinceID,".
	$myModule_Table."_Company_Postcode,".
	$myModule_Table."_Company_Telephone,".
	$myModule_Table."_Company_Fax,".
	$myModule_Table."_Company_Website,".
	$myModule_Table."_CreateBy,".
	$myModule_Table."_CreateDate,".
	$myModule_Table."_LastUpdate,".
	$myModule_Table."_Activate,".
	$myModule_Table."_Status".
	") VALUES (".
	"'".$SystemModuleKey."',".
	"'".$System_Session_Language."',".
	"'".$inputUser."',".
	"'".$inputPass."',".
	"'".$inputPrefix."',".
	"'".$inputFName."',".
	"'".$inputLName."',".
	"'".$inputNickName."',".
	"'".$inputEmail."',".
	"'".$inputBirthDate."',".
	"'".$inputOccupationID."',".
	"'".$inputOccupation."',".
	"'".$inputBusinessTypeID."',".
	"'".$inputBusinessType."',".
	"'".$inputPosition."',".
	"'".$inputQuestion."',".
	"'".$inputAnswer."',".
	"'".$inputAlias."',".
	"'".$inputComment."',".
	"'".$inputAddress1."',".
	"'".$inputAddress2."',".
	"'".$inputDistrict."',".
	"'".$inputProvinceID."',".
	"'".$inputPostcode."',".
	"'".$inputMobile."',".
	"'".$inputEnableSMSNews."',".
	"'".$inputTelephone."',".
	"'".$inputFax."',".
	"'".$inputCompany_Name."',".
	"'".$inputCompany_BusinessTypeID."',".
	"'".$inputCompany_BusinessType."',".
	"'".$inputCompany_Address1."',".
	"'".$inputCompany_Address2."',".
	"'".$inputCompany_District."',".
	"'".$inputCompany_ProvinceID."',".
	"'".$inputCompany_Postcode."',".
	"'".$inputCompany_Telephone."',".
	"'".$inputCompany_Fax."',".
	"'".$inputCompany_Website."',".
	"'".$System_Session_UserName."',".
	"Now(),".
	"Now(),".
	"1,".
	"'Enable')";
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	$MaxID=mysql_insert_id();
	
	if(is_file($inputFullPhoto) || is_file($inputThumbnailPhoto)) {
	
		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_file($inputFullPhoto)) {
			$ImageData = getimagesize($inputFullPhoto);
			if($ImageData!=NULL) {
				if($ImageData[2]==1) { 
					$ImageType="gif";
				} elseif($ImageData[2]==2) {
					$ImageType="jpg";
				}
				$ThumbnailPictureName = "$MaxID-full-$myrand.$ImageType";
				if(file_exists($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName)) {
					unlink($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName);
				}
				if(copy($inputFullPhoto,$myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName)) {
					chmod($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName,0777);
				}
				$sql = "UPDATE ".$myModule_Table." SET ".$myModule_Table."_FullPhoto='$ThumbnailPictureName' WHERE ".$myModule_Table."_ID=".$MaxID;
				$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
			}
		}
		if(is_file($inputThumbnailPhoto)) {
			$ImageData = getimagesize($inputThumbnailPhoto);
			if($ImageData!=NULL) {
				if($ImageData[2]==1) { 
					$ImageType="gif";
				} elseif($ImageData[2]==2) {
					$ImageType="jpg";
				}
				$ThumbnailPictureName = "$MaxID-thumb-$myrand.$ImageType";
				if(file_exists($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName)) {
					unlink($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName);
				}
				if(copy($inputThumbnailPhoto,$myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName)) {
					chmod($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName,0777);
				}
				$sql = "UPDATE ".$myModule_Table." SET ".$myModule_Table."_ThumbnailPhoto='$ThumbnailPictureName' WHERE ".$myModule_Table."_ID=".$MaxID;
				$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
			}
		}
	}
	
	/*
    $sql = "INSERT INTO ".$myModule_Table."(".
	$myModule_Table."_ModuleKey,".
	$myModule_Table."_FName,".
	$myModule_Table."_LName,".
	$myModule_Table."_BirthDate,".
	$myModule_Table."_Gender,".
	$myModule_Table."_Address,".
	$myModule_Table."_Postcode,".
	$myModule_Table."_Country,".
	$myModule_Table."_Telephone,".
	$myModule_Table."_Fax,".
	$myModule_Table."_Email,".
	$myModule_Table."_Occupation,".
	$myModule_Table."_Education,".
	$myModule_Table."_Hobbie,".
	$myModule_Table."_Request,".
	$myModule_Table."_User,".
	$myModule_Table."_Pass,".
	$myModule_Table."_Language,".
	$myModule_Table."_Status,".
	$myModule_Table."_CreateBy,".
	$myModule_Table."_CreateDate,".
	$myModule_Table."_LastUpdate
	) VALUES('$SystemModuleKey','$inputFName','$inputLName','$inputBirthDate','$inputGender','$inputAddress','$inputPostcode','$inputCountry','$inputTelephone'
	,'$inputFax','$inputEmail','$inputOccupation','$inputEducation','$inputHobbie','$inputRequest'
	,'$inputUser','$inputPass','$System_Session_Language','Enable','$System_Session_UserName'
	,NOW(),NOW())";
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	$MaxID=mysql_insert_id();
	
	if($inputEmail!=""){
		$myModule_Table_Mail="tat_mod_mlt01_maillist";
		$SystemModuleMail="mailinglist";	
		$System_Language="Thai";
		$sql="SELECT * FROM ".$myModule_Table_Mail." WHERE ".$myModule_Table_Mail."_Email='".$inputEmail."' AND ".$myModule_Table_Mail."_GroupID=2";
		$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
		if(mysql_num_rows($Query)==0){
			$sql="INSERT INTO ".$myModule_Table_Mail."(".
			$myModule_Table_Mail."_GroupID,".
			$myModule_Table_Mail."_MID,".
			$myModule_Table_Mail."_ModuleKey,".
			$myModule_Table_Mail."_Language,".
			$myModule_Table_Mail."_Name,".
			$myModule_Table_Mail."_Email,".
			$myModule_Table_Mail."_CreateDate,".
			$myModule_Table_Mail."_Status)VALUES('2',$MaxID,'$SystemModuleMail','$System_Language','$inputFName $inputLName','$inputEmail',NOW(),'Enable')";
			$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
		}
	}
	*/
	?>                  
       <form action="?" method="post" name="myForm" id="myForm">
        <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
        <input name="action" type="hidden" id="action">
        <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>">
        <input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>">
        <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>">
        <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>">
        <input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>">
      </form>
                  <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
                  <? 
####################################################################
} else if($action=="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);

	$inputUser = $Row[$myModule_Table."_User"];
	$inputPrefix = $Row[$myModule_Table."_Prefix"];
	$inputFName = $Row[$myModule_Table."_FName"];
	$inputLName = $Row[$myModule_Table."_LName"];
	$inputNickName = $Row[$myModule_Table."_NickName"];
	$inputEmail = $Row[$myModule_Table."_Email"];
	$inputOccupationID = $Row[$myModule_Table."_OccupationID"];
	$inputOccupation = $Row[$myModule_Table."_Occupation"];
	$inputBusinessTypeID = $Row[$myModule_Table."_BusinessTypeID"];
	$inputBusinessType = $Row[$myModule_Table."_BusinessType"];
	$inputPosition = $Row[$myModule_Table."_Position"];
	$inputQuestion = $Row[$myModule_Table."_Question"];
	$inputAnswer = $Row[$myModule_Table."_Answer"];
	$inputAlias = $Row[$myModule_Table."_Alias"];
	$inputComment = $Row[$myModule_Table."_Comment"];
	$inputAddress1 = $Row[$myModule_Table."_Address1"];
	$inputAddress2 = $Row[$myModule_Table."_Address2"];
	$inputDistrict = $Row[$myModule_Table."_District"];
	$inputProvinceID = $Row[$myModule_Table."_ProvinceID"];
	$inputPostcode = $Row[$myModule_Table."_Postcode"];
	$inputMobile = $Row[$myModule_Table."_Mobile"];
	$inputEnableSMSNews = $Row[$myModule_Table."_EnableSMSNews"];
	$inputTelephone = $Row[$myModule_Table."_Telephone"];
	$inputFax = $Row[$myModule_Table."_Fax"];
	$inputCompany_Name = $Row[$myModule_Table."_Company_Name"];
	$inputCompany_BusinessTypeID = $Row[$myModule_Table."_Company_BusinessTypeID"];
	$inputCompany_BusinessType = $Row[$myModule_Table."_Company_BusinessType"];
	$inputCompany_Address1 = $Row[$myModule_Table."_Company_Address1"];
	$inputCompany_Address2 = $Row[$myModule_Table."_Company_Address2"];
	$inputCompany_District = $Row[$myModule_Table."_Company_District"];
	$inputCompany_ProvinceID = $Row[$myModule_Table."_Company_ProvinceID"];
	$inputCompany_Postcode = $Row[$myModule_Table."_Company_Postcode"];
	$inputCompany_Telephone = $Row[$myModule_Table."_Company_Telephone"];
	$inputCompany_Fax = $Row[$myModule_Table."_Company_Fax"];
	$inputCompany_Website = $Row[$myModule_Table."_Company_Website"];
	
	$BirthArr=explode('-',$Row[$myModule_Table."_BirthDate"]);
	$inputDate=$BirthArr[2];
	$inputMonth=$BirthArr[1];
	$inputYear=$BirthArr[0];
	?>
	                  <br>
                  <table width="90%" border="0" cellpadding="0" cellspacing="0" >
                    <form action="?" method="post" name="myReturnForm" id="myReturnForm">
                        <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                        <input name="action" type="hidden" id="action">
                        <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>">
                        <input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>">
                        <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>">
                        <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>">
						<input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>">
                    </form>
                    <form action="?" method="post" enctype="multipart/form-data" name="myForm" id="myForm">
                        <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                        <input name="action" type="hidden" id="action" value="update">
                        <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>">
                        <input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>">
                        <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>">
                        <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>">
                        <input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>">
                        <input name="CheckBoxID1" type="hidden" id="CheckBoxID1" value="<?=$myCheckBoxID?>">
                      <tr> 
                        <td bgcolor="#FFFFFF" class="table_col2"> <table width="100%" border="0"  cellpadding="0" cellspacing="1">
                            <tr> 
                              <td height="24" colspan="2" align="center" class="menu_table_header">Edit <?=getMenuName($SystemMenuID)?></td>
                            </tr>
                          </table>
                          <table width="100%" border="0"  cellpadding="0" cellspacing="1">
                              <tr> 
                                <td> <table width="100%" border="0" cellpadding="2" cellspacing="1" class="table_border">
                                  <tr>
                                    <td height="22" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../../webengine/images/bullet/box21.gif" width="11" height="11">&nbsp;&nbsp;ข้อมูลระบบ</td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1"> ชื่อผู้ใช้ &nbsp;</td>
                                    <td height="22" class="table_col2">
                                      <?=$inputUser?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1"> รหัสผ่าน *&nbsp;</td>
                                    <td height="22" class="table_col2">
                                      <input name="inputPass" type="password" class="input_left" id="inputPass" size="20"  maxlength="30" >
&nbsp;&nbsp;* ความยาวอย่างน้อย 4 ตัวอักษร </td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1"> ใส่รหัสผ่านอีกครั้ง *&nbsp;</td>
                                    <td height="22" class="table_col2">
                                      <input name="inputConfirm" type="password" class="input_left" id="inputConfirm" size="20"  maxlength="30" ></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1"> คำถามกันลืม *&nbsp;</td>
                                    <td height="22" class="table_col2">
                                      <input name="inputQuestion" type="text"   class="input_left" id="inputQuestion" value="<?=$inputQuestion?>" size="40" maxlength="100" >
                                    </td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1"> คำตอบกันลืม *&nbsp;</td>
                                    <td height="22" class="table_col2">
                                      <input name="inputAnswer" type="text"   class="input_left" id="inputAnswer" value="<?=$inputAnswer?>" size="40" maxlength="100" >
                                    </td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1"> นามแฝง *&nbsp;</td>
                                    <td height="22" class="table_col2">
                                      <input name="inputAlias" type="text"   class="input_left" id="inputAlias" value="<?=$inputAlias?>" size="30" maxlength="50" >
                                    </td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1"> คำแนะนำตัวสั้น &nbsp;</td>
                                    <td height="22" class="table_col2">
                                      <input name="inputComment" type="text"   class="input_left" id="inputComment" value="<?=$inputComment?>" size="30" maxlength="100" >
                                    </td>
                                  </tr>
                                  <tr>
                                    <td height="22" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../../webengine/images/bullet/box21.gif" width="11" height="11">&nbsp;&nbsp;ข้อมูลส่วนตัว</td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1"> คำนำหน้า *&nbsp;</td>
                                    <td height="22" class="table_col2">
                                      <input name="inputPrefix" type="radio" value="นาย" <? if ($inputPrefix=="" || $inputPrefix=="นาย") { ?>checked<? } ?>>
    นาย
    <input name="inputPrefix" type="radio" value="นาง" <? if ($inputPrefix=="นาง") { ?>checked<? } ?>>
    นาง
    <input name="inputPrefix" type="radio" value="น.ส." <? if ($inputPrefix=="น.ส.") { ?>checked<? } ?>>
    น.ส.
    <input name="inputPrefix" type="radio" value="ด.ช." <? if ($inputPrefix=="ด.ช.") { ?>checked<? } ?>>
    ด.ช.
    <input name="inputPrefix" type="radio" value="ด.ญ." <? if ($inputPrefix=="ด.ญ.") { ?>checked<? } ?>>
    ด.ญ. </td>
                                  </tr>
                                  <tr>
                                    <td width="31%" height="22" align="right" class="table_col1"> ชื่อ *&nbsp;</td>
                                    <td width="72%" height="22" class="table_col2">
                                      <input name="inputFName" type="text"   class="input_left" id="inputFName" value="<?=$inputFName?>" size="30" maxlength="30" >
                                    </td>
                                  </tr>
                                  <tr>
                                    <td width="31%" height="22" align="right" class="table_col1">นามสกุล *&nbsp; </td>
                                    <td width="72%" height="22" class="table_col2"><input name="inputLName" type="text"   class="input_left" id="inputLName" value="<?=$inputLName?>" size="30" maxlength="30"></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">ชื่อเล่น &nbsp; </td>
                                    <td height="22" class="table_col2"><input name="inputNickName" type="text"   class="input_left" id="inputNickName" value="<?=$inputNickName?>" size="30" maxlength="30"></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">Email *&nbsp; </td>
                                    <td height="22" class="table_col2"><input name="inputEmail" type="text"   class="input_left" id="inputEmail" value="<?=$inputEmail?>" size="30" maxlength="50"></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">วันเกิด &nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2">&nbsp;วัน&nbsp;&nbsp;
                                        <select name="inputDate" class="select">
                                          <? for($i=1;$i<=31;$i++){
									  			if ($i<10) $myi = "0".$i;
												else $myi = $i;
									  ?>
                                          <option value="<?=$myi?>">
                                          <?=$myi?>
                                          </option>
                                          <? }?>
                                        </select>
                                  &nbsp;&nbsp;เดือน&nbsp;&nbsp;
                                        <select name="inputMonth" class="select">
                                          <option value="01">มกราคม</option>
                                          <option value="02">กุมภาพันธ์</option>
                                          <option value="03">มีนาคม</option>
                                          <option value="04">เมษายน</option>
                                          <option value="05">พฤษภาคม</option>
                                          <option value="06">มิถุนายน</option>
                                          <option value="07">กรกฎาคม</option>
                                          <option value="08">สิงหาคม</option>
                                          <option value="09">กันยายน</option>
                                          <option value="10">ตุลาคม</option>
                                          <option value="11">พฤศจิกายน</option>
                                          <option value="12">ธันวาคม</option>
                                        </select>
                                  &nbsp;&nbsp;ปี&nbsp;&nbsp;
                                        <select name="inputYear" class="select">
                                          <?
									   $currentYear =date(Y);
									   for($i=$currentYear-8;$i>=$currentYear-70;$i--) { ?>
                                          <option value="<?=$i?>">
                                          <?=$i+543?>
                                          </option>
                                          <? } ?>
                                        </select>
                                        <? if($inputDate>0){?>
                                        <script language="javascript">
									  document.myForm.inputDate.value='<?=$inputDate?>';
									  document.myForm.inputMonth.value='<?=$inputMonth?>';
									  document.myForm.inputYear.value='<?=$inputYear?>';
									  </script>
                                        <? }?>
                                    </td>
                                  </tr>
                                  <tr>
                                    <td height="22" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../../webengine/images/bullet/box21.gif" width="11" height="11">&nbsp;&nbsp;ข้อมูลการทำงาน</td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">อาชีพ&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><select name="inputOccupationID" class="select" id="inputOccupationD">
                                        <?
										  $sql = "SELECT * FROM ".$System_TableName_Occupation." WHERE ".$System_TableName_Occupation."_Status='Enable' ORDER BY ".$System_TableName_Occupation."_ID";
										  $Query_Occupation = mysql_query($sql);
										  ?>
                                        <? while ($Row_Occupation = mysql_fetch_array($Query_Occupation)) { ?>
                                        <option value="<?=$Row_Occupation[$System_TableName_Occupation."_ID"]?>">
                                        <?=$Row_Occupation[$System_TableName_Occupation."_Name".$System_Session_Language]?>
                                        </option>
                                        <? } ?>
                                      </select>
                                        <? if($inputOccupationID>0){?>
                                        <script language="javascript">
	document.myForm.inputOccupationID.value='<?=$inputOccupationID?>';
	                                    </script>
                                        <? }?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">อาชีพอื่นๆ&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><input name="inputOccupation" type="text" class="input_left" id="inputOccupation" value="<?=$inputOccupation?>" size="40" maxlength="100"></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">ประเภทธุรกิจ&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><select name="inputBusinessTypeID" class="select" id="inputBusinessTypenD">
                                        <?
										  $sql = "SELECT * FROM ".$System_TableName_BusinessType." WHERE ".$System_TableName_BusinessType."_Status='Enable' ORDER BY ".$System_TableName_BusinessType."_ID";
										  $Query_BusinessType = mysql_query($sql);
										  ?>
                                        <? while ($Row_BusinessType = mysql_fetch_array($Query_BusinessType)) { ?>
                                        <option value="<?=$Row_BusinessType[$System_TableName_BusinessType."_ID"]?>">
                                        <?=$Row_BusinessType[$System_TableName_BusinessType."_Name".$System_Session_Language]?>
                                        </option>
                                        <? } ?>
                                      </select>
                                        <? if($inputBusinessTypeID>0){?>
                                        <script language="javascript">
	document.myForm.inputBusinessTypeID.value='<?=$inputBusinessTypeID?>';
	                                    </script>
                                        <? }?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">ประเภทอื่นๆ&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><input name="inputBusinessType" type="text" class="input_left" id="inputBusinessType" value="<?=$inputBusinessType?>" size="40" maxlength="100"></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">ตำแหน่ง&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><input name="inputPosition" type="text" class="input_left" id="inputPosition" value="<?=$inputPosition?>" size="40" maxlength="100"></td>
                                  </tr>
                                  <tr>
                                    <td height="22" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../../webengine/images/bullet/box21.gif" width="11" height="11">&nbsp;&nbsp;ข้อมูลที่อยู่ปัจจุบัน</td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">ที่อยู่&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><input name="inputAddress1" type="text" class="input_left" id="inputAddress1" value="<?=$inputAddress1?>" size="40" maxlength="100"></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">&nbsp;</td>
                                    <td height="22" class="table_col2"><input name="inputAddress2" type="text" class="input_left" id="inputAddress2" value="<?=$inputAddress2?>" size="40" maxlength="100"></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">อำเภอ/เขต&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><input name="inputDistrict" type="text" class="input_left" id="inputDistrict" value="<?=$inputDistrict?>" size="40" maxlength="50"></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">จังหวัด&nbsp;&nbsp;</td>
                                    <td class="table_col2">
                                      <select name="inputProvinceID" class="select" id="inputProvinceID">
                                        <?
										  $sql = "SELECT * FROM ".$System_TableName_Province." WHERE ".$System_TableName_Province."_Status='Enable' ORDER BY ".$System_TableName_Province."_ID";
										  $Query_Province = mysql_query($sql);
										  ?>
                                        <? while ($Row_Province = mysql_fetch_array($Query_Province)) { ?>
                                        <option value="<?=$Row_Province[$System_TableName_Province."_ID"]?>">
                                        <?=$Row_Province[$System_TableName_Province."_Name".$System_Session_Language]?>
                                        </option>
                                        <? } ?>
                                      </select>
                                      <? if($inputProvinceID>0){?>
                                      <script language="javascript">
	document.myForm.inputProvinceID.value='<?=$inputProvinceID?>';
	                                </script>
                                      <? }?>
                                    </td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">รหัสไปรษณีย์ &nbsp; </td>
                                    <td height="22" class="table_col2"><input name="inputPostcode" type="text" class="input_left" id="inputPostcode" value="<?=$inputPostcode?>" size="40" maxlength="20"></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">โทรศัพท์มือถือ&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><input name="inputMobile" type="text" class="input_left" id="inputMobile" value="<?=$inputMobile?>" size="40" maxlength="25"></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">&nbsp;</td>
                                    <td height="22" class="table_col2"> ต้องการรับข่าวสารจาก JigsawOffice.com ผ่านทาง SMS ฟรี หรือไม่ ? </td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">&nbsp; </td>
                                    <td height="22" class="table_col2">
                                      <input name="inputEnableSMSNews" type="radio" value="1" <? if ($inputEnableSMSNews=="" || $inputEnableSMSNews=="1") { ?>checked<? } ?>>
    ต้องการรับ
    <input name="inputEnableSMSNews" type="radio" value="0" <? if ($inputEnableSMSNews=="0") { ?>checked<? } ?>>
    ไม่ต้องการรับ</td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">โทรศัพท์บ้าน &nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><input name="inputTelephone" type="text" class="input_left" id="inputTelephone" value="<?=$inputTelephone?>" size="40" maxlength="25"></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">โทรสาร&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><input name="inputFax" type="text" class="input_left" id="inputFax" value="<?=$inputFax?>" size="40" maxlength="25"></td>
                                  </tr>
                                  <tr>
                                    <td height="22" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../../webengine/images/bullet/box21.gif" width="11" height="11">&nbsp;&nbsp;ข้อมูลสถานที่ทำงาน</td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">ชื่อบริษัท&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><input name="inputCompany_Name" type="text" class="input_left" id="inputCompany_Name" value="<?=$inputCompany_Name?>" size="40" maxlength="100"></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">ประเภทธุรกิจ&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><select name="inputCompany_BusinessTypeID" class="select" id="inputBusinessTypenD">
                                        <?
										  $sql = "SELECT * FROM ".$System_TableName_BusinessType." WHERE ".$System_TableName_BusinessType."_Status='Enable' ORDER BY ".$System_TableName_BusinessType."_ID";
										  $Query_BusinessType = mysql_query($sql);
										  ?>
                                        <? while ($Row_BusinessType = mysql_fetch_array($Query_BusinessType)) { ?>
                                        <option value="<?=$Row_BusinessType[$System_TableName_BusinessType."_ID"]?>" selected>
                                        <?=$Row_BusinessType[$System_TableName_BusinessType."_Name".$System_Session_Language]?>
                                        </option>
                                        <? } ?>
                                      </select>
                                        <? if($inputCompany_BusinessTypeID>0){?>
                                        <script language="javascript">
	document.myForm.inputCompany_BusinessTypeID.value='<?=$inputCompany_BusinessTypeID?>';
	                                    </script>
                                        <? }?></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">ที่อยู่&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><input name="inputCompany_Address1" type="text" class="input_left" id="inputCompany_Address1" value="<?=$inputCompany_Address1?>" size="40" maxlength="100"></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">&nbsp;</td>
                                    <td height="22" class="table_col2"><input name="inputCompany_Address2" type="text" class="input_left" id="inputCompany_Address2" value="<?=$inputCompany_Address2?>" size="40" maxlength="100"></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">อำเภอ/เขต&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><input name="inputCompany_District" type="text" class="input_left" id="inputCompany_District" value="<?=$inputCompany_District?>" size="40" maxlength="50"></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">จังหวัด&nbsp;&nbsp;*</td>
                                    <td class="table_col2">
                                      <select name="inputCompany_ProvinceID" class="select" id="inputCompany_ProvinceID">
                                        <?
										  $sql = "SELECT * FROM ".$System_TableName_Province." WHERE ".$System_TableName_Province."_Status='Enable' ORDER BY ".$System_TableName_Province."_ID";
										  $Query_Province = mysql_query($sql);
										  ?>
                                        <? while ($Row_Province = mysql_fetch_array($Query_Province)) { ?>
                                        <option value="<?=$Row_Province[$System_TableName_Province."_ID"]?>">
                                        <?=$Row_Province[$System_TableName_Province."_Name".$System_Session_Language]?>
                                        </option>
                                        <? } ?>
                                      </select>
                                      <? if($inputCompany_ProvinceID>0){?>
                                      <script language="javascript">
	document.myForm.inputCompany_ProvinceID.value='<?=$inputCompany_ProvinceID?>';
	                                </script>
                                      <? }?>
                                    </td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">รหัสไปรษณีย์ *&nbsp; </td>
                                    <td height="22" class="table_col2"><input name="inputCompany_Postcode" type="text" class="input_left" id="inputCompany_Postcode" value="<?=$inputCompany_Postcode?>" size="40" maxlength="20"></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">โทรศัพท์&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><input name="inputCompany_Telephone" type="text" class="input_left" id="inputCompany_Telephone" value="<?=$inputCompany_Telephone?>" size="40" maxlength="25"></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">โทรสาร&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><input name="inputCompany_Fax" type="text" class="input_left" id="inputCompany_Fax" value="<?=$inputCompany_Fax?>" size="40" maxlength="25"></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">เวบไซต์&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><input name="inputCompany_Website" type="text" class="input_left" id="inputCompany_Website" value="<?=$inputCompany_Website?>" size="40" maxlength="100"></td>
                                  </tr>
                                  <tr>
                                    <td height="22" colspan="2" class="table_col3">&nbsp;&nbsp;<img src="../../webengine/images/bullet/box21.gif" width="11" height="11">&nbsp;&nbsp;ข้อมูลรูปภาพ</td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">รูปภาพ&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><input name="inputFullPhoto" type="file" class="input_left" id="inputFullPhoto" size="35" 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=='jpeg') {
		document.getElementById('PreviewImage_FullPhoto').src=myfile;
		document.getElementById('PreviewImageText_FullPhoto').innerHTML= document.getElementById('PreviewImage_FullPhoto').width + 'x' + document.getElementById('PreviewImage_FullPhoto').height + ' pixel';
	} else {
		alert('System allow to upload image files only.');
		this.focus();
	}
} else {
	alert('Please click Browse button to select picture file.');
	this.focus();
}
" onMouseOut="
if(document.getElementById('PreviewImage_FullPhoto').width>1 && document.getElementById('PreviewImage_FullPhoto').height>1) {
	document.getElementById('PreviewImageText_FullPhoto').innerHTML= document.getElementById('PreviewImage_FullPhoto').width + 'x' + document.getElementById('PreviewImage_FullPhoto').height + ' pixel';
}
"></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">&nbsp;</td>
                                    <td class="table_col2"> แนะนำให้ใช้ภาพ ประเภท gif , jpeg หรือ jpg </td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" valign="top" class="table_col1"><input name="btPreview_FullPhoto" type="button" class="button_80" id="btPreview_FullPhoto" onClick="
myfile = document.myForm.inputFullPhoto.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=='jpeg') {
		document.getElementById('PreviewImage_FullPhoto').src=myfile;
		document.getElementById('PreviewImageText_FullPhoto').innerHTML= document.getElementById('PreviewImage_FullPhoto').width + 'x' + document.getElementById('PreviewImage_FullPhoto').height + ' pixel';
	} else {
		alert('System allow to upload image files only.');
		document.myForm.inputFullPhoto.focus();
	}
} else {
	alert('Please click Browse button to select picture file.');
	document.myForm.inputFullPhoto.focus();
}
" value="Preview" onMouseOut="
if(document.getElementById('PreviewImage_FullPhoto').width>1 && document.getElementById('PreviewImage_FullPhoto').height>1) {
	document.getElementById('PreviewImageText_FullPhoto').innerHTML= document.getElementById('PreviewImage_FullPhoto').width + 'x' + document.getElementById('PreviewImage_FullPhoto').height + ' pixel';
}
"></td>
                                    <td class="table_col2"><table border="0" cellspacing="0" cellpadding="2">
                                        <tr>
                                          <td width="120" align="center" valign="middle"><img src="<? if ($Row[$myModule_Table."_FullPhoto"]<>"" && file_exists($myModule_Path_ThumbnailPicture."/".$Row[$myModule_Table."_FullPhoto"])) { ?><?=$myModule_Path_ThumbnailPicture."/".$Row[$myModule_Table."_FullPhoto"]?><? } else { ?>../../webengine/images/blank.gif<? } ?>" name="PreviewImage_FullPhoto" id="PreviewImage_FullPhoto"></td>
                                          <td align="right"><div id="PreviewImageText_FullPhoto">&nbsp;</div></td>
                                        </tr>
                                    </table></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">รูปภาพขนาดเล็ก&nbsp;&nbsp;</td>
                                    <td height="22" class="table_col2"><input name="inputThumbnailPhoto" type="file" class="input_left" id="inputThumbnailPhoto" size="35" 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=='jpeg') {
		document.getElementById('PreviewImage_ThumbnailPhoto').src=myfile;
		document.getElementById('PreviewImageText_ThumbnailPhoto').innerHTML= document.getElementById('PreviewImage_ThumbnailPhoto').width + 'x' + document.getElementById('PreviewImage_ThumbnailPhoto').height + ' pixel';
	} else {
		alert('System allow to upload image files only.');
		this.focus();
	}
} else {
	alert('Please click Browse button to select picture file.');
	this.focus();
}
" onMouseOut="
if(document.getElementById('PreviewImage_ThumbnailPhoto').width>1 && document.getElementById('PreviewImage_ThumbnailPhoto').height>1) {
	document.getElementById('PreviewImageText_ThumbnailPhoto').innerHTML= document.getElementById('PreviewImage_ThumbnailPhoto').width + 'x' + document.getElementById('PreviewImage_ThumbnailPhoto').height + ' pixel';
}
"></td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" class="table_col1">&nbsp;</td>
                                    <td class="table_col2"> แนะนำให้ใช้ภาพ ประเภท gif , jpeg หรือ jpg และขนาดไม่เกิน 80x80 pixel</td>
                                  </tr>
                                  <tr>
                                    <td height="22" align="right" valign="top" class="table_col1"><input name="btPreview_ThumbnailPhoto" type="button" class="button_80" id="btPreview_ThumbnailPhoto" onClick="
myfile = document.myForm.inputThumbnailPhoto.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=='jpeg') {
		document.getElementById('PreviewImage_ThumbnailPhoto').src=myfile;
		document.getElementById('PreviewImageText_ThumbnailPhoto').innerHTML= document.getElementById('PreviewImage_ThumbnailPhoto').width + 'x' + document.getElementById('PreviewImage_ThumbnailPhoto').height + ' pixel';
	} else {
		alert('System allow to upload image files only.');
		document.myForm.inputThumbnailPhoto.focus();
	}
} else {
	alert('Please click Browse button to select picture file.');
	document.myForm.inputThumbnailPhoto.focus();
}
" value="Preview" onMouseOut="
if(document.getElementById('PreviewImage_ThumbnailPhoto').width>1 && document.getElementById('PreviewImage_ThumbnailPhoto').height>1) {
	document.getElementById('PreviewImageText_ThumbnailPhoto').innerHTML= document.getElementById('PreviewImage_ThumbnailPhoto').width + 'x' + document.getElementById('PreviewImage_ThumbnailPhoto').height + ' pixel';
}
"></td>
                                    <td class="table_col2"><table border="0" cellspacing="0" cellpadding="2">
                                        <tr>
                                          <td width="120" align="center" valign="middle"><img src="<? if ($Row[$myModule_Table."_ThumbnailPhoto"]<>"" && file_exists($myModule_Path_ThumbnailPicture."/".$Row[$myModule_Table."_ThumbnailPhoto"])) { ?><?=$myModule_Path_ThumbnailPicture."/".$Row[$myModule_Table."_ThumbnailPhoto"]?><? } else { ?>../../webengine/images/blank.gif<? } ?>" name="PreviewImage_ThumbnailPhoto" id="PreviewImage_ThumbnailPhoto"></td>
                                          <td align="right"><div id="PreviewImageText_ThumbnailPhoto">&nbsp;</div></td>
                                        </tr>
                                    </table></td>
                                  </tr>
                                </table></td>
                              </tr>
                              <tr> 
                              <td><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" src="../../webengine/lib/checkemail.js"></script> 
<script language="JavaScript" type="text/JavaScript">
function isBlank(myObj) { if(myObj.value=='') { return true; } return false; }
function isNumber(myObj) { return !isNaN(myObj.value*1) }
function isEqual(myObj1,myObj2) {	if(myObj1.value==myObj2.value) { return true; }	return false;}
function verifySubmit() {
	with(document.myForm) {
		if(!isBlank(inputPass)) {
			if(inputPass.value.length<4){ alert("กรุณากรอก รหัสผ่าน อย่างน้อย 4 ตัวอักษร");  inputPass.focus(); return false; }
			if(!isEqual(inputPass,inputConfirm)) { alert("รหัสผ่าน กับ ยืนยันรหัสผ่าน ของท่านไม่ตรงกันกรุณากรอกใหม่!"); inputPass.focus(); return false; }
		}
		if(isBlank(inputQuestion)) {	alert("กรุณากรอก คำถามกันลืม");  inputQuestion.focus(); return false; }
		if(isBlank(inputAnswer)) {	alert("กรุณากรอก คำตอบกันลืม");  inputAnswer.focus(); return false; }
		if(isBlank(inputAlias)) {	alert("กรุณากรอก นามแฝง");  inputAlias.focus(); return false; }

		if(isBlank(inputFName)) {alert("กรุณากรอกชื่อ");  inputFName.focus(); return false; }
		if(isBlank(inputLName)) {alert("กรุณากรอกนามสกุล");  inputLName.focus(); return false; }
		if(isBlank(inputEmail)) {alert("กรุณากรอกอีเมล์");  inputEmail.focus(); return false; }
		if(!isBlank(inputEmail)){
		    if(!isEmail(inputEmail.value)) { alert('กรุณากรอกอีเมล์ให้ถูกต้อง'); inputEmail.focus(); return false; }
		}
	}
	 document.myForm.submit();
}
</script>
										 <input name="btAdd2" type="button" class="button_80" id="btAdd2" value="Save" onClick="verifySubmit();"> </td>
                                          <td> <input name="btCalcel" type="button" class="button_80" id="btCalcel" onClick="document.myReturnForm.submit();" value="Cencel"> </td>
                                        </tr>
                                      </table></td>
                                  </tr>
                                </table></td>
                            </tr>
                          </table></td>
                      </tr>
                    </form>
                  </table>
                  <br>
                  <br>
                  <? 
#########################################################
} else if($action=="update") { 

	 $MaxID = $CheckBoxID1;
	 $inputBirthDate=$inputYear."-".$inputMonth."-".$inputDate;
	 
	$sql = "UPDATE ".$myModule_Table." SET ";
	if ($inputPass<>"") $myModule_Table."_Pass='$inputPass',";
	$sql .= $myModule_Table."_Prefix='$inputPrefix',".
	$myModule_Table."_FName='$inputFName',".
	$myModule_Table."_LName='$inputLName',".
	$myModule_Table."_NickName='$inputNickName',".
	$myModule_Table."_Email='$inputEmail',".
	$myModule_Table."_BirthDate='$inputBirthDate',".
	$myModule_Table."_OccupationID='$inputOccupationID',".
	$myModule_Table."_Occupation='$inputOccupation',".
	$myModule_Table."_BusinessTypeID='$inputBusinessTypeID',".
	$myModule_Table."_BusinessType='$inputBusinessType',".
	$myModule_Table."_Position='$inputPosition',".
	$myModule_Table."_Question='$inputQuestion',".
	$myModule_Table."_Answer='$inputAnswer',".
	$myModule_Table."_Alias='$inputAlias',".
	$myModule_Table."_Comment='$inputComment',".
	$myModule_Table."_Address1='$inputAddress1',".
	$myModule_Table."_Address2='$inputAddress2',".
	$myModule_Table."_District='$inputDistrict',".
	$myModule_Table."_ProvinceID='$inputProvinceID',".
	$myModule_Table."_Postcode='$inputPostcode',".
	$myModule_Table."_Mobile='$inputMobile',".
	$myModule_Table."_EnableSMSNews='$inputEnableSMSNews',".
	$myModule_Table."_Telephone='$inputTelephone',".
	$myModule_Table."_Fax='$inputFax',".
	$myModule_Table."_Company_Name='$inputCompany_Name',".
	$myModule_Table."_Company_BusinessTypeID='$inputCompany_BusinessTypeID',".
	$myModule_Table."_Company_BusinessType='$inputCompany_BusinessType',".
	$myModule_Table."_Company_Address1='$inputCompany_Address1',".
	$myModule_Table."_Company_Address2='$inputCompany_Address2',".
	$myModule_Table."_Company_District='$inputCompany_District',".
	$myModule_Table."_Company_ProvinceID='$inputCompany_ProvinceID',".
	$myModule_Table."_Company_Postcode='$inputCompany_Postcode',".
	$myModule_Table."_Company_Telephone='$inputCompany_Telephone',".
	$myModule_Table."_Company_Fax='$inputCompany_Fax',".
	$myModule_Table."_Company_Website='$inputCompany_Website',".
	$myModule_Table."_CreateBy='$System_Session_UserName',".
	$myModule_Table."_LastUpdate=Now()".
	" WHERE ".$myModule_Table."_ID=".$MaxID;
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	
	if(is_file($inputFullPhoto) || is_file($inputThumbnailPhoto)) {
		$sql = "SELECT ".$myModule_Table."_FullPhoto,".$myModule_Table."_ThumbnailPhoto 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);
	
		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_file($inputFullPhoto)) {
			$ImageData = getimagesize($inputFullPhoto);
			if($ImageData!=NULL) {
				// Delete Old Photo
				if ($Row[$myModule_Table."_FullPhoto"]<>"" && file_exists($System_RelativePath_Upload."/".$Row[$myModule_Table."_FullPhoto"])) {
					unlink($System_RelativePath_Upload."/".$Row[$myModule_Table."_FullPhoto"]);
				}
				
				if($ImageData[2]==1) { 
					$ImageType="gif";
				} elseif($ImageData[2]==2) {
					$ImageType="jpg";
				}
				$ThumbnailPictureName = "$MaxID-full-$myrand.$ImageType";
				if(file_exists($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName)) {
					unlink($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName);
				}
				if(copy($inputFullPhoto,$myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName)) {
					chmod($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName,0777);
				}
				$sql = "UPDATE ".$myModule_Table." SET ".$myModule_Table."_FullPhoto='$ThumbnailPictureName' WHERE ".$myModule_Table."_ID=".$MaxID;
				$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
			}
		}
		if(is_file($inputThumbnailPhoto)) {
			$ImageData = getimagesize($inputThumbnailPhoto);
			if($ImageData!=NULL) {
				// Delete Old Photo
				if ($Row[$myModule_Table."_ThumbnailPhoto"]<>"" && file_exists($System_RelativePath_Upload."/".$Row[$myModule_Table."_ThumbnailPhoto"])) {
					unlink($System_RelativePath_Upload."/".$Row[$myModule_Table."_ThumbnailPhoto"]);
				}
				
				if($ImageData[2]==1) { 
					$ImageType="gif";
				} elseif($ImageData[2]==2) {
					$ImageType="jpg";
				}
				$ThumbnailPictureName = "$MaxID-thumb-$myrand.$ImageType";
				if(file_exists($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName)) {
					unlink($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName);
				}
				if(copy($inputThumbnailPhoto,$myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName)) {
					chmod($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName,0777);
				}
				$sql = "UPDATE ".$myModule_Table." SET ".$myModule_Table."_ThumbnailPhoto='$ThumbnailPictureName' WHERE ".$myModule_Table."_ID=".$MaxID;
				$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
			}
		}
	}
	
	 /*
	 $sql = "UPDATE ".$myModule_Table." SET "
	 .$myModule_Table."_FName='$inputFName',"
	 .$myModule_Table."_LName='$inputLName',"
	 .$myModule_Table."_BirthDate='$inputBirthDate',"
	 .$myModule_Table."_Gender='$inputGender',"
	 .$myModule_Table."_Address='$inputAddress',"
	 .$myModule_Table."_Postcode='$inputPostcode',"
	 .$myModule_Table."_Country='$inputCountry',"
	 .$myModule_Table."_Telephone='$inputTelephone',"
	 .$myModule_Table."_Fax='$inputFax',"
	 .$myModule_Table."_Email='$inputEmail',"
	 .$myModule_Table."_Occupation='$inputOccupation',"
	 .$myModule_Table."_Education='$inputEducation',"
	 .$myModule_Table."_Hobbie='$inputHobbie',"
	 .$myModule_Table."_Request='$inputRequest',"
	 .$myModule_Table."_LastUpdate='NOW()'";
	if(strlen($inputPass)>0) {
		$sql .= ",".$myModule_Table."_Pass = '$inputPass' ";
	}
	$sql .= " WHERE ". $myModule_Table."_ID=".$MaxID;
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	
	
//Mailling list--------------
	$MailingModuleKey="mailinglist";
	$myModule_Table_MailList="tat_mod_mlt01_maillist";
    $sql="SELECT ".$myModule_Table_MailList."_Email FROM ".$myModule_Table_MailList." WHERE ".$myModule_Table_MailList."_Email='".$inputEmail."' AND ".$myModule_Table_MailList."_MID<>'".$MaxID."'";
	$query=mysql_query($sql);
	if($numrow=mysql_num_rows($query)==0){
		$sql_mail="UPDATE ".$myModule_Table_MailList." SET "
		.$myModule_Table_MailList."_Email='".$inputEmail."',".$myModule_Table_MailList."_Name='".$inputFName." ".$inputLName."'  WHERE ".$myModule_Table_MailList."_MID=".$MaxID;
		$Query_mail=MYSQL_DB_QUERY($System_DataBase_Name,$sql_mail) OR DIE("Error: เกิดความผิดพลาด <br>$sql_mail<br>\n");
	 }
//- - - --- - - --- -- -  -- - -
	*/
	?>
                  <form action="?" method="post" name="myForm" id="myForm">
                    <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                    <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                    <input name="action" type="hidden" id="action">
                    <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>">
                    <input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>">
                    <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>">
                    <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>">
                    <input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>">
                  </form>
                  <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
                  <? 
#########################################################
} else if($action=="delete") { 
	for($i=1;$i<=$TotalCheckBoxID;$i++) {
		$myVar="CheckBoxID".$i;
		if(strlen($$myVar)>0) {
			$sql = "SELECT ".$myModule_Table."_FullPhoto,".$myModule_Table."_ThumbnailPhoto 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);
			// Delete Old Photo
			if ($Row[$myModule_Table."_FullPhoto"]<>"" && file_exists($System_RelativePath_Upload."/".$Row[$myModule_Table."_FullPhoto"])) {
				unlink($System_RelativePath_Upload."/".$Row[$myModule_Table."_FullPhoto"]);
			}
			if ($Row[$myModule_Table."_ThumbnailPhoto"]<>"" && file_exists($System_RelativePath_Upload."/".$Row[$myModule_Table."_ThumbnailPhoto"])) {
				unlink($System_RelativePath_Upload."/".$Row[$myModule_Table."_ThumbnailPhoto"]);
			}
			
			$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");
		}

	}
?>
                  <form action="?" method="post" name="myForm" id="myForm">
                    <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                    <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                    <input name="action" type="hidden" id="action">
                    <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>">
                    <input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>">
                    <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>">
                    <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>">
                    <input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>">
                  </form>
                  <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
<? 
#########################################################
} else if($action=="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");
?>
                  <form action="?" method="post" name="myForm" id="myForm">
                    <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                    <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                    <input name="action" type="hidden" id="action">
                    <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>">
                    <input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>">
                    <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>">
                    <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>">
                    <input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>">
                  </form>
                  <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
<?
} else if($action=="setactivatestatus") { 
	$myCheckBoxID=0;
	for($i=1;$i<=$TotalCheckBoxID;$i++) {
		$myVar="CheckBoxID".$i;
		if(strlen($$myVar)>0) {
			$myCheckBoxID=$$myVar;
		}
	}
	$sql="UPDATE ".$myModule_Table." SET ". $myModule_Table."_Activate='$ActivateStatus' WHERE ". $myModule_Table."_ID=".$myCheckBoxID;
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
?>
                  <form action="?" method="post" name="myForm" id="myForm">
                    <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                    <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                    <input name="action" type="hidden" id="action">
                    <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>">
                    <input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>">
                    <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>">
                    <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>">
                    <input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>">
                  </form>
                  <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
<?
} else {
?>
<?
# 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"; } 
} 
if($PageSearch!="") { $PageSearch=trim($PageSearch); }
# 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'  ";
if($inputAge!="" && $inputAge!="0"){
	$sql.=" AND ".(date("Y")+543)."-substring(".$myModule_Table."_BirthDate,7,4) BETWEEN ".str_replace("-"," AND ",$inputAge);
}
if($inputMonth!="" && $inputMonth!="0"){
	$sql.=" AND substring(".$myModule_Table."_BirthDate,4,2)='".$inputMonth."'";
}
if($inputGender!="" && $inputGender!="0"){
	$sql.=" AND ".$myModule_Table."_Gender='".$inputGender."'";
}
if($inputInterrest!="" && $inputInterrest!="0"){
	$sql.=" AND substring(".$myModule_Table."_Interrest,".$inputInterrest.",1)='1'";
}
if($inputSalary!="" && $inputSalary!="0"){
	$sql.=" AND ".$myModule_Table."_Salary='".$inputSalary."'";
}
if($inputDegree!="" && $inputDegree!="0"){
	$sql.=" AND ".$myModule_Table."_Education='".$inputDegree."'";
}

if($PageSearch!="") {
	$sql.=" AND ( ".$myModule_Table."_FName LIKE '%$PageSearch%' ".
	" OR ". $myModule_Table."_User LIKE '%$PageSearch%' ".
	" OR ". $myModule_Table."_Email LIKE '%$PageSearch%' ".
	") ";
}
$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 ";
$sql.=" 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="divActivate" 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="myActivateForm" id="myActivateForm">
                        <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('divActivate').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="0" checked></td>
                                <td height="22" class="text_bold">Not</td>
                              </tr>
                              <tr> 
                                <td width="26" height="22" align="center"><input name="toolbarStatus" type="radio" class="form_checkbox" value="1"></td>
                                <td height="22" class="text_bold">Activate</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.myActivateForm.toolbarStatus[0].checked) {
	document.myForm.ActivateStatus.value=document.myActivateForm.toolbarStatus[0].value;
}
if(document.myActivateForm.toolbarStatus[1].checked) {
	document.myForm.ActivateStatus.value=document.myActivateForm.toolbarStatus[1].value;
}
document.myForm.action.value='setactivatestatus';
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('divActivate').style.display='none';"></td>
                              </tr>
                            </table></td>
                        </tr>
                        <tr> 
                          <td height="6" class="table_footer"><img src="../images/blank.gif" width="1" height="1"></td>
                        </tr>
                      </form>
                    </table>
                  </div>
                  <div id="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="88%" 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]=="Write" ||  $System_Session_Permission[$SystemMenuID]=="Manage"){ ?>
							<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]=="Write" ||  $System_Session_Permission[$SystemMenuID]=="Manage"){ ?>
<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="90%" height="22" 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='';
						PageSearch.value='';
						submit();
					}
					"></td>
                              <? if($PageShow<$NoOfPage) { ?>
                              <td width="21" align="center"> <img src="../images/controlpage/playset_forward.gif" width="21" height="21" 
				  onMouseOver="this.src='../images/controlpage/playset_forward_active.gif'; this.style.cursor='hand';" 
				  onMouseOut="this.src='../images/controlpage/playset_forward.gif';" 
				  onClick="document.myForm.PageShow.value++; document.myForm.submit();"></td>
                              <? } else { ?>
                              <td width="10" align="center"><img src="../images/controlpage/playset_forward_disable.gif" width="21" height="21"></td>
                              <? } ?>
                              <? if($PageShow<$NoOfPage) { ?>
                              <td width="10" align="center"><img src="../images/controlpage/playset_end.gif" width="21" height="21" 
				  onMouseOver="this.src='../images/controlpage/playset_end_active.gif'; this.style.cursor='hand';" 
				  onMouseOut="this.src='../images/controlpage/playset_end.gif';" 
				  onClick="document.myForm.PageShow.value='<?=$NoOfPage?>'; document.myForm.submit();"></td>
                              <? } else { ?>
                              <td width="10" align="center"><img src="../images/controlpage/playset_end_disable.gif" width="21" height="21"></td>
                              <? } ?>
                            </tr>
                          </table></td>
                        <td width="5" align="right" valign="top"><img src="../images/bgborder2w.gif" width="5" height="5"></td>
                      </tr>
                    </form>
                  </table>
                  <table width="90%" 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="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>">
							<input name="inputAge" type="hidden" id="inputAge" value="<?=$inputAge?>">
							<input name="inputMonth" type="hidden" id="inputMonth" value="<?=$inputMonth?>">
							<input name="inputGender" type="hidden" id="inputGender" value="<?=$inputGender?>">
							<input name="inputInterrest" type="hidden" id="inputInterrest" value="<?=$inputInterrest?>">
							<input name="inputSalary" type="hidden" id="inputSalary" value="<?=$inputSalary?>">
							<input name="inputDegree" type="hidden" id="inputDegree" value="<?=$inputDegree?>">
                            <input name="SelectStatus" type="hidden" id="SelectStatus">
							<input name="ActivateStatus" type="hidden" id="ActivateStatus">
                          
                            <tr align="center" class="menu_table_header"> 
                              <td width="20" height="24"><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 height="24"> 
                                <? 
$myOrderBy = $myModule_Table."_FName";
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(); 
}
					"> Name</a> </td>
                              <td><? 
$myOrderBy = $myModule_Table."_Email";
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(); 
}
					"> Email</a> </td>
                              <td width="70" height="24"> 
                                <? 
$myOrderBy = $myModule_Table."_User";
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(); 
}
					">Username</a></td>
					         <td width="70">Activate</td>
                              <td width="70" height="24"> 
                                <? 
$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> / 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);
?>							
                             <tr class="<?=$myClassRow?>" onMouseOver="this.className='table_rowover'" onMouseOut="this.className='<?=$myClassRow?>'">  
                              <td height="20" 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 height="20" align="center"><?=$RecordStart+$index?>
                              </td>
                              <td height="20">&nbsp; 
                                &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."_FName"]?>&nbsp;<?=$Row[$myModule_Table."_LName"]?></strong></a></td>
                              <td align="center"><?=$Row[$myModule_Table."_Email"]?> </td>
                              <td height="20" align="center"><?=$Row[$myModule_Table."_User"]?> 
                              </td>
                               <td align="center"><img src="../images/icon/ico442.gif" width="8" height="14">&nbsp;
							      <span onMouseOver="this.style.cursor='hand'" onClick="
                                  if('<?=$Row[$myModule_Table."_Activate"]?>'=='0') {
									  document.myActivateForm.toolbarStatus[0].checked=true;
                                  }
                                  if('<?=$Row[$myModule_Table."_Activate"]?>'=='1') {
									  document.myActivateForm.toolbarStatus[1].checked=true;
                                  }
                                  StatusIndex = <?=$index?>;
                                  ShowDataPicker('divActivate',-230,-150)
                                  "> 
                                  <?
								  	 if ($Row[$myModule_Table."_Activate"]==0) echo "<font color='#FF0000'> Not </font>";
									 else echo "Activate";
								  ?>
                                  </span>
									</td>  
                             <td width="70" height="30" align="center"><img src="../images/icon/ico442.gif" width="8" height="14">&nbsp; 
							      <font  color="#990000">
<? if($System_Session_Permission[$SystemMenuID]=="Write" ||  $System_Session_Permission[$SystemMenuID]=="Manage"){ ?>
<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"]?>
<? if($System_Session_Permission[$SystemMenuID]=="Write" ||  $System_Session_Permission[$SystemMenuID]=="Manage"){ ?>
                                  </span>
<? }?>
</font>
<br>
<table border="0" cellspacing="0" cellpadding="1">
                                    <tr align="center" valign="bottom"> 

<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>
<? if($System_Session_Permission[$SystemMenuID]=="Write" ||  $System_Session_Permission[$SystemMenuID]=="Manage"){ ?>
<td><img src="../images/icon/ico425.gif" alt="Edit" width="16" height="16" border="0" onMouseOver="this.style.cursor='hand'" onClick="
if(confirm('Are you sure to edit this record?')) {
	Paging_CheckedThisItem( document.myForm.CheckBoxAll, <?=$index?>, 'CheckBoxID', document.myForm.TotalCheckBoxID.value );
	document.myForm.action.value='edit';
	document.myForm.submit();
}
						"></td>									
                                      <td><img src="../images/icon/ico417.gif" alt="Delete" width="16" height="16" border="0" onMouseOver="this.style.cursor='hand'" onClick="
if(confirm('Are you sure to delete this record?')) {
	Paging_CheckedThisItem( document.myForm.CheckBoxAll, <?=$index?>, 'CheckBoxID', document.myForm.TotalCheckBoxID.value );
	document.myForm.action.value='delete';
	document.myForm.submit();
}
						"></td>
<? }?>
</tr>
                               </table></td>
                            </tr>
	<?
		$index++;
	}
} else {  ?>
                        <tr class="table_row1"> 
                          <td height="80" colspan="10" 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">                              <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                  <td width="80%"><table width="100%" height="22"  border="0" cellpadding="0" cellspacing="0">
                                      <tr>
                                        <td width="87%" height="22" align="right"><input name="toolbarPageSearch" type="text" class="input_left" id="toolbarPageSearch2" value="<?=$PageSearch?>" size="20" maxlength="50"></td>
                                        <td width="13%" height="22" align="right"><input name="btPageSearch" type="button" class="button_60" id="btPageSearch2" value="Search" onClick="
/*
document.myForm.inputAge.value=document.mySearchForm.inputAge.value;
document.myForm.inputMonth.value=document.mySearchForm.inputMonth.value;
document.myForm.inputGender.value=document.mySearchForm.inputGender.value;
document.myForm.inputInterrest.value=document.mySearchForm.inputInterrest.value;
document.myForm.inputSalary.value=document.mySearchForm.inputSalary.value;
document.myForm.inputDegree.value=document.mySearchForm.inputDegree.value;
*/
document.myForm.PageSearch.value=document.mySearchForm.toolbarPageSearch.value;
document.myForm.submit();
						"></td>
                                      </tr>
                                  </table></td>
                                </tr>
                              </table></td>
                            </tr>
                          </form>
                        </table></td>
                    </tr>
                  </table>
                  <table width="88%" 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]=="Write" ||  $System_Session_Permission[$SystemMenuID]=="Manage"){ ?>
                              <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]=="Write" ||  $System_Session_Permission[$SystemMenuID]=="Manage"){ ?>
                              <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>
                  <? 
}
#########################################################
?>
                   
<title>Web Engine : 
<?=$System_Variable_Title?>
</title>

	  <!-- InstanceEndEditable --> 
            <? }  else { echo "&nbsp;"; }?>            </td>
          </tr>
          <tr>
            <td width="113" align="left" valign="bottom" bgcolor="#EEEEEE"><img src="../images/bgborder3w.gif" width="5" height="5"></td>
            <td width="61" align="right" valign="bottom" bgcolor="#EEEEEE"><img src="../images/bgborder4w.gif" width="5" height="5"></td>
          </tr>
          <tr>
            <td colspan="3" align="left" valign="bottom" height="5"></td>
          </tr>
        </table></td>
    </tr>
  </table>
<table width="770" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
          <tr> 
            <td align="left" valign="top"><img src="../images/bgborder1w.gif" width="5" height="5"></td>
            <td align="center"></td>
            <td align="right" valign="top"><img src="../images/bgborder2w.gif" width="5" height="5"></td>
          </tr>
          <tr>
            <td height="30" align="center">&nbsp;</td>
            <td align="center"><font color="#999999">Copyright &copy; 2005 Design &amp; construction All rights reserved.</font>
                  <font color="#999999">Developed &amp; Design by </font><font color="#666666">Net</font><font color="#99CC00">-Com</font></td>
            <td align="center">&nbsp;</td>
          </tr>
          <tr>
            <td align="left" valign="bottom"><img src="../images/bgborder3w.gif" width="5" height="5"></td>
            <td></td>
            <td align="right" valign="bottom"><img src="../images/bgborder4w.gif" width="5" height="5"></td>
          </tr>
  </table>
  
</div>
</body>
<!-- InstanceEnd --></html>
<? 
include("../lib/disconnect.php");
?>

Hacked By AnonymousFox1.0, Coded By AnonymousFox