/* Form - Utilities - Javascript - Namespaced * ZRM */ U = function(jQ){ var helpFileId = '9741348'; /* RELOAD FUNCTIONS */ reloadFunctions = new Array(); function _addOnreloadEvent(fnName) { reloadFunctions[reloadFunctions.length] = fnName; } if(typeof onCompleteEventHandler != 'undefined'){ var core_onCompleteEventHandler = onCompleteEventHandler; } onCompleteEventHandler = function(http_request, jsonHeader) { core_onCompleteEventHandler(http_request, jsonHeader); for (var i = 0; i < reloadFunctions.length; i++) { reloadFunctions[i](); } }; function _addMultiloadEvent(fnName){ addOnloadEvent(fnName); _addOnreloadEvent(fnName); } if (typeof refreshTrackingFormCount == "undefined"){ refreshTrackingFormCount = 0; } function _dynamicLoadScript(page, parameters, callBack){ function loadScript(){ $H(parameters).each(function (parameter){ page += "&"+parameter.key+"="+parameter.value(); }); var script = document.createElement('script'); script.src = "page.request.do?page="+page; var browserName=navigator.appName; if (browserName == "Microsoft Internet Explorer"){ script.onreadystatechange = function() { if(script.readyState=='loaded'){ finishedLoading(); } }; }else{ script.onload = finishedLoading; } ($('trackingForm') || document.getElementsByTagName('head')[0]).appendChild(script); //document.getElementsByTagName('head')[0].appendChild(script); } function finishedLoading(){ callBack(); } if(refreshTrackingFormCount == 0){ addOnloadEvent(loadScript); }else{ loadScript(); } } function _addDynamicLoadEvent(fnc){ if (refreshTrackingFormCount == 0){ fnc(); } } function _addDynamicMultiloadEvent(fnc){ fnc(); } function _addDynamicReloadEvent(fnc){ if (refreshTrackingFormCount > 0){ fnc(); } } _addOnreloadEvent(function(){ ++refreshTrackingFormCount; }); /* END RELOAD FUNCTIONS */ function _resizeElementWidth(elem){ //elem.style.width = (elem.offsetWidth + 10) + 'px'; elem.style.width = 'auto'; } function _resizeElementHeight(elem){ //elem.style.height = (elem.scrollHeight + 0) + 'px'; elem.style.height = 'auto'; } function _autoResizeMultiSelects(){ var divs = document.getElementsByTagName('div'); for (dd=0; dd -1){ _resizeElementWidth(divs[dd]); _resizeElementHeight(divs[dd]); } } } function _autoResizeSelects(){ var selects = document.getElementsByTagName('select'); for (dd=0; dd -1 ){ var strQueryString = strHref.substr(strHref.indexOf("?")); var aQueryString = strQueryString.split("&"); for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){ if (aQueryString[iParam].indexOf(strParamName + "=") > -1 ){ var aParam = aQueryString[iParam].split("="); strReturn = aParam[1]; break; } } } return unescape(strReturn); } function _getUrlParams(url){ var url = url == undefined ? window.location.href : url var hashes = url.slice(url.indexOf('?') + 1).split('&'); var vars = [], hash; for(var i = 0; i < hashes.length; i++) { hash = hashes[i].split('='); vars.push(hash[0]); vars[hash[0]] = hash[1]; } return vars; } //Hides all the entellitrak menu bars function _hideEtkToolbars(){ $$('#systemBar', '#titleDisplay', '#udm', '#assignmentListContainer', '#footer').each( function(ele){ ele.hide(); }); } //This is for when you have just a label in a form row and you want to put HTML to the right of it. function _appendTDString(tableRow, innerHTML){ var td = document.createElement('td'); td.innerHTML = innerHTML; $(tableRow).childElements().last().colSpan = "1" tableRow.appendChild(td); } function _appendTD(tableRow, element){ var td = document.createElement('td'); td.appendChild(element); $(tableRow).childElements().last().colSpan = "1" tableRow.appendChild(td); } function _removeFormButtons(){ if ($('saveButton') != null){ $('saveButton').up('tr').up('tr').remove(); } } function _showMainContent(){ jQ('#mainContent').show(); } function _showSideList(){ jQ('#sideList').show(); } /* Creates a filled with holding columnNames. * Accepts an array of columnNames*/ function _createHeaderRow(columnNames){ var tr = document.createElement('tr'); for (var column = 0; column < columnNames.length; column++){ var th = document.createElement('th'); th.appendChild(document.createTextNode(columnNames[column])); tr.appendChild(th); } return tr; } /* Takes a 2d array of strings and an array of property names and creates an array of objects * (handy when used with velocity)*/ function _arrToJSON(array, propertyNames){ var returnArray = []; for (var row = 0; row < array.length; row++){ var obj = new Object(); for (var property = 0; property < propertyNames.length; property++){ obj[propertyNames[property]] = array[row][property]; } returnArray[row] = obj; } return returnArray; } function _createMultiValueList(eltName) { var checkboxDiv = document.getElementById(eltName + "_multiValue"); if (!checkboxDiv) { return; } var list = document.createElement("ul"); list.className = "multiValueReadOnlyUl"; list.id = eltName + "_display"; var checkboxArray; if (document.dataForm.elements[eltName] == undefined){ checkboxArray = []; }else if(document.dataForm.elements[eltName].length == undefined){ checkboxArray = [document.dataForm.elements[eltName]]; }else{ checkboxArray = document.dataForm.elements[eltName]; } for (var i=0; i < checkboxArray.length; i++) { if (checkboxArray[i].checked) { var elt = document.createElement("li"); elt.appendChild(document.createTextNode(trim(checkboxArray[i].nextSibling.nodeValue))); list.appendChild(elt); } } var linkText; if (list.childNodes.length == 0) { linkText = "Add"; } else { linkText = "Edit"; } var link = document.createElement("a"); link.href = "javascript:U.showEditList('" + eltName + "')"; link.appendChild(document.createTextNode(linkText)); list.appendChild(link); var displayDiv = document.createElement("div"); if (list.hasChildNodes() && list.childNodes.length > 10) { //div.className = "multiValueReadOnlyDiv"; } displayDiv.appendChild(list); // Going up the hierarchy: div -> td -> tr -> tbody -> table -> td var column = checkboxDiv.parentNode.parentNode.parentNode.parentNode.parentNode; column.insertBefore(displayDiv, column.firstChild); var link2 = document.createElement("a"); link2.href = "javascript:U.showReadList('" + eltName + "')"; link2.appendChild(document.createTextNode("Done")); checkboxDiv.parentNode.appendChild(link2); checkboxDiv.parentNode.className="hidden"; } function _showEditList(eltName) { document.getElementById(eltName + "_multiValue").parentNode.className=""; document.getElementById(eltName + "_display").className="hidden"; } function _showReadList(eltName) { // clear and rebuild list var list = document.getElementById(eltName + "_display"); if ( list.hasChildNodes() ) { while ( list.childNodes.length >= 1 ) { list.removeChild( list.firstChild ); } } var checkboxArray; if (document.dataForm.elements[eltName] == undefined){ checkboxArray = []; }else if(document.dataForm.elements[eltName].length == undefined){ checkboxArray = [document.dataForm.elements[eltName]]; }else{ checkboxArray = document.dataForm.elements[eltName]; } for (var i=0; i < checkboxArray.length; i++) { if (checkboxArray[i].checked) { var elt = document.createElement("li"); elt.appendChild(document.createTextNode(trim(checkboxArray[i].nextSibling.nodeValue))); list.appendChild(elt); } } var linkText; if (list.childNodes.length == 0) { linkText = "Add"; } else { linkText = "Edit"; } var link = document.createElement("a"); link.href = "javascript:U.showEditList('" + eltName + "')"; link.appendChild(document.createTextNode(linkText)); list.appendChild(link); document.getElementById(eltName + "_multiValue").parentNode.className="hidden"; list.className="multiValueReadOnlyUl"; } function _loadStyleSheet(url){ if (document.createStyleSheet){ document.createStyleSheet(url); }else{ var cssNode = document.createElement('link'); cssNode.type = 'text/css'; cssNode.rel = 'stylesheet'; cssNode.href = url; document.getElementsByTagName("head")[0].appendChild(cssNode); } } function _refreshTrackingFormHide(){ $('mainContent').hide(); refreshTrackingForm(); } /*clears a multi-select*/ function _clearMultiSelect(ancestor){ jQ(ancestor).find('input[type=checkbox]').each(function(index, checkbox){ checkbox.checked=false; }); } /* Filters an array of objects with searchedProperty = searchedValue */ function _filterArray(array, searchedProperty, searchedValue){ return jQ(array).filter(function(index){ return this[searchedProperty] == searchedValue; }); } /* Finds the first element in the array of objects with searchedProperty = searchedValue * Then returns the returnedProperty of that object */ function _lookupValueInArray(array, searchedProperty, searchedValue, returnedProperty){ var filtered = _filterArray(array, searchedProperty, searchedValue); if (filtered.length > 0){ return filtered[0][returnedProperty]; }else{ return null; } } /*Hides the input specified by name and clears it's container*/ function _hideClearInput(name){ if (jQ('#'+name+'_fileElementLink').length > 0){ //The input is a file and we won't clear it }else{ jQ('#'+name+', input[type=hidden][name='+name+']').val(''); jQ('#'+name+'_yes, #'+name+'_no').prop('checked', false); jQ('input[name='+name+']:checkbox:checked').prop('checked', false); jQ('#'+name+'_multiValue :checkbox:checked').prop('checked', false); } jQ('#'+name+'-container').hide(); } /*Gets the value of the input specified by name*/ function _getValue(name){ var temp; temp = jQ('#'+name+'_multiValue'); if(temp.length > 0){ temp = jQ('[name='+name+']:checkbox'); if(temp.length > 0){ return temp.map(function(index, box){return box.value}); }else{ return jQ('input[name='+name+']').map(function(index, input){return input.value}); } }else{ temp = jQ('#'+name); if(temp.length > 0){ //PR 04/03/2014 Added logic to correctly check file field after it has already been initially saved with a file var dneElement = (temp.val() == undefined || temp.val() == '' || temp.val().length == 0); var fileElem = '#'+name + '_fileElementLink'; var fileElemLink = jQ(fileElem); var dneFileElement = (fileElemLink == undefined || fileElemLink == '' || fileElemLink.length == 0); if(dneElement && !dneFileElement && fileElemLink.attr('class') == "etk-form-file-download" && fileElemLink.attr('href') != "") return jQ('#'+name + '_fileName').val(); return temp.val(); }else{ temp = jQ('input[type=hidden][name='+name+']'); if(temp.length > 0){ return temp.val(); }else{ return jQ('#'+name+'_yes, #'+name+'_no, input[name='+name+']').filter(':checked').val() } } } } /* Builds a Select element given an array of objects * objArray: an array of objects * value: the property to act as the Value * dispaly: the property to act as the Display * name: the name of the select element * blankValue: should this dropdown have a blank option at the top */ function _buildDDL(objArray, value, display, name, blankValue){ var select = $(document.createElement('select')); if(name){ select.name = name; select.id = name; } select.addClassName('formInput'); if (blankValue){ select.appendChild(document.createElement('option')); } jQ(objArray).each(function(index, obj){ var option = document.createElement('option'); option.value = obj[value]; option.appendChild(document.createTextNode(obj[display])); select.appendChild(option); }); return select; } function _generateRequiredIcon(){ return jQ('Required'); } function _addRequiredIconToFile(elementName){ jQ('') .append(jQ('') .append(jQ('') .append(jQ('
') .append(jQ('#'+elementName+'-container div.etk-form-file'))) .append(jQ('') .append(_generateRequiredIcon())))) .appendTo(jQ('#'+elementName+'-container > td:last')); } //PR 02/11/2014 Above code didn't work, so added this function _addRequiredIconToFileUpdated(elementName, leftOffset, topOffset) { var locationToInsert = ' > div.etk-form-file'; //If div version doesn't work, try using td if(!jQ('#'+elementName+'-container > div.etk-form-file').length) locationToInsert = ' > td > div.etk-form-file'; jQ("
").attr({ 'id': "#"+elementName + "-container-required", 'class': "etk-required-true", 'style': "left: "+leftOffset+ "px; position: relative; top: " +topOffset+ "px; width:12px;" }).append(U.generateRequiredIcon()).append(jQ("
")) .appendTo(jQ('#'+elementName+'-container' + locationToInsert)); } function _hideRequiredIcon(inputName){ return jQ('#'+inputName+'-container').find('img[title=Required]').hide(); } function _showRequiredIcon(inputName){ return jQ('#'+inputName+'-container').find('img[title=Required]').show(); } function _resizeMainContent(){ jQ('#mainContent').css('height', 'auto'); } function _loadNavigationList(url, baseId, currentObject, includedObjects){ var objectMap = { page: url, baseId: baseId, currentObject: currentObject}; jQ(includedObjects).each(function(i, ele){ objectMap[ele] = 1; }); jQ('#sideList').load( 'page.request.do', objectMap, function(){jQ('#sideList').show();} ); } function _sideBySide(containerRow, sideBySideRows, keepLabels){ _appendTD(containerRow, jQ('
') .css({padding: '0px'}) .append(jQ.map(sideBySideRows, function(ele){ if (!keepLabels){ jQ(ele).children().first().remove(); } return jQ('') .css({float: 'left'}) .append(jQ('') .append(ele))[0]; }))[0]); } function _convertDdlToRadios(select){ var jSelect = jQ(select); var selectedValue = jSelect.val(); var name = jSelect.prop('name'); jSelect .replaceWith(jQ('
') .append(jQ('') .append(jSelect.find('option[value!=""]') .map(function(i, option){ return jQ('') .append(jQ('
') .append(jQ('') .prop({name: name, value: jQ(option).prop('value')}))) .append(jQ('') .text(jQ(option).text()))[0]})))); jQ(':radio[name='+name+'][value='+selectedValue+']').prop('checked', true); } function _removeSpellcheckButton(){ jQ('input[onclick="onCheckSpellingBtn(this.form)"]').hide(); } function _renameSaveToSaveForLater(){ jQ('#saveButton').prop('value', ' Save for Later '); } /*Inserts element after the saveButton */ function _addAfterSaveButton(element){ jQ('#saveButton') .parent() .after(jQ('').append(element)) } function _addBeforeSaveButton(element){ jQ('#saveButton') .parent() .before(jQ('').prepend(element)) } function _addEfileHelp(){ jQ('
  • ') .append(jQ('') .prop({href: 'page.request.do?page=fileRetriever&fileId='+helpFileId}) .text('User Guide')) //.appendTo(jQ('#udm')) .prependTo(jQ('#myAccount')) jQ('
  • ') .append(jQ('') .prop({href: 'page.request.do?page=fileRetriever&fileBusinessKey=eFilerFAQ'}) .text('FAQs')) //.appendTo(jQ('#udm')) .prependTo(jQ('#myAccount')) jQ('
  • ') .append(jQ('') .prop({href: 'mailto:Boards-EFSR-Help@dol.gov'}) .text('Contact Us')) //.appendTo(jQ('#udm')) .prependTo(jQ('#myAccount')) } function _nvl(test, option){ return test ? test : option; } function _appendNavigationButton(dataObjectKey, trackingId, text){ jQ('
  • ') .append(jQ('') .addClass('button') .prop({href: 'workflow.do?dataObjectKey='+dataObjectKey+'&trackingId=' + trackingId}) .text(text)) .appendTo(jQ('#saveButton').parent().parent()) } function _fixIe7FileIssue(){ setTimeout(function(){jQ('div.etk-form-file').each(function(i, ele){ ele.className = ele.className })}, 50) } function _addContactTooltip(targetElement, contactInfo){ if (contactInfo){ new Ext.ToolTip({ title: 'Contact Information', target: targetElement, anchor: 'left', html: jQ('
    ') .append(jQ('
    ').text('Address 1: ' + contactInfo.address1)) .append(jQ('
    ').text('Address 2: ' + contactInfo.address2)) .append(jQ('
    ').text('Address 3: ' + contactInfo.address3)) .append(jQ('
    ').text('City: ' + contactInfo.city)) .append(jQ('
    ').text('State: ' + contactInfo.state)) .append(jQ('
    ').text('Zip Code: ' + contactInfo.zip)) .append(jQ('
    ').text('Main Phone: ' + contactInfo.mainPhone)) .append(jQ('
    ').text('Mobile Phone: ' + contactInfo.mobilePhone)) .append(jQ('
    ').text('Email Address: ' + contactInfo.emailAddress)).html(), width: 300, height: 500, dismissDelay: 1000000 }); } } function _addDolBanner(){ jQ('body') .prepend(jQ("
    ") .css({ height: '6em', color: 'white', 'background-image': "url('web-pub/dol/RedVerticalGrad.jpg')", 'font-size': '1em', 'font-family': 'Verdana'}) .append(jQ(''))); //08-31-15 PJR Add JS to fix display issue with DOL logo on 3.16.2 (T-01195) //jQ("#myAccount").css("top", "100px"); //jQ("#myAccount").css("z-index", "0"); //10-23-15 PJR Added, so that the "My Account" row no longer overlaps popups for efilers (T-02912) jQ("#userDisplay").css("top", "100px"); //KL 6-13-2018 added !important to ensure that the sytem bar options don't overlap, needed to use class name simpleMenu since the DOM ID of myAccount is not unique... //All the commented code works in Chrome but not in IE //document.getElementById("myAccount").style.setProperty('top', '100px', 'important'); //document.getElementById("myAccount").style.top = '100px'; //jQ(".simpleMenu").attr('style', 'top: 100px !important; z-index: 0 !important;'); } function _addTooltipToLabel(name, content){ jQ('label[for='+name+'], label#'+name) .append(jQuery('') .text(' [?]') .qtip({content: content})) } function _addFormInstructions(html){ if(html){ jQ('#formInstructions') .append(jQ('

    ').html(html)) .append(jQ('


    ')) } } return { resizeElementWidth: _resizeElementWidth, resizeElementHeight: _resizeElementHeight, autoResizeMultiSelects: _autoResizeMultiSelects, autoResizeSelects: _autoResizeSelects, getURLParam: _getURLParam, getUrlParams: _getUrlParams, hideEtkToolbars: _hideEtkToolbars, appendTDString: _appendTDString, appendTD: _appendTD, removeFormButtons: _removeFormButtons, showMainContent: _showMainContent, showSideList: _showSideList, createHeaderRow: _createHeaderRow, arrToJSON: _arrToJSON, createMultiValueList: _createMultiValueList, showEditList: _showEditList, showReadList: _showReadList, loadStyleSheet: _loadStyleSheet, refreshTrackingFormHide: _refreshTrackingFormHide, clearMultiSelect: _clearMultiSelect, filterArray: _filterArray, lookupValueInArray: _lookupValueInArray, hideClearInput: _hideClearInput, getValue: _getValue, buildDDL: _buildDDL, generateRequiredIcon: _generateRequiredIcon, addRequiredIconToFile: _addRequiredIconToFile, addRequiredIconToFileUpdated: _addRequiredIconToFileUpdated, hideRequiredIcon: _hideRequiredIcon, showRequiredIcon: _showRequiredIcon, resizeMainContent: _resizeMainContent, loadNavigationList: _loadNavigationList, sideBySide: _sideBySide, convertDdlToRadios: _convertDdlToRadios, removeSpellcheckButton: _removeSpellcheckButton, renameSaveToSaveForLater: _renameSaveToSaveForLater, addAfterSaveButton: _addAfterSaveButton, addBeforeSaveButton: _addBeforeSaveButton, nvl: _nvl, addEfileHelp: _addEfileHelp, addDolBanner: _addDolBanner, appendNavigationButton: _appendNavigationButton, addContactTooltip: _addContactTooltip, addTooltipToLabel: _addTooltipToLabel, addFormInstructions: _addFormInstructions, fixIe7FileIssue: _fixIe7FileIssue, dynamicLoadScript : _dynamicLoadScript, addDynamicLoadEvent : _addDynamicLoadEvent, addDynamicMultiloadEvent : _addDynamicMultiloadEvent, addDynamicReloadEvent: _addDynamicReloadEvent } }(jQuery); DolConstants = { contactSearchGuidance: "The existing contact search is similar to the Contact Name search under the Related Contacts tab to determine if this party already exists in the system. Information provided by the eFiler is pre-populated as the search criteria, but you may change this as you see fit and re-run the search.

    If you need to see more information on a contact returned in the search results to determine if it's a match, click on it, then click the \"Open in New Window\" button.

    If the desired contact appears in the search results, click on it, then click the \"Choose Contact\" button to associate them with the current appeal.

    If the search returns no appropriate results, click the \"New Contact\" button to create the contact in the system and associate them with the current appeal.", owcpSearchGuidance: "The OWCP Search is similar to the IFECS search done before docketing a new ECAB appeal. The OWCP number provided by the eFiler is pre-populated as the search criteria, but you may change this as you see fit and re-run the search.

    To copy the information returned from IFECS to the current appeal, check the appropriate checkboxes in the \"Use IFECS?\" column, then click the \"Copy to Form\" button. As some of the IFECS information pertains to the overall case and some to the claimant, the OWCP Search link exists on both the New Appeal and Claimant Information tabs, with the option to copy only those fields appropriate to each tab.

    ***Please note that copying the IFECS information to the form will overwrite the information provided by the eFiler, and that this action cannot be undone once the form is saved.***", passwordPrompt: "By providing your password and clicking the Submit button below, you acknowledge this submission to be accurate and free of viruses. The password will be the electronic representation of your signature for all purposes when you (or your representative) uses it for requests that are filed via the Adjudicatory Boards' Electronic Filing and Service Request System (EFSR)- just the same as a pen-and-paper signature or initials. A request filed electronically via this system has the same legal effect as the original document. If you wish not to proceed, you are under no obligation to transact business electronically using this web site." }