function checkform()
{
  if(document.form1.personal.value==""){
	   alert("กรุณาระบุบุคลากร");
         return false;
	  }else if(document.form1.reason.value==""){
	   alert("กรุณาระบุเหตุผล");
         return false;
	  }else if(document.form1.input9.value==""){
	   alert("กรุณาระบุวันที่");
         return false;
	  }
	   else {
			return true;
		}
}

function checkformpersonal()
{
  if(document.form1.idteacher.value==""){
	   alert("กรุณาระบุรหัสบุคลากร");
	   form1.idteacher.focus();
         return false;
	  }else if(document.form1.name.value==""){
	   alert("กรุณาระบุชื่อ-สกุล");
	   form1.name.focus();
         return false;
	  }else if(document.form1.depart.value==""){
	   alert("กรุณาระบุสังกัด");
         return false;
	  }else if(document.form1.level.value==""){
	   alert("กรุณาระบุระดับการเข้าใช้งานโปรแกรม");
         return false;
	  }
	   else {
			return true;
		}
}

function checkformbank()
{
  if(document.form1.input9.value==""){
	   alert("กรุณาระบุวันที่");
         return false;
	  }else if(document.form1.activity.value==""){
	   alert("กรุณาระบุกิจกรรมที่ทำ");
	   form1.activity.focus();
         return false;
	  }else if(document.form1.prize.value==""){
	   alert("กรุณาระบุระดับรางวัลที่ได้รับ");
	   form1.prize.focus();
         return false;
	  }else if(document.form1.owner.value==""){
	   alert("กรุณาระบุผู้มอบรางวัล");
	   form1.owner.focus();
         return false;
	  }else if(document.form1.major.value==""){
	   alert("กรุณาระบุกลุ่มสาระ");
	   form1.major.focus();
         return false;
	  }
	   else {
			return true;
		}
}

function checkclub()
{
  if(document.form1.club.value==""){
	   alert("กรุณาระบุชื่อชุมนุม");
	     form1.club.focus();
         return false;
	  }else if(document.form1.teacher.value==""){
	   alert("กรุณาระบุอาจารย์ที่ปรึกษา");
	   form1.teacher.focus();
         return false;
	  }else if(document.form1.nums.value==""){
	   alert("กรุณาระบุจำนวนสมาชิกชุมนุมที่รับ");
	   form1.nums.focus();
         return false;
	  }
	   else {
			return true;
		}
}

function trim(str)
{
	return str.replace(/^\s+|\s+$/g,'');
}

/*
Make sure that textBox only contain number
*/
function checkNumber(textBox)
{
	while (textBox.value.length > 0 && isNaN(textBox.value)) {
		textBox.value = textBox.value.substring(0, textBox.value.length - 1)
	}
	
	textBox.value = trim(textBox.value);
/*	if (textBox.value.length == 0) {
		textBox.value = 0;		
	} else {
		textBox.value = parseInt(textBox.value);
	}*/
}

