    $(document).ready(function(){
      $(":text").labelify();
      
      // Submit the form via Ajax      
      $('#newsletter').submit( submitForm );
      
      function submitForm() {
        var contactForm = $(this);
       
        // Are all the fields filled in?
       
        if (!$('.email').val()) {
       
          // No; display a warning message and return to the form
          alert('Please enter your email address.');
       
        } else {
       
          // Yes; submit the form to the PHP script via Ajax
              
          $.ajax( {
            url: contactForm.attr( 'action' ) + "?ajax=true",
            type: contactForm.attr( 'method' ),
            data: contactForm.serialize(),
            success: submitFinished
          } );
        }
        
        $('.email').val('submitting...');
          
        // Prevent the default form submission occurring
        return false;
      }
      
      function submitFinished( response ) {
        response = $.trim( response );
        if ( response == "success" ) {
          $('.email').val('Thanks!');
        } else {
          $('.email').val('Error. Try again.');
        }
      }
    });
