$(document).ready(function () {
	i=0;
	$("#infoContent").jPaginate();
	
	
	
	$("#contact_b").click(function () {
		if (i==0) {
				$("#contactform").animate( 
				{
					marginTop:'0'
				}
				);
				$("#wrap").animate( 
				{
					top:'350'
				}
				);
				i=1;
		} else {	
				$("#contactform").animate( 
				{
					marginTop:'-350'
				}
				);
				$("#wrap").animate( 
				{
					top:'0'
				}
				);
				i=0;
	    }
	});
	
	$.validator.setDefaults({
			submitHandler: function() { 
				$().ajaxStart(function() {
				$('#loading').show();
				$('#result').hide();
			}).ajaxStop(function() {
				$('#loading').hide();
				$('#result').fadeIn('slow');
			});
		 // Definimos el metodo ajax, los datos
        $.ajax({
            type: 'POST',
            url: $("#myform").attr('action'),
            data: $("#myform").serialize(),
            success: function(data) {
			
                // Imprimimos la respuesta en el div result
                $('#result').html(data);

            }
        })
       
        return false;
	 }
	});
	
	// validate signup form on keyup and submit
	$("#myform").validate({
		rules: {
			nombre: "required",
			email: {
				required: true,
				email: true
			}
		},
		messages: {
			nombre: "This field is necessary",
			email: "Please, introduce a correct email"
		}
	});
	
	$("#slider").easySlider({
				auto: true, 
				continuous: true
			});
			
			
});
