/* giveFocus.js.txt */ function giveFocus() { if (document.documentElement.clientHeight >= 900) { // Sets the focus to the first input box on the page. // From http://www.codeproject.com/Articles/11586/Set-Focus-to-First-Input-on-Web-Page var bFound = false; // for each form for (f=0; f < document.forms.length; f++) { // for each element in each form for(i=0; i < document.forms[f].length; i++) { // if it's not a hidden element if (document.forms[f][i].type != "hidden") { // and it's not disabled if (document.forms[f][i].disabled != true) { // set the focus to it document.forms[f][i].focus(); var bFound = true; } } // if found in this element, stop looking if (bFound == true) break; } // if found in this form, stop looking if (bFound == true) break; } } } /*setTimeout(giveFocus,1000);*/ // Wait 1 second for the form to load addEvent = function(obj, evType, fn, useCapture) { if (obj.addEventListener) { obj.addEventListener(evType, fn, useCapture); return true; } else if (obj.attachEvent) { var r = obj.attachEvent('on' + evType, fn); return r; } else { obj['on' + evType] = fn; } } addEvent(window, 'load', giveFocus, false);