/*
  Script to set focus to the first text box of a form while the page is
  loaded. this will not set focus to the search box
*/
function set_focus(){
    /* function to search for the first form other than the search form */
    if (document && document.forms && document.forms.length){
        for (var i=0 ;i<document.forms.length;i++){
            if( document.forms[i].name != 'searchform' &&  document.forms[i].id != 'searchform'){
                set_focus_form(document.forms[i]);
                    break;
            }
        }
    }
}

function set_focus_form(frm){
    /* function to set focus on the first input field of the given form */
    
    if(!frm && !frm.elements)
        return;
    for(var i=0;i<frm.elements.length;i++){
        if (frm.elements[i].type == 'text' ){
            frm.elements[i].focus();
            break;
        }
    }
}
window.onload = set_focus;
