// TO USE THIS IN YOUR APPLICATION, add the following formula to your form in the HTML Head, a computed text field, or a Computed Text object://        "<script src=\"" + @If(@IsNewDoc; ""; "../") + "jsTSFormulas.js?OpenPage\"></script>"// OR... add this Library to the JSHeader of your form.// Available functions:// tsAddList(array1, array2); combines two arrays into one// tsCatList(startingArray, newArrayElements, noNulls);// tsExplode(startingString, separatorString);// tsGetCookie(name); returns the value of the named cookie// tsGetDate(fieldToPutDateInto [, formObject] [, calendarFormatStr]); // uses tsDialogs if available// tsGetFieldObj(fieldNameStr);// tsGetItemValue(fieldObjectReference as object or string [, failSilent] [, failureRetStr]);// tsGetMultiFormattedNames(returnField, specialParameters, nameFormat); // uses tsDialogs if available// tsGetMultiNames(returnFieldNameStr, specialParameters); // uses tsDialogs if available// tsGetObjByID(idNameStr);// tsGetQSParameter(parameterName); note: to retrieve value of "&status=" parameter, enter only "status" for parameterName// tsGetSingleFormattedNames(returnField, specialParameters, nameFormat); // uses tsDialogs if available// tsGetSingleName(returnFieldNameStr, specialParameters); // uses tsDialogs if available// tsGetWindowSize(); // returns an array of [width, height] in pixels// tsHideObject(objectNameOrID [, documentObject]);// tsImplode(startingValue, separatorString);// tsIsAnyMember(valueToFind, valuesToLookIn);// tsIsArray(variable);// tsIsMember(valueToFind, valuesToLookIn);// tsIsOnlyNumber();// tsIsValidNumberCharacter();// tsLeft(startingVals, searchStr);// tsLeftBack(startingVals, searchStr);// tsMakeArray(variable);// tsName(nameTypeStr, nameArray, hasCountryInt); returns a list of names in the specified format. Allowable nameTypeStr values are "CN," "Abbreviate," and "Canonicalize." hasCountryInt should be true or false.// tsPreventFieldEditing([errorMessageText]);// tsProperCase(inputArrayOrString); // returns an array that is a Proper Case Version of the input string/array// tsRepeatAsArray(valueToRepeat, numberOfIterationsInt); returns an array with the specified number of elements, all having the same (specified) value.// tsReplace(start, find, replace);// tsReplaceItemValue(fieldObject or name as string, newValues);// tsReplaceSubstring(start, find, replace);// tsResetCheckboxOptions(newChoicesArray, newAliasesArray, fieldName, fieldContainerID, numCols, onClickFunction) NOTE: Does not work the same as tsResetSelection options. Requires a <span>, <div> or other containing object as complete HTML is replaced. See documentation in TS Database Builder.// tsResetRadioOptions(newChoicesArray, newAliasesArray, fieldName, fieldContainerID, numCols, onClickFunction) NOTE: Does not work the same as tsResetSelection options. Requires a <span>, <div> or other containing object as complete HTML is replaced. See documentation in TS Database Builder.// tsResetSelectOptions(newValues, newAliases, selectFieldObject or name as string);// tsRight(startingVals, searchStr);// tsRightBack(startingVals, searchStr);// tsSetCookie(name, value, expires); swets a cookie. expires is optional// tsSetMinimumWindowSize(minWidthPx, minHeightPx); // using zero for either value ignores that dimension// tsShowObject(objectNameOrID [, documentObject]);// tsShowInlineObject(objectNameOrID [, documentObject]);// tsSortArray(inputArray, sortAscendingBoolean); returns an array resorted ascending or descending - sg 13Mar2006// tsTrim(value); gets rid of all leading, all trailing and any double spaces as well as blank array elements// tsUnique(array); returns a unique list of all array values// tsWebDbName(); returns the path of the db without a preceeding slash to the .nsf - newbs 03Jan2006// tsWord(parseArray, wordSeparator, wordNum);// Added 14July 2008 Newbs// tsSetCookie(name, value, expires); swets a cookie. expires is optional// tsGetCookie(name); returns the value of the named cookie// Added 13Aug2008 SG// tsGetWindowSize(); // returns an array of [width, height] in pixels// tsSetMinimumWindowSize(minWidthPx, minHeightPx); // using zero for either value ignores that dimension// Tweaked 24Sept2008 SG// Integrated new tsDialogs calls for NAB and Date pickers into existing functions here. If script libs from tsDialogs are available, uses new code. Otherwise, uses old.var tsGetFieldObjList = new Array();var tsGetObjByIDList = new Array();function tsSetMinimumWindowSize(minWidthPx, minHeightPx){	// zero values are ignored	var curWinSize = tsGetWindowSize();	var sizeChgW = (minWidthPx > 0) ? ((minWidthPx > curWinSize[0]) ? (minWidthPx - curWinSize[0]) : 0) : 0; 	var sizeChgH = (minHeightPx > 0) ? ((minHeightPx > curWinSize[1]) ? (minHeightPx - curWinSize[1]) : 0) : 0; 	if (sizeChgW !== 0 || sizeChgH !== 0){		window.resizeBy(sizeChgW, sizeChgH);	}}function tsGetWindowSize(){	var winW;	var winH;	if (parseInt(navigator.appVersion)>3) {		if (navigator.appName=="Netscape") {			winW = window.innerWidth;			winH = window.innerHeight;		}		if (navigator.appName.indexOf("Microsoft")!=-1) {			winW = document.body.offsetWidth;			winH = document.body.offsetHeight;		}	}	return [winW, winH];}function tsProperCase(inputArray){	if (!tsIsArray(inputArray)){		inputArray = tsMakeArray(inputArray);	}	for (var i = 0; i < inputArray.length; i++){		inputArray[i] = inputArray[i].toLowerCase().replace(/^(.)|\s(.)/g, function($1) {return $1.toUpperCase();});	}	return inputArray;}function tsGetFieldObj(fName){	if ( (tsGetFieldObjList[fName] == null) || ( typeof tsGetFieldObjList[fName] == "undefined" ) ){		tsGetFieldObjList[fName] = document.forms[0][fName];	} else {		if (!tsGetFieldObjList[fName].type) {			tsGetFieldObjList[fName] = document.forms[0][fName];		}	}	return tsGetFieldObjList[fName];}function tsGetObjByID(idVal){	if (tsGetObjByIDList[idVal] == null){		tsGetObjByIDList[idVal] = document.getElementById(idVal);	}	return tsGetObjByIDList[idVal];}function tsTrim(sourceArray){	var i;	var x;	var strLen;	sourceArray = tsMakeArray(sourceArray);	var numIterations = sourceArray.length;	for (i = 0; i < numIterations; i++){		chkStr = sourceArray[i];		strLen = chkStr.length;		// remove all leading spaces (unless the only value is a space)		for (x = 0; x < strLen; x++){			spaceLoc = chkStr.indexOf(" ");			if (spaceLoc == 0 && chkStr.length > 1){				chkStr = chkStr.substring(1);				strLen = chkStr.length;			} else {				break;			}		};		// remove all trailing spaces (unless the only value is a space)		for (x = strLen - 1; x > 0; x--){			if (chkStr.charAt(x) == " " && chkStr.length > 1){				chkStr = chkStr.slice(0, -1);			} else {				break;			}		};		// remove double spaces		dblSpace = chkStr.indexOf("  ");		while (dblSpace > -1){			chkStr = chkStr.substring(0, dblSpace + 1) + chkStr.substring(dblSpace + 2);			dblSpace = chkStr.indexOf("  ");		}		sourceArray[i] = chkStr;	}	// remove null array elements	for (i = 0; i < numIterations; i++){		if (sourceArray[i] == ""){			// remove the blank element from the array			for (x = i; x < numIterations - 1; x++){				sourceArray[x] = sourceArray[x + 1];			}			numIterations--;			sourceArray.length = numIterations;			i--;  // reset i back one to check the same array position again		}	}	return sourceArray;}function tsAddList(array1, array2){	if (!tsIsArray(array1)){		array1 = tsMakeArray(array1);	}	if (!tsIsArray(array2)){		array2 = tsMakeArray(array2);	}	var a1Len = array1.length;	var a2Len = array2.length;	var maxCount = (a1Len >= a2Len) ? a1Len : a2Len;	var outArr = new Array();	var a1;	var a2;	for (var i = 0; i < maxCount; i ++){		a1 = (i < a1Len) ? array1[i] : array1[a1Len -1]		a2 = (i < a2Len) ? array2[i] : array2[a2Len -1]		outArr[i] = a1 + a2;	}	return outArr;}function tsResetRadioOptions(newChoicesArray, newAliasesArray, fieldName, fieldContainerID, numCols, onClickFunction){	var contArea = tsGetObjByID(fieldContainerID);	var newHTML = "";	var onCF = "";	if (onClickFunction != ""){		onCF = " onclick='" + onClickFunction + "'";	}	var aliases = ((newAliasesArray == "") ? newChoicesArray : newAliasesArray);	if (contArea){		for (var i = 0; i < newChoicesArray.length; i++){			newHTML += ((i > 0 && i % numCols == 0) ? "<br />" : "");			newHTML += "<input type='radio' name='" + fieldName + "' value='" + aliases[i] + "'" + onCF + ">" + newChoicesArray[i];		}		contArea.innerHTML = newHTML;	} else {		alert("CODE ERROR: No items were found with an ID of '" + fieldContainerID + "' in tsResetRadioOptions.");	}}function tsResetCheckboxOptions(newChoicesArray, newAliasesArray, fieldName, fieldContainerID, numCols, onClickFunction){	var contArea = tsGetObjByID(fieldContainerID);	var newHTML = "";	var onCF = "";	if (onClickFunction != ""){		onCF = " onclick='" + onClickFunction + "'";	}	var aliases = ((newAliasesArray == "") ? newChoicesArray : newAliasesArray);	if (contArea){		for (var i = 0; i < newChoicesArray.length; i++){			newHTML += ((i > 0 && i % numCols == 0) ? "<br />" : "");			newHTML += "<input type='checkbox' name='" + fieldName + "' value='" + aliases[i] + "'" + onCF + ">" + newChoicesArray[i];		}		contArea.innerHTML = newHTML;	} else {		alert("CODE ERROR: No items were found with an ID of '" + fieldContainerID + "' in tsResetCheckboxOptions.");	}}function tsSortArray(inArr, sortAscendBoolean){	var listLen = inArr.length;	var a;	for (var i = 0; i < listLen; i++){		if (inArr[i] > inArr[i + 1]){			a = inArr[i];			inArr[i] = inArr[i + 1];			inArr[i + 1] = a;			for (var x = i+1; x > 0; x--){				if (inArr[x] < inArr[x -1]){					a = inArr[x-1];					inArr[x-1] = inArr[x];					inArr[x] = a;							}			}		}	}	if (!sortAscendBoolean){		var outArr = new Array("");		for (var y = 0; y < listLen; y++){			outArr[y] = inArr[listLen - y - 1];		}		inArr = outArr;	}	return inArr;}function tsGetMultiNames(returnField, specialParameters) {	if (util){		// use tsDialogs		tsBuildNABPicker(returnField, true, null, "Abbreviate");	} else {		// use old way		var turl = "/" + tsWebDbName() + "/NABPickerMulti?open&returnfield=" + returnField + ((specialParameters) ? specialParameters : "");		var wchrome = "toolbar=no,directories=no,status=no,scrollbars=auto,resizable=yes,resize=yes,"		wchrome += "menubar=no,height=400,width=580,top=150,left=250";		setTimeout("window.open('" + turl +  "', 'popupWindow', '" + wchrome + "')", 1);	}}function tsGetSingleName(returnField, specialParameters, isNewDoc) {	if (util){		// use tsDialogs		tsBuildNABPicker(returnField, false, null, "Abbreviate");	} else {		// use old way		var turl = "/" + tsWebDbName() + "/NABPickerSingle?open&returnfield=" + returnField + ((specialParameters) ? specialParameters : "");		var wchrome = "toolbar=no,directories=no,status=no,scrollbars=auto,resizable=yes,resize=yes,"		wchrome += "menubar=no,height=420,width=320,top=150,left=250";		setTimeout("window.open('" + turl +  "', 'popupWindow', '" + wchrome + "')", 1);	}}function tsGetMultiFormattedNames(returnField, specialParameters, nameFormat) {	// allowable formats: CN, Abbreviate, Canonicalize	if (util){		// use tsDialogs		tsBuildNABPicker(returnField, true, null, nameFormat);	} else {		// use old way		var turl = "/" + tsWebDbName() + "/NABPickerMulti?open&returnfield=" + returnField + ((specialParameters) ? specialParameters : "") + "&format=" + nameFormat;		var wchrome = "toolbar=no,directories=no,status=no,scrollbars=auto,resizable=yes,resize=yes,"		wchrome += "menubar=no,height=400,width=580,top=150,left=250";		setTimeout("window.open('" + turl +  "', 'popupWindow', '" + wchrome + "')", 1);	}}function tsGetSingleFormattedName(returnField, specialParameters, nameFormat) {	// allowable formats: CN, Abbreviate, Canonicalize	if (util){		// use tsDialogs		tsBuildNABPicker(returnField, false, null, nameFormat);	} else {		// use old way		var turl = "/" + tsWebDbName() + "/NABPickerSingle?open&returnfield=" + returnField + ((specialParameters) ? specialParameters : "") + "&format=" + nameFormat;		var wchrome = "toolbar=no,directories=no,status=no,scrollbars=auto,resizable=yes,resize=yes,"		wchrome += "menubar=no,height=420,width=320,top=150,left=250";		setTimeout("window.open('" + turl +  "', 'popupWindow', '" + wchrome + "')", 1);	}}function tsRepeatAsArray(valueToRepeat, numberOfIterationsInt) {	var returnVal = new Array("");	for (var i = 0; i < numberOfIterationsInt; i++){		returnVal[i] = valueToRepeat;	}	return returnVal;}function tsName(nameTypeStr, nameArray, hasCountryInt){	// valid values for nameTypeStr are "CN," "Abbreviate," and "Canonicalize"	// hasCountryInt should be an integer (or true or false)	nameArray = tsMakeArray(nameArray);	var curVal;	for (var i = 0; i < nameArray.length; i++){		curVal = nameArray[i];		switch (nameTypeStr){			case "CN":				if (curVal.indexOf("/") > -1){					nameArray[i] = tsLeft(tsReplaceSubstring(nameArray[i], "CN=", ""), "/")[0];				}				break;			case "Abbreviate":				var frArray = new Array("CN=", "OU=", "O=", "C=");				var toArray = new Array("", "", "", "");				if (curVal.indexOf("/") > -1){					nameArray[i] = tsReplaceSubstring(nameArray[i], frArray, toArray)[0];				}				break;			case "Canonicalize":				if (curVal.indexOf("CN=") == -1){					// only if it isn't already in a Canonicalized format					var tempValues = curVal.split("/");					for (var x = 0; x < tempValues.length; x++){						if (x == 0) {							// the first one is CN							tempValues[x] = "CN=" + tempValues[x];						} else if (x == (tempValues.length - 1)) {							// the last one							if (hasCountryInt) {								tempValues[x] = "C=" + tempValues[x];							} else {								tempValues[x] = "O=" + tempValues[x];							}						} else if (x == (tempValues.length - 2)) {							// the next to the last one							if (hasCountryInt) {								tempValues[x] = "O=" + tempValues[x];							} else {								tempValues[x] = "OU=" + tempValues[x];							}						} else {							// all the others are OUs							tempValues[x] = "OU=" + tempValues[x];						}					}					nameArray[i] = tsImplode(tempValues, "/");					}				break;			default:		}	}	return nameArray;}function tsCatList(startingChoices, addedChoices, noNulls){	startingChoices = tsMakeArray(startingChoices);	addedChoices = tsMakeArray(addedChoices);	var n = startingChoices.length;	for (var i = 0; i < addedChoices.length; i++){		startingChoices[i + n] = addedChoices[i];	}	if (noNulls){		startingChoices = tsTrim(startingChoices);	}	return startingChoices;}function tsResetSelectOptions(newChoicesArray, newAliasesArray, fieldObject){	if (typeof fieldObject == "string"){		fieldObject = tsGetFieldObj(fieldObject);	}	if (typeof fieldObject == "object"){		newChoicesArray = tsMakeArray(newChoicesArray);		if (!tsIsArray(newAliasesArray)){			if (newAliasesArray == ""){				// if no aliases specified, use the choices for aliases, too.				newAliasesArray = newChoicesArray;			} else {				newAliasesArray = tsMakeArray(newAliasesArray);			}		}		if (newChoicesArray.length == newAliasesArray.length){			switch (fieldObject.type){				case "select-one":					tsResetSelectVals(newChoicesArray, newAliasesArray, fieldObject);					break;				case "select-multiple":					tsResetSelectVals(newChoicesArray, newAliasesArray, fieldObject);					break;				default:					alert("CODE ERROR: The third parameter of tsResetSelectOptions must be a listbox- or combobox-type field (or the correct name of one as a string).");			}		} else {			alert("CODE ERROR: The arrays provided for values and aliases in the tsResetSelectOptions function must have an equal number of elements.");		}	} else {		alert("CODE ERROR: The third parameter of tsResetSelectOptions must be an OBJECT representing a field, or the correct NAME of a field (as a string).");	}}function tsUnique(startingArray){	if (tsIsArray(startingArray)) {		var retArray = new Array;		var hasVal;		for (i = 0; i < startingArray.length; i++){			if (i ==0){				retArray[0] = startingArray[0];			} else {				hasVal = false;				for (x = 0; x < retArray.length; x++){					if (retArray[x] == startingArray[i]){						hasVal = true;						break;					}				}				if (!hasVal){					retArray[retArray.length] = startingArray[i];				}			}		}		return retArray;	} else {		alert("CODE ERROR: The input parameter of the tsUnique function must be an array.");		return "";	}}function tsExplode(startingValues, separatorString){	return startingValues.split(separatorString);}function tsImplode(startingArray, separatorString){	// startingArray does not have to be an array (although that's really the point of the thing)	startingArray = tsMakeArray(startingArray);	return startingArray.join(separatorString);}function tsIsMember(findArray, fromArray){	// checks to see if ALL members of the test list are members of the main list	var x;	var y;	var isMember = false;	var itemIsMember;	(!tsIsArray(fromArray)) ? fromArray = tsMakeArray(fromArray) : "";	(!tsIsArray(findArray)) ? findArray = tsMakeArray(findArray) : "";	for (y = 0; y < findArray.length; y++){		itemIsMember = false		for (x = 0; x < fromArray.length; x++){			if (fromArray[x] == findArray[y]){				itemIsMember = true;				break;			} 		}		if (!itemIsMember) {			return false;			break;		} else {			isMember = true;		}	}	return isMember;}	function tsIsAnyMember(findArray, fromArray){	// checks to see if ANY ONE member of the test list are members of the main list	var x;	var y;	var isMember = false;	var itemIsMember;	(!tsIsArray(fromArray)) ? fromArray = tsMakeArray(fromArray) : "";	(!tsIsArray(findArray)) ? findArray = tsMakeArray(findArray) : "";	for (y = 0; y < findArray.length; y++){		itemIsMember = false		for (x = 0; x < fromArray.length; x++){			if (fromArray[x] == findArray[y]){				isMember = true;				break;			}		}		if (isMember){			break		}	}	return isMember;}	function tsGetQSParameter(gqs_Param){	// extracts a parameter from the Query_String value of a URL, i.e., in the url,	// http://www.teamsol.com/whatever/db.nsf/docname?open&a=3&b=54&c=active	// this could extract the "3" from the "&a=" parameter, the "54" from the "&b=" parameter	// or the "active" from the "&c=" parameter.	// Correct format: tsGetQSParameter("a");	if (typeof gqs_Param == "string"){		gqs_urlVal = window.location.href + "&";		gqs_paramLoc = gqs_urlVal.indexOf("&" + gqs_Param + "=");		if (gqs_paramLoc > -1){			gqs_nextParam = gqs_urlVal.indexOf("&", gqs_paramLoc + 1);			return gqs_urlVal.substring(gqs_paramLoc + gqs_Param.length + 2, gqs_nextParam);		} else {			return "";		}	} else {		alert("CODE ERROR: The parameter passed into tsGetQSParameter must be a string.");	}}function tsReplaceItemValue(fieldObject, fieldVals){	// the same as doc.ReplaceItemValue except will accept either a field OBJECT or a field NAME.	// sets the value(s) of any type of field.	if (typeof fieldObject == "string"){		fieldObject = tsGetFieldObj(fieldObject);	}	if (typeof fieldObject == "object"){		fieldVals = tsMakeArray(fieldVals);		switch (fieldObject.type) {			case "text":				//...retrieve text value...				fieldObject.value = fieldVals;				break;			case "textarea":				//...retrieve text value...				fieldObject.value = fieldVals;				break;			case "select-one":				//...retrieve single listbox or combobox value...				setSelectFieldValue(fieldObject, fieldVals);				break;			case "select-multiple":				//...retrieve multi-listbox values...				setSelectFieldValue(fieldObject, fieldVals);				break;			case "checkbox":				//...retrieve checkbox values...				setRadioCheckboxValue(fieldObject, fieldVals);				break;			case "radio":				//...retrieve radio values...				setRadioCheckboxValue(fieldObject, fieldVals);				break;			case undefined:				//...retrieve as if radio or checkbox...				setRadioCheckboxValue(fieldObject, fieldVals);				break;		}	} else {		alert("CODE ERROR: The first parameter of tsReplaceItemValue must be an OBJECT representing a field or the correct NAME of the field (as a string).");	}}function tsWord(inputArray, wordSeparator, elementNumber){	// Like TSFormulas (for LotusScript) and the formula language, the elementNumber	// used here starts at 1 (not zero).	// tsWord("A~B~C~D", "~", 1) returns "A"	inputArray = (tsIsArray(inputArray)) ? inputArray : tsMakeArray(inputArray);	var retVal = new Array(inputArray.length);	for (w_i = 0; w_i < inputArray.length; w_i++){		iaSplit = inputArray[w_i].split(wordSeparator);		retVal[w_i] = iaSplit[elementNumber - 1];	}	return retVal;}function tsLeft(sourceArray, searchVal){	sourceArray = tsMakeArray(sourceArray);	var returnArray = new Array(sourceArray.length);	var findLoc;	var lf_i;	for (lf_i = 0; lf_i < sourceArray.length; lf_i++){		if (isNaN(parseInt(searchVal)) || (searchVal + 1 == searchVal + "1")){			findLoc = sourceArray[lf_i].indexOf(searchVal);		} else {			findLoc = searchVal;		}		if (findLoc > -1){			returnArray[lf_i] = sourceArray[lf_i].substr(0, findLoc);		} else {			returnArray[lf_i] = "";		}	}	return returnArray;}function tsLeftBack(sourceArray, searchVal){	sourceArray = tsMakeArray(sourceArray);	var returnArray = new Array(sourceArray.length);	var findLoc;	var lb_i;	for (lb_i = 0; lb_i < sourceArray.length; lb_i++){		if (isNaN(parseInt(searchVal)) || (searchVal + 1 == searchVal + "1")){			findLoc = sourceArray[lb_i].lastIndexOf(searchVal);		} else {			findLoc = sourceArray[lb_i].length - searchVal;		}		if (findLoc > -1){			returnArray[lb_i] = sourceArray[lb_i].substr(0, findLoc);		} else {			returnArray[lb_i] = "";		}	}	return returnArray;}function tsRightBack(sourceArray, searchVal){	sourceArray = tsMakeArray(sourceArray);	var returnArray = new Array(sourceArray.length);	var findLoc;	var rb_i;	for (rb_i = 0; rb_i < sourceArray.length; rb_i++){		if (isNaN(parseInt(searchVal)) || (searchVal + 1 == searchVal + "1")){			findLoc = sourceArray[rb_i].lastIndexOf(searchVal);			if (findLoc > -1) {				 findLoc = findLoc + searchVal.length;			}		} else {			findLoc = searchVal;		}		if (findLoc > -1){			returnArray[rb_i] = sourceArray[rb_i].substr(findLoc);		} else {			returnArray[rb_i] = "";		}	}	return returnArray;}function tsRight(sourceArray, searchVal){	sourceArray = tsMakeArray(sourceArray);	var returnArray = new Array(sourceArray.length);	var findLoc;	var rt_i;	for (rt_i = 0; rt_i < sourceArray.length; rt_i++){		if (isNaN(parseInt(searchVal)) || (searchVal + 1 == searchVal + "1")){			findLoc = sourceArray[rt_i].indexOf(searchVal);			if (findLoc > -1){				findLoc = findLoc + searchVal.length;			}		} else {			findLoc = sourceArray[rt_i].length - searchVal;		}		if (findLoc > -1){			returnArray[rt_i] = sourceArray[rt_i].substr(findLoc);		} else {			returnArray[rt_i] = "";		}	}	return returnArray;}function tsShowObject(objNameStr, documentObj){	// unhides a specified object (such as a <span>). documentObj is optional	if (documentObj) {		if (typeof documentObj == "object"){			documentObj.getElementById(objNameStr).style.display = "block";		} else {			alert("CODE ERROR: The second parameter of tsShowObject must be an object representing the document on which you want to unhide an element. For the current document, you may leave it blank.");		}	} else {		if (document.getElementById(objNameStr)){			document.getElementById(objNameStr).style.display = "block";		}	}}function tsShowInlineObject(objNameStr, documentObj){	// unhides a specified object (such as a <span>). documentObj is optional	if (documentObj) {		if (typeof documentObj == "object"){			documentObj.getElementById(objNameStr).style.display = "inline";		} else {			alert("CODE ERROR: The second parameter of tsShowInlineObject must be an object representing the document on which you want to unhide an element. For the current document, you may leave it blank.");		}	} else {		if (document.getElementById(objNameStr)){			document.getElementById(objNameStr).style.display = "inline";		}	}}function tsHideObject(objNameStr, documentObj){	// hides a specified object (such as a <span>). documentObj is optional	if (documentObj) {		if (typeof documentObj == "object"){			documentObj.getElementById(objNameStr).style.display = "none";		} else {			alert("CODE ERROR: The second parameter of tsHideObject must be an object representing the document on which you want to unhide an element. For the current document, you may leave it blank.");		}	} else {		if (document.getElementById(objNameStr)){			document.getElementById(objNameStr).style.display = "none";		}	}}function tsIsValidNumberCharacter(){	// allows entry of only digits 0-9 or commas, periods, apostrophes	// this allows for European number formats (e.g., 3'122,50) as well as	// American (e.g., 3,122.50)	// used in onKeyPress event: event.returnValue = tsIsValidNumberCharacter();	var key = event.keyCode;	if ((key >= 48 && key <= 57) || key == 44 || key == 46 || key == 39){		return true;	} else {		return false;	}}function tsIsOnlyNumber(){	// allows entry of only digits 0-9	// used in onKeyPress event: event.returnValue = tsIsOnlyNumber();	var key = event.keyCode;	if (key >= 48 && key <= 57){		return true;	} else {		return false;	}}function tsPreventFieldEditing(errorMessageText){	// use in onKeyPress event to stop manual editing of a field	(errorMessageText) ? alert(errorMessageText) : "";	event.returnValue = false;}function tsGetItemValue(fieldObject, failSilentBoolOptl, failureStrOptl){	// the same as doc.GetItemValue except field OBJECT must be passed in, not just field name.	// failSilentBoolOptl allows setting this to not prompt the user with error messages	// failureStrOptl allows defining what to retun on failure	// returns the value(s) from any type of field as an array	if (typeof fieldObject == "string"){		fieldObject = tsGetFieldObj(fieldObject);	}	failSilentBoolOptl = (failSilentBoolOptl) ? failSilentBoolOptl : false;	failureStrOptl = (failureStrOptl) ? failureStrOptl : "";	if (typeof fieldObject == "object"){		var fieldVals = new Array();		switch (fieldObject.type) {			case "text":				//...retrieve text value...				fieldVals[0] = fieldObject.value;				break;			case "textarea":				//...retrieve text value...				fieldVals[0] = fieldObject.value;				break;			case "select-one":				//...retrieve single listbox or combobox value...				fieldVals = getSelectFieldValue(fieldObject, false, fieldVals);				break;			case "select-multiple":				//...retrieve multi-listbox values...				fieldVals = getSelectFieldValue(fieldObject, true, fieldVals);				break;			case "checkbox":				//...retrieve checkbox values...				fieldVals = getRadioCheckboxValue(fieldObject, fieldVals);				break;			case "radio":				//...retrieve radio values...				fieldVals = getRadioCheckboxValue(fieldObject, fieldVals);				break;			case undefined:				//...retrieve as if radio or checkbox...				fieldVals = getRadioCheckboxValue(fieldObject, fieldVals);				break;		}		if (fieldVals.length == 0){			fieldVals[0] = "";		}		return fieldVals;	} else {		if (!failSilentBoolOptl){			alert("CODE ERROR: The parameter for tsGetItemValue should be either a field OBJECT or a valid field NAME (" + fieldObject + ").");		}		return failureStrOptl;	}}function tsReplaceSubstring(inputArray, findArray, replaceArray){	// the same as @ReplaceSubstring	inputArray = tsMakeArray(inputArray);	findArray = tsMakeArray(findArray);	replaceArray = tsMakeArray(replaceArray);	var rss_c = replaceArray.length;	var iA = new Array();	for (rss_a = 0; rss_a < inputArray.length; rss_a++) {		// loops through input values		for (rss_b = 0; rss_b < findArray.length; rss_b++) {			// loops through find and replace values			iA = inputArray[rss_a].split(findArray[rss_b]);			inputArray[rss_a] = iA.join(replaceArray[(rss_b <= rss_c) ? rss_b : rss_c]);		}	}	return inputArray;}function tsReplace(inputArray, findArray, replaceArray){	// the same as @Replace	inputArray = tsMakeArray(inputArray);	findArray = tsMakeArray(findArray);	replaceArray = tsMakeArray(replaceArray);	var re_c = replaceArray.length	for (re_a = 0; re_a < inputArray.length; re_a++) {		// loops through input values		for (re_b = 0; re_b < findArray.length; re_b++) {			if (inputArray[re_a] == findArray[re_b]){				inputArray[re_a] = replaceArray[(re_b <= re_c) ? re_b : re_c];				break;			}		}	}	return inputArray;}function tsIsArray(objectRef){	// checks to see if a value is an array. Returns true or false.	if (typeof objectRef == "object"){		if (objectRef.constructor == String){			return false;		} else {			return true;		}	} else {		return false;	}}function tsMakeArray(inputVal){	// given a value, converts it to an array if it isn't already one	return (tsIsArray(inputVal)) ? inputVal : new Array(inputVal);}function tsGetDate(fieldNameStr, formRefStr, calendarFormat){	if (util){		// use tsDialogs		tsBuildCalendar(fieldNameStr);	} else {		// use old way				// fieldNameStr is the name of the field where the return value is to go ("DueDate")		// formRefStr is optional. Default is document.forms[0] (enter value as a string: "opener.document.forms[0]")		// calendarFormat is optional. Default is MM/DD/YYYY. Other options are as follows (enter the string		// representing the format for the calendarFormat parameter):		//		"MM/DD/YYYY"		//		"MM/DD/YY"		//		"MM-DD-YYYY"		//		"MM-DD-YY"		//		"MON-DD-YYYY"		//		"MON/DD/YYYY"		//		"MON DD, YYYY"		//		"DD/MON/YYYY"		//		"DD/MON/YY"		//		"DD-MON-YYYY"		//		"DD-MON-YY"		//		"DD/MONTH/YYYY"		//		"DD/MONTH/YY"		//		"DD-MONTH-YYYY"		//		"DD-MONTH-YY"		//		"DD/MM/YYYY"		//		"DD/MM/YY"		//		"DD-MM-YYYY"		//		"DD-MM-YY"			var fieldStr;		var fName;		if (formRefStr) {			fieldStr = formRefStr + "." + fieldNameStr;		} else {			fieldStr = "document.forms[0]." + fieldNameStr;		}		calendarFormatTU = (calendarFormat) ? calendarFormat : "";		fName = eval(fieldStr);		//var fName = document.forms[0].YourFieldName;		var a = fName.value;				fName.value = show_calendar(fieldStr + ".value");				if (fName.value=="undefined" || fName.value ==null || fName.value=="") {			fName.value=""		}				if(fName.value==null || fName.value==""){			fName.value=a		}	}}function tsWebDbName() {	var strPath = window.location.pathname;	var idx = strPath.toLowerCase().indexOf(".nsf")	if ( idx > -1 ){		return( strPath.substring(1, idx+4 ))	} else {		return( strPath  )	}}function tsSetCookie(name, value, expires) {		var curCookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + "; path=/";		document.cookie = curCookie;}function tsGetCookie(name){	var dc = document.cookie;	var prefix = name + "=";	var begin = dc.indexOf("; " + prefix);	if (begin == -1){		begin = dc.indexOf(prefix);		if (begin != 0){			return null;		}	} else {		begin += 2;	}	var end = document.cookie.indexOf(";", begin);	if (end == -1){		end = dc.length;	}	var retval = unescape(dc.substring(begin + prefix.length, end));		return (retval == "") ? null : retval;}// ------------ functions which support main tsFormulas functions ---------------function tsResetSelectVals(newValues, newAliases, fieldObject){	// this function supports tsResetSelectOptions	fieldObject.length = newValues.length;	for (var i = 0; i < newValues.length; i++){		fieldObject.options[i].value = newAliases[i];		fieldObject.options[i].text = newValues[i];	}}function setSelectFieldValue(fieldObject, fieldVals){	// supports tsReplaceItemValue	var isSelected;	for (var i = 0; i < fieldObject.length; i++){		curVal = fieldObject.options[i].value;		(curVal == "") ? curVal = fieldObject.options[i].text : "";		isSelected = false;		for (var x = 0; x < fieldVals.length; x++){			if (fieldVals[x] == curVal){				isSelected = true;				break;			}		}		if (isSelected){			fieldObject.options[i].selected = true;		} else {			fieldObject.options[i].selected = false;		}	}}function setRadioCheckboxValue(fieldObject, fieldVals){	// supports tsReplaceItemValue	var isSelected;	if (!fieldObject.value){		for (srv_i = 0; srv_i < fieldObject.length; srv_i++){			curVal = fieldObject[srv_i].value;			isSelected = false;			for (srv_x = 0; srv_x < fieldVals.length; srv_x++){				if (fieldVals[srv_x] == curVal){					isSelected = true;					break;				}			}			if (isSelected){				fieldObject[srv_i].checked = true;			} else {				fieldObject[srv_i].checked = false;			}		}	} else {		fieldObject.checked = false;		for (srv_x = 0; srv_x < fieldVals.length; srv_x++){			if (fieldVals[srv_x] == fieldObject.value){				fieldObject.checked = true;				break;			}		}	}}function getSelectFieldValue(fieldObject, isMultiValue, fieldVals){	// supports tsGetItemValue	firstSelected = fieldObject.selectedIndex;	if (firstSelected > -1){		for (gsv_i = firstSelected; gsv_i < fieldObject.length; gsv_i++){			if (fieldObject.options[gsv_i].selected){				gsv_FieldVal = fieldObject.options[gsv_i].value;				fieldVals[fieldVals.length] = (gsv_FieldVal != "") ? gsv_FieldVal : fieldObject.options[gsv_i].text;				if (!isMultiValue){ break };			}		}	}	return fieldVals;}function getRadioCheckboxValue(fieldObject, fieldVals){	// supports tsGetItemValue	if (!fieldObject.value){		for (grv_i = 0; grv_i < fieldObject.length; grv_i++){			if (fieldObject[grv_i].checked){				fieldVals[fieldVals.length] = fieldObject[grv_i].value;			}		}	} else {		if (fieldObject.checked){			fieldVals[0] = fieldObject.value;		} else {			fieldVals[0] = "";		}	}	return fieldVals;}// -------------------------- end supporting functions ------------------------------// --------------------- start JS date picker support code--------------------------var weekend = [0,6];var weekendColor = "#e0e0e0";var fontface = "Verdana";var fontsize = 2;var calendarFormatTU;var gNow = new Date();var ggWinCal;isNav = (navigator.appName.indexOf("Netscape") != -1) ? true : false;isIE = (navigator.appName.indexOf("Microsoft") != -1) ? true : false;Calendar.Months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];// Non-Leap year Month days..Calendar.DOMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];// Leap year Month days..Calendar.lDOMonth = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];function Calendar(p_item, p_WinCal, p_month, p_year, p_format) {if ((p_month == null) && (p_year == null)) return;if (p_WinCal == null)this.gWinCal = ggWinCal;elsethis.gWinCal = p_WinCal;if (p_month == null) {this.gMonthName = null;this.gMonth = null;this.gYearly = true;} else {this.gMonthName = Calendar.get_month(p_month);this.gMonth = new Number(p_month);this.gYearly = false;}this.gYear = p_year;this.gFormat = p_format;this.gBGColor = "white";this.gFGColor = "black";this.gTextColor = "black";this.gHeaderColor = "black";this.gReturnItem = p_item;}Calendar.get_month = Calendar_get_month;Calendar.get_daysofmonth = Calendar_get_daysofmonth;Calendar.calc_month_year = Calendar_calc_month_year;Calendar.print = Calendar_print;function Calendar_get_month(monthNo) {return Calendar.Months[monthNo];}function Calendar_get_daysofmonth(monthNo, p_year) {/*Check for leap year ..1.Years evenly divisible by four are normally leap years, except for... 2.Years also evenly divisible by 100 are not leap years, except for... 3.Years also evenly divisible by 400 are leap years.*/if ((p_year % 4) == 0) {if ((p_year % 100) == 0 && (p_year % 400) != 0)return Calendar.DOMonth[monthNo];return Calendar.lDOMonth[monthNo];} elsereturn Calendar.DOMonth[monthNo];}function Calendar_calc_month_year(p_Month, p_Year, incr) {/*Will return an 1-D array with 1st element being the calculated month and second being the calculated year after applying the month increment/decrement as specified by 'incr' parameter.'incr' will normally have 1/-1 to navigate thru the months.*/var ret_arr = new Array();if (incr == -1) {// B A C K W A R Dif (p_Month == 0) {ret_arr[0] = 11;ret_arr[1] = parseInt(p_Year) - 1;}else {ret_arr[0] = parseInt(p_Month) - 1;ret_arr[1] = parseInt(p_Year);}} else if (incr == 1) {// F O R W A R Dif (p_Month == 11) {ret_arr[0] = 0;ret_arr[1] = parseInt(p_Year) + 1;}else {ret_arr[0] = parseInt(p_Month) + 1;ret_arr[1] = parseInt(p_Year);}}return ret_arr;}function Calendar_print() {ggWinCal.print();}function Calendar_calc_month_year(p_Month, p_Year, incr) {/* Will return an 1-D array with 1st element being the calculated month and second being the calculated yearafter applying the month increment/decrement as specified by 'incr' parameter.'incr' will normally have 1/-1 to navigate thru the months.*/var ret_arr = new Array();if (incr == -1) {// B A C K W A R Dif (p_Month == 0) {ret_arr[0] = 11;ret_arr[1] = parseInt(p_Year) - 1;}else {ret_arr[0] = parseInt(p_Month) - 1;ret_arr[1] = parseInt(p_Year);}} else if (incr == 1) {// F O R W A R Dif (p_Month == 11) {ret_arr[0] = 0;ret_arr[1] = parseInt(p_Year) + 1;}else {ret_arr[0] = parseInt(p_Month) + 1;ret_arr[1] = parseInt(p_Year);}}return ret_arr;}// This is for compatibility with Navigator 3, we have to create and discard one object before the prototype object exists.new Calendar();Calendar.prototype.getMonthlyCalendarCode = function() {var vCode = "";var vHeader_Code = "";var vData_Code = "";// Begin Table Drawing code here..vCode = vCode + "<table border=0 bgcolor=\"silver\">";  //  " + this.gBGColor + "\">";vHeader_Code = this.cal_header();vData_Code = this.cal_data();vCode = vCode + vHeader_Code + vData_Code;vCode = vCode + "</table>";return vCode;}Calendar.prototype.show = function() {var vCode = "";this.gWinCal.document.open();// Setup the page...this.wwrite("<html>");this.wwrite("<head><title>Calendar</title>");this.wwrite("</head>");this.wwrite("<body bgcolor=\"silver\" " + "link=\"" + this.gLinkColor + "\" " + "vlink=\"" + this.gLinkColor + "\" " +"alink=\"" + this.gLinkColor + "\" " +"text=\"" + this.gTextColor + "\">");this.wwriteA("<font face='" + fontface + "' size=2><b>");this.wwriteA(this.gMonthName + " " + this.gYear);this.wwriteA("</b><br />");// Show navigation buttonsvar prevMMYYYY = Calendar.calc_month_year(this.gMonth, this.gYear, -1);var prevMM = prevMMYYYY[0];var prevYYYY = prevMMYYYY[1];var nextMMYYYY = Calendar.calc_month_year(this.gMonth, this.gYear, 1);var nextMM = nextMMYYYY[0];var nextYYYY = nextMMYYYY[1];this.wwrite("<table width='100%' border=0 cellspacing=0 cellpadding=0><tr><td colspan=5><hr /></td></tr><tr><td align=center>");this.wwrite("<a href=\"" +		"javascript:window.opener.Build(" + 		"'" + this.gReturnItem + "', '" + this.gMonth + "', '" + (parseInt(this.gYear)-1) + "', '" + this.gFormat + "'" +		");" +		"\"><<<\/a></td><td align=center>");	this.wwrite("<a href=\"" +		"javascript:window.opener.Build(" + 		"'" + this.gReturnItem + "', '" + prevMM + "', '" + prevYYYY + "', '" + this.gFormat + "'" +		");" +		"\"><<\/a></td><td align=center>");	this.wwrite("<a href=\"javascript:window.print();\">Print</a></td><td align=center>");	this.wwrite("<a href=\"" +		"javascript:window.opener.Build(" + 		"'" + this.gReturnItem + "', '" + nextMM + "', '" + nextYYYY + "', '" + this.gFormat + "'" +		");" +		"\">><\/a></td><td align=center>");	this.wwrite("<a href=\"" +		"javascript:window.opener.Build(" + 		"'" + this.gReturnItem + "', '" + this.gMonth + "', '" + (parseInt(this.gYear)+1) + "', '" + this.gFormat + "'" +		");" +		"\">>><\/a></td></tr><tr><td colspan=5><hr /></td></tr></table>");// Get the complete calendar code for the month..vCode = this.getMonthlyCalendarCode();this.wwrite(vCode);this.wwrite("</font></body></html>");this.gWinCal.document.close();}Calendar.prototype.showY = function() {var vCode = "";var i;var vr, vc, vx, vy; // Row, Column, X-coord, Y-coordvar vxf = 285; // X-Factorvar vyf = 200; // Y-Factorvar vxm = 10; // X-marginvar vym; // Y-marginif (isIE) vym = 75;else if (isNav) vym = 25;this.gWinCal.document.open();this.wwrite("<html>");this.wwrite("<head><title>Calendar</title>");this.wwrite("<style type='text/css'>\n<!--");for (i=0; i<12; i++) {vc = i % 3;if (i>=0 && i<= 2) vr = 0;if (i>=3 && i<= 5) vr = 1;if (i>=6 && i<= 8) vr = 2;if (i>=9 && i<= 11) vr = 3;vx = parseInt(vxf * vc) + vxm;vy = parseInt(vyf * vr) + vym;this.wwrite(".lclass" + i + " {position:absolute;top:" + vy + ";left:" + vx + ";}");}this.wwrite("-->\n</style>");this.wwrite("</head>");this.wwrite("<body " + "link=\"" + this.gLinkColor + "\" " + "vlink=\"" + this.gLinkColor + "\" " +"alink=\"" + this.gLinkColor + "\" " +"text=\"" + this.gTextColor + "\">");this.wwrite("<font face='" + fontface + "' size=2><b>");this.wwrite("Year : " + this.gYear);this.wwrite("</b><br />");// Show navigation buttonsvar prevYYYY = parseInt(this.gYear) - 1;var nextYYYY = parseInt(this.gYear) + 1;this.wwrite("<TABLE width='100%' BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR='#e0e0e0'><tr><td align=center>");this.wwrite("<<<\/a></td><td align=center>");this.wwrite("Print</td><td align=center>");this.wwrite(">><\/a></td></tr></TABLE><br />");// Get the complete calendar code for each month..var j;for (i=11; i>=0; i--) {if (isIE)this.wwrite("<DIV ID=\"layer" + i + "\" CLASS=\"lclass" + i + "\">");else if (isNav)this.wwrite("<LAYER ID=\"layer" + i + "\" CLASS=\"lclass" + i + "\">");this.gMonth = i;this.gMonthName = Calendar.get_month(this.gMonth);vCode = this.getMonthlyCalendarCode();this.wwrite(this.gMonthName + "/" + this.gYear + "<br />");this.wwrite(vCode);if (isIE)this.wwrite("</DIV>");else if (isNav)this.wwrite("</LAYER>");}this.wwrite("</font><br /></body></html>");this.gWinCal.document.close();}Calendar.prototype.wwrite = function(wtext) {this.gWinCal.document.writeln(wtext);}Calendar.prototype.wwriteA = function(wtext) {this.gWinCal.document.write(wtext);}Calendar.prototype.cal_header = function() {var vCode = "";vCode = vCode + "<tr>";vCode = vCode + "<td width='25' align=center><font size='2' face='" + fontface + "' color='black'><b>S</b></font></td>";vCode = vCode + "<td width='25' align=center><font size='2' face='" + fontface + "' color='black'><b>M</b></font></td>";vCode = vCode + "<td width='25' align=center><font size='2' face='" + fontface + "' color='black'><b>T</b></font></td>";vCode = vCode + "<td width='25' align=center><font size='2' face='" + fontface + "' color='black'><b>W</b></font></td>";vCode = vCode + "<td width='25' align=center><font size='2' face='" + fontface + "' color='black'><b>T</b></font></td>";vCode = vCode + "<td width='25' align=center><font size='2' face='" + fontface + "' color='black'><b>F</b></font></td>";vCode = vCode + "<td width='25' align=center><font size='2' face='" + fontface + "' color='black'><b>S</b></font></td>";vCode = vCode + "</tr>";return vCode;}Calendar.prototype.cal_data = function() {var vDate = new Date();vDate.setDate(1);vDate.setMonth(this.gMonth);vDate.setFullYear(this.gYear);var vFirstDay=vDate.getDay();var vDay=1;var vLastDay=Calendar.get_daysofmonth(this.gMonth, this.gYear);var vOnLastDay=0;var vCode = "";/*Get day for the 1st of the requested month/year..Place as many blank cells before the 1st day of the month as necessary.*/vCode = vCode + "<tr>";for (i=0; i<vFirstDay; i++) {vCode = vCode + "<td width='14%'" + this.write_weekend_string(i) + "><font size='2' face='" + fontface + "'> </font></td>";}// Write rest of the 1st weekfor (j=vFirstDay; j<7; j++) {vCode = vCode + "<td align=center width='14%'" + this.write_weekend_string(j) + "><font size='2' face='" + fontface + "'>" + "<a href='#' " + "onClick=\"self.opener." + this.gReturnItem + "='" + this.format_data(vDay) +"';window.close();\">" + this.format_day(vDay) + "</a>" + "</font></td>";vDay=vDay + 1;}vCode = vCode + "</tr>";// Write the rest of the weeksfor (k=2; k<7; k++) {vCode = vCode + "<tr>";for (j=0; j<7; j++) {vCode = vCode + "<td align=center width='14%'" + this.write_weekend_string(j) + "><font size='2' face='" + fontface + "'>" + "<a href='#' " + "onClick=\"self.opener." + this.gReturnItem + "='" + this.format_data(vDay) +"';window.close();\">" + this.format_day(vDay) + "</A>" + "</font></td>";vDay=vDay + 1;if (vDay > vLastDay) {vOnLastDay = 1;break;}}if (j == 6)vCode = vCode + "</tr>";if (vOnLastDay == 1)break;}// Fill up the rest of last week with proper blanks, so that we get proper square blocksfor (m=1; m<(7-j); m++) {if (this.gYearly)vCode = vCode + "<td align=center width='14%'" + this.write_weekend_string(j+m) + "><font size='2' face='" + fontface + "' color='gray'> </font></td>";elsevCode = vCode + "<td align=center width='14%'" + this.write_weekend_string(j+m) + "><font size='2' face='" + fontface + "' color='gray'>" + m + "</font></td>";}return vCode;}Calendar.prototype.format_day = function(vday) {var vNowDay = gNow.getDate();var vNowMonth = gNow.getMonth();var vNowYear = gNow.getFullYear();if (vday == vNowDay && this.gMonth == vNowMonth && this.gYear == vNowYear)return ("<font color=\"red\"><B>" + vday + "</b></font>");elsereturn (vday);}Calendar.prototype.write_weekend_string = function(vday) {var i;// Return special formatting for the weekend day.for (i=0; i<weekend.length; i++) {if (vday == weekend[i])return (" bgcolor=\"" + weekendColor + "\"");}return "";}Calendar.prototype.format_data = function(p_day) {var vData;var vMonth = 1 + this.gMonth;vMonth = (vMonth.toString().length < 2) ? "0" + vMonth : vMonth;var vMon = Calendar.get_month(this.gMonth).substr(0,3).toUpperCase();var vFMon = Calendar.get_month(this.gMonth).toUpperCase();var vY4 = new String(this.gYear);var vY2 = new String(this.gYear.substr(2,2));var vDD = (p_day.toString().length < 2) ? "0" + p_day : p_day;switch (this.gFormat) {case "MM\/DD\/YYYY" :vData = vMonth + "\/" + vDD + "\/" + vY4;break;case "MM\/DD\/YY" :vData = vMonth + "\/" + vDD + "\/" + vY2;break;case "MM-DD-YYYY" :vData = vMonth + "-" + vDD + "-" + vY4;break;case "MM-DD-YY" :vData = vMonth + "-" + vDD + "-" + vY2;break;case "DD\/MON\/YYYY" :vData = vDD + "\/" + vMon + "\/" + vY4;break;case "MON\/DD\/YYYY" :vData = vMon + "\/" + vDD + "\/" + vY4;break;case "MON DD, YYYY" :vData = vMon + " " + vDD + ", " + vY4;break;case "DD\/MON\/YY" :vData = vDD + "\/" + vMon + "\/" + vY2;break;case "DD-MON-YYYY" :vData = vDD + "-" + vMon + "-" + vY4;case "MON-DD-YYYY" :vData = vMon + "-" + vDD + "-" + vY4;break;case "DD-MON-YY" :vData = vDD + "-" + vMon + "-" + vY2;break;case "DD\/MONTH\/YYYY" :vData = vDD + "\/" + vFMon + "\/" + vY4;break;case "DD\/MONTH\/YY" :vData = vDD + "\/" + vFMon + "\/" + vY2;break;case "DD-MONTH-YYYY" :vData = vDD + "-" + vFMon + "-" + vY4;break;case "DD-MONTH-YY" :vData = vDD + "-" + vFMon + "-" + vY2;break;case "DD\/MM\/YYYY" :vData = vDD + "\/" + vMonth + "\/" + vY4;break;case "DD\/MM\/YY" :vData = vDD + "\/" + vMonth + "\/" + vY2;break;case "DD-MM-YYYY" :vData = vDD + "-" + vMonth + "-" + vY4;break;case "DD-MM-YY" :vData = vDD + "-" + vMonth + "-" + vY2;break;default :vData = vMonth + "\/" + vDD + "\/" + vY4;}return vData;}function Build(p_item, p_month, p_year, p_format) {var p_WinCal = ggWinCal;gCal = new Calendar(p_item, p_WinCal, p_month, p_year, p_format);// Customize your Calendar here..gCal.gBGColor="white";gCal.gLinkColor="black";gCal.gTextColor="black";gCal.gHeaderColor="darkgreen";// Choose appropriate show functionif (gCal.gYearly) gCal.showY();else gCal.show();}function show_calendar() {/* p_month : 0-11 for Jan-Dec; 12 for All Months.p_year : 4-digit yearp_format: Date format (mm/dd/yyyy, dd/mm/yy, ...)p_item : Return Item.*/p_item = arguments[0];if (arguments[1] == null)p_month = new String(gNow.getMonth());elsep_month = arguments[1];if (arguments[2] == "" || arguments[2] == null)p_year = new String(gNow.getFullYear().toString());elsep_year = arguments[2];if (arguments[3] == null)p_format = (calendarFormatTU != "") ? calendarFormatTU : "MM/DD/YYYY";elsep_format = arguments[3];vWinCal = window.open("", "Calendar", "width=180,height=230,status=no,resizable=no,top=200,left=200");vWinCal.opener = self;ggWinCal = vWinCal;Build(p_item, p_month, p_year, p_format);}/*Yearly Calendar Code Starts here*/function show_yearly_calendar(p_item, p_year, p_format) {// Load the defaults..if (p_year == null || p_year == "")p_year = new String(gNow.getFullYear().toString());if (p_format == null || p_format == "")p_format = "MM/DD/YYYY";var vWinCal = window.open("", "Calendar", "scrollbars=yes");vWinCal.opener = self;ggWinCal = vWinCal;Build(p_item, null, p_year, p_format);}// -------------------- end JS date picker support code-------------------------