
var SELF_LOGINMSGS_USERNONEMPTY = "El nombre de usuario no puede estar en blanco.";
var SELF_LOGINMSGS_PWDNONEMPTY = "La contraseña no puede estar vacía.";

        function SELF_ValLogin() {

            with (window.document.forms['frmKWAFLogIn']) {
                if (SELF_isEmpty(KWAF_UserLogin)) {
                    alert(SELF_LOGINMSGS_USERNONEMPTY);
                    KWAF_UserLogin.focus();
                    return false;
                }

                if (SELF_isEmpty(KWAF_UserPassword)) {
                    alert(SELF_LOGINMSGS_PWDNONEMPTY);
                    KWAF_UserPassword.focus();
                    return false;
                }
                TimeOffset.value = getTimeZoneOffset();
                
                username.value = KWAF_UserLogin.value;
                password.value = KWAF_UserPassword.value;
                
                var saction = 'http://www.egaconsultoresonline.com/moodle/login/index.php';
                var sPreLogin = KWAF_UserLogin.value;
                sPreLogin = sPreLogin.toLowerCase();
                if (sPreLogin.substring(0, 4) == 'ofi_') {
                    saction = 'http://www.cursosmicrosoft.com/Self/DoLoginDomain.asp';
                }
                action = saction;
                submit();
            }
        }

        function SELF_isEmpty(textForm) {
            with (window.document.forms['frmKWAFLogIn']) {
                //campo nulo
                if (textForm.value == null)
                    return true;
                //campo de longitud cero
                if (textForm.value.length == 0)
                    return true;
                else {
                    //comprueba que no se introduce una cadena de espacios en blanco
                    for (i = 0; i < textForm.value.length; i++) {
                        if (textForm.value[i] != ' ')
                            return false;
                    }
                    return true;
                }
            }
        }

        function getTimeZoneOffset() {
            // Get current time
            var d = new Date();

            // Get timezone - and convert To hours Si le quito el 60 lo devuelve en minutos
            //Restar en horas si no le quito el 60
            return -d.getTimezoneOffset() / 60

            // return the offset
            return (lnOffset);
        }
