/////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2004-2005 SumTotal Systems, Inc. All rights reserved.
//
// The copyright to the computer software herein is proprietary and remains
// the property of SumTotal Systems, Inc. It may be used and/or copied only with
// the written consent of SumTotal Systems, Inc. or in accordance with the terms and
// conditions stipulated in the agreement/contract under which this software
// has been supplied.
//
// $Id: SYS_login.js,v 1.10 2007/03/09 14:06:31 vasantham Exp $
// $Date: 2007/03/09 14:06:31 $
// $RCSfile: SYS_login.js,v $
// $Revision: 1.10 $
//
// Abstract:
//
//    Browser class to identify browsers and operating system
//
// Revision History:
//
//    2002-02-25   Anand Arvind    Created file
//
/////////////////////////////////////////////////////////////////////////////

var g_bFormSubmitted = false ;

function Content_OnLoad()
{

    _UTL_PageInit();

    document.LoginForm.UserName.focus();

    //
    // Check for popup blockers and print appropriate message
    //
    _UTL_CheckPopupBlocker();

}


function Login_ValidateParameters()
{

    //
    // Check for OK user name
    //
    if ( _UTL_Trim(document.LoginForm.UserName.value).length == 0 )
    {
        alert(L_Error_NoData);
        document.LoginForm.UserName.focus();
        return false ;
    }

    return true ;

}

function Login_PasswordEntered(evt)
{

    evt = SYS_Browser_GetEventObject(evt);
    
    if ( _UTL_EnterPressed(evt) )
    {
        Login_DoLogin();
    }
}

function Login_DoLogin()
{

    if ( Login_ValidateParameters() )
    {
        //
        // Ignore multiple submits as if IE shows the submit warning
        // dialog and user presses cancel, no way to relogin till page
        // refreshes. In other pages this is OK but only for login
        // to reduce support issues, we have to do this.
        //
        // if ( g_bFormSubmitted )
        //    return ;
        g_bFormSubmitted = true ;
        document.LoginForm.submit();
    }

}


