function setup() { // Add show/hide help link.. var helpLinkDiv = document.getElementById('help_link') ; if (!helpLinkDiv) return ; else { var newJSLink = document.createElement('a') ; newJSLink.href="javascript:showHideHelp('hide');" ; newJSLink.id = "show_hide_help_link" ; newJSLinkText = document.createTextNode("Hide help") ; newJSLink.appendChild(newJSLinkText) ; helpLinkDiv.appendChild(newJSLink) ; } // Try to read show_or_hide value from URL string var myString = window.location.search ; var soughtString = 'show_help=' ; var valPos = myString.indexOf(soughtString) ; if (valPos == -1) return false ; // There is a value. Is it 'show' or 'hide' ? showHideHelp(myString.substring(valPos + soughtString.length, valPos + soughtString.length + 4)) ; } function showHideHelp(show_or_hide) { // Loop through all divs // If they have className 'label_note', show or hide var allDivs = document.getElementsByTagName('div') ; for (var a=0; a1 class separated by spaces paddedClass = " " + allDivs[a].className + " " ; if (paddedClass.indexOf(' label_note ') != -1) allDivs[a].style.display = (show_or_hide == 'hide') ? 'none' : 'block' ; } // Update the show/hide link on the page var helpLink = document.getElementById('show_hide_help_link') ; // Set the text of the link helpLink.firstChild.nodeValue = (show_or_hide == 'hide') ? 'Show help' : 'Hide help' ; // And set the value of the JS function helpLink.href = (show_or_hide == 'hide') ? "javascript:showHideHelp('show');" : "javascript:showHideHelp('hide');" ; setFormActions(show_or_hide) ; } function setFormActions(show_or_hide) { // Add the value "show_help=hide" to the action parameter of all forms var allForms = document.getElementsByTagName('form') for (var b=0; b