function agregar_a_favoritos() { if (document.all) { var url=document.location.href; var titulo="Bip-perpignan.fr"; window.external.AddFavorite(url,titulo); } else { var l=new Array(); l[0]="Appuyer sur Ctrl+D pour ajouter ce site à vos favoris"; msgAlerta('Ajouter aux favoris',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("Erreurs :",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("Erreurs :",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]="Les deux mot de passe ne correspondent pas."; f=document.forms[0].id; msgAlerta("Erreurs :",matriz); document.getElementById('txtpass1').className='invalidInput'; document.getElementById('txtpass2').className='invalidInput'; return false; } } if(id=='txtpass2' && pas2!='') { if((pas1!='')&&(pas1!=pas2)) { matriz[0]="Les deux mot de passe ne correspondent pas."; msgAlerta("Erreurs :",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('Erreurs :',matriz); }else{ document.forms[idf].submit(); } } function mostrar_tapaTodo(){ document.getElementById('tapaTodo').style.width=document.body.offsetWidth; var browser=navigator.appName; var viewportwidth; var viewportheight; // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight if (typeof window.innerWidth != 'undefined') { viewportwidth = window.innerWidth, viewportheight = window.innerHeight } // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document) else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) { viewportwidth = document.documentElement.clientWidth, viewportheight = document.documentElement.clientHeight } // older versions of IE else { viewportwidth = document.getElementsByTagName('body')[0].clientWidth, viewportheight = document.getElementsByTagName('body')[0].clientHeight } document.getElementById('tapaTodo').style.height = viewportheight + 'px'; //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.top = 200 + document.documentElement.scrollTop + '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); // ponerFocus(); } function msgConfirm(titulo, matriz, option, value) { /* @matriz: matriz de n elementos donde cada elemento será una linea a pintar de codigo 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;u'; if(matriz[u].length>mayor){ mayor=matriz[u].length; } } ancho=mayor*10; distIzquierda=(anchoVentana/2)-(ancho/2); distArriba=(altoVentana/2)-((u*15)/2); mostrar_tapaTodo(); document.getElementById('revertboxConfirm').style.width=ancho+'px'; document.getElementById('revertboxConfirm').style.left=distIzquierda + 'px'; document.getElementById('revertboxConfirm').style.top = 200 + document.documentElement.scrollTop + 'px'; document.getElementById('revertboxConfirm').style.display='block'; document.getElementById('tituloAlertaConfirm').innerHTML=titulo; document.getElementById('textoAlertaConfirm').innerHTML=errores; document.getElementById('confirmOption').value = option; document.getElementById('confirmOptionValue').value = value; } function renewalDecisionConfirm(accepted){ document.acceptRenewalForm.renewalOption.value = accepted; var lineas=new Array(); lineas[0]=""; lineas[1]="Est-ce que vous confirmez ?"; msgConfirm("Renouvellement d'abonnement", lineas, "form", "acceptRenewalForm"); //document.acceptRenewalForm.submit(); } function restaurarConfirm(action){ document.getElementById('revertboxConfirm').style.display='none'; if(action=='accept'){ var option = document.getElementById('confirmOption').value; var value = document.getElementById('confirmOptionValue').value; if(option=='form'){ document.getElementById(value).submit(); } if(option=='redirect'){ document.location.href=value; } } 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