
jQuery(document).ready(function(){    
  var hide_or_show_label = function(current){
      var label = jQuery("#trial_user_signup_form label[for='" + current.attr("id") +"']");
      if(current.val() != ''){
        label.hide();
      }else{
        label.show();
      }
    };
  var initial_check_for_recorded_input = function(){
    jQuery("#trial_user_signup_form input[type='text']").each(function(){
      hide_or_show_label(jQuery(this));
    });
    jQuery("#trial_user_signup_form input[type='password']").each(function(){
      hide_or_show_label(jQuery(this));
    });
  };
  // using setTimeout because of Safari prepopulate field functionality which happens
  // between 50 and 500 ms after the document.load event
  setTimeout(initial_check_for_recorded_input, 1000);
  
  

  jQuery("#trial_user_signup_form input").focus(function(){
    jQuery("#trial_user_signup_form label[for='" + jQuery(this).attr("id") +"']").hide();
  });

  jQuery("#trial_user_signup_form input").blur(function(e){
    hide_or_show_label(jQuery(this));
  });

  
});

