jQuery(function(a){var b;return window.AjaxIndicator=b=function(){function b(){this.element=a(".ajaxIndicator").clone().appendTo("body")}return b.prototype.show=function(){return this.element.show()},b.prototype.show_on=function(a){return this.element.css({left:a.offset().left+a.width()/2,top:a.offset().top+a.height()/2}).show()},b.prototype.show_next_to=function(a){return this.element.css({left:a.offset().left+(a.width()+35),top:a.offset().top+a.height()/2}).show()},b.prototype.hide=function(){return this.element.hide()},b}(),window.ajax_i=new b}),jQuery(function(a){var b;return b=function(){function b(){this.avatars_and_menus(),this.questions(),this.messages(),this.dialogs(),this.other()}return b.prototype.avatars_and_menus=function(){if(!a.browser.msie)return a("img.avatar").corner("round 5px"),a(".profile_actions_icons-other_actions, .resource .avatarAndActions .actions").corner("round top 10px")},b.prototype.questions_list=function(){if(!a.browser.msie)return a(".questions.list .question .text, .questions.list .question .answer").corner("round 10px")},b.prototype.questions=function(){if(!a.browser.msie)return a(".question div.text, .question div.answer, table.gifts .gift .message").corner("round 10px")},b.prototype.messages=function(){if(!a.browser.msie)return a(".message div.text").corner("round 10px")},b.prototype.dialogs=function(){return a("#dialog").corner("round 10px")},b.prototype.other=function(){a("footer a.qroomForBusiness, header .storeLink, header .signIn, header .signUp").corner("round 5px"),a("#notification_box").corner("round 7px"),a(".statusLine").corner("round 7px"),a("#search_person_name").corner("round 10px"),a(".searchForm .extendedSearch").corner("round 10px"),a(".royal .stake, .royal .king, .royal .queen").corner("round 10px"),a(".royal .stats").corner("round 5px"),a(".charts .player.explanation, .charts.referrals .entry").corner("round 10px"),a(".welcomePage .profileLink, .welcomePage .leftColumn, .welcomePage .rightColumn, .welcomePage .enterProfile, .newCommentsWarningBox").corner("round 10px"),a(".frontpage").length>0||a("footer").corner("round 10px");if(!a.browser.msie)return a(".contentBlock, .contentBlockWrapper, .userListBlock, .questionOfTheDay, .bezdnaInfo, .celebrityBigFatBlock .about, .celebrityBigFatBlock .social").corner("round 10px"),a(".contentBlock.buttonLook").corner("round 20px")},b}(),window.Corners=new b}),jQuery(function(a){var b;return window.DropdownMenu=b=function(){function b(b,c,d){var e=this;this.block=b,this.trigger=c,this.options=d!=null?d:{};if(!this.block)throw"Dropdown menu block is not set";if(!this.trigger)throw"Dropdown menu trigger is not set";this.current_target=[null],this.block.visible=!1,this.ajax_i=new AjaxIndicator,this.trigger.live("click",function(a){return a.preventDefault(),a.stopPropagation(),e.block.visible&&a.currentTarget===e.current_target[0]?(e.block.visible=!1,e.hide()):(e.block.visible=!0,e.show_for(a.currentTarget))}),this.block.click(function(a){return a.stopPropagation()}),a("html").click(function(){return e.hide()}),this.resources_name=function(){if(this.current_target[0])return this.current_target.attr("data-resources-name")},this.load_content=function(){if(this.current_target.attr("data-menu-content"))return this.content_block=this.current_target.parents(".resource").find(this.current_target.attr("data-menu-content")),this.content_block_parent=this.content_block.parent(),this.block.html(""),this.block.append(this.content_block.css("display","block"))}}return b.prototype.load_data=function(){var b=this;return this.block.children(".content").html(""),this.ajax_i.show_on(this.block),a.get("/"+this.resources_name()+"?limit=3",function(a){var c,d;return b.ajax_i.hide(),b.block.find(".content").html(a),c=b.block.find(".content .itemsCount").text(),b.block.find("img.avatar").corner("round 5px"),d=b.block.find(".seeAll"),d.children("a").text(""+d.children("a").text().replace(/\([0-9]*\)$/,"")+" "+c),d.show().children("a").attr("href","/"+b.resources_name())},"html")},b.prototype.show_for=function(b,c){var d,e;return c==null&&(c={}),this.hide(),this.current_target=a(b),this.current_target.addClass("opened"),e=this.options.top||this.current_target.offset().top+this.current_target.height(),d=this.options.left||this.current_target.offset().left-this.block.width()/2+this.current_target.width()/2,this.block.css({top:e,left:d}),this.current_target.css("z-index",1e3),this.block.show(),this.resources_name()?this.load_data():this.load_content()},b.prototype.hide=function(){return this.current_target[0]&&this.current_target.removeClass("opened").css("z-index",1),this.content_block_parent&&this.content_block_parent.append(this.content_block.hide()),this.ajax_i.hide(),this.block.hide(),this.block.find(".seeAll").hide()},b}(),b.create=function(a,c,d){return new b(a,c,d)}}),jQuery(function(a){var b;return b=function(){function b(){var b=this;this.block=a("#notification_box"),this.message=a(".message",this.block),a(".closeNotificationIco").click(function(){return b.close()})}return b.prototype.show=function(a,b){typeof a=="object"&&a.type&&a.message&&(b=a.type,a=a.message),b&&this.block.removeClass("error").removeClass("success").removeClass("info").addClass(b),a&&this.message.html(a),this.block.slideDown(300);if(!this.block.hasClass("info"))return this.start_timer()},b.prototype.show_error=function(){return this.show(a("#server_error_message").text(),"error")},b.prototype.close=function(){return this.block.slideUp(300)},b.prototype.start_timer=function(){var a=this;return setTimeout(function(){return a.close()},1e4)},b}(),window.NotificationBox=new b,NotificationBox.message.html()&&NotificationBox.message.html().length>0&&NotificationBox.show(),a("#mmtb .closeNotificationIco").click(function(){return a("#mmtb").slideUp(300)})}),jQuery(function(a){var b;return window.Resources=b=function(){function b(b){var c,d,e;this.name=b;if(typeof this.name=="object"){e=this.name;for(d in e)c=e[d],this.resource_name=d}else this.resource_name=this.name;this.send_ajax_request=function(b,c,d){var e,f,g,h,i,j,k=this;d==null&&(d={}),this.response_html=null;if(d.http_request&&d.is_form)return this.form.submit();if(typeof this.name=="object"){g="",i=this.name;for(f in i){h=i[f];if(c[h])g+="/"+f+"/"+c[h];else if(h===""||c[h]===""||!c[h])g+="/"+f}j=this.name;for(e in j)h=j[e],delete c[h]}else d.is_form?g=d.path:d.member_action?g="/"+this.name+"/"+c.id+"/"+d.member_action:(c.id||(c.id=""),g="/"+this.name+"/"+c.id);return a.ajax({url:g+"/",dataType:"json",type:"post",data:a.extend({_method:b},c),success:function(a){return NotificationBox.show(a),k.response_html=a.html,a.type==="success"?k.dfd.resolve():k.dfd.reject()},error:function(){return NotificationBox.show_error(),k.dfd.reject()}})},this.serialize_if_form=function(b,c){var d,e;try{return b[0].tagName==="FORM"?(this.form=b,d=b.attr("action"),e={},b.find("input, textarea, radio").each(function(){if(a(this).attr("type")!=="checkbox"||a(this).is(":checked"))return e[a(this).attr("name")]=a(this).val()}),{params:e,options:a.extend(c,{is_form:!0,path:d})}):{params:b,options:c}}catch(f){return{params:b,options:c}}}}return b.prototype["delete"]=function(b,c){var d,e,f=this;return c==null&&(c={}),e=c.resource_name?c.resource_name:this.resource_name,this.dfd=a.Deferred(),c.no_confirm?(d=this.serialize_if_form(b,c),this.send_ajax_request("delete",d.params,d.options)):ConfirmationDialog.show(a(".i18n_captions .confirms. .are_you_sure_you_want_to_delete_that_resource").text()+" "+a("#resource_human_name_for_"+e+" .will_delete_form").text()+"?").done(function(){return d=f.serialize_if_form(b,c),f.send_ajax_request("delete",d.params,d.options)}).fail(function(){return f.dfd.reject()}),this.dfd.promise()},b.prototype.create=function(b,c){var d,e;return c==null&&(c={}),e={},this.dfd=a.Deferred(),d=this.serialize_if_form(b,c),this.send_ajax_request("post",d.params,d.options),this.dfd.promise()},b.prototype.action=function(b,c,d){return this.dfd=a.Deferred(),d?this.send_ajax_request(b,{id:d},{member_action:c}):this.send_ajax_request(b,{},{collection_action:c}),this.dfd.promise()},b}()}),jQuery(function(a){var b;return window.Button=b=function(){function b(b){this.button=a(b)}return b.prototype.lock=function(){var b;this.button.addClass("locked").removeClass("unlocked"),this.button.hasClass("unlocked")&&children(".caption").hide().next(".wait").slideDown(200),a(".button[class!=locked]").removeClass("enabled").addClass("disabled");if(b=this.button.attr("data-target-form"))FormLocker.show_on(a(b)),a(b).submit();return this},b.prototype.unlock=function(){return this.button.removeClass("locked").children(".caption").show().next(".wait").hide(),a(".button.disabled").removeClass("disabled").addClass("enabled"),this},b.prototype.disable=function(){return this.button.removeClass("enabled").addClass("disabled"),this},b.prototype.enable=function(){return this.button.removeClass("disabled").addClass("enabled"),this},b}(),window.ButtonFactory=function(c){return c.unbind("click").each(function(){var c;return c=a(this),c.click(function(a){return a.stopPropagation(),(new b(c)).lock(),c.data("default_action")?!0:!1})})},window.ButtonFactory(a(".button"))});var __hasProp=Object.prototype.hasOwnProperty,__extends=function(a,b){function d(){this.constructor=a}for(var c in b)__hasProp.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};jQuery(function(a){var b,c,d,e;return window.Dialog=b=function(){function b(){var b=this;this.block=a("#dialog"),this.content=a("#dialog .dialogPadding .dialogContainer > div.content"),this.options={overlayClose:!0,opacity:50,overlayCss:{"background-color":"#000"},closeClass:"cancel",minWidth:520,zIndex:2e3,onClose:function(){return b.dfd.reject(),a.modal.close()}}}return b.prototype.show=function(){var b=this;return this.dfd=a.Deferred(),this.content.find(".confirm").click(function(){return b.dfd.resolve(),a.modal.close()}),this.block.modal(this.options),this.dfd.promise()},b.prototype.hide=function(){return this.dfd&&this.dfd.reject(),a.modal.close()},b}(),c=function(b){function c(){this.block_content=a(".confirmationDialogContent").clone(),c.__super__.constructor.apply(this,arguments)}return __extends(c,b),c.prototype.show=function(a){return this.block_content.find(".question").html(a),this.content.empty().append(this.block_content),c.__super__.show.apply(this,arguments)},c}(b),d=function(a){function b(){b.__super__.constructor.apply(this,arguments)}return __extends(b,a),b.prototype.show=function(a){return this.content.html("").append(a),b.__super__.show.apply(this,arguments)},b}(b),e=function(b){function c(){c.__super__.constructor.apply(this,arguments),this.options.containerCss={width:"800px"},this.visible=!1}return __extends(c,b),c.prototype.show=function(b){var d,e,f=this;return this.block.addClass("dialogWide"),this.content.addClass("signContent"),this.options.minWidth=820,e=c.__super__.show.call(this,b),d=a(".button",this.content),d.attr("data-target-form","#thisform"),d.parents("form").eq(0).attr("id","thisform"),window.ButtonFactory(d),this.options.minWidth=520,this.visible=!0,e.always(function(){return f.block.removeClass("dialogWide"),f.content.removeClass("signContent")})},c.prototype.hide=function(){return c.__super__.hide.apply(this,arguments),this.visible=!1},c}(d),window.ConfirmationDialog=new c,window.ContentDialog=new d,window.SignDialog=new e}),jQuery(function(a){var b;return b=function(){function b(){this.block=a('<div id="form_locker"></div>'),a("body").prepend(this.block)}return b.prototype.show_on=function(a){return this.block.css({left:a.offset().left,top:a.offset().top,width:a.outerWidth(),height:a.outerHeight()}).show(),ajax_i.show_on(this.block)},b.prototype.hide=function(){return this.block.hide(),ajax_i.hide()},b}(),window.FormLocker=new b}),jQuery(function(a){return a(".askQuestion textarea").watchFieldLength(a(".askQuestion .charCount .number"),350),a("form#new_featured_question textarea").watchFieldLength(a("form#new_featured_question .charCount .number"),200),a("form.message textarea").watchFieldLength(a("form.message .charCount .number"),1e3),a("span.eventTrigger.showMore").click(function(){return a(a(this).attr("data-target")).slideDown(300),a(this).attr("data-hide-block")?a(a(this).attr("data-hide-block")).hide():a(this).hide()})})
