var CtFormLightbox=Class.create({initialize:function(a){this.element=a;var b=this.element;b.observe("submit",function(d){d.stop();var c=d.element();c.select(".ctwebform-element-validationerror").each(function(e){e.up().removeClassName("ctform-element-container-validationerror");e.remove()});new Ajax.Request(c.readAttribute("action"),{method:c.readAttribute("method"),parameters:c.serialize(),onSuccess:function(e){alert(e.responseText.evalJSON());lightbox.hide()},onFailure:function(g){var e=g.responseText.evalJSON();for(var f in e){var h=$("ctwebform-element-"+f);if(h===null){h=$("appbase-form-view-default-"+f)}var j=h.select(".ctwebform-element-validationerror");if(j.size()===0){h.insert({bottom:'<span class="ctwebform-element-validationerror">'+e[f]+"</span>"});h.addClassName("ctform-element-container-validationerror")}new Effect.Pulsate(h,{pulses:1,duration:0.5})}}})})}});document.observe("lightbox:contentUpdated",function(a){lightbox.content.select("form.ctform").each(function(b){new CtFormLightbox(b)})});
