docs: protected void appendDefaultLoginScript(StringBuffer html, CmsMessageContainer message) {
  
          html.append("<script type=\"text/javascript\" src=\"");
          html.append(CmsWorkplace.getSkinUri()).append("jquery/packed/jquery.js");
          html.append("\"></script>\n");
          html.append("<script type=\"text/javascript\">\n");
          if (message != null) {
              html.append("function showAlert() {\n");
              html.append("\talert(\"");
              html.append(CmsStringUtil.escapeJavaScript(message.key(m_locale)));
              html.append("\");\n");
              html.append("}\n");
          }
          html.append("var orgUnitShow = false;\n");
          html.append("var orgUnits = null;\n");
          html.append("var activeOu = -1;\n");
          html.append("var searchTimeout;\n");
          html.append("var searchDefaultValue = \"");
          html.append(Messages.get().getBundle(m_locale).key(Messages.GUI_LOGIN_ORGUNIT_SEARCH_0));
          html.append("\";\n");
  
          // triggers the options to select the OU to login to
          html.append("function orgUnitSelection() {\n");
          html.append("\tif (!orgUnitShow) {\n");
          html.append("\t\tif (orgUnits == null) {\n");
          html.append("\t\t\t$.post(\"");
          html.append(getFormLink());
          html.append("\", { ");
          html.append(PARAM_ACTION_GETOULIST);
          html.append(": \"true\" }");
          html.append(", function(data){ fillOrgUnits(data); });\n");
          html.append("\t\t}\n");
          html.append("\t\tdocument.getElementById('ouSelId').style.display = 'block';\n");
          html.append("\t\tdocument.getElementById('ouLabelId').style.display = 'block';\n");
          html.append("\t\tdocument.getElementById('ouSearchId').style.display = 'block';\n");
          html.append("\t\tdocument.getElementById('ouBtnId').value = '");
          html.append(Messages.get().getBundle(m_locale).key(Messages.GUI_LOGIN_ORGUNIT_SELECT_OFF_0));
          html.append("';\n");
          html.append("\t} else {\n");
          html.append("\t\tdocument.getElementById('ouSelId').style.display = 'none';\n");
          html.append("\t\tdocument.getElementById('ouLabelId').style.display = 'none';\n");
          html.append("\t\tdocument.getElementById('ouSearchId').style.display = 'none';\n");
          html.append("\t\tdocument.getElementById('ouBtnId').value = '");
          html.append(Messages.get().getBundle(m_locale).key(Messages.GUI_LOGIN_ORGUNIT_SELECT_ON_0));
          html.append("';\n");
          html.append("\t}\n");
          html.append("\torgUnitShow = !orgUnitShow;\n");
          html.append("\tdocument.getElementById('titleId').style.display = 'block';\n");
          html.append("\tdocument.getElementById('titleIdOu').style.display = 'none';\n");
          html.append("}\n");
  
          // creates the HTML for the OUs to login to
          html.append("function fillOrgUnits(data) {\n");
          html.append("\torgUnits = eval(data);\n");
          html.append("\tvar html = \"\";\n");
          html.append("\tvar foundOu = false;\n");
          html.append("\tvar activeIndex = -1;\n");
          html.append("\tfor (var i = 0; i < orgUnits.length; i++) {\n");
          html.append("\t\tvar currOu = orgUnits[i];\n");
          html.append("\t\tvar actClass = \"\";\n");
          html.append("\t\tif (currOu.active == true) {\n");
          html.append("\t\t\t// this is the active OU\n");
          html.append("\t\t\tactiveOu = currOu.index;\n");
          html.append("\t\t\tactClass = \" class=\\\"active\\\"\";\n");
          html.append("\t\t}\n");
          html.append("\t\tvar actStyle = \"\";\n");
          html.append("\t\tif (currOu.level > 0) {\n");
          html.append("\t\t\tactStyle = \" style=\\\"margin-left: \" + (currOu.level * 20) + \"px;\\\"\";\n");
          html.append("\t\t}\n");
          html.append("\t\thtml += \"<div\";\n");
          html.append("\t\thtml += actClass;\n");
          html.append("\t\thtml += actStyle;\n");
          html.append("\t\thtml += \" id=\\\"ou\" + currOu.index;\n");
          html.append("\t\thtml += \"\\\" onclick=\\\"selectOu('\";\n");
          html.append("\t\thtml += currOu.name;\n");
          html.append("\t\thtml += \"', \" + currOu.index;\n");
          html.append("\t\thtml += \");\\\"><span class=\\\"name\\\">\";\n");
          html.append("\t\thtml += currOu.description;\n");
          html.append("\t\thtml += \"</span>\";\n");
          html.append("\t\tif (currOu.name != \"\") {\n");
          html.append("\t\t\thtml += \"<span class=\\\"path\\\"\";\n");
          html.append("\t\t\thtml += \" title=\\\"\";\n");
          html.append("\t\t\thtml += currOu.name;\n");
          html.append("\t\t\thtml += \"\\\">\";\n");
          html.append("\t\t\thtml += currOu.simplename;\n");
          html.append("\t\t\thtml += \"</span>\";\n");
          html.append("\t\t}\n");
          html.append("\t\thtml += \"</div>\";\n");
          html.append("\t}\n");
          html.append(
              "\thtml += \"<div id=\\\"nooufound\\\" style=\\\"display: none;\\\"><span class=\\\"name\\\">\";\n");
          html.append("\thtml += \"");
          html.append(Messages.get().getBundle(m_locale).key(Messages.GUI_LOGIN_ORGUNIT_SEARCH_NORESULTS_0));
          html.append("\";\n");
          html.append("\thtml += \"</span></div>\";\n");
          html.append("\t$(\"#ouSelId\").append(html);\n");
          html.append("\t$(\"#ouSelId\").slideDown();\n");
          html.append("\tscrollToActiveOu();\n");
          html.append("}\n");
  
          // shows the list of OUs matching the search term or all OUs if the search term is empty
          html.append("function showOrgUnits(searchTerm) {\n");
          html.append("\tvar html = \"\";\n");
          html.append("\tvar foundOu = false;\n");
          html.append("\tfor (var i = 0; i < orgUnits.length; i++) {\n");
          html.append("\t\tvar currOu = orgUnits[i];\n");
          html.append("\t\tif (searchTerm != \"\") {\n");
          html.append("\t\t\tvar stLower = searchTerm.toLowerCase();\n");
          html.append(
              "\t\t\tif (currOu.name.toLowerCase().indexOf(stLower )== -1 && currOu.description.toLowerCase().indexOf(stLower) == -1) {\n");
          html.append("\t\t\t\t$(\"#ou\" + i + \":visible\").slideUp();\n");
          html.append("\t\t\t} else {\n");
          html.append("\t\t\t\t$(\"#ou\" + i + \":hidden\").slideDown();\n");
          html.append("\t\t\t\t$(\"#ou\" + i).removeAttr(\"style\");\n");
          html.append("\t\t\t\tfoundOu = true;\n");
          html.append("\t\t\t}\n");
          html.append("\t\t} else {\n");
          html.append("\t\t\tfoundOu = true;\n");
          html.append("\t\t\tvar actStyle = \"\";\n");
          html.append("\t\t\tif (currOu.level > 0) {\n");
          html.append("\t\t\t\tactStyle = \"margin-left: \" + (currOu.level * 20) + \"px;\";\n");
          html.append("\t\t\t}\n");
          html.append("\t\t\t$(\"#ou\" + i).attr(\"style\", actStyle);\n");
          html.append("\t\t\t$(\"#ou\" + i + \":hidden\").slideDown();\n");
          html.append("\t\t}\n");
          html.append("\t}\n");
          html.append("\tif (searchTerm != \"\" && foundOu == false) {\n");
          html.append("\t\t$(\"#nooufound:hidden\").slideDown();\n");
          html.append("\t} else {\n");
          html.append("\t\t$(\"#nooufound:visible\").slideUp();\n");
          html.append("\t}\n");
          html.append("\tif (searchTerm == \"\") {\n");
          html.append("\t\tscrollToActiveOu();\n");
          html.append("\t}\n");
          html.append("}\n");
  
          // selects the OU to login to
          html.append("function selectOu(ouPath, ouIndex) {\n");
          html.append("\tif (ouIndex != -1 && ouIndex != activeOu) {\n");
          html.append("\t\t$(\"#ou\" + ouIndex).addClass(\"active\");\n");
          html.append("\t\torgUnits[ouIndex].active = true;\n");
          html.append("\t\t$(\"#");
          html.append(PARAM_OUFQN);
          html.append("\").val(ouPath);\n");
          html.append("\t\tif (activeOu != -1) {\n");
          html.append("\t\t\torgUnits[activeOu].active = false;\n");
          html.append("\t\t\t$(\"#ou\" + activeOu).removeClass();\n");
          html.append("\t\t}\n");
          html.append("\t\tactiveOu = ouIndex;\n");
          html.append("\t}\n");
          html.append("}\n");
  
          // filters the OUs by the provided search term using a timeout, called by the onkeyup event of the search input field
          html.append("function searchOu() {\n");
          html.append("\tvar searchElem = $(\"#");
          html.append(PARAM_OUSEARCH);
          html.append("\");\n");
          html.append("\tvar searchTerm = searchElem.val();\n");
          html.append("\tif (searchTerm == searchDefaultValue) {");
          html.append("\t\tsearchTerm = \"\";");
          html.append("\t}");
          html.append("\tclearTimeout(searchTimeout);\n");
          html.append("\tsearchTimeout = setTimeout(\"showOrgUnits(\\\"\" + trim(searchTerm) + \"\\\");\", 750);\n");
          html.append("}\n");
  
          // sets the value of the OU search input field, called by the onfocus and onblur event of the field
          html.append("function checkOuValue() {\n");
          html.append("\tvar searchElem = $(\"#");
          html.append(PARAM_OUSEARCH);
          html.append("\");\n");
          html.append("\tif (searchElem.val() == searchDefaultValue) {");
          html.append("\t\tsearchElem.val(\"\");");
          html.append("\t\tsearchElem.removeAttr(\"class\");");
          html.append("\t} else if (searchElem.val() == \"\") {");
          html.append("\t\tsearchElem.val(searchDefaultValue);");
          html.append("\t\tsearchElem.attr(\"class\", \"inactive\");");
          html.append("\t}");
          html.append("}\n");
  
          // scrolls to the currently selected OU if it is out of visible range
          html.append("function scrollToActiveOu() {\n");
          html.append("\tif (activeOu != -1) {\n");
          html.append("\t\tvar activeOffset = $(\"#ou\" + activeOu).offset().top;\n");
          html.append("\t\tvar parentOffset = $(\"#ouSelId\").offset().top;\n");
          html.append("\t\tactiveOffset = activeOffset - parentOffset;\n");
          html.append("\t\tif (activeOffset > $(\"#ouSelId\").height()) {;\n");
          html.append("\t\t\t$(\"#ouSelId\").animate({scrollTop: activeOffset}, 500);\n");
          html.append("\t\t};\n");
          html.append("\t}\n");
          html.append("}\n");
  
          // function to check IE version, in case of a version < IE8 login will be disabled and an error message shown.
          html.append("function checkBrowser(){\n ");
          html.append("var div = document.createElement(\"div\");\n");
          html.append("div.innerHTML = \"<!--[if lt IE 8]><i></i><![endif]-->\";\n");
          html.append("var isIeLessThan8 = (div.getElementsByTagName(\"i\").length == 1);\n");
          html.append("if (isIeLessThan8) {\n  $('#");
          html.append(PARAM_FORM);
          html.append(
              "').after('<div style=\"color: #B31B34; font-weight: bold; font-size: 14px; margin: 20px; text-align: center;\">");
          html.append(Messages.get().getBundle(m_locale).key(Messages.GUI_LOGIN_UNSUPPORTED_BROWSER_0));
          html.append("</div>');\n $('#");
          html.append(PARAM_FORM);
          html.append(
              "').css(\"display\",\"none\"); /** $('input').attr('disabled', 'disabled');\n  alert('wrong browser'); */\n}\n}\n");
  
          // called when the login form page is loaded
          html.append("function doOnload() {\n checkBrowser();\n");
          html.append("\tdocument.");
          html.append(PARAM_FORM);
          html.append(".");
          html.append(PARAM_USERNAME);
          html.append(".select();\n");
          html.append("\tdocument.");
          html.append(PARAM_FORM);
          html.append(".");
          html.append(PARAM_USERNAME);
          html.append(".focus();\n");
          if (message != null) {
              html.append("\tshowAlert();\n");
          }
          html.append("}\n");
  
          // helper function to trim a given string
          html.append("function trim (myStr) {\n");
          html.append("\treturn myStr.replace(/^\\s+/, '').replace (/\\s+$/, '');\n");
          html.append("}\n");
  
          html.append("</script>\n");
      }