﻿/////////////////////////////////////////////////////////////////////////////
//
// 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: LMS_ForgottenPWD.js,v 1.3 2005/08/08 07:35:54 vasantham Exp $
// $Date: 2005/08/08 07:35:54 $
// $RCSfile: LMS_ForgottenPWD.js,v $
// $Revision: 1.3 $
//
// 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.ForgotPWDForm.UserName.focus();

}

function Login_ValidateParameters()
{

    //
    // Check for user name
    //
    if ( _UTL_Trim(document.ForgotPWDForm.UserName.value).length == 0 )
    {
        alert(L_Error_NoData);
        document.ForgotPWDForm.UserName.focus();
        return false ;
    }

    //
    // Check for the E-mail id
    //
    if ( _UTL_Trim(document.ForgotPWDForm.txtEmail.value).length == 0 )
    {
        alert(L_Error_NoData);
        document.ForgotPWDForm.txtEmail.focus();
        return false ;
    }

    return true ;

}

function ForgotPWD_ClickOK()
{

    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.ForgotPWDForm.mode.value=1;
        document.ForgotPWDForm.submit();
    }

}


//
// called when cancel button is clicked
//
function ForgotPWD_ClickCancel()
{
	if(g_strReqCallerURL && g_strReqCallerURL.length > 0 )
		_UTL_Navigate(g_strReqCallerURL );

}

function ForgotPWD_EmailEntered(evt)
{

    evt = SYS_Browser_GetEventObject(evt);
    
    if ( _UTL_EnterPressed(evt) )
    {
        ForgotPWD_ClickOK();
    }
}


