function contador (campo, limite) { if (campo.value.length > limite) campo.value = campo.value.substring(0, limite); } function persiana(objId,target,clicker) { obj = document.getElementById(objId); if (obj) { if (obj.style.display == "block"){ obj.style.display = "none"; str = new String(clicker); if (str !="") { var etiq =document.getElementById(clicker); } } else{ obj.style.display = "block"; str = new String(clicker); if (str !="") { var etiq =document.getElementById(clicker); } } } } function juego_mostrarpopup(nombre,enlace,ancho,alto) { window.open(enlace,nombre,"toolbar=no,scrollbars=no,location=no,statusbar=no,menubar=no,resizable=yes,width=" + ancho + ",height=" + alto); } function juego_mostrarpantalla(pagina) { var opciones=("toolbar=no, location=no, directories=no, status=no, menubar=yes ,scrollbars=no, resizable=no, fullscreen=yes"); window.open(pagina,"juego",opciones); } function comprobarcomentario(formulario) { var error = false; if ((document.comentarios.com_nombre.value=='' || document.comentarios.com_email.value=='' || document.comentarios.com_comentario.value=='') && error==false) { alert("Debes de poner un nombre, tu email y un comentario"); error=true; } if(document.comentarios.com_email.value!=''){ if(!checkemail(document.comentarios.com_email.value)){ alert("El email es incorrecto"); error=true; } } if (error==false) { document.comentarios.submit(); } } function checkemail(str){ var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i if (filter.test(str)) return true; else return false; } function comprobaramigo(formulario) { var error = false; if(compEmail1()==1 && error==false){ alert("Debes de poner tu mail y el de tu amigo"); error= true; } if(compEmail1()==2 && error==false){ alert("Una de las direcciones de email no es correcta"); error= true; } if(compEmail1()==3 && error==false){ alert("Una de las direcciones de email no es correcta"); error= true; } if(compEmail1()==4 && error==false){ alert("Debes indicar tu nombre y el de tu amigo"); error= true; } if(error==false) { document.envioamigo.submit(); } } function compEmail1(){ if(document.envioamigo.frmCorreo1.value=='' || document.envioamigo.frmCorreo2.value==''){ return 1; } if(document.envioamigo.frmCorreo1.value.indexOf('@')==-1 || document.envioamigo.frmCorreo2.value.indexOf('@')==-1){ return 2; } if(document.envioamigo.frmCorreo1.value.indexOf('.')==-1 || document.envioamigo.frmCorreo2.value.indexOf('@')==-1){ return 3; } if(document.envioamigo.frmNombre1.value=='' || document.envioamigo.frmNombre2.value==''){ return 4; } } function getidlayer(id) { return document.getElementById(id); } function showlayer(e) { if (e) { e.style.display = 'block'; } } function hidelayer(e) { if (e) { e.style.display = 'none'; } } function add_favorito(idjuego) { xajax_ajax_usuario_favorito(idjuego); } function $(v) { return(document.getElementById(v)); } function cheque_usuario(o){ o.value=o.value.replace(/([^0-9a-zA-Z\-])/g,""); o.value=o.value.toLowerCase(); }