function goAppDetail(){
	with(window.cscform){
				__help.value = "applicantid#'"+__applicantid.value+"',companyid#'"+__companyid.value+"'";	
				params = "__applicantid="+__applicantid.value+"&__companyid="+__companyid.value;
				page = "REQ206.jsp?"+params;
	//		window.open(page,"Candidate Detail","left=150,top=150,width=700,height=500,toolbar=no,status=yes,scrollbars=yes");
			window.open(page);
	}
}

function goAppDetail2(appid,comid){
	with(window.cscform){
			 page = "REQ206.jsp?__applicantid="+appid+
							"&__companyid="+comid;
	//		window.open(page,"Candidate Detail","left=150,top=150,width=700,height=500,toolbar=no,status=yes,scrollbars=yes");
			window.open(page);
	}
}

function closeWindows(){
	with(window.cscform){
			window.close();
	}
}

function chkBox(box,hid){
	if(box.checked){
		hid.value = "1";
	}else hid.value = "0";
}

function setValueBox(hid,box){
	if(hid.value=='1'){
			box.checked = true;
	}
}

function setAllBox(){	
	with(document.cscform){
			setValueBox(__comskill1,comskill1);
			setValueBox(__comskill2,comskill2);
			setValueBox(__comskill3,comskill3);
			setValueBox(__comskill4,comskill4);
			setValueBox(__comskill5,comskill5);
			setValueBox(__comskill6,comskill6);		
			setValueBox(__cust_detail1,cust_detail1);
			setValueBox(__cust_detail2,cust_detail2);
			setValueBox(__cust_detail3,cust_detail3);
			setValueBox(__news_yourself,news_yourself);
			setValueBox(__news_web,news_web);
			setValueBox(__news_branch,news_branch);
			setValueBox(__news_paper,news_paper);
			setValueBox(__news_jobfair,news_jobfair);
			setValueBox(__news_person,news_person);		
	}
}

function saveId(){
	var id = "";
	with(document.cscform){
			id = id1.value + id2.value + id3.value + id4.value + id5.value ;
			if(!chkId()){
				alert(MyCode[75]);
			}
			__id_people.value = id;
	}
}

function chkId(){
	with(document.cscform){
		if(!chklen(id1.value,1)){
			id1.focus();
			return false;
		}
		if(!chklen(id2.value,4)){
			id2.focus();
			return false;
		}
		if(!chklen(id3.value,5)){
			id3.focus();
			return false;
		}
		if(!chklen(id4.value,2)){
			id4.focus();
			return false;
		}
		if(!chklen(id5.value,1)){
			id5.focus();
			return false;
		}
	}
	return true;
}


function chklen(val,limit){
	if(val.length<limit) return false;
	else return true;
}

function setId_people(){
		with(document.cscform){
			id = __id_people.value;
			id1.value = id.substring(0,1);
			id2.value = id.substring(1,5);
			id3.value = id.substring(5,10);
			id4.value = id.substring(10,12);
			id5.value = id.substring(12,13);
		}
}

function moveCursor(len,curr,next){
		with(document.cscform){
			var val = curr.value;
			if(val.length == len){
				next.focus();
			}
		}
	}

function chkNullField(){

	with(document.cscform){
		// id_people 
		if(id1.value==''){
			alert(MyCode[0]);
			id1.focus();
			return false
		}
		else if(id2.value==''){
			alert(MyCode[0]);
			id2.focus();
			return false
		}
		else if(id3.value==''){
			alert(MyCode[0]);
			id3.focus();
			return false
		}
		else if(id4.value==''){
			alert(MyCode[0]);
			id4.focus();
			return false
		}
		else if(id5.value==''){
			alert(MyCode[0]);
			id5.focus();
			return false
		}

		// �������
		else if(__MAPP_ADDR$EADDR$1.value==''){
			alert(MyCode[0]);
			__MAPP_ADDR$EADDR$1.focus();
			return false
		}
		else if(__MAPP_ADDR$EADDR$2.value==''){
			alert(MyCode[0]);
			__MAPP_ADDR$EADDR$2.focus();
			return false
		}
		// ���
		else if(__MAPP_ADDR$EROAD$1.value==''){
			alert(MyCode[0]);
			__MAPP_ADDR$EROAD$1.focus();
			return false
		}
		else if(__MAPP_ADDR$EROAD$2.value==''){
			alert(MyCode[0]);
			__MAPP_ADDR$EROAD$2.focus();
			return false
		}  
		// �Ӻ�
		else if(__MAPP_ADDR$EDISTRICT$1.value==''){
			alert(MyCode[0]);
			__MAPP_ADDR$EDISTRICT$1.focus();
			return false
		}
		else if(__MAPP_ADDR$EDISTRICT$2.value==''){
			alert(MyCode[0]);
			__MAPP_ADDR$EDISTRICT$2.focus();
			return false
		}
		//�ѧ��Ѵ
		/*else if(__province1.value==''){
			alert(MyCode[0]);
			__province1.focus();
			return false
		}
		else if(__province2.value==''){
			alert(MyCode[0]);
			__province2.focus();
			return false
		}*/
		// ������ɳ���	
		else if(__MAPP_ADDR$ZIPCODE$1.value==''){
			alert(MyCode[0]);
			__MAPP_ADDR$ZIPCODE$1.focus();
			return false
		}
		else if(__MAPP_ADDR$ZIPCODE$2.value==''){
			alert(MyCode[0]);
			__MAPP_ADDR$ZIPCODE$2.focus();
			return false
		}

		else if(__MAPP_FAMILY$FNAME$1.value==''){
			alert(MyCode[0]);
			__MAPP_FAMILY$FNAME$1.focus();
			return false
		}
		else if(__MAPP_FAMILY$FNAME$2.value==''){
			alert(MyCode[0]);
			__MAPP_FAMILY$FNAME$2.focus();
			return false
		}
		

	}
	return true;
}

//-- for web board --\\
function setID(){
	with(document.cscform){
		__requestid.value = window.parent.document.forms[0].__requestid.value;
		__applicantid.value = window.parent.document.forms[0].__applicantid.value;
	}
}
// for set topic label \\
function setInvDateTopic(){
	with(document.cscform){
		__topic.value = "Interview date : "+window.parent.document.forms[0].__interviewdate.value;
	}
}

//-- for  all text email --\\
// 1. Acknowledgement Letter (for Candidate - outside company)
function setMailMsg(){
	with(document.cscform){
			var msg="";
				msg = "Dear sir,\n\n"+
							"\t EASY BUY Public Company Limited, Human Resource Department would like to\n"+
							" invite you to attend an interview session in postion "+__position.value+" as you may see the details below.\n\n"+
							"\t"+__interviewdate.value+", "+__interviewtime.value+" at Ramaland Building ( Next to Robinson Silom) Floor 11,\n"+
							" Silom Road, Bangkok (BTS - Saladaeng Statio or MRTA - Silom Station)\n"+
							"\t All candidate must dress and groom properly, for any enquiry, please kindly contact Human Resource department\n"+
							" 02-6329800 ext. 1922 - 1926.\n\n"+
							"\nBest regards,\n\n"+
							"Human Resource Department\n\n"
				__textMailApp.value = msg;				
				}			
}

// 1. Acknowledgement Letter (for Manager - inside company)
function setMailAppointComm(){
	with(document.cscform){
			var msg="";
			msg = "Dear sir,\n\n"+
						"\t Human Resource Department would like to inform you about the interview arragement position \n"+
						__position.value+" as you may see the details below.\n\n"+
						__interviewdate.value+", "+__interviewtime.value+" at "+__interviewroom.value+" \n\n"+
						"\t for any enquiry, please kindly contact Human Resource department 02-6329800 ext. 1922 - 1926.\n\n"+
						"Best regards,\n\n"+
						"Human Resource Department\n\n";
						__textMailComm.value = msg;				
					}			
}

// email message for Result of Candidate (for Candidate - outside company)
function setMailResultCand(){
	with(document.cscform){
		var msg="";
		var result = __result.value;
		if(result=='1' || result=='3'){  // Pass or Pending
			msg = "Dear sir,\n"+
						"\t EASY BUY Public Company Limited, Human Resource Department, we are gratify to \n"+
						" inform that you have "+__resultmsg.value+" interview in the position "+__positionname.value+"., Please kindly check the detail\n"+
						" the details of confirmation below.\n"+
						"Position Name : "+__positionname.value+"\n"+
						"Start Date : "+__start_to_work.value+"\n"+
						"Working Place : "+__room.value+"\n"+
						"\t For any enquiry, please kindly contract Human Resource Department 02-6329800 ext. 1922 - 1926.\n\n"+
						"Best regards,\n"+
						"Human Resource Department\n\n"
		}
		else if(result=='2' || result=='4'){  // Not Pass or Blacklist
			msg = "Dear sir,\n"+
						"\t EASY BUY Public Company Limited, Human Resource Department, we are appreciated for your\n"+
						" presence on .............................. However your qualification has not match with our current job requirement.\n"+
						"We would like to thank you for your precious time and we wish you all success in the next coming future.\n\n"+
						"Thank You,\n"+
						"Human Resource Department\n\n";
		}
		__textMailApp.value = msg;	
	}
}

// email message for Result of Candidate (for Manager - inside company)
function setMailMsgComm(){
	with(document.cscform){
			var msg="";
			var result = __result.value;
			if(result=='1' || result=='3'){  // Pass or Pending
				msg = "Dear sir,\n"+
							"\t Please be confirmed for a new staff in the position "+__positionname.value+".,"+__candidatename.value+" He/She will start with us on\n"+
							__start_to_work.value+"\n"+
							"\t For any enquiry, please kindly contact Human Resource Department 02-6329800 ext. 1922 - 1926.\n"+
							"Best regards,\n"+
							"Human Resource Department\n\n";
			}
			__textMailComm.value = msg;			
	}
}

// shortlist candidates resume -- notification letter ( from HR to Line Manager)
function setMailSesumeToDept(){
	with(document.cscform){
		var msg="";
		msg = "Dear sir,\n"+
					"\tEnclosed herewith is the list of the candidates in position "+__position.value+".\n"+
					"\tPlease kindly screening for a shortlist and return to HR Dept. to make a further interview arrangement\n"+
					"Best regards,\n"+
					"Human Resource Department";
		__textMailApp.value = msg;
	}
}

//shortlist candidates resume -- notification letter ( from Manager to HR)
function setMailSesumeToHR(){
	with(document.cscform){
		var msg="";
		msg = "Dear Human Resource Department,\n"+
					"\tEnclosed herewith is the list of the candidates in position "+__position.value+",\n"+
					"which has been selected by us. Please kindly arrange the interview session following by a \n"+
					" schedule that has been given.\n"+
					"Best regards,\n";
					
		__textMailApp.value = msg;
	}
}

// Reschedule Letter ( to inform a candidate for interview re-arrangement/detail)
function setRecheMail(){
	with(document.cscform){
		var msg="";
		msg = "Dear "+__recreive.value+",\n"+
				"\t EASY BUY Public Company Limited, Human Resource Department would like to\n"+
				"postpone our interview session in position "+__position.value+". Please see the new\n"+
				"schedule below.\n"+
				"\t On "+__interviewdate.value+", "+__interviewtime.value+" at Ramaland Building\n"+
				"(Next to Robinson Silom) Floor 11, Silom Road, Bangkok(BTS-Saladaeng Station or MRTA-Silom Station)\n"+
				"\t All candidates must dress and groom properly, for any enquiry, please kindly contract\n"+
				"Human Resource department 02-6329800 ext.1922-1926.\n"+
				"Best regards,\n"+
				"Human Resource Department";
		__textMailComm.value = msg;
	}
}