// misc utility functions for javascript // appends the session id parameter to the popup dest URL // to work around issues when running inside the Outlook container function appendSessionIdParam(dest) { var retVal = dest; if (dest.indexOf('?') > -1) { retVal = retVal + "&" + sessIdParamStr; } else { retVal = retVal + "?" + sessIdParamStr; } return retVal; } // all parameters should be strings, use "yes" or "no" for booleans // the "name" parameter is optional and should be used to popup multiple windows function launchWin(dest, width, height, showToolbar, showMenubar, showStatusbar, showScrollbars, showLocation, isResizable, name) { if (!name) name = "popup" popUp = window.open(appendSessionIdParam(dest), name, "width=" + width + "," + "height=" + height + "," + "toolbar=" + showToolbar + "," + "menubar=" + showMenubar + "," + "status=" + showStatusbar + "," + "scrollbars=" + showScrollbars + "," + "location=" + showLocation + "," + "resizable=" + isResizable); popUp.focus(); } // all parameters should be strings, use "yes" or "no" for booleans // the "name" parameter is optional and should be used to popup multiple windows // (just like launchWin but we don't append a session id param - // useful for popping up attachments, or other URLs that shouldn't see the &jsessionid=XXXX param) function launchWinNoSessionId(dest, width, height, showToolbar, showMenubar, showStatusbar, showScrollbars, showLocation, isResizable, name) { if (!name) name = "popup" popUp = window.open(dest, name, "width=" + width + "," + "height=" + height + "," + "toolbar=" + showToolbar + "," + "menubar=" + showMenubar + "," + "status=" + showStatusbar + "," + "scrollbars=" + showScrollbars + "," + "location=" + showLocation + "," + "resizable=" + isResizable); popUp.focus(); } // launches window positioned in the center of the screen // all parameters should be strings, use "yes" or "no" for booleans // the "name" parameter is optional and should be used to popup multiple windows function launchWinCS(dest, width, height, showToolbar, showMenubar, showStatusbar, showScrollbars, showLocation, isResizable, name) { if (!name) name = "popup" var winL = ((screen.width / 2) - (width / 2)); var winT = ((screen.height / 2) - (height / 2)); popUp = window.open(appendSessionIdParam(dest), name, "width=" + width + "," + "height=" + height + "," + "left=" + winL + "," + "top=" + winT + "," + "toolbar=" + showToolbar + "," + "menubar=" + showMenubar + "," + "status=" + showStatusbar + "," + "scrollbars=" + showScrollbars + "," + "location=" + showLocation + "," + "resizable=" + isResizable); popUp.focus(); } // launches window positioned in the center of the screen // all parameters should be strings, use "yes" or "no" for booleans // the "name" parameter is optional and should be used to popup multiple windows // (just like launchWinCS but we don't append a session id param - // useful for popping up attachments, or other URLs that shouldn't see the &jsessionid=XXXX param) function launchWinCSNoSessionId(dest, width, height, showToolbar, showMenubar, showStatusbar, showScrollbars, showLocation, isResizable, name) { if (!name) name = "popup" var winL = ((screen.width / 2) - (width / 2)); var winT = ((screen.height / 2) - (height / 2)); popUp = window.open(dest, name, "width=" + width + "," + "height=" + height + "," + "left=" + winL + "," + "top=" + winT + "," + "toolbar=" + showToolbar + "," + "menubar=" + showMenubar + "," + "status=" + showStatusbar + "," + "scrollbars=" + showScrollbars + "," + "location=" + showLocation + "," + "resizable=" + isResizable); popUp.focus(); } // Help var strHelpOptions = "location=no"; strHelpOptions += ",toolbar=no"; strHelpOptions += ",menubar=no"; strHelpOptions += ",status=yes"; strHelpOptions += ",scrollbars=yes"; strHelpOptions += ",resizable=yes"; strHelpOptions += ",top=20"; strHelpOptions += ",left=20"; strHelpOptions += ",width=481"; strHelpOptions += ",height=322"; function getHelp(helpCd) { var strURL = '/help_popup.jsp?hcd=' + helpCd; window.open(appendSessionIdParam(strURL), "helpWindow", strHelpOptions); } // handles alerting the user of too many characters in a field function doLimitLength(field, maxLen, fieldName) { if (field.value.length > maxLen) { alert('You have exceded ' + maxLen + ' characters for the ' + fieldName + ' field. Please delete at least ' + (field.value.length - maxLen) + ' character(s).'); field.focus(); return false; } else { return true; } } // spell check function function spellCheckField(field) { field.value = this.document.applets.appletJSpell.doCheck(field.value); this.document.applets.appletJSpell.finish(); } // spell check function that checks the length after running the spellcheck applet function spellCheckFieldLimitLength(field, maxLen, fieldName) { field.value = this.document.applets.appletJSpell.doCheck(field.value); this.document.applets.appletJSpell.finish(); doLimitLength(field, maxLen, fieldName); } // used for date selection forms function setDays(mf, df, yf, topBlank) { var m; var y; var idxCheck = (topBlank) ? 1 : 0; if (!mf || mf.selectedIndex < idxCheck) { m = 1; } else { m = mf.options[mf.selectedIndex].value; } if (!yf || yf.selectedIndex < idxCheck) { y = 2002; } else { y = yf.options[yf.selectedIndex].value; } var nd = 31 + idxCheck; if (m == 4 || m == 6 || m == 9 || m == 11) { nd -= 1; } else if (m == 2) { if ((y % 400 == 0) || ((y % 4 == 0) && (y % 100 != 0))) nd -= 2; else nd -= 3; } var prevDaySel = df.selectedIndex; while (df.options.length < nd) { var nextDay; if (topBlank) nextDay = df.options.length; else nextDay = df.options.length + 1; df.options[df.options.length] = new Option(nextDay, nextDay); } if (df.options.length > nd) df.options.length = nd; if (prevDaySel >= df.options.length) df.selectedIndex = df.options.length - 1; } // avoid EOLAS patent (according to MS) by writing Spellcheck applet from separate file function loadSpellChecker(siteURL, learnWordsVal) { alert("starting writing"); this.document.write(""); this.document.write(""); this.document.write(""); this.document.write(""); alert("done writing"); } // returns true if the passed elem is contained in the passed Array function isElemInArray(elem, array) { if (array == null) return false; for (var x=0; x