/* Thanks to http://www.johnandcailin.com */
function inlineFieldLabel (label, inputid, formid)
{
  var fieldLabel = label;     // string to put in your text input
  var textInput = $(inputid)  // your text input field
  var form = $(formid)        // the form
 

  /* add the field label css class to the form field and set the value */
  textInput.addClass("intra-field-label").val(fieldLabel);

  /* remove the placeholder string when field gets focus */
  textInput.focus(function()
   {
      if(this.value == fieldLabel )
      {
         $(this).removeClass("intra-field-label").val("");
      };
   });

  /* add the field label string when field looses focus */
  textInput.blur(function()
   {
      if(this.value == "")
      {
         $(this).addClass("intra-field-label").val(fieldLabel );
      };
   });

   /* if the field is set to the fieldLabel on submit, clear the field */
   form.submit(function()
   {
      if(textInput.val() == fieldLabel)
      {
         textInput.removeClass("intra-field-label").val("");
      };
   });

}

function togglePasswordField()
{
  $('#password-clear').show();
  $('#password-password').hide();
 
  $('#password-clear').focus(function() {
    $('#password-clear').hide();
    $('#password-password').show();
    $('#password-password').focus();
  });
  $('#password-password').blur(function() {
    if($('#password-password').val() == '') {
      $('#password-clear').show();
      $('#password-password').hide();
    }
  });
 
  $('.default-value').each(function() {
    var default_value = this.value;
    $(this).focus(function() {
      if(this.value == default_value) {
        this.value = '';
      }
    });
    $(this).blur(function() {
      if(this.value == '') {
        this.value = default_value;
      }
    });
  });
}

