function puntuar(puntos,idmapa,idcapa)
{
	var url = 'puntuar.php?idmapa=' + idmapa + "&puntos=" + puntos ;
	xmlhttp.open("GET",url,true);
//	window.open (url)
	xmlhttp.onreadystatechange=function() {
	if (xmlhttp.readyState==4) {
		data = xmlhttp.responseText;
		alert('Gracias por votar el chiste y ayudarnos!!!');
		document.getElementById('vota' + idcapa).style.visibility='hidden'
	}
	}
	xmlhttp.setRequestHeader('Accept','message/x-jl-formresult');
	xmlhttp.send(null);
	
	return false;	
}
function puntuarmal(idmapa)
{
	var url = 'puntuarmal.php?idmapa=' + idmapa  ;
	xmlhttp.open("GET",url,true);
//	window.open (url)
	xmlhttp.onreadystatechange=function() {
	if (xmlhttp.readyState==4) {
		data = xmlhttp.responseText;
		alert('Gracias por  ayudarnos!!!\nHemos tomado nota.');
		
	}
	}
	xmlhttp.setRequestHeader('Accept','message/x-jl-formresult');
	xmlhttp.send(null);
	
	return false;	
}
	var enviar ='no';
	function comprobar(){
		var msgerror='';
		if (document.forms['datos'].nombre.value=='') 
			msgerror = '* Nombre completo\n';
		if (document.forms['datos'].email.value=='') 
			msgerror = msgerror +'* Email\n';
		if (document.forms['datos'].comentario.value=='') 
			msgerror = msgerror +'* Comentario\n';
		if (msgerror!=''){
			alert('Los siguientes campos son obligatorios:\n\n'+msgerror);
			return false;
			}
			else
			{
					var url = 'codigo.php?codigo=' + document.forms['datos'].codigo.value;
					//window.open (url);
					xmlhttp.open("GET",url,true);
					xmlhttp.onreadystatechange=function() {
					if (xmlhttp.readyState==4) {
						var res = xmlhttp.responseText;
						if (res=='yes')
							document.forms['datos'].submit();
						else
							{
							alert('Código incorrecto');
							return false;
							}
						}}
					 xmlhttp.setRequestHeader('Accept','message/x-jl-formresult');
					 xmlhttp.send(null);
					return false;

			}
	}
	function comprobarchiste(){
		var msgerror='';
		if (document.forms['datos'].nombre.value=='') 
			msgerror = '* Nombre completo\n';
		if (document.forms['datos'].email.value=='') 
			msgerror = msgerror +'* Email\n';
				if (document.forms['datos'].titulo.value=='') 
					msgerror = msgerror +'* Título del chiste\n';
		if (document.forms['datos'].texto.value=='') 
			msgerror = msgerror +'* Chiste\n';
			if (document.forms['datos'].tags.value=='') 
				msgerror = msgerror +'* Se te olvidó decirnos de qué va tu chiste\n';
		if (msgerror!=''){
			alert('Los siguientes campos son obligatorios:\n\n'+msgerror);
			return false;
			}
			else
			{
					var url = 'codigo.php?codigo=' + document.forms['datos'].codigo.value;
					//window.open (url);
					xmlhttp.open("GET",url,true);
					xmlhttp.onreadystatechange=function() {
					if (xmlhttp.readyState==4) {
						var res = xmlhttp.responseText;
						if (res=='yes')
							document.forms['datos'].submit();
						else
							{
							alert('Código incorrecto');
							return false;
							}
						}}
					 xmlhttp.setRequestHeader('Accept','message/x-jl-formresult');
					 xmlhttp.send(null);
					return false;

			}
	}
	function comprobarchiste2(){
		var msgerror='';
		if (document.forms['datos'].emaildestinatario.value=='') 
			msgerror = '* Email de tu amigo o amigos\n';
		if (document.forms['datos'].nombre.value=='') 
			msgerror = msgerror +'* Tu nombre o apodo\n';
		if (document.forms['datos'].tuemail.value=='') 
			msgerror = msgerror +'* Tu email\n';
		if (msgerror!=''){
			alert('Los siguientes campos son obligatorios:\n\n'+msgerror);
			return false;
			}
			else
			{
					var url = 'codigo.php?codigo=' + document.forms['datos'].codigo.value;
					//window.open (url);
					xmlhttp.open("GET",url,true);
					xmlhttp.onreadystatechange=function() {
					if (xmlhttp.readyState==4) {
						var res = xmlhttp.responseText;
						if (res=='yes')
							document.forms['datos'].submit();
						else
							{
							alert('Código incorrecto');
							return false;
							}
						}}
					 xmlhttp.setRequestHeader('Accept','message/x-jl-formresult');
					 xmlhttp.send(null);
					return false;

			}
	}
	function comprobarusuario(){
		var msgerror='';
		if (document.forms['datos'].usuario.value=='') 
			msgerror = '* Tu nombre o apodo\n';
		if (document.forms['datos'].pass.value=='') 
			msgerror = msgerror +'* Tu contraseña\n';
		if (document.forms['datos'].email.value=='') 
			msgerror = msgerror +'* Tu email\n';
		if (msgerror!=''){
			alert('Los siguientes campos son obligatorios:\n\n'+msgerror);
			return false;
			}
		else
			{return true}
	
	}