var pageChanged = false; // return a reference to a DOM element by ID function e(id) { return document.getElementById(id); } // return a reference to a form element by name (within the first form and within the action array) function f(name) { if (typeof(document.forms[0].elements[name]) != 'undefined') return document.forms[0].elements[name]; else return {checked:0, disabled:1, selectedIndex:0, options:{0:{value:'', text:''}}}; } // return or set the display property of a DOM element by ID function d(id, display) { if (e(id) == null) return false; if (arguments.length == 1) return (e(id).style.display == 'none' ? false : true); else e(id).style.display = display ? '' : 'none'; } // clear the value property of a DOM element by ID function c(id, clear) { if (e(id) == null) return false; if (clear == true) e(id).value = ''; } // toggle an element by ID function toggle(elementID) { e(elementID).style.display = e(elementID).style.display == 'none' ? '' : 'none'; } function toggleImage(elementID) { var moreInfo = 'moreInformation' + elementID; var moreInfoLink = 'moreInformationImage' + elementID; if (e(moreInfo).style.display == 'none') { e(moreInfo).style.display = '' e(moreInfoLink).src = 'images/button-down.gif'; } else { e(moreInfo).style.display = 'none'; e(moreInfoLink).src = 'images/button.gif'; } } function toggleCategory(categoryID,rowCount) { for (i = 0; i < rowCount; i++) { var categoryRow = 'category' + categoryID + i; toggle(categoryRow); } var categoryReturnToTopLink = 'returnToTop' + categoryID; toggle(categoryReturnToTopLink); } // keep track of whether or not the page has changed pageChanged = false; // register that the page has changed function registerFormChanged() { pageChanged = true; } // confirm a link click if the page has changed function confirmLink() { if (pageChanged) return confirm("You have not saved your changes to this page. Press \"OK\" to discard your changes and continue, \"Cancel\" to return to the page."); return true; }