function comprobar (){
  
    var formato;
  	var comparacion;
   
    /*Comprueba que el mail no este vacio*/
    if (document.suscripcion.txtemail.value == ""){
    	alert("Debes rellenar el campo direccion email");
		  return false;
    }
    /*Comprueba que el mail lleve una @ y que no lleve otra clase de simbolos*/
    else{
    	email = document.suscripcion.txtemail.value;
      	formato = /^([\w-\.])+@([\w-]+\.)+([a-z]){2,4}$/;
     	comparacion = formato.test(email);

      if(comparacion == false){
          alert("El correo ingresado no es válido");
          return false;
     }
    }
    
    document.suscripcion.submit();
    return false;
  }
  

function imprimir(){

	texto=document.getElementById('imprime').innerHTML ;
	
	texto=texto.replace(/bgcolor="#[ABCDEF0123456789]+"/gi,"bgcolor='#FFFFFF'");
	texto=texto.replace(/font color="#FFFFFF"/gi,"font color='#7E7984'");
	var posicion=texto.search(/<td valign="top">/gi);
		if (posicion==-1){
		posicion=posicion=texto.search(/<td valign=top>/gi);
	}
	texto=Right(texto,texto.length-(posicion+17));	
	posicion=texto.search(/<map name="FPMap0">/gi);
	if (posicion==-1){
		posicion=posicion=texto.search(/<map name=FPMap0>/gi);
	}	
	texto=Left(texto,posicion);

	popup=window.open('','_blank');
	popup.document.write('<html>\n<head>\n<title>El Club de Jazz</title>\n');
	popup.document.write('<LINK REL=STYLESHEET HREF="http://www.elclubdejazz.com/estilos2.css">\n');
	popup.document.write('</head>\n');
	popup.document.write('<body onLoad="window.print();">\n');
	popup.document.write('<div align="center"><table border="0" cellpadding="0" cellspacing="0" width="500"><tr><td>');
	popup.document.write(texto+'\n');
	//popup.document.write('</td><td>&nbsp;</td></tr></table>');
	popup.document.write('</td></tr></table></div></body></html>');
	popup.document.close();
	setTimeout('popup.close()',2000)
}

function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}

function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}

