<!--
<!--
var doAlerts=true;
function changeSheets(whichSheet){
 
  if(document.styleSheets){
  
	var c = document.styleSheets.length;
	
	for(var i=1;i<c;i++){
	  if(i!=whichSheet){
		document.styleSheets[i].disabled=true;
	  }else{
		document.styleSheets[i].disabled=false;
	  }
	}
  }
}
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 News(Type) {
	//var News = 
	var Entertainment = document.getElementById('entertainment');
	var Sport = document.getElementById('sport');
	
	var moe2 = document.getElementById('moenews2');
	var moe3 = document.getElementById('moenews3');
		
	var outmoe2 =  '<img src="../../images/mainpage/main_152.gif" name="Image81" width="114" height="41" id="Image81" onMouseOver="MM_swapImage(\'Image81\',\'\',\'../../images/mainpage/mnuover_152.gif\',1)" onMouseOut="MM_swapImgRestore()" onClick="News(2)" style="cursor:pointer">';
		var onmoe2 = '<img src="../../images/mainpage/mnuover_152.gif" name="Image81" width="114" height="41" id="Image81" onMouseOver="MM_swapImage(\'Image81\',\'\',\'../../images/mainpage/mnuover_152.gif\',1)" onMouseOut="MM_swapImgRestore()" onClick="News(2)" style="cursor:pointer">';
	
	var outmoe3 =  '<img src="../../images/mainpage/main_154.gif" name="Image91" width="133" height="41" id="Image91" onMouseOver="MM_swapImage(\'Image91\',\'\',\'../../images/mainpage/mnuover_154.gif\',1)" onMouseOut="MM_swapImgRestore()" onClick="News(3)" style="cursor:pointer">';
	var onmoe3 = '<img src="../../images/mainpage/mnuover_154.gif" name="Image91" width="133" height="41" id="Image91" onMouseOver="MM_swapImage(\'Image91\',\'\',\'../../images/mainpage/mnuover_154.gif\',1)" onMouseOut="MM_swapImgRestore()" onClick="News(3)" style="cursor:pointer">';


	if(Type==1) {
		
		moe2.innerHTML = outmoe2;
		moe3.innerHTML = outmoe3;
	} else if(Type==2) {
		Entertainment.style.display = '';
		Sport.style.display = 'none';
		
		moe2.innerHTML = onmoe2;
		moe3.innerHTML = outmoe3;
	} else if(Type==3) {
		Entertainment.style.display = 'none';
		Sport.style.display = '';
		
		moe2.innerHTML = outmoe2;
		moe3.innerHTML = onmoe3;
	} else if(Type==4) {
		Entertainment.style.display = 'none';
		Sport.style.display = 'none';
		
		moe2.innerHTML = outmoe2;
		moe3.innerHTML = onmoe3;

	} else if(Type==5) {
		Entertainment.style.display = 'none';
		Sport.style.display = 'none';
		
		moe2.innerHTML = outmoe2;
		moe3.innerHTML = onmoe3;

	}
}
function Tab(Type) {
	//var News = 
	
	var Entertainment = document.getElementById('entertainmentnews');
	var Sport = document.getElementById('sportnews');
	var IT = document.getElementById('itnews');
	var Business = document.getElementById('businessnews');
	
	var tab2 = document.getElementById('tabnews2');
	var tab3 = document.getElementById('tabnews3');
	var tab4 = document.getElementById('tabnews4');
	
	
	var outtab2 = '<img src="../../images/mainpage/main_1.gif" name="Image101" width="114" height="41" id="Image114" onMouseOver="MM_swapImage(\'Image114\',\'\',\'../../images/mainpage/mnuover_1.gif\',1)" onMouseOut="MM_swapImgRestore()" onClick="Tab(2)" style="cursor:pointer">';
	var ontab2 = '<img src="../../images/mainpage/mnuover_1.gif" name="Image114" width="114" height="41" id="Image114" onMouseOver="MM_swapImage(\'Image114\',\'\',\'../../images/mainpage/mnuover_1.gif\',1)" onMouseOut="MM_swapImgRestore()" onClick="Tab(2)" style="cursor:pointer">';
	
	var outtab3 = '<img src="../../images/mainpage/main_2.gif" name="Image113" width="109" height="41" id="Image113" onMouseOver="MM_swapImage(\'Image113\',\'\',\'../../images/mainpage/mnuover_2.gif\',1)" onMouseOut="MM_swapImgRestore()" onClick="Tab(3)" style="cursor:pointer">';
	var ontab3 = '<img src="../../images/mainpage/mnuover_2.gif" name="Image113" width="109" height="41" id="Image113" onMouseOver="MM_swapImage(\'Image113\',\'\',\'../../images/mainpage/mnuover_2.gif\',1)" onMouseOut="MM_swapImgRestore()" onClick="Tab(3)" style="cursor:pointer">';
	
	var outtab4 = '<img src="../../images/mainpage/main_3.gif" name="Image112" width="108" height="41" id="Image112" onMouseOver="MM_swapImage(\'Image112\',\'\',\'../../images/mainpage/mnuover_3.gif\',1)" onMouseOut="MM_swapImgRestore()" onClick="Tab(4)" style="cursor:pointer">';
	var ontab4 = '<img src="../../images/mainpage/mnuover_3.gif" name="Image112" width="108" height="41" id="Image112" onMouseOver="MM_swapImage(\'Image112\',\'\',\'../../images/mainpage/mnuover_3.gif\',1)" onMouseOut="MM_swapImgRestore()" onClick="Tab(4)" style="cursor:pointer">';

	if(Type==1) {
		tab2.innerHTML = outtab2;
		tab3.innerHTML = outtab3;
		tab4.innerHTML = outtab4;
	} else if(Type==2) {
		Entertainment.style.display = '';
		Sport.style.display = 'none';
		IT.style.display = 'none';
		Business.style.display = 'none';
		
		tab2.innerHTML = ontab2;
		tab3.innerHTML = outtab3;
		tab4.innerHTML = outtab4;
	} else if(Type==3) {
		Entertainment.style.display = 'none';
		Sport.style.display = '';
		IT.style.display = 'none';
		Business.style.display = 'none';
		
		tab2.innerHTML = outtab2;
		tab3.innerHTML = ontab3;
		tab4.innerHTML = outtab4;
	}
		 else if(Type==4) {
		Entertainment.style.display = 'none';
		Sport.style.display = 'none';
		IT.style.display = '';
		Business.style.display = 'none';
		
		tab2.innerHTML = outtab2;
		tab3.innerHTML = outtab3;
		tab4.innerHTML = ontab4;
	} else if(Type==5) {
		Entertainment.style.display = 'none';
		Sport.style.display = 'none';
		IT.style.display = 'none';
		Business.style.display = '';
		
		tab2.innerHTML = outtab2;
		tab3.innerHTML = outtab3;
		tab4.innerHTML = outtab4;
	}
	
}

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_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];}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

<!--Hide from Browsers
var sParams = '';
var fieldid = 'txtCreateDate';
var fieldidtype = 'schedule'; 

function numDaysIn(mth,yr) {
 if (mth==3 || mth==5 || mth==8 || mth==10) return 30;
 else if ((mth==1) && leapYear(yr)) return 29;
 else if (mth==1) return 28;
 else return 31;
}
function leapYear(yr) {
 if (((yr % 4 == 0) && yr % 100 != 0) || yr % 400 == 0)
  return true;
 else
  return false;
}
function getFullYear(d) {
 yr = d.getYear();
 if (yr < 1000)
  yr+=1900;
 return yr;
}
function getCurrentYear(d) {
 yc = d.getYear();
 if (yc < 1000)
  yc+=1900;
 return yc;
}
function arr() {
 for (n=0;n<arr.arguments.length;n++) {
  this[n] = arr.arguments[n];
 }
}
//weekdays = new arr("Sun","Mon","Tues","Wed", "Thur","Fri","Sat");
weekdays = new arr("อ","จ","อ","พ", "พฤ","ศ","ส");
months = new arr("January","February","March","April","May","June","July","August","September","October","November","December");
months_th = new arr("มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฏาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม");
var filename="";
var flg=0;
var today = new Date();

hard_code_year = false; // initial testing - change to true if desired
hard_yr = 2001;

hard_code_date = false;
hard_mo = 0; // 0=Jan, 1=Feb


// Determine the month that is required.

function getMonth()
{
   if( hard_code_date ) //use to test calendar
      return( hard_mo );
   
   month=today.getMonth();
   endIndex=location.search.length;

   if( location.search.length > 1 )
   {
      index = location.search.indexOf(",");
      if( index != -1 )
      {
         endIndex=index;
      }

      mon = parseInt(location.search.substring(1,endIndex) );
      if ( ((""+mon).length<=2) && (mon >= 0) && (mon <= 11)) {
         month=mon;
//alert(month)
      }
   }
   return( month );
}


// Determine the year that is required.

function getYear() 
{
   if (hard_code_year) {
      return( hard_yr );
   }

   year=getFullYear(today);

   if( location.search.length > 1 )
   {
      index = location.search.indexOf(",");
      if( index != -1 )
      {
         yr = parseInt(location.search.substring(index+1) );
      }
      if ( ((""+yr).length<=4) && (yr >= 1900) && (yr <= 2010)) {
         year=yr;
      }
   }
   return( year );
}


// Output month selection choice.

function addMonthSelect()
{
   document.write( "<SELECT onChange='changeDate(document.selectForm.monthSelect,document.selectForm.yearSelect)' Class=dropdown NAME='monthSelect' SIZE=1>" );
   for( i=0; i<mo; i++ )
   {
      document.write( "<OPTION>"+months_th[i] );
   }
   document.write( "<OPTION SELECTED>"+months_th[mo] );
   for( i=mo+1; i<12; i++ )
   {
      document.write( "<OPTION>"+months_th[i] );
   }
   document.write( "</SELECT>" );
}


// Output year selection choice.

function addYearSelect()
{
var by, fy;

if (fieldidtype == 'bday'){
	by = 80;
	fy = 1;
	if (yr < getCurrentYear(today)){ 
	by = by-(getCurrentYear(today)-yr);		
	fy = fy+(getCurrentYear(today)-yr);
	}
}

if (fieldidtype == 'schedule'){
	by = 60;
	//by กำหนดย้อนหลังไป  60 ปี   (before Year)
	fy = 10;
	//fy กำหนดล่วงหน้าไป 10  ปี (future Year)
	if (yr > getCurrentYear(today)){ 
	by = by-(getCurrentYear(today)-yr);		
	fy = fy+(getCurrentYear(today)-yr);
	}
}
 	

	
   document.write( "<SELECT onChange='changeDate(document.selectForm.monthSelect,document.selectForm.yearSelect)' Class=dropdown NAME='yearSelect' SIZE=1>" );
   for( i=by; i>0; i-- )
   {
      document.write( "<OPTION>"+(yr-i+543) );
   }
   document.write( "<OPTION SELECTED>"+(yr+543) );
   for( i=1; i<fy; i++ )
   {
      document.write( "<OPTION>"+(yr+i+543) );
   }
   document.write( "</SELECT>" );
}


// Handle changing the date from month and year selects.

function changeDate(monthObj, yearObj)
{
   newMonth=monthObj.selectedIndex;
   newYear=yearObj.options[yearObj.selectedIndex].text;
   location.href=filename+"?"+newMonth+","+(newYear-543)+"&dummy=blank&params="+sParams+"&datefield="+fieldid+"&datefieldtype="+fieldidtype;
}


// Main calendar generator.

function showMe (datepick){
//alert("aaa")
	//window.opener.setDate(months[getMonth()] + ' ' + datepick + ',' + getYear(), fieldid, sParams);
	//window.opener.document.getElementById('datestart').value=datepick + '/' + (mo+1) + '/' + (getYear()+543);
	//window.opener.document.getElementById('htxtdate').value=datepick + '/' + (mo+1)+ '/' + (getYear()+543);
	 //window.opener.document.getElementById('txtUpdate').value=datepick + '/' + (mo+1)+ '/' + getYear();
	 // window.opener.document.getElementById('txtDatestart').value=datepick + '/' + (mo+1)+ '/' + getYear();

   window.open("showplan.asp?date="+datepick + '/' + (mo+1)+ '/' + (getYear()+543)+" ","FS","width=620,height=250,scrollbars=yes");
	 
// .opener ใช้สำหรับอ้างอิง object  ตัวแปร ฟังชั่น ของหน้าหลัก (หน้าที่เรียกหน้านี้มาแสดง) 
//getElementById  ใช้สำหรับอ้าง id ของ object 

	//self.close();
	//window.close
	
	/*This method is used to close a specified window. If no window reference is supplied, 
	the close() method will close the current active window. 
	****Note that this method will only close windows created using the open() method; 
			 if you attempt to close a window not created using open(), the user will be prompted to confirm this action with a dialog box 
			 before closing. The single exception to this is if the current active window has only one document in its session history.
			 In this case the closing of the window will not require confirmation.*/
}

function Calendar()
{
 todayYr=getFullYear(today);
 mo=getMonth();
 yr=getYear();
 var current = new Date();
 mc = current.getMonth();
 my = getCurrentYear(today);
 
bgn=new Date(months[mo]+" 1,"+yr);
// months[mo] ให้ค่าเป็นชื่อเดือน ภาษาอังกฤษ(Jun)    1 คือวันที่ที่จะset (วันที่1ของเดึอน)
// object date  new Date()=วัน,วันที่ ,เดือน,ปี,เวลา ปัจจุบัน รวมทั้ง Timezone    
// ต.ย  new Date(2000,11,6)=Wed  Dec 6 00:00:00 UTC+0700 2000 (วันWed,วันที่6 ,เดือนDec,ปี2000,เวลา 00:00:00)
// ต.ย  new Date("Jan1,2000")= Sat Jan 1 00:00:00 UTC+07000 2000 (วันSat,วันที่1 ,เดือนJan,ปี2000,เวลา 00:00:00 UTC+0700)
 //เอา ตัวแปร dy  รับค่า วัน ของ วันที่1 ของเดือน ให้ค่าเป็นตัวเลข (0=วันอาทิตย์   ถึง  6=วันเสาร์)
//mi=new Date("Jan1,2000") // เอาไว้ทดสอบ
//alert("mi=" + mi)
 dy=bgn.getDay();
 //getDay Method:  This method returns an integer (0 for Sunday thru 6 for Saturday) representing the day of the week.
//alert(bgn + "     "  + "dy="+dy+"    " +months[mo]);
 ld=numDaysIn(mo,yr);
 
 // Start table
 document.write("<TABLE BORDER=0 Cellspacing=0 Cellpadding=2 Width=165><TR bgcolor=#ffffff>");
 
  // Create prev/next with conditional type
 jump = "";
 if( ! hard_code_date )
 {

   document.write("<FORM Name='selectForm'><TD HEIGHT=21 Class='boldwhite' >");

   // Prev link
   prevMonth=(mo - 1);
   prevYr=yr;
   if( mo == 0 )
   {
      prevMonth=11;
      prevYr=yr - 1;
   }
   //document.write('<a href="'+filename+'?'+prevMonth+','+prevYr+'">&lt;- '+months[prevMonth]+' </a>');
    
/*if (fieldidtype == 'bday'){
   document.write('<a title="Previous Month" href="'+filename+'?'+prevMonth+','+prevYr+'&dummy=blank&params='+sParams+'&datefield='+fieldid+'&datefieldtype='+fieldidtype+'">&lt;&lt;</a>');
}*/

//if (fieldidtype == 'schedule'){
//	if ((mo==mc)&&(yr==my)){
//	document.write('&nbsp;&nbsp;&nbsp;');
//	}
//	else if (bgn.getTime()>current.getTime()){	
//    document.write('<a title="Previous Month" href="'+filename+'?'+prevMonth+','+prevYr+'&dummy=blank&datefield='+fieldid+'&datefieldtype='+fieldidtype+'">&lt;&lt;</a>');
//   }
//}

/*if (fieldidtype == 'schedule'){
 //alert(fieldidtype + '<a title="Previous Month" href="'+filename+'?'+prevMonth+','+prevYr+'&dummy=blank&params='+sParams+'&datefield='+fieldid+'&datefieldtype='+fieldidtype+'">&lt;&lt;</a>');
    document.write('<a title="Previous Month" href="'+filename+'?'+prevMonth+','+prevYr+'&dummy=blank&params='+sParams+'&datefield='+fieldid+'&datefieldtype='+fieldidtype+'">&lt;&lt;</a>');
}
   */
 
  document.write( "</TD><TD  ALIGN=Center>" );
   addMonthSelect();
   addYearSelect();
   document.write( "</TD><TD  ALIGN=RIGHT Class='boldwhite'>" );
// test button keep in case   
//   document.write( "<INPUT title='Show Selected Month' Class=dropdown TYPE=BUTTON VALUE='Go' onClick='changeDate"
//      +"(document.selectForm.monthSelect,document.selectForm.yearSelect)' id=BUTTON1 name=BUTTON1>" );

  //document.write(" | ");

   // Next link
   nextMonth=(mo + 1);
   nextYr=yr;
   if( mo == 11 )
   {
      nextMonth=0;
      nextYr=yr + 1;
   }
   //document.write('<a href="'+filename+'?'+nextMonth+','+nextYr+'"> '+months[nextMonth]+' -&gt;</a>');

/*if (fieldidtype == 'bday'){
	if ((mo==mc)&&(yr==my)){
	document.write('');
	}
	else if (bgn.getTime()<current.getTime()){
    document.write('<a title="Next Month" href="'+filename+'?'+nextMonth+','+nextYr+'&dummy=blank&params='+sParams+'&datefield='+fieldid+'&datefieldtype='+fieldidtype+'">&gt;&gt;</a>');
	}
}

if (fieldidtype == 'schedule'){
    document.write('<a title="Next Month" href="'+filename+'?'+nextMonth+','+nextYr+'&dummy=blank&params='+sParams+'&datefield='+fieldid+'&datefieldtype='+fieldidtype+'">&gt;&gt;</a>');
}*/
   

   document.write("</TD></FORM></TR></TABLE>");
 }
 
 document.write("<TABLE BORDER=0 bordercolor=red Cellpadding=1 Cellspacing=1 Width=165 Class=ContentsTable>");
 document.write("<TR><TD ALIGN=CENTER COLSPAN=7 Class=FormButton>");
 document.write("<B>"+months_th[mo]+" "+(yr+543)+"</B>");
 document.write("</TD></TR><TR>");
 // document.write("<TD  bgcolor=red ALIGN=CENTER >" +weekdays[0]+"</TD>");
 for (var i=0;i<7;i++){
  document.write("<TD ALIGN=CENTER Class=FormLabel>" +weekdays[i]+"</TD>");
 }
 document.write("</TR><TR>");
 ctr=0;
 for (var i=0;i<7;i++) {
 // alert(dy); 
  if (i<dy){

   document.write("<TD ALIGN=CENTER>"
   +"&nbsp;</TD>");
  }
  else {   
   ctr++;
   di=i;
   dupWrt();
  }
 }

 document.write("</TR><TR>");
 while (ctr<ld){
  for (var i=0;i<7;i++){
	ctr++;
   if (ctr>ld){
    document.write("<TD ALIGN=CENTER>&nbsp;</TD>");
   }
   else{
    di=i;
    dupWrt();
   }
  }
  document.write("</TR><TR>");
 }
 document.write("</TABLE>");

}

function dupWrt() {

if (fieldidtype == 'bday'){


 document.write("<TD ALIGN=CENTER class=dropdown >");

  if ( (mo==today.getMonth()) && (yr==todayYr) && (ctr>today.getDate()) )
  { 
  document.write("<span >"); 
  }
  else
  {
  document.write("<a href='javascript:showMe("+ctr+");'>");
  }
 
  if ( (mo==today.getMonth()) && (yr==todayYr) && (ctr==today.getDate()) )
 {
  document.write("<B>");
  }
 document.write (ctr);
  if ( (mo==today.getMonth()) && (yr==todayYr) && (ctr==today.getDate()) )
 {
  document.write("</B>");
  }  
  if ( (mo==today.getMonth()) && (yr==todayYr) && (ctr>today.getDate()) )
  {
  document.write("</span>"); 
  }
  else
  {
  document.write ("</a>");
  } 
 document.write ("</TD>");


}

if (fieldidtype == 'schedule'){
 document.write("<TD ALIGN=CENTER class=dropdown><a href='javascript:showMe("+ctr+");'>");
  if ( (mo==today.getMonth()) && (yr==todayYr) && (ctr==today.getDate()) )
 {
  document.write("<B>");
  }
 document.write (ctr);
  if ( (mo==today.getMonth()) && (yr==todayYr) && (ctr==today.getDate()) )
 {
  document.write("</B>");
  }  
 document.write ("</a></TD>");
}

 }

function holder() {
 document.write("<TD ALIGN=CENTER><a href='javascript:showMe("+ctr+");'>");
  if ( (mo==today.getMonth()) && (yr==todayYr) && (ctr==today.getDate()) )
 {
  document.write("<B>");
  }
 document.write (ctr);
  if ( (mo==today.getMonth()) && (yr==todayYr) && (ctr==today.getDate()) )
 {
  document.write("</B>");
  }  
 document.write ("</a></TD>");
 }
 
 function clockon() {
	thistime= new Date()
	var hours=thistime.getHours()
	var minutes=thistime.getMinutes()
	var seconds=thistime.getSeconds()
	if (eval(hours) <10) {hours="0"+hours}
	if (eval(minutes) < 10) {minutes="0"+minutes}
	if (seconds < 10) {seconds="0"+seconds}
	thistime = hours+":"+minutes+":"+seconds
		
	if(document.all) {
		bgclocknoshade.innerHTML=thistime
		bgclockshade.innerHTML=thistime
	}
	
	if(document.layers) {
		document.bgclockshade.document.write('<div id="bgclockshade" style="position:absolute;visibility:visible;font-family:Verdana;color:FFAAAAA;font-size:120px;top:10px;left:12px">'+thistime+'</div>')
		document.bgclocknoshade.document.write('<div id="bgclocknoshade" style="position:absolute;visibility:visible;font-family:Verdana;color:DDDDDD;font-size:120px;top:10px;left:10px">'+thistime+'</div>')
		document.close()
	}
	var timer=setTimeout("clockon()",200)
}