<!--
function jumptof(targ,selObj,restore){ //v3.0
  		eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  		if (restore) selObj.selectedIndex=0;
	}
// ลืมรหัสผ่าน
function chkblankforgot(tf) {
  	if (tf.membername.value == "") {
  	  alert('ใส่ชื่อสมาชิกด้วย');
  	  tf.membername.focus();
  	  return false;	
  	}
}
// แจ้งลบ
function chkcomment(tf)	{
	if (tf.comment.value == "") {
		alert('ระบุเหตุผลที่คุณต้องการให้ลบข้อความนี้ด้วย');
		tf.comment.focus();
		return false;
	}
}
// บอกต่อเพื่อน
function chkvaliddata(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;
	}
}
// แนบไฟล์
function chkblank(tf) {
	if (tf.frommail.value =="") {
		alert('กรอก Email ผู้ส่งด้วย');
		tf.frommail.focus();
		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 ผู้รับด้วย');
		tf.tomail.focus();
		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 ด้วย');
		tf.mailsubject.focus();
		return false;
	}
	if (tf.mailmsg.value =="") {
		alert('กรอกรายละเอียดเพิ่มเติมด้วย');
		tf.mailmsg.focus();
		return false;
	}
}
// Login
function chkmemberlogin(tf) {
		if (tf.username.value =="") {
			alert('ใส่ชื่อล็อกอินของคุณด้วย');
			tf.username.focus();
			return false;
		}
		if (tf.password.value =="") {
			alert('ใส่รหัสผ่านของคุณด้วย');
			tf.password.focus();
			return false;
		}
	}
// Register Form
function chkblankform(tf)
	{
		if (tf.fname.value=="") {
			alert('ใส่ชื่อของคุณด้วย');
			tf.fname.focus();
			return false;
		}
		if (tf.lname.value=="") {
			alert('ใส่นามสกุลของคุณด้วย');
			tf.lname.focus();
			return false;
		}
		if (tf.username.value=="") {
			alert('กำหนดชื่อล็อกอินของคุณด้วย');
			tf.username.focus();
			return false;
		}
		if (tf.password.value.length < 5) {
			alert('ใส่รหัสผ่านอย่างน้อย 5 ตัวอักษร');
			tf.password.focus();
			return false;
		}
		if (tf.password2.value != tf.password.value) {
			alert('รหัสผ่านกับยืนยันรหัสผ่านไม่ตรงกัน');
			tf.password2.focus();
			return false;
		}
		if (tf.address.value =="") {
			alert('กรอกที่อยู่ของคุณด้วย');
			tf.address.focus();
			return false;
		}
		if (tf.province.value=="") {
			alert('ระบุจังหวัดด้วย');
			tf.province.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('รูปแบบอีเมล์ไม่ถูกต้อง\nถ้ายังไม่มี e-mail ให้เว้นว่างไว้');
				tf.email.focus();return false
			} 
		}
	}
// Search form
function chksearchform(tf) {
	if (tf.keyword.value == "") {
		alert('ใส่คำที่ต้องการค้นหาด้วย');
		tf.keyword.focus();
		return false;
	}
}
function CngTd(form,act,Title) {
	if(act=="on")	{
		form.style.backgroundColor='#FDF9E5';
	} else	{
			form.style.backgroundColor=''
		}
}
function AddCommentTag(code,promptText, InsertText) {
	if (code != "") {
		insertCode = prompt(promptText + "\n[" + code + "]ข้อความ[/" + code + "]", InsertText);
			if ((insertCode != null) && (insertCode != "")){
				document.frmpost.comment.value += " " + "[" + code + "]" + insertCode + "[/"+ code + "]" + " ";
			}
	}
	document.frmpost.comment.focus();
}
function AddCommentFontTag(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 AddCommentIcon(iconCode) {
   document.frmpost.comment.value += " " + iconCode + " ";
}
function AddCommentPic(pictname) {
	if (cnt == 1) {
		oldmsg = document.frmpost.comment.value;
		document.frmpost.comment.value += " " + document.frmpost.blob.value + " ";
		document.frmpost.comment.focus();
		cnt +=1;
	}
	else {
		document.frmpost.comment.value = oldmsg;
		document.frmpost.comment.value += " " + document.frmpost.blob.value + " ";
		document.frmpost.comment.focus();
		alert('ใส่รูปภาพได้ครั้งละ 1 รูปเท่านั้น\nถ้าต้องการใส่รูปมากกว่า 1 รูป คลิกที่ปุ่ม images แล้วใส่ url ของรูปภาพแทน ');
	}
}
function chkblankcomment(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);
 	}
  	if (tf.mailme[0].checked) {
  		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 AddTag(code,promptText, InsertText) {
	if (code != "") {
		insertCode = prompt(promptText + "\n[" + code + "]ข้อความ[/" + code + "]", InsertText);
		if ((insertCode != null) && (insertCode != "")){
			document.frmpost.question.value += " [" + code + "]" + insertCode + "[/"+ code + "]";
		}
	}
	document.frmpost.question.focus();
}
function AddFontTag(code,promptText, InsertText) {
	if (code != "") {
		insertCode = prompt(promptText + "\n[" + code + "]ข้อความ[/"+ code+"]", InsertText);
			if ((insertCode != null) && (insertCode != "")){
				document.frmpost.question.value += "[" + code + "]" + insertCode + "[/" + code + "]" ;
			}
	}
	document.frmpost.question.focus();
}
function AddIcon(iconCode) {
	document.frmpost.question.value += " " + iconCode + " ";
}

function chkkeyword(tf) {
	if (tf.keyword.value == "") {
  		alert('ใส่คำที่ต้องการค้นหาด้วย');
  		return false;
  }
}
	
function conf(obj) {
 	if (confirm('การกระทำนี้ จะเป็นการลบข้อมูลอย่างถาวร\nคลิก OK เพื่อยืนยันการลบข้อมูล') == true) {
  		return true;
   }
   return false;
}
    
function chkblankpost(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('ใส่จำนวนวันที่ต้องการให้ลบข้อความอัตโนมัติด้วย');
     	tf.nofday.focus();
       return false;
  		}
 	}
	if (tf.mailme[0].checked) {
  		if (tf.email.value == "") {
     	alert('ถ้าต้องการให้แจ้งเมื่อมีผู้ตอบ กรอกอีเมล์ของคุณไว้ด้วย');
       return false;
   	}
  	}
}

function textCounter(field, countfield, maxlimit) {
	if (field.value.length > maxlimit)
		field.value = field.value.substring(0, maxlimit);		
		else
			countfield.value = maxlimit - field.value.length;
}

var cnt=1;
var oldmsg =" ";
function AddPic(pictname) {
	if (cnt == 1) {
		oldmsg = document.frmpost.question.value;
		document.frmpost.question.value += " " + document.frmpost.blob.value + " ";
		document.frmpost.question.focus();
		cnt +=1;
	}
	else {
		document.frmpost.question.value = oldmsg;
		document.frmpost.question.value += " " + document.frmpost.blob.value + " ";
		document.frmpost.question.focus();
		alert('ใส่รูปภาพได้ครั้งละ 1 รูปเท่านั้น\nถ้าต้องการใส่รูปมากกว่า 1 รูป คลิกที่ปุ่ม images แล้วใส่ url ของรูปภาพแทน ');
	}
}

-->
