
function alll(){var m=document.f1.descripcion.value;var mm=m.length;document.f1.t2.value=mm;if(mm>255){var str=document.f1.descripcion.value;document.f1.descripcion.value=str.substr(0,255);alert('Solo se permiten 255 caracteres.');}
setTimeout("alll()",0);}
function contador2(){var m=document.f1.t1_contador.value;var mm=m.length;document.f1.t2_contador.value=mm;if(mm>=255){document.f1.t1_contador.value="";}
setTimeout("contador2()",0);}
function contador(){var m=document.form_contador.t_contador.value;var mm=m.length;document.form_contador.texto2_contador.value=mm;if(mm>=300){document.form_contador.t_contador.value="";}
setTimeout("contador()",0);}
function muestra_oculta(id)
{if(document.getElementById)
{var el=document.getElementById(id);document.getElementById("matriculacion").className='hidden';document.getElementById("precio").className='hidden';document.getElementById("kilometraje").className='hidden';el.className=(el.className=='hidden')?'visible':'hidden';}}
function contenido_a_mostrar_busqueda_1(id){if(document.getElementById){var el=document.getElementById(id);el.style.display=(el.style.display=='none')?'block':'none';}}
function muestra(id){if(document.getElementById){var el=document.getElementById(id);el.className='display_block';}}
function muestra_oculta_user(id)
{if(document.getElementById)
{var el=document.getElementById(id);el.style.display=(el.style.display=='none')?'block':'none';var zindex=document.getElementById('flash');zindex.className=(zindex.className=='z_index')?'noz_index':'z_index';}}
function contenido_a_mostrar_busqueda(id){if(document.getElementById){var el=document.getElementById(id);var text_el1=document.getElementById('texto_'+id+'1');var text_el2=document.getElementById('texto_'+id+'2');el.style.display=(el.style.display=='block')?'none':'block';text_el1.style.display=(text_el1.style.display=='none')?'block':'none';text_el2.style.display=(text_el2.style.display=='block')?'none':'block';}}
function cerrar(id)
{document.getElementById(id).className='hidden';}
function aceptar(id)
{document.getElementById(id).className='hidden';}
function contar(form,name){n=document.forms[form][name].value.length;t=255;if(n>t){document.forms[form][name].value=document.forms[form][name].value.substring(0,t);}
else{document.forms[form]['result'].value=t-n;}}
function redondeo2decimales(numero)
{var original=parseFloat(numero);var result=Math.round(original*100)/100;return result;}
function calcula_cuota(form,meses,euros)
{n=document.forms[form][meses].value;d=document.forms[form][euros].value;if(n!=0&&d!=0)
{document.forms[form]['resultado'].value=redondeo2decimales(d*n).toString().replace(".",",");}
else
{document.forms[form]['resultado'].value="-";}
var x=document.getElementById(meses);document.forms[form]['numero_meses'].value=x.options[x.selectedIndex].text;}
var nav4=window.Event?1:0;function acceptNum(evt){var key=nav4?evt.which:evt.keyCode;return(key<=13||((key>=48&&key<=57)||key==46));}
function login()
{new Fx.Tween($('error_login')).start('opacity','0');new Fx.Tween($('error_email')).start('opacity','0');new Fx.Tween($('error_pass')).start('opacity','0');if(!$('email').value.match(/^.*@.*\..*$/)){new Fx.Tween($('error_login')).start('opacity','0');new Fx.Tween($('error_pass')).start('opacity','0');new Fx.Tween($('error_email')).start('opacity','1');return 0;}
if($('pass').value==""){new Fx.Tween($('error_login')).start('opacity','0');new Fx.Tween($('error_email')).start('opacity','0');new Fx.Tween($('error_pass')).start('opacity','1');return 0;}
var myRequest=new Request({method:'post',url:'/modulos/micuenta/include/ajax.php?action=login',onSuccess:function(result){if(result=="1"){window.location="/micuenta/mostrar.htm";}else{new Fx.Tween($('error_login')).start('opacity','1');}}});myRequest.send('remember='+$('remember').value+'&email='+$('email').value+'&pass='+$('pass').value);}
function validarSiNumero(numero){if(!/^([0-9])*$/.test(numero))
return false;else
return true;}
function reDimFoto(ancho,alto,cual,maxAlto,maxAncho,imagen)
{imagen.style.visibility="";forma="";if(ancho>alto){forma='apaisada'}
if(ancho<alto){forma='retrato'}
if(forma=='apaisada')
{if(ancho>maxAncho)
{porcientoAnchura=parseInt(maxAncho/ancho*100)
imagen.width=maxAncho
imagen.height=porcientoAnchura*alto/100
if(imagen.height>maxAlto)
{porcientoAltura=maxAlto/imagen.height*100
imagen.height=maxAlto
imagen.width=porcientoAltura*imagen.width/100}}}
else if(forma=='retrato')
{if(alto>maxAlto)
{porcientoAltura=maxAlto/alto*100
imagen.height=maxAlto
imagen.width=porcientoAltura*ancho/100
if(imagen.width>maxAncho)
{porcientoAnchura=parseInt(maxAncho/imagen.width*100)
imagen.width=maxAncho
imagen.height=porcientoAnchura*imagen.height/100}}}}