
/// <summary>
/// Gets the specified cookie.
/// </summary>
/// <param name="name">The name of the cookie to get.</param>
/// <created date="7/9/2007" by="Peter Femiani"/>
function GetCookie(name)
{
    var start = document.cookie.indexOf( name + "=" );
    var len = start + name.length + 1;
    if ( ( !start ) &&
         ( name != document.cookie.substring( 0, name.length ) ) )
    {
        return false;
    }

    if ( start == -1 ) return false;

    var end = document.cookie.indexOf( ";", len );
    if ( end == -1 ) end = document.cookie.length;

    return unescape( document.cookie.substring( len, end ) );
}

/// <summary>
/// Populates login control with remembered login.
/// </summary>
/// <param name="textControlID">The id of the login textbox.</param>
/// <param name="checkControlID">The id of the remember me checkbox.</param>
/// <created date="7/9/2007" by="Peter Femiani"/>
/// <revision date="08/23/2007" by="John Sheets">Bug 7046 - DM# or User Name text missing from the textbox</revision>
function PopulateRememberMe(textControlID, checkControlID)
{
    var value = GetCookie("USAirRememberUserAccount");

    var textControl = document.getElementById(textControlID);
    var checkControl = document.getElementById(checkControlID);

    if (value == false)
    {
        if (checkControl != null)
        {
            checkControl.checked = false;
            // Added to fix Bug 7046
            textControl.value = "DM# or User Name";
        }
    } else
    {
        if (textControl != null)
        {
            textControl.value = value;
        }
        if (checkControl != null)
        {
            checkControl.checked = true;
        }
    }
}