$(document).ready(function(){ 

  $('.txtReplace').focus(function(){ 
		//alert($(this).val());
		//alert($(this).attr('Desde'));
    if($(this).val() == $(this).attr('alt'))
    {
      $(this).val('');
    }
  });
  
  $('.txtReplace').blur(function(){
    if($(this).val() == '')
    {
      $(this).val($(this).attr('alt'));
    } 
  });


	//valido email para caja newsletter header
	$("#newsletterForm").validate({errorLabelContainer: "#messageBox"});



  $("#newsletterForm").submit(function(event) {

	$('#newsletterForm').hide();
	$('#responseBox').empty().append("<p>Enviando...</p>");

    /* stop form from submitting normally */
    event.preventDefault();
        
    /* get some values from elements on the page: */
    var $form = $( this ),
        ref_field = $form.find( 'input[name="ref"]' ).val(),
		email_field = $form.find( 'input[name="email"]' ).val(),
        url = $form.attr( 'action' );

    /* Send the data using post and put the results in a div */
    $.post( url, { ref: ref_field, email:email_field },
      function( data ) {
		  $('#responseBox').empty().append("<p>Muchas gracias por suscribirse!</p>");
      }
    );
  });


}); 
