function setFieldFocus()
{
    try
    {
        var foundfield = false;
        
        for (f=0; f < document.forms.length; f++)
        {
            for(i=0; i < document.forms[f].length; i++)
            {
                if (document.forms[f][i].type != "hidden" && document.forms[f][i].disabled != true && document.forms[f][i].readOnly != true)
                {                    
                    if (document.forms[f][i].type == 'text' || document.forms[f][i].type == 'password')
                    {
                        document.forms[f][i].select();
                    } document.forms[f][i].focus();
                    
                    var foundfield = true;                  
                }
                
                if (foundfield == true)
                {
                    break;
                }
            }
                
            if (foundfield == true)
            {
                break;
            }
        }
    } catch(e)
    {
        // do nothing
    }
}