$(document).ready(function(){
  // Select first form field on the page, as long as it doesn't have a title
  // Note: text fields with a title set typically have preview text
  if (!$('*[tabindex="1"]').attr('title')) {
    $('*[tabindex="1"]').focus();
  }
  
  // Remove/replace default text from textbox on focus/blur respectively
  // Note: requires 'title' and 'value' of input to be set to default text
  $('input:text').focus(function() {
    var value = $(this).attr('title');
    if (value != undefined && $(this).val() == value) {
      $(this).val('');
    }
  });
  
  $('input:text').blur(function() {
    var value = $(this).attr('title');
    if (value != undefined && $(this).val() == '') {
      $(this).val(value);
    }
  });
});

