$(document).ready(function(){
   $("#intro_mail").focus(function(){
   		$(this).css("background", "transparent url(img/intro_a.jpg) no-repeat scroll left top");	
   });
});

$('#fotos').cycle({ 
    fx:     'fade', 
    speed:   300, 
    timeout: 3000, 
    next:   '#next', 
    prev:   '#prev', 
    pause:   1 
});

function valida() {
	var mail = $('#intro_mail').val();
	if( /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/.test(mail)===false || !mail ) {
	  alert("El email introducido no parece válido");
	  return false;
	} else {
	  return true;
	}
}

function valida2() {
	var mail = $('#email').val();
	var tlf = $('#telefono').val();
	var errores = new Array();
	
	if( /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/.test(mail)===false || !mail ) {
	   errores[errores.length] = "El email introducido no parece válido";
	}
	if( $('#nombre').val() == '' || !$('#nombre').val() ) {
	  errores[errores.length] = 'No has completado el campo nombre.';
	}
	if( $('#apellidos').val() == '' || !$('#apellidos').val() ) {
	  errores[errores.length] = 'No has completado el campo de apellido.';
	}
	if( /^[69]{1}[0-9]{5,8}$/.test(tlf)===false || !tlf ) {
	  errores[errores.length] = 'El teléfono no es válido.';
	}
	
	if(errores.length>0) {
	  alert(errores.join('\n'));
	  return false;
	} else {
	  return true;
	}
}

 $( document ).ready( function() {  
     $("a[rel='pop-up']").click(function () {  
         var caracteristicas = "height=400,width=400,scrollTo,resizable=1,scrollbars=1,location=0";  
         nueva=window.open(this.href, 'Popup', caracteristicas);  
         return false;  
  });  
 });  