function SelectionRoutine(chkbox, action) {	var mysele = chkbox;	var myact = action;	var selcnt;	var selrec;			selrec = "";	selcnt = 0; 	alert ("myact = " + myact);	if (mysele == undefined) {		alert("(0) checkbox on page.");	} else if (mysele.length == undefined) {//		alert("(1) checkbox.. on page" );		switch(myact) {			case 'SelAll':		 		mysele.checked = true;		 		break;			case 'DeSelAll':				mysele.checked = false;				break;			case 'Inverse':				if (mysele.checked == false) {					mysele.checked = true;				} else if (mysele.checked == true) {					mysele.checked = false;				}				break;		}			} else {		alert("(" + mysele.length + ") checkboxes on page");		for (i=0; i<mysele.length;i++){			switch(myact) {			case 'SelAll':		 		mysele(i).checked = true;		 		break;			case 'DeSelAll':				mysele(i).checked = false;				break;			case 'Inverse':				if (mysele(i).checked == false) {					mysele(i).checked = true;				} else if (mysele(i).checked == true) {					mysele(i).checked = false;				}				break;			}				}	}}//=================================================================function SelectedItem(chkbox) {	var mysele = chkbox;	var selcnt;	var selrec;			selrec = "";	selcnt = 0;	if (mysele == undefined) {		//alert("(0) checkbox on page.");	} else if (mysele.length == undefined) {		if (mysele.checked == true) {			selrec += mysele.value ;		}	} else {		for (i=0; i<mysele.length;i++){			if (mysele(i).checked == true) {				selrec += mysele(i).value + "," ;			}		}	}	return(selrec)}//===============================================================function getXMLHTTP() {		var xmlHttp = null;	try {		xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");	} catch(e) {		try {			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");		} catch(oc) {			xmlHttp = null;		}	}	if(!xmlHttp && typeof XMLHttpRequest != "undefined") {		xmlHttp = new XMLHttpRequest();	}	return xmlHttp;	}//===================================================function listboxOnChange(seleitems) {	var d = document;	var f = d.forms[0];	//var thisPath = f.ThisPath.value;	var thisPath = f.WebSystemPath.value;	var actions = f.OtherAction;	var actionName = actions.options[actions.selectedIndex].value;	switch(actionName) {		case "New" ://			var xmlHttp = getXMLHTTP();			var url = "/" + thisPath + "/" +"EmpData?OpenForm";			//			var url = "http://lion_dev/Apps/EmpDirKe.nsf/EmpData?OpenForm"			document.location.href = url;//			xmlHttp.open("POST", url);//			xmlHttp.send			break;		case "Delete":			var thisPath = f.WebSystemPath.value;			var url = "/" + thisPath + "/" +"ajxDeleteSelected" + "?OpenAgent";			var selectionList = SelectedItem(f.MySel);			if (selectionList == "") {				alert("You must select at least one document to delete.");			} else {				var go = confirm("Are you sure you want to delete the selected document?");				if (go) {					deleteDocs(selectionList, url);//					alert("Deleted")				}			}				break;		case "Good" :			var url = "/" + thisPath + "/" +"ajxSetPerformance" + "?OpenAgent&Performance=Good";			var selectionList = SelectedItem(f.MySel);			if (selectionList == "") {				alert("You must select at least one document for Performance update.");			} else {				var go = confirm("Are you sure you want to update the selected document?");				if (go) {					updperformance(selectionList, url);				}			}				break;		case "Bad" :			var url = "/" + thisPath + "/" +"ajxSetPerformance" + "?OpenAgent&Performance=Bad";			var selectionList = SelectedItem(f.MySel);			if (selectionList == "") {				alert("You must select at least one document for Performance update.");			} else {				var go = confirm("Are you sure you want to update the selected document?");				if (go) {					updperformance(selectionList, url);				}			}				break;		case 'Inverse':			if (mysele.checked == false) {				mysele.checked = true;			} else if (mysele.checked == true) {				mysele.checked = false;			}			break;	}	actions.selectedIndex = 0;}//=================================================function QueryObj(q) {	if(q.length > 1) this.q = q; //this.q = q.substring(1, q.length);		else this.q = null;	this.keyValuePairs = new Array();	if(q) {		for(var i=0; i < this.q.split("&").length; i++) {			this.keyValuePairs[i] = this.q.split("&")[i];		}	}	this.getKeyValuePairs = function() { return this.keyValuePairs; }	this.getValue = function(s) {		for(var j=0; j < this.keyValuePairs.length; j++) {			if(this.keyValuePairs[j].split("=")[0].toLowerCase() == s.toLowerCase())			return this.keyValuePairs[j].split("=")[1];		}		return "";	}	this.getParameters = function() {		var a = new Array(this.getLength());		for(var j=0; j < this.keyValuePairs.length; j++) {			a[j] = this.keyValuePairs[j].split("=")[0];		}		return a;	}	this.getLength = function() { return this.keyValuePairs.length; } }/************************** Validation Error Messages handling ******************************/function errorHandler(errorStr) {	var f = document.forms[0];	var queryObj = new QueryObj(errorStr);	var errFields = queryObj.getParameters();	var length = queryObj.getLength();	var errDiv;	for(var j=1; j < length; j++) {//		errDiv = document.getElementById("Err"+errFields[j]);		errDiv = document.getElementById("err"+errFields[j]);		errDiv.innerHTML = unescape(queryObj.getValue(errFields[j]));		errDiv.style.display = "block";	}}function removeErrors() {	var divs = document.getElementsByTagName("DIV");	for(var j=0; j < divs.length; j++) {		if (divs[j].id.indexOf('Err') == 0) {			divs[j].style.display = "none";		}	}}/************************** AJX Status Message handling ******************************/function writeStatusById(id, str, display, vTimer) {	var f = document.forms[0];	var obj = document.getElementById(id);		if (!(obj == undefined)) {		obj.innerHTML = str;		obj.style.display = display				if (vTimer > 0) {			setTimeout("removeStatusById('" + id + "')",vTimer * 1000);					}			}	}	function removeStatusById(id) {	var f = document.forms[0];	var obj = document.getElementById(id);	obj.innerHTML = "";	obj.style.display = "none";}//=======Date Field Validation==========================////=======Date Format Validation=========================//var dtCh= "/";var minYear=1900;var maxYear=2100;function isInteger(s){	var i;    for (i = 0; i < s.length; i++){           // Check that current character is number.        var c = s.charAt(i);        if (((c < "0") || (c > "9"))) return false;    }    // All characters are numbers.    return true;}function stripCharsInBag(s, bag){	var i;    var returnString = "";    // Search through string's characters one by one.    // If character is not in bag, append to returnString.    for (i = 0; i < s.length; i++){           var c = s.charAt(i);        if (bag.indexOf(c) == -1) returnString += c;    }    return returnString;}function daysInFebruary (year){	// February has 29 days in any year evenly divisible by four,    // EXCEPT for centurial years which are not also divisible by 400.    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );}function DaysArray(n) {	for (var i = 1; i <= n; i++) {		this[i] = 31		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}		if (i==2) {this[i] = 29}   }    return this}function isDate(dtStr,errorField,Underline){	var daysInMonth = DaysArray(12)	var pos1=dtStr.indexOf(dtCh)	var pos2=dtStr.indexOf(dtCh,pos1+1)	var strDay=dtStr.substring(0,pos1)	var strMonth=dtStr.substring(pos1+1,pos2)	var strYear=dtStr.substring(pos2+1)	strYr=strYear	if (dtStr.length==0)  {		writeStatusById(errorField,"Date cannot be blank.","inline", 8);		underline(Underline ,"''''''''''''''''''''''''''''''''''''''''");		errorOccured = true;		return false	} 	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)	for (var i = 1; i <= 3; i++) {		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)	}	month=parseInt(strMonth)	day=parseInt(strDay)	year=parseInt(strYr)	if (pos1==-1 || pos2==-1||pos1==1||pos2==1){		writeStatusById(errorField,"Date format should be dd/mm/yyyy.","inline", 8);		underline(Underline ,"''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''")		errorOccured = true;		return false	}		if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){		writeStatusById(errorField,"Please enter a valid day.","inline", 8);		underline(Underline ,"''''''''''''''''''''''''''''''''''''''''''''")		errorOccured = true;				return false	}	if (strMonth.length<1 || month<1 || month>12){		writeStatusById(errorField,"Please enter a valid month.","inline", 8);		underline(Underline ,"''''''''''''''''''''''''''''''''''''''''''''''''''")		errorOccured = true;		return false	}	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){		writeStatusById(errorField,"Please enter a valid 4 digit year between "+minYear+" and "+maxYear + ".","inline", 8);		underline(Underline ,"'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''")		errorOccured = true;		return false	}	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){		writeStatusById(errorField,"Please enter a valid date.","inline", 8);		underline(Underline ,"''''''''''''''''''''''''''''''''''''''''''''''")		errorOccured = true;		return false	}return true}function validate_date(field,errorField,Underline){with (field){	if (value != ""){	//var dt=document.frmSample.txtDate	if (isDate(value, errorField,Underline)==false){		//field.focus()		return false	}    return true } }}//======Numeric Validation=============================//function validate_numeric(field,ErrID,alerttxt, Underline, line){with (field){var strValidChars = "0123456789.-,";var strChar;var blnResult = true;if (value.length == 0) return true;if (value.length != 0) {for (i = 0; i < value.length && blnResult == true; i++)      {      strChar = value.charAt(i);      if (strValidChars.indexOf(strChar) == -1)         {         writeStatusById(ErrID,alerttxt,"inline",8);         underline(Underline, line) ; 		blnResult = false;         }      }   return blnResult;   }}}//=======Code Validation==========================//function validate_vcode(ErrID,alerttxt,Underline,line){ var f = document.forms[0];vCode = f.YEC_VCode.valuevCode2 = f.YEC_Verify.valueif (vCode!=vCode2)  {writeStatusById(ErrID,alerttxt,"inline",8);	underline(Underline, line) ; 	return false}else {return true}}//=======Decimal Point Validation(4Decimal)========================//function validate_4decimal_point(field,errfieldname,errtxt, Underline, line){with (field){if (value.length != 0) {	pattern = /^([0-9,]{0,3})([,]{0,1})([0-9,]{1,3})([.][0-9][0-9][0-9][0-9])$/;		if(pattern.test(value) == false)		{writeStatusById(errfieldname,errtxt,"inline",0);		underline(Underline, line) ; 		return false		field.focus()}		else		{return true}	}}}//=======Decimal Point Validation(3Decimal)========================//function validate_3decimal_point(field,errfieldname,errtxt, Underline, line){with (field){if (value.length != 0) {	pattern = /^([0-9,]{0,3})([,]{0,1})([0-9,]{1,3})([.][0-9][0-9][0-9])$/;		if(pattern.test(value) == false)		{writeStatusById(errfieldname,errtxt,"inline",0);		underline(Underline, line) ; 		return false		field.focus()}		else		{return true}	}}}//=======Decimal Point Validation========================//function validate_decimal_point(field,errfieldname,errtxt, Underline, line){with (field){if (value.length == 0) return false;	pattern = /^[0-9].[0-9][0-9]$/;	if(pattern.test(value) == false)	{writeStatusById(errfieldname,errtxt,"inline",0);		underline(Underline, line) ; 		return false		field.focus()}		else		{return true}	}}//=============Check Period Function=============function check_leave_period(valueFrom,valueTo, ErrID,Underline){ while (valueFrom.indexOf("/")!= -1)  {    valueFrom = valueFrom.slice (0,valueFrom.indexOf("/"))+valueFrom.slice (valueFrom.indexOf("/")+1);    valueTo = valueTo.slice (0,valueTo.indexOf("/"))+valueTo.slice (valueTo.indexOf("/")+1);      }      var value1= valueFrom.charAt(0)+valueFrom.charAt(1);      var value2= valueFrom.charAt(2)+valueFrom.charAt(3);      var value3= valueFrom.charAt(4)+valueFrom.charAt(5)+valueFrom.charAt(6)+valueFrom.charAt(7);      valueFrom = value3+value2+value1;      var value1= valueTo.charAt(0)+valueTo.charAt(1);      var value2= valueTo.charAt(2)+valueTo.charAt(3);      var value3= valueTo.charAt(4)+valueTo.charAt(5)+valueTo.charAt(6)+valueTo.charAt(7);      valueTo = value3+value2+value1;if ( valueFrom > valueTo){writeStatusById(ErrID,"Please enter a valid leave period.","inline",8); //return;underline(Underline, "''''''''''''''''''''''''''''''''") ;return false }}//=======Last Year Field Validation==========================//function validate_LastYear(value,ErrID,Underline){ var f = document.forms[0];vLastYr = f.YearCreated.value;var vDate = value;var temp = new Array();temp = vDate.split("/");var year = temp[2];year=parseInt(year);var d = new Date();var curr_year = d.getFullYear();if(year !=vLastYr){	alert("You can only apply leave for last year");	return false}}//=======Next Year Field Validation==========================//function validate_NextYear(valueFrom,valueTo,ErrID,Underline){ 	var f = document.forms[0];	var vDateFrom = valueFrom;	var vDateTo = valueTo;	vActiveYr = f.ActiveYear.value;	var tempFrom = new Array();	tempFrom = vDateFrom.split("/");	var yearFrom = tempFrom[2];	var monthFrom = tempFrom[1];		var tempTo = new Array();	tempTo = vDateTo.split("/");	var yearTo = tempTo[2];	var monthTo = tempTo[1];		yearFrom=parseInt(yearFrom);	yearTo=parseInt(yearTo);		if((yearFrom >vActiveYr && monthFrom !=1)||( yearTo >vActiveYr && monthTo !=1)){	alert("You are not allowed to take next year leave except January");	return false}}//=======Cross Date Validation==========================//function validate_cross_date(valueFrom,valueTo, ErrID,Underline){ 	var f = document.forms[0];	var vDateFrom = valueFrom;	var vDateTo = valueTo;	var tempFrom = new Array();	tempFrom = vDateFrom.split("/");	var yearFrom = tempFrom[2];	var tempTo = new Array();	tempTo = vDateTo.split("/");	var yearTo = tempTo[2];	yearFrom=parseInt(yearFrom);	yearTo=parseInt(yearTo);	var d = new Date();	var curr_year = d.getFullYear();	//var last_year = curr_year - 1;	if(yearFrom != yearTo){	writeStatusById(ErrID,"The Date Cannot be Cross Date.","inline",8); //return;	underline(Underline, "''''''''''''''''''''''''''''''''") ;	//alert("The Date Cannot be Cross Date");	return false}}//=============Blinking Function=============window.onerror = null; var bName = navigator.appName; var bVer = parseInt(navigator.appVersion); var NS4 = (bName == "Netscape" && bVer >= 4); var IE4 = (bName == "Microsoft Internet Explorer"  && bVer >= 4); var NS3 = (bName == "Netscape" && bVer < 4); var IE3 = (bName == "Microsoft Internet Explorer"  && bVer < 4); var blink_speed=300; var i=0; if (NS4 || IE4) { if (navigator.appName == "Netscape") { layerStyleRef="layer."; layerRef="document.layers"; styleSwitch=""; }else{ layerStyleRef="layer.style."; layerRef="document.all"; styleSwitch=".style"; }}//BLINKINGfunction Blink(layerName){ if (NS4 || IE4) {  if(i%2==0) { eval(layerRef+'["'+layerName+'"]'+ styleSwitch+'.visibility="visible"'); } else { eval(layerRef+'["'+layerName+'"]'+ styleSwitch+'.visibility="hidden"'); } }  if(i<1) { i++; }  else { i-- } setTimeout("Blink('"+layerName+"')",blink_speed);}//  End -->//=======Undeline function==========================//function underline(ErrID,alerttxt){writeStatusById(ErrID,alerttxt,"inline",8);	}	//=======YearMonth Empty Field Validation==========================//function validate_YearMonth(value,ErrID,Underline){ var f = document.forms[0];var yearmonth = value;var temp = new Array();temp = yearmonth.split("/");var year = temp[0];var month = temp[1];month=parseInt(month)year=parseInt(year)var d = new Date();var curr_date = d.getDate();var curr_month=d.getMonth()+1;var curr_year = d.getFullYear();if(month=="02"&&(f.day29.value!=""||f.day30.value!=""||f.day31.value!="")){	if(year%4!=0){	alert("This year is not a leap year. February only has 28 days!");	f.day29.value="";	f.day30.value="";	f.day31.value="";	return false}}else if((month=="04"||month=="06"||month=="09"||month=="11")&&(f.day31.value!="")){	alert("This month only has 30 days!");	f.day31.value="";	return false}else {return true}}//=======Error Field Validation==========================//function validate_error(value,ErrString,ErrID,alerttxt,Underline,line){ if (value==ErrString)  {writeStatusById(ErrID,alerttxt,"inline",8);	underline(Underline, line) ; 	return false}else {return true}}//=======Empty Field Validation==========================//function validate_empty(value,ErrID,alerttxt,Underline,line){ var f = document.forms[0];if (value.length==0)  {writeStatusById(ErrID,alerttxt,"inline",8);	underline(Underline, line) ; 	return false}else if(value=="-Select Clinic-"){  {writeStatusById(ErrID,alerttxt,"inline",8);	underline(Underline, line) ; 	return false}}else if(value=="-Select Employee Name-"){  {writeStatusById(ErrID,alerttxt,"inline",8);	underline(Underline, line) ; 	return false}}else if(value=="-Select Group Code-"){  {writeStatusById(ErrID,alerttxt,"inline",8);	underline(Underline, line) ; 	return false}}else if(value=="-Select Leave Type-"){  {writeStatusById(ErrID,alerttxt,"inline",8);	underline(Underline, line) ; 	return false}}else if(value=="-Select Payroll Company-"){  {writeStatusById(ErrID,alerttxt,"inline",8);	underline(Underline, line) ; 	return false}}else if(value=="-Select Function-"){  {writeStatusById(ErrID,alerttxt,"inline",8);	underline(Underline, line) ; 	return false}}else if(value=="-Select Division-"){  {writeStatusById(ErrID,alerttxt,"inline",8);	underline(Underline, line) ; 	return false}}else if(value=="BothAll"){  {writeStatusById(ErrID,alerttxt,"inline",8);	underline(Underline, line) ; 	return false}}else {return true}}//=======Empty Checkbox Validation========================//function validate_checkbox(value,ErrID, alerttxt, Underline, line){	// require that at least one checkbox be checked	var checkSelected = false;	for (i = 0;  i <value.length;  i++)	{		if (value[i].checked)			checkSelected = true;	}	if (!checkSelected){		writeStatusById(ErrID, alerttxt, "inline",8);		underline(Underline,line);		return false	}	else{		return true	}}//=============Show Hidden Function============= function showHidden(id, display) {	var f = document.forms[0];	var obj = document.getElementById(id);	if (!(obj == undefined)) {		obj.style.display = display;	}}//=============Number Format Conversion Function (4Decimal)=============function FComma_4Decimal(value,field,ErrID, Underline, line){ if (value != ""){//check value is numeric or nottry{ if(validate_numeric(field,ErrID,"Exchange rate must be numeric",Underline, line) ==false)  throw "Err" } catch(er){if(er=="Err") return;}var S=String(value),T="", H,j,Q,A="",B="",C="",D="";//remove "," of the stringwhile (S.indexOf(",")!= -1) {S = S.slice (0,S.indexOf(",")) + S.slice (S.indexOf(",")+1) }S=String(parseFloat(S).toFixed(4))//remove "." and the value behind of "." and store it to a variable for apply again laterwhile (S.indexOf(".")!= -1) {S = S.slice (0,S.indexOf(".")) + S.slice (S.indexOf(".")+1)	var K=S.length-1	A=S.charAt(K);	B=S.charAt(K-1);	C=S.charAt(K-2);	D=S.charAt(K-3);	S = S.slice (0,K)	S = S.slice (0,K-1)	S = S.slice (0,K-2)	S = S.slice (0,K-3) }     var  P = S.indexOf('.')-1,L=S.length-1;  Q=P;	if (P<0){ 		P=L		for (j=0; j<=L; j++) {			T+=H=S.charAt(j)			if ((j < P) && ((P-j)%3 == 0) && (H != '-')) T+=','		 }			 field.value = T ;			S=T;	}	     	if (A != "" & B != "" & C != "" & D != ""){		field.value = S+"."+D+C+B+A;		S= S+"."+D+C+B+A;	}	     	if(Q==-2 & A=="" & B=="" & C == "" & D != "") {		field.value = S+".0000";		S= S+".0000";	}		}	}//=============Number Format Conversion Function (3 Decimal)=============function FComma_3Decimal(value,field,ErrID, Underline, line){ if (value != ""){//check value is numeric or nottry{ if(validate_numeric(field,ErrID,"Exchange rate must be numeric",Underline, line) ==false)  throw "Err" } catch(er){if(er=="Err") return;}var S=String(value),T="", C, j,Q,M="",N="",O="";//remove "," of the stringwhile (S.indexOf(",")!= -1) {S = S.slice (0,S.indexOf(",")) + S.slice (S.indexOf(",")+1) }S=String(parseFloat(S).toFixed(3))//remove "." and the value behind of "." and store it to a variable for apply again laterwhile (S.indexOf(".")!= -1) {S = S.slice (0,S.indexOf(".")) + S.slice (S.indexOf(".")+1)	var K=S.length-1	M=S.charAt(K);	N=S.charAt(K-1);	O=S.charAt(K-2);	S = S.slice (0,K)	S = S.slice (0,K-1)	S = S.slice (0,K-2)     }     var  P = S.indexOf('.')-1,L=S.length-1;  Q=P;	if (P<0){ 		P=L		for (j=0; j<=L; j++) {			T+=C=S.charAt(j)			if ((j < P) && ((P-j)%3 == 0) && (C != '-')) T+=','		 }			 field.value = T ;			S=T;	}		if (M != "" & N != "" & O != ""){		field.value = S+"."+O+N+M;		S= S+"."+O+N+M;	}		if(Q==-2 & M=="" & N=="" & O == "") {		field.value = S+".000";		S= S+".000";	}		}}//=============Number Format Conversion Function (2 Decimal)=============function FComma(value,field,ErrID,ErrMsg, Underline, line){ if (value != ""){//check value is numeric or nottry{ if(validate_numeric(field,ErrID,ErrMsg, Underline, line) ==false)  throw "Err" } catch(er){if(er=="Err") return;}var S=String(value),T="", C, j,Q,M="",N="",O="";//remove "," of the stringwhile (S.indexOf(",")!= -1) {S = S.slice (0,S.indexOf(",")) + S.slice (S.indexOf(",")+1) }S=String(parseFloat(S).toFixed(2))//remove "." and the value behind of "." and store it to a variable for apply again laterwhile (S.indexOf(".")!= -1) {S = S.slice (0,S.indexOf(".")) + S.slice (S.indexOf(".")+1)	var K=S.length-1	M=S.charAt(K);	N=S.charAt(K-1);		S = S.slice (0,K)	S = S.slice (0,K-1)	     }var  P = S.indexOf('.')-1,L=S.length-1;  Q=P;	if (P<0){ 		P=L		for (j=0; j<=L; j++) {			T+=C=S.charAt(j)			if ((j < P) && ((P-j)%3 == 0) && (C != '-')) T+=','		 }			 field.value = T ;			S=T;	}	if (M != "" & N != "" ){		field.value = S+"."+N+M;		S= S+"."+N+M;	}		if(Q==-2 & M=="" & N=="" ) {		field.value = S+".00";		S= S+".00";	}		}}//=============Number Format Conversion Function (2 Decima without error message)=============function FComma2(value){ if (value != ""){//check value is numeric or notvar S=String(value),T="", C, j,Q,M="",N="",O="";//remove "," of the stringwhile (S.indexOf(",")!= -1) {S = S.slice (0,S.indexOf(",")) + S.slice (S.indexOf(",")+1) }S=String(parseFloat(S).toFixed(2))//remove "." and the value behind of "." and store it to a variable for apply again laterwhile (S.indexOf(".")!= -1) {S = S.slice (0,S.indexOf(".")) + S.slice (S.indexOf(".")+1)	var K=S.length-1	M=S.charAt(K);	N=S.charAt(K-1);		S = S.slice (0,K)	S = S.slice (0,K-1)	     }var  P = S.indexOf('.')-1,L=S.length-1;  Q=P;	if (P<0){ 		P=L		for (j=0; j<=L; j++) {			T+=C=S.charAt(j)			if ((j < P) && ((P-j)%3 == 0) && (C != '-')) T+=','		 }			 			S=T;			 				}	if (M != "" & N != "" ){				S= S+"."+N+M;				}		if(Q==-2 & M=="" & N=="" ) {				S= S+".00";					}		return(String(S));	}}//=============Number Format Conversion Function (Remove comma)=============function FRemoveComma(value){ var S=String(value);//remove "," of the stringwhile (S.indexOf(",")!= -1) {S = S.slice (0,S.indexOf(",")) + S.slice (S.indexOf(",")+1) }return S;}//===========is new doc==========================//function isNewDoc(){      url = window.location.toString();      url = url.toLowerCase();      if (url.indexOf("openform") == -1)            return false;      else            return true;}//===========is doc being edited==========================//function isDocBeingEdited(){      if (isNewDoc()) return true;      url = window.location.toString();      url = url.toLowerCase();      if (url.indexOf("editdocument") == -1)            return false;      else            return true;}//===========Calendar==========================//// Title: Tigra Calendar// URL: http://www.softcomplex.com/products/tigra_calendar/// Version: 3.3 (American date format)// Date: 09/01/2005 (mm/dd/yyyy)// Note: Permission given to use this script in ANY kind of applications if//    header lines are left unchanged.// Note: Script consists of two files: calendar?.js and calendar.html// if two digit year input dates after this year considered 20 century.var NUM_CENTYEAR = 30;// is time input control required by defaultvar BUL_TIMECOMPONENT = false;// are year scrolling buttons required by defaultvar BUL_YEARSCROLL = true;var calendars = [];var RE_NUM = /^\-?\d+$/;function calendar2(obj_target) {	// assigning methods	this.gen_date = cal_gen_date2;	this.gen_time = cal_gen_time2;	this.gen_tsmp = cal_gen_tsmp2;	this.prs_date = cal_prs_date2;	this.prs_time = cal_prs_time2;	this.prs_tsmp = cal_prs_tsmp2;	this.popup    = cal_popup2;	// validate input parameters	if (!obj_target)		return cal_error("Error calling the calendar: no target control specified");	if (obj_target.value == null)		return cal_error("Error calling the calendar: parameter specified is not valid target control");	this.target = obj_target;	this.time_comp = BUL_TIMECOMPONENT;	this.year_scroll = BUL_YEARSCROLL;		// register in global collections	this.id = calendars.length;	calendars[this.id] = this;}function cal_popup2 (str_datetime,top,left) {var f = document.forms[0];var thisServer = f.WebServerName.value;var thisPath = f.WebSystemPath.value;	if (str_datetime) {		this.dt_current = this.prs_tsmp(str_datetime);	}	else {		this.dt_current = this.prs_tsmp(this.target.value);		this.dt_selected = this.dt_current;			}	if (!this.dt_current) return;			var obj_calwindow = window.open(		'http://'+thisServer+'/'+thisPath + '/calendar?OpenForm?datetime=' + this.dt_current.valueOf()+ '&id=' + this.id,		'Calendar', 'width=200,height='+(this.time_comp ? 215 : 190)+		',status=no,resizable=no,top='+top+',left='+left+',dependent=yes,alwaysRaised=yes'	);	obj_calwindow.opener = window;	obj_calwindow.focus();}// timestamp generating functionfunction cal_gen_tsmp2 (dt_datetime) {	return(this.gen_date(dt_datetime) + ' ' + this.gen_time(dt_datetime));}// date generating functionfunction cal_gen_date2 (dt_datetime) {	return (		(dt_datetime.getDate() < 10 ? '0' : '') + dt_datetime.getDate() + "/"		+(dt_datetime.getMonth() < 9 ? '0' : '') + (dt_datetime.getMonth() + 1) + "/"		+ dt_datetime.getFullYear()	);}// time generating functionfunction cal_gen_time2 (dt_datetime) {	return (		(dt_datetime.getHours() < 10 ? '0' : '') + dt_datetime.getHours() + ":"		+ (dt_datetime.getMinutes() < 10 ? '0' : '') + (dt_datetime.getMinutes()) + ":"		+ (dt_datetime.getSeconds() < 10 ? '0' : '') + (dt_datetime.getSeconds())	);}// timestamp parsing functionfunction cal_prs_tsmp2 (str_datetime) {	// if no parameter specified return current timestamp	if (!str_datetime)		return (new Date());	// if positive integer treat as milliseconds from epoch	if (RE_NUM.exec(str_datetime))		return new Date(str_datetime);			// else treat as date in string format	var arr_datetime = str_datetime.split(' ');	return this.prs_time(arr_datetime[1], this.prs_date(arr_datetime[0]));}// date parsing functionfunction cal_prs_date2 (str_date) {	var arr_date = str_date.split('/');	if (arr_date.length != 3) return alert ("Invalid date format: '" + str_date + "'.\nFormat accepted is dd/mm/yyyy.");	if (!arr_date[1]) return alert ("Invalid date format: '" + str_date + "'.\nNo day of month value can be found.");	if (!RE_NUM.exec(arr_date[1])) return alert ("Invalid day of month value: '" + arr_date[1] + "'.\nAllowed values are unsigned integers.");	if (!arr_date[0]) return alert ("Invalid date format: '" + str_date + "'.\nNo month value can be found.");	if (!RE_NUM.exec(arr_date[0])) return alert ("Invalid month value: '" + arr_date[0] + "'.\nAllowed values are unsigned integers.");	if (!arr_date[2]) return alert ("Invalid date format: '" + str_date + "'.\nNo year value can be found.");	if (!RE_NUM.exec(arr_date[2])) return alert ("Invalid year value: '" + arr_date[2] + "'.\nAllowed values are unsigned integers.");	var dt_date = new Date();	dt_date.setDate(1);if (arr_date[1] < 1 || arr_date[1] > 12) return cal_error ("Invalid month value: '" + arr_date[1] + "'.\nAllowed range is 01-12.");	dt_date.setMonth(arr_date[1]-1);	 	if (arr_date[2] < 100) arr_date[2] = Number(arr_date[2]) + (arr_date[2] < NUM_CENTYEAR ? 2000 : 1900);	dt_date.setFullYear(arr_date[2]);	var dt_numdays = new Date(arr_date[2], arr_date[1], 0);	dt_date.setDate(arr_date[0]);	if (dt_date.getMonth() != (arr_date[1]-1)) return cal_error ("Invalid day of month value: '" + arr_date[0] + "'.\nAllowed range is 01-"+dt_numdays.getDate()+".");	return (dt_date)}// time parsing functionfunction cal_prs_time2 (str_time, dt_date) {	if (!dt_date) return null;	var arr_time = String(str_time ? str_time : '').split(':');	if (!arr_time[0]) dt_date.setHours(0);	else if (RE_NUM.exec(arr_time[0])) 		if (arr_time[0] < 24) dt_date.setHours(arr_time[0]);		else return cal_error ("Invalid hours value: '" + arr_time[0] + "'.\nAllowed range is 00-23.");	else return cal_error ("Invalid hours value: '" + arr_time[0] + "'.\nAllowed values are unsigned integers.");		if (!arr_time[1]) dt_date.setMinutes(0);	else if (RE_NUM.exec(arr_time[1]))		if (arr_time[1] < 60) dt_date.setMinutes(arr_time[1]);		else return cal_error ("Invalid minutes value: '" + arr_time[1] + "'.\nAllowed range is 00-59.");	else return cal_error ("Invalid minutes value: '" + arr_time[1] + "'.\nAllowed values are unsigned integers.");	if (!arr_time[2]) dt_date.setSeconds(0);	else if (RE_NUM.exec(arr_time[2]))		if (arr_time[2] < 60) dt_date.setSeconds(arr_time[2]);		else return cal_error ("Invalid seconds value: '" + arr_time[2] + "'.\nAllowed range is 00-59.");	else return cal_error ("Invalid seconds value: '" + arr_time[2] + "'.\nAllowed values are unsigned integers.");	dt_date.setMilliseconds(0);	return dt_date;}function cal_error (str_message) {	alert (str_message);	return null;}//=======validate_duplicate_value Validation==========================//function validate_duplicate_value(LAF_ImmSuperior1,LAF_ImmSuperior2,ErrID,alerttxt,Underline,line){ var f = document.forms[0];if (LAF_ImmSuperior1 =="") 	{ if (LAF_ImmSuperior2=="") 				{return true}	 }else 	{ if (LAF_ImmSuperior2=="")			{return true} 	 else						if (LAF_ImmSuperior1==LAF_ImmSuperior2)  			{writeStatusById(ErrID,alerttxt,"inline",8);			underline(Underline, line) ; 			return false}	 }}//=======validate_duplicate_value Validation==========================//function validate_duplicate_value2(LAF_ImmSuperiorCancel1,LAF_ImmSuperiorCancel2,ErrID,alerttxt,Underline,line){ var f = document.forms[0];if (LAF_ImmSuperiorCancel1 =="") 	{ if (LAF_ImmSuperiorCancel2=="") 				{return true}	 }else 	{ if (LAF_ImmSuperiorCancel2=="")			{return true} 	 else						if (LAF_ImmSuperiorCancel1==LAF_ImmSuperiorCancel2)  			{writeStatusById(ErrID,alerttxt,"inline",8);			underline(Underline, line) ; 			return false}	 }}//=======validate_duplicate_value Validation==========================//function validate_duplicate_value3(LAF_SignatoryCancel,LAF_ImmSuperiorCancel1,LAF_ImmSuperiorCancel2,ErrID,alerttxt,Underline,line){ var f = document.forms[0];if (LAF_ImmSuperiorCancel1 ==""){ 	if (LAF_SignatoryCancel==LAF_ImmSuperiorCancel2)   		{writeStatusById(ErrID,alerttxt,"inline",8);		underline(Underline, line) ; 		return false}}			else  {return true}if (LAF_ImmSuperiorCancel2 ==""){ 	if (LAF_SignatoryCancel==LAF_ImmSuperiorCancel1)   		{writeStatusById(ErrID,alerttxt,"inline",8);		underline(Underline, line) ; 		return false}}			else  {return true}   if (LAF_SignatoryCancel ==""){		 	if (LAF_ImmSuperiorCancel1==LAF_ImmSuperiorCancel2)   		{writeStatusById(ErrID,alerttxt,"inline",8);		underline(Underline, line) ; 		return false}}else {return true}if ((LAF_ImmSuperiorCancel1!="")&&(LAF_ImmSuperiorCancel2!="")&&(LAF_SignatoryCancel !="")){		 	if (LAF_ImmSuperiorCancel1==LAF_ImmSuperiorCancel2==LAF_SignatoryCancel)   		{writeStatusById(ErrID,alerttxt,"inline",8);		underline(Underline, line) ; 		return false}}else {return true}if ((LAF_ImmSuperiorCancel1=="")&&(LAF_ImmSuperiorCancel2=="")&&(LAF_SignatoryCancel =="")){		return true}if ((LAF_ImmSuperiorCancel1=="")&&(LAF_ImmSuperiorCancel2 =="")){				return true}}//=======validate_duplicate_date Validation==========================//function validate_duplicate_date(ErrID,alerttxt,Underline,line){ var f = document.forms[0];from1=f.LAF_LeaveDateFrom.value;from2 = f.LAF_LeaveDateFrom2.value;from3 = f.LAF_LeaveDateFrom3.value;to1=f.LAF_LeaveDateTo.value;to2 = f.LAF_LeaveDateTo2.value;to3=f.LAF_LeaveDateTo3.value;var totalDay1= f.LAF_TotalDay.options[f.LAF_TotalDay.selectedIndex].text;var totalDay2= f.LAF_TotalDay.options[f.LAF_TotalDay2.selectedIndex].text;var totalDay3= f.LAF_TotalDay.options[f.LAF_TotalDay3.selectedIndex].text;var leaveDay1= f.LAF_Day.options[f.LAF_Day.selectedIndex].text;var leaveDay2= f.LAF_Day2.options[f.LAF_Day2.selectedIndex].text;var leaveDay3= f.LAF_Day3.options[f.LAF_Day3.selectedIndex].text;if(((Date.parse(from1) >= Date.parse(from2)) && (Date.parse(from1) <= Date.parse(to2))) ||	 ((Date.parse(to1) >= Date.parse(from2)) && (Date.parse(to1) <= Date.parse(to2)))||	((Date.parse(from1) >= Date.parse(from3)) && (Date.parse(from1) <= Date.parse(to3)))||	((Date.parse(to1) >= Date.parse(from3)) && (Date.parse(to1) <= Date.parse(to3)))){		if(((totalDay1 == totalDay2) &&( leaveDay1 != leaveDay2 )&&Date.parse(from1)!=Date.parse(from3)&&totalDay1<1&&totalDay2<1)||         ((totalDay1==totalDay3) && (leaveDay1!=leaveDay3) &&Date.parse(from1)!=Date.parse(from2)&& totalDay1<1 && totalDay3 <1)){	return true	}else{	    writeStatusById(ErrID,alerttxt,"inline",8);		underline(Underline, line) ; 		return false	}} else if(((Date.parse(from2) >= Date.parse(from1)) && (Date.parse(from2) <= Date.parse(to1))) ||	 ((Date.parse(to2) >= Date.parse(from1)) && (Date.parse(to2) <= Date.parse(to1)))||	((Date.parse(from2) >= Date.parse(from3)) && (Date.parse(from2) <= Date.parse(to3)))||	((Date.parse(to2) >= Date.parse(from3)) && (Date.parse(to2) <= Date.parse(to3)))	){	    if(((totalDay2 == totalDay1) &&( leaveDay2 != leaveDay1 )&&Date.parse(from2)!=Date.parse(from3)&&totalDay2<1&&totalDay1<1)||         ((totalDay2==totalDay3) && (leaveDay2!=leaveDay3) &&Date.parse(from2)!=Date.parse(from1)&& totalDay2<1 && totalDay3 <1)){	return true	}else{	    writeStatusById(ErrID,alerttxt,"inline",8);		underline(Underline, line) ; 		return false	}   } else if(((Date.parse(from3) >= Date.parse(from1)) && (Date.parse(from3) <= Date.parse(to1))) ||	 ((Date.parse(to3) >= Date.parse(from1)) && (Date.parse(to3) <= Date.parse(to1)))||	((Date.parse(from3) >= Date.parse(from2)) && (Date.parse(from3) <= Date.parse(to2)))||	((Date.parse(to3) >= Date.parse(from2)) && (Date.parse(to3) <= Date.parse(to2)))	){              if(((totalDay3 == totalDay1) &&( leaveDay3 != leaveDay1 )&&Date.parse(from3)!=Date.parse(from2)&&totalDay3<1&&totalDay1<1)||         ((totalDay3==totalDay2) && (leaveDay3!=leaveDay2) &&Date.parse(from3)!=Date.parse(from1)&& totalDay3<1 && totalDay2 <1)){	return true	}else{	    writeStatusById(ErrID,alerttxt,"inline",8);		underline(Underline, line) ; 		return false	}   }    else{           return true   }	}//===============================================================DOMinclude={	ifrContainer:null,	currentTrigger:null,	init:function(){		if(!document.getElementById || !document.createTextNode){return;}		var allLinks=document.getElementsByTagName('a');		for(var i=0;i<allLinks.length;i++){			if(!DOMinclude.cssjs('check',allLinks[i],DOMinccfg.triggerClass)){continue;}			DOMinclude.addEvent(allLinks[i],'click',DOMinclude.openPopup,false);						allLinks[i].preset=allLinks[i].innerHTML;			allLinks[i].onclick=DOMinclude.safariClickFix;			allLinks[i].isOpen=false;		}	},	openPopup:function(e){		var t=DOMinclude.getTarget(e);		if(t.nodeName.toLowerCase()!='a'){			t=t.parentNode;			}		if(DOMinclude.currentTrigger && DOMinclude.currentTrigger!=t){			DOMinclude.currentTrigger.isOpen=false;		}		DOMinclude.killPopup();		if(!t.isOpen){			DOMinclude.cssjs('add',t,DOMinccfg.openPopupLinkClass);			t.innerHTML=t.preset;			DOMinclude.ifrContainer=document.createElement('div');			DOMinclude.cssjs('add',DOMinclude.ifrContainer,DOMinccfg.popupClass);			var targetURL=t.getAttribute('href');			var ftype=targetURL.substring(targetURL.lastIndexOf('.')+1,targetURL.length);			ftype=new RegExp(DOMinccfg.imagetypes).test(ftype)?'img':'iframe';			var ifr=document.createElement(ftype);			if(ftype=='iframe'){				ifr.style.width=DOMinccfg.frameSize[0]+'px';				ifr.style.height=DOMinccfg.frameSize[1]+'px';			}			DOMinclude.ifrContainer.appendChild(ifr);			ifr.setAttribute('src',targetURL);			document.body.appendChild(DOMinclude.ifrContainer);			DOMinclude.positionPopup(t);			DOMinclude.cancelClick(e);			DOMinclude.currentTrigger=t;			t.isOpen=true;		} else {			t.isOpen=false;		}	},	positionPopup:function(o){		var x=0;		var y=0;		var h=o.offsetHeight;		while (o != null){			x += o.offsetLeft;			y += o.offsetTop;			o = o.offsetParent;		}		DOMinclude.ifrContainer.style.left=x+'px';		DOMinclude.ifrContainer.style.top=y+h+'px';	},	killPopup:function(e){		if(!DOMinclude.ifrContainer){return;}		if(DOMinclude.currentTrigger){			if(arguments.length>0){				DOMinclude.currentTrigger.isOpen=false;			}			DOMinclude.currentTrigger.innerHTML=DOMinclude.currentTrigger.preset;			DOMinclude.cssjs('remove',DOMinclude.currentTrigger,DOMinccfg.openPopupLinkClass);			DOMinclude.currentTrigger=null;		}		DOMinclude.ifrContainer.parentNode.removeChild(DOMinclude.ifrContainer);		DOMinclude.ifrContainer=null;		DOMinclude.cancelClick(e);	},	getTarget:function(e){		var target = window.event ? window.event.srcElement : e ? e.target : null;		if (!target){return false;}		while(target.nodeType!=1 && target.nodeName.toLowerCase()!='body'){			target=target.parentNode;		}		return target;	},	cancelClick:function(e){		if (window.event && window.event.cancelBubble 		    && window.event.returnValue){			window.event.cancelBubble = true;			window.event.returnValue = false;			return;		}		if (e && e.stopPropagation && e.preventDefault){			e.stopPropagation();			e.preventDefault();		}	},	addEvent: function(elm, evType, fn, useCapture){		if (elm.addEventListener){			elm.addEventListener(evType, fn, useCapture);			return true;		} else if (elm.attachEvent) {			var r = elm.attachEvent('on' + evType, fn);			return r;		} else {			elm['on' + evType] = fn;		}	},	cssjs:function(a,o,c1,c2){		switch (a){			case 'swap':				o.className=!DOMinclude.cssjs('check',o,c1)?o.className.replace(c2,c1):o.className.replace(c1,c2);			break;			case 'add':				if(!DOMinclude.cssjs('check',o,c1)){o.className+=o.className?' '+c1:c1;}			break;			case 'remove':				var rep=o.className.match(' '+c1)?' '+c1:c1;				o.className=o.className.replace(rep,'');			break;			case 'check':				var found=false;				var temparray=o.className.split(' ');				for(var i=0;i<temparray.length;i++){					if(temparray[i]==c1){found=true;}				}				return found;			break;		}	},    safariClickFix:function(){      return false;    }}DOMinclude.addEvent(window,'load',DOMinclude.init,false);			DOMinccfg={// CSS classes// trigger DOMinclude  triggerClass:'DOMpop',// class of the popup  popupClass:'popup',// class of the link when the popup // is open  openPopupLinkClass:'popuplink',// text to add to the link when the // popup is open   displayPrefix:'Hide ',// filter to define which files should// not open in an iframe  imagetypes:'jpg|JPG|JPEG|jpeg|gif|GIF|png|PNG',// dimensions of the popup  frameSize:[320,180]}		