var required = { 'esForm':[
  { 'email':'Your email address','zipcode':'Zip code' }
]};

$('#esForm input:text').bind('focus',function() {
  $('#esForm div.fmsg:hidden').slideDown(300);
  if (this.value == required.esForm[0][this.name].toLowerCase()) { this.value = ''; }
  $(this).removeClass('default');
}).bind('blur',function() {
  if (this.value == '') {
    $(this).addClass('default').val(required.esForm[0][this.name].toLowerCase());
  }
});
  
$('#esForm').bind('submit',function() {
  if (validate(this)) {
    $('input:submit',this).attr('disabled',true).val('Hold on...');
    var formdata = new Object();
    $('input:hidden,input:text',this).each(function() {
      formdata[this.name] = this.value;
    });
    $.ajax({
      dataType:'json',
      url:this.action,
      data:formdata,
      type:'post',
      success:function(sdata) {
        $('#esForm').fadeOut(300,function() {
          $(this).html('<p class="msg">'+((sdata.status)?sdata.msg:'<strong>ERROR:</strong> '+sdata.msg)+'</p>').fadeIn(300);
        });
      }
    });
  }
  return(false);
});
