/********************************************************** global.js Set of JavaScript functions used throughout all databases *********************************************************** The code contained herein contstitutes Medical Office Online, Inc's copyright and is intended for use by its customers and potential customers only. User may not modify, remove, delete, augment, add to, publish, transmit, participate in the transfer or sale of, create derivative works from, or in any way exploit any of the code contained herein, in whole or in part. This Web site is offered to the user conditioned on acceptance by the user without modification of the terms, conditions, and notices contained herein. By accessing and using this Web site, the User is deemed to have agreed to all such terms, conditions, and notices. ***********************************************************/ //bk20090323 var ignoreSaveButtons; var newWindow; //bk20110201 /************************************************************************************ hasRequiredRole returns true if any element of the reqdRoles array equals any element of the hasRoles array. ************************************************************************************/ function hasRequiredRole(reqdRolesStr, hasRolesStr) { var reqdRoles = reqdRolesStr.split("; "); var hasRoles = hasRolesStr.split("; "); for (var i=0; i' else { var popH = 500; var popW = 500; var topPos = (screen.availHeight-popH)/2; var leftPos = (screen.availWidth-popW)/2; window.open(agentPath,"LogActivity",'width='+popW+',height='+popH+',top='+topPos+',left='+leftPos); } } /************************************************************************************ clearUploadControls() clears the values of all upload controls found on the page. ************************************************************************************/ function clearUploadControls() { var inputTags = document.getElementsByTagName("input"); for(var i = 0;i < inputTags.length;i++){ if(inputTags[i].type == "file") { var oldULControl = inputTags[i]; var newULControl = document.createElement("input"); newULControl.type = "file"; newULControl.id = oldULControl.id; newULControl.name = oldULControl.name; oldULControl.parentElement.replaceChild(newULControl,oldULControl); } } } /************************************************************************************ doSaveWithValidation is used to save a document with the fields specified in the vArray being validated before the document is saved. The function also clears any upload controls so that files are not uploaded on a normal save. the function works to save forms without validation as well. arguments: vArray = array of obj - see validate.js for or page with validation in place for help closeWindow = boolean number - if = 1 close the window after validating and saving ************************************************************************************/ function doSaveWithValidation(vArray, closeWindow) { //bk20090323 next two lines to ignore multiple clicks of save button during validation if (ignoreSaveButtons) return false; ignoreSaveButtons = true; var f = document.forms[0]; clearUploadControls(); if(vArray != null) { //form has validation; validate and then save setValidateFieldArray(f); setRequiredFieldStyles(vArray, "requiredField", f.IsOpenForEditing.value,"requiredSelectbox") ; if(validateFields(f, vArray)){ if(closeWindow == 1) f.ReturnOpt.value = "Close"; //sets flag for $$Return else f.ReturnOpt.value = "ReadMode"; //sets flag for $$Return if(window.preSubmitFunction) { //bk20090323 add return false to following four submits to ignore repeated user clicks of Save buttons if(preSubmitFunction() == true) {f.submit(); return false;} } else {f.submit(); return false;} } } else { //form doesn't have validation, just save it if(closeWindow == 1) f.ReturnOpt.value = "Close"; else f.ReturnOpt.value = "ReadMode"; if(window.preSubmitFunction) { if(preSubmitFunction() == true) {f.submit(); return false;} } else {f.submit(); return false;} } //bk20090323 ignoreSaveButtons = false; } /*********************************************************** doEdit opens the current form for editing. if the table has tabs and a currentTab field, doEdit will append the tab id and open to the specified tab ************************************************************/ function doEdit(auditEdit) { var f = document.forms[0]; if (auditEdit) { var url = "/" + f.DatabaseName.value + "/" + auditEdit if(window.currTabNum) { self.location = url + "?OpenForm&TabNum=" + currTabNum + "&ParentUNID=" + f.UNID.value; } else self.location = url + "?OpenForm&ParentUNID=" + f.UNID.value; } else { if(window.currTabNum) { self.location = window.location.pathname + "?EditDocument&TabNum=" + currTabNum; } else self.location = window.location.pathname + "?EditDocument"; } } /*********************************************************** trim is a simple function to remove leading/trailing spaces ************************************************************/ function trim(aStr) { return aStr.replace(/^\s{1,}/, "").replace(/\s{1,}$/, "") } /*********************************************************** arrayRemove() removes an element from an array given the elements value returns the new array without the element ************************************************************/ function arrayRemove(arr, remVal) { var newArr = new Array(); for(var i = 0; i < arr.length; i++) { if(arr[i] != remVal) newArr[newArr.length] = arr[i]; } return newArr } /************************************************************************************** goFirstAnchor() goes to a named anchor within the document that is currenty being viewed. To set a named anchor use the code To go to the anchor simply call the function goFirstAnchor(where) "where" being the name of the anchor. ***************************************************************************************/ function goFirstAnchor(where) { window.location.hash = where } /************************************************************************************** Mouse-Over Pop-Up Windows (www.codeave.com) open_new_window() When a person places their mouse over the link a new window will open up on top of the current browser window. When the mouse pointer is moved off the link the window will close automatically. ***************************************************************************************/ function open_new_window(titletext,text1,text2,text3,text4) { new_window = open("","hoverwindow","width=300,height=200,left=10,top=10"); new_window.document.open(); // open new document // Text of the new document // Replace your " with ' or \" or your document.write statements will fail new_window.document.write(""+titletext+""); new_window.document.write(""); new_window.document.write(text1); new_window.document.write(text2); new_window.document.write(text3); new_window.document.write(text4); new_window.document.write("
"); new_window.document.write(""); new_window.document.close(); // close the document } // This is the function that will close the // new window when the mouse is moved off the link function close_window() { new_window.close(); } /******************************************************************/ /* writeLoadingBarDocument(newWindow) */ /* is passed a new window and writes our loading bar into it. */ /******************************************************************/ function writeLoadingBarDocument(urlStr){ newWindow.document.write("Loading, please wait."+""+"function loading() {var inc = 2;if((parseInt(loadingBar.width) + inc) < parseInt(loadingBarFrame.width)) {loadingBar.width = parseInt(loadingBar.width) + inc; timeOut = (parseInt(loadingBar.width) / parseInt(loadingBarFrame.width)) * 10 * 10;setTimeout('loading()', timeOut);}}
Loading, please wait.
 
"); newWindow.loading(); newWindow.location = urlStr; } /************************************************************************************** pickNum() given a string of digits, returns the first half if frst, else the second half. ***************************************************************************************/ //return the first half or the second half of the string. if an odd length, the shortest string is first, e.g. 910 function pickNum(nums, frst) { remainder = (nums.length % 2); quotient = (nums.length-remainder) / 2; if (frst) return nums.substr(0,quotient); else return nums.substr(quotient); } /************************************************************************************** pickNum() given a load balancer url such as lb910, return either pro9 or pro10 ***************************************************************************************/ function removeLoadBalancer(s) { var prefix = 'lb' var hub = 'hub' var nums; //part1 will be something like http:// var arr = s.split('://'); var part1 = arr[0]+'://'; //part2 will be something like .moo-secure.com/xxx?openyyy arr = arr[1].split('.moo-secure.com'); var part2 = '.moo-secure.com' + arr[1]; //addr will be something like lb910 or lbhub12; var addr = arr[0]; //alert(addr); //don't change anything if it isn't a load balancer url //alert('addr.indexOf(prefix)='+ addr.indexOf(prefix)); if (addr.indexOf(prefix)==0) { // alert('addr.indexOf(hub)='+addr.indexOf(hub)); if (addr.indexOf(hub)>0) { prefix = hub; nums = addr.substr(5); } else { prefix = 'pro'; nums = addr.substr(2); } addr = pickNum(nums, Math.random() > 0.5) } return part1+prefix +addr+part2; } /************************************************************************************** openNewDomWindow() Opens a Domino form or page in a new browser window arguments: bk20080820 if sName="" use field StickyServer if it exists, e.g.pro6.moo-secure.com pathStr = str - the path (after server and db) of the domino document that you want to open winName = null for random text, else practice number is prepended popW = int - the width for the new window popH = int - the height for the new window tbar = str(yes/no) - include the toolbar sbar = str(yes/no) - include scrollbars ***************************************************************************************/ function openNewDomWindow(sName,dName,pathStr,winName,popW,popH,mBar,tBar,sBar,aBar,statusLine,resizeOn,topPos, leftPos) { //bk20080820 set sName to value of parameter or StickyServer if null. //if (sName!="") sName = document.getElementsByName(sName)[0].value; if (sName==""){ if (document.getElementsByName("StickyServer")[0]) sName = document.getElementsByName("StickyServer")[0].value; } else sName = document.getElementsByName(sName)[0].value; dName = document.getElementsByName(dName)[0].value; if(topPos == null) topPos = (screen.availHeight-popH)/2; if(leftPos == null) leftPos = (screen.availWidth-popW)/2; var dfPath; if (document.forms[0].FilePath) { if (document.forms[0].FilePath.value != "") dfPath = "/" + document.forms[0].FilePath.value ; else dfPath = ""; } else dfPath = ""; if (sName=='') { var URLRegExp = /.*\.n[st]f/i; var protocol = location.href.match(URLRegExp); var urlStr = protocol[0] + pathStr; } else { var URLRegExp = /http[s]*/; var protocol = location.href.match(URLRegExp); var urlStr = protocol+"://"+sName+dfPath+"/"+dName+pathStr; } newWindow = window.open(urlStr,winName,'width='+popW+',height='+ popH+',top='+topPos+',left='+leftPos+',menubar='+mBar+',toolbar='+tBar+',scrollbars='+sBar+',location='+aBar+',status='+statusLine+',resizable='+resizeOn); // setTimeout('writeLoadingBarDocument("'+urlStr+'")', 500) //writeLoadingBarDocument(newWindow) //newWindow.location = urlStr; //if (newWindow.opener == null) newWindow.opener = self; //-------------add the child window to the child window array--------- try { //bk 20061214 ignore error. see catch below var currWin = window; var i = 1; while((!currWin.childwindows) && (i < 10)) { i++; if(currWin.opener) { if(!currWin.opener.closed) currWin = currWin.opener; } else if(currWin.parent) currWin = currWin.parent; } if(currWin.childwindows) { currWin.childwindows[currWin.childwindows.length] = newWindow; } }catch (err) {}; //------------------------------------------------------------------- newWindow.focus(); return newWindow; } /************************************************************************************** switchClassByName() This Function changes the class of all elements on the form of one particular name. It only changes the class if the element is not hidden. ***************************************************************************************/ function switchClassByName(objName,newClass) { var objNameArray = document.getElementsByName(objName); for(var i = 0;i < objNameArray.length;i++) { if ((objNameArray[i].type != "hidden") && (objNameArray[i].type != "button")) objNameArray[i].className = newClass; } } /************************************************************************************** doSearch() This Function runs the view search from a $$ViewTemplate arguments: s = string to search for viewToSearch = name of the view that should be searched. ***************************************************************************************/ function doSearch(s, viewToSearch, newEntryForm) { var f = document.forms[0]; var regExp1 = /[(,),<,>,\[,\]]/; var str = s.value; if ( str == "" ) { alert("Please be sure to enter something to search for."); s.focus(); } else { if(regExp1.test( str )){ s.focus(); return alert("Please note that you can not include the following characters in your search query:\n\n[, ], (, ), < or >"); } else if((!isNaN(parseInt(str))) && (str.indexOf('*') == -1)) str = "Field BillingNumber = " + str + " OR " + str; location.href = "/" + f.DatabaseName.value + "/" + viewToSearch + "?SearchView&Query=" + escape( str ) + "&start=1&count=50&NewEntryForm="+newEntryForm; } } /************************************************************************************** textToDate() This Function takes a date and a time string formated as shown below and returns a JavaScript date arguments: date = string - formated as: 1 or 2 digits "/" 1 or 2 digits "/" four digits) time = string - formated as: 1 or 2 digits ":" 2 digits " " AM/PM ***************************************************************************************/ function textToDate(date,time) { var jsVisitDate = new Date(); //calculate and set date portion of jsVisitDate var dateElems = date.split("/"); var month = parseInt(dateElems[0],10); var day = parseInt(dateElems[1],10); var year = parseInt(dateElems[2],10); jsVisitDate.setFullYear(year, month-1, day); //calculate and set time portion of jsVisitDate var colonPos = time.indexOf(":"); var spacePos = time.indexOf(" "); var hour = parseInt(time.substr(0,colonPos),10); var minute = parseInt(time.substr(colonPos+1,2),10); var AmPm = time.substr(spacePos+1,2); if (AmPm == "PM" && hour < 12) hour = hour + 12; jsVisitDate.setHours(hour,minute,0,0); return jsVisitDate; } /************************************************************************************** convertDateToCalDate() This Function takes a date in standard US format and returns it in the domino calendar format. It puts it in the format YYYY-MM-DD and returns it as a string. arguments: date = string - formated as: 1 or 2 digits "/" 1 or 2 digits "/" four digits) ***************************************************************************************/ function convertDateToCalDate(date) { var dateElems = date.split("/"); var month = dateElems[0]; if (month.length == 1) month = "0" + month; var day = dateElems[1]; var year = dateElems[2]; return year + "-" + month + "-" + day; } /************************************************************************************** getDayOfWeek() This Function takes a date in standard US format and returns the day of the week as a number . Weekday numbers are 1 through 7, with Sunday = 1, Monday = 2, and so on. This function is the same as the Formula Function @Weekday. arguments: date = string - formated as: 1 or 2 digits "/" 1 or 2 digits "/" four digits) ***************************************************************************************/ function getDayOfWeek(textDate) { //convert the inputed date to a JS date var newDate = new Date(); var dateElems = textDate.split("/"); var month = parseInt(dateElems[0],10); var day = parseInt(dateElems[1],10); var year = parseInt(dateElems[2],10); newDate.setFullYear(year, month-1, day); return newDate.getDay()+1; } /************************************************************************************** getSelectedRadio() This Function gets a name for a radio button group and returns the selected group member. arguments: groupName = string - the name of the radio button or check box group returns: a radio button object ***************************************************************************************/ function getSelectedRadio(groupName) { var radioArray = document.getElementsByName(groupName); for (var i=0; i < radioArray.length; i++) { if (radioArray[i].checked == true) return radioArray[i]; } return false; } /************************************************************************************** setRadio() This Function gets a name for a radio button group and the value of the radio button to select arguments: groupName = string - the name of the radio button or check box group val = string - the value of the radio group to mark ***************************************************************************************/ function setRadio(groupName, val) { var radioArray = document.getElementsByName(groupName); for (var i=0; i < radioArray.length; i++) { if((radioArray[i].value == val) || (radioArray[i].text == val)) radioArray[i].checked = true; else radioArray[i].checked = false; } return false; } /************************************************************************************ The following function stylizes the totals column ***********************************************************************************/ function setTotalsRowStyle() { var f = document.forms[0]; if(f.EndCount.value == f.TotalDocs.value) { var tableTag = document.all.viewDIV.getElementsByTagName("TABLE")[0]; if(tableTag) { var rows = tableTag.getElementsByTagName("TR"); var totalCells = rows[rows.length-1].getElementsByTagName("TD") totalCells[0].innerHTML = "Totals" for(i=0; i < totalCells.length; i++) { var fontTags = totalCells[i].getElementsByTagName("FONT"); for(k=0; k < fontTags.length; k++) { var tempStr = fontTags[k].innerHTML; totalCells[i].removeChild(fontTags[k]); totalCells[i].innerHTML = tempStr; } totalCells[i].className = "viewTotals"; } } } } /*********************************************************************************** compDomSelect() This Function performs a comparison of the value of a field with a passed value. And returns a boolean value that results from the comparison. The catch is that the type of field could either be a select list or a text field. This is used to check the value of a select list on domino tabbed tables, where the field becomes a hidden field when on a different tab. arguments: fieldNameStr = string - the name of the field compOpStr = string - the comparison operator (valid values are "==","!=",">","<",">=","<=" valueStr = string - the value to compare the field with ************************************************************************************/ function compDomSelect(fieldNameStr, compOpStr,valueStr) { var obj = document.getElementsByName(fieldNameStr)[0] var retValBool = false var objValStr = "" if(obj.type == "hidden") objValStr = obj.value; else objValStr = obj.options[obj.selectedIndex].innerHTML switch (compOpStr){ case "==": if(objValStr == valueStr) retValBool = true; break case "!=": if(objValStr != valueStr) retValBool = true; break case ">": if(objValStr > valueStr) retValBool = true; break case "<": if(objValStr < valueStr) retValBool = true; break case ">=": if(objValStr >= valueStr) retValBool = true; break case "<=": if(objValStr <= valueStr) retValBool = true; break default: break } return retValBool } /*********************************************************************************** getDomSelectVal() This function returns the selected value of a domino select list. It works regardless of whether the form is in read or in edit mode. arguments: objName = string - the name of the select list object valOrTxt = string - whether to return the .value or .text if in edit mode returns: the value or text of the object ************************************************************************************/ function getDomSelectVal(objName,valOrTxt) { obj = document.getElementsByName(objName)[0]; //bk20080819 check if present if (obj) { if((obj.type == "text") || (obj.type == "hidden")) return obj.value; else { if(valOrTxt == "text") return obj.options[obj.selectedIndex].text else return obj.options[obj.selectedIndex].value } } } /*********************************************************************************** setSelectVal() This function sets the selectedIndex of a select list. It does it based on the text or the value of the option in the list arguments: objName = string - the name of the select list object valOrTxt = string - whether to return the .value or .text if in edit mode setVal = string - the value to set the object to; returns: true or false if the value was found ************************************************************************************/ function setSelectVal(objName,setVal, valOrTxt) { var obj = document.getElementsByName(objName)[0]; var i = 0; var foundBool = false; while((foundBool == false) && (i < obj.options.length)) { if(valOrTxt == "text") { if(obj.options[i].text == setVal) { foundIndex = i; foundBool = true; } } else { if(obj.options[i].value == setVal) { foundIndex = i; foundBool = true; } } i++; } if(foundBool == true) { obj.selectedIndex = foundIndex; return true; } else return false; } /*********************************************************************************** formatTextDate() This function is called onBlur of a date text field. If the field has 8 digits with no "/" then the "/"s are added to format the date as "01/01/2001" arguments: textField = obj - the object whose value is to be formated ************************************************************************************/ function formatTextDate(textField) { var re0 = /[0-9]{2}\/[0-9]{2}\/[0-9]{4}/; //properly formatted date var re1 = /[0-9]{1,8}/g; //global get all numbers var re2 = /^[0-9]{8}$/; //match 8 digits var re3 = /^[0-9]{6}$/; //match 6 digits if(!re0.test(textField.value)) { var numArr = textField.value.match(re1); if(numArr != null) { var numStr = numArr.join(""); if(re2.test(numStr)){ var comp1 = numStr.substr(0,2); var comp2 = numStr.substr(2,2); var comp3 = numStr.substr(4,4); textField.value = comp1 +"/"+ comp2 +"/"+ comp3; } if(re3.test(numStr)) { var comp1 = "0" + numStr.substr(0,1); var comp2 = "0" + numStr.substr(1,1); var comp3 = numStr.substr(2,4); textField.value = comp1 +"/"+ comp2 +"/"+ comp3; } } } return false ; } /*********************************************************************************** formatBirthDate() This function is called onBlur of a birthdate field. If the field has 8 digits with no "/" then the "/"s are added to format the date as "01/01/2001" arguments: textField = obj - the object whose value is to be formated ************************************************************************************/ function formatBirthDate(textField) { var re0 = /[0-9]{2}\/[0-9]{2}\/[0-9]{4}/; //properly formatted date var re1 = /[0-9]{1,8}/g; //global get all numbers var re2 = /^[0-9]{8}$/; //match 8 digits var re3 = /^[0-9]{6}$/; //match 6 digits if(!re0.test(textField.value)) { var numArr = textField.value.match(re1); if(numArr != null) { var numStr = numArr.join(""); if(re2.test(numStr)){ var comp1 = numStr.substr(0,2); var comp2 = numStr.substr(2,2); var comp3 = numStr.substr(4,4); textField.value = comp1 +"/"+ comp2 +"/"+ comp3; } if(re3.test(numStr)) { if((numStr.substr(2,2) == "19") || (numStr.substr(2,2) == "20")) { var comp1 = "0" + numStr.substr(0,1); var comp2 = "0" + numStr.substr(1,1); var comp3 = numStr.substr(2,4); textField.value = comp1 +"/"+ comp2 +"/"+ comp3; } else { var now = new Date(); var thisYear = now.getFullYear(); var comp1 = numStr.substr(0,2); var comp2 = numStr.substr(2,2); if(parseInt(numStr.substr(4,2),10) > (thisYear-2000)) var comp3 = "19" + numStr.substr(4,2) else var comp3 = "20" + numStr.substr(4,2) textField.value = comp1 +"/"+ comp2 +"/"+ comp3; } } } } return false ; } /*********************************************************************************** formatRecentDate() This function is called onBlur of a field that represents something that has been done recently. The year is assumed to be 20__ if the year is the two digit year is the current year or earlier. Otherwise the If the field has 8 digits with no "/" then the "/"s are added to format the date as "01/01/2001" arguments: textField = obj - the object whose value is to be formated ************************************************************************************/ function formatRecentDate(textField) { var re0 = /[0-9]{2}\/[0-9]{2}\/[0-9]{4}/; //properly formatted date var re1 = /[0-9]{1,8}/g; //global get all numbers var re2 = /^[0-9]{8}$/; //match 8 digits var re3 = /^[0-9]{6}$/; //match 6 digits if(!re0.test(textField.value)) { var numArr = textField.value.match(re1); if(numArr != null) { var numStr = numArr.join(""); if(re2.test(numStr)){ var comp1 = numStr.substr(0,2); var comp2 = numStr.substr(2,2); var comp3 = numStr.substr(4,4); textField.value = comp1 +"/"+ comp2 +"/"+ comp3; } if(re3.test(numStr)) { if((numStr.substr(2,2) == "19") || (numStr.substr(2,2) == "20")) { var comp1 = "0" + numStr.substr(0,1); var comp2 = "0" + numStr.substr(1,1); var comp3 = numStr.substr(2,4); textField.value = comp1 +"/"+ comp2 +"/"+ comp3; } else { var now = new Date(); var thisYear = now.getFullYear(); var comp1 = numStr.substr(0,2); var comp2 = numStr.substr(2,2); if(parseInt(numStr.substr(4,2),10) > (thisYear-2000)) var comp3 = "19" + numStr.substr(4,2) else var comp3 = "20" + numStr.substr(4,2) textField.value = comp1 +"/"+ comp2 +"/"+ comp3; } } } } return false ; } /************************************************************************************** formatUSPhone() This function is called onBlur of a phone text field. If the field has 10 digits with no "-" then the "-"s are added to format the phone number as "000-000-0000" arguments: textField = obj - the object whose value is to be formated ***************************************************************************************/ function formatUSPhone(textField) { var re = /^[0-9]{10}$/; if (re.test(textField.value)){ var comp1 = textField.value.substr(0,3); var comp2 = textField.value.substr(3,3); var comp3 = textField.value.substr(6,4); textField.value = comp1 +"-"+ comp2 +"-"+ comp3; } else {return false;} ; } /************************************************************************************** formatSSN() This function is called onBlur of a Social Security Number text field. If the field has 9 digits with no "-" then the "-"s are added to format the SSN as "000-00-0000" arguments: textField = obj - the object whose value is to be formated ***************************************************************************************/ function formatSSN(textField) { var re = /^[0-9]{9}$/; if (re.test(textField.value)){ var comp1 = textField.value.substr(0,3); var comp2 = textField.value.substr(3,2); var comp3 = textField.value.substr(5,4); textField.value = comp1 +"-"+ comp2 +"-"+ comp3; } else {return false;} ; } /*********************************************************************************** switchTabs() This functions switches which DHTML tab is active newTabNum = string - the number of the tab that is to be switched to NOTE: currTabNum is a global variable that should be set onLoad. ***********************************************************************************/ function switchTabs(newTabNum) { //bk20090617 force to tab 1 if prev tab is out of range if (document.getElementById("tab"+newTabNum)==null) newTabNum='1'; var tabBodyDivObj = document.getElementById("tabBody"+newTabNum); if(tabBodyDivObj) { if(tabBodyDivObj.style.display != "block") { //-----------------------Does subtabs--------------------------- if(newTabNum.indexOf(".") != -1) { if(currTabNum.indexOf(".") != -1) { //hide the previous tab if it is on the same level document.getElementById("tabBody"+currTabNum).style.display = "none"; } else if(currTabNum.indexOf(".") == -1) { //if the tab clicked is a subtab and the tab before it was an //upper level tab, hide all of the subtab bodies var i = 1; var tBody = document.getElementById("tabBody"+currTabNum+"."+i) while(tBody != null) { tBody.style.display = "none"; i++; tBody = document.getElementById("tabBody"+currTabNum+"."+i) } document.getElementById("tabBody"+currTabNum+".1").style.display = "none"; } //show the new tab document.getElementById("tabBody"+newTabNum).style.display = "block"; //switch the tab styles document.getElementById("tab"+newTabNum).className = "activeTab2"; var tl = newTabNum.substring(0,newTabNum.indexOf(".")); //top level(tl) num var i = 1; var tabElem = document.getElementById("tab"+tl+"."+i); while(tabElem != null) { if((tl+"."+i) != newTabNum) tabElem.className = "inactiveTab2"; i++; tabElem = document.getElementById("tab"+tl+"."+i); } } //-----------------------Does top level tabs--------------------------- else { if(currTabNum.indexOf(".") != -1) { //turn the subtabs off from the previous tab var tl = currTabNum.substring(0,currTabNum.indexOf(".")); //top level(tl) num document.getElementById("tabBody"+tl).style.display = "none"; } else { document.getElementById("tabBody"+currTabNum).style.display = "none"; } //switch the visible tab body document.getElementById("tabBody"+newTabNum).style.display = "block"; //switch the tab styles document.getElementById("tab"+newTabNum).className = "activeTab"; var i = 1; var tabElem = document.getElementById("tab"+i); while(tabElem != null) { if( i != newTabNum) tabElem.className = "inactiveTab"; i++; tabElem = document.getElementById("tab"+i); } } currTabNum = newTabNum; document.forms[0].ReturnTab.value = newTabNum; } } } /************************************************************************************** openHelp() This functions opens the context sensitive help **************************************************************************************/ function openHelp(helpKey) { var f = document.forms[0]; var windowWidth = 800; var windowHeight = 600; var leftPos = (screen.availWidth-windowWidth)/2; var topPos = (screen.availHeight-windowHeight)/2; var docPath = "/MOOHelp/MOOHelp.nsf/Main+Frameset?ReadForm&HelpKey="+helpKey; var helpWin = window.open(docPath,'help','width='+windowWidth+',height='+windowHeight+',top=45,left=200,menubar=no,toolbar=no,scrollbars=yes,location=no,status=no,resizable=yes'); helpWin.focus(); } /************************************************************************************** getSelectedOption() This functions returns the selected