wtf = function(){
    // show boring text and hide WTF button
    $("#boring").show();
    $("#wtf_btn").hide();
}


do_apply = function(){
    $("#apply").show();
    $("#wtf_btn").hide();
    $("#apply_btn").hide();
}



$(document).ready(function(){
    $.meta.setType("attr", "validate");

    var validator = $("#apply_form").validate({
                        // remove default error placement handler
                        errorPlacement: function() {}
                    });

    $("#apply_form").bind('submit', function(form) {
            if ( validator.valid() ){

                // set iframe onload event
                $("#_iframe").load(function(){
                        // hide apply form
                        $("#apply_form").hide();

                        // show success message
                        $("#apply .success").show();
                    });

                // show overlay widget
                var form = $("#apply_form");
                form.prepend( '<div id="overlay"><div class="background"><div class="image"></div></div></div>' )
                $("#overlay .background").css({
                    width:  form.width(),
                    height: form.height()
                });
            }
        });

})
