/** Global Javascript **/ var isIE = document.all?true:false; var isNS = document.layers?true:false; var omxContextPath = null; var returnUrl = null; var selectedNode = null; /* Vertical Tree Functions */ function clickNode(node) { if ( node.open == 'never') { //Just sleep } else { if(node.open == "false") { expand(node, true); } else { collapse(node); } } selectedNode = node; window.event.cancelBubble = "true"; } function expand(node) { var stateImage; var oImage stateImage = document.all["stateImage" + node.id]; oImage = node.childNodes(0).all["image"] oImage.src = node.imageOpen if(stateImage) { stateImage.src = stateImage._open; } for(i=0; i < node.childNodes.length; i++) { if(node.childNodes(i).tagName == "DIV") { node.childNodes(i).style.display = "block"; } } node.open = "true" } function collapse(node) { var stateImage; var oImage var i stateImage = document.all["stateImage" + node.id]; oImage = node.childNodes(0).all["image"] oImage.src = node.image if(stateImage) { stateImage.src = stateImage._closed; } for(i=0; i < node.childNodes.length; i++) { if(node.childNodes(i).tagName == "DIV") { if(node.id != "folderTree") node.childNodes(i).style.display = "none" //collapse(node.childNodes(i)) } } node.open = "false" } function expandAll(node) { var oImage var i expand(node, false) for(i=0; i < node.childNodes.length; i++) { if(node.childNodes(i).tagName == "DIV") { expandAll(node.childNodes(i)) } } } /* Vertical Tree related functions */ /* omxSetContextPath() defines the context path directory that js files would use. Compatibility: IE, NS6, NS4 */ function omxSetContextPath(contextPath) { omxContextPath = contextPath; } function validateZipCode(e) { var _ret = true; if (isIE) { if ((window.event.keyCode == 45)||(window.event.keyCode > 46 && window.event.keyCode < 58)) { _ret = true; }else { window.event.keyCode = 0; _ret = false; } } if (isNS) { if ((e.which == 45 )||(e.which > 46 && e.which < 58)) { _ret = true; }else { e.which = 0; _ret = false; } } return (_ret); } /** Trim Function **/ function trimString (str) { str = this != window? this : str; return str.replace(/^\s+/g, '').replace(/\s+$/g, ''); } String.prototype.trim = trimString; /** Debug Function **/ function objectToString(obj) { var ret = "Object " + obj.name + " is ["; for (var prop in obj) ret += " " + prop + " is " + obj[prop] + ";" ; return ret + "]" } function core_prompt(fieldLabel, pageTitle) { var rc = i2uiShowMessageBox(omxContextPath + "/core/prompt/controller/display.x2c?FIELD_LABEL="+escape(fieldLabel)+"&PAGE_TITLE="+escape(pageTitle)+"&TYPE=success",150,350); return rc ; } function core_success(msg) { var rc = i2uiShowMessageBox(omxContextPath + "/core/alert/controller/display.x2c?MESSAGE="+escape(msg)+"&TYPE=success",150,350); return rc ; } /* Handles extra parameters as arguments to the message string. Ex. core_alert(msg, arg0, arg1, arg2, ...); */ function core_alert(msg) { var arg_val; for(var i=1; i0) { window.popUp2.focus(); return; } else { window.popUp2.close(); } } window.popUp2 = window.open(omxContextPath + "/core/blank.jsp",popUp,'height=450, width=600, scrollbars=yes, resizable=yes'); for (var i=0; i<5000; i++) { if (window.popUp2) { window.popUp2.location = url; i = 5000; } } } else if (popUp=="orderTree") { // popUp2 is used for the address book if ( (window.orderTree != null) && (!window.orderTree.closed) ) // MAB: changed top.window.orderTree to window.orderTree. { var windowURL = window.orderTree.location.href.toString(); if (windowURL.indexOf(url)>0) { window.orderTree.focus(); return; } else { window.orderTree.close(); } } window.orderTree = window.open(omxContextPath + "/core/blank.jsp",popUp,'height=450, width=600, scrollbars=no, resizable=yes'); for (var i=0; i<5000; i++) { if (window.orderTree) { window.orderTree.location = url; i = 5000; } } } else if (popUp=="catalogPopup") { popW = 800; popH = 450; bScrollbars = "yes"; bResizable="no"; leftPos = (w-popW)/2; topPos = (h-popH)/2; if ( (window.catalogPopup != null) && (!window.catalogPopup.closed) ) { var windowURL = window.catalogPopup.location.href.toString(); if (windowURL.indexOf(url)>0) { window.catalogPopup.focus(); return; } else { window.catalogPopup.close(); } } window.catalogPopup = window.open(omxContextPath + "/core/blank.jsp",popUp,'height= '+ popH + ', width= ' + popW + ', top=' + topPos + ', left=' + leftPos + ', scrollbars= ' + bScrollbars + ', resizable= ' + bResizable); for (var i=0; i<5000; i++) { if (window.catalogPopup) { window.catalogPopup.location = url; i = 5000; } } } else if (popUp=="configurePopup") { popW = 570; popH = 300; bScrollbars = "yes"; bResizable="no"; leftPos = (w-popW)/2; topPos = (h-popH)/2; if ( (window.catalogPopup != null) && (!window.catalogPopup.closed) ) { var windowURL = window.catalogPopup.location.href.toString(); if (windowURL.indexOf(url)>0) { window.catalogPopup.focus(); return; } else { window.catalogPopup.close(); } } window.catalogPopup = window.open(omxContextPath + "/core/blank.jsp",popUp,'height= '+ popH + ', width= ' + popW + ', top=' + topPos + ', left=' + leftPos + ', scrollbars= ' + bScrollbars + ', resizable= ' + bResizable); for (var i=0; i<5000; i++) { if (window.catalogPopup) { window.catalogPopup.location = url; i = 5000; } } } else if (popUp=="absePopup") { popW = 800; popH = 450; bScrollbars = "yes"; bResizable="no"; leftPos = (w-popW)/2; topPos = (h-popH)/2; if ( (window.absePopup != null) && (!window.absePopup.closed) ) { if (windowURL.indexOf(url)>0) { window.absePopup.focus(); return; } else { window.absePopup.close(); } } window.absePopup = window.open(omxContextPath + "/core/blank.jsp",popUp,'height= '+ popH + ', width= ' + popW + ', top=' + topPos + ', left=' + leftPos + ', scrollbars= ' + bScrollbars + ', resizable= ' + bResizable); for (var i=0; i<5000; i++) { if (window.absePopup) { window.absePopup.location = url; i = 5000; } } } else if (popUp=="orderPopup") { popW = 800; popH = 500; bScrollbars = "no"; bResizable="no"; leftPos = (w-popW)/2; topPos = (h-popH)/2; if ( (window.orderPopup != null) && (!window.orderPopup.closed) ) { var windowURL = window.orderPopup.location.href.toString(); if (windowURL.indexOf(url)>0) { window.orderPopup.focus(); return; } else { window.orderPopup.close(); } } window.orderPopup = window.open(omxContextPath + "/core/blank.jsp",popUp,'height= '+ popH + ', width= ' + popW + ', top=' + topPos + ', left=' + leftPos + ', scrollbars= ' + bScrollbars + ', resizable= ' + bResizable); for (var i=0; i<5000; i++) { if (window.orderPopup) { window.orderPopup.location = url; i = 5000; } } } else if (popUp=="popUp3") { // popUp3 is used for the save menu, email, and fax if (window.popUp3) { window.popUp3.close(); } window.popUp3 = window.open(escapeUrlParamValues(url),popUp,'height=275,width=400, scrollbars=yes, resizable=no'); } else if (popUp=="popUp4") { // popUp4 is used for help window popW = 800; popH = 600; bScrollbars = "yes"; bResizable="yes"; leftPos = (w-popW)/2; topPos = (h-popH)/2; if (window.popUp4) { window.popUp4.close(); } window.popUp4 = window.open(escapeUrlParamValues(url),'popUp4','height= '+ popH + ', width= ' + popW + ', top=' + topPos + ', left=' + leftPos + ', scrollbars= ' + bScrollbars + ', resizable= ' + bResizable); } else if (popUp=="popUp5") { // popUp5 used for alerts popW = 390; popH = 130; leftPos = (w-popW)/2; topPos = (h-popH)/2; if (window.popUp5) { window.popUp5.close(); } window.popUp5 = window.open(escapeUrlParamValues(url),popUp,'height=130, width=390, top=' + topPos + ', left=' + leftPos + ', scrollbars=no, resizable=no'); } else if (popUp=="alertPopup") { // alertPopup used for alerts popW = 390; popH = 130; leftPos = (w-popW)/2; topPos = (h-popH)/2; if (window.alertPopup) { window.alertPopup.close(); } window.alertPopup = window.open(escapeUrlParamValues(url),popUp,'height=120, width=332, top=' + topPos + ', left=' + leftPos + ', scrollbars=no, resizable=no'); } else if (popUp=="popUp6") { // popUp5 used for alerts popW = 390; popH = 130; leftPos = (w-popW)/2; topPos = (h-popH)/2; if (window.popUp6) { window.popUp6.close(); } window.popUp6 = window.open(escapeUrlParamValues(url),popUp,'height=130, width=390, top=' + topPos + ', left=' + leftPos + ', scrollbars=no, resizable=no'); } else if (popUp=="planPopUp") { // popUp2 is used for showing history if (window.planPopUp && !window.planPopUp.closed) { var windowURL = window.planPopUp.location.href.toString(); if (windowURL.indexOf(url)>0) { window.planPopUp.focus(); return; } else { window.planPopUp.close(); } } window.planPopUp = window.open(omxContextPath + "/core/blank.jsp",popUp,'height=410, width=800, scrollbars=yes, resizable=yes'); for (var i=0; i<5000; i++) { if (window.planPopUp) { window.planPopUp.location = url; i = 5000; } } } else if (popUp=="lotDetailsPopUp") { // popUp2 is used for adding/viewing serial and lot numbers if (window.lotDetailsPopUp && !window.lotDetailsPopUp.closed) { var windowURL = window.lotDetailsPopUp.location.href.toString(); if (windowURL.indexOf(url)>0) { window.lotDetailsPopUp.focus(); return; } else { window.lotDetailsPopUp.close(); } } window.lotDetailsPopUp = window.open(omxContextPath + "/core/blank.jsp",popUp,'height=350, width=680, scrollbars=yes, resizable=yes'); for (var i=0; i<5000; i++) { if (window.lotDetailsPopUp) { window.lotDetailsPopUp.location = url; i = 5000; } } } } function escapeUrlParamValues(url) { var queryStrIndex = url.indexOf("?"); var urlPath = url.substring(0, queryStrIndex); if (queryStrIndex > -1) { urlPath += "?"; var queryStr = url.substring(queryStrIndex+1, url.length); var keyValuePairs = queryStr.split("&"); for(var i=0; i < keyValuePairs.length; i++) { keyValuePair = keyValuePairs[i].split("="); var param = keyValuePair[0]; var value = escape(keyValuePair[1]); urlPath += (param + "=" +value); if (i+1 < keyValuePairs.length) { urlPath += "&"; } } } return urlPath; } /** checks to see if any popUp windows are currently open - if so, sets the focus to the popUp **/ function checkForPopUps() { if (top.window.popUp2 && !top.window.popUp2.closed) top.window.popUp2.focus(); else if (top.window.popUp3 && !top.window.popUp3.closed) top.window.popUp3.focus(); else if (top.window.lotDetailsPopUp && !top.window.lotDetailsPopUp.closed) top.window.lotDetailsPopUp.focus(); // else if (top.window.popUp4 && !top.window.popUp4.closed) top.window.popUp4.focus(); } /** if the F2 key is pressed, the form is submitted. **/ function mappedKeyCheck() { if (event.keyCode==113) { // document.inputForm.submit(); parent.footer.nextTab(parent.footer.array_tabs); } } /** moves from one horizontal tab to the next, closes the window when last tab is reached **/ function nextTab(array_tabs) { for (var i=0; i0) { if (i==array_tabs.length-1) { top.window.close(); } else { top.content.location = array_tabs[i+1]; } } } } /** switches the application navigation links on the header frame **/ function updateHeader(type) { var link1 = 'OMS Home'; var link2 = 'Saved Transactions'; var link3 = 'Address Book'; var link4 = 'New Order'; var link6 = 'Help'; var link7 = 'User Administration'; var link8 = 'Preferences'; var link9 = 'Catalog'; var spacer = '   ' if (type=='home' && top.header.document.all['appNav']) top.header.document.all['appNav'].innerHTML = link1+spacer+link7+spacer+link8+spacer+link6; else if (type=='review') top.header.document.all['appNav'].innerHTML = link1+spacer+link6; else top.header.document.all['appNav'].innerHTML = link1+spacer+link2+spacer+link9+spacer+link3+spacer+link4+spacer+link8+spacer+link6; } function goHome(url) { document.location.href = url; } //this function needs to be removed once we get rid of frames function goHomeWithFrames(url) { parent.document.location.href = url; } /** Hide/Show Navigation Frame **/ /** Hide/Show Navigation Frame **/ function initFrameToggleGif(path) { var frameCol = top.i2ui_shell_content.document.body.cols; if ( frameCol.charAt(0) == "0") { if (document.all) { document.header.toggle.alt = "Show Navigation Frame"; document.header.toggle.src = omxContextPath + "/expand.gif"; } } else { if (document.all) { document.header.toggle.alt = "Hide Navigation Frame"; document.header.toggle.src = omxContextPath + "/collapse.gif"; } } } function togglenav(path) { var frameCol = top.i2ui_shell_content.document.body.cols; if ( frameCol.charAt(0) == "0") { if (document.all) { document.header.toggle.alt = "Hide Navigation Frame"; document.header.toggle.src = omxContextPath + "/collapse.gif"; top.i2ui_shell_content.document.body.cols="170,*"; tabShow = 0; return; } } else { if (document.all) { document.header.toggle.alt = "Show Navigation Frame"; document.header.toggle.src = omxContextPath + "/expand.gif"; top.i2ui_shell_content.document.body.cols="0%,100%"; tabShow = 1; } } } /******************** Resizing Containers ******************/ function initContainer(container_id) { i2uiResizeScrollableContainer(container_id,document.body.offsetHeight - 100, null, document.body.offsetWidth - 20, true, 'yes'); i2uiToggleContentUserFunction = "resizeContainer"; } function resizeContainer(container_id) { i2uiResizeScrollableContainer(container_id,document.body.offsetHeight - 100, null, document.body.offsetWidth - 20, true, 'yes'); } /******************** Resizing Containers In Popup******************/ function initContainerPopup(container_id) { i2uiResizeScrollableContainer(container_id,document.body.offsetHeight - 100, null, document.body.offsetWidth - 35, true, 'yes'); } function resizeContainerPopup(container_id) { i2uiResizeScrollableContainer(container_id,document.body.offsetHeight - 100, null, document.body.offsetWidth - 35, true, 'yes'); } function toggleCheckboxes(_form, _field, _all) { var numOfAlerts = _field.length; var select = _all.checked; var selectedAlerts = 0; if ( numOfAlerts == 1 ) { if ( _field.disabled == false ) { eval("_field.checked = " + select); } } if ( numOfAlerts > 1 ) { for(i=0; i