﻿/****************************************************************
*                                                               *
* Nombre:       ShowControls                                    *
* Descripción:  Muestra o oculta los controles de logeo cuando  *
*               se realiza click sobre uno de los literales.    *
* Parametros:   Ninguno.                                        *
* Salida:       Ninguna.                                        *
*                                                               *
*****************************************************************/
function ShowControls(handlerTextBox, obj)
{
    //debugger;
    // Obtenemos los objetos
    var txtUser = document.getElementById(GF_LOGIN_SKIN_OBJECT_TXT_USER_ID);
    var txtPassword = document.getElementById(GF_LOGIN_SKIN_OBJECT_TXT_PASSWORD_ID);
    var txtUserSwitch = document.getElementById(GF_LOGIN_SKIN_OBJECT_TXT_USER_SWITCH_ID);
    var txtPasswordSwitch = document.getElementById(GF_LOGIN_SKIN_OBJECT_TXT_PASSWORD_SWITCH_ID);

    // Declaramos variables
    var none = 'none';
    var inline = 'inline';

    // Procede del evento onblur
    if (handlerTextBox == 1) 
    {
        // Mostramos el objeto que lanzo el evento
        obj.style.display = inline;

        // Si no contiene caracteres
        if (obj.value.length == 0) 
        {
            // Ocultamos el objeto que lanzo el evento
            obj.style.display = none;

            // En función del objeto
            switch (obj.id)
            {
                case txtUser.id:
                    txtUserSwitch.style.display = inline;
                    break;
                case txtPassword.id:
                    txtPasswordSwitch.style.display = inline;
                    break;            
            }                        
        }        
    }
    else 
    {
        // Procede del evento onclick
        obj.style.display = none;
        switch (obj.id) {
            case txtUserSwitch.id:
                txtUser.style.display = inline;
                txtUser.focus();
                break;
            case txtPasswordSwitch.id:
                txtPassword.style.display = inline;
                txtPassword.focus();
                break;
        }                        
    }
}