var modal_enter_email = '<h3>Keen for a bit of VIP treatment?</h3><p>Sign up to the Beer Festival VIP list and receive special<br/> updates and discounts on tickets and beer!</p><input type="text" id="modal_contact_email" name="modal_contact_email" value="Email Address" onfocus="if (this.value == \'Email Address\') { this.value=\'\'; }" onblur="if (this.value == \'\') { this.value=\'Email Address\'; }" />';
var modal_success = "<h3>Nice Work!</h3><p>We've sent some sweet VIP action to your inbox already!<p>";
var modal_error_pre = '<h3>Whoops?</h3><p>';
var modal_error_post = ', please try again.</p><input type="text" id="modal_contact_email" name="modal_contact_email" value="Email Address" onfocus="if (this.value == \'Email Address\') { this.value=\'\'; }" onblur="if (this.value == \'\') { this.value=\'Email Address\'; }" />';

function mycallbackform(v,m,f){
  if(v > 0) {
    $.post('vip/signup_modal', f,
      function(data) {
        if(data.success) {
          $.prompt(modal_success,{prefix:'jqismooth'});
        } else {
          $.prompt(modal_error_pre+data.message+modal_error_post,{
            callback: mycallbackform,
            buttons: {
              'No Thanks':-1,
              'Sign Me Up':1
            },
            focus: 1,
            prefix:'jqismooth'
            })
        }
      }, "json"
    );      
  }
}

$(document).ready(
  $.prompt(modal_enter_email,{
    callback: mycallbackform,
    buttons: {
      'No Thanks':-1,
      'Sign Me Up':1
    },
    focus: 1,
    prefix:'jqismooth'
    })
);