/////////////////////////////////////////////////////////////////////////////
//
// 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.9 2005/06/13 16:15:05 vasantham Exp $
// $Date: 2005/06/13 16:15:05 $
// $RCSfile: SYS_login.js,v $
// $Revision: 1.9 $
//
// 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();//Turned off by Brian 11-6-2008

}


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();
    }

}

function Login_DoGuestLogon()
{
	return;
    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 ;
		var g_strGuestLogonURL = "/SumTotal2043/lang-en/administration/user/job/ADM_ListJobs.asp";
		document.LoginForm.action =g_strGuestLogonURL;
		alert(document.LoginForm.action);
        document.LoginForm.submit();
    }

}


var b_timer = null; // blink timer 
var b_on = true; // blink state 
var blnkrs = null; // array of spans 

function blink() { 
var tmp = document.getElementsByTagName("label"); 
if (tmp) { 
blnkrs = new Array(); 
var b_count = 0; 
for (var i = 0; i < tmp.length; ++i) { 
if (tmp[i].className == "clsNormal2") { 
blnkrs[b_count] = tmp[i]; 
++b_count; 
} 
} 
// time in m.secs between blinks 
// 500 = 1/2 second 
blinkTimer(650); 
} 
} 

function blinkTimer(ival) { 
if (b_timer) { 
window.clearTimeout(b_timer); 
b_timer = null; 
} 
blinkIt(); 
b_timer = window.setTimeout('blinkTimer(' + ival + ')', ival); 
} 

function blinkIt() { 
for (var i = 0; i < blnkrs.length; ++i) { 
if (b_on == true) { 
blnkrs[i].style.visibility = "hidden"; 
} 
else { 
blnkrs[i].style.visibility = "visible"; 
} 
} 
b_on =!b_on; 
} 
