$(document).ready(function() { //if ($.isFunction($.truncate)) { if ($.isFunction($.fn.truncate)) { $('div.truncate').truncate({ max_length: 160, more: '...más', less: '...menos' }); } if ($.isFunction($.fn.fancybox)) { $('a.lightbox').fancybox({ 'overlayOpacity': 0.7, 'overlayColor': '#000', 'hideOnContentClick': 'true' }); } }); function eurificar(number) { var numberStr = parseFloat(number).toFixed(2).toString(); var numFormatDec = numberStr.slice(-2); /*decimal 00*/ numberStr = numberStr.substring(0, numberStr.length-3); /*cut last 3 strings*/ var numFormat = new Array; while (numberStr.length > 3) { numFormat.unshift(numberStr.slice(-3)); numberStr = numberStr.substring(0, numberStr.length-3); } numFormat.unshift(numberStr); return numFormat.join('.')+','+numFormatDec; /*format 000.000.000,00 */ } function clicRadio() { var fecha = new Date(); var mes = fecha.getMonth (); var trimestral = 3-mes%3; var anual = 12-mes; var tipos = document.getElementsByName('tipo_pago'); var tipo; var valor_tipo; for(var i = 0; i < tipos.length; i++){ if(tipos[i].checked){ valor_tipo = tipos[i].value; } } if (valor_tipo=='trimestral'){ tipo = trimestral; } else { tipo = anual; } var cuotas = document.getElementsByName('radio_cuota'); var valor_cuota; for(var i = 0; i < cuotas.length; i++){ if(cuotas[i].checked){ valor_cuota = cuotas[i].value; } } if (valor_cuota == 0) // promoción jóvenes { coste_mensual = 14; } else { coste_mensual = 28; } total = valor_cuota*1+6+coste_mensual*tipo; document.getElementById('entrada').value = valor_cuota*1; document.getElementById('cuota').value = coste_mensual*tipo; document.getElementById('precio').value = total; } function calcular_edad(dia_nacim,mes_nacim,anio_nacim) { fecha_hoy = new Date(); ahora_anio = fecha_hoy.getYear(); ahora_mes = fecha_hoy.getMonth(); ahora_dia = fecha_hoy.getDate(); edad = (ahora_anio + 1900) - anio_nacim; if ( ahora_mes < (mes_nacim - 1)) { edad--; } if (((mes_nacim - 1) == ahora_mes) && (ahora_dia < dia_nacim)) { edad--; } if (edad > 1900) { edad -= 1900; } return edad; }
