 YAHOO.namespace('example.container');

 function submitCallback(obj) {
  var response = obj.responseText;
  response = response.split("<!")[0];
  document.getElementById("resp").innerHTML = response;
  eval(response);
 }

 function submitFailure(obj) {
  alert("Submission failed: " + obj.status);
 }

 function init() {
  var handleCancel = function() {
   this.cancel();
  }
  var handleSubmit = function() {
   this.submit();
  }
  YAHOO.example.container.dlg = new YAHOO.widget.Dialog("dlg", { modal:true, visible:false, width:"450px", fixedcenter:true, constraintoviewport:true, draggable:false });
  
  YAHOO.example.container.dlg.callback.success = submitCallback;
  YAHOO.example.container.dlg.callback.failure = submitFailure;

  var listeners = new YAHOO.util.KeyListener(document, { keys : 27 }, {fn:handleCancel,scope:YAHOO.example.container.dlg,correctScope:true} );

  YAHOO.example.container.dlg.cfg.queueProperty("keylisteners", listeners);

//  YAHOO.example.container.dlg.cfg.queueProperty("buttons", [ { text:"Join Now",handler:handleSubmit } ]);

  
  var handleManual = function(type, args, obj) {
   alert("Manual submission of " + this.id + " detected");
  }

  YAHOO.example.container.dlg.manualSubmitEvent.subscribe(handleManual, YAHOO.example.container.dlg, true);
  YAHOO.example.container.dlg.render();
  YAHOO.example.container.dlg.show()
 }

 YAHOO.util.Event.addListener(window, "load", init);
