(function() {
  ;
  eval(";window.Modernizr=function(a,b,c){function y(){e.input=function(a){for(var b=0,c=a.length;b<c;b++)p[a[b]]=a[b]in k;return p}(\"autocomplete autofocus list placeholder max min multiple pattern required step\".split(\" \")),e.inputtypes=function(a){for(var d=0,e,g,h,i=a.length;d<i;d++)k.setAttribute(\"type\",g=a[d]),e=k.type!==\"text\",e&&(k.value=l,k.style.cssText=\"position:absolute;visibility:hidden;\",/^range$/.test(g)&&k.style.WebkitAppearance!==c?(f.appendChild(k),h=b.defaultView,e=h.getComputedStyle&&h.getComputedStyle(k,null).WebkitAppearance!==\"textfield\"&&k.offsetHeight!==0,f.removeChild(k)):/^(search|tel)$/.test(g)||(/^(url|email)$/.test(g)?e=k.checkValidity&&k.checkValidity()===!1:/^color$/.test(g)?(f.appendChild(k),f.offsetWidth,e=k.value!=l,f.removeChild(k)):e=k.value!=l)),o[a[d]]=!!e;return o}(\"search tel url email datetime date month week time datetime-local number range color\".split(\" \"))}function x(a,b){return!!~(\"\"+a).indexOf(b)}function w(a,b){return typeof a===b}function v(a,b){return u(prefixes.join(a+\";\")+(b||\"\"))}function u(a){j.cssText=a}var d=\"2.0.6\",e={},f=b.documentElement,g=b.head||b.getElementsByTagName(\"head\")[0],h=\"modernizr\",i=b.createElement(h),j=i.style,k=b.createElement(\"input\"),l=\":)\",m=Object.prototype.toString,n={},o={},p={},q=[],r,s={}.hasOwnProperty,t;!w(s,c)&&!w(s.call,c)?t=function(a,b){return s.call(a,b)}:t=function(a,b){return b in a&&w(a.constructor.prototype[b],c)};for(var z in n)t(n,z)&&(r=z.toLowerCase(),e[r]=n[z](),q.push((e[r]?\"\":\"no-\")+r));e.input||y(),u(\"\"),i=k=null,e._version=d;return e}(this,this.document);");

  eval("(function($){function maybeCall(thing,ctx){return(typeof thing=='function')?(thing.call(ctx)):thing};function Tipsy(element,options){this.$element=$(element);this.options=options;this.enabled=true;this.fixTitle()};Tipsy.prototype={show:function(){var title=this.getTitle();if(title&&this.enabled){var $tip=this.tip();$tip.find('.tipsy-inner')[this.options.html?'html':'text'](title);$tip[0].className='tipsy';$tip.remove().css({top:0,left:0,visibility:'hidden',display:'block'}).prependTo(document.body);var pos=$.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight});var actualWidth=$tip[0].offsetWidth,actualHeight=$tip[0].offsetHeight,gravity=maybeCall(this.options.gravity,this.$element[0]);var tp;switch(gravity.charAt(0)){case'n':tp={top:pos.top+pos.height+this.options.offset,left:pos.left+pos.width/2-actualWidth/2};break;case's':tp={top:pos.top-actualHeight-this.options.offset,left:pos.left+pos.width/2-actualWidth/2};break;case'e':tp={top:pos.top+pos.height/2-actualHeight/2,left:pos.left-actualWidth-this.options.offset};break;case'w':tp={top:pos.top+pos.height/2-actualHeight/2,left:pos.left+pos.width+this.options.offset};break}if(gravity.length==2){if(gravity.charAt(1)=='w'){tp.left=pos.left+pos.width/2-15}else{tp.left=pos.left+pos.width/2-actualWidth+15}}$tip.css(tp).addClass('tipsy-'+gravity);$tip.find('.tipsy-arrow')[0].className='tipsy-arrow tipsy-arrow-'+gravity.charAt(0);if(this.options.className){$tip.addClass(maybeCall(this.options.className,this.$element[0]))}if(this.options.fade){$tip.stop().css({opacity:0,display:'block',visibility:'visible'}).animate({opacity:this.options.opacity})}else{$tip.css({visibility:'visible',opacity:this.options.opacity})}}},hide:function(){if(this.options.fade){this.tip().stop().fadeOut(function(){$(this).remove()})}else{this.tip().remove()}},fixTitle:function(){var $e=this.$element;if($e.attr('title')||typeof($e.attr('original-title'))!='string'){$e.attr('original-title',$e.attr('title')||'').removeAttr('title')}},getTitle:function(){var title,$e=this.$element,o=this.options;this.fixTitle();var title,o=this.options;if(typeof o.title=='string'){title=$e.attr(o.title=='title'?'original-title':o.title)}else if(typeof o.title=='function'){title=o.title.call($e[0])}title=(''+title).replace(/(^\s*|\s*$)/,\"\");return title||o.fallback},tip:function(){if(!this.$tip){this.$tip=$('<div class=\"tipsy\"></div>').html('<div class=\"tipsy-arrow\"></div><div class=\"tipsy-inner\"></div>')}return this.$tip},validate:function(){if(!this.$element[0].parentNode){this.hide();this.$element=null;this.options=null}},enable:function(){this.enabled=true},disable:function(){this.enabled=false},toggleEnabled:function(){this.enabled=!this.enabled}};$.fn.tipsy=function(options){if(options===true){return this.data('tipsy')}else if(typeof options=='string'){var tipsy=this.data('tipsy');if(tipsy)tipsy[options]();return this}options=$.extend({},$.fn.tipsy.defaults,options);function get(ele){var tipsy=$.data(ele,'tipsy');if(!tipsy){tipsy=new Tipsy(ele,$.fn.tipsy.elementOptions(ele,options));$.data(ele,'tipsy',tipsy)}return tipsy}function enter(){var tipsy=get(this);tipsy.hoverState='in';if(options.delayIn==0){tipsy.show()}else{tipsy.fixTitle();setTimeout(function(){if(tipsy.hoverState=='in')tipsy.show()},options.delayIn)}};function leave(){var tipsy=get(this);tipsy.hoverState='out';if(options.delayOut==0){tipsy.hide()}else{setTimeout(function(){if(tipsy.hoverState=='out')tipsy.hide()},options.delayOut)}};if(!options.live)this.each(function(){get(this)});if(options.trigger!='manual'){var binder=options.live?'live':'bind',eventIn=options.trigger=='hover'?'mouseenter':'focus',eventOut=options.trigger=='hover'?'mouseleave':'blur';this[binder](eventIn,enter)[binder](eventOut,leave)}return this};$.fn.tipsy.defaults={className:null,delayIn:0,delayOut:0,fade:false,fallback:'',gravity:'n',html:false,live:false,offset:0,opacity:0.8,title:'title',trigger:'hover'};$.fn.tipsy.elementOptions=function(ele,options){return $.metadata?$.extend({},options,$(ele).metadata()):options};$.fn.tipsy.autoNS=function(){return $(this).offset().top>($(document).scrollTop()+$(window).height()/2)?'s':'n'};$.fn.tipsy.autoWE=function(){return $(this).offset().left>($(document).scrollLeft()+$(window).width()/2)?'e':'w'};$.fn.tipsy.autoBounds=function(margin,prefer){return function(){var dir={ns:prefer[0],ew:(prefer.length>1?prefer[1]:false)},boundTop=$(document).scrollTop()+margin,boundLeft=$(document).scrollLeft()+margin,$this=$(this);if($this.offset().top<boundTop)dir.ns='n';if($this.offset().left<boundLeft)dir.ew='w';if($(window).width()+$(document).scrollLeft()-$this.offset().left<margin)dir.ew='e';if($(window).height()+$(document).scrollTop()-$this.offset().top<margin)dir.ns='s';return dir.ns+(dir.ew?dir.ew:'')}}})(jQuery);");

  $(function() {
    var style;
    style = ".tipsy{font-size:10px;padding:5px;position:absolute;z-index:100000}.tipsy-inner{-moz-border-radius:3px;-webkit-border-radius:3px;background-color:#000;border-radius:3px;color:#FFF;max-width:200px;padding:5px 8px 4px;text-align:center}.tipsy-arrow{border:5px dashed #000;height:0;line-height:0;position:absolute;width:0}.tipsy-arrow-n{border-bottom-color:#000}.tipsy-arrow-s{border-top-color:#000}.tipsy-arrow-e{border-left-color:#000}.tipsy-arrow-w{border-right-color:#000}.tipsy-n .tipsy-arrow{border-bottom-style:solid;border-left-color:transparent;border-right-color:transparent;border-top:none;left:50%;margin-left:-5px;top:0}.tipsy-nw .tipsy-arrow{border-bottom-style:solid;border-left-color:transparent;border-right-color:transparent;border-top:none;left:10px;top:0}.tipsy-ne .tipsy-arrow{border-bottom-style:solid;border-left-color:transparent;border-right-color:transparent;border-top:none;right:10px;top:0}.tipsy-s .tipsy-arrow{border-bottom:none;border-left-color:transparent;border-right-color:transparent;border-top-style:solid;bottom:0;left:50%;margin-left:-5px}.tipsy-sw .tipsy-arrow{border-bottom:none;border-left-color:transparent;border-right-color:transparent;border-top-style:solid;bottom:0;left:10px}.tipsy-se .tipsy-arrow{border-bottom:none;border-left-color:transparent;border-right-color:transparent;border-top-style:solid;bottom:0;right:10px}.tipsy-e .tipsy-arrow{border-bottom-color:transparent;border-left-style:solid;border-right:none;border-top-color:transparent;margin-top:-5px;right:0;top:50%}.tipsy-w .tipsy-arrow{border-bottom-color:transparent;border-left:none;border-right-style:solid;border-top-color:transparent;left:0;margin-top:-5px;top:50%}";
    return $("<style>" + style + "</style>").prependTo('head');
  });

  eval("(function(a){if(typeof define===\"function\"&&define.amd){define([\"jquery\"],a)}else{a(jQuery)}})(function(a){var b=[],c=a(document),d=a.browser.msie&&parseInt(a.browser.version)===6&&typeof window[\"XMLHttpRequest\"]!==\"object\",e=a.browser.msie&&parseInt(a.browser.version)===7,f=null,g=a(window),h=[];a.modal=function(b,c){return a.modal.impl.init(b,c)};a.modal.close=function(){a.modal.impl.close()};a.modal.focus=function(b){a.modal.impl.focus(b)};a.modal.setContainerDimensions=function(){a.modal.impl.setContainerDimensions()};a.modal.setPosition=function(){a.modal.impl.setPosition()};a.modal.update=function(b,c){a.modal.impl.update(b,c)};a.fn.modal=function(b){return a.modal.impl.init(this,b)};a.modal.defaults={appendTo:\"body\",focus:true,opacity:50,overlayId:\"simplemodal-overlay\",overlayCss:{},containerId:\"simplemodal-container\",containerCss:{},dataId:\"simplemodal-data\",dataCss:{},minHeight:null,minWidth:null,maxHeight:null,maxWidth:null,autoResize:false,autoPosition:true,zIndex:1e3,close:true,closeHTML:'<a class=\"modalCloseImg\" title=\"Close\"></a>',closeClass:\"simplemodal-close\",escClose:true,overlayClose:false,fixed:true,position:null,persist:false,modal:true,onOpen:null,onShow:null,onClose:null};a.modal.impl={d:{},init:function(b,c){var d=this;if(d.d.data){return false}f=a.browser.msie&&!a.boxModel;d.o=a.extend({},a.modal.defaults,c);d.zIndex=d.o.zIndex;d.occb=false;if(typeof b===\"object\"){b=b instanceof jQuery?b:a(b);d.d.placeholder=false;if(b.parent().parent().size()>0){b.before(a(\"<span></span>\").attr(\"id\",\"simplemodal-placeholder\").css({display:\"none\"}));d.d.placeholder=true;d.display=b.css(\"display\");if(!d.o.persist){d.d.orig=b.clone(true)}}}else if(typeof b===\"string\"||typeof b===\"number\"){b=a(\"<div></div>\").html(b)}else{alert(\"SimpleModal Error: Unsupported data type: \"+typeof b);return d}d.create(b);b=null;d.open();if(a.isFunction(d.o.onShow)){d.o.onShow.apply(d,[d.d])}return d},create:function(c){var e=this;e.getDimensions();if(e.o.modal&&d){e.d.iframe=a('<iframe src=\"javascript:false;\"></iframe>').css(a.extend(e.o.iframeCss,{display:\"none\",opacity:0,position:\"fixed\",height:h[0],width:h[1],zIndex:e.o.zIndex,top:0,left:0})).appendTo(e.o.appendTo)}e.d.overlay=a(\"<div></div>\").attr(\"id\",e.o.overlayId).addClass(\"simplemodal-overlay\").css(a.extend(e.o.overlayCss,{display:\"none\",opacity:e.o.opacity/100,height:e.o.modal?b[0]:0,width:e.o.modal?b[1]:0,position:\"fixed\",left:0,top:0,zIndex:e.o.zIndex+1})).appendTo(e.o.appendTo);e.d.container=a(\"<div></div>\").attr(\"id\",e.o.containerId).addClass(\"simplemodal-container\").css(a.extend({position:e.o.fixed?\"fixed\":\"absolute\"},e.o.containerCss,{display:\"none\",zIndex:e.o.zIndex+2})).append(e.o.close&&e.o.closeHTML?a(e.o.closeHTML).addClass(e.o.closeClass):\"\").appendTo(e.o.appendTo);e.d.wrap=a(\"<div></div>\").attr(\"tabIndex\",-1).addClass(\"simplemodal-wrap\").css({height:\"100%\",outline:0,width:\"100%\"}).appendTo(e.d.container);e.d.data=c.attr(\"id\",c.attr(\"id\")||e.o.dataId).addClass(\"simplemodal-data\").css(a.extend(e.o.dataCss,{display:\"none\"})).appendTo(\"body\");c=null;e.setContainerDimensions();e.d.data.appendTo(e.d.wrap);if(d||f){e.fixIE()}},bindEvents:function(){var e=this;a(\".\"+e.o.closeClass).bind(\"click.simplemodal\",function(a){a.preventDefault();e.close()});if(e.o.modal&&e.o.close&&e.o.overlayClose){e.d.overlay.bind(\"click.simplemodal\",function(a){a.preventDefault();e.close()})}c.bind(\"keydown.simplemodal\",function(a){if(e.o.modal&&a.keyCode===9){e.watchTab(a)}else if(e.o.close&&e.o.escClose&&a.keyCode===27){a.preventDefault();e.close()}});g.bind(\"resize.simplemodal orientationchange.simplemodal\",function(){e.getDimensions();e.o.autoResize?e.setContainerDimensions():e.o.autoPosition&&e.setPosition();if(d||f){e.fixIE()}else if(e.o.modal){e.d.iframe&&e.d.iframe.css({height:h[0],width:h[1]});e.d.overlay.css({height:b[0],width:b[1]})}})},unbindEvents:function(){a(\".\"+this.o.closeClass).unbind(\"click.simplemodal\");c.unbind(\"keydown.simplemodal\");g.unbind(\".simplemodal\");this.d.overlay.unbind(\"click.simplemodal\")},fixIE:function(){var b=this,c=b.o.position;a.each([b.d.iframe||null,!b.o.modal?null:b.d.overlay,b.d.container.css(\"position\")===\"fixed\"?b.d.container:null],function(a,b){if(b){var d=\"document.body.clientHeight\",e=\"document.body.clientWidth\",f=\"document.body.scrollHeight\",g=\"document.body.scrollLeft\",h=\"document.body.scrollTop\",i=\"document.body.scrollWidth\",j=\"document.documentElement.clientHeight\",k=\"document.documentElement.clientWidth\",l=\"document.documentElement.scrollLeft\",m=\"document.documentElement.scrollTop\",n=b[0].style;n.position=\"absolute\";if(a<2){n.removeExpression(\"height\");n.removeExpression(\"width\");n.setExpression(\"height\",\"\"+f+\" > \"+d+\" ? \"+f+\" : \"+d+' + \"px\"');n.setExpression(\"width\",\"\"+i+\" > \"+e+\" ? \"+i+\" : \"+e+' + \"px\"')}else{var o,q;if(c&&c.constructor===Array){var r=c[0]?typeof c[0]===\"number\"?c[0].toString():c[0].replace(/px/,\"\"):b.css(\"top\").replace(/px/,\"\");o=r.indexOf(\"%\")===-1?r+\" + (t = \"+m+\" ? \"+m+\" : \"+h+') + \"px\"':parseInt(r.replace(/%/,\"\"))+\" * ((\"+j+\" || \"+d+\") / 100) + (t = \"+m+\" ? \"+m+\" : \"+h+') + \"px\"';if(c[1]){var s=typeof c[1]===\"number\"?c[1].toString():c[1].replace(/px/,\"\");q=s.indexOf(\"%\")===-1?s+\" + (t = \"+l+\" ? \"+l+\" : \"+g+') + \"px\"':parseInt(s.replace(/%/,\"\"))+\" * ((\"+k+\" || \"+e+\") / 100) + (t = \"+l+\" ? \"+l+\" : \"+g+') + \"px\"'}}else{o=\"(\"+j+\" || \"+d+\") / 2 - (this.offsetHeight / 2) + (t = \"+m+\" ? \"+m+\" : \"+h+') + \"px\"';q=\"(\"+k+\" || \"+e+\") / 2 - (this.offsetWidth / 2) + (t = \"+l+\" ? \"+l+\" : \"+g+') + \"px\"'}n.removeExpression(\"top\");n.removeExpression(\"left\");n.setExpression(\"top\",o);n.setExpression(\"left\",q)}}})},focus:function(b){var c=this,d=b&&a.inArray(b,[\"first\",\"last\"])!==-1?b:\"first\";var e=a(\":input:enabled:visible:\"+d,c.d.wrap);setTimeout(function(){e.length>0?e.focus():c.d.wrap.focus()},10)},getDimensions:function(){var d=this,e=a.browser.opera&&a.browser.version>\"9.5\"&&a.fn.jquery<\"1.3\"||a.browser.opera&&a.browser.version<\"9.5\"&&a.fn.jquery>\"1.2.6\"?g[0].innerHeight:g.height();b=[c.height(),c.width()];h=[e,g.width()]},getVal:function(a,b){return a?typeof a===\"number\"?a:a===\"auto\"?0:a.indexOf(\"%\")>0?parseInt(a.replace(/%/,\"\"))/100*(b===\"h\"?h[0]:h[1]):parseInt(a.replace(/px/,\"\")):null},update:function(a,b){var c=this;if(!c.d.data){return false}c.d.origHeight=c.getVal(a,\"h\");c.d.origWidth=c.getVal(b,\"w\");c.d.data.hide();a&&c.d.container.css(\"height\",a);b&&c.d.container.css(\"width\",b);c.setContainerDimensions();c.d.data.show();c.o.focus&&c.focus();c.unbindEvents();c.bindEvents()},setContainerDimensions:function(){var b=this,c=d||e;var f=b.d.origHeight?b.d.origHeight:a.browser.opera?b.d.container.height():b.getVal(c?b.d.container[0].currentStyle[\"height\"]:b.d.container.css(\"height\"),\"h\"),g=b.d.origWidth?b.d.origWidth:a.browser.opera?b.d.container.width():b.getVal(c?b.d.container[0].currentStyle[\"width\"]:b.d.container.css(\"width\"),\"w\"),i=b.d.data.outerHeight(true),j=b.d.data.outerWidth(true);b.d.origHeight=b.d.origHeight||f;b.d.origWidth=b.d.origWidth||g;var k=b.o.maxHeight?b.getVal(b.o.maxHeight,\"h\"):null,l=b.o.maxWidth?b.getVal(b.o.maxWidth,\"w\"):null,m=k&&k<h[0]?k:h[0],n=l&&l<h[1]?l:h[1];var o=b.o.minHeight?b.getVal(b.o.minHeight,\"h\"):\"auto\";if(!f){if(!i){f=o}else{if(i>m){f=m}else if(b.o.minHeight&&o!==\"auto\"&&i<o){f=o}else{f=i}}}else{f=b.o.autoResize&&f>m?m:f<o?o:f}var p=b.o.minWidth?b.getVal(b.o.minWidth,\"w\"):\"auto\";if(!g){if(!j){g=p}else{if(j>n){g=n}else if(b.o.minWidth&&p!==\"auto\"&&j<p){g=p}else{g=j}}}else{g=b.o.autoResize&&g>n?n:g<p?p:g}b.d.container.css({height:f,width:g});b.d.wrap.css({overflow:i>f||j>g?\"auto\":\"visible\"});b.o.autoPosition&&b.setPosition()},setPosition:function(){var a=this,b,c,d=h[0]/2-a.d.container.outerHeight(true)/2,e=h[1]/2-a.d.container.outerWidth(true)/2,f=a.d.container.css(\"position\")!==\"fixed\"?g.scrollTop():0;if(a.o.position&&Object.prototype.toString.call(a.o.position)===\"[object Array]\"){b=f+(a.o.position[0]||d);c=a.o.position[1]||e}else{b=f+d;c=e}a.d.container.css({left:c,top:b})},watchTab:function(b){var c=this;if(a(b.target).parents(\".simplemodal-container\").length>0){c.inputs=a(\":input:enabled:visible:first, :input:enabled:visible:last\",c.d.data[0]);if(!b.shiftKey&&b.target===c.inputs[c.inputs.length-1]||b.shiftKey&&b.target===c.inputs[0]||c.inputs.length===0){b.preventDefault();var d=b.shiftKey?\"last\":\"first\";c.focus(d)}}else{b.preventDefault();c.focus()}},open:function(){var b=this;b.d.iframe&&b.d.iframe.show();if(a.isFunction(b.o.onOpen)){b.o.onOpen.apply(b,[b.d])}else{b.d.overlay.show();b.d.container.show();b.d.data.show()}b.o.focus&&b.focus();b.bindEvents()},close:function(){var b=this;if(!b.d.data){return false}b.unbindEvents();if(a.isFunction(b.o.onClose)&&!b.occb){b.occb=true;b.o.onClose.apply(b,[b.d])}else{if(b.d.placeholder){var c=a(\"#simplemodal-placeholder\");if(b.o.persist){c.replaceWith(b.d.data.removeClass(\"simplemodal-data\").css(\"display\",b.display))}else{b.d.data.hide().remove();c.replaceWith(b.d.orig)}}else{b.d.data.hide().remove()}b.d.container.hide().remove();b.d.overlay.hide();b.d.iframe&&b.d.iframe.hide().remove();b.d.overlay.remove();b.d={}}}}})");

  $(function() {
    var style;
    style = "#simplemodal-overlay{background-color:#000}#simplemodal-container{-webkit-border-radius:20px;background-color:#ddd;border:8px solid #aaa;padding:12px}";
    return $("<style>" + style + "</style>").prependTo('head');
  });

  $(function() {
    return $('<style>.placeholder{color:gray;}</style>').prependTo('head');
  });

  (function($, window, document) {
    var Plugin, defaults, pluginName;
    pluginName = 'balaforms';
    defaults = {
      invalid_class: 'invalid',
      confirm_class: 'confirm-message',
      error_class: 'error-message',
      required_error: 'Esse campo não pode ficar em branco'
    };
    Plugin = (function() {

      function Plugin(element, options) {
        this.element = element;
        this.options = $.extend({}, defaults, options);
        this._defaults = defaults;
        this._name = pluginName;
        this.$el = $(this.element);
        this.init();
      }

      Plugin.prototype.init = function() {
        var _this = this;
        if (!Modernizr.input.placeholder) this.fake_placeholder();
        this.confirm_dialog = $("." + this.options.confirm_class, this.$el).hide();
        this.error_dialog = $("." + this.options.error_class, this.$el).hide();
        return this.$el.submit(function() {
          if (Modernizr.input.required || _this.validate_requireds()) {
            _this.submit();
          }
          return false;
        });
      };

      Plugin.prototype.fake_placeholder = function() {
        return $('[placeholder]', this.$el).bind({
          focus: function() {
            var $this;
            $this = $(this);
            if ($this.val() === $this.attr('placeholder')) {
              return $this.val('').removeClass('placeholder');
            }
          },
          blur: function() {
            var $this;
            $this = $(this);
            $this.data('value', $this.val());
            if ($(this).val() === '') {
              return $this.val($this.attr('placeholder')).addClass('placeholder');
            }
          }
        }).blur();
      };

      Plugin.prototype.validate_requireds = function() {
        var $invalids, $requireds, invalid_class, required_error;
        invalid_class = this.options.invalid_class;
        required_error = this.options.required_error;
        $requireds = $('[required]', this.$el);
        $invalids = $requireds.filter(function() {
          return $(this).val() === '' || !$(this).data('value');
        });
        $requireds.add(this.$el).removeClass(invalid_class);
        $invalids.each(function() {
          $(this).addClass(invalid_class).parents('form').addClass(invalid_class);
          return $invalids.tipsy({
            title: function() {
              return required_error;
            },
            trigger: 'manual'
          }).tipsy('show').one('focus', function() {
            return $(this).tipsy('hide').removeClass(invalid_class).parents('form').addClass(invalid_class);
          });
        });
        return !this.$el.hasClass(invalid_class);
      };

      Plugin.prototype.submit = function() {
        var $placeholders, $submit, submit_sending, submit_value,
          _this = this;
        $submit = $(':submit', this.$el);
        submit_value = $submit.attr('value');
        submit_sending = $submit.attr('data-sending');
        $placeholders = $('.placeholder').each(function() {
          return $(this).val('');
        });
        return $.ajax({
          url: this.$el.attr('action'),
          method: this.$el.attr('method'),
          data: this.$el.serialize(),
          dataType: 'json',
          beforeSend: function() {
            $submit.val(submit_sending).attr('disabled', 'disabled');
            return $placeholders.blur();
          },
          complete: function() {
            return $submit.val(submit_value).removeAttr('disabled');
          },
          success: function() {
            _this.open_modal('confirm');
            return $('input, text').not(':submit').val('').blur();
          },
          error: function() {
            return _this.open_modal('error');
          }
        });
      };

      Plugin.prototype.open_modal = function(type) {
        var custom_modal, modals;
        custom_modal = this.$el.triggerHandler('open-modal', [type]);
        modals = {
          'confirm': this.confirm_dialog,
          'error': this.error_dialog
        };
        if (custom_modal === true || custom_modal === void 0) {
          return modals[type].modal({
            overlayClose: true,
            close: true
          });
        }
      };

      return Plugin;

    })();
    return $.fn[pluginName] = function(options) {
      return this.each(function() {
        if (!$.data(this, "plugin_" + pluginName)) {
          return $.data(this, "plugin_" + pluginName, new Plugin(this, options));
        }
      });
    };
  })(jQuery, window, document);

  $(function() {
    return $('form.balaforms').balaforms();
  });

}).call(this);

