var allowsave = true;
var novalidate = false;
/*---------- this is a addition method the valite the filesize before upload , added by kongxiong ==========*/
$.validator.addMethod('filesize', function(value, element, param) {
    // param = size (en bytes) 
    // element = element to validate (<input>)
    // value = value of the element (file name)
    return this.optional(element) || (element.files[0].size <= param) 
});
/*------- end addition method -------*/
$(function(){
	$("#confirmpwd").blur(chPass);
	$(".old_password").blur(Auto_md5_pwd);
	/*---------------------------------- Validate change pass -----------------------------------*/
	$("#frmChangepass").validate({
    	rules: {
            "old_password[]": {required: true},
            "h_input_old_password[]": {equalTo: ".h_old_password"},
            "new_password[]": {required: true, minlength: 6},
            "confirm_pass[]": {required: true, equalTo: ".new_password"},
			
    	},
    	
    	messages: {
			
			"old_password[]": {required: "</label><span class = 'req_err' style=\"display:inline;\">ກະລຸນາ ປ້ອນລະຫັດຜ່ານເກົ່າກ່ອນ !</span><label>",
			},
			"h_input_old_password[]": {
				equalTo: "</label><span class = 'req_err' style=\"display:inline;\">ປ້ອນລະຫັດຜ່ານເກົ່າບໍ່ຖືກຕ້ອງ !</span><label>",
			},
			"new_password[]": {required: "</label><span class = 'req_err' style=\"display:inline;\">ກະລຸນາ ປ້ອນລະຫັດຜ່ານໃໝ່ກ່ອນ !</span><label>",
				minlength: "</label><span class = 'req_err' style=\"display:inline;\">ຢ່າງໜ້ອຍ 6 ອັກສອນ !</span><label>",
			},
			"confirm_pass[]": {required: "</label><span class = 'req_err' style=\"display:inline;\">ກະລຸນາ ຢືນຢັນລະຫັດຜ່ານກ່ອນ !</span><label>",
				equalTo: "</label><span class = 'req_err' style=\"display:inline;\">ຢືນຢັນລະຫັດຜ່ານບໍ່ຖືກຕ້ອງ !</span><label>",
			},
						
    	}
    });
	/*-------------- validation the form  organization unit ==> orgunit*/
	 $("#frmorgunit").validate({
    	rules: {
        	/*--------------------- enter in master info -------------*/
			"orgname_la[]": {required: true},
			"parentid[]": {required: true},
            "unittype[]": {required: true},
    	},
    	
    	messages: {
			
    	   	/*-------------- the table enter master info -------------*/
			"orgname_la[]": {required: "</label><span class = 'req_err' style=\"display:inline;\">ກະລຸນາປ້ອນຊື່ກ່ອນ !</span><label>",
			},
			"parentid[]": {required: "</label><span class = 'req_err' style=\"display:inline;\">ກະລຸນາເລືອກຫົວໜ້າກ່ອນ !</span><label>",
			},
			"unittype[]": {required: "</label><span class = 'req_err' style=\"display:inline;\">ກະລຸນາເລືອກທີ່ສັງກັດຢູ່ກ່ອນ !</span><label>",
			},				
    	}
    });
	/*-------------- validation the form   ------------------*/
	 $("#frmorgunit").validate({
    	rules: {
        	/*--------------------- enter in  info -------------*/
			"orgname_la[]": {required: true},
			"parentid[]": {required: true},
            "unittype[]": {required: true},
    	},
    	
    	messages: {
			
    	   	/*-------------- the table enter info -------------*/
			"orgname_la[]": {required: "</label><span class = 'req_err' style=\"display:inline;\">ກະລຸນາປ້ອນຊື່ກ່ອນ !</span><label>",
			},
			"parentid[]": {required: "</label><span class = 'req_err' style=\"display:inline;\">ກະລຸນາເລືອກຫົວໜ້າກ່ອນ !</span><label>",
			},
			"unittype[]": {required: "</label><span class = 'req_err' style=\"display:inline;\">ກະລຸນາເລືອກທີ່ສັງກັດຢູ່ກ່ອນ !</span><label>",
			},				
    	}
    });
	/*-------------- validation the form  create system user ------------------*/
	 $("#frmadduser").validate({
    	rules: {
        	/*--------------------- enter in  info -------------*/
			"emp_id": {required: true},
			//"isactive": {required: true},
            "username": {required: true},
            "password": {required: true},
            "confirmpwd": {required: true},
            "emp_code": {required: true},
    	},
    	
    	messages: {
			
    	   	/*-------------- the table enter info -------------*/
			"orgname_la[]": {required: "</label><span class = 'req_err' style=\"display:inline;\">ກະລຸນາປ້ອນຊື່ກ່ອນ !</span><label>",
			},
			"parentid[]": {required: "</label><span class = 'req_err' style=\"display:inline;\">ກະລຸນາເລືອກຫົວໜ້າກ່ອນ !</span><label>",
			},
			"unittype[]": {required: "</label><span class = 'req_err' style=\"display:inline;\">ກະລຸນາເລືອກທີ່ສັງກັດຢູ່ກ່ອນ !</span><label>",
			},				
    	}
    });
		/*-------------- validation the form  create system user ------------------*/
	 $("#frmuser").validate({
    	rules: {
        	/*--------------------- enter in  info -------------*/
			"username_form[]": {required: true},
			//"isactive": {required: true},
            "first_name_form[]": {required: true},
            "orgunitid[]": {required: true},
            "role_id_form[]": {required: true},
    	},
    	
    	messages: {
			
    	   	/*-------------- the table enter info -------------*/
			"username_form[]": {required: "</label><span class = 'req_err' style=\"display:inline;\">ປ້ອນຊື່ເຂົ້າໃຊ້ລະບົບກ່ອນ !</span><label>",
			},
			"first_name_form[]": {required: "</label><span class = 'req_err' style=\"display:inline;\">ກະລຸນາຊື່ກ່ອນ !</span><label>",
			},
			"orgunitid[]": {required: "</label><span class = 'req_err' style=\"display:inline;\">ເລືອກພະແນກ/ສາຂາກ່ອນ !</span><label>",
			},	
			"role_id_form[]": {required: "</label><span class = 'req_err' style=\"display:inline;\">ກະລຸນາເລືອກສິດເຂົ້າໃຊ້ກ່ອນ !</span><label>",
			},			
    	}
    });
	/*-------------- validation the form docin in DOcument system ------------------*/
	
	 $("#frm_add_docin").validate({
    	rules: {
			/* "doc_code": {required: true}, */
            "doc_date": {required: true},
            "doctype": {required: true},
            "io_type": {required: true},
            "doc_from": {required: true},
            "doc_title": {required: true},
            "signer": {required: true},
            "doc_to": {required: true},
            "type_out": {required: true},
            "doc_file": {
					 extension: "xls|xlsx|doc|docx|ppt|pptx|csv|pdf",
					 filesize: 29360128  // this equal to 28 MB limit size , example: filesize <= 29360128/1024/1024=28 || 1048576 = 1MB
			},
            "orgunitid[]": {required: true,
				minlength: 1 },
			"refer_file": {
					 extension: "xls|xlsx|doc|docx|ppt|pptx|csv|pdf",
					 filesize: 29360128  // this equal to 28 MB limit size , example: filesize <= 29360128/1024/1024=28 || 1048576 = 1MB
			},
    	},
    	
    	messages: {
			/* "doc_code": {required: "</label><span class = 'req_err' style=\"display:inline;\">ປ້ອນເລກທີເອກະສານກ່ອນ !</span><label>",
			}, */
			"doc_date": {required: "</label><span class = 'req_err' style=\"display:inline;\">ກະລຸນາປ້ອນວັນທີກ່ອນ !</span><label>",
			},
			"doctype": {required: "</label><span class = 'req_err' style=\"display:inline;\">ກະລຸນາເລືອກປະເພດກ່ອນ !</span><label>",
			},
			"io_type": {required: "</label><span class = 'req_err' style=\"display:inline;\">ກະລຸນາເລືອກປະເພດເຂົ້າ !</span><label>",
			},
			"doc_from": {required: "</label><span class = 'req_err' style=\"display:inline;\">ກະລຸນາປ້ອນຂໍ້ມູນກ່ອນ !</span><label>",
			},
			"doc_title": {required: "</label><span class = 'req_err' style=\"display:inline;\">ປ້ອນເລື່ອງ ຫຼື ຫົວຂໍ້ກ່ອນ !</span><label>",
			},
			"doc_file": {
					extension: "</label><span class = 'req_err' style=\"display:inline;\">ຕ້ອງເປັນໄຟລ໌ເອກະສານເທົ່ານັ້ນ !</span><label>",
					filesize: "</label><span class = 'req_err' style=\"display:inline;\">ຂະໜາດໄຟລ໌ຕ້ອງໜ້ອຍກວ່າ 28 MB !</span><label>",
			},
			"signer": {required: "</label><span class = 'req_err' style=\"display:inline;\">ເລືອກຊື່ຜູ້ເຊັນເອກະສານກ່ອນ</span><label>",
			},
			"type_out": {required: "</label><span class = 'req_err' style=\"display:inline;\">ເລືອກປະເພດຂາອອກ</span><label>",
			},
			"doc_to": {required: "</label><span class = 'req_err' style=\"display:inline;\">ປ້ອນຜູ້ຮັບເອກະສານກ່ອນ !</span><label>",
			},
			"orgunitid[]": {required: "</label><span class = 'req_err' style=\"display:inline;\">ເລືອກຢ່າງໜ້ອຍ 1 ພະແນກ/ສາຂາ</span><label>",
			},
			"refer_file": {
					extension: "</label><span class = 'req_err' style=\"display:inline;\">ຕ້ອງເປັນໄຟລ໌ເອກະສານເທົ່ານັ້ນ !</span><label>",
					filesize: "</label><span class = 'req_err' style=\"display:inline;\">ຂະໜາດໄຟລ໌ຕ້ອງໜ້ອຍກວ່າ 28 MB !</span><label>",
			},
			
							
    	}
    });
	
		/*-------------- validation the form assign DOcument ------------------*/
	
	 $("#frm_assign").validate({
    	rules: {
			
            "orgunitid[]": {required: true,
				minlength: 1 },
	
    	},
    	
    	messages: {
		
			"orgunitid[]": {required: "</label><span class = 'req_err' style=\"display:inline;\">ເລືອກຢ່າງໜ້ອຍ 1 ຄົນ</span><label>",
			},
    	}
    });
	/*====================================================================== in PLANNING system =====================================================*/
	/*-------------- validation the form v_workflowdetail in PLANNING system ------------------*/
	 $("#frmdetail_head").validate({
    	rules: {
			"detail_date[]": {required: true},
            "detail_text[]": {required: true},
			"comment_date[]": {required: true},
            "comment_text[]": {required: true},
    	},
    	
    	messages: {
			"detail_date[]": {required: "</label><span class = 'req_err' style=\"display:inline;\">ປ້ອນວັນທີກ່ອນ !</span><label>",
			},
			"detail_text[]": {required: "</label><span class = 'req_err' style=\"display:inline;\">ກະລຸນາປ້ອນຄວາມຄືບໜ້າ !</span><label>",
			},
			"comment_date[]": {required: "</label><span class = 'req_err' style=\"display:inline;\">ປ້ອນວັນທີກ່ອນ !</span><label>",
			},
			"comment_text[]": {required: "</label><span class = 'req_err' style=\"display:inline;\">ກະລຸນາໃຫ້ທິດທາງກ່ອນ !</span><label>",
			},
    	}
    });
	/*-------------- validation the form v_workflowdetail ,reply form in PLANNING system ------------------*/
	 $("#frmreply").validate({
    	rules: {
			"reply_text": {required: true},
			"file_name": {
					 filesize: 29360128  // this equal to 28 MB limit size , example: filesize <= 29360128/1024/1024=28 || 1048576 = 1MB
			},
    	},
    	
    	messages: {
			"reply_text": {required: "</label><span class = 'req_err' style=\"display:inline;\">ກະລູນາປ້ອນຂໍ້ຄວາມກ່ອນ !</span><label>",
			},
			"file_name": {
					filesize: "</label><span class = 'req_err' style=\"display:inline;\">ຂະໜາດໄຟລ໌ຕ້ອງໜ້ອຍກວ່າ 28 MB !</span><label>",
			},
			
    	}
    });
	/*-------------- validation the form v_addwork, in PLANNING system ------------------*/
	 $("#frmaddwork").validate({
    	rules: {
			"titlework": {required: true},
			"status": {required: true},
			"section[]": { 
                    required: true, 
                    minlength: 1 
            } 
    	},
    	
    	messages: {
			"titlework": {required: "</label><span class = 'req_err' style=\"display:inline;\">ກະລຸນາປ້ອນຫົວຂໍ້ວຽກກ່ອນ !</span><label>",
			},
			"status": {required: "<span class = '' style=\"display:inline;\">ກະລຸນາເລືອກສະຖານະກ່ອນ</span>",
			},
			"section[]": {required: "</label><span class = 'req_err' style=\"display:inline;\">ຢ່າງໜ້ອຍເລືອກ 1 ພາກສ່ວນ</span><label>",
			},
    	}
    });
	
	/* ----- validate webmaster form staff ----*/
	/*-------------- validation the form v_addwork, in PLANNING system ------------------*/
	 $("#frmstaff").validate({
    	rules: {
			"emp_code": {required: true, number: true},
			"orgunitid": {required: true},
			"name": {required: true},
			"name_eng": {required: true},
			"surname": {required: true},
			"surname_eng": {required: true},
			"status": {required: true},
			"sex": {required: true},
			"position": {required: true},
			"email_address": {required: true},
			"tel": {required: true}
    	},
    	
    	messages: {
			"emp_code": {required: "<br><span class = '' style=\"display:inline;\">ກະລຸນາປ້ອນລະຫັດພະນັກງານກ່ອນ</span>",
				number: "<br><span class = '' style=\"display:inline;\">ລະຫັດພະນັກງານຕ້ອງເປັນຕົວເລກເທົ່ານັ້ນ</span>",
			},
			"orgunitid": {required: "<br><span class = '' style=\"display:inline;\">ກະລຸນາເລືອກສັງກັດຢູ່</span>",
			},
			"name": {required: "<br><span class = '' style=\"display:inline;\">ກະລຸນາປ້ອນຊື່ກ່ອນ</span>",
			},
			"name_eng": {required: "<br><span class = '' style=\"display:inline;\">ກະລຸນາປ້ອນຊື່ກ່ອນ</span>",
			},
			"surname": {required: "<br><span class = '' style=\"display:inline;\">ກະລຸນາປ້ອນນາມສະກຸນກ່ອນ</span>",
			},
			"surname_eng": {required: "<br><span class = '' style=\"display:inline;\">ກະລຸນາປ້ອນນາມສະກຸນກ່ອນ</span>",
			},
			"status": {required: "<br><span class = '' style=\"display:inline;\">ກະລຸນາເລືອກສະຖານະກ່ອນ</span>",
			},
			"sex": {required: "<br><span class = '' style=\"display:inline;\">ກະລຸນາເລືອກເພດກ່ອນ</span>",
			},
			"position": {required: "<br><span class = '' style=\"display:inline;\">ກະລຸນາເລືອກຕໍາແໜ່ງກ່ອນ</span>",
			},
			"email_address": {required: "<br><span class = '' style=\"display:inline;\">ກະລຸນາປ້ອນ Email ກ່ອນ</span>",
			},
			"tel": {required: "<br><span class = '' style=\"display:inline;\">ກະລຸນາປ້ອນເບີໂທກ່ອນ</span>",
			},
    	}
    });
	/*=============== form add new presentation ====================*/
	$("#frmaddpresent").validate({
    	rules: {
            "titlepre": {required: true},
            "prename": {required: true},
            "file_name": {required: true},
            "pre_date": {required: true},
			
    	},
    	
    	messages: {
			
			"titlepre": {required: "</label><span class = 'req_err' style=\"display:inline;\">ກະລຸນາ ປ້ອນຫົວຂໍ້ກ່ອນ !</span><label>"},
			"prename": {required: "</label><span class = 'req_err' style=\"display:inline;\">ກະລຸນາ ປ້ອນຊື່ຜູ້ນໍາສະເໜີ !</span><label>"},
			"file_name": {required: "</label><span class = 'req_err' style=\"display:inline;\">ກະລຸນາ ເລືອກໄຟລ໌ກ່ອນ !</span><label>"},
			"pre_date": {required: "</label><span class = 'req_err' style=\"display:inline;\">ກະລຸນາ ເລືອກວັນທີ !</span><label>"},
			
    	}
    });
	
	/*=============== form add poeple to agenda IN REMINDER SYSTEM  ADDED BY KONGXIONG ====================*/
	/*=============== form add poeple to agenda  ====================*/
	/*=============== form add poeple to agenda  ====================*/
	$("#frmManage_a").validate({
    	rules: {
            "name[]": {required: true},
            "email[]": {required: true},
			
    	},
    	
    	messages: {
			
			"name[]": {required: "</label><span class = 'req_err' style=\"display:inline;\">ກະລຸນາ ປ້ອນຊື່ກ່ອນ !</span><label>"},
			"email[]": {required: "</label><span class = 'req_err' style=\"display:inline;\">ກະລຸນາ ປ້ອນ Email !</span><label>"},
			
    	}
    });
	
	
	
})
$('#doc_file').change(function() {
            alert('This file size is: ' + this.files[0].size/1024/1024 + "MB");
     });
/*---------------- check confirm password ------------*/
function chPass(){
	var pwd = document.getElementById("password").value;
	var confpwd = document.getElementById("confirmpwd").value;
	if(confpwd != pwd){
		alert("ທ່ານຢືນຢັນລະຫັດຜ່ານທບໍ່ຖືກຕ້ອງ");
		//document.forms.frmadduser.confirmpwd.focus();
		
	}
}
/*----------------------*/
function chCode(){
	var code = this;
	var emp_id = document.getElementById("emp_id").value;
	$.get("manage/list_code.php", { "emp_id": emp_id}, function(data){
		
		if (data != null){
			// alert(data);
			document.getElementById("emp_code").value = data;			
				//$(code).closest("table").find(".emp_code").val(data);
				//$(code).closest("td").find(".qtyerr").show();
								
			
		}
	});
	
}
/*------- used when change pwd ------------*/
function Auto_md5_pwd(){	
	var cal = this;
	/*---get user id --*/				
	var old_pwd = $(this).closest("tr").find(".old_password").val();
	if(old_pwd != ""){
		//alert('start'+ serial_start + '+ serial_end' + serial_end);
		$.get("lib/list_md5_pwd.php", {"old_pwd": old_pwd}, function(data){
			if (data != null){
				// var newamount = new Number(serial_end.value);
				$(cal).closest("tr").find(".h_input_old_password").val(data);
			}
		})
	}
}
function rechpwd(){
	var old_pass = document.getElementById("h_old_password").value;
	var old_input_pass = document.getElementById("h_input_old_password").value;
	if(old_input_pass != old_pass){
		alert('ລະຫັດຜ່ານເກົ່າທ່ານປ້ອນບໍ່ຖຶກຕ້ອງ');
		return false;
	}
}

/*================================= ALL FUNCTION VALIDATE IN REMINDER SYSTEM ADDED BY KONG =====================================*/
/*================================= ALL FUNCTION VALIDATE IN REMINDER SYSTEM ADDED BY KONG =====================================*/
/*------------------------------ mask ---------------------------*/

/*------------------------------------------------------------- validation the item that already selected ---*/
function validateVtierDD(src, Lines){
	var flag = false;
	var counter = 0;
	for(var ch=1 ; ch<=Lines; ch++){
		var vtierDD = document.getElementsByName("txtoperator"+ch);
	
		if(src.value!=-1 && vtierDD && vtierDD.length > 0){
			for(var i=0; i < vtierDD.length; i++){
				if(src.value == vtierDD[i].value){
					counter++;
					if(counter>1)break;
				}
			}
		} 	
	}
	if(counter>1){
		alert(src.options[src.selectedIndex].text + "  is already selected.");
		src.value="-1";
		return false;
	}else{
		return true;
	}	
}

function doCheck(src, Lines) {
	
	if(validateVtierDD(src, Lines)){

	}
}
/*------------------------------------------------------------ validate input--------------------------*/
function CheckValue() 
{
	var act = CheckAct();  
	var detail	= CheckDetail(); 
	var date1 = CheckDate1();  
	var date2 = CheckDate2();  
	var rname = CheckRname();  
	var type = CheckType();  
	if (act && detail && date1 && date2 && rname && type) {	
		return true;
	} else { 
		return false;
		
	}
}
function CheckAct(){
	var act = document.getElementById('activity');
	if (act.value == '') {
		document.getElementById('erract').innerHTML = "<span class='errChk' >&#3713;&#3760;&#3749;&#3768;&#3737;&#3762;&#3739;&#3785;&#3757;&#3737;&#3713;&#3764;&#3732;&#3720;&#3760;&#3713;&#3763;&#3713;&#3757;&#3719;&#3739;&#3760;&#3722;&#3768;&#3745;&#3713;&#3784;&#3757;&#3737;...!</span>";		
		act.focus();		
		return false;
	} else {
		document.getElementById('erract').innerHTML = "";		
		return true;
	}
}
function CheckDetail(){
	var detail = document.getElementById('detail');
	if (detail.value == '') {
		document.getElementById('errdetail').innerHTML = "<span class='errChk' >&#3713;&#3760;&#3749;&#3768;&#3737;&#3762;&#3739;&#3785;&#3757;&#3737;&#3749;&#3762;&#3725;&#3749;&#3760;&#3757;&#3773;&#3732;&#3713;&#3757;&#3719;&#3739;&#3760;&#3722;&#3768;&#3745;&#3713;&#3784;&#3757;&#3737;...!</span>";		
		detail.focus();		
		return false;
	} else {
		document.getElementById('errdetail').innerHTML = "";		
		return true;
	}
}
function CheckDate1(){
	var date1 = document.getElementById('datetime');
	if (date1.value == '') {
		document.getElementById('errdate1').innerHTML = "<span class='errChk' >&#3713;&#3760;&#3749;&#3768;&#3737;&#3762;&#3739;&#3785;&#3757;&#3737;&#3745;&#3767;&#3785;&#3776;&#3749;&#3765;&#3784;&#3745;...!</span>";		
		date1.focus();		
		return false;
	} else {
		document.getElementById('errdate1').innerHTML = "";		
		return true;
	}
}
function CheckDate2(){
	var date2 = document.getElementById('datetime2');
	if (date2.value == '') {
		document.getElementById('errdate2').innerHTML = "<span class='errChk' >&#3713;&#3760;&#3749;&#3768;&#3737;&#3762;&#3739;&#3785;&#3757;&#3737;&#3745;&#3767;&#3785;&#3754;&#3764;&#3785;&#3737;&#3754;&#3768;&#3732;...!</span>";		
		date2.focus();		
		return false;
	} else {
		document.getElementById('errdate2').innerHTML = "";		
		return true;
	}
}
function CheckRname(){
	var rname = document.getElementById('rname');
	if (rname.value == '') {
		document.getElementById('errrname').innerHTML = "<span class='errChk' >&#3713;&#3760;&#3749;&#3768;&#3737;&#3762;&#3776;&#3749;&#3767;&#3757;&#3713;&#3755;&#3785;&#3757;&#3719;&#3739;&#3760;&#3722;&#3768;&#3745;&#3713;&#3784;&#3757;&#3737;...!</span>";		
		rname.focus();		
		return false;
	} else {
		document.getElementById('errrname').innerHTML = "";		
		return true;
	}
}
function CheckType(){
	var rname = document.getElementById('pres_id');
	if (rname.value == '') {
		document.getElementById('errtype').innerHTML = "<span class='errChk' >&#3713;&#3760;&#3749;&#3768;&#3737;&#3762;&#3776;&#3749;&#3767;&#3757;&#3713;&#3776;&#3720;&#3771;&#3785;&#3762;&#3742;&#3762;&#3738;&#3713;&#3784;&#3757;&#3737;...!</span>";		
		rname.focus();		
		return false;
	} else {
		document.getElementById('errtype').innerHTML = "";		
		return true;
	}
}
/*------------------------------- the old code ------------------------------*/
// function seleted menu 
function selected_m(Lines, m_id) 
{ 
  window.location = "manage.php?Lines="+Lines + "&m_id=" + m_id;
}
// function get lines of operator who will be sended Mail to
function jumpMenu(targ, selObj, restore) 
{ 
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex = 0;
}
function selected_o(Lines, m_id, o_id) 
{ 
	window.location = "manage.php?Lines="+Lines + "&m_id=" + m_id + "&o_id="+ o_id;
}
// Funtion Get Query from SELECT OPTION
function sendId(Lines, id) 
{
	//window.location = "manage.php?Lines="+Lines + "&id=" +id;
   eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex = 0;
}
function ch_other(getr, o_id) 
{ 
	window.location = ""+getr+"?d=other_rpt&id="+ o_id;
}
function ch_dept(getr, o_id) 
{ 
	window.location = ""+getr+"?d=dept_rpt&id="+ o_id;
}
function ch_sec(getr, o_id) 
{ 
	window.location = ""+getr+"?d=section_rpt&id="+ o_id;
}
function ch_emp(getr, o_id) 
{ 
	window.location = ""+getr+"?d=emp_rpt&id="+ o_id;
} 