var path='';

function setPath(ph) {path=ph;}
function Ch_background(ly,cl) {ly.style.backgroundColor=cl;}
function Ch_cursor(ly) {ly.style.cursor="hand";}

function CreateMenu(id,bgOver,bgOut,text,link) {
	document.write("<img src='"+path+"img/black.gif' border=0 width=170 height=1");
	document.write("><a class=menu onMouseOver='Ch_background("+id+",\""+bgOver+"\");Ch_cursor("+id+");' onMouseOut='Ch_background("+id+",\""+bgOut+"\");' href='"+path+""+link+"'");
	document.write("><div align=center id="+id+" style='width:170px;height:18px;background-color:"+bgOut+"'");
	document.write("><img src='"+path+"img/blank.gif' width=1 height=2 border=0><br>"+text+"</div></a><img src='"+path+"img/black.gif' border=0 width=170 height=1><br>");			
	document.write("<img src='"+path+"img/blank.gif' width=1 height=3 border=0><br>");
}

function CreateSubmenu(text,link) {

document.write(
"	<table border=0 cellpadding=0 cellspacing=0>"+
"		<tr valign=middle>"+
"			<td><img src='"+path+"img/blank.gif' width=5 height=1><img src='"+path+"img/bullet1.gif' border=0><img src='"+path+"img/blank.gif' width=2 height=1></td>"+
//"			<td width=145><a href='"+path+""+link+"'>"+text+"</a></td>"+
"			<td width=145><a class=menu3 href='"+path+""+link+"'>"+text+"</a></td>"+
"		</tr>"+
"	</table>"
);

	
}

function EndSubmenu() {
	document.write("<img src='"+path+"img/blank.gif' width=1 height=5 border=0>");
}

// function ส่วนแสดง Logo
function BackNext(back,next) {
// ส่วนแสดง Logo
document.write(
"<br>"+
"<div align=right>"
);

document.write(
"</div><br>"+
"<center>"+
"<table width=80% border=0 cellpadding=0 cellspacing=0 bgcolor=7F7F7F><tr><td><img src='"+path+"img/blank.gif' width=1 height=1></td></tr></table>"+
"<img src='"+path+"img/blank.gif' width=1 height=1><br>"+
"<table width=80% border=0 cellpadding=0 cellspacing=0 bgcolor=8F8F8F><tr><td><img src='"+path+"img/blank.gif' width=1 height=1></td></tr></table>"+
"<img src='"+path+"img/blank.gif' width=1 height=1><br>"+
"<table width=80% border=0 cellpadding=0 cellspacing=0 bgcolor=9F9F9F><tr><td><img src='"+path+"img/blank.gif' width=1 height=1></td></tr></table>"+
"<img src='"+path+"img/blank.gif' width=1 height=1><br>"+
"<table width=80% border=0 cellpadding=0 cellspacing=0 bgcolor=AFAFAF><tr><td><img src='"+path+"img/blank.gif' width=1 height=1></td></tr></table>"+
"<img src='"+path+"img/blank.gif' width=1 height=1><br>"+
"<table width=80% border=0 cellpadding=0 cellspacing=0 bgcolor=BFBFBF><tr><td><img src='"+path+"img/blank.gif' width=1 height=1></td></tr></table>"+
"<img src='"+path+"img/blank.gif' width=1 height=1><br>"+
"<table width=80% border=0 cellpadding=0 cellspacing=0 bgcolor=CFCFCF><tr><td><img src='"+path+"img/blank.gif' width=1 height=1></td></tr></table>"+
//"</center><br><br>"
"<center><a href='http://www.technictrang.ac.th'><font color=AAAAAA>"+
" แผนกวิชาการเลขานุการ<br>วิทยาลัยเทคนิคตรัง</font></a></center><br><br>"
);
	
}


// function ส่วนแสดงเนื้อหาในแต่ละ page
function WriteTop(page) {

// document ส่วนแสดงเนื้อหาในแต่ละ page
document.write(

"<html>"+
""+
"<style type=text/css>"+
//"body,p,table,td,center,form,tr{	font-family: \"Tahoma\";	font-size:10pt;	color:#000000;}"+
//"body,p,td,center,form,tr{	font-family: \"Tahoma\"; 	font-size:12pxt;	color:#000000;}"+

"a {text-decoration:; color:#D2691E; font-style:normal;text-decoration : none}"+
"a:hover {text-decoration:; color:Navy}"+
"a.menu {color:000000;text-decoration:none}"+
"a.menu:hover {color:000000;text-decoration:none}"+
"a.menu3 {color:000000;text-decoration:none;color:#D2691E}"+
"a.menu3:hover {color:000000;text-decoration:none;letter-spacing: 1px;color:Navy}"+


"BODY {"+
"                scrollbar-face-color: #529F0E; scrollbar-shadow-color: #529F0E; "+
//"                scrollbar-face-color: #005FB4; scrollbar-shadow-color: #9AB6C4; "+
"                scrollbar-highlight-color: #529F0E; scrollbar-3dlight-color: #9AB6C4; "+
//"                scrollbar-highlight-color: #000000; scrollbar-3dlight-color: #529F0E; "+
"                scrollbar-darkshadow-color: #000000; scrollbar-track-color: #D6F4B7;"+
"                scrollbar-arrow-color: #FFFF0D;"+

//	SCROLLBAR-FACE-COLOR: #F2ECFF;
//	SCROLLBAR-HIGHLIGHT-COLOR: #F2ECFF; 
//	SCROLLBAR-SHADOW-COLOR: #F2ECFF; 
//	SCROLLBAR-3DLIGHT-COLOR: #FfffFF; 
//	SCROLLBAR-ARROW-COLOR: #000000; 
//	SCROLLBAR-TRACK-COLOR: #FfffFF; 
//	SCROLLBAR-DARKSHADOW-COLOR: gray




"          }"+
//"font "+
//"{"+
//"	font-size: 13px;"+
//"}	"+
"table"+
"{  font-size: 13px;"+
"	font-family: Tahoma;"+
"}"+
"tr"+
"{  font-size: 13px;"+
"	font-family: Tahoma;"+
"}"+
"td"+
"{  font-size: 13px;"+
"	font-family: Tahoma;"+
"}"+
"p"+
"{  font-size: 13px;"+
"	font-family: Tahoma;"+
"}"+
"center"+
"{  font-size: 14px;"+
"	font-family: Tahoma;"+
"}"+



"</style>"+
""+
// ส่วน page เต็มหน้า
"<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 bgcolor=529F0E>"+
""+
// old top.js
//"<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 bgcolor=FFFFFF>"+
//""+

// ส่วน  logo ควบคุมกับ table เพิ่ม align=center ใน line 144
"<table width=100% border=0 cellpadding=0 cellspacing=0 background='"+path+"img/b_top.gif'  >"+
"	<tr>"+
//"		<td><img src='"+path+"img/logotop.gif' border=0></td>"+
"		<td  align=center><img src='"+path+"img/sc.jpg' border=0></td>"+
"	</tr>"+
"</table>"+
""+
"<table width=100% border=0 cellpadding=0 cellspacing=0 bgcolor=529F0E>"+
"	<tr>"+
"		<td align=right><font style='font-family:Arial; font-size:11px;' color=529F0E><b>Writen byRawan aothongthip &nbsp;&nbsp;</b></font></td>"+
"	</tr>"+
"</table>"+
""

);




document.write (
// document การควยคุม menu และส่วนแสดงเนื้อหา ควบคุมกับ table แก้ไขเนื้อหาอยู่กลาง
"<table height=100% border=0 cellpadding=0 cellspacing=0 bgcolor=FFFFFF align=center>"+
"	<tr valign=top>"+
// สำหรับ menu มีความกว้าง 16+10+180 ควบคุมด้วย <td>
//"		<td width=16 background='"+path+"img/kob.gif'>&nbsp;</td>"+
"		<td width=12 bgcolor=529F0E>&nbsp;</td>"+
"		<td width=10 bgcolor=D6F4B7>&nbsp;</td>"+
"		<td width=180 bgcolor=D6F4B7>"+
"			&nbsp;<br>"+
"			"
// old top.js
//"<table height=100% border=0 cellpadding=0 cellspacing=0 bgcolor=D6F4B7>"+
//"	<tr valign=top>"+
//"		<td width=16 background='"+path+"img/kob.gif'>&nbsp;</td>"+
//"		<td width=10 bgcolor=D6F4B7>&nbsp;</td>"+
//"		<td width=180 bgcolor=D6F4B7>"+
//"			&nbsp;<br>"+
//"			"

);


//************************* Add menu here *************************

	if (page=='index') {
		CreateMenu("a0","EAFFC8","EAFFC8","<b>หน้าแรก</b>","index.html");
	}else CreateMenu("a0","D2FF78","A9E969","หน้าแรก","index.html");

//	if (page=='index') {
//		CreateMenu("a0","EAFFC8","EAFFC8","<b>เข้าสู่ระบบ</b>","login.html");
//	}else CreateMenu("a0","D2FF78","A9E969","เข้าสู่ระบบ","login.html");
	
//	if (page=='regit') {
//		CreateMenu("a1","EAFFC8","EAFFC8","<b>ลงทะเบียน</b>","register.html");
//	} else CreateMenu("a1","D2FF78","A9E969","ลงทะเบียน","register.html");
	
	
	if (page=='chapter') {
		CreateMenu("a2","EAFFC8","EAFFC8","<b>บทเรียน</b>","course/content.asp");
		CreateSubmenu("หน่วยที่ 1 ","course/content1.asp");
		CreateSubmenu("หน่วยที่ 2","course/content2.asp");
		CreateSubmenu("หน่วยที่ 3","course/content3.asp");
		CreateSubmenu("หน่วยที่ 4","course/content4.asp");
		CreateSubmenu("หน่วยที่ 5","course/content5.asp");
		CreateSubmenu("หน่วยที่ 6","course/content6.asp");	
        CreateSubmenu("หน่วยที่ 7","course/content7.asp");
		CreateSubmenu("หน่วยที่ 8","course/content8.asp");
		CreateSubmenu("หน่วยที่ 9","course/content9.asp");
		
		EndSubmenu();	
	} else CreateMenu("a2","D2FF78","A9E969","บทเรียน","course/content.asp");
	
	
	if (page=='test') {
		CreateMenu("a3","EAFFC8","EAFFC8","<b>สอบประเมินผล</b>","course/Finaltest.asp");
//		CreateSubmenu("แบบฝึกหัดบทที่ 1","test/t1.html");
//		CreateSubmenu("แบบฝึกหัดบทที่ 2","test/t2.html");
//		CreateSubmenu("แบบฝึกหัดบทที่ 3","test/t3.html");
//		CreateSubmenu("แบบฝึกหัดบทที่ 4","test/t4.html");
//		CreateSubmenu("แบบฝึกหัดบทที่ 5","test/t5.html");
//		CreateSubmenu("แบบฝึกหัดบทที่ 6","test/t6.html");
//		CreateSubmenu("แบบฝึกหัดบทที่ 7","test/t7.html");
//		CreateSubmenu("แบบฝึกหัดบทที่ 8","test/t8.html");
//				EndSubmenu();	
	} else CreateMenu("a3","D2FF78","A9E969","สอบประเมินผล","course/Finaltest.asp");
	
	if (page=='teacher') {
		CreateMenu("a4","EAFFC8","EAFFC8","<b>สถิติคะแนน</b>","course/showstat.asp");
	} else CreateMenu("a4","D2FF78","A9E969","สถิติคะแนน","course/showstat.asp");

// old top.js
//	if (page=='hotspot') {
//		CreateMenu("a4","EAFFC8","EAFFC8","<b>เกี่ยวกับอาจารย์ผู้สอน</b>","teacher/teacher.html");
//		EndSubmenu();	
//	} else CreateMenu("a4","D2FF78","A9E969","เกี่ยวกับอาจารย์ผู้สอน","teacher/teacher.html");
	
	if (page=='chat') {
		CreateMenu("a5","EAFFC8","EAFFC8","<b>ห้องสนทนา</b>","chat/index.html");
	}else{CreateMenu("a5","D2FF78","A9E969","ห้องสนทนา","chat/index.html");}
	
	
	if (page=='board') {
		CreateMenu("a6","EAFFC8","EAFFC8","<b>กระดานถาม-ตอบ</b>","wb/index.asp");
	}else{CreateMenu("a6","D2FF78","A9E969","กระดานถาม-ตอบ","wb/index.asp");}
	
	
	if (page=='aboutus') {
		CreateMenu("a7","EAFFC8","EAFFC8","<b>ผู้จัดทำ</b>","aboutus.html");
	}else{CreateMenu("a7","D2FF78","A9E969","ผู้จัดทำ","aboutus.html");}
	
	if (page=='link') {
		CreateMenu("a8","EAFFC8","EAFFC8","<b>ออกจากบทเรียน</b>","signout.asp");
	} else CreateMenu("a8","D2FF78","A9E969","ออกจากบทเรียน","signout.asp");

//	if (page=='regit') {
//		CreateMenu("a9","EAFFC8","EAFFC8","<b>ลงทะเบียน</b>","register.html");
//	} else CreateMenu("a9","D2FF78","A9E969","ลงทะเบียน","register.html");

document.write(
// สำหรับ Link มีความกว้าง 170  ใน  <td> ของ menu มีความกว้าง 170
//"			<br><br><table width=170 border=0 cellpadding=0 cellspacing=0><tr><td>"+
"	<table width=170 border=0 cellpadding=0 cellspacing=0>"+
"<tr><td>"+
"			<center>"+
//"<img src='"+path+"img/black.gif' width=140 height=1><br><b><font color=008800>:: Link ::</font></b><br><img src='"+path+"img/black.gif' width=140 height=1><br><br>"+

"			"+
"			"+
"			"+
"			"+
"			"+
"			"+

//"<a href='http://ced.kmitnb.ac.th'>TCT Department</a><br>"+
//"<a href='http://www.kmitnb.ac.th'>KMITNB</a>"+
//"<br><br><img src='"+path+"img/black.gif' width=140 height=1><br><br>"+
"<br><img src='"+path+"img/black.gif' width=140 height=1><br>"+
//"	<a href='http://www.microsoft.com/isapi/redir.dll?prd=ie&pver=5.0&ar=aboutie&sba=copyr'><img src='"+path+"img/ie.gif' border=0><br><font color=00AA00>Best view in IE5 or higher</font></a><br><br><br>"+
"<br><font color=00AA00>Best view in IE5 or higher<br>800 by 600 pixels<br><br></font>"+
"			</center>"+			
"			"+
"			"+
"			"+
"			"+
"		</td></tr></table>"+

//หมดส่วน TD 180
"</td>"+

// หมดส่วนเมน   menuู
//  ควบคุมกั้นหน้าด้วย <td>
"		<td width=20>&nbsp;</td>"+
// ส่วนแสดงเนื้อหาที่ใช้ top.js ควบคุมด้วย <td>
"		<td width=540>"

// old top.js
//"		</td></tr></table></td>"+
//"		<td width=20 bgcolor=529F0E>&nbsp;</td>"+
//"		<td width=76% >"
);

}
