/* FILE ARCHIVED ON 1:02:42 Nov 3, 2016 AND RETRIEVED FROM THE AN OPENWAYBACK INSTANCE ON 6:29:09 Jun 30, 2024. JAVASCRIPT APPENDED BY OPENWAYBACK, COPYRIGHT INTERNET ARCHIVE. ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C. SECTION 108(a)(3)). */ /* This function places focus on the first field of the page and sets the tabIndex on the input fields of the firs form on the page. It is used to create the following tabbing order: all fields, Next, Back, Delete This Registration. It works as following: All visible input elements on a page are assigned the tabIndex in the order they are created. The buttons in the footer are set to positive tabIndex manually (9999,9998 etc.). We want to force a tab from the last form field to the "Next" btn. Once we set the form elements tabindex to positive number, the browser proceeds with the positive tabIndex instead of 0 tabIndex. */ function placeFocus() { if (document.forms.length > 0) { var tabCount = 0; var myForm = document.forms[0]; var elm, tabValue; var firstSubmitElm = null; var isFocusSet = false; for (i = 0; i < myForm.length; i++) { elm = myForm.elements[i]; tabValue = elm.tabIndex; if (elm.style.display != 'none') { if ((elm.type == "text") || (elm.type == "radio") || (elm.type == "password") || (elm.type == "checkbox") || (elm.type == "textarea") || (elm.type.toString().toLowerCase().indexOf("select") != -1) || (elm.type == "submit")) { try { // tabIndex is not set when value == 0 if (tabValue == 0) { tabCount++; //elm.tabIndex = tabCount; //Don't set tabindex for 508 compliance } if (!isFocusSet) { if (elm.type == "submit") { if (!firstSubmitElm) { firstSubmitElm = elm; } } else { elm.focus(); isFocusSet = true; } } } catch(ex){} } } } } // If focus was not set, set it on the 'add' button if one is found. // If add button is not found, set the focus on the 'next' button. // If next button is not found, set the focus on the first submit button. if(!isFocusSet){ if (document.getElementById('btnAdd')) { setTimeout("document.getElementById('btnAdd').focus()", 100); } else if (document.getElementById('next')) { setTimeout("document.getElementById('next').focus()", 100); } else if (firstSubmitElm) { firstSubmitElm.focus(); } } //if the errorlist is in the document place the focus on that element. if (document.getElementById('errorList')) { setTimeout("document.getElementById('errorList').focus()", 100); } } function placeFocusRemoveTextArea() { if (document.forms.length > 0) { var myForm = document.forms[0]; for (i = 0; i < myForm.length; i++) { if (myForm.elements[i].style.display != 'none') { if ((myForm.elements[i].type == "text") || (myForm.elements[i].type == "radio") || (myForm.elements[i].type == "checkbox") || (myForm.elements[i].type.toString().charAt(0) == "s")) { document.forms[0].elements[i].focus(); break; } } } } } function placeFocusCloseButton() { if (document.forms.length > 0) { var myForm = document.forms[0]; var elm; var isFocus = false; for (i = 0; i < myForm.length; i++) { elm = myForm.elements[i]; if (elm.style.display != 'none') { if ( (elm.type == "radio") ) { elm.focus(); isFocus = true; break; } } } if(!isFocus) { document.getElementById('close').focus(); } } } var ErrorContainerHandler = {}; ErrorContainerHandler.placeFocus = function () { var elem = document.getElementById('errorList'); if (elem) { elem.focus(); } return; }