//funcion SoloRut no se utiliza. function SoloRut(fld, e) { var i = j = 0 var strCheck = '0123456789-Kk' var aux = aux2 = '' var whichCode = (window.Event) ? e.which : e.keyCode if (whichCode == 13) return true // Enter key = String.fromCharCode(whichCode) if (strCheck.indexOf(key) == -1) return false len = fld.value.length for (; i < len; i++) if (strCheck.indexOf(fld.value.charAt(i)) != -1) aux += fld.value.charAt(i) } //******************************************************** function ValidarRut(obj,valor) { if (isEmpty(valor)) { alert('Debe ingresar su RUT completo'); obj.value=''; obj.focus(); return false; } var res = valor.split('-'); var rut = res[0]; var dv = res[1]; if (res.length==2){ if (validarut(rut, dv) == false) { alert('RUT no es válido.'); obj.value=''; obj.focus(); return false; } }else{ alert('Debe ingresar su RUT completo'); obj.value=''; obj.focus(); return false; } return true; } //**************************************************************************************************** function ValidarClave(obj,valor) { if (isEmpty(valor)) { alert('Debe ingresar una contraseña.'); obj.focus(); return false; } return true } //***************************************************************************************************** //***************************FUNCIONES DE FORMULARIO DE CONTACTO (Contacto.aspx)*********************** //se ejecuta al seleccionar motivo de control select function AbrirRespuestaMotivos() { var TextMotivo= $("#motivo option:selected").html(); var motivo_value = $('#motivo').val(); var sesion = $('#session').val(); $("#motivotext").val(TextMotivo); if (motivo_value != 0 && motivo_value!=10) { //se agrega href de forma dinamica con jquery $("#lnk_Respuesta_Motivos").attr('href', '/ClubKino/Generales/RespuestaMotivos?id=0&data=0&valor=' + motivo_value +'&motivotext='+ TextMotivo +'&session='+ sesion); //se llama a evento click de etiqueta a que contiene clase iframe $('#lnk_Respuesta_Motivos').trigger("click"); } } //*************************************************** function SubmitContacto() { if (ValidaBlancosContacto() != false) { //document.getElementById("capchaval").value = document.getElementById("capval").value //document.getElementById("capchares").value = document.getElementById("capres").value $('#capchaval').val(document.getElementById("capval").value); $('#capchares').val(document.getElementById("capres").value); // ChkCapcha(); } } //********************************************************** function sendsubmit() { $( "#nombre" ).prop( "disabled", false ); $( "#apellido").prop( "disabled", false ); $( "#mail").prop( "disabled", false ); $("#formContacto").submit(); // $("#nombre").val(''); // $("#apellido").val(''); // $("#mail").val(''); // $("#telefono").val(''); // $("#areacod").val(''); $("#comentarios").val(''); $('#motivo').val('0'); $( "#nombre" ).prop( "disabled", true ); $( "#apellido").prop( "disabled", true ); $( "#mail").prop( "disabled", true ); return false; } //********************************************* function ValidaBlancosContacto() { var s, err = 0, msg, pos = 0, Flag = true; msg = "" s = $("#motivo").val(); if (s == '0') { msg = "Debe seleccionar motivo de consulta."; pos = 1; Flag = false; } $("#nombre").val(blancos($("#nombre").val())); s = $("#nombre").val(); if (isEmpty(s) && Flag) { msg = "Debe ingresar su nombre."; pos = 2; Flag = false; } $("#apellido").val(blancos($("#apellido").val())); s = $("#apellido").val(); if (isEmpty(s) && Flag) { msg = "Debe ingresar su apellido."; pos = 3; Flag = false; } $("#mail").val(blancos($("#mail").val())); s = $("#mail").val(); if (isEmpty(s) && Flag) { msg = "Debe ingresar su e-mail."; pos = 4; Flag = false; } $("#rut_contacto").val(blancos($("#rut_contacto").val())); s = $("#rut_contacto").val(); if (isEmpty(s) && Flag) { msg = "Debe ingresar su rut."; pos = 6; Flag = false; } $("#comentarios").val(blancos($("#comentarios").val())); s = $("#comentarios").val(); if (isEmpty(s) && Flag) { msg = "Debe ingresar su comentario."; pos = 5; Flag = false; } if (Flag == false) alert(msg); if (pos != 0) { if (pos == 1) $("#motivo").focus(); if (pos == 2) $("#nombre").focus(); if (pos == 3) $("#apellido").focus(); if (pos == 4) $("#mail").focus(); if (pos == 5) $("#comentarios").focus(); if (pos == 6) $("#rut_contacto").focus(); } return Flag; } //**************************************************************************************** // *********************** LOGIN ************************ //**************************************************************************************** //Revisa que el rut sea valido en BD function Abrir_NuevaContraseña(rut) { if ((rut.length)!=0) { $("#Rut").val(rut.value); //ongoJS("formNuevaClave"); ongo2JS("formNuevaClave"); } } function Ingreso() { $("#formNuevaClave").attr("action", "/ClubKino/Login/Loginrut/"); //ongoJS("formNuevaClave") //$("#formNuevaClave").submit(); ongo2JS("formNuevaClave"); } function ValidaDatosLogin() { if (ValidaBlancosInicioSession()){ Ingreso(); } } //************************************************ function ValidaBlancosInicioSession() { var s, err = 0, msg, pos = 0, Flag = true; var FecNac; var Reg, Ciu, Com, Dir, Num, Calle, Depto; //var Form = document.frmprincipal var RadTrab, RadCas; msg ="" $("#Rut").val(blancos($("#Rut").val())); s = $("#Rut").val(); if (isEmpty(s) && Flag){ err++; msg = "Debe ingresar su RUT completo."; if (pos == 0) pos = 1; Flag = false; } $("#Clave").val(blancos($("#Clave").val())); s = $("#Clave").val(); if (isEmpty(s) && Flag){ err++; msg = "1-Debe ingresar su contraseña."; if (pos == 0) pos = 2; Flag = false; } if (Flag == false) alert(msg); if (pos != 0){ if (pos == 1) $("#Rut").focus(); if (pos == 2) $("#Clave").focus(); } return Flag; } //****************************************************************************************************** //************************** Login Móvil ************************************************************** //****************************************************************************************************** //Revisa que el rut sea valido en BD function Abrir_NvaContraseñaM(rut) { if ((rut.length)!=0) { $("#RutM").val(rut.value); ongoJS("formNuevaClaveM"); } } //************************************************** function IngresoM() { $("#formNuevaClaveM").attr("action", "/ClubKino/Login/LoginrutM/"); ongoJS("formNuevaClaveM"); } //************************************************* function ValidaDatosLoginM() { if (ValidaBlancosInicioSessionM()){ IngresoM(); } } //************************************************ function ValidaBlancosInicioSessionM() { var s, err = 0, msg, pos = 0, Flag = true; msg ="" //$("#RutM").val(blancos($("#RutM").val())); s = $("#RutM").val(); if (isEmpty(s) && Flag){ err++; msg = "Debe ingresar su RUT completo."; if (pos == 0) pos = 1; Flag = false; } $("#ClaveM").val(blancos($("#ClaveM").val())); s = $("#ClaveM").val(); if (isEmpty(s) && Flag){ err++; msg = "Debe ingresar su contraseña."; if (pos == 0) pos = 2; Flag = false; } if (Flag == false) alert(msg); if (pos != 0){ if (pos == 1) $("#RutM").focus(); if (pos == 2) $("#ClaveM").focus(); } return Flag; } //***************************************************************************************************** //***********************FUNCIONES RECUPERACION DE CLAVE (RecuperaClave.aspx)************************** function SubmitRecuperaClave() { //alert(1); var StrRut = $("#StrRut").val(); console.log(contador); console.log("prueba01"); if (contador != 0) { // alerta("Solicitud ya enviada"); return false; } else{ console.log("prueba02"); contador = contador + 1; if (ValidarRut($("#StrRut"), StrRut)) { captchaResponse = grecaptcha.getResponse(widgetId1); console.log(widgetId1); console.log(captchaResponse); console.log("prueba03"); $.post("ProcRecuperaClave", {"captchaResponse": captchaResponse, "id": "0", "data": "", "StrRut": StrRut}, function(response){ $(".divRecuperaClave").html(response); } ); //$("#formRecuperaClave").submit(); //return false; } } } //***************************************************************************************************** //***********************FUNCIONES CREAR CONTRASEÑA (Login_Nueva_Contraseña.aspx y CreaContraseña)********************** function checkCreaContrasenna() { var StrRut = $("#cliRut").val(); if (ValidarRut($("#cliRut"), StrRut)) { if (ValidaBlancosCreaContrasenna()) { $("#formCreaContrasenna").submit(); } } } //************************************************************** function SubmitCreaContrasenna() { if (ValidaBlancosCreaContrasenna()) { $("#formCreaContrasenna").submit(); } } //************************************************* function ValidaBlancosCreaContrasenna() { var s, err = 0, msg, pos = 0, Flag = true; msg = "" var Pwd = $("#clave").val(); var PwdConf = $("#clave2").val(); // if ($.trim(Pwd) != "" || $.trim(PwdConf) != "") { if (isEmpty(Pwd)) { err++; msg = "Debe ingresar una contraseña"; if (pos == 0) pos = 1; Flag = false; } if (isEmpty(PwdConf) && Flag) { err++; msg = "Debe Confirmar su contraseña"; if (pos == 0) pos = 2; Flag = false; } if (Pwd != PwdConf && Flag) { err++; msg = "Contraseñas no son iguales."; if (pos == 0) pos = 1; Flag = false; } if (!valPass($("#clave"))) { return false; } //} if (Flag == false) alert(msg); if (pos != 0) { if (pos == 1) $("#clave").focus(); if (pos == 2) $("#clave2").focus(); } return Flag; } //***************************************************************************************************** //***********************FUNCIONES CREAR MAIL Y CONTRASEÑA (Login_Nuevo_Mail.aspx)********************* function SubmitCreaMail() { if (ValidaBlancosCreaMail()) { $("#formCreaMail").submit(); } } //********************************************** function ValidaBlancosCreaMail() { var s, err = 0, msg, pos = 0, Flag = true; msg = "" $("#email").val(blancos($("#email").val())); s = $("#email").val(); if (isEmpty(s) && Flag) { msg = "Debe ingresar su e-mail."; pos = 1; Flag = false; } if (Flag) { var Pwd = $("#clave").val(); var PwdConf = $("#clave2").val(); // if ($.trim(Pwd) != "" || $.trim(PwdConf) != "") { if (isEmpty(Pwd)) { err++; msg = "Debe ingresar una contraseña"; if (pos == 0) pos = 2; Flag = false; } if (isEmpty(PwdConf) && Flag) { err++; msg = "Debe Confirmar su contraseña"; if (pos == 0) pos = 3; Flag = false; } if (Pwd != PwdConf && Flag) { err++; msg = "Contraseñas no son iguales."; if (pos == 0) pos = 2; Flag = false; } if (!valPass($("#clave"))) { return false; } //} } if (Flag == false) alert(msg); if (pos != 0) { if (pos == 1) $("#email").focus(); if (pos == 2) $("#clave").focus(); if (pos == 3) $("#clave2").focus(); } return Flag; } //***************************************************************************************************** function ValidaAbonoLoteria() { var session = $("#session").val(); var puntos =$("#Puntos").val(); var PtoDisp =$("#ptosdisp").val(); if (puntos <1000) { alert("Estimado cliente: Los puntos a Canjear deben ser mayor o igual a 1000."); return; } if (parseFloat(PtoDisp) < parseFloat(puntos)) { alert("Estimado cliente: Los puntos a Canjear deben ser Menor o Igual a sus Puntos Disponibles."); return; } $("#formAboLot").attr("action", "/ClubKino/canje/ProcesaAbonarPuntos/"+"0"); ongoJS("formAboLot"); } //********************************************************************************************************************* //***************************FUNCIONES DE FORMULARIO DE REGISTRO DE APUESTAS (RegistroApuestas.aspx)*********************** //**************************************************************************************************** function SubmitRegistroApuestas() { if (ValidaBlancosRegistroApuestas()) { if (ValidarRadiosJuegos()) { var formulario; var CamposImput; var inputName = 1; var valor = ""; /**SETAMOS VALORES DE LOS TEXT DE LOS REGISTROS DE APUESTAS EN UN SOLO CAMPO OCULTO LLAMADO 'Apuestas'**/ formulario = document.getElementById("formRegApuestas"); CamposImput = formulario.getElementsByTagName("input"); for (var i = 0; i < CamposImput.length; i++) { // Si el tipo de campo es una caja de texto if (CamposImput[i].type == "text") { if ($.trim($("#Apu" + inputName).val()).length > 0) { valor = valor + $.trim($("#Apu" + inputName).val()) + ","; } inputName = inputName + 1; } } $("#Apuestas").val(valor); /********************************************************************************************************/ $("#formRegApuestas").submit(); $("#formRegApuestas input").val(''); } } } //**************************************************************************************************** //**************************************************************************************************** function ValidarRadiosJuegos() { var r1, r2, r3, PrdNom, flag; flag = true; var formulario; var CamposImput; var inputName=1; r1 = $("#radios1").is(':checked'); r2 = $("#radios2").is(':checked'); r3 = $("#radios3").is(':checked'); if (r1 == true) { PrdNom = "kino"; } else if (r2 == true) { PrdNom = "Al Fin le Achunte"; } else if (r3 == true) { PrdNom = "kino5"; } formulario = document.getElementById("formRegApuestas"); CamposImput = formulario.getElementsByTagName("input"); for (var i = 0; i < CamposImput.length; i++) { // Si el tipo de campo es una caja de texto if (CamposImput[i].type == "text") { if ($.trim($("#Apu" + inputName).val()).length > 0) { if ($.trim($("#Apu" + inputName).val()).length != 14) { alert("Debe ingresar un número de Codigo de Barra de 14 dígitos en la apuesta " + inputName); return false; } flag = ValidarCodBarraJuegos($.trim($("#Apu" + inputName).val())); if (flag == false) { alert("Codigo de Barra ingresado en la apuesta N° " + inputName + " no es válido o no pertenece a una apuesta " + PrdNom + "."); return false; } } inputName = inputName + 1; } } return true; } //**************************************************************************************************** function ValidarCodBarraJuegos(valor) { var cad02 = ''; var cad04 = ''; var r1, r2, r3; r1 = $("#radios1").is(':checked'); r2 = $("#radios2").is(':checked'); r3 = $("#radios3").is(':checked'); cad02 = valor.substring(0, 2); cad04 = valor.substring(0, 4); if (r1 == true) { if ((cad02 != '03') && (cad04 != '5202')) { return false; } } else if (r2 == true) { if ((cad02 != '79') && (cad04 != '5229')) { return false; } } else if (r3 == true) { if ((cad02 != '05') && (cad04 != '5203')) { return false; } } return true; } //**************************************************************************************************** function ValidaBlancosRegistroApuestas() { var formulario; var CamposImput; var inputName = 1; var flag=0; formulario = document.getElementById("formRegApuestas"); CamposImput = formulario.getElementsByTagName("input"); for (var i = 0; i < CamposImput.length; i++) { // Si el tipo de campo es una caja de texto if (CamposImput[i].type == "text") { if (($.trim($("#Apu" + inputName).val()).length > 0 )&&($.trim($("#Apu" + inputName).val()).length != "" )) { flag=1; } inputName = inputName + 1; } } if (flag==0){ alert("Debe registrar una apuesta como minimo"); return false; } return true; } //****************************************************************************************