//Title:       formfocus
//Version:     1.02
//Copyright:   Copyright (c) 2003
//Author:      REVIE
//Company:     Rhino Internet


/**
 * Sets the focus to the username field of a login prompt.
 *
 * <p>
 * <b>Changelog:</b><pre>
 *  1.00  REVIE 2001/08/10  created.
 *  1.01  REVIE 2001/12/17  updated to now loop through all forms until
 *                          the first selectable element is found
 *  1.02  REVIE 2003/01/24  moved functionality to sub so can be used
 *                          in conjunction with mouseover js
 * </pre>
 *
 * @author  REVIE
 * @version 1.02
 * @since   JDK1.0
 */


// -----------------------------------------------
//
//  form action methods
//

function formfocus() {
   if (document.forms) {
      for (var j=0; document.forms[j]; j++) {
         var form = document.forms[j];
         if (form && form.elements) {
            for (var i=0; form.elements[i]; i++) {
               if (form.elements[i].type &&
                   (form.elements[i].type == 'checkbox' ||
                    form.elements[i].type == 'file' ||
                    form.elements[i].type == 'password' ||
                    form.elements[i].type == 'radio' ||
                    form.elements[i].type == 'text' ||
                    form.elements[i].type == 'textarea')) {
                  form.elements[i].focus();
                  return 1;
               } // if
            } // for
         } // if
      } // for
   } // if
} // focus

//window.onload = function() { 
//   focus();
//};

