// Main function
$(document).ready(function(){
  // This function disables the submit button upon clicking submit
  disableSubmitButtonOnFormSubmit("#paymentForm")
  labelInside('#email_address.form_input_replace', 'Email Updates and Promotions')
})

function disableSubmitButtonOnFormSubmit(formid) {
  $(formid).submit(function(){
      $('input[type=submit]', this).attr('disabled', 'disabled').attr("value",'Please Wait...');
  });
}

/**
 * labelInside adds a label to the inside of an input field
 *
 * @author Christopher Tatro <ctatro@janeiredale.com>
 * @since  2011-03-08
 *
 * @param  input_field The selector value of the input field
 * @param  label_words The words you want the field to say
 */
function labelInside(input_field, label_words)
{
  $(input_field).val(label_words).addClass('inactive');

  $(input_field).focus(function() 
  {
    if($(this).val()== label_words)
    {
      $(this).val("");
      $(this).removeClass('inactive');
    }
  })
  .blur(function() {
    if($(this).val()=="")
    {
      $(this).val(label_words);
      $(this).addClass('inactive');
    }
  });
}

