function chkpasswordform(tf) {
	if (tf.newpass.value == "") {
		alert('ใส่รหัสผ่านใหม่ด้วย');
		tf.newpass.focus();
		return false;
	}
	if (tf.confnewpass.value != tf.newpass.value) {
		alert('รหัสผ่านใหม่ กับ ยืนยันรหัสผ่านใหม่ ไม่ตรงกัน');
		tf.confnewpass.focus();
		return false;
	}
}
// search company
function chkblanksrchcompany(tf) {
	if (tf.kword.value == "") {
		alert('ใส่คำที่ต้องการค้นหาด้วยครับ');
		tf.kword.focus();
		return false;
	}
}

function conf(obj)
   {
   	if (confirm('การกระทำนี้ จะเป็นการลบข้อมูลอย่างถาวร\nคลิก OK เพื่อยืนยันการลบข้อมูล') == true) {
   	   return true;
   	}
   	return false;
   }
// add company
function chkblankcompany(tf) {   
	if (tf.group.value == "") {
		alert('กรุณาเลือกหมวดหมู่หลักด้วยครับ');
		tf.group.focus();
		return false;
	}
	if (tf.cat.value == "") {
		alert('กรุณาเลือกหมวดหมู่ย่อยด้วยครับ');
		tf.cat.focus();
		return false;
	}
	if (tf.thainame.value == "") {
 		alert('กรุณากรอก ชื่อนิติบุคคล (ไทย) ด้วยครับ');
 		tf.thainame.focus();
    	return false;
	}  
	if (tf.engname.value.length<=0 ) {
  		alert('กรุณากรอก ชื่อนิติบุคคล (อังกฤษ) ด้วยครับ');
  		tf.engname.focus();
    	return false;
  }
  if (tf.address.value == "") {
   	alert('กรุณากรอก ที่ตั้งสำนักงานแห่งใหญ่ ด้วยครับ');
   	tf.address.focus();
    	return false;
 	}
 	if (tf.tel.value == "") {
 	alert('กรุณากรอกหมายเลขโทรศัพท์ด้วยครับ');
 	tf.tel.focus();
 	return false;
 }
 	if (tf.fax.value == "") {
 		alert('กรุณากรอกหมายเลขโทรสารด้วยครับ');
 		tf.fax.focus();
 		return false;
	}
	if (tf.detailgoods.value == "") {
		alert('กรุณากรอกรายละเอียดประเภทธุรกิจด้วยครับ');
		tf.detailgoods.focus();
		return false;
	}
	if (tf.keywthai.value == "") {
  		alert('กรุณากรอกคีย์เวิร์ดภาษาไทยเพื่อการค้นหาด้วยครับ ');
  		tf.keywthai.focus();
  		return false;
  	}
  	if (tf.keyweng.value == "") {
  		alert('กรุณากรอกคีย์เวิร์ดภาษาอังกฤษเพื่อการค้นหาด้วยครับ ');
  		tf.keyweng.focus();
  		return false;
  	}
  	if (tf.username.value == "")
  	{
      alert('กรุณากรอก Username ด้วยครับ ');
      tf.username.focus();
      return false;
  }
  if (tf.pass.value == "") {
  			alert('กรุณากรอก Password ด้วยครับ ');
  			tf.pass.focus();
  			return false;
  		}
  		if (tf.pass1.value == "") {
  			alert('กรุณากรอก Password อีกครั้งครับ ');
  			tf.pass1.focus();
  			return false;
  		}
  		if (tf.pass.value != tf.pass1.value) {
  			alert('รหัสผ่านกับยืนยันรหัสผ่านไม่ตรงกัน');
  			tf.pass1.focus();
  			return false;
  		}
  		if (tf.email_u.value == "") {
  			alert('กรุณากรอก Email ของคุณครับ ');
  			tf.email_u.focus();
  			return false;
     }
     if (tf.jobname.value == "") {
     	alert('กรุณากรอกชื่อผู้ทำหน้าที่รับสมัครงานด้วยครับ');
     	tf.jobname.focus();
     	return false;
     }        	
     if (tf.contactto.value == "") {
      alert('กรุณากรอกชื่อเพื่อการติดต่อด้วยครับ ');
      tf.contactto.focus();
      return false;
      }
  		if (tf.address2.value == "") {      
      alert('กรุณากรอกที่อยู่ด้วยครับ');
      tf.address2.focus();
      return false;
      }
  			if (tf.telephone.value == "") {
  			alert('กรุณากรอกหมายเลขโทรศัพท์เพื่อการติดต่อด้วยครับ ');
  			tf.telephone.focus();
      	return false;
     }
  		if (tf.email_1.value == "") {
  			alert('กรุณา e-mail เพื่อการติดต่อด้วยครับ ');
      	tf.email_1.focus();
  			return false;
    }
}

// Search
function chkblanksearch(tf) {
	if (tf.tsearch.value == "") {
		alert('ใส่คำที่ต้องการค้นหาด้วย');
		tf.tsearch.focus();
		return false;
	}
}
// Login
function chklogin(tf) {
	if (tf.uname.value == "") {
		alert('ใส่ชื่อล็อกอินด้วย');
		tf.uname.focus();
		return false;
	}
	if (tf.upass.value == "") {
		alert('ใส่รหัสผ่านด้วย');
		tf.upass.focus();
		return false;
	}
}
// เพิ่มหมวดหลัก
function chkblankgroupdata(tf) {
	if (tf.thgroup.value == "") {
		alert('ใส่ชื่อหมวดหมู่หลักด้วย');
		tf.thgroup.focus();
		return false;
	}
	if (tf.groupdesc.value == "") {
		alert('ใส่คำอธิบายสำหรับหมวดหมู่นี้ด้วย');
		tf.groupdesc.focus();
		return false;
	}
}
// หมวดหมู่ย่อย
function chkblankcatdata(tf) {
	if (tf.group.value == "") {
		alert('เลือกหมวดหมู่หลักให้หมวดหมู่ย่อยนี้ด้วย');
		tf.group.focus();
		return false;
	}
	if (tf.catname.value == "") {
		alert('ใส่ชื่อหมวดหมู่ย่อยด้วย');
		tf.catname.focus();
		return false;
	}
	if (tf.catdesc.value == "") {
		alert('ใส่คำอธิบายสำหรับหมวดหมู่ย่อยนี้ด้วย');
		tf.catdesc.focus();
		return false;
	}
}
// เพิ่มเว็บไซต์
function chkblanklinkdata(tf) {
	if (tf.group.value == "") {
		alert('เลือกหมวดหมู่หลักด้วย');
		tf.group.focus();
		return false;
	}
	if (tf.cat.value == "") {
		alert('เลือกหมวดหมู่ย่อยด้วย');
		tf.cat.focus();
		return false;
	}
	if (tf.title.value == "") {
		alert('ใส่ชื่อเว็บไซต์ด้วย');
		tf.title.focus();
		return false;
	}
	if (tf.url.value == "") {
		alert('ระบุ url ของเว็บไซต์ด้วย');
		tf.url.focus();
		return false;
	}
	if (tf.desc.value == "") {
		alert('ใส่คำอธิบายเกี่ยวกับเว็บไซต์ด้วย');
		tf.desc.focus();
		return false;
	}
	if (tf.kword.value == "") {
		alert('ระบุคำที่ต้องการให้ค้นพบเว็บไซต์ด้วย');
		tf.kword.focus();
		return false;
	}
	if (tf.infoname.value == ""){
		alert('ใส่ชื่อผู้แนะนำด้วย');
		tf.infoname.focus();
		return false;
	}
	if (tf.email.value == "") {
		alert('กรอก E-mail ของคุณด้วย');
		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 jumptof(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}