function agregar_a_favoritos() { if (document.all) { var url=document.location.href; var titulo=""; window.external.AddFavorite(url,titulo); } else { var l=new Array(); l[0]=""; msgAlerta('',l); } } function abrir_ventana(url) { var x=(screen.width/2)-225; var y=(screen.height/2)-320; window.open(url,"","scrollbars=yes,width=530,height=600,top=" + y + ",left =" + x + ""); } function LTrim(cadena) { var re = /\s*((\S+\s*)*)/; return cadena.replace(re, "$1"); } function RTrim(cadena) { var re = /((\s*\S+)*)\s*/; return cadena.replace(re, "$1"); } function trim(cadena) { return LTrim(RTrim(cadena)); } function evaluar(id_form,id,tipo_dato,min,max,accion) { if(accion!='') accion = 0; else accion = 1; var contenido=trim(document.getElementById(id).value); var longitud=contenido.length; var errores=""; var matriz=new Array(); if(longitud>0) { document.getElementById(id).value=contenido.replace(/'/g," "); } if(tipo_dato=='check') { if(document.getElementById(id).checked) { document.getElementById(id).className='validInput'; return true; } else { document.getElementById(id).className='invalidInput'; return false; } } if((min==0) && (max==0)) { errores+=Field_Validate(id_form,'',id, tipo_dato,min,max, true); if(errores) { matriz[0]=errores; bloquearForm(id_form); msgAlerta("",matriz); desBloquearForm(id_form); document.getElementById(id).className='invalidInput'; }else{ document.getElementById(id).className='validInput'; } return false; } if(longitud==0) { if(accion) document.getElementById(id).className='validInput'; else document.getElementById(id).className='invalidInput'; } else { errores+=Field_Validate(id_form,'',id, tipo_dato,min,max, false); if(!errores) { document.getElementById(id).className='validInput'; }else{ matriz[0]=errores; bloquearForm(id_form); msgAlerta("",matriz); desBloquearForm(id_form); document.getElementById(id).className='invalidInput'; } } } function concordancia(id) { var pas1=document.getElementById('txtpass1').value; var pas2=document.getElementById('txtpass2').value; var matriz=new Array(); if(id=='txtpass1' && pas1!='') { if((pas2!='')&&(pas1!=pas2)) { matriz[0]=""; f=document.forms[0].id; msgAlerta("",matriz); document.getElementById('txtpass1').className='invalidInput'; document.getElementById('txtpass2').className='invalidInput'; return false; } } if(id=='txtpass2' && pas2!='') { if((pas1!='')&&(pas1!=pas2)) { matriz[0]=""; msgAlerta("",matriz); document.getElementById('txtpass1').className='invalidInput'; document.getElementById('txtpass2').className='invalidInput'; return false; } else { if((pas1!='') && (pas1==pas2)) { document.getElementById('txtpass1').className='validInput'; document.getElementById('txtpass2').className='validInput'; } } } return true; } function hora() { var today=new Date() var h=today.getHours() var m=today.getMinutes() var s=today.getSeconds() m=ponCero(m) s=ponCero(s) document.getElementById('div_hora').innerHTML=" | "+h+":"+m+":"+s t=setTimeout('hora()',1000) } function ponCero(i) { if (i<10) {i="0" + i} return i } function validar_localizacion(idf,ide) { var errores=''; var matriz=new Array(); errores+=Field_Validate(idf,'',ide, "cp",5,5, false); if (errores!='') { matriz[0]=errores; msgAlerta('',matriz); }else{ document.forms[idf].submit(); } } function mostrar_tapaTodo() { document.getElementById('tapaTodo').style.width=document.body.offsetWidth; document.getElementById('tapaTodo').style.height=document.body.scrollHeight; document.body.style.overflow='hidden'; document.getElementById('tapaTodo').style.bgcolor='black'; document.getElementById('tapaTodo').style.display='inline'; var numForms = document.forms.length if (document.all) { if(numForms>0) { for(i=0;i0) { for(i=0;i dia)) { ano=(ano-1); } if (mesnaz > mes) { ano=(ano-1); } var edad=(ano-anonaz); return edad; } function bisiesto(anyo) { if((anyo%4)==0) { if((anyo%100)==0) { if((anyo%400)==0) { return true; }else{ return false; } }else{ return true; } }else{ return false; } } function msgAlerta(titulo,matriz) { /* @matriz: matriz de n elementos donde cada elemento será una linea a pintar de código HTML dentro del mensaje de alerta @titulo: título del mensaje */ var anchoVentana=screen.width; var altoVentana=screen.height; var mayor=0; var errores=''; var u; for(u=0;umayor) mayor=matriz[u].length; } ancho=mayor*6; distIzquierda=(anchoVentana/2)-(ancho/2); distArriba=(altoVentana/2)-((u*15)/2); mostrar_tapaTodo(); document.getElementById('revertbox11').style.width=ancho+'px'; document.getElementById('revertbox11').style.left=distIzquierda + 'px'; document.getElementById('revertbox11').style.display='block'; document.getElementById('tituloAlerta').innerHTML=titulo; document.getElementById('textoAlerta').innerHTML=errores; } function restaurar() { document.getElementById('revertbox11').style.display='none'; if(document.forms.length>0) { var frm=document.forms[0].id; } ocultar_tapaTodo(frm); } function bloquearForm(id) { var formulario = document.getElementById(id); if(formulario) { var x=document.forms[id].elements.length; for(i=0;i