function default_boxes() {
  //####Section: The following is code to make default search text
    // set the value to be equal to the default attribute
    $("input[default]").each(function () {
      if (!$(this).attr('value')) {
        $(this).css("color","#aaa");
        $(this).attr('value', $(this).attr('default'));
      }
    });
    
    bind_default_boxes();
  //####End Section
}

function bind_default_boxes() {
  $("input[default]").focus(function () {
    // check if we have the default text and clear
    if ($(this).attr('value') == $(this).attr('default')) {
      $(this).attr('value', '');
      $(this).css("color","black");
    }
  });

  $("input[default]").blur(function () {
    // unclear back to default if empty
    if ($(this).attr('value') == '') {
      $(this).attr('value', function () {
        return $(this).attr('default');
      });
      $(this).css("color","#aaa");
    }
  });
  
  $("form").submit(function () {
    // clear forms before submission
    clear_default_values();
  });
}

function clear_default_values() {
  $("input[default]").each(function(i) {
    if ($(this).attr('value') == $(this).attr('default')) {
      $(this).attr('value', '');
    }
  });
}