//------------------------------- MyCode -------------------------------------
// wut 31/10/03
var EngCode = new Array(); 
var ThaiCode = new Array(); 
var MyCode=new Array();
var lang="eng";

    ThaiCode[0]="คุณกรอกข้อมูลไม่ครบ";
	EngCode[0]="Invalid Data or null Value !";

	ThaiCode[1]="ต้องการบันทึกข้อมูลหรือไม่ ?";
	EngCode[1]="Save data ?";

    ThaiCode[2]="มีข้อมูล Record นี้อยู่แล้ว ถ้าต้องการบันทึกข้อมูลกรุณากด EDIT ?";
	EngCode[2]="Duplicate data ! Please click EDIT for update data";

	ThaiCode[3]="ต้องการแก้ไขข้อมูลหรือไม่ ?";
	EngCode[3]="Update data ?";

	ThaiCode[4]="ต้องการลบข้อมูลหรือไม่ ?";
	EngCode[4]="Delete data ?";
///------------------ result for database action
	ThaiCode[5]="แก้ไขข้อมูลไม่สำเร็จ";
	EngCode[5]="Can't Update data ,Try again.";

	ThaiCode[6]="ไม่พบข้อมูล";
	EngCode[6]="Data not found.";
	
	ThaiCode[7]="ลบข้อมูลไม่ได้";
	EngCode[7]="Can't delete data.";
	
	ThaiCode[8]="ยังไม่ได้กำหนด";
	EngCode[8]="Undifinded";
	
	ThaiCode[9]="ไม่พบข้อมูล ถ้าต้องการบันทึกกรุณากด ADD";
	EngCode[9]=" Data not found , Please click ADD to save data";
	
	ThaiCode[10]="พิมพ์รายงาน";
	EngCode[10]="Print report";
                      
	ThaiCode[11] = "ได้เลือกไว้แล้ว";
	EngCode[11] = "was selected";         

	ThaiCode[12] = "ตรวจสอบโดย";
	EngCode[12] = "Verify By";

	ThaiCode[13] = "วันเวลาที่แก้ไข";
	EngCode[13] = "Edit Date";
	
	ThaiCode[14] = "แก้ไขโดย";
	EngCode[14] = " Edit By";

	ThaiCode[15] = "กรุณากรอกรหัสพนักงาน";
	EngCode[15] = "Please Enter  Employee Code ";

	ThaiCode[16] = "กรุณากดปุ่ม EDIT";
	EngCode[16] = " Please Click  'EDIT' button";

	ThaiCode[17] = "เพิ่มข้อมูลไม่ได้";
	EngCode[17] = "Can't save data";

	ThaiCode[18] = "แก้ใขข้อมูลเรียบร้อย";
	EngCode[18] = "Update data sucessfull";

    ThaiCode[19] = "ลบข้อมูลเรียบร้อย";
	EngCode[19] = "Delete data sucessfull";

    ThaiCode[20] = "มีการเลือก Payment method แบบอื่นๆ แต่ไม่ใส่รายละเอียด";
	EngCode[20] = "Other Payment method dont have Description";

    ThaiCode[21] = "ยังไม่มีการบันทึกเงื่อนไขการพิมพ์รายงาน";
	EngCode[21] = "No condition for print report";

    ThaiCode[22] = "บันทึกเงื่อนไขที่ ";
	EngCode[22] = "Save condition no.";

    ThaiCode[23] = "ลบเงื่อนไขที่ ";
	EngCode[23] = "Delete condition no.";

	ThaiCode[24] = "กรอกหมายเลขเงื่อนไข ที่ต้องการลบ";
	EngCode[24] = "Input condition no for delete";

	ThaiCode[25] = "กรอกหมายเลขเงื่อนไข บันทึกหรือแก้ไข";
	EngCode[25] = "Input condition no for save or update";

	ThaiCode[26] = "จำนวนพนักงานรวมไม่ถูกต้อง คำนวณใหม่ ?";
	EngCode[26] = " Number of employee  is inInvalid calculate it ?";
	
	ThaiCode[27] = "ยังไม่มีการเลือก field";
	EngCode[27] = " Not  select field";

	ThaiCode[28] = "เงื่อนไขไม่ตรงลำดับ";
	EngCode[28] = " Condition order incorect";


//employee
    ThaiCode[29] = "หน้า refer ไม่สามารถแก้ใขข้อมูลได้";
	EngCode[29] = " This is refer page ,Can't update data";

	ThaiCode[30] = "กลับไปยังหน้าหลัก ?";
	EngCode[30] = " Back to main page ?";
 // return from Verify
  ThaiCode[31] = "ไม่สามารถเพิ่มข้อมูลได้ เพราะข้อมูลนี้กำลังรอการยืนยัน";
	EngCode[31] = "Can't insert data,Data status is Verify Insert";

	ThaiCode[32] = "ไม่สามารถแก้ใข้อมูลได้ เพราะข้อมูลนี้กำลังรอการยืนยันการลบ";
	EngCode[32] = "Can't Update, Data status is Verify Delete";

	ThaiCode[33] = "ไม่สามารถลบข้อมูลได้ เพราะข้อมูลกำลังรอการยืนยันการลบ";
	EngCode[33] = "Can't Delete, Data status is Verify Delete";

	ThaiCode[34] = "ไม่สามารถลบข้อมูลได้ เพราะข้อมูลกำลังรอการยืนยันการแก้ใข";
	EngCode[34] = "Can't Delete, Data status is Verify Update."

	ThaiCode[35] = " :: ไม่สามารถแก้ไขได้ , ข้อมูลกำลังรอการยืนยันการแก้ไขงจาก user คนอื่น ";
	EngCode[35] = " :: Can't Update, Data status is Verify Update by other user ";

	ThaiCode[36] = " ไม่สามารถแก้ไขได้ ข้อมูลชุดนี้อยู่ในระหว่างการรอ Verify ";
	EngCode[36] = " Can't Update, Data group status is weat for verify ";

//--------------------- PAS ----------------------------------------------------
	/*ThaiCode[26] = "ผลรวทั้งหมด ต้องเท่ากับ 100";
	EngCode[26] = " Over all score = 100";

	ThaiCode[27] = "กรอกคะแนนไม่ถูกต้อง !!!!!!";
	EngCode[27] = " This score is wrong  !!!!!!";
    
	ThaiCode[28] = "คำสั่งนี้จะใช้ได้ก็ต่อเมื่อ ประเมินครบทุกฟอร์มแล้ว เท่านั้น !!!!!!";
	EngCode[28] = " คำสั่งนี้จะใช้ได้ก็ต่อเมื่อ ประเมินครบทุกฟอร์มแล้ว เท่านั้น !!!!!!";

	ThaiCode[29] = "กรุณาเลือกเรื่องที่ประเมินก่อน !!!!!!";
	EngCode[29] = " Please choose Title topic !!!!!!";

	ThaiCode[30] = "เมื่อยืนยันการประเมินแล้วไม่สามารถแก้ไขได้ !!!!!!!!";
	EngCode[30] = "เมื่อยืนยันการประเมินแล้วไม่สามารถแก้ไขได้ !!!!!!!!";
*/
	ThaiCode[40] = "ผลรวทั้งหมด ต้องเท่ากับ 100";
	EngCode[40] = " Over all score = 100";

	ThaiCode[41] = "กรอกคะแนนไม่ถูกต้อง !!!!!!";
	EngCode[41] = " This score is wrong  !!!!!!";
    
	ThaiCode[42] = "คำสั่งนี้จะใช้ได้ก็ต่อเมื่อ ประเมินครบทุกฟอร์มแล้ว เท่านั้น !!!!!!";
	EngCode[42] = " คำสั่งนี้จะใช้ได้ก็ต่อเมื่อ ประเมินครบทุกฟอร์มแล้ว เท่านั้น !!!!!!";

	ThaiCode[43] = "กรุณาเลือกเรื่องที่ประเมินก่อน !!!!!!";
	EngCode[43] = " Please choose Title topic !!!!!!";

	ThaiCode[44] = "เมื่อยืนยันการประเมินแล้วไม่สามารถแก้ไขได้ !!!!!!!!";
	EngCode[44] = "เมื่อยืนยันการประเมินแล้วไม่สามารถแก้ไขได้ !!!!!!!!";

	ThaiCode[45] = "Please type T or F in case true or false";
	EngCode[45] = "กรณีที่เป็น คำถามประเภทถูกผิด ให้ใส่ T หรือ F";


	MyCode=EngCode;

//----------------------------------------------------------------------

function setLang(lan){
   lang=lan.toLowerCase();
   setCode();
}

function getLang(){
	return lang;
}

function setCode(){
		if(getLang()=="tha"){
		      MyCode=ThaiCode;
		}else{
			  MyCode=EngCode;
	}
}
// end of wut edit 31/10/03
//--------------------------------------------------------------------

function linkChild(page){
	with(document.cscform){
		action=page+".jsp";
		submit();
	}
}
function bdOnload() {
		document.cscform.action=__pageCall.value+".jsp";
		document.cscform.submit();
}

function linkGenXML(page){
	with(document.cscform){
		__xmlname.value=xmlname.value;
		action="/genxml/"+page+".jsp" ;
		submit();
	}
}

function backHelp(){
	with(document.cscform){
		//		alert("__fieldSearch.value = "+__fieldSearch.value+" fieldV = "+fieldV);
     	action=__pageCall.value+".jsp";
		submit();
	}
}


function  setcmd(acktion){
	with(document.cscform){
		if(acktion=="ack"){
			__gorec.value=__maxrec.value;
			__ack.value="ack";
		}else{
			if(acktion=="del"){
				__cmdchild.value="del";
			}else{
				if(acktion=="next"){
					if(__gorec.value<__maxrec.value){__gorec.value++;
					}
				}else{
					if(acktion=="prev"){
						 if(__gorec.value>1){__gorec.value--;  }
					}else{
						if(acktion=="top"){ __gorec.value=1;
						}else{
							if(acktion=="end"){__gorec.value=__maxrec.value;
							}else{
								if(acktion=="save"){
									__cmdchild.value="save";
									__ack.value="add";
								}

							}
						}

					}
				}
			}
		}

//		alert(acktion+"  "+__gorec.value);
  //   	action="http://192.100.1.129:8080/aromatic/jsp/"+__screen.value+".jsp";
		submit();
	}
}

function showcscupload(record){
	with(document.cscform){
		__gorec.value=record;
		__cmd.value="Child";
	     action="pwcscupload_show.jsp?__headMulti="+__screen.value+"&__pwcscupload0="+record;
		submit();
	}
}

function editcscupload(record){
	with(document.cscform){
		__gorec.value=record;
		//__cmd.value="Child";
	     action="pwcscupload_edit.jsp?__headMulti="+__screen.value+"&__pwcscupload0="+record;
		submit();
	}
}

function childMulti(record){
	with(document.cscform){
		__gorec.value=record;
		__cmd.value=""; // edit
	     action=__childMulti.value+".jsp";

		submit();
	}
}

function backhead(){
	with(window.opener.cscform){
	     //action=__headMulti.value+".jsp";
	    submit();
	     window.close();
		
	}
}

function addMulti(){
	with(document.cscform){
		__cmd.value="";
		__gorec.value="";
		__ack.value="add";
	     //action=__childMulti.value+".jsp?__headMulti="+__screen.value;
	     window.open("CS002.jsp?__gorec= &__ack.value=add");
		//submit();
	}
}

function deleteMulti(){
	with(document.cscform){
		__cmd.value="DelChild";
	//    action=__screen.value+".jsp";
		submit();
		alert(__cmd.value);
	}
}

function  link(jsppage){
	//alert("not in with");
	with(document.cscform){
//		alert("Link");
     	action=jsppage+".jsp";
		submit();
	}
}
function savepass(){
	with(document.cscform){
		if(__pwpassword1.value==__pwpassword2.value){
				bCon=confirm("ต้องการบันทึกข้อมูลหรือไม่ ?");
				if( (bCon==true)&&(__pwpassword.value==__checkpass.value))	{
					__cmd.value="save";
					__pwpassword.value=__pwpassword1.value;
					action=__screen.value+".jsp";
					submit();
					alert("โปรด Login เข้าสู่ระบบใหม่");
				}else{
					alert("รหัสผ่านงานเก่าไม่ถูกต้อง");
				}
		}else{
			alert("ยืนยันรหัสผ่านไม่ถูกต้อง");
		}
	}
}


function  linkReport(jsppage){
	with(document.cscform){
     	action=jsppage+".jsp";
//		submit();
		window.open(jsppage+".jsp?__id="+__id.value);
	}
}

function edelete(){
	with(document.cscform){
		bCon=confirm(MyCode[4]);
		if (bCon==true)	{
			//	setAction(__jspname.value,"delete");
			__cmd.value="delete";
			submit();
		}
	}
}

function search(){	
	with(document.cscform){
		__cmd.value="search";
		submit();
	}
}

function save(){
	with(document.cscform){
		__cmd.value = "save";
		submit();
		}
}

function update(){
	if(nullCheck()){
	with(document.cscform){
		bCon=confirm(MyCode[3]);
		if (bCon==true)	{
			__confirm.value="2";
			__cmd.value = "save";
			submit();
		}
	  }
   }
}

function confirmSave(){
	if(nullCheck()){
	with(document.cscform){
		if(__confirm.value=="0"){
		    	aCon=confirm(MyCode[1]);// จะบันทึกหรือไม่
				if (aCon==true)	{
					save();
				}
		}else {
			alert(MyCode[2]);// ข้อมูลมีอยู่แล้ว
			__confirm.value = "0";
		}
	}
}
}
function checkConfirm(){
	with(document.cscform){
		if(__confirm.value=="1")        {alert(MyCode[2]);__confirm.value = "0";//มีข้อมูลอยู่แล้ว
		}else if(__confirm.value=="4"){alert(MyCode[5]);__confirm.value = "0";//update ไม่ได้
        }else if(__confirm.value=="5"){alert(MyCode[6]);__confirm.value = "0";//search ไม่เจอ
        }else if(__confirm.value=="6"){alert(MyCode[7]);__confirm.value = "0";//delete ไม่ได้
        }else if(__confirm.value=="7"){alert(MyCode[15]);__confirm.value = "0";//Save ่ได้
        }else if(__confirm.value=="8"){alert(MyCode[16]);__confirm.value = "0";//Save ไม่ได้
        }else if(__confirm.value=="9"){alert(MyCode[17]);__confirm.value = "0";//Update ได้
        }else if(__confirm.value=="10"){alert(MyCode[18]);__confirm.value = "0";//delete ได้
		}else __confirm.value = "0";// default value
	}
}

function save_pwcscupload01(){
	with(document.cscform){
		bCon=confirm(MyCode[1]);
		if (bCon==true)	{
			__cmd.value="save";
			action="pwcscupload01"+".jsp";
			submit();
		}
	}
}

function linkHelp_pwtran(help,input){
	with(document.cscform){
		__cmd.value="help";
		__fixCon.value="";
     	action="TestHelp.jsp?__helpName="+help+"&__fieldSearch="+input+"&__pageCall="+__screen.value;
		submit();
	}
}

function linkHelp_fc(help,input){
	with(document.cscform){
		__cmd.value="help";
		__cmdchild.value="save";
     	action="testhelp.jsp?__helpName="+help+"&__fieldSearch="+input+"&__pageCall=bgfactorclass1";
		submit();
	}
}

function linkHelp_fc_active(help,input){
	with(document.cscform){
		__active.value="active";
		__cmd.value="help";
		__cmdchild.value="save";
     	action="testhelp.jsp?__helpName="+help+"&__fieldSearch="+input+"&__pageCall=bgfactorclass1";
		submit();
	}
}

function linkHelp_bgtemp_active(help,input){
	with(document.cscform){
		__active.value="active";
		__cmd.value="help";
		__cmdchild.value="save";
     	action="testhelp.jsp?__helpName="+help+"&__fieldSearch="+input+"&__pageCall=bgcscuploadtemplate1";
		submit();
	}
}

function linkHelp_bg(help,fieldName,show){
	with(document.cscform){
		__cmd.value="help";
		__cmdchild.value="save";
     	action="testhelp.jsp?__helpName="+help+"&__fieldSearch="+input+"&__pageCall=bgcscuploadgroup1";
		submit();
	}
}

function helpPage(helpName){
	with(document.cscform){
			window.open(helpName+".jsp","Help","left=150,top=150,width=800,height=200,toolbar=no,status=yes,scrollbars=yes");
	}
}
//23/09/03 edit by SUK
function linkHelp(help,input){
	with(document.cscform){
	var param="AS000.jsp?__helpName="+help+"&__fieldSearch="+input+"&__pageCall="+__screen.value+"&__fixCon="+__fixCon.value;
	window.open(param,"Help","left=150,top=150,width=700,height=440,resizable=yes,scrollbars=yes,toolbar=no,status=yes");
}
}
function helpPageCon(help,input,fcon){
with(document.cscform){
	var param="AS000.jsp?__fixCon="+fcon+"&__helpName="+help+"&__helpReturn="+input+"&__pageCall="+__screen.value;
	window.open(param,"Help","left=150,top=150,width=500,height=200,toolbar=no,status=yes,scrollbars=yes,resizable=yes");
}
}

function linkHelp_Return(help,input){
	with(document.cscform){
	var param="AS000.jsp?__helpName="+help+"&__helpReturn="+input+"&__pageCall="+__screen.value;
window.open(param,"Help","left=150,top=150,width=700,height=500,toolbar=no,status=yes,scrollbars=yes,resizable=yes");
}
}

function linkHelpReport_Return(help,input){
	with(document.cscform){
	var param="ASRHELP000.jsp?__helpName="+help+"&__helpReturn="+input+"&__pageCall="+__screen.value;
window.open(param,"Help","left=150,top=150,width=700,height=500,toolbar=no,status=yes,scrollbars=yes,resizable=yes");
}
}


function backMainPage(page){
	with(document.cscform){
		__screen.value="bgcscuploadgroup";
     	action=page+".jsp";
		submit();
	}
}

/*function backPage(fieldV){
	with(document.cscform){
//		alert("__fieldSearch.value = "+__fieldSearch.value+" fieldV = "+fieldV);
		__cmd.value="search";
     	action=__pageCall.value+".jsp?__help="+__fieldSearch.value+","+fieldV+"&__screen="+__pageCall.value;
		submit();
	}
}*/
//11/09/03   Edit by wut
  //__help="+"employee,comid#007,001"
/*function backPage(valueList){
	with(document.cscform){
      alert(valueList+" back to   --->"+__pageCall.value);
		__cmd.value="search";
     	action=__pageCall.value+".jsp?__help="+valueList+","+"&__screen="+__pageCall.value;
		submit();
	}
	window.close();
}*/
//function backPage(typeid,typename){
function backPage(valueList){
	with(window.opener.document.cscform){
		__help.value = valueList;
		//__codeid.value="412";
		//alert(__help.value);
		//__cmd.value="search";
		__cmd.value="";
		submit();
		//window.opener.location.refresh();
	}	
	window.close();
}

function backPage_Return(valueList){
var tmp = new Array(50);
var tmp1 = new Array(50);
var inputName="";
var inputValue="";
	with(window.opener.document.cscform){
		tmp=valueList.split(",");
   	for (var i=0; i < tmp.length; i++) { 
   	    tmp1=tmp[i].split("#");
        for (var j=0; j < tmp1.length; j++) { 
              inputName=tmp1[j++];   
              inputValue=tmp1[j];             
    		  for(var z=0;z<elements.length;z++){
    		    if(elements[z].name == inputName){
    		         elements[z].value=inputValue;
    		    }
    		  }
     	}	  
    }		
	}	
	window.close();
}



function goPage(page){
	with(document.cscform){
		__goPage.value=page;
		submit();
	}
}

function setOrderby(){
//	alert("setOrderby");
alert("B");
	with(document.cscform){
		//alert("listOrder.value ==  "+__listOrder.options[__listOrder.selectedIndex].value);
		__orderBy.value=__listOrder.options[__listOrder.selectedIndex].value;
		submit();
	}
}

function setSearchby(){
	//	alert("setSearchby");
	with(document.cscform){
		__goPage.value="1";
		//__searchBy.value=__searchOrder.options[__searchOrder.selectedIndex].value;
		alert(__searchBy.options[__searchBy.selectedIndex].value);
		alert("value"+__valueSearch.value);
		if (__valueSearch.value == "")	{
			alert("กรุณาใส่ค่าในการค้นหา");
		} else {
				alert("__valueSearch.value = "+__valueSearch.value);
				submit();
			}
	}
}

function ckreport(){
	with(document.cscform){
		action="filereport.jsp";
		submit();
	}
}

function cmdrp(){
		with(document.cscform){
		__cmd.value="pdf";
	//	alert(__cmd.value+"  "+__screen.value);
     	action="filereport.jsp";
		submit();
	}
}

function linkStartup(page){
	with(document.cscform){
     	action=page+".jsp";
		submit();
	}
}

function goBookPage(page){
	with(document.cscform){
		__goPage.value=page;
//		alert(__goPage.value);
     	action="show_help.jsp";
		submit();
	}
}

function linkPage(page){
	with(document.cscform){
	  	action=page+".jsp";
		submit();
	}
}

function viewPayment(pymt) {
	with(document.cscform) {
		__cmd.value="search";
		__pwsalatype.value=pymt;
		//alert("pwsalatype = "+__pwsalatype);
		action=__screen.value+".jsp";
		submit();
	}
}

function  showtime(){
	with(document.cscform){
		__timework.value="go";
		__cmd.value="ack";
		//action="http://192.100.1.129:8080/cscupload/jsp/pwcscupload01.jsp";
		submit();
	}
}

function setstatus(status) {
	with(document.cscform) {
		__cmd.value="save";
		__pwstatus.value=status;
		alert("pwstatus.value = "+__pwstatus.value);
		action=__backpage.value+".jsp";
		submit();
	}
}

function cancel(){
	with(document.cscform){
		reset();
	}
}

function editotsingle(record){
	with(document.cscform){
	     action="pwotsingle_edit.jsp?__pwot0="+record;
		submit();
	}
}

function gopwotgroup2(){
	with(document.cscform){
	     action="pwotgroup2"+".jsp?__headMulti="+__screen.value;
		submit();
	}
}

function gopwotgroup1(){
	with(document.cscform){
	     action=__headMulti.value+".jsp";
		submit();
	}
}
function backpage(){
	with(document.cscform){
	     action=__backpage.value+".jsp";
		submit();
	}
}

function gopwdoctran(pwdoctran,pwdoctype,pwstep){
	with(document.cscform){
	     action=__childMulti.value+".jsp?__pwdoctran="+pwdoctran+"&__pwdoctype="+pwdoctype+"&__pwstep="+pwstep;
		submit();
	}
}



function send(){
	with(document.cscform){
		__pwsend.value ="1";
		__cmd.value="save";

//	     action="http://192.100.1.129:8080/aromatic/jsp/"+__screen.value+".jsp";
		submit();
	}
}
function   changeactor(pwemployee){
	with(document.cscform){
	     action=__screen.value+".jsp?__actor="+pwemployee;
		submit();
	}
}

function genTime(){
	timecode="";
	with(document.cscform){
		__cmd.value="ack";
		if(__timeGroup.value>0){
		for(i =1 ;i<=__timeGroup.value;i++){
			temp=document.cscform['__time'+i];
			if(temp.checked){
				timecode=timecode+temp.value+",";
			}
		}
	     action=__screen.value+".jsp?__genTime=genTime&__timecode="+timecode;
		submit();
	}
	}
}

function next(screen){
	with(document.cscform){
		__cmd.value="ack";
		action=screen+".jsp";
		submit();
	}
}

function backpage1(screen){
	with(document.cscform){
	     action=screen+".jsp";
		submit();
	}
}
function logout(){
	with(document.cscform){
	     action="logout"+".jsp?__logout=ok";
		submit();
	}
}

function admin_logout(){
	with(document.cscform){
		target = "_top";
	    action="admin_logout"+".jsp?__logout=ok";
		submit();
	}
}

function hilightOn(row){
    row.setAttribute('bgcolor','#99FF99',0);
}

function hilightOff(row){
    row.setAttribute('bgcolor','#FFFFFF',0);
}

function setAction(page,cmd){
		with(document.cscform){
			    action= page +".jsp?__cmd=" + cmd;
		}
}

//------------------------------------------------------------------------
// wut edit 15/09/03
//------------------ tooltip -------------------------------------------
var ns4 = document.layers;
var ns6 = document.getElementById && !document.all;
var ie4 = document.all;
offsetX = 5;
offsetY = 5;
var toolTipSTYLE="";
function initToolTips()
{
  if(ns4||ns6||ie4)
  {
    if(ns4) toolTipSTYLE = document.toolTipLayer;
    else if(ns6) toolTipSTYLE = document.getElementById("toolTipLayer").style;
    else if(ie4) toolTipSTYLE = document.all.toolTipLayer.style;
    if(ns4) document.captureEvents(Event.MOUSEMOVE);
    else
    {
      toolTipSTYLE.visibility = "visible";
      toolTipSTYLE.display = "none";
    }
    document.onmousemove = moveToMouseLoc;
  }
}
function toolTip(msg)
{
	
  if(toolTip.arguments.length < 1) // hide
  {
    if(ns4) toolTipSTYLE.visibility = "hidden";
    else toolTipSTYLE.display = "none";
  }
  else // show
  {
 
	var tableWidth=msg.length+10;
	var content ="<table border='1' class=\"toolTip\"><tr><td>&nbsp;&nbsp;"+ msg+"&nbsp;&nbsp;</td></tr></table>";
    if(ns4)
    {
      toolTipSTYLE.document.write(content);
      toolTipSTYLE.document.close();
      toolTipSTYLE.visibility = "visible";
    }
    if(ns6)
    {
      document.getElementById("toolTipLayer").innerHTML = content;
      toolTipSTYLE.display='block'
    }
    if(ie4)
    {
      document.all("toolTipLayer").innerHTML=content;
       setTimeout("toolTip()",2000);
      toolTipSTYLE.display='block'
    }
  }
}
function xxx(){
			  document.all("toolTipLayer").innerHTML="";
}
function moveToMouseLoc(e)
{
  if(ns4||ns6)
  {
    x = e.pageX;
    y = e.pageY;
  }
  else
  {
    x = event.x + document.body.scrollLeft;
    y = event.y + document.body.scrollTop;
  }
  toolTipSTYLE.left = x + offsetX;
  toolTipSTYLE.top = y + offsetY;
  return true;
}
//SORT TABLE------------------------------------------
<!-- Begin
function setDataType(cValue)
  {
    var isDate = new Date(cValue);
    if (isDate == "NaN")
      {
        if (isNaN(cValue))
          {
            cValue = cValue.toUpperCase();
            return cValue;
          }
        else
          {
            var myNum;
            myNum = String.fromCharCode(48 + cValue.length) + cValue;
            return myNum;
          }
        }
  else
      {
        var myDate = new String();
        myDate = isDate.getFullYear() + " " ;
        myDate = myDate + isDate.getMonth() + " ";
        myDate = myDate + isDate.getDate(); + " ";
        myDate = myDate + isDate.getHours(); + " ";
        myDate = myDate + isDate.getMinutes(); + " ";
        myDate = myDate + isDate.getSeconds();
        //myDate = String.fromCharCode(48 + myDate.length) + myDate;
        return myDate ;
      }
  }
function sortTable(col, tableToSort)
  {
	  
    var iCurCell = col + tableToSort.cols;
    var totalRows = tableToSort.rows.length;
    var bSort = 0;
    var colArray = new Array();
    var oldIndex = new Array();
    var indexArray = new Array();
    var bArray = new Array();
    var newRow;
    var newCell;
    var i;
    var c;
    var j;
    for (i=1; i < tableToSort.rows.length; i++)
      {
        colArray[i - 1] = setDataType(tableToSort.cells(iCurCell).innerText);
        iCurCell = iCurCell + tableToSort.cols;
      }
    for (i=0; i < colArray.length; i++)
      {
        bArray[i] = colArray[i];
      }
    colArray.sort();
    for (i=0; i < colArray.length; i++)
      { 
        indexArray[i] = (i+1);
        for(j=0; j < bArray.length; j++)
          { 
            if (colArray[i] == bArray[j])
              {  
                for (c=0; c<i; c++)
                  {
                    if ( oldIndex[c] == (j+1) )
                    {
                      bSort = 1;
                    }
                      }
                      if (bSort == 0)
                        {
                          oldIndex[i] = (j+1);
                        }
                          bSort = 0;
                        }
          }
    }
  for (i=0; i<oldIndex.length; i++)
    {
      newRow = tableToSort.insertRow();
      for (c=0; c<tableToSort.cols; c++)
        {
          newCell = newRow.insertCell();
          newCell.innerHTML = tableToSort.rows(oldIndex[i]).cells(c).innerHTML;
        }
      }
  for (i=1; i<totalRows; i++)
    {
      tableToSort.moveRow((tableToSort.rows.length -1),1);
    }
  for (i=1; i<totalRows; i++)
    {
      tableToSort.deleteRow();
    }
  }
  

	function checkAll(){
		with(document.cscform){
			for(i=0;i<elements.length;i++){
					if(elements[i].type=="checkbox")
							elements[i].checked=true;
			}//end for
		}//end with
	}//end function
	function decheckAll(){
		with(document.cscform){
			for(i=0;i<elements.length;i++){
					if(elements[i].type=="checkbox")
							elements[i].checked=false;
			}//end for
		}//end with
	}//end function
	
	//------------------------------ cscform null check ---------------------------------------------->
function  nullField(idx){
 with(document.cscform){
		var fieldName = new Array();
		var returnV=false;
		if(__notNull.value != ""){fieldName= __notNull.value.split(",");}
	  }
	    for(i=0;i<fieldName.length;i++){
			    tempValue="__"+fieldName[i];
				if(tempValue ==document.cscform.elements[idx].name){
					     returnV=true;					
		   	        }
		}
    return returnV;
}
function nullCheck(){
	for (var i=0;i<document.cscform.length;i++){
			if(nullField(i)){
				if((document.cscform.elements[i].value==null)||(document.cscform.elements[i].value=="")){
		             alert(MyCode[0]+document.cscform.elements[i].name);  
					 document.cscform.elements[i].focus();
					 return false;
 	                }
		//	}
		}//else{
			
  //}
  }
  return true;
}
//------------------------------ cscform NULL check ----------------------------------------------->

//-------------------------------- My Date ------------------------------------------------------------>
function MyDate(lang){
		NDate = new Date(); 
		var thday = new Array ("อาทิตย์","จันทร์","อังคาร","พุธ","พฤหัส","ศุกร์","เสาร์"); 
		var engDay=new Array("Sunday","Monday","Tueday","Wedesday","Thurday","Friday","Saturday");
		var thmonth = new Array ("มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม"); 
		var engMonth=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
		var thDate=thday[NDate.getDay()]+", "+NDate.getDate()+" "+thmonth[NDate.getMonth()]+" "+(NDate.getYear()+543);
		var engDate=engDay[NDate.getDay()]+", "+NDate.getDate()+" "+engMonth[NDate.getMonth()]+" "+(NDate.getYear()+543);
		var result=""
			if(lang=="tha"){
					result=thDate;
				}else{
					result=engDate;
				}
				document.write(result);
}
function Logout(logPage){
with(document.cscform){
       bCon=confirm("ต้องการออกจากระบบ ?");
      if (bCon==true)	{
				action=logPage;
		  		submit();
       }
	}		
}
// create by wut 10/30/2003
function printEditCheck(editBy,editDate,editTime,verifyBy){
  returnValue="";
  if(editBy !=""){
	  returnValue= editBy +"_"+" : "+editDate+" : "+editTime;
	  if(verifyBy != ""){
	    returnValue= returnValue+" :: "+verifyBy;
	  }
	}
	document.write(returnValue+" ");
}
//pae crate 10/11/2003
	//Code >>>>>>> 46=. 48=0 49=1 50=2 51=3 52=4 53=5 54=6 55=7 56=8 57=9
	function chkInteger(){
		if ((window.event.keyCode < 48) || (window.event.keyCode > 57))
			window.event.returnValue = false;
	}

	function chkBigDecimal(){
		if ( ((window.event.keyCode != 46) && (window.event.keyCode < 48)) || (window.event.keyCode > 57))			
		     window.event.returnValue = false;
	}

	//pas create 2/2/2547
	function chkBigDecimal(obj){
		var count=0;
		if ( ((window.event.keyCode != 46) && (window.event.keyCode < 48)) || (window.event.keyCode > 57))	
			window.event.returnValue = false;	
			for(k=0;k<obj.value.length;k++){
		         if(obj.value.charAt(k)=="."){
					          count++;
					 }
			}
			if(window.event.keyCode == 46) {
			         count++;
			}
			if(count>1){
				if(window.event.keyCode == 46) {
       				window.event.returnValue = false;	
			      }
				 alert(MyCode[41]);
			}			
	}