<script for="parentid" event="onchange" language="JScript">

  function option_do(form, element) {
    if (document.all) {
      var i = 0;
      var sel = document.forms[form][element];

      for (i = 0; i < sel.options.length; i++) {
        if (sel.options(i).disabled) {
          sel.options(i).style.color = '#999';
          sel.options(i).style.fontWeight = 'bold';
        }
      }

      ok = false;

      if ((sel.selectedIndex != -1) && (sel.options(sel.selectedIndex).disabled)) {
        for (i = sel.selectedIndex; i < sel.options.length; i++) {
          if (!ok && !sel.options(i).disabled) {
            sel.options.selectedIndex = i;
            ok = true;
          }
        }
        if (!ok) 
          for (i = sel.selectedIndex; i >= 0; i--) {
            if (!sel.options(i).disabled) {
              sel.options.selectedIndex = i;
              ok = true;
            }
          }
        }
      }
    }
  }

  option_do('forma', 'parentid');

</script>