<!--
var persistmenu="no" //"yes" or "no". Make sure each SPAN content contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc)
var persisttype="sitewide" //enter "sitewide" for menu to persist across site, "local" for this page only
if (document.getElementById){ //DynamicDrive.com change
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}
PositionX = 100;
PositionY = 100;
defaultWidth  = 500;
defaultHeight = 500;
var AutoClose = false;
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
function popImage(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','dsp',optNN);}
if (isIE){imgWin=window.open('about:blank','dsp',optIE);}
with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
writeln('width=100-(document.body.clientWidth-document.images[0].width);');
writeln('height=100-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
close();		
}}
function newWindow(mypage,myname,w,h,features) {
  if(screen.width){
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  }else{winl = 0;wint =0;}
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + h + ',';
  settings += 'width=' + w + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += features;
  win = window.open(mypage,myname,settings);
  win.window.focus();
}
function SwitchMenu(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
		if(el.style.display != "block"){ //DynamicDrive.com change
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="submenu") //DynamicDrive.com change
				ar[i].style.display = "none";
			}
			el.style.display = "block";
		}else{
			el.style.display = "none";
		}
	}
}

function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function onloadfunction(){
if (persistmenu=="yes"){
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=get_cookie(cookiename)
if (cookievalue!="")
document.getElementById(cookievalue).style.display="block"
}
}

function savemenustate(){
var inc=1, blockid=""
while (document.getElementById("sub"+inc)){
if (document.getElementById("sub"+inc).style.display=="block"){
blockid="sub"+inc
break
}
inc++
}
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
document.cookie=cookiename+"="+cookievalue
}

if (window.addEventListener)
window.addEventListener("load", onloadfunction, false)
else if (window.attachEvent)
window.attachEvent("onload", onloadfunction)
else if (document.getElementById)
window.onload=onloadfunction

if (persistmenu=="yes" && document.getElementById)
window.onunload=savemenustate

var rate = 20; 
var obj; 
var act = 0; 
var elmH = 0; 
var elmS = 128; 
var elmV = 255; 
var clrOrg; 
var TimerID; 
if (navigator.appName.indexOf("Microsoft",0) != -1 && parseInt(navigator.appVersion) >= 4) {
Browser = true;
} else {
Browser = false;
}
if (Browser) {
document.onmouseover = doRainbowAnchor;
document.onmouseout = stopRainbowAnchor;
}
function doRainbow()
{
if (Browser && act != 1) {
act = 1;
obj = event.srcElement;
clrOrg = obj.style.color;
TimerID = setInterval("ChangeColor()",100);
}
}
function stopRainbow()
{
if (Browser && act != 0) {
obj.style.color = clrOrg;
clearInterval(TimerID);
act = 0;
}
}
function doRainbowAnchor()
{
if (Browser && act != 1) {
obj = event.srcElement;
while (obj.tagName != 'A' && obj.tagName != 'BODY') {
obj = obj.parentElement;
if (obj.tagName == 'A' || obj.tagName == 'BODY')
break;
}
if (obj.tagName == 'A' && obj.href != '') {
act = 1;
clrOrg = obj.style.color;
TimerID = setInterval("ChangeColor()",100);
}
}
}
function stopRainbowAnchor()
{
if (Browser && act != 0) {
if (obj.tagName == 'A') {
obj.style.color = clrOrg;
clearInterval(TimerID);
act = 0;
}
}
}
function ChangeColor()
{
obj.style.color = makeColor();
}
function makeColor()
{
if (elmS == 0) {
elmR = elmV; elmG = elmV; elmB = elmV;
}
else {
t1 = elmV;
t2 = (255 - elmS) * elmV / 255;
t3 = elmH % 60;
t3 = (t1 - t2) * t3 / 60;
if (elmH < 60) {
elmR = t1; elmB = t2; elmG = t2 + t3;
}
else if (elmH < 120) {
elmG = t1; elmB = t2; elmR = t1 - t3;
}
else if (elmH < 180) {
elmG = t1; elmR = t2; elmB = t2 + t3;
}
else if (elmH < 240) {
elmB = t1; elmR = t2; elmG = t1 - t3;
}
else if (elmH < 300) {
elmB = t1; elmG = t2; elmR = t2 + t3;
}
else if (elmH < 360) {
elmR = t1; elmG = t2; elmB = t1 - t3;
}
else {
elmR = 0; elmG = 0; elmB = 0;
}
}
elmR = Math.floor(elmR);
elmG = Math.floor(elmG);
elmB = Math.floor(elmB);
clrRGB = '#' + elmR.toString(16) + elmG.toString(16) + elmB.toString(16);
elmH = elmH + rate;
if (elmH >= 360)
elmH = 0;
return clrRGB;
}

// แสดงความคิดเห็น
function chkvaliddata(tf)     {
	if (tf.nameans.value == "") {
		alert('ชื่อและข้อความแสดงความคิดเห็นต้องใส่ให้ครบทั้ง 2 ช่อง\nคุณยังไม่ได้ใส่ชื่อของคุณเลย');
     tf.nameans.focus();
     return(false);
  }
  if (tf.comment.value == "") {
		alert('ชื่อและข้อความแสดงความคิดเห็นต้องใส่ให้ครบทั้ง 2 ช่อง\nคุณยังไม่ได้ใส่ความคิดเห็นของคุณเลย');
		tf.comment.focus();
     return(false);
  }
  tf.sendcomment.disabled = true;  
 }
// เมล์แนบไฟล์
function chkblankdoit(tf) {
		if (tf.frommail.value =="") {
			alert('กรอก Email ผู้ส่งด้วย');
			return false;
		}
		if (tf.frommail.value!="") {
			if (tf.frommail.value.indexOf("@")==-1 || tf.frommail.value.indexOf(".")==-1 || tf.frommail.value.indexOf(" ")!=-1 || tf.frommail.value.length<6) 	{
				alert('รูปแบบอีเมล์ไม่ถูกต้อง');
				tf.frommail.focus();return false
			} 
		}
		if (tf.tomail.value =="") {
			alert('กรอก Email ผู้รับด้วย');
			return false;
		}
		if (tf.tomail.value!="") {
			if (tf.tomail.value.indexOf("@")==-1 || tf.tomail.value.indexOf(".")==-1 || tf.tomail.value.indexOf(" ")!=-1 || tf.tomail.value.length<6) 	{
				alert('รูปแบบอีเมล์ไม่ถูกต้อง');
				tf.tomail.focus();return false
			} 
		}
		if (tf.mailsubject.value =="") {
			alert('กรอกหัวเรื่อง Email ด้วย');
			return false;
		}
		if (tf.mailmsg.value =="") {
			alert('กรอกรายละเอียดเพิ่มเติมด้วย');
			return false;
		}
	}

// สมัครสมาชิก
function chkregisterdata(tf)
	{		
		if (tf.firstname.value == "") {
			alert('ใส่ชื่อจริงของคุณด้วย');
			tf.firstname.focus();
			return false;
		}
		if (tf.lastname.value == "") {
			alert('ใส่นามสกุลของคุณด้วย');
			tf.lastname.focus();
			return false;
		}		
		if (tf.mday.value==""|| tf.mmon.value==""|| tf.myea.value==""){			
			alert('ระบุวันเดือนปีเกิดของคุณด้วย');
			if (tf.mday.value==""){tf.mday.focus();}else if(tf.mmon.value==""){tf.mmon.focus()}else{tf.myea.focus()}			
			return false;
		}
		if (tf.occupation.value == "") {
			alert( 'ระบุอาชีพของคุณด้วย');
			tf.occupation.focus();
			return false;
		}		
		if (tf.address.value.length < 15) {
			alert( 'ใส่ที่อยู่ที่สามารถติดต่อได้ให้ละเอียดด้วย (เลขที่ หมู่ ตำบล อำเภอ)');
			tf.address.focus();
			return false;
		}
		if (tf.province.value == "") {
			alert('ระบุชื่อจังหวัดที่คุณอยู่ด้วย');
			tf.province.focus();
			return false;
		}
		if (tf.country.value == "") {
			alert('ระบุชื่อประเทศที่คุณอยู่ด้วย');
			tf.country.focus();
			return false;
		}
		if (tf.zip.value.length < 5) {
			alert('ใส่รหัสไปรษณีย์ให้ครบด้วย');
			tf.zip.focus();
			return false;
		}
		if (tf.tel.value == "") {
			alert('ใส่หมายเลขโทรศัพท์ที่สามารถติดต่อได้ด้วย\n(ถ้าไม่มีให้ใส่ - แทน)');
			tf.tel.focus();
			return false;
		}	
		if (tf.email.value == "") {
			alert('ใส่อีเมล์แอดเดรสของคุณด้วย');
			tf.email.focus();
			return false;
		}
		if (tf.uname.value.length < 5) {
			alert('ใส่ชื่อที่ใช้ในการล็อกอินด้วย อย่างน้อย 5 ตัวอักษร');
			tf.uname.focus();
			return false;
		}
		if (tf.upassword.value.length < 6) {
			alert('รหัสผ่านต้องมีความยาวไม่น้อยกว่า 6 ตัวอักษรนะคะ');
			tf.upassword.focus();
			return false;
		}
		if (tf.confirmpwd.value != tf.upassword.value) {
			alert('รหัสผ่าน กับ ยืนยันรหัสผ่าน ต้องใส่ให้เหมือนกัน');
			tf.confirmpwd.focus();
			return false;
		}
	}
	function chkregisterdata_lt(tf)
	{		
		if (tf.firstname.value == "") {
			alert('ใส่ชื่อจริงของคุณด้วย');
			tf.firstname.focus();
			return false;
		}
		if (tf.lastname.value == "") {
			alert('ใส่นามสกุลของคุณด้วย');
			tf.lastname.focus();
			return false;
		}		
		if (tf.day.value==""|| tf.mon.value==""|| tf.yea.value==""){			
			alert('ระบุวันเดือนปีเกิดของคุณด้วย');
			if (tf.day.value==""){tf.day.focus();}else if(tf.mon.value==""){tf.mon.focus()}else{tf.yea.focus()}			
			return false;
		}
		if (tf.cardid.value.length < 13) {
			alert( 'ระบุหมายเลขบัตรประจำตัวประชาชนของคุณด้วย');
			tf.cardid.focus();
			return false;
		}		
		if (tf.address.value.length < 15) {
			alert( 'ใส่ที่อยู่ที่สามารถติดต่อได้ให้ละเอียดด้วย (เลขที่ หมู่ ตำบล อำเภอ)');
			tf.address.focus();
			return false;
		}
		if (tf.province.value == "") {
			alert('ระบุชื่อจังหวัดที่คุณอยู่ด้วย');
			tf.province.focus();
			return false;
		}
		if (tf.zip.value.length < 5) {
			alert('ใส่รหัสไปรษณีย์ให้ครบด้วย');
			tf.zip.focus();
			return false;
		}
		if (tf.tel.value == "") {
			alert('ใส่หมายเลขโทรศัพท์ที่สามารถติดต่อได้ด้วย\n(ถ้าไม่มีให้ใส่ - แทน)');
			tf.tel.focus();
			return false;
		}	
		if (tf.mobile.value == "") {
			alert('ใส่หมายเลขโทรศัพท์มือถือที่สามารถติดต่อได้ด้วย\n(ถ้าไม่มีให้ใส่ - แทน)');
			tf.mobile.focus();
			return false;
		}	
		if (tf.email.value == "") {
			alert('ใส่อีเมล์แอดเดรสของคุณด้วย');
			tf.email.focus();
			return false;
		}		
	}
// ลืมรหัสผ่าน
function chkforgotform(tf) {
	if (tf.email.value == "") {
		alert('ใส่อีเมล์ของคุณด้วย');
		tf.email.focus();
		return false;
	}
	if (tf.email.value!="") {
		if (tf.email.value.indexOf("@")==-1 || tf.email.value.indexOf(".")==-1 || tf.email.value.indexOf(" ")!=-1 || tf.email.value.length<6) 	{
			alert('รูปแบบอีเมล์ไม่ถูกต้อง');
			tf.email.focus();return false
		} 
	}
}
//สมัครสมาชิก
function OpenPreviewRegister(){
  		strFirstname = escape(document.reg.firstname.value);
  		strLastname = escape(document.reg.lastname.value);
  		strDay = escape(document.reg.day.value);
		strMonth = escape(document.reg.mon.value);		
		strYear = escape(document.reg.yea.value);
		strOccupation = escape(document.reg.occupation.value);
		strAddress = escape(document.reg.address.value);
		strProvince = escape(document.reg.province.value);
		strCountry = escape(document.reg.country.value);
		strZip = escape(document.reg.zip.value);
		strTel = escape(document.reg.tel.value);
		strMobile = escape(document.reg.mobile.value);		
		strEmail = escape(document.reg.email.value);		
		document.cookie = "strFirstname=" + strFirstname
		document.cookie = "strLastname=" + strLastname
		document.cookie = "strDay=" + strDay
		document.cookie = "strMonth=" + strMonth
		document.cookie = "strYear=" + strYear
		document.cookie = "strOccupation=" + strOccupation
		document.cookie = "strAddress=" + strAddress
		document.cookie = "strProvince=" + strProvince
		document.cookie = "strCountry=" + strCountry
		document.cookie = "strZip=" + strZip
		document.cookie = "strTel=" + strTel
		document.cookie = "strMobile=" + strMobile
		document.cookie = "strEmail=" + strEmail
   	openWin('preview.asp','preview','toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=0,width=500,height=250')
}
function openWin(theURL,winName,features) {
  	window.open(theURL,winName,features);
}

//member login
function chkloginform(tf) {
	if (tf.uname.value == "") {
		alert('กรอกชื่อล็อกอินของคุณด้วย');
		tf.uname.focus();
		return false;
	}	
	if (tf.upassword.value == "") {
		alert('กรอกรหัสผ่านของคุณให้ถูกต้องด้วย');
		tf.upassword.focus();
		return false;
	}
}
//member login
function chkloginform2() {
	if (document.frmlogin.uname.value == "") {
		alert('กรอกชื่อล็อกอินของคุณด้วย');
		document.frmlogin.uname.focus();
		return false;
	}	
	if (document.frmlogin.upassword.value == "") {
		alert('กรอกรหัสผ่านของคุณให้ถูกต้องด้วย');
		document.frmlogin.upassword.focus();
		return false;
	}
}
function mOvr(src,clrOver){ 
	if (!src.contains(event.fromElement)){ 
		src.style.cursor = 'hand'; 
		src.bgColor = clrOver; 
	} 
} 
function mOut(src,clrIn){ 
	if (!src.contains(event.toElement)){ 
		src.style.cursor = 'default'; 
		src.bgColor = clrIn; 
	} 
} 
// send2friend
function chksend2friendform(tf)
	{
		if (tf.mailfriend.value =="") {
			alert('ใส่ e-mail ของเพื่อนคุณด้วย');
			tf.mailfriend.focus();
			return false;
		}
		if (tf.mailfriend.value!="") {
		if (tf.mailfriend.value.indexOf("@")==-1 || tf.mailfriend.value.indexOf(".")==-1 || tf.mailfriend.value.indexOf(" ")!=-1 || tf.mailfriend.value.length<6) 	{
			alert('รูปแบบอีเมล์ไม่ถูกต้อง');
			tf.mailfriend.focus();return false
		} 
	}
		if (tf.comment.value =="") {
			alert('ใส่ข้อความแนะนำด้วย');
			tf.comment.focus();
			return false;
		}
	}
// bookmark
function addBookmark(title,url) {
		if (window.sidebar) {
			window.sidebar.addPanel(title, url,"");
		} else if( document.all ) {
			window.external.AddFavorite( url, title);
		} else if( window.opera && window.print ) {
			return true;
		}
	}

function maskKeyPress(objEvent) 
	{
	  var iKeyCode;  	
	  iKeyCode = objEvent.keyCode;			
	  if(iKeyCode>=48 && iKeyCode<=57) return true;
	  return false;
	}
function keyCheck(eventObj, obj)
{
	var keyCode

	// Check For Browser Type
	if (document.all){ 
		keyCode=eventObj.keyCode
	}
	else{
		keyCode=eventObj.which
	}

	var str=obj.value

	if(keyCode==46){ 
		if (str.indexOf(".")>0){
			return false
		}
	}

	if((keyCode<48 || keyCode >58)   &&   (keyCode != 46)){ 
		return false
	}

	return true
}
function conf(obj)
   {
   	if (confirm('การกระทำนี้ จะเป็นการลบข้อมูลอย่างถาวร\nคลิก OK เพื่อยืนยันการลบข้อมูล') == true) {
   	   return true;
   	}
   	return false;
   }
var cnt=1;
	var oldmsg =" ";
function AddPic(pictname) {
	if (cnt == 1) {
		oldmsg = document.frmpost.comment.value;
		if (document.frmpost.comment.value == "") {
			document.frmpost.comment.value += document.frmpost.blob.value + " ";
		} else {
			document.frmpost.comment.value += "\n" + document.frmpost.blob.value + " ";
		}
		document.frmpost.comment.focus();
		cnt +=1;
	}
	else {
		document.frmpost.comment.value = oldmsg;
		if (document.frmpost.comment.value == "") {
			document.frmpost.comment.value += document.frmpost.blob.value + " ";
		} else {
		document.frmpost.comment.value += "\n" + document.frmpost.blob.value + " ";
		}
		document.frmpost.comment.focus();
		alert('ใส่รูปภาพได้ครั้งละ 1 รูปเท่านั้น\nถ้าต้องการใส่รูปมากกว่า 1 รูป คลิกที่ปุ่ม images แล้วใส่ url ของรูปภาพแทน ');
	}
}
function AddPic2(pictname) {
	if (cnt == 1) {
		oldmsg = document.frmpost.question.value;
		if (document.frmpost.question.value == "") {
			document.frmpost.question.value += document.frmpost.blob.value + " ";
		} else {
			document.frmpost.question.value += "\n" + document.frmpost.blob.value + " ";
		}
		document.frmpost.question.focus();
		cnt +=1;
	}
	else {
		document.frmpost.question.value = oldmsg;
		if (document.frmpost.question.value == "") {
			document.frmpost.question.value += document.frmpost.blob.value + " ";
		} else {
			document.frmpost.question.value += "\n" + document.frmpost.blob.value + " ";
		}
		document.frmpost.question.focus();
		alert('ใส่รูปภาพได้ครั้งละ 1 รูปเท่านั้น\nถ้าต้องการใส่รูปมากกว่า 1 รูป คลิกที่ปุ่ม images แล้วใส่ url ของรูปภาพแทน ');
	}
}
function textCounter(field, countfield, maxlimit) {
		if (field.value.length > maxlimit) // if too long...trim it!
			field.value = field.value.substring(0, maxlimit);
			// otherwise, update 'characters left' counter
		else
			countfield.value = maxlimit - field.value.length;
	}
	function AddTag(code,promptText, InsertText) {
		if (code != "") {
			insertCode = prompt(promptText + "\n[" + code + "]ข้อความ[/" + code + "]", InsertText);
				if ((insertCode != null) && (insertCode != "")){
					if (document.frmpost.comment.value == "") {
						document.frmpost.comment.value += "[" + code + "]" + insertCode + "[/"+ code + "]" + " ";
					} else {
						document.frmpost.comment.value += " " + "[" + code + "]" + insertCode + "[/"+ code + "]" + " ";
					}
				}
		}
		document.frmpost.comment.focus();
	} 
	function AddTag2(code,promptText, InsertText) {
		if (code != "") {
			insertCode = prompt(promptText + "\n[" + code + "]ข้อความ[/" + code + "]", InsertText);
				if ((insertCode != null) && (insertCode != "")){
					if (document.frmpost.question.value == "") {
						document.frmpost.question.value +=  "[" + code + "]" + insertCode + "[/"+ code + "]" + " ";
					} else {
						document.frmpost.question.value += " " + "[" + code + "]" + insertCode + "[/"+ code + "]" + " ";
					}
				}
		}
		document.frmpost.question.focus();
	} 
	function AddFontTag(code,promptText, InsertText) {
		if (code != "") {
			insertCode = prompt(promptText + "\n[" + code + "]ข้อความ[/f]", InsertText);
				if ((insertCode != null) && (insertCode != "")){
					document.frmpost.comment.value += "[" + code + "]" + insertCode + "[/" + code +"]" + " ";
				}
		}
		document.frmpost.comment.focus();
	}
	function AddFontTag2(code,promptText, InsertText) {
		if (code != "") {
			insertCode = prompt(promptText + "\n[" + code + "]ข้อความ[/f]", InsertText);
				if ((insertCode != null) && (insertCode != "")) {						
						document.frmpost.question.value += "[" + code + "]" + insertCode + "[/" + code +"]" + " ";
				}
		}
		document.frmpost.question.focus();
	}
	function AddIcon(iconCode) {
 		document.frmpost.comment.value += iconCode + " ";
	}
	function AddIcon2(iconCode) {
 		document.frmpost.question.value +=  iconCode + " " ;
	}
	function CngTd(form,act,Title)	{
		if(act=="on")	{
			form.style.backgroundColor='#ffffff';
}	else	{
			form.style.backgroundColor=''
		}
}
function chkkeyword(tf) {
    if (tf.keyword.value == "") {
    		alert('ใส่คำที่ต้องการค้นหาด้วย');
    		return false;
    }
}
	
    function Chkvalidpost(tf)
     {
        if (tf.cat.value=="")
        {
          alert('เลือกหมวดหมู่ด้วย');
          tf.cat.focus();
          return(false);
        }
        if (tf.pname.value == "")
        {
           alert('ชื่อ หัวข้อและข้อความต้องใส่ให้ครบทั้ง 3 ช่อง\nคุณยังไม่ได้ใส่ชื่อของคุณเลย');
           tf.pname.focus();
           return(false);
        }
        if (tf.topic.value == "")
        {
           alert('ชื่อ หัวข้อและข้อความต้องใส่ให้ครบทั้ง 3 ช่อง\nคุณยังไม่ได้ใส่หัวข้อของคุณเลย');
           tf.topic.focus();
           return(false);
        }
        if (tf.question.value == "")
        {
           alert('ชื่อ หัวข้อและข้อความต้องใส่ให้ครบทั้ง 3 ช่อง\nคุณยังไม่ได้ใส่ข้อความของคุณเลย');
           tf.question.focus();
           return(false);
        }
        if (tf.adel[0].checked) {
        		if (tf.nofday.value <= 0) {
        			alert('ใส่จำนวนวันที่ต้องการให้ลบข้อความอัตโนมัติด้วย');
        			return false;
        		}
        }

        if (tf.mailme[0].checked) {
        		if (tf.email.value == "") {
        			alert('ถ้าต้องการให้แจ้งเมื่อมีผู้ตอบ กรอกอีเมล์ของคุณไว้ด้วย');
        			tf.email.focus();
        			return false;
        		}
        }
        tf.addnewpost.disabled = true;
     }  
		function refreshParent() {
  			window.opener.location.href = window.opener.location.href;
  		}  
// Admin Login
function chkblankadmlogin(tf) {
		if (tf.loginname.value == "") {
			alert('ใส่ชื่อล็อกอินของคุณด้วย');
			tf.loginname.focus();
			return false;
		}
		if (tf.pwd.value == "") {
			alert('ใส่รหัสผ่านของคุณด้วย');
			tf.pwd.focus();
			return false;
		}
	}
	//หมวดหมู่กระทู้
	function chkvalidroomname(tf)
	{
		if (tf.title.value == "") {
			alert('ใส่ชื่อห้องด้วยครับ');
			tf.title.focus();
			return false;
		}
		if (tf.description.value == "") {
			alert('ใส่คำอธิบายสั้นๆ เกี่ยวกับห้องนี้ด้วยครับ');
			tf.description.focus();
			return false;
		}
	}
	//Badword
	function chkvalidbadword(tf) {
		if (tf.badwords.value == "") {
			alert('กรอกคำที่ต้องการป้องกันในเว็บบอร์ดด้วย');
			tf.badwords.focus();
			return false;
		}
	}
	//config
	function chkvalidconfig(tf) {
		if (tf.sitename.value == "") {
			alert('กรอกชื่อเว็บไซต์ด้วย');
			tf.sitename.focus();
			return false;
		}
		if (tf.boardname.value == "") {
			alert('กรอกชื่อเว็บบอร์ดด้วย');
			tf.boardname.focus();
			return false;
		}
		if (tf.rule.value == "") {
			alert('กรอกคำชี้แจงในการใช้เว็บบอร์ดด้วย');
			tf.rule.focus();
			return false;
		}
		if (tf.qpagelen.value == "") {
			alert('กรอกจำนวนหัวข้อกระทู้ที่ต้องการให้แสดงต่อ 1 หน้าด้วย');
			tf.qpagelen.focus();
			return false;
		}
		if (tf.apagelen.value == "") {
			alert('กรอกจำนวนข้อความคิดเห็นที่ต้องการให้แสดงต่อ 1 หน้าด้วย');
			tf.apagelen.focus();
			return false;
		}
		if (tf.brdurl.value == "") {
			alert('กรอก URL ของเว็บบอร์ดด้วย');
			tf.brdurl.focus();
			return false;
		}
		if (tf.maximgsize.value == "") {
			alert('กรอกขนาดของไฟล์รูปภาพที่สามารถอัพโหลดได้ด้วย');
			tf.maximgsize.focus();
			return false;
		}
		if (tf.mailadmin.value == "") {
			alert('กรอก Email ผู้ดูแลระบบด้วย');
			tf.mailadmin.focus();
			return false;
		}
	}
	function chkvalidmemberdata(tf) {
		if (tf.uname.value == "") {
			alert('กรอกชื่อล็อกอินด้วย');
			tf.uname.focus();
			return false;
		}
		if (tf.upasswd.value == "") {
			alert('กรอกรหัสผ่านด้วย');
			tf.upasswd.focus();
			return false;
		}
		if (tf.firstname.value == "") {
			alert('กรอกชื่อสมาชิกด้วย');
			tf.firstname.focus();
			return false;
		}
		if (tf.lastname.value == "") {
			alert('กรอกนามสกุลด้วย');
			tf.lastname.focus();
			return false;
		}
		if (tf.province.value == "") {
			alert('ระบุจังหวัดด้วย');
			tf.province.focus();
			return false;
		}		
		if (isNaN(tf.ulevel.value)) {
			alert('ใส่ได้เฉพาะตัวเลข 1 หรือ 2 เท่านั้น');
			tf.ulevel.focus();
			return false;
		}		
	}
//-->