Hacked By AnonymousFox

Current Path : C:/AppServ/www/timetable/system/mod_calendar/
Upload File :
Current File : C:/AppServ/www/timetable/system/mod_calendar/year.php

<? 
include("../../lib/session.php"); 
include("../../lib/config.php");
include("../../lib/connect.php");
include("../../lib/function.php");
include("../../lib/register_global.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/main_pm.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<title>Curriculum Map</title>
<script type="text/javascript">
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<link href="../../css/menu.css" rel="stylesheet" type="text/css" />
<link href="../../css/font.css" rel="stylesheet" type="text/css" />
<link href="../../css/piya_style.css" rel="stylesheet" type="text/css" />
<link href="../../css/table.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style2 {
	color: #30707C;
	font-weight: bold;
	font-size: 14px;
}
-->
</style>
</head>

<body onload="MM_preloadImages('../../images/menu/menu_03.png','../../images/menu/menu_01_over.png','../../images/menu/menu_05_over.png')">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="100" align="center" background="../../images/head/sky.jpg"><img src="../../images/head/Sirirajlogo.gif" width="126" height="120" /></td>
  </tr>
  <tr>
    <td height="22" background="../../images/head/bar.jpg"><table width="950" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td>
		<table width="30%" border="0" align="right" cellpadding="0" cellspacing="0" class="login">
            <tr>
              <td align="right"><img src="../../images/icon/people_1.png" width="13" height="14" />Hi ! 
                <?=$System_Session_UserName?>|<img src="../../images/icon/door.png" width="16" height="15" /><a href="../logout.php">Logout</a></td>
              </tr>
            </table>
        </td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td align="center" valign="top"><table width="100" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="747" valign="top"><table width="747" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="24" rowspan="2" valign="top" background="../../images/l/left_menu_02.jpg"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td><img src="../../images/l/left_menu_01_l.jpg" width="24" height="27" /></td>
                </tr>
                <tr>
                  <td><img src="../../images/l/left_menu_02.jpg" width="24" height="1" /></td>
                </tr>
            </table></td>
            <td width="24" colspan="2" rowspan="2" valign="top" background="../../images/l/left_menu_02_bg.jpg"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td><img src="../../images/l/left_menu_01_r.jpg" width="197" height="27" /></td>
                </tr>
                <tr>
                  <td><table width="100%" border="0" cellspacing="5" cellpadding="0">
                      <tr>
                        <td align="left"><span class="style2">ระบบข้อมูลรายวิชา</span></td>
                      </tr>
                      <tr>
                        <td align="left" class="menu_one">
                        <ul class="menu_one">
                        <li><a href="../../home/home.php">ข้อมูลรายวิชา</a></li>
                       </ul>                        </td>
                      </tr>
                      <tr>
                        <td align="left"><span class="style2">ระบบผู้ใช้งาน</span></td>
                      </tr>
                      <tr>
                        <td align="left"><ul class="menu_one">
                        <? if($System_Session_Level=="Administrator")  { ?>
                            <li><a href="../user_management.php">ข้อมูลผู้ใช้งานในระบบ</a></li>
                            <? } ?>
                             <? if($System_Session_Level=="Staff")  { ?>
                            <li><a href="../user_managementperson.php">ข้อมูลผู้ใช้งานในระบบ</a></li>
                            <? } ?>
							 <? if($System_Session_Level=="Admin")  { ?>
                            <li><a href="../user_managementperson.php">ข้อมูลผู้ใช้งานในระบบ</a></li>
                            <? } ?>
                        </ul></td>
                      </tr>
					    <? if($System_Session_Level=="Administrator")  { ?>
                      <tr>
                        <td align="left"><span class="style2">ระบบข้อมูลที่เกี่ยวข้อง</span></td>
                      </tr>
                      <tr>
                        <td align="left"><ul class="menu_one">
                            <li><a href="../mod_other/standard.php">เพิ่มข้อมูลมาตรฐานการเรียนรู้</a></li>
                            <li><a href="../mod_other/council.php">เพิ่มข้อมูลแพทยสภา</a></li>
                            <li><a href="../mod_other/report.php">ระบบรายงานผล</a></li>
                          
                        </ul></td>
                      </tr>  <? } ?>
                      <tr>
                        <td align="left">&nbsp;</td>
                      </tr>
                      <tr>
                        <td align="left">&nbsp;</td>
                      </tr>
                      <tr>
                        <td align="left"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image16','','file:///C|/AppServ/www/images/menu/menu_05_over.png',1)"></a></td>
                      </tr>
                  </table></td>
                </tr>
            </table></td>
            <td background="../../images/content_border/content_border_02.jpg"><img src="../../images/content_border/content_border_01.jpg" width="747" height="11" /></td>
            <td background="../../images/content_border/content_border_right.jpg"></td>
          </tr>
          <tr>
            <td valign="top" background="../../images/content_border/content_border_02.jpg"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="15" height="300">&nbsp;</td>
                  <td align="left" valign="top"><!-- InstanceBeginEditable name="content" -->
			 
			 <link rel="stylesheet" type="text/css" href="../../css/style.css" />
			  <script language="JavaScript">
 function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features).focus();
 }
</script>
			  <div id="box">
                <h3>ข้อมูลปฏิทิน</h3>
                <table width="75%" border="2" align="right" style="border-collapse:collapse" bordercolor="#cccccc">
                  <tr>
                    <td width="27%" height="33" bgcolor="#DAE3E8"><div align="center"><span class="style2 style1 style5"><strong><a href="calendar.php" class="menu_one">ปฏิทินรวม</a></strong></span> </div></td>
                    <td width="38%" bgcolor="#DAE3E8"><div align="center"><span class="style2 style1 style5"><strong><a href="teach.php" class="menu_one">ปฏิทินแสดงข้อมูลตามผู้สอน</a></strong></span> </div></td>
                    <td width="35%" class="table_title2"><div align="center">ปฏิทินแสดงข้อมูลตามชั้นปี</div></td>
                  </tr>
                </table>
                <p>&nbsp;</p>
                <p><br />
                  <script language="JavaScript" src="lib/popup.js" type="text/JavaScript"></script>
                    <? 
## Load Module Configuration Variable ############################################
include("config.php");
## Default Value ############################################
$SystemModule_defaultPageSize = 10;
$SystemModule_defaultPageShow = 1;
$SystemModule_MaxPage = 20;
$SystemModule_ReduceRange = 10; 		// +,- from current page show
$SystemModule_ASCDESC = "DESC";
$myModule_Table = $myModule_Table1;
$SystemModule_OrderBy = $myModule_Table."_ID";
#########################################################

if($myDate=="") { $myDate=getDateNow(); }
if($myTime=="") { $myTime=getTimeNow(); }

?>
                    <? 
####################################################################
if($action=="view") { 
	$sql="SELECT * FROM ".$myModule_Table." WHERE ".$myModule_Table."_ID=".$myCalID;
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	$Row=MYSQL_FETCH_ARRAY($Query);
	$HTMLsrc = $myModule_Path_HTMLFiles."/".$Row[$myModule_Table."_HtmlFile"];
	
	?>
                    <br>
                    </p>
                <table width="95%" border="0" align="center" cellpadding="0" cellspacing="1" class="table_header">
                  <form action="?" method="post" name="myReturnForm" id="myReturnForm2">
                    <input name="SystemModuleKey2" type="hidden" id="SystemModuleKey2" value="<?=$SystemModuleKey?>" />
                    <input name="SystemMenuID3" type="hidden" id="SystemMenuID3" value="<?=$SystemMenuID?>" />
                    <input name="action2" type="hidden" id="action2" value="" />
                    <input name="PageSize2" type="hidden" id="PageSize2" value="<?=$PageSize?>" />
                    <input name="PageShow2" type="hidden" id="PageShow2" value="<?=$PageShow?>" />
                    <input name="ASCDESC2" type="hidden" id="ASCDESC2" value="<?=$ASCDESC?>" />
                    <input name="OrderBy2" type="hidden" id="OrderBy2" value="<?=$OrderBy?>" />
                    <input name="PageSearch2" type="hidden" id="PageSearch2" value="<?=$PageSearch?>" />
                  </form>
                  <form action="?" method="post" name="myForm" id="myForm2">
                    <input name="SystemModuleKey2" type="hidden" id="SystemModuleKey2" value="<?=$SystemModuleKey?>" />
                    <input name="SystemMenuID3" type="hidden" id="SystemMenuID3" value="<?=$SystemMenuID?>" />
                    <input name="action2" type="hidden" id="action2" value="edit" />
                    <input name="PageSize2" type="hidden" id="PageSize2" value="<?=$PageSize?>" />
                    <input name="PageShow2" type="hidden" id="PageShow2" value="<?=$PageShow?>" />
                    <input name="ASCDESC2" type="hidden" id="ASCDESC2" value="<?=$ASCDESC?>" />
                    <input name="OrderBy2" type="hidden" id="OrderBy2" value="<?=$OrderBy?>" />
                    <input name="PageSearch2" type="hidden" id="PageSearch2" value="<?=$PageSearch?>" />
                    <input name="CheckBoxID1" type="hidden" id="CheckBoxID1" value="<?=$myCheckBoxID?>" />
                    <input name="TotalCheckBoxID" type="hidden" id="TotalCheckBoxID" value="1" />
                    <tr>
                      <td bgcolor="#FFFFFF"><table width="100%" border="0" cellpadding="2" cellspacing="1">
                          <tr>
                            <td height="24" colspan="2" align="center" class="table_header"><b>ดูข้อมูล</b></td>
                          </tr>
                          <tr>
                            <td height="22" colspan="2" bgcolor="#F7F6F0" class="table_col3">&nbsp;&nbsp;<img src="../images/bullet/box21.gif" width="11" height="11" />&nbsp;<span style="font-weight: bold">ข้อมูลวัน / เวลา</span></td>
                          </tr>
                          <tr>
                            <td width="17%" height="22" align="right" class="table_col1">รายวิชา</td>
                            <td width="83%" height="22" class="table_col2"><? $sqlrefer="select * from cm_mod_detailoverall where cm_mod_detailoverall_ID='$Row[cm_mod_calendar_DetailID]'";
				$queryrefer=mysql_query($sqlrefer);
				$rowsrefer=mysql_fetch_array($queryrefer);?>
                                <?=$rowsrefer[cm_mod_detailoverall_Subject]?>
                              &nbsp;</td>
                          </tr>
                          <tr>
                            <td height="22" align="right" class="table_col1">ภาควิชา&nbsp;</td>
                            <td height="22" class="table_col2"><? $sqlrefer1="select * from crm_system_staff where crm_system_staff_ID='$rowsrefer[cm_mod_detailoverall_Createbyid]'";
				$queryrefer1=mysql_query($sqlrefer1);
				$rowsrefer1=mysql_fetch_array($queryrefer1);?>
                                <?=$rowsrefer1[crm_system_staff_Faculty]?></td>
                          </tr>
                          <tr>
                            <td height="22" align="right" class="table_col1">นักศึกษาที่เรียน&nbsp;</td>
                            <td height="22" class="table_col2"><?=$Row[$myModule_Table."_Studentyear"]?></td>
                          </tr>
                          <tr>
                            <td height="22" align="right" class="table_col1">เรื่องที่เรียน&nbsp;</td>
                            <td height="22" class="table_col2"><?=$rowsrefer[cm_mod_detailoverall_Course]?></td>
                          </tr>
                          <tr>
                            <td height="22" align="right" class="table_col1">ผู้สอน&nbsp;</td>
                            <td height="22" class="table_col2"><?=$rowsrefer1[crm_system_staff_FName]?>
                                <?=$rowsrefer1[crm_system_staff_LName]?>
                            </td>
                          </tr>
                          <tr>
                            <td height="22" align="right" class="table_col1">วันที่สอน&nbsp; </td>
                            <td height="22" class="table_col2"><?=ShowDateEn($Row[$myModule_Table."_DateFrom"])?>
                              -
                              <?=ShowDateEn($Row[$myModule_Table."_DateTo"])?></td>
                          </tr>
                          <tr>
                            <td height="22" align="right" class="table_col1">เวลาที่สอน </td>
                            <td height="22" class="table_col2"><? if($Row[$myModule_Table."_TimeTo"]=="00:00:00") { ?>
                                <?=substr($Row[$myModule_Table."_TimeFrom"],0,5)?>
                                <? } else { ?>
                                <?=substr($Row[$myModule_Table."_TimeFrom"],0,5)." - ".substr($Row[$myModule_Table."_TimeTo"],0,5)?>
                                <? } ?></td>
                          </tr>
                          <tr>
                            <td height="22" align="right" class="table_col1">รูปแบบ</td>
                            <td height="22" class="table_col2"><?=$rowsrefer[cm_mod_detailoverall_Type]?>
                              &nbsp;</td>
                          </tr>
                          <tr>
                            <td height="22" align="right" class="table_col1">มศว</td>
                            <td height="22" class="table_col2"><?=$rowsrefer[cm_mod_detailoverall_Fill1]?>
                              &nbsp;</td>
                          </tr>
                          <tr>
                            <td height="22" align="right" class="table_col1">แพทยสภา</td>
                            <td height="22" class="table_col2"><?=$rowsrefer[cm_mod_detailoverall_Fill2]?>
                              &nbsp;</td>
                          </tr>
                          <tr>
                            <td height="22" align="right" class="table_col1">วัตถุประสงค์การสอน</td>
                            <td height="22" class="table_col2"><? if($rowsrefer[cm_mod_detailoverall_Objective1]!=""){ echo"1."; echo $rowsrefer[cm_mod_detailoverall_Objective1]; }?>
                                <br />
                                <? if($rowsrefer[cm_mod_detailoverall_Objective2]!=""){ echo"2."; echo $rowsrefer[cm_mod_detailoverall_Objective2]; }?>
                                <br />
                                <? if($rowsrefer[cm_mod_detailoverall_Objective3]!=""){ echo"3."; echo $rowsrefer[cm_mod_detailoverall_Objective3]; }?>
                                <br />
                                <? if($rowsrefer[cm_mod_detailoverall_Objective4]!=""){ echo"4."; echo $rowsrefer[cm_mod_detailoverall_Objective4]; }?>
                                <br />
                                <? if($rowsrefer[cm_mod_detailoverall_Objective5]!=""){ echo"5."; echo $rowsrefer[cm_mod_detailoverall_Objective5]; }?>
                            </td>
                          </tr>
                        </table>
                          <table width="100%" height="24" border="0" cellpadding="3" cellspacing="0">
                            <tr align="right">
                              <td height="30" colspan="4" align="center" class="table_footer"><table width="300" border="0" cellspacing="0" cellpadding="2">
                                  <tr align="center">
                                    <? if($System_Session_Permission[$SystemMenuID]=="RW" ){ ?>
                                    <td><input name="btEdit" type="button" class="button_80" id="btEdit" value="Edit" onclick="
document.myForm.action.value='edit';
document.myForm.submit();
						" />
                                    </td>
                                    <? }?>
                                    <td><input name="btCalcel2" type="button" class="button_80" id="btCalcel2" onclick="
if(confirm('Are you sure to return to list?')) {
	document.myReturnForm.submit();
}
						" value="Cancel" />
                                    </td>
                                  </tr>
                              </table></td>
                            </tr>
                        </table></td>
                    </tr>
                  </form>
                </table>
                <br>
                    <br>
                    <? 
####################################################################
 } else if($action=="add") { 
	$HTMLToolContentBG = "#FFFFFF";
	$myTimeArray = explode(":",$myTime);
	$myTimeHH=$myTimeArray [0]*1;
	$myTimeMM=$myTimeArray [1]*1;
	?>
                    <br>
                   
                    <!-- import the calendar script -->
                    <link rel="stylesheet" type="text/css" href="../../css/myCalendarStyle.css">
                    <script type="text/javascript" src="lib/calendar.js"></script>
                    <script type="text/javascript" src="lib/lang/calendar-en.js"></script>
                    <script type="text/javascript" src="lib/loadcalendar.js"></script>
                    <!-- end the calendar script -->
                    <table width="95%" border="0" align="center" cellpadding="0" cellspacing="1" class="table_header">
                      <form action="?" method="post" name="myReturnForm" id="myReturnForm">
                        <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                        <input name="action" type="hidden" id="action" value="">
                        <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>">
                        <input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>">
                        <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>">
                        <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>">
                        <input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>">
                      </form>
                      <form action="?" method="post" name="myForm" id="myForm" enctype="multipart/form-data">
                        <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                        <input name="action" type="hidden" id="action" value="addnew">
                        <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>">
                        <input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>">
                        <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>">
                        <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>">
                        <input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>">
                        <tr> 
                          <td bgcolor="#FFFFFF"> <table width="100%" border="0" cellpadding="2" cellspacing="1">
                              <tr> 
                                <td height="24" colspan="2" align="center" class="table_header"><b>เพิ่มข้อมูล</b></td>
                              </tr>

                              <tr> 
                                <td height="22" colspan="2" bgcolor="#F7F6F0" class="table_col3">&nbsp;&nbsp;<img src="../images/bullet/box21.gif" width="11" height="11" />&nbsp;<span style="font-weight: bold">ข้อมูลวัน / เวลา</span>
                                  <input name="inputMod_Calendar_TimeFrom" type="hidden" id="inputMod_Calendar_TimeFrom"> 
                                <input name="inputMod_Calendar_TimeTo" type="hidden" id="inputMod_Calendar_TimeTo"></td>
                              </tr>
                              <tr> 
                                <td width="140" height="22" align="right" class="table_col1"><div align="right">วันที่&nbsp;</div></td>
                                <td height="22" class="table_col2"><table border="0" cellspacing="0" cellpadding="1">
                                    <tr> 
                                      <td nowrap>From&nbsp;</td>
                                      <td><input name="inputMod_Calendar_DateFrom" type="text" class="input_center" id="inputMod_Calendar_DateFrom" value="<?=$myDate?>" size="10" maxlength="10"></td>
                                      <td> <input type="button" class="button_th_normal" onClick="return showCalendar('inputMod_Calendar_DateFrom', 'y-mm-dd');" value=" ... "> 
                                      </td>
                                      <td width="25" align="right"><input name="inputIsDateTo" type="checkbox" id="inputIsDateTo" value="Yes" onClick="if(document.getElementById('idDateTo1').style.display=='') { document.getElementById('idDateTo1').style.display='none'; document.getElementById('idDateTo2').style.display='none'; } else { document.getElementById('idDateTo1').style.display=''; document.getElementById('idDateTo2').style.display=''; } "></td>
                                      <td nowrap>To&nbsp;</td>
                                      <td id="idDateTo1" style="display:none"> 
                                        <input name="inputMod_Calendar_DateTo" type="text" class="input_center" id="inputMod_Calendar_DateTo" value="<?=$myDate?>" size="10" maxlength="10"></td>
                                      <td id="idDateTo2" style="display:none"> 
                                        <input type="button" class="button_th_normal" onClick="return showCalendar('inputMod_Calendar_DateTo', 'y-mm-dd');" value=" ... "></td>
                                    </tr>
                                  </table></td>
                              </tr>
                              <tr> 
                                <td height="22" align="right" class="table_col1"><div align="right">เวลา&nbsp;</div></td>
                                <td height="22" class="table_col2"><table border="0" cellspacing="0" cellpadding="1">
                                    <tr> 
                                      <td width="30">From</td>
                                      <td><select name="inputTimeFromHH" class="select" id="inputTimeFromHH">
                                          <? for($i=0;$i<=23;$i++) { if($i<10) { $myi= "0".$i; } else { $myi=$i; } ?>
                                          <option value="<?=$myi?>"<? if($myTimeHH==$i) { echo " selected"; } ?>> 
                                          <?=$myi?>
                                          </option>
                                          <? } ?>
                                        </select></td>
                                      <td><b>:</b></td>
                                      <td><select name="inputTimeFromMM" class="select" id="inputTimeFromMM">
                                          <? for($i=0;$i<=59;$i++) { if($i<10) { $myi= "0".$i; } else { $myi=$i; } ?>
                                          <option value="<?=$myi?>"<? if($myTimeMM==$i) { echo " selected"; } ?>> 
                                          <?=$myi?>
                                          </option>
                                          <? } ?>
                                        </select></td>
                                      <td width="37" align="right"><input name="inputIsTimeTo" type="checkbox" id="inputIsTimeTo" value="Yes" onClick="if(document.getElementById('idTimeTo1').style.display=='') { document.getElementById('idTimeTo1').style.display='none'; document.getElementById('idTimeTo2').style.display='none';  document.getElementById('idTimeTo3').style.display='none'; } else { document.getElementById('idTimeTo1').style.display=''; document.getElementById('idTimeTo2').style.display=''; document.getElementById('idTimeTo3').style.display=''; } "></td>
                                      <td nowrap>To&nbsp;</td>
                                      <td  id="idTimeTo1" style="display:none"><select name="inputTimeToHH" class="select" id="inputTimeToHH">
                                          <? for($i=0;$i<=23;$i++) { if($i<10) { $myi= "0".$i; } else { $myi=$i; } ?>
                                          <option value="<?=$myi?>"<? if($myTimeHH==$i) { echo " selected"; } ?>> 
                                          <?=$myi?>
                                          </option>
                                          <? } ?>
                                        </select></td>
                                      <td  id="idTimeTo2" style="display:none"><b>:</b></td>
                                      <td  id="idTimeTo3" style="display:none"><select name="inputTimeToMM" class="select" id="inputTimeToMM">
                                          <? for($i=0;$i<=59;$i++) { if($i<10) { $myi= "0".$i; } else { $myi=$i; } ?>
                                          <option value="<?=$myi?>"<? if($myTimeMM==$i) { echo " selected"; } ?>> 
                                          <?=$myi?>
                                          </option>
                                          <? } ?>
                                        </select></td>
                                    </tr>
                                  </table></td>
                              </tr>
                              <tr>
                                <td height="22" align="right" class="table_col1">ประเภทงาน</td>
                                <td height="22" class="table_col2"><select name="inputGroupID" id="inputGroupID" class="select">
								<option value="1">นัดหมายงานลูกค้า</option>
								<option value="2">ติดตามงานลูกค้า</option>
								<option value="3">อื่นๆ</option>
                                </select>&nbsp;</td>
                              </tr>
                              
                              <tr> 
                                <td width="140" height="22" align="right" class="table_col1"><div align="right">หัวข้อ&nbsp;</div></td>
                                <td height="22" class="table_col2"> <input name="inputMod_Calendar_Subject" type="text" class="input_left" id="inputMod_Calendar_Subject" size="50"  maxlength="250">
                                <span style="color: #FF0000">*</span></td>
                              </tr>
                              <tr> 
                                <td width="140" height="22" align="right" class="table_col1"><div align="right">สถานที่&nbsp;</div></td>
                                <td height="22" class="table_col2"><textarea name="inputMod_Calendar_Location" cols="50" rows="6" class="input_textarea" id="inputMod_Calendar_Location"></textarea>
                                <span style="color: #FF0000">*</span></td>
                              </tr>
							  <tr>
		  <td height="22" align="right" class="table_col1"><div align="right">IDลูกค้า&nbsp; </div></td>
		  <td height="22" class="table_col2">
		  <input name="inputMod_Calendar_Name" type="text" class="input_left" id="inputMod_Calendar_Name" size="50"  maxlength="250">
		  
		    <span style="color: #FF0000">*</span></td>
							  </tr>
							  <tr>
							    <td height="22" align="right" class="table_col1"><div align="right">ผู้ติดต่อลูกค้า&nbsp; </div></td>
							    <td height="22" class="table_col2">
								<select name="inputMod_Calendar_Contact" id="inputMod_Calendar_Contact" class="select">
								
								<? 
								$sql = "SELECT * FROM crm_system_staff";
								
								$QueryCalendarGroup=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
								while($RowCalendarGroup=MYSQL_FETCH_ARRAY($QueryCalendarGroup)){
								?>
								<option value="<?=$RowCalendarGroup[crm_system_staff_FName]." ".$RowCalendarGroup[crm_system_staff_LName]?>"  <? if($RowCalendarGroup[crm_system_staff_FName]==$Row[crm_system_staff_FName]){ echo "selected";}?>><?=$RowCalendarGroup[crm_system_staff_FName]." ".$RowCalendarGroup[crm_system_staff_LName]?></option>
								<? }?>
								
                                </select>
						        <span style="color: #FF0000">*</span></td>
						    </tr>
							  <tr>
                                <td height="22" align="right" class="table_col1"><div align="right">รายละเอียด&nbsp; </div></td>
							    <td height="22" class="table_col2"><textarea name="inputMod_Calendar_Detail" cols="50" rows="6" class="input_textarea" id="inputMod_Calendar_Detail"></textarea></td>
						    </tr>
                            </table>
                            <table width="100%" height="24" border="0" cellpadding="3" cellspacing="0">
                              <tr align="right"> 
                                <td height="30" colspan="4" align="center" class="table_footer"> 
                                  <table width="300" border="0" cellspacing="0" cellpadding="2">
                                    <tr align="center"> 
                                      <td> <script language="JavaScript" type="text/JavaScript">
function isBlank(myObj) { if(myObj.value=='') { return true; } return false; }
function isNumber(myObj) { return !isNaN(myObj.value*1) }
function verifySubmit() {
	with(document.myForm) {
		if(isBlank(inputMod_Calendar_Subject)) {	inputMod_Calendar_Subject.focus(); return false; }
		if(isBlank(inputMod_Calendar_Location)) {	inputMod_Calendar_Location.focus(); return false; }
		if(isBlank(inputMod_Calendar_Name)) {	inputMod_Calendar_Name.focus(); return false; }
		if(isBlank(inputMod_Calendar_Contact)) {	inputMod_Calendar_Contact.focus(); return false; }
			inputMod_Calendar_TimeFrom.value=inputTimeFromHH.value+":"+inputTimeFromMM.value+":00";
		inputMod_Calendar_TimeTo.value=inputTimeToHH.value+":"+inputTimeToMM.value+":00";
	document.myForm.submit();
}
}
						</script> <input name="btAdd" type="button" class="button_80" id="btAdd" value="Add" onClick="verifySubmit();">                                      
						   &nbsp;&nbsp; <input name="btCalcel" type="button" class="button_80" id="btCalcel" onClick="
if(confirm('Are you sure to return to list?')) {
	document.myReturnForm.submit();
}
						" value="Cancel"> </td>
                                    </tr>
                                  </table></td>
                              </tr>
                            </table></td>
                        </tr>
                      </form>


            </table>
                    <br>
                    <br>
                    <? 
#########################################################
} else if($action=="addnew") { 
		if(strlen($inputMod_Calendar_DateFrom)!=10) { $inputMod_Calendar_DateFrom="0000-00-00"; }
	if(strlen($inputMod_Calendar_DateTo)!=10) { $inputMod_Calendar_DateTo="0000-00-00"; }
	if($inputIsDateTo=="") { $inputMod_Calendar_DateTo="0000-00-00"; }
	if($inputIsTimeTo=="") { $inputMod_Calendar_TimeTo="00:00:00"; }
	if( strlen($inputMod_Calendar_DateFrom)>0 && strlen($inputMod_Calendar_DateTo)>0 && $inputMod_Calendar_DateFrom!="0000-00-00"  && $inputMod_Calendar_DateTo!="0000-00-00" ) {
		if(strcmp($inputMod_Calendar_DateFrom,$inputMod_Calendar_DateTo)<1) { 
			// Do nothing.
		} else { 
			// Switch Date
			$myTmp = $inputMod_Calendar_DateFrom;
			$inputMod_Calendar_DateFrom = $inputMod_Calendar_DateTo;
			$inputMod_Calendar_DateTo = $myTmp;
		}
	}
	if($inputMod_Calendar_DateTo=="0000-00-00") { $inputMod_Calendar_DateTo=$inputMod_Calendar_DateFrom; }
	 $sql = "INSERT INTO ".$myModule_Table."(".$myModule_Table."_ModuleKey,".$myModule_Table."_DateFrom,".$myModule_Table."_DateTo,".$myModule_Table."_TimeFrom,".$myModule_Table."_TimeTo,".$myModule_Table."_Subject,".$myModule_Table."_Location,".$myModule_Table."_Customername,".$myModule_Table."_Contactname,".$myModule_Table."_Detail,".$myModule_Table."_CreateByID,".$myModule_Table."_CreateBy,".$myModule_Table."_CreateDate,".$myModule_Table."_LastUpdate,".$myModule_Table."_Status,".$myModule_Table."_Language ,".$myModule_Table."_GroupID) VALUES('$SystemModuleKey','$inputMod_Calendar_DateFrom','$inputMod_Calendar_DateTo','$inputMod_Calendar_TimeFrom','$inputMod_Calendar_TimeTo','".changeQuot($inputMod_Calendar_Subject)."','".changeQuot($inputMod_Calendar_Location)."','$inputMod_Calendar_Name','$inputMod_Calendar_Contact','$inputMod_Calendar_Detail','$System_Session_User_ID','$System_Session_UserName',NOW(),NOW(),'Enable','$System_Session_Language','$inputGroupID')";
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	$sql = "SELECT MAX(".$myModule_Table."_ID) FROM ".$myModule_Table;
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	$Row=MYSQL_FETCH_ARRAY($Query);
	$MaxID = $Row[0];
	srand(make_seed());
	$myrand = rand(1111,9999);
	// Check to create module data directory. ---------
	if(!is_dir($System_RelativePath_Upload."/".$SystemModuleKey)) { mkdir($System_RelativePath_Upload."/".$SystemModuleKey,0777); }
	if(!is_dir($myModule_Path_ThumbnailPicture)) { mkdir($myModule_Path_ThumbnailPicture,0777); }
	if(!is_dir($myModule_Path_HTMLFiles)) { mkdir($myModule_Path_HTMLFiles,0777); }
	if(!is_dir($myModule_Path_ImageLibrary)) { mkdir($myModule_Path_ImageLibrary,0777); }
	if(!is_dir($myModule_Path_UploadFiles)) { mkdir($myModule_Path_UploadFiles,0777); }

	// ------------------------------------------------
	
	for($i=0; $i<=count($inputFileUpload); $i++){
					srand(make_seed());
					$myrand = rand(1111,9999);
					$LastFileArray=explode(".",$inputFileUpload_name[$i]);
					$LastFile=$LastFileArray[count($LastFileArray)-1];
					$StrFileName=$MaxID."_".$myrand.".".$LastFile;
					
					if($inputFileUpload[$i]!=""){
					
					if(file_exists($myModule_Path_UploadFiles."/".$StrFileName)) {
							unlink($myModule_Path_UploadFiles."/".$StrFileName);
					}
					//echo $inputFileUpload[$i].",".$myModule_FullPath_UploadFiles."/".$StrFileName;
					if(copy($inputFileUpload[$i],$myModule_Path_UploadFiles."/".$StrFileName)) {
							chmod($myModule_Path_UploadFiles."/".$StrFileName,0777);
					} 
				$sql = " INSERT INTO ".$myModule_Table1_FileUpload."(".$myModule_Table1_FileUpload."_CalID ,".$myModule_Table1_FileUpload."_FileUpload , ".$myModule_Table1_FileUpload."_FileUploadName)".
				" VALUES ($MaxID,'$StrFileName','$LastFileArray[0]') ";
				$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error : เกิดความผิดพลาด <br>$sql<br>\n");
						
					}
		}//end for
	
	if(is_file($inputThumbnailPicture)) {
			$ImageData = getimagesize($inputThumbnailPicture);
			if($ImageData!=NULL) {
				if($ImageData[2]==1) { 
					$ImageType="gif";
				} elseif($ImageData[2]==2) {
					$ImageType="jpg";
				}
				$ThumbnailPictureName = "$MaxID-$myrand.$ImageType";
				if(file_exists($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName)) {
					unlink($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName);
				}
				if(copy($inputThumbnailPicture,$myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName)) {
					chmod($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName,0777);
				}
				$sql = "UPDATE ".$myModule_Table1." SET ".$myModule_Table1."_PictureFile='$ThumbnailPictureName' WHERE ".$myModule_Table1."_ID=".$MaxID;
				$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
			}
		}
	
	for ($index=0;$index<count($inputSelectAssign);$index++) {
						$sql = "SELECT * FROM ".$myModule_TableTag." WHERE ".$myModule_TableTag."_Detail = '$inputSelectAssign[$index]'";
						$QueryTag=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
						$RowTag=MYSQL_FETCH_ARRAY($QueryTag);
							if($RowTag[0]==""){
								$sql="INSERT INTO ".$myModule_TableTag." (".$myModule_TableTag."_Detail) VALUES('$inputSelectAssign[$index]')";
								$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
							}
				
							$tag.=$inputSelectAssign[$index].",";
				}
				
				$sql = "UPDATE ".$myModule_Table1." SET ".$myModule_Table1."_Tag='$tag' WHERE ".$myModule_Table1."_ID=".$MaxID;
				$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");

	
	?>
                    <form action="?" method="post" name="myForm" id="myForm">
                      <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                      <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                      <input name="action" type="hidden" id="action">
                      <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>">
                      <input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>">
                      <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>">
                      <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>">
                      <input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>">
                    </form>
                    <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
                    <? 
####################################################################
} else if($action=="edit") { 
	
	$sql="SELECT * FROM ".$myModule_Table." WHERE ".$myModule_Table."_ID=".$myCalID;
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	$Row=MYSQL_FETCH_ARRAY($Query);
	$HTMLsrc = $myModule_Path_HTMLFiles."/".$Row[$myModule_Table."_HtmlFile"];
	$HTMLToolContentBG = "#FFFFFF";
	
	?>
                    <br>
                    
                    <!-- import the calendar script -->
                    <link rel="stylesheet" type="text/css" href="../../css/myCalendarStyle.css">
                    <script type="text/javascript" src="lib/calendar.js"></script>
                    <script type="text/javascript" src="lib/lang/calendar-en.js"></script>
                    <script type="text/javascript" src="lib/loadcalendar.js"></script>
                    <!-- end the calendar script -->
                    <table width="95%" border="0" align="center" cellpadding="0" cellspacing="1" class="table_header">
                      <form action="?" method="post" name="myReturnForm" id="myReturnForm">
                        <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                        <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                        <input name="action" type="hidden" id="action" value="">
                        <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>">
                        <input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>">
                        <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>">
                        <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>">
                        <input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>">
                      </form>
                      <form action="?" method="post" name="myForm" id="myForm" enctype="multipart/form-data">
                        <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="myCalID" type="hidden" id="myCalID" value="<?=$myCalID?>">
                        <tr> 
                          <td bgcolor="#FFFFFF"> <table width="100%" border="0" cellpadding="2" cellspacing="1">
                              <tr> 
                                <td height="24" colspan="2" align="center" class="table_header"><b>แก้ไขข้อมูล</b></td>
                              </tr>
                              <tr> 
                                <td height="22" colspan="2" bgcolor="#F7F6F0" class="table_col3">&nbsp;&nbsp;<img src="../images/bullet/box21.gif" width="11" height="11">&nbsp;<span style="font-weight: bold">ข้อมูลวัน / เวลา</span> 
                                  <input name="inputMod_Calendar_TimeFrom" type="hidden" id="inputMod_Calendar_TimeFrom"> 
                                <input name="inputMod_Calendar_TimeTo" type="hidden" id="inputMod_Calendar_TimeTo"></td>
                              </tr>
                              <tr> 
                                <td height="22" align="right" class="table_col1">วันที่&nbsp;</td>
                                <td height="22" class="table_col2"><table border="0" align="left" cellpadding="1" cellspacing="0">
                                  <tr>
                                    <td nowrap="nowrap"><? $myTmpDate = substr($Row[$myModule_Table."_DateFrom"],0,10); ?>
                                        <? $myTmpDateTo = substr($Row[$myModule_Table."_DateTo"],0,10); ?>
                                      From&nbsp;</td>
                                    <td><input name="inputMod_Calendar_DateFrom" type="text" class="input_center" id="inputMod_Calendar_DateFrom" value="<? if($myTmpDate!="0000-00-00") { echo $myTmpDate; } ?>" size="10" maxlength="10" />
                                        <? $myTmpDate = substr($Row[$myModule_Table."_DateTo"],0,10); ?>                                    </td>
                                    <td><input name="button2" type="button" class="button_th_normal" onclick="return showCalendar('inputMod_Calendar_DateFrom', 'y-mm-dd');" value=" ... " />                                    </td>
                                    <td width="25" align="right"><input name="inputIsDateTo" type="checkbox" id="inputIsDateTo" value="Yes" onclick="if(document.getElementById('idDateTo1').style.display=='') { document.getElementById('idDateTo1').style.display='none'; document.getElementById('idDateTo2').style.display='none'; } else { document.getElementById('idDateTo1').style.display=''; document.getElementById('idDateTo2').style.display=''; } " <? if($myTmpDate!="0000-00-00") { echo " checked"; } ?> /></td>
                                    <td nowrap="nowrap">To&nbsp;</td>
                                    <td id="idDateTo1" <? if($myTmpDate=="0000-00-00") { ?>style="display:none"<? } ?>><input name="inputMod_Calendar_DateTo" type="text" class="input_center" id="inputMod_Calendar_DateTo" value="<?=$Row[$myModule_Table."_DateTo"]?>" size="10" maxlength="10" /></td>
                                    <td id="idDateTo2" <? if($myTmpDate=="0000-00-00") { ?>style="display:none"<? } ?>><input name="button2" type="button" class="button_th_normal" onclick="return showCalendar('inputMod_Calendar_DateTo', 'y-mm-dd');" value=" ... " /></td>
                                  </tr>
                                </table></td>
                              </tr>
                              
                              <tr> 
                                <td height="22" align="right" class="table_col1"> 
                                  <?
$myTime = explode(":",$Row[$myModule_Table."_TimeFrom"]);
$myTimeHH = $myTime[0]*1;
$myTimeMM = $myTime[1]*1;
?>
                                  เวลา&nbsp;</td>
                                <td height="22" class="table_col2"><table border="0" align="left" cellpadding="1" cellspacing="0">
                                    <tr> 
                                      <td width="30">From</td>
                                      <td><select name="inputTimeFromHH" class="select" id="inputTimeFromHH">
                                          <? for($i=0;$i<=23;$i++) { if($i<10) { $myi= "0".$i; } else { $myi=$i; } ?>
                                          <option value="<?=$myi?>"<? if($myTimeHH==$i) { echo " selected"; } ?>> 
                                          <?=$myi?>
                                          </option>
                                          <? } ?>
                                        </select></td>
                                      <td><b>:</b></td>
                                      <td><select name="inputTimeFromMM" class="select" id="inputTimeFromMM">
                                          <? for($i=0;$i<=59;$i++) { if($i<10) { $myi= "0".$i; } else { $myi=$i; } ?>
                                          <option value="<?=$myi?>"<? if($myTimeMM==$i) { echo " selected"; } ?>> 
                                          <?=$myi?>
                                          </option>
                                          <? } ?>
                                        </select></td>
                                      <td width="37" align="right"> 
                                        <?
$myTime = explode(":",$Row[$myModule_Table."_TimeTo"]);
$myTimeHH = $myTime[0]*1;
$myTimeMM = $myTime[1]*1;
?>
                                      <input name="inputIsTimeTo" type="checkbox" id="inputIsTimeTo" value="Yes" onClick="if(document.getElementById('idTimeTo1').style.display=='') { document.getElementById('idTimeTo1').style.display='none'; document.getElementById('idTimeTo2').style.display='none';  document.getElementById('idTimeTo3').style.display='none'; } else { document.getElementById('idTimeTo1').style.display=''; document.getElementById('idTimeTo2').style.display=''; document.getElementById('idTimeTo3').style.display=''; } " <? if($Row[$myModule_Table."_TimeTo"]!="00:00:00") { echo " checked"; } ?>></td>
                                      <td nowrap>To&nbsp;</td>
                                      <td  id="idTimeTo1" <? if($Row[$myModule_Table."_TimeTo"]=="00:00:00") { ?>style="display:none"<? } ?>><select name="inputTimeToHH" class="select" id="inputTimeToHH">
                                          <? for($i=0;$i<=23;$i++) { if($i<10) { $myi= "0".$i; } else { $myi=$i; } ?>
                                          <option value="<?=$myi?>"<? if($myTimeHH==$i) { echo " selected"; } ?>> 
                                          <?=$myi?>
                                          </option>
                                          <? } ?>
                                        </select></td>
                                      <td  id="idTimeTo2" <? if($Row[$myModule_Table."_TimeTo"]=="00:00:00") { ?>style="display:none"<? } ?>><b>:</b></td>
                                      <td  id="idTimeTo3" <? if($Row[$myModule_Table."_TimeTo"]=="00:00:00") { ?>style="display:none"<? } ?>><select name="inputTimeToMM" class="select" id="inputTimeToMM">
                                          <? for($i=0;$i<=59;$i++) { if($i<10) { $myi= "0".$i; } else { $myi=$i; } ?>
                                          <option value="<?=$myi?>"<? if($myTimeMM==$i) { echo " selected"; } ?>> 
                                          <?=$myi?>
                                          </option>
                                          <? } ?>
                                        </select></td>
                                    </tr>
                                  </table></td>
                              </tr>
							   <tr>
							  <td width="140" height="22" align="right" class="table_col1">ประเภทงาน&nbsp;</td>
                                <td height="22" class="table_col2"><select name="inputGroupID" id="select" class="select">
								<option value="1" <?php if (!(strcmp("1", $Row[$myModule_Table."_GroupID"]))) {echo "selected=\"selected\"";} ?>> นัดหมายงานลูกค้า </option>
								<option value="2" <?php if (!(strcmp("2", $Row[$myModule_Table."_GroupID"]))) {echo "selected=\"selected\"";} ?>> ติดตามงานลูกค้า </option>
								<option value="3" <?php if (!(strcmp("3", $Row[$myModule_Table."_GroupID"]))) {echo "selected=\"selected\"";} ?>> อื่น ๆ </option>
                                </select></td>
							</tr>
                              
                              <tr> 
                                <td width="140" height="22" align="right" class="table_col1">หัวข้อ&nbsp;</td>
                                <td height="22" class="table_col2"> <input name="inputMod_Calendar_Subject" type="text" class="input_left" id="inputYes" size="40"  maxlength="250" value="<?=$Row[$myModule_Table."_Subject"]?>">
                                <span style="color: #FF0000">*</span></td>
                              </tr>
                              <tr> 
                                <td width="140" height="22" align="right" class="table_col1">สถานที่&nbsp;</td>
                                <td height="22" class="table_col2"><textarea name="inputMod_Calendar_Location" cols="50" rows="6" class="input_textarea" id="inputMod_Calendar_Location"><?=$Row[$myModule_Table."_Location"]?></textarea>
                                <span style="color: #FF0000">*</span></td>
                              </tr>
                              <tr>
                                <td height="22" align="right" class="table_col1">IDลูกค้า</td>
                                <td height="22" class="table_col2">
								  <input name="inputMod_Calendar_Name" type="text" class="input_left" id="inputMod_Calendar_Name" size="50"  maxlength="250" value="<?=$Row[$myModule_Table."_Customername"]?>">
								
							    <span style="color: #FF0000">*</span></td>
                              </tr>
                              <tr>
                                <td height="22" align="right" class="table_col1">ผู้ติดต่อลูกค้า</td>
                                <td height="22" class="table_col2"><select name="inputMod_Calendar_Contact" id="inputMod_Calendar_Contact" class="select">
								
								<? 
								$sql = "SELECT DISTINCT crm_system_staff_FName,crm_system_staff_LName FROM crm_system_staff";
								
								$QueryCalendarGroup=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
								while($RowCalendarGroup=MYSQL_FETCH_ARRAY($QueryCalendarGroup)){
								?>
								<option value="<?=$RowCalendarGroup[crm_system_staff_FName]." ".$RowCalendarGroup[crm_system_staff_LName]?>"  <? if($RowCalendarGroup[crm_system_staff_FName]." ".$RowCalendarGroup[crm_system_staff_LName]==$Row[crm_mod_calendar_Contactname]){ echo "selected";}?>><?=$RowCalendarGroup[crm_system_staff_FName]." ".$RowCalendarGroup[crm_system_staff_LName]?></option>
								<? }?>
								
                                </select>
                                <span style="color: #FF0000">*</span></td>
                              </tr>
                              <tr>
                                <td height="22" align="right" class="table_col1">รายละเอียด</td>
                                <td height="22" class="table_col2"><textarea name="inputMod_Calendar_Detail" cols="50" rows="6" class="input_textarea" id="textarea"><?=$Row[$myModule_Table."_Detail"]?>
                                </textarea></td>
                              </tr>
                              <tr> 
                                <td height="22" colspan="2" class="table_col3">&nbsp;</td>
                              </tr>
                            </table>
                            <table width="100%" height="24" border="0" cellpadding="3" cellspacing="0">
                              <tr align="right"> 
                                <td height="30" colspan="4" align="center" class="table_footer"> 
                                  <table width="300" border="0" cellspacing="0" cellpadding="2">
                                    <tr align="center"> 
                                      <td> <script language="JavaScript" type="text/JavaScript">
function isBlank(myObj) { if(myObj.value=='') { return true; } return false; }
function isNumber(myObj) { return !isNaN(myObj.value*1) }
function verifySubmit() {
	with(document.myForm) {
		if(isBlank(inputMod_Calendar_Subject)) {	inputMod_Calendar_Subject.focus(); return false; }
		inputMod_Calendar_TimeFrom.value=inputTimeFromHH.value+":"+inputTimeFromMM.value+":00";
		inputMod_Calendar_TimeTo.value=inputTimeToHH.value+":"+inputTimeToMM.value+":00";
		if(isBlank(inputMod_Calendar_Subject)) {	inputMod_Calendar_Subject.focus(); return false; }
		if(isBlank(inputMod_Calendar_Location)) {	inputMod_Calendar_Location.focus(); return false; }
		if(isBlank(inputMod_Calendar_Name)) {	inputMod_Calendar_Name.focus(); return false; }

		if(isBlank(inputMod_Calendar_Contact)) {	inputMod_Calendar_Contact.focus(); return false; }

	}
	document.myForm.submit();
}
						</script> <input name="btAdd" type="button" class="button_80" id="btAdd" value="Save" onClick="verifySubmit();"> 
                                      </td>
                                      <td> <input name="btCalcel" type="button" class="button_80" id="btCalcel" onClick="
if(confirm('Are you sure to return to list?')) {
	document.myReturnForm.submit();
}
						" value="Cancel"> </td>
                                    </tr>
                                  </table></td>
                              </tr>
                            </table></td>
                        </tr>
                      </form>
            </table>
                    <br>
                    <br>
                    <? 
#########################################################
} else if($action=="update") { 
	$MaxID = $myCalID;
	if(strlen($inputMod_Calendar_DateFrom)!=10) { $inputMod_Calendar_DateFrom="0000-00-00"; }
	if(strlen($inputMod_Calendar_DateTo)!=10) { $inputMod_Calendar_DateTo="0000-00-00"; }
	if($inputIsDateTo=="") { $inputMod_Calendar_DateTo="0000-00-00"; }
	if($inputIsTimeTo=="") { $inputMod_Calendar_TimeTo="00:00:00"; }
	if( strlen($inputMod_Calendar_DateFrom)>0 && strlen($inputMod_Calendar_DateTo)>0 && $inputMod_Calendar_DateFrom!="0000-00-00"  && $inputMod_Calendar_DateTo!="0000-00-00" ) {
		if(strcmp($inputMod_Calendar_DateFrom,$inputMod_Calendar_DateTo)<1) { 
			// Do nothing.
		} else { 
			// Switch Date
			$myTmp = $inputMod_Calendar_DateFrom;
			$inputMod_Calendar_DateFrom = $inputMod_Calendar_DateTo;
			$inputMod_Calendar_DateTo = $myTmp;
		}
	}
	if($inputMod_Calendar_DateTo=="0000-00-00") { $inputMod_Calendar_DateTo=$inputMod_Calendar_DateFrom; }
	$sql = "UPDATE ".$myModule_Table." SET ".$myModule_Table."_DateFrom = '$inputMod_Calendar_DateFrom',".$myModule_Table."_DateTo = '$inputMod_Calendar_DateTo',".$myModule_Table."_TimeFrom = '$inputMod_Calendar_TimeFrom',".$myModule_Table."_TimeTo = '$inputMod_Calendar_TimeTo',".$myModule_Table."_Subject = '".changeQuot($inputMod_Calendar_Subject)."',".$myModule_Table."_Location = '".changeQuot($inputMod_Calendar_Location)."',".$myModule_Table."_Customername = '$inputMod_Calendar_Name',".$myModule_Table."_Contactname = '$inputMod_Calendar_Contact',".$myModule_Table."_Detail = '$inputMod_Calendar_Detail',".$myModule_Table."_LastUpdate=NOW(),".$myModule_Table."_GroupID = '$inputGroupID' WHERE ".$myModule_Table."_ID=".$MaxID;
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");

	?>
                    <form action="?" method="post" name="myForm" id="myForm">
                      <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                      <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                      <input name="action" type="hidden" id="action">
                      <input name="PageSize" type="hidden" id="PageSize" value="<?=$PageSize?>">
                      <input name="PageShow" type="hidden" id="PageShow" value="<?=$PageShow?>">
                      <input name="ASCDESC" type="hidden" id="ASCDESC" value="<?=$ASCDESC?>">
                      <input name="OrderBy" type="hidden" id="OrderBy" value="<?=$OrderBy?>">
                      <input name="PageSearch" type="hidden" id="PageSearch" value="<?=$PageSearch?>">
                    </form>
                    <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script>
                    <? 
#########################################################
} else if($action=="delete") { 
		if(strlen($myCalID)>0) {
			$sql = "SELECT * FROM ".$myModule_Table." WHERE ".$myModule_Table."_ID=".$myCalID;
			$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
			$Row=MYSQL_FETCH_ARRAY($Query);


			$sql = "DELETE FROM ".$myModule_Table." WHERE ".$myModule_Table."_ID=".$myCalID;
			$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") { 
	$sql="UPDATE ".$myModule_Table." SET ".$myModule_Table."_Status='$SelectStatus' WHERE ".$myModule_Table."_ID=".$myCalID;
	$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 {

//include("function.php");

if($myDate=="") { $myDate=getDateNow(); }
$myDateArray = explode("-",$myDate);

// Find Start Week Day ##############################################
$today=getdate(mktime(0,0,0,$myDateArray[1],1,$myDateArray[0]));

$NextMonthArray=getdate(mktime(0,0,0,$myDateArray[1]+1,1,$myDateArray[0]));
$Day=$NextMonthArray[mday]; $Month=$NextMonthArray[mon]; $Year=$NextMonthArray[year];
$NextMonth=sprintf("%04d-%02d-%02d",$Year,$Month,$Day);

$PrevMonthArray=getdate(mktime(0,0,0,$myDateArray[1]-1,1,$myDateArray[0]));
$Day=$PrevMonthArray[mday]; $Month=$PrevMonthArray[mon]; $Year=$PrevMonthArray[year];
$PrevMonth=sprintf("%04d-%02d-%02d",$Year,$Month,$Day);

$startWeekDay=$today[wday];
$myDateYear=$today[year];
$myDateMonth=$today[mon];
$endDayOfMonth=getEndDayOfMonth($myDate);

$myStartDateOfMonth = sprintf("%04d-%02d-%02d",$myDateArray[0],$myDateArray[1],1);
$myEndDateOfMonth = sprintf("%04d-%02d-%02d",$myDateArray[0],$myDateArray[1],$endDayOfMonth);

$myCalendarData[0]="";
$myCalendarEventCounter[0]=0;

if($toolbarPageSearch1!="") { 

$toolbarPageSearch1=trim($toolbarPageSearch1);
 }
// Load activity data #################################################
$sql  = "SELECT * FROM ".$myModule_Table." WHERE ";
$sql .= $myModule_Table."_Language='$System_Session_Language' AND ";
if($toolbarPageSearch1!=""){
	$sql .= $myModule_Table."_Studentyear='$toolbarPageSearch1' AND";
}
$sql .= " ( ";
$sql .= " ( ".$myModule_Table."_DateFrom>='$myStartDateOfMonth' AND ".$myModule_Table."_DateTo='0000-00-00' ) OR ";
$sql .= " ( ".$myModule_Table."_DateFrom>='$myStartDateOfMonth' AND ".$myModule_Table."_DateFrom<='$myEndDateOfMonth' ) OR ";
$sql .= " ( ".$myModule_Table."_DateTo>='$myStartDateOfMonth' AND ".$myModule_Table."_DateTo<='$myEndDateOfMonth' ) OR ";
$sql .= " ( ".$myModule_Table."_DateFrom<='$myStartDateOfMonth' AND ".$myModule_Table."_DateTo>='$myEndDateOfMonth' ) ";
$sql .= " ) ORDER BY ".$myModule_Table."_TimeFrom ASC ";
$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
$RecordCount=MYSQL_NUMROWS($Query);
$index=1;
if($RecordCount>0) {
	while($index<$RecordCount+1) {
		$Row=MYSQL_FETCH_ARRAY($Query);
		if(strcmp($Row[$myModule_Table."_DateFrom"],$myStartDateOfMonth)<1) { 
			$myDateStart=$myStartDateOfMonth;
		} else {
			$myDateStart=$Row[$myModule_Table."_DateFrom"];
		}
		$myStart=substr($myDateStart,8,2)*1;
		if($Row[$myModule_Table."_DateTo"]!="0000-00-00") {
			if(strcmp($myEndDateOfMonth,$Row[$myModule_Table."_DateTo"])<1) { 
				$myDateEnd=$myEndDateOfMonth;
			} else {
				$myDateEnd=$Row[$myModule_Table."_DateTo"];
			}
		} else {
			$myDateEnd="0000-00-00";
		}
		if($myDateEnd=="0000-00-00") {
				$myCalendarEventCounter[$myStart]++;
				$myCalendarData[$myStart].="<table width=100% border=0 cellspacing=0 cellpadding=2><tr class=table_col3><td width=14 align=center><img src=../images/bullet/red-circle-arrow.gif width=9 height=9></td>";
				if($Row[$myModule_Table."_TimeFrom"]=="00:00:00") {
					$myCalendarData[$myStart].="<td><b>Time : All day";
				} else {
					$myCalendarData[$myStart].="<td><b>Time : ".substr($Row[$myModule_Table."_TimeFrom"],0,5);
					if($Row[$myModule_Table."_TimeTo"]!="00:00:00") {
						$myCalendarData[$myStart].=" - ".substr($Row[$myModule_Table."_TimeTo"],0,5);
					}
				}
				$myCalendarData[$myStart].="</b></td>";
				 if($System_Session_Level=="Administrator")  { 
					$myCalendarData[$myStart].="<td width=16 align=center><a href=# onClick=setSubmit('edit',".$Row[$myModule_Table."_ID"].")><img src=../../img/icons/edit.png width=16 height=16 border=0 alt=edit></a></td>";
					$myCalendarData[$myStart].="<td width=16 align=center><a href=# onClick=setSubmit('delete',".$Row[$myModule_Table."_ID"].")><img src=../../img/icons/delete.png width=16 height=16 border=0 alt=delete></a></td>";
				}
				$myCalendarData[$myStart].="</tr></table><table width=95% border=0 cellspacing=0 cellpadding=2><tr> ";
				$myCalendarData[$myStart].="<td><a href=# onClick=setSubmit('view',".$Row[$myModule_Table."_ID"].")>".$Row[$myModule_Table."_Subject"]."</a></td>";
				$myCalendarData[$myStart].="</tr></table>";
		} else {
			$myEnd=substr($myDateEnd,8,2)*1;
			for($i=$myStart;$i<=$myEnd;$i++) {
				$myCalendarEventCounter[$i]++;
				$myCalendarData[$i].="<table width=100% border=0 cellspacing=0 cellpadding=2 bgcolor=#E4E9EF><tr class=table_col3>";
				if($Row[$myModule_Table."_TimeFrom"]=="00:00:00") {
				
				$color="#E4E9EF";
					$myCalendarData[$i].="<td bgcolor=$color><b>Time : All day";
				} else {
					$myCalendarData[$i].="<td bgcolor=$color><b>Time : ".substr($Row[$myModule_Table."_TimeFrom"],0,5);
					if($Row[$myModule_Table."_TimeTo"]!="00:00:00") {
						$myCalendarData[$i].=" - ".substr($Row[$myModule_Table."_TimeTo"],0,5);
					}
				}
				$myCalendarData[$i].="</b></td>";
				$myCalendarData[$i].="<td width=16 align=center bgcolor=$color><a href=# onClick=setSubmit('view',".$Row[$myModule_Table."_ID"].")><img src=../../img/icons/view.png width=16 height=16 border=0 alt=view></a></td>";
				/* if($System_Session_Level=="Administrator")  { 
					$myCalendarData[$i].="<td width=16 align=center bgcolor=$color><a href=# onClick=setSubmit('edit',".$Row[$myModule_Table."_ID"].")><img src=../../img/icons/edit.png width=16 height=16 border=0 alt=edit></a></td>";
					$myCalendarData[$i].="<td width=16 align=center bgcolor=$color><a href=# onClick=setSubmit('delete',".$Row[$myModule_Table."_ID"].")><img src=../../img/icons/delete.png width=16 height=16 border=0 alt=delete></a></td>";
				 }*/
				 //////// select detailoverall table ////////
				 $sql="select * from cm_mod_detailoverall where cm_mod_detailoverall_ID='$Row[cm_mod_calendar_DetailID]'";
				$query=mysql_query($sql);
				$rows=mysql_fetch_array($query);
				//////// select detailoverall table ////////
				$myCalendarData[$i].="</tr></table><table width=95% border=0 cellspacing=0 cellpadding=2><tr> ";
				$myCalendarData[$i].="<td align=left><b><a href=# onClick=setSubmit('view',".$Row[$myModule_Table."_ID"].")>".$Row[$myModule_Table."_Subject"]."</a></b></td>";
				$myCalendarData[$i].="<tr> ";
				
				$myCalendarData[$i].="<td align=left>รายวิชา : ".$rows[cm_mod_detailoverall_Subject]."</td>";
				$myCalendarData[$i].="<tr> ";
				$myCalendarData[$i].="<td align=left>เรื่องที่เรียน : ".$rows[cm_mod_detailoverall_Course]."</td>";
				$myCalendarData[$i].="<tr> ";
				$myCalendarData[$i].="<td align=left>นักศึกษาที่เรียน : ".$rows[cm_mod_detailoverall_Studentyear]."</td>";
				$myCalendarData[$i].="<tr> ";
				$myCalendarData[$i].="<td align=left>ผู้สอน : ".$rows[cm_mod_detailoverall_Teacher]."</td>";
				$myCalendarData[$i].="<tr> ";
				$myCalendarData[$i].="<td align=right>สร้างโดย : <b>".$Row[$myModule_Table."_CreateBy"]."</b> - ".$Row[$myModule_Table."_CreateDate"]."</td>";
				$myCalendarData[$i].="</tr></table>";
			}
		}
		$index++;
	}
} 
echo "<br>";

// Load calendar display #############################################
$mCount=1;
?>
                   
                    <script language="JavaScript" type="text/JavaScript">
function ShowInformationWindow(myDivName,myData,RefX,RefY) {
	document.getElementById('idInformationData').innerHTML=myData;
	document.getElementById(myDivName).style.display=''; 
	document.getElementById(myDivName).style.left = document.body.scrollLeft + window.event.clientX + RefX;
	document.getElementById(myDivName).style.top= document.body.scrollTop+ window.event.clientY + RefY;
}
	  </script>
      <table width="95%" border="0" align="center" cellpadding="2" cellspacing="0" >
                  <form action="" method="post" name="mySearchForm1" id="mySearchForm1" onsubmit="return false;">
                    <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>" />
                    <input name="SystemMenuID2" type="hidden" id="SystemMenuID2" value="<?=$SystemMenuID?>" />
                    <tr>
                      <td>
                        
                        <div align="right">
						  <select name="toolbarPageSearch1" id="toolbarPageSearch1" class="select" onchange="document.mySearchForm1.submit();">
											<option selected="selected">เลือกนักศึกษาชั้นปี</option>
                                            <option value="">ทั้งหมด</option>
                                           <option value="ปี 1">ปี 1</option>
                                    		<option value="ปี 2">ปี 2</option>
                                   			 <option value="ปี 3">ปี 3</option>
                                    		<option value="ปี 4">ปี 4</option>
                                    		<option value="ปี 5">ปี 5</option>
                                   			 <option value="ปี 6">ปี 6</option>
                                            </option>
									</select>
                        </div></td></tr>
                  </form>
                </table>
                    <br />
                    <table border="0" align="center" cellpadding="0" cellspacing="1" class="table_header">
                      <form action="?" method="get" 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="myDate" type="hidden" id="myDate" value="<?=$myDate?>">
                        <input name="myCalID" type="hidden" id="myCalID" value="0">
                        <input name="toolbarPageSearch1" type="hidden" id="toolbarPageSearch1" value="<?=$toolbarPageSearch1?>">
                        <tr> 
                          <td bgcolor="#FFFFFF"><table width="100%" border="0" cellpadding="0" cellspacing="1">
                            <tr>
                              <td height="24" colspan="7" align="center" class="menu_table_header"><table width="100%" height="24" border="0" cellpadding="0" cellspacing="0">
                                  <tr>
                                    <td width="20" align="center" valign="middle" bgcolor="#F7F6F0" onclick="
document.myForm.myDate.value='<?=$PrevMonth?>';
document.myForm.submit();
									  " onmouseover="this.style.cursor='hand'; ">&nbsp;<img src="images/prevmonth.gif" width="10" height="10" /></td>
                                    <td width="70" align="left" bgcolor="#57BBCB" onclick="
document.myForm.myDate.value='<?=$PrevMonth?>';
document.myForm.submit();
									  " onmouseover="this.style.cursor='hand'; "><font color="#000000"><b>
                                      <?
$myDateText = ShowDateEn($PrevMonth);
echo substr($myDateText,2,strlen($myDateText))
?>
                                    </b></font></td>
                                    <td align="center" bgcolor="#57BBCB"><table width="255" border="0" cellpadding="2" cellspacing="0">
                                        <tr>
                                          <td><span style="font-weight: bold">Month</span>
                                              <select name="inputMonth" class="select" id="inputMonth" onchange="
document.myForm.myDate.value=document.myForm.inputYear.value+'-'+document.myForm.inputMonth.value+'-01';
document.myForm.submit();
											">
                                                <option value="01"<? if($myDateMonth==1) { echo " selected"; } ?>>January</option>
                                                <option value="02"<? if($myDateMonth==2) { echo " selected"; } ?>>February</option>
                                                <option value="03"<? if($myDateMonth==3) { echo " selected"; } ?>>March</option>
                                                <option value="04"<? if($myDateMonth==4) { echo " selected"; } ?>>April</option>
                                                <option value="05"<? if($myDateMonth==5) { echo " selected"; } ?>>May</option>
                                                <option value="06"<? if($myDateMonth==6) { echo " selected"; } ?>>June</option>
                                                <option value="07"<? if($myDateMonth==7) { echo " selected"; } ?>>July</option>
                                                <option value="08"<? if($myDateMonth==8) { echo " selected"; } ?>>August</option>
                                                <option value="09"<? if($myDateMonth==9) { echo " selected"; } ?>>September</option>
                                                <option value="10"<? if($myDateMonth==10) { echo " selected"; } ?>>October</option>
                                                <option value="11"<? if($myDateMonth==11) { echo " selected"; } ?>>November</option>
                                                <option value="12"<? if($myDateMonth==12) { echo " selected"; } ?>>December</option>
                                            </select></td>
                                          <td><span style="font-weight: bold">Year</span>
                                              <select name="inputYear" class="select" id="inputYear" onchange="
document.myForm.myDate.value=document.myForm.inputYear.value+'-'+document.myForm.inputMonth.value+'-01';
document.myForm.submit();
											">
                                                <? for($i=$myDateYear-4;$i<=$myDateYear+4;$i++) { ?>
                                                <option value="<?=$i?>"<? if($myDateYear==$i) { echo " selected"; } ?>>
                                                <?=$i?>
                                                </option>
                                                <? } ?>
                                            </select></td>
                                        </tr>
                                    </table></td>
                                    <td width="70" align="right" bgcolor="#57BBCB"  onclick="
document.myForm.myDate.value='<?=$NextMonth?>';
document.myForm.submit();
									  " onmouseover="this.style.cursor='hand'; "><font color="#000000"><b>
                                      <?
$myDateText = ShowDateEn($NextMonth);
echo substr($myDateText,2,strlen($myDateText))
?>
                                    </b></font></td>
                                    <td width="20" align="center" bgcolor="#F7F6F0" onclick="
document.myForm.myDate.value='<?=$NextMonth?>';
document.myForm.submit();
									  " onmouseover="this.style.cursor='hand'; "><img src="images/nextmonth.gif" width="10" height="10" /></td>
                                  </tr>
                                  <tr>
                                    <td align="center" valign="middle" onclick="
document.myForm.myDate.value='<?=$PrevMonth?>';
document.myForm.submit();
									  " onmouseover="this.style.cursor='hand'; ">&nbsp;</td>
                                    <td align="left" onmouseover="this.style.cursor='hand'; " onclick="
document.myForm.myDate.value='<?=$PrevMonth?>';
document.myForm.submit();
									  ">&nbsp;</td>
                                    <td align="center">&nbsp;</td>
                                    <td align="right" onmouseover="this.style.cursor='hand'; "  onclick="
document.myForm.myDate.value='<?=$NextMonth?>';
document.myForm.submit();
									  ">&nbsp;</td>
                                    <td align="center" onclick="
document.myForm.myDate.value='<?=$NextMonth?>';
document.myForm.submit();
									  " onmouseover="this.style.cursor='hand'; ">&nbsp;</td>
                                  </tr>
                              </table></td>
                            </tr>
                            <tr>
                              <td width="70" height="22" align="center" bgcolor="#E9E0D5" class="table_col3" style="color: #a43708; font-weight: bold">Sun</td>
                              <td width="70" align="center" bgcolor="#E9E0D5" class="table_col3" style="color: #a43708; font-weight: bold">Mon</td>
                              <td width="70" align="center" bgcolor="#E9E0D5" class="table_col3" style="color: #a43708; font-weight: bold">Tue</td>
                              <td width="70" align="center" bgcolor="#E9E0D5" class="table_col3" style="color: #a43708; font-weight: bold">Wed</td>
                              <td width="70" align="center" bgcolor="#E9E0D5" class="table_col3" style="color: #a43708; font-weight: bold">Thu</td>
                              <td width="70" align="center" bgcolor="#E9E0D5" class="table_col3" style="color: #a43708; font-weight: bold">Fri</td>
                              <td width="70" height="22" align="center" bgcolor="#E9E0D5" class="table_col3" style="color: #a43708; font-weight: bold">Sat</td>
                            </tr>
                            <? 
if($startWeekDay>0) { 
	?>
                            <tr>
                              <?
	for($i=0;$i<$startWeekDay;$i++) {
	?>
                              <td width="70" height="70" class="table_col2">&nbsp;</td>
                              <? 
	}
for($i;$i<7;$i++) {
	?>
                              <? if($myCalendarEventCounter[$mCount]==0 || $myCalendarEventCounter[$mCount]=="") { ?>
                              <td width="70" height="70" class="table_col1"><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
                                  <tr>
                                    <td width="8"><img src="../images/blank.gif" width="1" height="1" /></td>
                                    <td height="8"><img src="../images/blank.gif" width="1" height="1" /></td>
                                    <td width="8" height="8"><img src="../images/blank.gif" width="1" height="1" /></td>
                                  </tr>
								    	<? $d=date("d");
								  $m=date("n");
								  $y=date("Y");
								  $myDateMonth;
									if($d=="$mCount" && $myDateMonth=="$m" && $myDateYear=="$y")
									{
											echo "<div align=center><font color=#a43708>Today</font></align>";
									}
									?>
                                  <tr>
                                    <td width="8"><img src="../images/blank.gif" width="1" height="1" /></td>
                                    <td align="right" valign="top"><?=$mCount?>                                    </td>
                                    <td width="8"><img src="../images/blank.gif" width="1" height="1" /></td>
                                  </tr>
                              </table></td>
                              <? } else { ?>
                              <td width="70" height="70" class="table_col1" onmouseover="myMouseOver(this)" onmouseout="myMouseOut(this)" onclick="
document.myForm.myDate.value='<?=sprintf("%04d-%02d-%02d",$myDateYear,$myDateMonth,$mCount)?>';	
document.getElementById('idInformationDataHeader').innerHTML = '<?=ShowDateEn(sprintf("%04d-%02d-%02d",$myDateYear,$myDateMonth,$mCount))?>';
<? if($i>3) { ?>
ShowInformationWindow('divInformationWindow','<?=addslashes($myCalendarData[$mCount])?>',-210,10);
<? } else { ?>
ShowInformationWindow('divInformationWindow','<?=addslashes($myCalendarData[$mCount])?>',10,10);
<? } ?>
								"><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
                                  <tr>
                                    <td width="8"><img src="../images/blank.gif" width="1" height="1" /></td>
                                    <td height="8"><img src="../images/blank.gif" width="1" height="1" /></td>
                                    <td width="8" height="8"><img src="images/calendar_cellbg.gif" width="8" height="8" /></td>
                                  </tr>
								    	<? $d=date("d");
								  $m=date("n");
								  $y=date("Y");
								  $myDateMonth;
									if($d=="$mCount" && $myDateMonth=="$m" && $myDateYear=="$y")
									{
											echo "<div align=center><font color=#a43708>Today</font></align>";
									}
									?>
                                  <tr>
                                    <td width="8"><img src="../images/blank.gif" width="1" height="1" /></td>
                                    <td align="right" valign="top"><b>
                                      <?=$mCount?>
                                    </b></td>
                                    <td width="8"><img src="../images/blank.gif" width="1" height="1" /></td>
                                  </tr>
                                  <tr>
                                    <td height="30" colspan="3"><img src="../images/blank.gif" width="1" height="1" /><font color="#999999">(
                                      <?=$myCalendarEventCounter[$mCount]?>
                                    event )</font><img src="../images/blank.gif" width="1" height="1" /></td>
                                  </tr>
                              </table></td>
                              <? } ?>
                              <?
	$mCount++;
} 
?>
                            </tr>
                            <?
}
$colcount=0;
for($mCount;$mCount<=$endDayOfMonth;$mCount++) {
	if($colcount==0) {
		?>
                            <tr align="center">
                              <?
	}
	$colcount++;
	?>
                              <?
	if($myCalendarEventCounter[$mCount]==0 || $myCalendarEventCounter[$mCount]=="") { ?>
                              <td width="70" height="70" class="table_col1"><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
                                  <tr>
                                    <td width="8"><img src="../images/blank.gif" width="1" height="1" /></td>
                                    <td height="8"><img src="../images/blank.gif" width="1" height="1" /></td>
                                    <td width="8" height="8"><img src="../images/blank.gif" width="1" height="1" /></td>
                                  </tr>  	<? $d=date("d");
								  $m=date("n");
								  $y=date("Y");
								  $myDateMonth;
									if($d=="$mCount" && $myDateMonth=="$m" && $myDateYear=="$y")
									{
											echo "<div align=center><font color=#a43708>Today</font></align>";
									}
									?>
                                  <tr>
                                    <td width="8"><img src="../images/blank.gif" width="1" height="1" /></td>
                                    <td align="right" valign="top"><?=$mCount?>                                    </td>
                                    <td width="8"><img src="../images/blank.gif" width="1" height="1" /></td>
                                  </tr>
                              </table></td>
                              <? } else { ?>
                              <td width="70" height="70" class="table_col1" onmouseover="myMouseOver(this)" onmouseout="myMouseOut(this)" onclick="
document.myForm.myDate.value='<?=sprintf("%04d-%02d-%02d",$myDateYear,$myDateMonth,$mCount)?>';	
document.getElementById('idInformationDataHeader').innerHTML = '<?=ShowDateEn(sprintf("%04d-%02d-%02d",$myDateYear,$myDateMonth,$mCount))?>';
<? if($colcount>3) { ?>
ShowInformationWindow('divInformationWindow','<?=addslashes($myCalendarData[$mCount])?>',-210,10);
<? } else { ?>
ShowInformationWindow('divInformationWindow','<?=addslashes($myCalendarData[$mCount])?>',10,10);
<? } ?>
								"><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
                                  <tr>
                                    <td width="8"><img src="../images/blank.gif" width="1" height="1" /></td>
                                    <td height="8"><img src="../images/blank.gif" width="1" height="1" /></td>
                                    <td width="8" height="8"><img src="images/calendar_cellbg.gif" width="8" height="8" /></td>
                                  </tr>
								  	<? $d=date("d");
								  $m=date("n");
								  $y=date("Y");
								  $myDateMonth;
									if($d=="$mCount" && $myDateMonth=="$m" && $myDateYear=="$y")
									{
											echo "<div align=center><font color=#a43708>Today</font></align>";
									}
									?>
                                  <tr>
                                    <td width="8"><img src="../images/blank.gif" width="1" height="1" /></td>
									<td align="right" valign="top"><b>
									
                                      <?=$mCount?>
                                    </b></td>
                                    <td width="8"><img src="../images/blank.gif" width="1" height="1" /></td>
                                  </tr>
                                  <tr>
                                    <td height="30" colspan="3"><img src="../images/blank.gif" width="1" height="1" /><font color="#999999">(
                                      <?=$myCalendarEventCounter[$mCount]?>
                                    event )</font><img src="../images/blank.gif" width="1" height="1" /></td>
                                  </tr>
                              </table></td>
                              <? } ?>
                              <?
	if($colcount==7) {
		?>
                            </tr>
                            <?
		$colcount=0;
	}
}
if($colcount>0) {
	for($colcount;$colcount<7;$colcount++) {
		?>
  <td width="70" height="70" class="table_col2">&nbsp;</td>
      <? 
	}
	?>
  </tr>
  <?
}
?>
                          </table></td>
                        </tr>
                      </form>
                </table>
				 <div id="divInformationWindow" style="display:none; position:absolute; top:83px; left:158px; width: 600px; z-index: 1; height: 138px;">
                 
                 <br />
<br />
                      <table width="80%" style="border-collapse: collapse" border="2" bordercolor="#E8E7E1"  cellpadding="0" cellspacing="1" align="center">
                        <tr> 
                          <td height="22" bgcolor="#F7F6F0"><table width="100%" height="22" border="0" cellpadding="0" cellspacing="0" class="table_header">
                              <tr> 
                                <td align="center" bgcolor="#F7F6F0"  id="idInformationDataHeader"></td>
                                <td width="22" bgcolor="#F7F6F0" align="center"><img src="../images/icon/ico215.gif" width="16" height="16" onMouseOver="this.style.cursor='hand'" onClick="document.getElementById('divInformationWindow').style.display='none'; "></td>
                              </tr>
                          </table></td>
                        </tr>
                        <tr> 
                          <td height="120" align="center"  bgcolor="#F4F9FF" valign="top" class="table_row1" id="idInformationData">&nbsp;</td>
                        </tr>
                        <tr> 
                          <td height="26" align="center" class="table_footer" bgcolor="#F7F6F0"><table width="359" border="0" cellpadding="2" cellspacing="0">
                              <tr align="center">
                                <td><br>
                                <input name="Button" type="button" class="button_80" value="          Close           " onClick="document.getElementById('divInformationWindow').style.display='none'; "></td></tr>
                            </table><br />
</td>
                        </tr>
                      </table>
                    </div>
                    <script language="JavaScript" type="text/JavaScript">
	function myMouseOver(myObj) {
		//myObj.style.cursor='hand'; 
		myObj.className='table_rowover';
		myObj.style.cursor='hand';
	}
	function myMouseOut(myObj) {
		myObj.className='table_col1'; 
	}
	function setSubmit(myAction,myCalID) {
		if(myAction=='delete') { 
			if(confirm("Are you sure to delete this event?")) {
				document.myForm.myCalID.value=myCalID;
				document.myForm.action.value='delete';
				document.myForm.submit();
			}
		}
		if(myAction=='edit') { 
			if(confirm("Are you sure to edit this event?")) {
				document.myForm.myCalID.value=myCalID;
				document.myForm.action.value='edit';
				document.myForm.submit();
			}
		}
		if(myAction=='view') { 
			document.myForm.myCalID.value=myCalID;
			document.myForm.action.value='view';
			document.myForm.submit();
		}
	}
	                </script>                    
                    <br>
                    <br>
                    <br>
                    <br>
                    <br>
                    <br>
                    <? 
}
#########################################################
?>
              </div>
              
      <!-- InstanceEndEditable --> </td>
                  <td width="15">&nbsp;</td>
                </tr>
            </table></td>
            <td background="../../images/content_border/content_border_right.jpg">&nbsp;</td>
          </tr>
          <tr>
            <td><img src="../../images/l/left_menu_03_l.jpg" width="24" height="29" /></td>
            <td colspan="2"><img src="../../images/l/left_menu_03_r.jpg" width="197" height="29" /></td>
            <td><img src="../../images/content_border/content_border_03.jpg" width="747" height="29" /></td>
            <td><img src="../../images/content_border/content_border_right2.jpg" width="17" height="29" /></td>
          </tr>
        </table></td>
        </tr>
    </table></td>
  </tr>
</table>
</body>
<!-- InstanceEnd --></html>

Hacked By AnonymousFox1.0, Coded By AnonymousFox