function general_onReady(){$('<img src="/img/colorbox/border.png"/>');$('<img src="/img/colorbox/controls.png"/>');$('<img src="/img/colorbox/loading.gif"/>');$('<img src="/img/colorbox/loading_background.png"/>');$('<img src="/img/colorbox/overlay.png"/>');$("[original-title]").each(function(n,t){$(t).tipsy({gravity:"s"})});$("[data-filter]").each(function(){util.filterInput($(this),$(this).attr("data-filter"))});$(".datepicker").datepicker();$(".recipe-import").click(function(){return $.colorbox({html:'<iframe id="ImportBeerXmlIFrame" src="/ImportBeerXmlDialog" width="525" height="200" scrolling="no" />',opacity:.35,overlayClose:!1,escKey:!1,scrolling:!1}),!1});$("[data-followid]").on("mouseover mouseout click",function(n){var t=$(this),u=$(this).data("followed")=="1",f=$(this).data("followid"),i=$(this).children("span:nth-of-type(2)"),r=$(this).children("span:first-of-type");n.type==="mouseover"?u?(t.removeClass().addClass("btn btn-danger"),r.removeClass().addClass("glyphicon glyphicon-remove"),i.text("Stop Following")):(t.removeClass().addClass("btn btn-success"),r.removeClass().addClass("glyphicon glyphicon-plus"),i.text("Follow")):n.type==="mouseout"?u?(t.removeClass().addClass("btn btn-success"),r.removeClass().addClass("glyphicon glyphicon-check"),i.text("Following")):(t.removeClass().addClass("btn btn-default"),r.removeClass().addClass("glyphicon glyphicon-plus"),i.text("Follow")):n.type==="click"&&(n.preventDefault(),t.attr("disabled","disabled"),$.ajax({url:"/ToggleBrewerFollow/"+f,async:!0,type:u?"delete":"post",success:function(){u?(i.text("Follow"),t.removeClass().addClass("btn btn-default"),r.removeClass().addClass("glyphicon glyphicon-plus"),t.data("followed","0")):(i.text("Following"),t.removeClass().addClass("btn btn-success"),r.removeClass().addClass("glyphicon glyphicon-check"),t.data("followed","1"))},error:function(){alert("uh oh, something went wrong.  Please try again.")},complete:function(){t.removeAttr("disabled")}}))});$(".login-link").click(function(){var n=window.location.toString();n.indexOf("/login")==-1&&n.substring(n.indexOf("/"))!="login"&&$(this).attr("href",$(this).attr("href")+"?ReturnUrl="+$(this).attr("data-returnurl"))});$(".sign-out-link").click(function(){$(this).attr("href",$(this).attr("href")+"?ReturnUrl="+$(this).attr("data-returnurl"))});$("#calculations[data-showinmodal=1]").click(function(){return $.colorbox({href:$(this).attr("href")+"?iframe=1",iframe:!0,width:850,height:525,opacity:.35,overlayClose:!1,escKey:!1,scrolling:!0}),!1});$("#tasting-note-form .notes textarea").autosize();$("#tasting-note-form .save a").click(function(){if($("#tasting-note-form").find(".messages").remove(),!$("#tasting-note-form #taste-date").val().length||!$("#tasting-note-form #Rating").val().length)return $("#tasting-note-form").prepend($('<div class="messages small"><ul><li class="error">Date Tasted and Overall Rating are required<\/li><\/ul><\/div>')),!1;var n={RecipeId:$("#TastingNotesRecipeId").val(),BrewSessionId:$("#TastingNotesBrewSessionId").val(),TasteDate:$("#taste-date").val(),Rating:$("#tasting-note-form #Rating").val(),Notes:$("#tasting-note-form .notes textarea").val()},t=function(){$.ajax({url:"/brew/SaveTastingNote",data:n,method:"post",success:function(n){var i,r,t;switch(n){case"-1":$("#tasting-note-form").prepend($('<div class="messages small"><ul><li class="error">An unknown error has occurred.  Please try again<\/li><\/ul><\/div>'));break;case"0":$("#tasting-note-form").prepend($('<div class="messages small"><ul><li class="error">Date Tasted and Overall Rating are required<\/li><\/ul><\/div>'));break;default:i=$(n);$(".no-tasting-notes").remove();$(".tasting-notes").append(i);wireRatyStar(i.find("span.rating[data-rating]"));r=parseInt($("#tasting-note-count").html());$("#tasting-note-count").html(++r);setupRatyStar("#star");$("#tasting-note-form .notes textarea").val("");t=new Date;$("#taste-date").val(t.getMonth()+1+"/"+t.getDate()+"/"+t.getFullYear())}},error:function(){Message.error("There was a problem saving your brew session.  Please try again.")},complete:function(){$.colorbox.close()}})};return Layout.statusModal("Saving Tasting Notes...",t),!1});$("a.new-window").click(function(){return window.open($(this).attr("href")),!1});var n=300,t=400,i=400,r=400;jQuery(window).scroll(function(){jQuery(window).scrollTop()>=n?jQuery("#backtotop").fadeIn(t):jQuery("#backtotop").fadeOut(i)});jQuery("#backtotop a").click(function(){return jQuery("html, body").animate({scrollTop:0},r),!1});$("abbr.timeago").timeago().show();$("[data-rating]").raty({path:"/img/raty/",hints:["worst beer ever","ok","good","really good","best beer ever"],readOnly:function(){return $(this).data("readonly")},score:function(){return $(this).data("rating")}})}function layout_onReady(){$("#newsletterform").submit(function(){return $.ajax($(this).attr("action")+"/?emailAddress="+$("#newsletterform input:first").val(),{async:!0,cache:!1,success:function(){$.colorbox({html:'<h1 class="aligncenter">Thank you for signing up!<\/h1>',opacity:.35,width:500,height:70,scrolling:!1});$("#newsletterform input:first").val("Enter your email adress").trigger("blur")}}),!1});$("footer .photo-stream").length>0&&$.ajax({url:"/RecentPhotos",success:function(n){$(n).each(function(n,t){$("footer .photo-stream").append($('<a href="'+t.Url+'"><img width="59" height="59" alt="" src="'+t.ImageUrl+'" /><\/a>'))})}});$("#mobilemenu button.menu").click(function(n){n.preventDefault();$("#navigation").toggle()});$(".searchtrig").click(function(){$("#navigation").hide();$("html, body").animate({scrollTop:0},"fast");$("#search").slideDown();$("#SearchTerm").focus()});$(window).scroll(function(){$("#hamburger a.menu").is(":visible")&&$("#navigation").hide()});$(document).on("click",function(n){$(n.target).closest("#navigation").length&&$(".mobile a.menu").is(":visible")&&$("#navigation").toggle()})}function common_onReady(){$("body").on("click",".delete-recipe",function(){return $.colorbox({html:'<div style="padding: 12px 24px 0 24px;"><h3>Are you sure you want to delete this?<\/h3><p>Once you delete a recipe there is no way to get it back.<br /><a class="btn btn-danger btn-md" href="/recipe/'+$(this).attr("data-recipeid")+'/delete">Yes, Delete<\/a><a class="bbtn btn-default btn-md" href="#" onclick="$.colorbox.close()">No, don\'t delete<\/a><p/><\/div>',opacity:.35,overlayClose:!1,escKey:!1,scrolling:!1}),!1});$("span.rating[data-rating]").length>0&&$("span.rating[data-rating]").each(function(n,t){wireRatyStar(t)});$("#tastingnotes").on("click","a[data-tastingnoteid]",function(){return $.colorbox({html:'<div style="padding: 12px 24px 0 24px;"><h3>Are you sure you want to delete this?<\/h3><p>Once you delete tasting notes there is no way to get them back.<br /><a class="btn btn-danger btn-md" href="#" onclick="deleteTastingNote('+$(this).attr("data-tastingnoteid")+'); $.colorbox.close(); return false;">Yes, Delete<\/a><a class="btn btn-default btn-md" href="#" onclick="$.colorbox.close(); return false;">No, don\'t delete<\/a><p/><\/div>',opacity:.35,overlayClose:!1,escKey:!1,scrolling:!1}),!1});setupRatyStar($("#star"))}function feedback_onReady(){$(window).width()>1050&&$("#FeedbackTrigger").show().click(function(){return $.colorbox({html:'<iframe id="ImportBeerXmlIFrame" src="/marketing/feedback" width="650" height="330" scrolling="no" />',opacity:.35,overlayClose:!1,escKey:!0,scrolling:!1}),!1});$("#Feedback").length>0&&($("#Feedback").limitInput(1e3,$("#FeedbackCounter"),!0),$("#suggestion-form a").click(function(){return $.ajax({url:"/Marketing/Feedback",type:"post",data:{Feedback:$("#suggestion-form textarea").val()},success:function(){$("#suggestion-form .success-message").show();$("#suggestion-form textarea").val("");$("#suggestion-form textarea").trigger("keyup")}}),!1}));$("#suggestion-form textarea").keypress(function(){$("#suggestion-form .success-message").is(":visible")&&$("#suggestion-form .success-message").hide()});$("#view-feedback").length>0&&($("#Feedback").keypress(function(){$(this).hasClass("input-validation-error")&&$(this).val()&&$(this).removeClass("input-validation-error")}),$("#view-feedback form").submit(function(){return $("#Feedback").val()?!0:($("#Feedback").addClass("input-validation-error"),!1)}));$("#view-feedbackreceived").length>0&&(parent.$.colorbox.resize({width:650,height:200}),$("#FeedbackClose").click(function(){return parent.$.colorbox.close(),!1}))}function search_onReady(){var t,n;if($("#searchresults-view").length>0)for(t=$("li[role=tab]"),n=0;n<t.length;n++)if(parseInt($(t[n]).attr("data-count"))>0){if(n==0)break;$(t[n]).find("a").click();break}}function home_onReady(){$("#fb-root").length>0&&function(n,t,i){var r,u=n.getElementsByTagName(t)[0];n.getElementById(i)||(r=n.createElement(t),r.id=i,r.src="//connect.facebook.net/en_US/all.js#xfbml=1&appId=324420670945545",u.parentNode.insertBefore(r,u))}(document,"script","facebook-jssdk")}function builder_onReady(){$("#view-newrecipe, #view-editrecipe, #view-recipedetail").length>0&&($("[data-name=styleid]").change(function(){var t=getRecipe(),n;$(this).val()==""?($("#recipe-facts .style").text(""),$("#selected-style-chart").empty()):($("#recipe-facts .style").text($(this[this.selectedIndex]).text().split(". ")[1]),n=StyleChart.GetStyle($(this[this.selectedIndex]).val()),$("#selected-style-chart").empty(),StyleChart.create(n,t,$("#selected-style-chart")))}),$("#show-similar-styles").click(function(){for(var t=getRecipe(),i=StyleChart.SortStylesByClosestMatch(t),r=StyleChart.isWater(t)?1:3,n=0;n<r;n++)StyleChart.create(i[n],t,$("#similar-style-chart"));return $("#style-showmore").hide(),$("#style-hidemore").show(),!1}),$("#hide-similar-styles").click(function(){return $("#similar-style-chart").empty(),$("#style-showmore").show(),$("#style-hidemore").hide(),!1}));$("#view-newrecipe, #view-editrecipe, #view-newbrewsession, #view-editbrewsession").length>0&&($(".builder input, .builder select, .builder textarea").not("#taste-date").not("#NewTastingNotes").not(".CommentText").change(function(){$(".builder").attr("data-formchanged")||$(".builder").attr("data-formchanged","true")}),$(window).bind("beforeunload",function(){if($(".builder[data-formchanged=true]").length>0)return"You have unsaved changes"}),$(".delete-recipe").click(function(){var n=$(this);return $.colorbox({html:'<h3>Are you sure you want to delete this?<\/h3><p>Once you delete a recipe there is no way to get it back.<br /><a class="btn btn-danger btn-md" onclick="$(\'.builder\').removeAttr(\'data-formchanged\');" href="/recipe/'+$(this).attr("data-recipeid")+'/delete">Yes, Delete<\/a><a class="btn btn-default btn-md" href="#" onclick="$.colorbox.close(); return false;">No, don\'t delete<\/a><p/>',opacity:.35,overlayClose:!1,escKey:!1,scrolling:!1}),!1}));$("#sendtoshop-intro h3 a").click(function(){return $.colorbox({inline:!0,href:"#sendtoshop-learnmore",opacity:.35,width:700,height:400,overlayClose:!0,escKey:!0,scrolling:!1}),!1})}function getRecipe(){if($("#RecipeJson").length>0){var n=new Recipe(jQuery.parseJSON($("#RecipeJson").text()));return n.calculate(),n}return Builder.getRecipe()}function photoUploadInProgress(){parent.$.colorbox.resize({width:800,height:145})}function photoUploadComplete(){var n=window.setTimeout(function(){$.colorbox.close()},1e4);$(document).bind("cbox_closed",function(){window.clearTimeout(n)})}function recipeDetail_onReady(){$("#view-recipedetail").length>0&&($("#recipe-rating").raty({path:"/img/raty/",hints:["worst beer ever","ok","good","really good","best beer ever"],readOnly:!0,score:$("#recipe-rating").attr("data-rating")}),$("#CommentText").autosize())}function settings_onReady(){if($("#vw-settings").length>0){var n=null,t=null;$("#vw-settings .tabs").tabs({beforeActivate:function(){Message.clear()}});window.location.toString().indexOf("#notifications")>-1&&$("li#tab3 > a").click();Message.useSmall();Message.setParent($("#vw-settings form").parents(".tab"));$("#vw-settings form").ajaxForm({preSubmitCallback:function(){Message.clear()},successCallback:function(n,t){!t.Success&&t.Message?Message.error(t.Message):Message.success(t.Message);window.scrollTo(0,0)},errorCallback:function(){Message.error("Oops, something went wrong.  Please try again.");window.scrollTo(0,0)}});$("#vw-settings .username").keyup(function(){if(clearTimeout(n),$(this).removeClass("input-validation-error"),$(this).val().length<3)return $("#username-avail").text(""),!0;var t=$(this).val();n=setTimeout(function(){$.ajax("UsernameExists/"+t.trim()+"?d="+new Date,{success:function(n){n=="1"?($("#username-avail").text("username taken").css("color","red"),$("#Username").addClass("input-validation-error"),$("#savesettings").attr("disabled","disabled"),$("#Dummy").val("")):($("#username-avail").text("username available").css("color","green"),$("#Username").removeClass("input-validation-error"),$("#Dummy").val("value"),$("#savesettings").removeAttr("disabled"))}})},350)});$("#vw-settings .emailaddress").keyup(function(){clearTimeout(t);var n=encodeURIComponent($(this).val());t=setTimeout(function(){$.ajax("EmailAddressInUse/?email="+n.trim()+"&d="+new Date,{success:function(n){n=="1"?($("#emailinuse").text("Email Address already in use").css("color","red").show(),$("#EmailAddress").addClass("input-validation-error"),$("#savesettings").attr("disabled","disabled"),$("#Dummy").val("")):($("#emailinuse").hide(),$("#EmailAddress").removeClass("input-validation-error"),$("#Dummy").val("value"),$("#savesettings").removeAttr("disabled"))}})},350)});$("#ChooseUsername").click(function(){$("#UsernameFieldToggle").remove();$("#Username").val("");$("label[for=Username]").addClass("valigntop").addClass("paddingtop6");$("#UsernameField").removeClass("hidden").slideDown();$("#Username").focus()});$("#Bio").limitInput(450,$("#suggest-limit"),!0)}}function loginRelated_onReady(){if($("#view-resetpassword.is-in-dialog").length){var n=$(".messages").is(":visible")?375:280;parent.$.colorbox.resize({width:650,height:n})}$("#view-loginviadialog").length&&parent.$.colorbox.resize({width:800,height:525})}function loginComplete(n){$(".builder").removeAttr("data-isanon");parent.$.colorbox.resize({width:800,height:150});n?window.setTimeout(function(){$("#SaveRecipeButton").click()},2e3):($("#RecipeJson").val(escape(Builder.getRecipe().getJSON())),$("#RecipeForm").submit())}function waterinfusion_onReady(){$("#view-calculatorHydro").length>0&&$(".optional-equipment-expand").toggle(function(){$(".optional-equipment-expand img").attr("src","/img/less-up-arrow.png");$(".optional-equipment").show()},function(){$(".optional-equipment-expand img").attr("src","/img/more-down-arrow.png");$(".optional-equipment").hide()})}function misc_onReady(){$("input#BeerXmlFile").change(function(){$("input#BeerXmlFile").removeClass("input-validation-error")});$("#ImportRecipeForm").submit(function(){return($("input#BeerXmlFile").removeClass("input-validation-error"),$("input#BeerXmlFile").val().length==0)?($("input#BeerXmlFile").addClass("input-validation-error"),!1):!0});$(".facts .color").length>0&&$("[data-name=facts_srm]").length>0&&$(".facts .color").css("background-color",util.srm_To_hex($("[data-name=facts_srm]").text()))}function comment_onReady(){if($(".comments-wrapper").length>0){jQuery("abbr.timeago").timeago();$("abbr.timeago").timeago().show();$(".CommentText").autosize();$("body").on("keydown",".CommentText",function(n){n.which==13&&(n.preventDefault(),$(this).next("#AddComment").click())});$("body").on("click",".AddComment",function(){if(!$(this).parent().prev(".CommentText").val()||$.trim($(this).parent().prev(".CommentText").val()).length==0||$.trim($(this).parent().prev(".CommentText").val())=="Write a comment...")return!1;var n=$(this);return $.ajax({url:"/AddComment",type:"post",data:{CommentText:$("<div/>").text(n.parent().prev(".CommentText").val()).html(),GenericId:$(this).attr("data-genericid"),CommentType:$(this).attr("data-commenttype")},success:function(t){return n.closest(".comments-wrapper").find(".comment-list").append(t),n.parent().prev(".CommentText").val("").autosize(),jQuery("abbr.timeago").timeago(),$("abbr.timeago").timeago().show(),!1}}),!1})}}function calculations_onReady(){$(".calculations#water-calc").length&&(WaterCalc.initialize($("#s_waterIn"),$("#s_waterOut"),$("select[data-name=s_UnitType]")),$("select[data-name=s_UnitType]").change(function(){WaterCalc.useUnit($(this).val())}))}function dashboard_onReady(){if($("#dashboard").length>0){function n(n){return n<10?"0"+n:n}function t(){var t=new Date;return t.getFullYear()+""+n(t.getMonth())+""+n(t.getDate())}$.ajax({url:"/dashboard/all",type:"get",success:function(n){$("#tabfeed").html(n);$("[data-rating]").each(function(n,t){wireRatyStar(t)});comment_onReady()}});$("body").on("click",".dashboard-more",function(){var n=$(this).attr("data-dateoflast"),t=$(this).attr("data-numbertoreturn");return $(this).replaceWith('<img src="/img/ajax-spinner.gif" class="dashboard-morespinner" />'),$.ajax({url:"/dashboard/all/"+t+"/?SearchOlderThan="+n,type:"get",success:function(n){return $(".dashboard-morespinner").hide(),$("#dashboardlist-moreplaceholder").replaceWith(n),$("[data-rating]").each(function(n,t){wireRatyStar(t)}),jQuery("abbr.timeago").timeago(),$("abbr.timeago").timeago().show(),!1}}),!1});$("[aria-controls=tabrecipes]").click(function(){$(".dashboard-nomorerecipes").hide();$(".dashboard-nomorebrewsessions").hide();$.ajax({url:"/dashboard/recipes",type:"get",success:function(n){return $("#tabrecipes").html(n),n.indexOf("NoDashboardItems")>0&&($(".dashboard-nomore").hide(),$(".dashboard-nomorerecipes").show(),$(".dashboard-nomorerecipes").removeClass("hidden")),$("#tab-tab-2 .CommentText").autosize(),$(".spinner-recipe .dashboard-more").hide(),jQuery("abbr.timeago").timeago(),$("abbr.timeago").timeago().show(),!1}})});$("[aria-controls=tabsessions]").click(function(){$(".dashboard-nomorerecipes").hide();$(".dashboard-nomorebrewsessions").hide();$.ajax({url:"/dashboard/sessions",type:"get",success:function(n){return $("#tabsessions").html(n),n.indexOf("NoDashboardItems")>0&&($(".dashboard-nomore").hide(),$(".dashboard-nomorebrewsessions").show(),$(".dashboard-nomorebrewsessions").removeClass("hidden")),$("#tabrecipes .CommentText").autosize(),$("#tabrecipes .dashboard-more").hide(),jQuery("abbr.timeago").timeago(),$("abbr.timeago").timeago().show(),!1}})});$(window).on("hashchange",function(){handleDashboardHash()});handleDashboardHash()}}function handleDashboardHash(){window.location.toString().indexOf("#recipes")>-1&&$("#tab-my-recipes").click();window.location.toString().indexOf("#brewsessions")>-1&&$("#tab-my-brewsessions").click()}function tryNumber(n,t){return isNaN(n)?t||0:Number(n)}function setupRatyStar(n){$(n).raty({path:"/img/raty/",hints:["worst beer ever","ok","good","really good","best beer ever"],target:"#Rating",targetType:"number",targetKeep:!0})}function wireRatyStar(n){$(n).raty({path:"/img/raty/",hints:["worst beer ever","ok","good","really good","best beer ever"],readOnly:!0,score:$(n).attr("data-rating")})}function deleteTastingNote(n){$.ajax({url:"/brew/DeleteTastingNote/"+n,type:"post",async:!0,success:function(){$("a[data-tastingnoteid="+n+"]").parents(".tasting-note").remove();var t=parseInt($("#tasting-note-count").html());$("#tasting-note-count").html(--t);t==0&&($(".no-tasting-notes").remove(),$(".tasting-notes-wrapper").append('<div class="no-tasting-notes padding10">There aren\'t any tasting notes logged yet<\/div>'))},error:function(){$("a[data-tastingnoteid="+n+"]").parents(".tasting-notes").find(".messages").remove();$("a[data-tastingnoteid="+n+"]").parents(".tasting-notes").prepend($('<div class="messages small"><ul><li class="error">Oops, something went wrong.  Please try again.<\/li><\/ul><\/div>'))}})}function Recipe(n){if(this.RecipeId=0,this.OriginalRecipeId=null,this.UnitType=null,this.Name=null,this.Description=null,this.BatchSize=0,this.BoilSize=0,this.BoilTime=0,this.Efficiency=0,this.Og=1,this.Fg=1,this.Srm=0,this.Ibu=0,this.BgGu=0,this.Abv=0,this.Calories=0,this.StyleId=null,this.IbuFormula=null,this.Fermentables=[],this.Hops=[],this.Yeasts=[],this.Others=[],this.MashSteps=[],this.Steps=[],this.getJSON=function(){return JSON.stringify(this)},this.calculate=function(){var f,i,t,n;this.Og=1;this.Fg=1;this.Abv=0;this.Srm=0;this.Calories=0;this.Ibu=0;this.BgGu=0;var r=0,o=0,s=0,h=0,u=this.UnitType==="s"?Number(this.BatchSize):util.l_To_gal(Number(this.BatchSize)),p=this.UnitType==="s"?Number(this.BoilSize):util.l_To_gal(Number(this.BoilSize));if(u!=0){if(f=0,this.Yeasts.length>0){for(t=0;t<this.Yeasts.length;t++)f+=Number(this.Yeasts[t].Atten);f=f/this.Yeasts.length}else f=.75;for(t=0;t<this.Fermentables.length;t++)if(i=this.Fermentables[t],!(i.Amt<=0)){var w=i.Use==="Extract"||i.Use==="Late"?1:i.Use==="Steep"?.5:Number(this.Efficiency),a=this.UnitType==="s"?Number(i.Amt):util.kg_To_lb(Number(i.Amt)),v=a*i.Ppg*w/u;r+=v;h+=a*i.L/u;i.Use!=="late"&&(o+=v)}for(this.Og=r===0?1:1+r/1e3,this.Fg=r===0?1:1+r*(1-f)/1e3,this.Abv=r===0?0:(r-r*(1-f))*.129,this.Srm=h<=0?0:1.49*Math.pow(h,.69),this.Calories=Math.round(this.Og<=1?0:1881.22*this.Fg*(this.Og-this.Fg)/(1.775-this.Og)+3550*this.Fg*(.1808*this.Og+.8192*this.Fg-1.0004)),this.Ibu=0,s=o===0?1:1+o/1e3,t=0;t<this.Hops.length;t++)if(n=this.Hops[t],n.Ibu=0,n.Use=="Boil"||n.Use=="FirstWort"){var c=this.UnitType==="s"?Number(n.Amt):util.g_To_oz(Number(n.Amt)),y=n.Min,e=0,l=n.Type==="Pellet"?1.1:1;this.IbuFormula==="t"?(e=1.65*Math.pow(.000125,s-1)*(1-Math.exp(-.04*y))/4.15*l,n.Ibu=n.AA/100*c*7490/u*e):this.IbuFormula==="r"?(e=18.11+13.86*util.tanh((y-31.32)/18.27),n.Ibu=c*(e/100)*(n.AA/100)*7462/(u*(1+Math.max(0,(s-1.05)/.2)))*l):this.IbuFormula==="b"&&(e=1.65*Math.pow(.000125,u/p*(this.Og-1))*(1-Math.pow(2.7182818284590451,-.04*n.Min))/4.15*l,n.Ibu=n.AA*c*e*74.9/u);this.Ibu+=isNaN(n.Ibu)?0:n.Ibu}this.BgGu=this.Og<=1&&this.Ibu>0?1:this.Og===0||this.Ibu===0?0:this.Ibu/((this.Og-1)*1e3)}},n!=null){for(var t in n)this[t]=n[t];this.calculate()}}var WaterCalc,Builder,SessionBuilder,StyleChart;(function(n){n.extend(n.fn,{validate:function(t){if(!this.length){t&&t.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing.");return}var i=n.data(this[0],"validator");return i?i:(this.attr("novalidate","novalidate"),i=new n.validator(t,this[0]),n.data(this[0],"validator",i),i.settings.onsubmit&&(this.validateDelegate(":submit","click",function(t){i.settings.submitHandler&&(i.submitButton=t.target);n(t.target).hasClass("cancel")&&(i.cancelSubmit=!0);n(t.target).attr("formnovalidate")!==undefined&&(i.cancelSubmit=!0)}),this.submit(function(t){function r(){var r;return i.settings.submitHandler?(i.submitButton&&(r=n("<input type='hidden'/>").attr("name",i.submitButton.name).val(n(i.submitButton).val()).appendTo(i.currentForm)),i.settings.submitHandler.call(i,i.currentForm,t),i.submitButton&&r.remove(),!1):!0}return(i.settings.debug&&t.preventDefault(),i.cancelSubmit)?(i.cancelSubmit=!1,r()):i.form()?i.pendingRequest?(i.formSubmitted=!0,!1):r():(i.focusInvalid(),!1)})),i)},valid:function(){if(n(this[0]).is("form"))return this.validate().form();var t=!0,i=n(this[0].form).validate();return this.each(function(){t=t&&i.element(this)}),t},removeAttrs:function(t){var i={},r=this;return n.each(t.split(/\s/),function(n,t){i[t]=r.attr(t);r.removeAttr(t)}),i},rules:function(t,i){var r=this[0],o,u,h;if(t){var e=n.data(r.form,"validator").settings,s=e.rules,f=n.validator.staticRules(r);switch(t){case"add":n.extend(f,n.validator.normalizeRule(i));delete f.messages;s[r.name]=f;i.messages&&(e.messages[r.name]=n.extend(e.messages[r.name],i.messages));break;case"remove":return i?(o={},n.each(i.split(/\s/),function(n,t){o[t]=f[t];delete f[t]}),o):(delete s[r.name],f)}}return u=n.validator.normalizeRules(n.extend({},n.validator.classRules(r),n.validator.attributeRules(r),n.validator.dataRules(r),n.validator.staticRules(r)),r),u.required&&(h=u.required,delete u.required,u=n.extend({required:h},u)),u}});n.extend(n.expr[":"],{blank:function(t){return!n.trim(""+n(t).val())},filled:function(t){return!!n.trim(""+n(t).val())},unchecked:function(t){return!n(t).prop("checked")}});n.validator=function(t,i){this.settings=n.extend(!0,{},n.validator.defaults,t);this.currentForm=i;this.init()};n.validator.format=function(t,i){return arguments.length===1?function(){var i=n.makeArray(arguments);return i.unshift(t),n.validator.format.apply(this,i)}:(arguments.length>2&&i.constructor!==Array&&(i=n.makeArray(arguments).slice(1)),i.constructor!==Array&&(i=[i]),n.each(i,function(n,i){t=t.replace(new RegExp("\\{"+n+"\\}","g"),function(){return i})}),t)};n.extend(n.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:!0,errorContainer:n([]),errorLabelContainer:n([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(n){this.lastActive=n;this.settings.focusCleanup&&!this.blockFocusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,n,this.settings.errorClass,this.settings.validClass),this.addWrapper(this.errorsFor(n)).hide())},onfocusout:function(n){!this.checkable(n)&&(n.name in this.submitted||!this.optional(n))&&this.element(n)},onkeyup:function(n,t){(t.which!==9||this.elementValue(n)!=="")&&(n.name in this.submitted||n===this.lastElement)&&this.element(n)},onclick:function(n){n.name in this.submitted?this.element(n):n.parentNode.name in this.submitted&&this.element(n.parentNode)},highlight:function(t,i,r){t.type==="radio"?this.findByName(t.name).addClass(i).removeClass(r):n(t).addClass(i).removeClass(r)},unhighlight:function(t,i,r){t.type==="radio"?this.findByName(t.name).removeClass(i).addClass(r):n(t).removeClass(i).addClass(r)}},setDefaults:function(t){n.extend(n.validator.defaults,t)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:n.validator.format("Please enter no more than {0} characters."),minlength:n.validator.format("Please enter at least {0} characters."),rangelength:n.validator.format("Please enter a value between {0} and {1} characters long."),range:n.validator.format("Please enter a value between {0} and {1}."),max:n.validator.format("Please enter a value less than or equal to {0}."),min:n.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function r(t){var i=n.data(this[0].form,"validator"),r="on"+t.type.replace(/^validate/,"");i.settings[r]&&i.settings[r].call(i,this[0],t)}var i,t;this.labelContainer=n(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||n(this.currentForm);this.containers=n(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();i=this.groups={};n.each(this.settings.groups,function(t,r){typeof r=="string"&&(r=r.split(/\s/));n.each(r,function(n,r){i[r]=t})});t=this.settings.rules;n.each(t,function(i,r){t[i]=n.validator.normalizeRule(r)});n(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'] ","focusin focusout keyup",r).validateDelegate("[type='radio'], [type='checkbox'], select, option","click",r);this.settings.invalidHandler&&n(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),n.extend(this.submitted,this.errorMap),this.invalid=n.extend({},this.errorMap),this.valid()||n(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var n=0,t=this.currentElements=this.elements();t[n];n++)this.check(t[n]);return this.valid()},element:function(t){t=this.validationTargetFor(this.clean(t));this.lastElement=t;this.prepareElement(t);this.currentElements=n(t);var i=this.check(t)!==!1;return i?delete this.invalid[t.name]:this.invalid[t.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),i},showErrors:function(t){if(t){n.extend(this.errorMap,t);this.errorList=[];for(var i in t)this.errorList.push({message:t[i],element:this.findByName(i)[0]});this.successList=n.grep(this.successList,function(n){return!(n.name in t)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){n.fn.resetForm&&n(this.currentForm).resetForm();this.submitted={};this.lastElement=null;this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass).removeData("previousValue")},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(n){var t=0,i;for(i in n)t++;return t},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return this.size()===0},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{n(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(t){}},findLastActive:function(){var t=this.lastActive;return t&&n.grep(this.errorList,function(n){return n.element.name===t.name}).length===1&&t},elements:function(){var t=this,i={};return n(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){return(!this.name&&t.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.name in i||!t.objectLength(n(this).rules()))?!1:(i[this.name]=!0,!0)})},clean:function(t){return n(t)[0]},errors:function(){var t=this.settings.errorClass.replace(" ",".");return n(this.settings.errorElement+"."+t,this.errorContext)},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=n([]);this.toHide=n([]);this.currentElements=n([])},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers)},prepareElement:function(n){this.reset();this.toHide=this.errorsFor(n)},elementValue:function(t){var r=n(t).attr("type"),i=n(t).val();return r==="radio"||r==="checkbox"?n("input[name='"+n(t).attr("name")+"']:checked").val():typeof i=="string"?i.replace(/\r/g,""):i},check:function(t){var r,u;t=this.validationTargetFor(this.clean(t));var f=n(t).rules(),e=!1,s=this.elementValue(t),i;for(r in f){u={method:r,parameters:f[r]};try{if(i=n.validator.methods[r].call(this,s,t,u.parameters),i==="dependency-mismatch"){e=!0;continue}if(e=!1,i==="pending"){this.toHide=this.toHide.not(this.errorsFor(t));return}if(!i)return this.formatAndAdd(t,u),!1}catch(o){this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+t.id+", check the '"+u.method+"' method.",o);throw o;}}if(!e)return this.objectLength(f)&&this.successList.push(t),!0},customDataMessage:function(t,i){return n(t).data("msg-"+i.toLowerCase())||t.attributes&&n(t).attr("data-msg-"+i.toLowerCase())},customMessage:function(n,t){var i=this.settings.messages[n];return i&&(i.constructor===String?i:i[t])},findDefined:function(){for(var n=0;n<arguments.length;n++)if(arguments[n]!==undefined)return arguments[n];return undefined},defaultMessage:function(t,i){return this.findDefined(this.customMessage(t.name,i),this.customDataMessage(t,i),!this.settings.ignoreTitle&&t.title||undefined,n.validator.messages[i],"<strong>Warning: No message defined for "+t.name+"<\/strong>")},formatAndAdd:function(t,i){var r=this.defaultMessage(t,i.method),u=/\$?\{(\d+)\}/g;typeof r=="function"?r=r.call(this,i.parameters,t):u.test(r)&&(r=n.validator.format(r.replace(u,"{$1}"),i.parameters));this.errorList.push({message:r,element:t});this.errorMap[t.name]=r;this.submitted[t.name]=r},addWrapper:function(n){return this.settings.wrapper&&(n=n.add(n.parent(this.settings.wrapper))),n},defaultShowErrors:function(){for(var i,t,n=0;this.errorList[n];n++)t=this.errorList[n],this.settings.highlight&&this.settings.highlight.call(this,t.element,this.settings.errorClass,this.settings.validClass),this.showLabel(t.element,t.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(n=0;this.successList[n];n++)this.showLabel(this.successList[n]);if(this.settings.unhighlight)for(n=0,i=this.validElements();i[n];n++)this.settings.unhighlight.call(this,i[n],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return n(this.errorList).map(function(){return this.element})},showLabel:function(t,i){var r=this.errorsFor(t);r.length?(r.removeClass(this.settings.validClass).addClass(this.settings.errorClass),r.html(i)):(r=n("<"+this.settings.errorElement+">").attr("for",this.idOrName(t)).addClass(this.settings.errorClass).html(i||""),this.settings.wrapper&&(r=r.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.append(r).length||(this.settings.errorPlacement?this.settings.errorPlacement(r,n(t)):r.insertAfter(t)));!i&&this.settings.success&&(r.text(""),typeof this.settings.success=="string"?r.addClass(this.settings.success):this.settings.success(r,t));this.toShow=this.toShow.add(r)},errorsFor:function(t){var i=this.idOrName(t);return this.errors().filter(function(){return n(this).attr("for")===i})},idOrName:function(n){return this.groups[n.name]||(this.checkable(n)?n.name:n.id||n.name)},validationTargetFor:function(n){return this.checkable(n)&&(n=this.findByName(n.name).not(this.settings.ignore)[0]),n},checkable:function(n){return/radio|checkbox/i.test(n.type)},findByName:function(t){return n(this.currentForm).find("[name='"+t+"']")},getLength:function(t,i){switch(i.nodeName.toLowerCase()){case"select":return n("option:selected",i).length;case"input":if(this.checkable(i))return this.findByName(i.name).filter(":checked").length}return t.length},depend:function(n,t){return this.dependTypes[typeof n]?this.dependTypes[typeof n](n,t):!0},dependTypes:{boolean:function(n){return n},string:function(t,i){return!!n(t,i.form).length},"function":function(n,t){return n(t)}},optional:function(t){var i=this.elementValue(t);return!n.validator.methods.required.call(this,i,t)&&"dependency-mismatch"},startRequest:function(n){this.pending[n.name]||(this.pendingRequest++,this.pending[n.name]=!0)},stopRequest:function(t,i){this.pendingRequest--;this.pendingRequest<0&&(this.pendingRequest=0);delete this.pending[t.name];i&&this.pendingRequest===0&&this.formSubmitted&&this.form()?(n(this.currentForm).submit(),this.formSubmitted=!1):!i&&this.pendingRequest===0&&this.formSubmitted&&(n(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(t){return n.data(t,"previousValue")||n.data(t,"previousValue",{old:null,valid:!0,message:this.defaultMessage(t,"remote")})}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(t,i){t.constructor===String?this.classRuleSettings[t]=i:n.extend(this.classRuleSettings,t)},classRules:function(t){var i={},r=n(t).attr("class");return r&&n.each(r.split(" "),function(){this in n.validator.classRuleSettings&&n.extend(i,n.validator.classRuleSettings[this])}),i},attributeRules:function(t){var u={},e=n(t),f=e[0].getAttribute("type"),r,i;for(r in n.validator.methods)r==="required"?(i=e.get(0).getAttribute(r),i===""&&(i=!0),i=!!i):i=e.attr(r),/min|max/.test(r)&&(f===null||/number|range|text/.test(f))&&(i=Number(i)),i?u[r]=i:f===r&&f!=="range"&&(u[r]=!0);return u.maxlength&&/-1|2147483647|524288/.test(u.maxlength)&&delete u.maxlength,u},dataRules:function(t){var i,r,u={},f=n(t);for(i in n.validator.methods)r=f.data("rule-"+i.toLowerCase()),r!==undefined&&(u[i]=r);return u},staticRules:function(t){var i={},r=n.data(t.form,"validator");return r.settings.rules&&(i=n.validator.normalizeRule(r.settings.rules[t.name])||{}),i},normalizeRules:function(t,i){return n.each(t,function(r,u){if(u===!1){delete t[r];return}if(u.param||u.depends){var f=!0;switch(typeof u.depends){case"string":f=!!n(u.depends,i.form).length;break;case"function":f=u.depends.call(i,i)}f?t[r]=u.param!==undefined?u.param:!0:delete t[r]}}),n.each(t,function(r,u){t[r]=n.isFunction(u)?u(i):u}),n.each(["minlength","maxlength"],function(){t[this]&&(t[this]=Number(t[this]))}),n.each(["rangelength","range"],function(){var i;t[this]&&(n.isArray(t[this])?t[this]=[Number(t[this][0]),Number(t[this][1])]:typeof t[this]=="string"&&(i=t[this].split(/[\s,]+/),t[this]=[Number(i[0]),Number(i[1])]))}),n.validator.autoCreateRanges&&(t.min&&t.max&&(t.range=[t.min,t.max],delete t.min,delete t.max),t.minlength&&t.maxlength&&(t.rangelength=[t.minlength,t.maxlength],delete t.minlength,delete t.maxlength)),t},normalizeRule:function(t){if(typeof t=="string"){var i={};n.each(t.split(/\s/),function(){i[this]=!0});t=i}return t},addMethod:function(t,i,r){n.validator.methods[t]=i;n.validator.messages[t]=r!==undefined?r:n.validator.messages[t];i.length<3&&n.validator.addClassRules(t,n.validator.normalizeRule(t))},methods:{required:function(t,i,r){if(!this.depend(r,i))return"dependency-mismatch";if(i.nodeName.toLowerCase()==="select"){var u=n(i).val();return u&&u.length>0}return this.checkable(i)?this.getLength(t,i)>0:n.trim(t).length>0},email:function(n,t){return this.optional(t)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(n)},url:function(n,t){return this.optional(t)||/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(n)},date:function(n,t){return this.optional(t)||!/Invalid|NaN/.test(new Date(n).toString())},dateISO:function(n,t){return this.optional(t)||/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(n)},number:function(n,t){return this.optional(t)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(n)},digits:function(n,t){return this.optional(t)||/^\d+$/.test(n)},creditcard:function(n,t){var r,e;if(this.optional(t))return"dependency-mismatch";if(/[^0-9 \-]+/.test(n))return!1;var f=0,i=0,u=!1;for(n=n.replace(/\D/g,""),r=n.length-1;r>=0;r--)e=n.charAt(r),i=parseInt(e,10),u&&(i*=2)>9&&(i-=9),f+=i,u=!u;return f%10==0},minlength:function(t,i,r){var u=n.isArray(t)?t.length:this.getLength(n.trim(t),i);return this.optional(i)||u>=r},maxlength:function(t,i,r){var u=n.isArray(t)?t.length:this.getLength(n.trim(t),i);return this.optional(i)||u<=r},rangelength:function(t,i,r){var u=n.isArray(t)?t.length:this.getLength(n.trim(t),i);return this.optional(i)||u>=r[0]&&u<=r[1]},min:function(n,t,i){return this.optional(t)||n>=i},max:function(n,t,i){return this.optional(t)||n<=i},range:function(n,t,i){return this.optional(t)||n>=i[0]&&n<=i[1]},equalTo:function(t,i,r){var u=n(r);return this.settings.onfocusout&&u.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){n(i).valid()}),t===u.val()},remote:function(t,i,r){var f,u,e;return this.optional(i)?"dependency-mismatch":(f=this.previousValue(i),this.settings.messages[i.name]||(this.settings.messages[i.name]={}),f.originalMessage=this.settings.messages[i.name].remote,this.settings.messages[i.name].remote=f.message,r=typeof r=="string"&&{url:r}||r,f.old===t)?f.valid:(f.old=t,u=this,this.startRequest(i),e={},e[i.name]=t,n.ajax(n.extend(!0,{url:r,mode:"abort",port:"validate"+i.name,dataType:"json",data:e,success:function(r){var e,h,s,o;u.settings.messages[i.name].remote=f.originalMessage;e=r===!0||r==="true";e?(h=u.formSubmitted,u.prepareElement(i),u.formSubmitted=h,u.successList.push(i),delete u.invalid[i.name],u.showErrors()):(s={},o=r||u.defaultMessage(i,"remote"),s[i.name]=f.message=n.isFunction(o)?o(t):o,u.invalid[i.name]=!0,u.showErrors(s));f.valid=e;u.stopRequest(i,e)}},r)),"pending")}}});n.format=n.validator.format})(jQuery),function(n){var t={},i;n.ajaxPrefilter?n.ajaxPrefilter(function(n,i,r){var u=n.port;n.mode==="abort"&&(t[u]&&t[u].abort(),t[u]=r)}):(i=n.ajax,n.ajax=function(r){var f=("mode"in r?r:n.ajaxSettings).mode,u=("port"in r?r:n.ajaxSettings).port;return f==="abort"?(t[u]&&t[u].abort(),t[u]=i.apply(this,arguments),t[u]):i.apply(this,arguments)})}(jQuery),function(n){n.extend(n.fn,{validateDelegate:function(t,i,r){return this.bind(i,function(i){var u=n(i.target);if(u.is(t))return r.apply(u,arguments)})}})}(jQuery),function(n){function i(n,t,i){n.rules[t]=i;n.message&&(n.messages[t]=n.message)}function h(n){return n.replace(/^\s+|\s+$/g,"").split(/\s*,\s*/g)}function f(n){return n.replace(/([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g,"\\$1")}function e(n){return n.substr(0,n.lastIndexOf(".")+1)}function o(n,t){return n.indexOf("*.")===0&&(n=n.replace("*.",t)),n}function c(t,i){var r=n(this).find("[data-valmsg-for='"+f(i[0].name)+"']"),u=n.parseJSON(r.attr("data-valmsg-replace"))!==!1;r.removeClass("field-validation-valid").addClass("field-validation-error");t.data("unobtrusiveContainer",r);u?(r.empty(),t.removeClass("input-validation-error").appendTo(r)):t.hide()}function l(t,i){var u=n(this).find("[data-valmsg-summary=true]"),r=u.find("ul");r&&r.length&&i.errorList.length&&(r.empty(),u.addClass("validation-summary-errors").removeClass("validation-summary-valid"),n.each(i.errorList,function(){n("<li />").html(this.message).appendTo(r)}))}function a(t){var i=t.data("unobtrusiveContainer"),r=n.parseJSON(i.attr("data-valmsg-replace"));i&&(i.addClass("field-validation-valid").removeClass("field-validation-error"),t.removeData("unobtrusiveContainer"),r&&i.empty())}function v(){var t=n(this);t.data("validator").resetForm();t.find(".validation-summary-errors").addClass("validation-summary-valid").removeClass("validation-summary-errors");t.find(".field-validation-error").addClass("field-validation-valid").removeClass("field-validation-error").removeData("unobtrusiveContainer").find(">*").removeData("unobtrusiveContainer")}function s(t){var i=n(t),r=i.data(u),f=n.proxy(v,t);return r||(r={options:{errorClass:"input-validation-error",errorElement:"span",errorPlacement:n.proxy(c,t),invalidHandler:n.proxy(l,t),messages:{},rules:{},success:n.proxy(a,t)},attachValidation:function(){i.unbind("reset."+u,f).bind("reset."+u,f).validate(this.options)},validate:function(){return i.validate(),i.valid()}},i.data(u,r)),r}var r=n.validator,t,u="unobtrusiveValidation";r.unobtrusive={adapters:[],parseElement:function(t,i){var u=n(t),f=u.parents("form")[0],r,e,o;f&&(r=s(f),r.options.rules[t.name]=e={},r.options.messages[t.name]=o={},n.each(this.adapters,function(){var i="data-val-"+this.name,r=u.attr(i),s={};r!==undefined&&(i+="-",n.each(this.params,function(){s[this]=u.attr(i+this)}),this.adapt({element:t,form:f,message:r,params:s,rules:e,messages:o}))}),n.extend(e,{__dummy__:!0}),i||r.attachValidation())},parse:function(t){var i=n(t).parents("form").andSelf().add(n(t).find("form")).filter("form");n(t).find(":input[data-val=true]").each(function(){r.unobtrusive.parseElement(this,!0)});i.each(function(){var n=s(this);n&&n.attachValidation()})}};t=r.unobtrusive.adapters;t.add=function(n,t,i){return i||(i=t,t=[]),this.push({name:n,params:t,adapt:i}),this};t.addBool=function(n,t){return this.add(n,function(r){i(r,t||n,!0)})};t.addMinMax=function(n,t,r,u,f,e){return this.add(n,[f||"min",e||"max"],function(n){var f=n.params.min,e=n.params.max;f&&e?i(n,u,[f,e]):f?i(n,t,f):e&&i(n,r,e)})};t.addSingleVal=function(n,t,r){return this.add(n,[t||"val"],function(u){i(u,r||n,u.params[t])})};r.addMethod("__dummy__",function(){return!0});r.addMethod("regex",function(n,t,i){var r;return this.optional(t)?!0:(r=new RegExp(i).exec(n),r&&r.index===0&&r[0].length===n.length)});t.addSingleVal("accept","exts").addSingleVal("regex","pattern");t.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url");t.addMinMax("length","minlength","maxlength","rangelength").addMinMax("range","min","max","range");t.add("equalto",["other"],function(t){var r=e(t.element.name),u=t.params.other,s=o(u,r),h=n(t.form).find(":input[name='"+f(s)+"']")[0];i(t,"equalTo",h)});t.add("required",function(n){(n.element.tagName.toUpperCase()!=="INPUT"||n.element.type.toUpperCase()!=="CHECKBOX")&&i(n,"required",!0)});t.add("remote",["url","type","additionalfields"],function(t){var r={url:t.params.url,type:t.params.type||"GET",data:{}},u=e(t.element.name);n.each(h(t.params.additionalfields||t.element.name),function(i,e){var s=o(e,u);r.data[s]=function(){return n(t.form).find(":input[name='"+f(s)+"']").val()}});i(t,"remote",r)});n(function(){r.unobtrusive.parse(document)})}(jQuery),function(n){function o(i,r,f,o){var s={data:o||(r?r.data:{}),_wrap:r?r._wrap:null,tmpl:null,parent:r||null,nodes:[],calls:d,nest:g,wrap:nt,html:tt,update:it};return i&&n.extend(s,i,{nodes:[],parent:r}),f&&(s.tmpl=f,s._ctnt=s._ctnt||s.tmpl(n,s),s.key=++e,(h.length?u:t)[e]=s),s}function s(t,i,u){var f,e=u?n.map(u,function(n){return typeof n=="string"?t.key?n.replace(/(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g,"$1 "+r+'="'+t.key+'" $2'):n:s(n,t,n._ctnt)}):t;return i?e:(e=e.join(""),e.replace(/^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/,function(t,i,r,u){f=n(r).get();b(f);i&&(f=c(i).concat(f));u&&(f=f.concat(c(u)))}),f?f:c(e))}function c(t){var i=document.createElement("div");return i.innerHTML=t,n.makeArray(i.childNodes)}function p(t){return new Function("jQuery","$item","var $=jQuery,call,_=[],$data=$item.data;with($data){_.push('"+n.trim(t).replace(/([\\'])/g,"\\$1").replace(/[\r\t\n]/g," ").replace(/\$\{([^\}]*)\}/g,"{{= $1}}").replace(/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,function(t,i,r,u,f,e,o){var h=n.tmpl.tag[r],c,s,a;if(!h)throw"Template command not found: "+r;return c=h._default||[],e&&!/\w$/.test(f)&&(f+=e,e=""),f?(f=l(f),o=o?","+l(o)+")":e?")":"",s=e?f.indexOf(".")>-1?f+e:"("+f+").call($item"+o:f,a=e?s:"(typeof("+f+")==='function'?("+f+").call($item):("+f+"))"):a=s=c.$1||"null",u=l(u),"');"+h[i?"close":"open"].split("$notnull_1").join(f?"typeof("+f+")!=='undefined' && ("+f+")!=null":"true").split("$1a").join(a).split("$1").join(s).split("$2").join(u?u.replace(/\s*([^\(]+)\s*(\((.*?)\))?/g,function(n,t,i,r){return r=r?","+r+")":i?")":"",r?"("+t+").call($item"+r:n}):c.$2||"")+"_.push('"})+"');}return _;")}function w(t,i){t._wrap=s(t,!0,n.isArray(i)?i:[v.test(i)?i:n(i).html()]).join("")}function l(n){return n?n.replace(/\\'/g,"'").replace(/\\\\/g,"\\"):null}function k(n){var t=document.createElement("div");return t.appendChild(n.cloneNode(!0)),t.innerHTML}function b(f){function p(f){function p(n){n=n+a;s=v[n]=v[n]||o(s,t[s.parent.key+a]||s.parent,null,!0)}var y,h=f,c,s,l;if(l=f.getAttribute(r)){while(h.parentNode&&(h=h.parentNode).nodeType===1&&!(y=h.getAttribute(r)));y!==l&&(h=h.parentNode?h.nodeType===11?0:h.getAttribute(r)||0:0,(s=t[l])||(s=u[l],s=o(s,t[h]||u[h],null,!0),s.key=++e,t[e]=s),i&&p(l));f.removeAttribute(r)}else i&&(s=n.data(f,"tmplItem"))&&(p(s.key),t[s.key]=s,h=n.data(f.parentNode,"tmplItem"),h=h?h.key:0);if(s){for(c=s;c&&c.key!=h;)c.nodes.push(f),c=c.parent;delete s._ctnt;delete s._wrap;n.data(f,"tmplItem",s)}}for(var a="_"+i,c,l,v={},h,s=0,y=f.length;s<y;s++)if((c=f[s]).nodeType===1){for(l=c.getElementsByTagName("*"),h=l.length-1;h>=0;h--)p(l[h]);p(c)}}function d(n,t,i,r){if(!n)return h.pop();h.push({_:n,tmpl:t,item:this,data:i,options:r})}function g(t,i,r){return n.tmpl(n.template(t),i,r,this)}function nt(t,i){var r=t.options||{};return r.wrapped=i,n.tmpl(n.template(t.tmpl),t.data,r,t.item)}function tt(t,i){var r=this._wrap;return n.map(n(n.isArray(r)?r.join(""):r).filter(t||"*"),function(n){return i?n.innerText||n.textContent:n.outerHTML||k(n)})}function it(){var t=this.nodes;n.tmpl(null,null,null,this).insertBefore(t[0]);n(t).remove()}var a=n.fn.domManip,r="_tmplitem",v=/^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,t={},u={},f,y={key:0,data:{}},e=0,i=0,h=[];n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(r,u){n.fn[r]=function(e){var o=[],h=n(e),c,s,a,v,l=this.length===1&&this[0].parentNode;if(f=t||{},l&&l.nodeType===11&&l.childNodes.length===1&&h.length===1)h[u](this[0]),o=this;else{for(s=0,a=h.length;s<a;s++)i=s,c=(s>0?this.clone(!0):this).get(),n.fn[u].apply(n(h[s]),c),o=o.concat(c);i=0;o=this.pushStack(o,r,h.selector)}return v=f,f=null,n.tmpl.complete(v),o}});n.fn.extend({tmpl:function(t,i,r){return n.tmpl(this[0],t,i,r)},tmplItem:function(){return n.tmplItem(this[0])},template:function(t){return n.template(t,this[0])},domManip:function(r,u,e){if(r[0]&&r[0].nodeType){for(var o=n.makeArray(arguments),s=r.length,h=0,c;h<s&&!(c=n.data(r[h++],"tmplItem")););s>1&&(o[0]=[n.makeArray(r)]);c&&i&&(o[2]=function(t){n.tmpl.afterManip(this,t,e)});a.apply(this,o)}else a.apply(this,arguments);return i=0,f||n.tmpl.complete(t),this}});n.extend({tmpl:function(i,r,f,e){var h,c=!e;if(c)e=y,i=n.template[i]||n.template(null,i),u={};else if(!i)return i=e.tmpl,t[e.key]=e,e.nodes=[],e.wrapped&&w(e,e.wrapped),n(s(e,null,e.tmpl(n,e)));return i?(typeof r=="function"&&(r=r.call(e||{})),f&&f.wrapped&&w(f,f.wrapped),h=n.isArray(r)?n.map(r,function(n){return n?o(f,e,i,n):null}):[o(f,e,i,r)],c?n(s(e,null,h)):h):[]},tmplItem:function(t){var i;for(t instanceof n&&(t=t[0]);t&&t.nodeType===1&&!(i=n.data(t,"tmplItem"))&&(t=t.parentNode););return i||y},template:function(t,i){return i?(typeof i=="string"?i=p(i):i instanceof n&&(i=i[0]||{}),i.nodeType&&(i=n.data(i,"tmpl")||n.data(i,"tmpl",p(i.innerHTML))),typeof t=="string"?n.template[t]=i:i):t?typeof t!="string"?n.template(null,t):n.template[t]||n.template(null,v.test(t)?t:n(t)):null},encode:function(n){return(""+n).split("<").join("&lt;").split(">").join("&gt;").split('"').join("&#34;").split("'").join("&#39;")}});n.extend(n.tmpl,{tag:{tmpl:{_default:{$2:"null"},open:"if($notnull_1){_=_.concat($item.nest($1,$2));}"},wrap:{_default:{$2:"null"},open:"$item.calls(_,$1,$2);_=[];",close:"call=$item.calls();_=call._.concat($item.wrap(call,_));"},each:{_default:{$2:"$index, $value"},open:"if($notnull_1){$.each($1a,function($2){with(this){",close:"}});}"},"if":{open:"if(($notnull_1) && $1a){",close:"}"},"else":{_default:{$1:"true"},open:"}else if(($notnull_1) && $1a){"},html:{open:"if($notnull_1){_.push($1a);}"},"=":{_default:{$1:"$data"},open:"if($notnull_1){_.push($.encode($1a));}"},"!":{open:""}},complete:function(){t={}},afterManip:function(t,r,u){var f=r.nodeType===11?n.makeArray(r.childNodes):r.nodeType===1?[r]:[];u.call(t,r);b(f);i++}})}(jQuery),function(n,t,i){function e(i,r,u){var f=t.createElement(i);return r&&(f.id=h+r),u&&(f.style.cssText=u),n(f)}function ai(){return i.innerHeight?i.innerHeight:n(i).height()}function kt(n){var i=c.length,t=(a+n)%i;return t<0?i+t:t}function y(n,t){return Math.round((/%/.test(n)?(t==="x"?d.width():ai())/100:1)*parseInt(n,10))}function pi(n,t){return n.photo||n.photoRegex.test(t)}function wi(n,t){return n.retinaUrl&&i.devicePixelRatio>1?t.replace(n.photoRegex,n.retinaSuffix):t}function bi(n){"contains"in u[0]&&!u[0].contains(n.target)&&(n.stopPropagation(),u.focus())}function ki(){var t,i=n.data(v,b);i==null?(r=n.extend({},gt),console&&console.log&&console.log("Error: cboxElement missing settings object")):r=n.extend({},i);for(t in r)n.isFunction(r[t])&&t.slice(0,2)!=="on"&&(r[t]=r[t].call(v));r.rel=r.rel||v.rel||n(v).data("rel")||"nofollow";r.href=r.href||n(v).attr("href");r.title=r.title||v.title;typeof r.href=="string"&&(r.href=n.trim(r.href))}function ft(i,r){n(t).trigger(i);w.triggerHandler(i);n.isFunction(r)&&r.call(v)}function dt(i){if(!at){if(v=i,ki(),c=n(v),a=0,r.rel!=="nofollow"&&(c=n("."+et).filter(function(){var t=n.data(this,b),i;return t&&(i=n(this).data("rel")||t.rel||this.rel),i===r.rel}),a=c.index(v),a===-1&&(c=c.add(v),a=c.length-1)),k.css({opacity:parseFloat(r.opacity),cursor:r.overlayClose?"pointer":"auto",visibility:"visible"}).show(),hi&&u.add(k).removeClass(hi),r.className&&u.add(k).addClass(r.className),hi=r.className,r.closeButton?bt.html(r.close).appendTo(p):bt.appendTo("<div/>"),!tt){if(tt=lt=!0,u.css({visibility:"hidden",display:"block"}),l=e(o,"LoadedContent","width:0; height:0; overflow:hidden"),p.css({width:"",height:""}).append(l),g=ii.height()+fi.height()+p.outerHeight(!0)-p.height(),nt=ri.width()+ui.width()+p.outerWidth(!0)-p.width(),it=l.outerHeight(!0),rt=l.outerWidth(!0),r.w=y(r.initialWidth,"x"),r.h=y(r.initialHeight,"y"),l.css({width:"",height:r.h}),s.position(),ft(gi,r.onOpen),si.add(ei).hide(),u.focus(),r.trapFocus&&t.addEventListener){t.addEventListener("focus",bi,!0);w.one(ti,function(){t.removeEventListener("focus",bi,!0)})}if(r.returnFocus)w.one(ti,function(){n(v).focus()})}ir()}}function di(){!u&&t.body&&(li=!1,d=n(i),u=e(o).attr({id:b,"class":n.support.opacity===!1?h+"IE":"",role:"dialog",tabindex:"-1"}).hide(),k=e(o,"Overlay").hide(),wt=n([e(o,"LoadingOverlay")[0],e(o,"LoadingGraphic")[0]]),ut=e(o,"Wrapper"),p=e(o,"Content").append(ei=e(o,"Title"),oi=e(o,"Current"),ct=n('<button type="button"/>').attr({id:h+"Previous"}),ht=n('<button type="button"/>').attr({id:h+"Next"}),ot=e("button","Slideshow"),wt),bt=n('<button type="button"/>').attr({id:h+"Close"}),ut.append(e(o).append(e(o,"TopLeft"),ii=e(o,"TopCenter"),e(o,"TopRight")),e(o,!1,"clear:left").append(ri=e(o,"MiddleLeft"),p,ui=e(o,"MiddleRight")),e(o,!1,"clear:left").append(e(o,"BottomLeft"),fi=e(o,"BottomCenter"),e(o,"BottomRight"))).find("div div").css({float:"left"}),st=e(o,!1,"position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;"),si=ht.add(ct).add(oi).add(ot),n(t.body).append(k,u.append(ut,st)))}function tr(){function i(n){n.which>1||n.shiftKey||n.altKey||n.metaKey||n.ctrlKey||(n.preventDefault(),dt(this))}if(u){if(!li)if(li=!0,ht.click(function(){s.next()}),ct.click(function(){s.prev()}),bt.click(function(){s.close()}),k.click(function(){r.overlayClose&&s.close()}),n(t).bind("keydown."+h,function(n){var t=n.keyCode;tt&&r.escKey&&t===27&&(n.preventDefault(),s.close());tt&&r.arrowKey&&c[1]&&!n.altKey&&(t===37?(n.preventDefault(),ct.click()):t===39&&(n.preventDefault(),ht.click()))}),n.isFunction(n.fn.on))n(t).on("click."+h,"."+et,i);else n("."+et).live("click."+h,i);return!0}return!1}function ir(){var u,b,p=s.prep,k,d=++ci;if(lt=!0,f=!1,v=c[a],ki(),ft(pt),ft(vt,r.onLoad),r.h=r.height?y(r.height,"y")-it-g:r.innerHeight&&y(r.innerHeight,"y"),r.w=r.width?y(r.width,"x")-rt-nt:r.innerWidth&&y(r.innerWidth,"x"),r.mw=r.w,r.mh=r.h,r.maxWidth&&(r.mw=y(r.maxWidth,"x")-rt-nt,r.mw=r.w&&r.w<r.mw?r.w:r.mw),r.maxHeight&&(r.mh=y(r.maxHeight,"y")-it-g,r.mh=r.h&&r.h<r.mh?r.h:r.mh),u=r.href,vi=setTimeout(function(){wt.show()},100),r.inline){k=e(o).hide().insertBefore(n(u)[0]);w.one(pt,function(){k.replaceWith(l.children())});p(n(u))}else if(r.iframe)p(" ");else if(r.html)p(r.html);else if(pi(r,u)){u=wi(r,u);f=t.createElement("img");n(f).addClass(h+"Photo").bind("error",function(){r.title=!1;p(e(o,"Error").html(r.imgError))}).one("load",function(){var t;d===ci&&(n.each(["alt","longdesc","aria-describedby"],function(t,i){var r=n(v).attr(i)||n(v).attr("data-"+i);r&&f.setAttribute(i,r)}),r.retinaImage&&i.devicePixelRatio>1&&(f.height=f.height/i.devicePixelRatio,f.width=f.width/i.devicePixelRatio),r.scalePhotos&&(b=function(){f.height-=f.height*t;f.width-=f.width*t},r.mw&&f.width>r.mw&&(t=(f.width-r.mw)/f.width,b()),r.mh&&f.height>r.mh&&(t=(f.height-r.mh)/f.height,b())),r.h&&(f.style.marginTop=Math.max(r.mh-f.height,0)/2+"px"),c[1]&&(r.loop||c[a+1])&&(f.style.cursor="pointer",f.onclick=function(){s.next()}),f.style.width=f.width+"px",f.style.height=f.height+"px",setTimeout(function(){p(f)},1))});setTimeout(function(){f.src=u},1)}else u&&st.load(u,r.data,function(t,i){d===ci&&p(i==="error"?e(o,"Error").html(r.xhrError):n(this).contents())})}var gt={html:!1,photo:!1,iframe:!1,inline:!1,transition:"elastic",speed:300,fadeOut:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,href:!1,title:!1,rel:!1,opacity:.9,preloading:!0,className:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:undefined,closeButton:!0,fastIframe:!0,open:!1,reposition:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",photoRegex:/\.(gif|png|jp(e|g|eg)|bmp|ico|webp)((#|\?).*)?$/i,retinaImage:!1,retinaUrl:!1,retinaSuffix:"@2x.$1",current:"image {current} of {total}",previous:"previous",next:"next",close:"close",xhrError:"This content failed to load.",imgError:"This image failed to load.",returnFocus:!0,trapFocus:!0,onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1},b="colorbox",h="cbox",et=h+"Element",gi=h+"_open",vt=h+"_load",yt=h+"_complete",ni=h+"_cleanup",ti=h+"_closed",pt=h+"_purge",k,u,ut,p,ii,ri,ui,fi,c,d,l,st,wt,ei,oi,ot,ht,ct,bt,si,w=n("<a/>"),r,g,nt,it,rt,v,a,f,tt,lt,at,vi,s,o="div",hi,ci=0,yi={},li,nr=function(){function t(){clearTimeout(l)}function e(){(r.loop||c[a+1])&&(t(),l=setTimeout(s.next,r.slideshowSpeed))}function v(){ot.html(r.slideshowStop).unbind(i).one(i,y);w.bind(yt,e).bind(vt,t);u.removeClass(n+"off").addClass(n+"on")}function y(){t();w.unbind(yt,e).unbind(vt,t);ot.html(r.slideshowStart).unbind(i).one(i,function(){s.next();v()});u.removeClass(n+"on").addClass(n+"off")}function o(){f=!1;ot.hide();t();w.unbind(yt,e).unbind(vt,t);u.removeClass(n+"off "+n+"on")}var f,n=h+"Slideshow_",i="click."+h,l;return function(){if(f)r.slideshow||(w.unbind(ni,o),o());else if(r.slideshow&&c[1]){f=!0;w.one(ni,o);r.slideshowAuto?v():y();ot.show()}}}();n.colorbox||(n(di),s=n.fn[b]=n[b]=function(t,i){var r=this;if(t=t||{},di(),tr()){if(n.isFunction(r))r=n("<a/>"),t.open=!0;else if(!r[0])return r;i&&(t.onComplete=i);r.each(function(){n.data(this,b,n.extend({},n.data(this,b)||gt,t))}).addClass(et);(n.isFunction(t.open)&&t.open.call(r)||t.open)&&dt(r[0])}return r},s.position=function(t,i){function w(){ii[0].style.width=fi[0].style.width=p[0].style.width=parseInt(u[0].style.width,10)-nt+"px";p[0].style.height=ri[0].style.height=ui[0].style.height=parseInt(u[0].style.height,10)-g+"px"}var f,o=0,c=0,e=u.offset(),l,a,v;d.unbind("resize."+h);u.css({top:-9e4,left:-9e4});l=d.scrollTop();a=d.scrollLeft();r.fixed?(e.top-=l,e.left-=a,u.css({position:"fixed"})):(o=l,c=a,u.css({position:"absolute"}));c+=r.right!==!1?Math.max(d.width()-r.w-rt-nt-y(r.right,"x"),0):r.left!==!1?y(r.left,"x"):Math.round(Math.max(d.width()-r.w-rt-nt,0)/2);o+=r.bottom!==!1?Math.max(ai()-r.h-it-g-y(r.bottom,"y"),0):r.top!==!1?y(r.top,"y"):Math.round(Math.max(ai()-r.h-it-g,0)/2);u.css({top:e.top,left:e.left,visibility:"visible"});ut[0].style.width=ut[0].style.height="9999px";f={width:r.w+rt+nt,height:r.h+it+g,top:o,left:c};t&&(v=0,n.each(f,function(n){if(f[n]!==yi[n]){v=t;return}}),t=v);yi=f;t||u.css(f);u.dequeue().animate(f,{duration:t||0,complete:function(){w();lt=!1;ut[0].style.width=r.w+rt+nt+"px";ut[0].style.height=r.h+it+g+"px";r.reposition&&setTimeout(function(){d.bind("resize."+h,s.position)},1);i&&i()},step:w})},s.resize=function(n){var t;tt&&(n=n||{},n.width&&(r.w=y(n.width,"x")-rt-nt),n.innerWidth&&(r.w=y(n.innerWidth,"x")),l.css({width:r.w}),n.height&&(r.h=y(n.height,"y")-it-g),n.innerHeight&&(r.h=y(n.innerHeight,"y")),n.innerHeight||n.height||(t=l.scrollTop(),l.css({height:"auto"}),r.h=l.height()),l.css({height:r.h}),t&&l.scrollTop(t),s.position(r.transition==="none"?0:r.speed))},s.prep=function(i){function k(){return r.w=r.w||l.width(),r.w=r.mw&&r.mw<r.w?r.mw:r.w,r.w}function d(){return r.h=r.h||l.height(),r.h=r.mh&&r.mh<r.h?r.mh:r.h,r.h}if(tt){var v,y=r.transition==="none"?0:r.speed;l.empty().remove();l=e(o,"LoadedContent").append(i);l.hide().appendTo(st.show()).css({width:k(),overflow:r.scrolling?"auto":"hidden"}).css({height:d()}).prependTo(p);st.hide();n(f).css({float:"none"});v=function(){function p(){n.support.opacity===!1&&u[0].style.removeAttribute("filter")}var f=c.length,i,s="frameBorder",v="allowTransparency",o;if(tt){if(o=function(){clearTimeout(vi);wt.hide();ft(yt,r.onComplete)},ei.html(r.title).add(l).show(),f>1?(typeof r.current=="string"&&oi.html(r.current.replace("{current}",a+1).replace("{total}",f)).show(),ht[r.loop||a<f-1?"show":"hide"]().html(r.next),ct[r.loop||a?"show":"hide"]().html(r.previous),nr(),r.preloading&&n.each([kt(-1),kt(1)],function(){var i,f,u=c[this],r=n.data(u,b);r&&r.href?(i=r.href,n.isFunction(i)&&(i=i.call(u))):i=n(u).attr("href");i&&pi(r,i)&&(i=wi(r,i),f=t.createElement("img"),f.src=i)})):si.hide(),r.iframe){i=e("iframe")[0];s in i&&(i[s]=0);v in i&&(i[v]="true");r.scrolling||(i.scrolling="no");n(i).attr({src:r.href,name:(new Date).getTime(),"class":h+"Iframe",allowFullScreen:!0,webkitAllowFullScreen:!0,mozallowfullscreen:!0}).one("load",o).appendTo(l);w.one(pt,function(){i.src="//about:blank"});r.fastIframe&&n(i).trigger("load")}else o();r.transition==="fade"?u.fadeTo(y,1,p):p()}};r.transition==="fade"?u.fadeTo(y,0,function(){s.position(0,v)}):s.position(y,v)}},s.next=function(){!lt&&c[1]&&(r.loop||c[a+1])&&(a=kt(1),dt(c[a]))},s.prev=function(){!lt&&c[1]&&(r.loop||a)&&(a=kt(-1),dt(c[a]))},s.close=function(){tt&&!at&&(at=!0,tt=!1,ft(ni,r.onCleanup),d.unbind("."+h),k.fadeTo(r.fadeOut||0,0),u.stop().fadeTo(r.fadeOut||0,0,function(){u.add(k).css({opacity:1,cursor:"auto"}).hide();ft(pt);l.empty().remove();setTimeout(function(){at=!1;ft(ti,r.onClosed)},1)}))},s.remove=function(){u&&(u.stop(),n.colorbox.close(),u.stop().remove(),k.remove(),at=!1,u=null,n("."+et).removeData(b).removeClass(et),n(t).unbind("click."+h))},s.element=function(){return n(v)},s.settings=gt)}(jQuery,document,window),function(n){"use strict";var t=function(){var t={bcClass:"sf-breadcrumb",menuClass:"sf-js-enabled",anchorClass:"sf-with-ul",menuArrowClass:"sf-arrows"},f=function(){var t=/iPhone|iPad|iPod/i.test(navigator.userAgent);return t&&n(window).load(function(){n("body").children().on("click",n.noop)}),t}(),l=function(){var n=document.documentElement.style;return"behavior"in n&&"fill"in n&&/iemobile/i.test(navigator.userAgent)}(),e=function(n,i){var r=t.menuClass;i.cssArrows&&(r+=" "+t.menuArrowClass);n.toggleClass(r)},a=function(i,r){return i.find("li."+r.pathClass).slice(0,r.pathLevels).addClass(r.hoverClass+" "+t.bcClass).filter(function(){return n(this).children(r.popUpSelector).hide().show().length}).removeClass(r.pathClass)},o=function(n){n.children("a").toggleClass(t.anchorClass)},s=function(n){var t=n.css("ms-touch-action");t=t==="pan-y"?"auto":"pan-y";n.css("ms-touch-action",t)},v=function(t,r){var o="li:has("+r.popUpSelector+")",e;if(n.fn.hoverIntent&&!r.disableHI)t.hoverIntent(i,u,o);else t.on("mouseenter.superfish",o,i).on("mouseleave.superfish",o,u);e="MSPointerDown.superfish";f||(e+=" touchend.superfish");l&&(e+=" mousedown.superfish");t.on("focusin.superfish","li",i).on("focusout.superfish","li",u).on(e,"a",r,y)},y=function(t){var r=n(this),u=r.siblings(t.data.popUpSelector);if(u.length>0&&u.is(":hidden")){r.one("click.superfish",!1);t.type==="MSPointerDown"?r.trigger("focus"):n.proxy(i,r.parent("li"))()}},i=function(){var i=n(this),t=r(i);t!=null&&t.sfTimer!=null&&clearTimeout(t.sfTimer);i.siblings().superfish("hide").end().superfish("show")},u=function(){var i=n(this),t=r(i);f?n.proxy(h,i,t)():t!=null&&t.sfTimer!=null&&(clearTimeout(t.sfTimer),t.sfTimer=setTimeout(n.proxy(h,i,t),t.delay))},h=function(t){t.retainPath=n.inArray(this[0],t.$path)>-1;this.superfish("hide");this.parents("."+t.hoverClass).length||(t.onIdle.call(c(this)),t.$path.length&&n.proxy(i,t.$path)())},c=function(n){return n.closest("."+t.menuClass)},r=function(n){return c(n).data("sf-options")};return{hide:function(t){var u,i;if(this.length){if(u=this,i=r(u),!i)return this;var o=i.retainPath===!0?i.$path:"",f=u.find("li."+i.hoverClass).add(this).not(o).removeClass(i.hoverClass).children(i.popUpSelector),e=i.speedOut;t&&(f.show(),e=0);i.retainPath=!1;i.onBeforeHide.call(f);f.stop(!0,!0).animate(i.animationOut,e,function(){var t=n(this);i.onHide.call(t)})}return this},show:function(){var n=r(this),i,t;return n?(i=this.addClass(n.hoverClass),t=i.children(n.popUpSelector),n.onBeforeShow.call(t),t.stop(!0,!0).animate(n.animation,n.speed,function(){n.onShow.call(t)}),this):this},destroy:function(){return this.each(function(){var r=n(this),i=r.data("sf-options"),u;if(!i)return!1;u=r.find(i.popUpSelector).parent("li");clearTimeout(i.sfTimer);e(r,i);o(u);s(r);r.off(".superfish").off(".hoverIntent");u.children(i.popUpSelector).attr("style",function(n,t){return t.replace(/display[^;]+;?/g,"")});i.$path.removeClass(i.hoverClass+" "+t.bcClass).addClass(i.pathClass);r.find("."+i.hoverClass).removeClass(i.hoverClass);i.onDestroy.call(r);r.removeData("sf-options")})},init:function(i){return this.each(function(){var u=n(this),r,f;if(u.data("sf-options"))return!1;r=n.extend({},n.fn.superfish.defaults,i);f=u.find(r.popUpSelector).parent("li");r.$path=a(u,r);u.data("sf-options",r);e(u,r);o(f);s(u);v(u,r);f.not("."+t.bcClass).superfish("hide",!0);r.onInit.call(this)})}}}();n.fn.superfish=function(i){return t[i]?t[i].apply(this,Array.prototype.slice.call(arguments,1)):typeof i!="object"&&i?n.error("Method "+i+" does not exist on jQuery.fn.superfish"):t.init.apply(this,arguments)};n.fn.superfish.defaults={popUpSelector:"ul,.sf-mega",hoverClass:"sfHover",pathClass:"overrideThisToUse",pathLevels:1,delay:800,animation:{opacity:"show"},animationOut:{opacity:"hide"},speed:"normal",speedOut:"fast",cssArrows:!0,disableHI:!1,onInit:n.noop,onBeforeShow:n.noop,onShow:n.noop,onBeforeHide:n.noop,onHide:n.noop,onIdle:n.noop,onDestroy:n.noop};n.fn.extend({hideSuperfishUl:t.hide,showSuperfishUl:t.show})}(jQuery),function(n){function t(n,t){return typeof n=="function"?n.call(t):n}function i(t,i){this.$element=n(t);this.options=i;this.enabled=!0;this.fixTitle()}i.prototype={show:function(){var s=this.getTitle(),r;if(s&&this.enabled){r=this.tip();r.find(".tipsy-inner")[this.options.html?"html":"text"](s);r[0].className="tipsy";r.remove().css({top:0,left:0,visibility:"hidden",display:"block"}).prependTo(document.body);var i=n.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight}),e=r[0].offsetWidth,o=r[0].offsetHeight,f=t(this.options.gravity,this.$element[0]),u;switch(f.charAt(0)){case"n":u={top:i.top+i.height+this.options.offset,left:i.left+i.width/2-e/2};break;case"s":u={top:i.top-o-this.options.offset,left:i.left+i.width/2-e/2};break;case"e":u={top:i.top+i.height/2-o/2,left:i.left-e-this.options.offset};break;case"w":u={top:i.top+i.height/2-o/2,left:i.left+i.width+this.options.offset}}f.length==2&&(u.left=f.charAt(1)=="w"?i.left+i.width/2-15:i.left+i.width/2-e+15);r.css(u).addClass("tipsy-"+f);r.find(".tipsy-arrow")[0].className="tipsy-arrow tipsy-arrow-"+f.charAt(0);this.options.className&&r.addClass(t(this.options.className,this.$element[0]));this.options.fade?r.stop().css({opacity:0,display:"block",visibility:"visible"}).animate({opacity:this.options.opacity}):r.css({visibility:"visible",opacity:this.options.opacity})}},hide:function(){this.options.fade?this.tip().stop().fadeOut(function(){n(this).remove()}):this.tip().remove()},fixTitle:function(){var n=this.$element;(n.attr("title")||typeof n.attr("original-title")!="string")&&n.attr("original-title",n.attr("title")||"").removeAttr("title")},getTitle:function(){var i=this.$element,n=this.options,t;return this.fixTitle(),n=this.options,typeof n.title=="string"?t=i.attr(n.title=="title"?"original-title":n.title):typeof n.title=="function"&&(t=n.title.call(i[0])),t=(""+t).replace(/(^\s*|\s*$)/,""),t||n.fallback},tip:function(){return this.$tip||(this.$tip=n('<div class="tipsy"><\/div>').html('<div class="tipsy-arrow"><\/div><div class="tipsy-inner"><\/div>')),this.$tip},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled}};n.fn.tipsy=function(t){function u(r){var u=n.data(r,"tipsy");return u||(u=new i(r,n.fn.tipsy.elementOptions(r,t)),n.data(r,"tipsy",u)),u}function e(){var n=u(this);n.hoverState="in";t.delayIn==0?n.show():(n.fixTitle(),setTimeout(function(){n.hoverState=="in"&&n.show()},t.delayIn))}function o(){var n=u(this);n.hoverState="out";t.delayOut==0?n.hide():setTimeout(function(){n.hoverState=="out"&&n.hide()},t.delayOut)}var r;if(t===!0)return this.data("tipsy");if(typeof t=="string")return r=this.data("tipsy"),r&&r[t](),this;if(t=n.extend({},n.fn.tipsy.defaults,t),t.live||this.each(function(){u(this)}),t.trigger!="manual"){var f=t.live?"live":"bind",s=t.trigger=="hover"?"mouseenter":"focus",h=t.trigger=="hover"?"mouseleave":"blur";this[f](s,e)[f](h,o)}return this};n.fn.tipsy.defaults={className:null,delayIn:0,delayOut:0,fade:!1,fallback:"",gravity:"n",html:!1,live:!1,offset:0,opacity:.8,title:"title",trigger:"hover"};n.fn.tipsy.elementOptions=function(t,i){return n.metadata?n.extend({},i,n(t).metadata()):i};n.fn.tipsy.autoNS=function(){return n(this).offset().top>n(document).scrollTop()+n(window).height()/2?"s":"n"};n.fn.tipsy.autoWE=function(){return n(this).offset().left>n(document).scrollLeft()+n(window).width()/2?"e":"w"};n.fn.tipsy.autoBounds=function(t,i){return function(){var r={ns:i[0],ew:i.length>1?i[1]:!1},f=n(document).scrollTop()+t,e=n(document).scrollLeft()+t,u=n(this);return u.offset().top<f&&(r.ns="n"),u.offset().left<e&&(r.ew="w"),n(window).width()+n(document).scrollLeft()-u.offset().left<t&&(r.ew="e"),n(window).height()+n(document).scrollTop()-u.offset().top<t&&(r.ns="s"),r.ns+(r.ew?r.ew:"")}}}(jQuery);window.log=function(){if(log.history=log.history||[],log.history.push(arguments),this.console){var n=arguments,t;n.callee=n.callee.caller;t=[].slice.call(n);typeof console.log=="object"?log.apply.call(console.log,console,t):console.log.apply(console,t)}},function(n){function i(){}for(var r="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),t;!!(t=r.pop());)n[t]=n[t]||i}(function(){try{return console.log(),window.console}catch(n){return window.console={}}}()),function(n){n.fn.outside=function(t,i){return this.each(function(){var f=n(this),r=this;n(document.body).bind(t,function u(f){f.target===r||n.contains(r,f.target)||(i.apply(r,[f]),r.parentNode||n(document.body).unbind(t,u))})})}}(jQuery),function(n){n.fn.limitInput=function(t,i,r){return this.each(function(){n(this).keypress(function(){return n(this).val().length<t});n(this).keyup(function(){n(this).val().length>t&&n(this).val(n(this).val().substring(0,t));n(i).html(t-n(this).val().length+" character(s) remaining")});typeof r!="undefined"&&r&&n(i).html(t-(n(this).val()!=null?n(this).val().length:0)+" character(s) remaining")})}}(jQuery),function(n){n.fn.ajaxForm=function(t){t=n.extend({preSubmitCallback:null,successCallback:null,errorCallback:null},t);n(this).find("input[type=submit]").after(n('<img src="/img/ajax-spinner.gif" class="spinner" />'));n(this).submit(function(){var r=n(this).find("input[type=submit]"),u=n(this).find("img.spinner"),i;return n(this).valid()&&(i=n(this),u.show(),r.attr("disabled","disabled"),t.preSubmitCallback&&t.preSubmitCallback(n(this)),n.ajax({url:n(this).attr("action"),async:!0,type:n(this).attr("method"),data:n(this).serialize(),success:function(n){t.successCallback&&t.successCallback(i,n)},error:function(){t.errorCallback&&t.errorCallback(i)},complete:function(){r.removeAttr("disabled");u.hide()}})),!1})}}(jQuery);jQuery(document).ready(function(){function n(){jQuery(".post-thumb a img, .tab-thumb img, .tz_flickr_widget img").hover(function(){jQuery(this).stop().animate({opacity:.8},200)},function(){jQuery(this).stop().animate({opacity:1},200)});jQuery(".plus").hover(function(){jQuery(this).parent(".post-thumb").find("img").stop().animate({opacity:.8},200)},function(){jQuery(this).parent(".post-thumb").find("img").stop().animate({opacity:1},200)})}function t(){jQuery("a[rel^='prettyPhoto']").prettyPhoto({animationSpeed:"fast",slideshow:5e3,theme:"pp_default",show_title:!1,overlay_gallery:!1})}jQuery().superfish&&jQuery(".sf-menu-wrapper ul.sf-menu").superfish({delay:200,animation:{opacity:"show",height:"show"},speed:"fast",dropShadows:!1});jQuery(".toggle h4").each(function(){var n=jQuery(this).closest(".toggle").find(".inner").height(),t=jQuery(this).closest(".toggle").find(".inner").css("padding-top"),i=jQuery(this).closest(".toggle").find(".inner").css("padding-bottom");jQuery(this).toggle(function(){imageURL=jQuery(this).find("span").attr("class");jQuery(this).closest(".toggle").find(".inner").animate({height:0,paddingTop:0,paddingBottom:0,opacity:0},200,"jswing");jQuery(this).find("span").css("background","url("+imageURL+"/images/plus_minus_sprite.gif) 25px 12px")},function(){jQuery(this).closest(".toggle").find(".inner").animate({height:n,paddingTop:t,paddingBottom:i,opacity:1},200,"jswing");jQuery(this).find("span").css("background","url("+imageURL+"/images/plus_minus_sprite.gif) 12px 12px")})});jQuery().tabs&&(jQuery(".tabs, .tour").tabs({}),jQuery(".tour .nav a").click(function(n){n.preventDefault()}));n();jQuery().prettyPhoto&&t();jQuery("#taxs a").each(function(){var n=jQuery(this).width()+2;jQuery(this).hover(function(){jQuery(this).not(".active").stop().animate({width:"91%"},200,"jswing")},function(){jQuery(this).not(".active").stop().animate({width:n},200,"jswing")});jQuery(this).click(function(n){jQuery("#taxs a").removeClass("active").width("");jQuery(this).addClass("active").width("91%");n.preventDefault()})});jQuery("#taxs a.active").css({width:"91%"});jQuery().quicksand&&(function(n){n.fn.sorted=function(t){var i={reversed:!1,by:function(n){return n.text()}};return n.extend(i,t),$data=jQuery(this),arr=$data.get(),arr.sort(function(t,r){var u=i.by(n(t)),f=i.by(n(r));return i.reversed?u<f?1:u>f?-1:0:u<f?-1:u>f?1:0}),n(arr)}}(jQuery),jQuery(function(){var f=function(n){for(var i={selected:!1,type:0},t=0;t<n.length;t++)n[t].indexOf("selected-")==0&&(i.selected=!0),n[t].indexOf("segment-")==0&&(i.segment=n[t].split("-")[1]);return i},e=function(n){var t=n.parent().filter('[class*="selected-"]');return t.find("a").attr("data-value")},o=function(n){var t=n.parent().filter('[class*="selected-"]');return t.find("a").attr("data-value")},s={duration:slideDuration,easing:"easeInOutQuad",adjustHeight:"dynamic"},r=jQuery("#columns-wrap"),u=r.clone(),i=jQuery("#portfolio-filter");i.each(function(){var c=jQuery(this),h=c.find("a");h.bind("click",function(c){var w=jQuery(this),v=w.parent(),y=f(v.attr("class").split(" ")),b=y.selected,k=y.segment,d,l,a,p;b||(h.parent().removeClass(),v.addClass("selected-"+k),d=e(i.eq(1).find("a")),l=o(i.eq(0).find("a")),a=l=="all"?u.find("li"):u.find("li."+l),p=a.sorted({by:function(n){return parseInt(jQuery(n).find(".count").text())}}),r.quicksand(p,s,function(){n();t()}));c.preventDefault()})})}))}),function(n){var t={init:function(i){return this.each(function(){var r=this,f=n(r).empty(),u,e,o;for(r.opt=n.extend(!0,{},n.fn.raty.defaults,i),f.data("settings",r.opt),r.opt.number=t.between(r.opt.number,0,20),r.opt.path.substring(r.opt.path.length-1,r.opt.path.length)!="/"&&(r.opt.path+="/"),typeof r.opt.score=="function"&&(r.opt.score=r.opt.score.call(r)),r.opt.score&&(r.opt.score=t.between(r.opt.score,0,r.opt.number)),u=1;u<=r.opt.number;u++)n("<img />",{src:r.opt.path+(!r.opt.score||r.opt.score<u?r.opt.starOff:r.opt.starOn),alt:u,title:u<=r.opt.hints.length&&r.opt.hints[u-1]!==null?r.opt.hints[u-1]:u}).appendTo(r),r.opt.space&&f.append(u<r.opt.number?"&#160;":"");r.stars=f.children('img:not(".raty-cancel")');r.score=n("<input />",{type:"hidden",name:r.opt.scoreName}).appendTo(r);r.opt.score&&r.opt.score>0&&(r.score.val(r.opt.score),t.roundStar.call(r,r.opt.score));r.opt.iconRange&&t.fill.call(r,r.opt.score);t.setTarget.call(r,r.opt.score,r.opt.targetKeep);e=r.opt.space?4:0;o=r.opt.width||r.opt.number*r.opt.size+r.opt.number*e;r.opt.cancel&&(r.cancel=n("<img />",{src:r.opt.path+r.opt.cancelOff,alt:"x",title:r.opt.cancelHint,"class":"raty-cancel"}),r.opt.cancelPlace=="left"?f.prepend("&#160;").prepend(r.cancel):f.append("&#160;").append(r.cancel),o+=r.opt.size+e);r.opt.readOnly?(t.fixHint.call(r),r.cancel&&r.cancel.hide()):(f.css("cursor","pointer"),t.bindAction.call(r));f.css("width",o)})},between:function(n,t,i){return Math.min(Math.max(parseFloat(n),t),i)},bindAction:function(){var i=this,r=n(i),u;r.mouseleave(function(){var n=i.score.val()||undefined;t.initialize.call(i,n);t.setTarget.call(i,n,i.opt.targetKeep);i.opt.mouseover&&i.opt.mouseover.call(i,n)});u=i.opt.half?"mousemove":"mouseover";i.opt.cancel&&i.cancel.mouseenter(function(){n(this).attr("src",i.opt.path+i.opt.cancelOn);i.stars.attr("src",i.opt.path+i.opt.starOff);t.setTarget.call(i,null,!0);i.opt.mouseover&&i.opt.mouseover.call(i,null)}).mouseleave(function(){n(this).attr("src",i.opt.path+i.opt.cancelOff);i.opt.mouseover&&i.opt.mouseover.call(i,i.score.val()||null)}).click(function(n){i.score.removeAttr("value");i.opt.click&&i.opt.click.call(i,null,n)});i.stars.bind(u,function(u){var f=parseInt(this.alt,10),e,o;i.opt.half?(e=parseFloat((u.pageX-n(this).offset().left)/i.opt.size),o=e>.5?1:.5,f=parseFloat(this.alt)-1+o,t.fill.call(i,f),i.opt.precision&&(f=f-o+e),t.showHalf.call(i,f)):t.fill.call(i,f);r.data("score",f);t.setTarget.call(i,f,!0);i.opt.mouseover&&i.opt.mouseover.call(i,f,u)}).click(function(n){i.score.val(i.opt.half||i.opt.precision?r.data("score"):this.alt);i.opt.click&&i.opt.click.call(i,i.score.val(),n)})},cancel:function(i){return n(this).each(function(){var r=this,u=n(r);if(u.data("readonly")===!0)return this;i?t.click.call(r,null):t.score.call(r,null);r.score.removeAttr("value")})},click:function(i){return n(this).each(function(){if(n(this).data("readonly")===!0)return this;t.initialize.call(this,i);this.opt.click?this.opt.click.call(this,i):t.error.call(this,'you must add the "click: function(score, evt) { }" callback.');t.setTarget.call(this,i,!0)})},error:function(t){n(this).html(t);n.error(t)},fill:function(n){for(var t=this,o=t.stars.length,f=0,e,r,u,i=1;i<=o;i++)e=t.stars.eq(i-1),t.opt.iconRange&&t.opt.iconRange.length>f?(r=t.opt.iconRange[f],u=t.opt.single?i==n?r.on||t.opt.starOn:r.off||t.opt.starOff:i<=n?r.on||t.opt.starOn:r.off||t.opt.starOff,i<=r.range&&e.attr("src",t.opt.path+u),i==r.range&&f++):(u=t.opt.single?i==n?t.opt.starOn:t.opt.starOff:i<=n?t.opt.starOn:t.opt.starOff,e.attr("src",t.opt.path+u))},fixHint:function(){var r=n(this),t=parseInt(this.score.val(),10),i=this.opt.noRatedMsg;!isNaN(t)&&t>0&&(i=t<=this.opt.hints.length&&this.opt.hints[t-1]!==null?this.opt.hints[t-1]:t);r.data("readonly",!0).css("cursor","default").attr("title",i);this.score.attr("readonly","readonly");this.stars.attr("title",i)},getScore:function(){var t=[],i;return n(this).each(function(){i=this.score.val();t.push(i?parseFloat(i):undefined)}),t.length>1?t:t[0]},readOnly:function(i){return this.each(function(){var r=n(this);if(r.data("readonly")===i)return this;this.cancel&&(i?this.cancel.hide():this.cancel.show());i?(r.unbind(),r.children("img").unbind(),t.fixHint.call(this)):(t.bindAction.call(this),t.unfixHint.call(this));r.data("readonly",i)})},reload:function(){return t.set.call(this,{})},roundStar:function(n){var i=(n-Math.floor(n)).toFixed(2),t;i>this.opt.round.down&&(t=this.opt.starOn,i<this.opt.round.up&&this.opt.halfShow?t=this.opt.starHalf:i<this.opt.round.full&&(t=this.opt.starOff),this.stars.eq(Math.ceil(n)-1).attr("src",this.opt.path+t))},score:function(){return arguments.length?t.setScore.apply(this,arguments):t.getScore.call(this)},set:function(t){return this.each(function(){var i=n(this),r=i.data("settings"),u=i.clone().removeAttr("style").insertBefore(i);i.remove();u.raty(n.extend(r,t))}),n(this.selector)},setScore:function(i){return n(this).each(function(){if(n(this).data("readonly")===!0)return this;t.initialize.call(this,i);t.setTarget.call(this,i,!0)})},setTarget:function(i,r){var f,u;this.opt.target&&(f=n(this.opt.target),f.length==0&&t.error.call(this,"target selector invalid or missing!"),u=i,u=r&&u!==undefined?this.opt.targetType=="hint"?u===null&&this.opt.cancel?this.opt.cancelHint:this.opt.hints[Math.ceil(u-1)]:this.opt.precision?parseFloat(u).toFixed(1):parseInt(u,10):this.opt.targetText,this.opt.targetFormat.indexOf("{score}")<0&&t.error.call(this,'template "{score}" missing!'),i!==null&&(u=this.opt.targetFormat.toString().replace("{score}",u)),f.is(":input")?f.val(u):f.html(u))},showHalf:function(n){var t=(n-Math.floor(n)).toFixed(1);t>0&&t<.6&&this.stars.eq(Math.ceil(n)-1).attr("src",this.opt.path+this.opt.starHalf)},initialize:function(n){n=n?t.between(n,0,this.opt.number):0;t.fill.call(this,n);n>0&&(this.opt.halfShow&&t.roundStar.call(this,n),this.score.val(n))},unfixHint:function(){for(var t=0;t<this.opt.number;t++)this.stars.eq(t).attr("title",t<this.opt.hints.length&&this.opt.hints[t]!==null?this.opt.hints[t]:t);n(this).data("readonly",!1).css("cursor","pointer").removeAttr("title");this.score.attr("readonly","readonly")}};n.fn.raty=function(i){if(t[i])return t[i].apply(this,Array.prototype.slice.call(arguments,1));if(typeof i!="object"&&i)n.error("Method "+i+" does not exist!");else return t.init.apply(this,arguments)};n.fn.raty.defaults={cancel:!1,cancelHint:"cancel this rating!",cancelOff:"cancel-off.png",cancelOn:"cancel-on.png",cancelPlace:"left",click:undefined,half:!1,halfShow:!0,hints:["bad","poor","regular","good","gorgeous"],iconRange:undefined,mouseover:undefined,noRatedMsg:"not rated yet",number:5,path:"img/",precision:!1,round:{down:.25,full:.6,up:.76},readOnly:!1,score:undefined,scoreName:"score",single:!1,size:16,space:!0,starHalf:"star-half.png",starOff:"star-off.png",starOn:"star-on.png",target:undefined,targetFormat:"{score}",targetKeep:!1,targetText:"",targetType:"hint",width:undefined}}(jQuery),function(n){n.fn.extend({filter_input:function(t){function i(r){var u=r.input?r.input:n(this),f,e,o;if(!r.ctrlKey&&!r.altKey){if(r.type=="keypress"){if(f=r.charCode?r.charCode:r.keyCode?r.keyCode:0,(f==8||f==9||f==13||f==35||f==36||f==37||f==39||f==46)&&r.charCode==0&&r.keyCode==f)return!0;if(e=String.fromCharCode(f),t.negkey&&e==t.negkey)return u.val().substr(0,1)==e?u.val(u.val().substring(1,u.val().length)).change():u.val(e+u.val()).change(),!1;o=new RegExp(t.regex)}else{if(r.type=="paste")return u.data("value_before_paste",r.target.value),setTimeout(function(){i({type:"after_paste",input:u})},1),!0;if(r.type=="after_paste")e=u.val(),o=new RegExp("^("+t.regex+")+$");else return!1}return o.test(e)?!0:(typeof t.feedback=="function"&&t.feedback.call(this,e),r.type=="after_paste"&&u.val(u.data("value_before_paste")),!1)}}var t=n.extend({regex:".",negkey:!1,live:!1,events:"keypress paste"},t),r=parseFloat(jQuery.fn.jquery.split(".")[0]+"."+jQuery.fn.jquery.split(".")[1]);if(t.live)if(r>=1.7)n(this).on(t.events,i);else n(this).live(t.events,i);else return this.each(function(){var u=n(this);if(r>=1.7)u.off(t.events).on(t.events,i);else u.unbind(t.events).bind(t.events,i)})}})}(jQuery),function(n){typeof define=="function"&&define.amd?define(["jquery"],n):n(jQuery)}(function(n){function u(){var r=e(this),u=t.settings;return isNaN(r.datetime)||(u.cutoff==0||f(r.datetime)<u.cutoff)&&n(this).text(i(r.datetime)),this}function e(i){if(i=n(i),!i.data("timeago")){i.data("timeago",{datetime:t.datetime(i)});var r=n.trim(i.text());t.settings.localeTitle?i.attr("title",i.data("timeago").datetime.toLocaleString()):r.length>0&&!(t.isTime(i)&&i.attr("title"))&&i.attr("title",r)}return i.data("timeago")}function i(n){return t.inWords(f(n))}function f(n){return(new Date).getTime()-n.getTime()}var t,r;n.timeago=function(t){return t instanceof Date?i(t):typeof t=="string"?i(n.timeago.parse(t)):typeof t=="number"?i(new Date(t)):i(n.timeago.datetime(t))};t=n.timeago;n.extend(n.timeago,{settings:{refreshMillis:6e4,allowFuture:!1,localeTitle:!1,cutoff:0,strings:{prefixAgo:null,prefixFromNow:null,suffixAgo:"ago",suffixFromNow:"from now",seconds:"less than a minute",minute:"about a minute",minutes:"%d minutes",hour:"about an hour",hours:"about %d hours",day:"a day",days:"%d days",month:"about a month",months:"%d months",year:"about a year",years:"%d years",wordSeparator:" ",numbers:[]}},inWords:function(t){function r(r,u){var f=n.isFunction(r)?r(u,t):r,e=i.numbers&&i.numbers[u]||u;return f.replace(/%d/i,e)}var i=this.settings.strings,h=i.prefixAgo,c=i.suffixAgo,a,s;this.settings.allowFuture&&t<0&&(h=i.prefixFromNow,c=i.suffixFromNow);var f=Math.abs(t)/1e3,e=f/60,o=e/60,u=o/24,l=u/365;return a=f<45&&r(i.seconds,Math.round(f))||f<90&&r(i.minute,1)||e<45&&r(i.minutes,Math.round(e))||e<90&&r(i.hour,1)||o<24&&r(i.hours,Math.round(o))||o<42&&r(i.day,1)||u<30&&r(i.days,Math.round(u))||u<45&&r(i.month,1)||u<365&&r(i.months,Math.round(u/30))||l<1.5&&r(i.year,1)||r(i.years,Math.round(l)),s=i.wordSeparator||"",i.wordSeparator===undefined&&(s=" "),n.trim([h,a,c].join(s))},parse:function(t){var i=n.trim(t);return i=i.replace(/\.\d+/,""),i=i.replace(/-/,"/").replace(/-/,"/"),i=i.replace(/T/," ").replace(/Z/," UTC"),i=i.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"),new Date(i)},datetime:function(i){var r=t.isTime(i)?n(i).attr("datetime"):n(i).attr("title");return t.parse(r)},isTime:function(t){return n(t).get(0).tagName.toLowerCase()==="time"}});r={init:function(){var r=n.proxy(u,this),i;r();i=t.settings;i.refreshMillis>0&&setInterval(r,i.refreshMillis)},update:function(i){n(this).data("timeago",{datetime:t.parse(i)});u.apply(this)},updateFromDOM:function(){n(this).data("timeago",{datetime:t.parse(t.isTime(this)?n(this).attr("datetime"):n(this).attr("title"))});u.apply(this)}};n.fn.timeago=function(n,t){var i=n?r[n]:r.init;if(!i)throw new Error("Unknown function name '"+n+"' for timeago");return this.each(function(){i.call(this,t)}),this};document.createElement("abbr");document.createElement("time")}),function(){function t(n){this.t=n}function f(n){return new Option(n).innerHTML.replace(/"/g,"&quot;")}function i(n,t){for(var i=t.split(".");i.length;){if(!(i[0]in n))return!1;n=n[i.shift()]}return n}function n(t,e){return t.replace(r,function(t,r,u,f,o,s,h,c){var l=i(e,f),v="",a;if(!l)return u=="!"?n(o,e):h?n(c,e):"";if(!u)return n(s,e);if(u=="@"){for(a in l)l.hasOwnProperty(a)&&(e._key=a,e._val=l[a],v+=n(o,e));return delete e._key,delete e._val,v}}).replace(u,function(n,t,r){var u=i(e,r);return u||u===0?t=="%"?f(u):u:""})}var r=/\{\{(([@!]?)(.+?))\}\}(([\s\S]+?)(\{\{:\1\}\}([\s\S]+?))?)\{\{\/\1\}\}/g,u=/\{\{([=%])(.+?)\}\}/g;t.prototype.render=function(t){return n(this.t,t)};window.t=t}(),function(){var n,i,r,t,u,f={}.hasOwnProperty,e=function(n,t){function r(){this.constructor=n}for(var i in t)f.call(t,i)&&(n[i]=t[i]);return r.prototype=t.prototype,n.prototype=new r,n.__super__=t.prototype,n};t=function(){function n(){this.options_index=0;this.parsed=[]}return n.prototype.add_node=function(n){return n.nodeName.toUpperCase()==="OPTGROUP"?this.add_group(n):this.add_option(n)},n.prototype.add_group=function(n){var i,f,t,e,r,u;for(i=this.parsed.length,this.parsed.push({array_index:i,group:!0,label:this.escapeExpression(n.label),children:0,disabled:n.disabled}),r=n.childNodes,u=[],t=0,e=r.length;t<e;t++)f=r[t],u.push(this.add_option(f,i,n.disabled));return u},n.prototype.add_option=function(n,t,i){if(n.nodeName.toUpperCase()==="OPTION")return n.text!==""?(t!=null&&(this.parsed[t].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:n.value,text:n.text,html:n.innerHTML,selected:n.selected,disabled:i===!0?i:n.disabled,group_array_index:t,classes:n.className,style:n.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},n.prototype.escapeExpression=function(n){var t,i;return n==null||n===!1?"":/[\&\<\>\"\'\`]/.test(n)?(t={"<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},i=/&(?!\w+;)|[\<\>\"\'\`]/g,n.replace(i,function(n){return t[n]||"&amp;"})):n},n}();t.select_to_array=function(n){var f,r,i,e,u;for(r=new t,u=n.childNodes,i=0,e=u.length;i<e;i++)f=u[i],r.add_node(f);return r.parsed};i=function(){function n(t,i){(this.form_field=t,this.options=i!=null?i:{},n.browser_is_supported())&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers())}return n.prototype.set_default_values=function(){var n=this;return this.click_test_action=function(t){return n.test_active_click(t)},this.activate_action=function(t){return n.activate_field(t)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.result_single_selected=null,this.allow_single_deselect=this.options.allow_single_deselect!=null&&this.form_field.options[0]!=null&&this.form_field.options[0].text===""?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=this.options.enable_split_word_search!=null?this.options.enable_split_word_search:!0,this.group_search=this.options.group_search!=null?this.options.group_search:!0,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=this.options.single_backstroke_delete!=null?this.options.single_backstroke_delete:!0,this.max_selected_options=this.options.max_selected_options||Infinity,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=this.options.display_selected_options!=null?this.options.display_selected_options:!0,this.display_disabled_options=this.options.display_disabled_options!=null?this.options.display_disabled_options:!0},n.prototype.set_default_text=function(){return this.default_text=this.form_field.getAttribute("data-placeholder")?this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.options.placeholder_text_multiple||this.options.placeholder_text||n.default_multiple_text:this.options.placeholder_text_single||this.options.placeholder_text||n.default_single_text,this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||n.default_no_result_text},n.prototype.mouse_enter=function(){return this.mouse_on_container=!0},n.prototype.mouse_leave=function(){return this.mouse_on_container=!1},n.prototype.input_focus=function(){var n=this;if(this.is_multiple){if(!this.active_field)return setTimeout(function(){return n.container_mousedown()},50)}else if(!this.active_field)return this.activate_field()},n.prototype.input_blur=function(){var n=this;if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(){return n.blur_test()},100)},n.prototype.results_option_build=function(n){var r,t,i,f,u;for(r="",u=this.results_data,i=0,f=u.length;i<f;i++)t=u[i],r+=t.group?this.result_add_group(t):this.result_add_option(t),(n!=null?n.first:void 0)&&(t.selected&&this.is_multiple?this.choice_build(t):t.selected&&!this.is_multiple&&this.single_set_selected_text(t.text));return r},n.prototype.result_add_option=function(n){var t,i;return n.search_match?this.include_option_in_results(n)?(t=[],n.disabled||n.selected&&this.is_multiple||t.push("active-result"),!n.disabled||n.selected&&this.is_multiple||t.push("disabled-result"),n.selected&&t.push("result-selected"),n.group_array_index!=null&&t.push("group-option"),n.classes!==""&&t.push(n.classes),i=n.style.cssText!==""?' style="'+n.style+'"':"",'<li class="'+t.join(" ")+'"'+i+' data-option-array-index="'+n.array_index+'">'+n.search_text+"<\/li>"):"":""},n.prototype.result_add_group=function(n){return(n.search_match||n.group_match)?(n.active_options>0)?'<li class="group-result">'+n.search_text+"<\/li>":"":""},n.prototype.brewgr_custom_reset=function(n){this.set_default_text();this.result_clear_highlight();this.result_single_selected=null;this.single_set_selected_text(n)},n.prototype.results_update_field=function(){return this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.result_single_selected=null,this.results_build(),this.results_showing?this.winnow_results():void 0},n.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},n.prototype.results_search=function(){return this.results_showing?this.winnow_results():this.results_show()},n.prototype.winnow_results=function(){var e,n,h,c,u,t,i,r,o,l,f,a,s;for(this.no_results_clear(),u=0,i=this.get_search_text(),e=i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),c=this.search_contains?"":"^",h=new RegExp(c+e,"i"),l=new RegExp(e,"i"),s=this.results_data,f=0,a=s.length;f<a;f++)n=s[f],n.search_match=!1,t=null,this.include_option_in_results(n)&&(n.group&&(n.group_match=!1,n.active_options=0),n.group_array_index!=null&&this.results_data[n.group_array_index]&&(t=this.results_data[n.group_array_index],t.active_options===0&&t.search_match&&(u+=1),t.active_options+=1),n.group&&!this.group_search||(n.search_text=n.group?n.label:n.html,n.search_match=this.search_string_match(n.search_text,h),n.search_match&&!n.group&&(u+=1),n.search_match?(i.length&&(r=n.search_text.search(l),o=n.search_text.substr(0,r+i.length)+"<\/em>"+n.search_text.substr(r+i.length),n.search_text=o.substr(0,r)+"<em>"+o.substr(r)),t!=null&&(t.group_match=!0)):n.group_array_index!=null&&this.results_data[n.group_array_index].search_match&&(n.search_match=!0)));return this.result_clear_highlight(),u<1&&i.length?(this.update_results_content(""),this.no_results(i)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},n.prototype.search_string_match=function(n,t){var u,i,r,f;if(t.test(n))return!0;if(this.enable_split_word_search&&(n.indexOf(" ")>=0||n.indexOf("[")===0)&&(i=n.replace(/\[|\]/g,"").split(" "),i.length))for(r=0,f=i.length;r<f;r++)if(u=i[r],t.test(u))return!0},n.prototype.choices_count=function(){var i,n,r,t;if(this.selected_option_count!=null)return this.selected_option_count;for(this.selected_option_count=0,t=this.form_field.options,n=0,r=t.length;n<r;n++)i=t[n],i.selected&&(this.selected_option_count+=1);return this.selected_option_count},n.prototype.choices_click=function(n){return n.preventDefault(),(this.results_showing||this.is_disabled)?void 0:this.results_show()},n.prototype.keyup_checker=function(n){var t,i;t=(i=n.which)!=null?i:n.keyCode;this.search_field_scale();switch(t){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:if(n.preventDefault(),this.results_showing)return this.result_select(n);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},n.prototype.container_width=function(){return this.options.width!=null?this.options.width:""+this.form_field.offsetWidth+"px"},n.prototype.include_option_in_results=function(n){return this.is_multiple&&!this.display_selected_options&&n.selected?!1:!this.display_disabled_options&&n.disabled?!1:n.empty?!1:!0},n.browser_is_supported=function(){return window.navigator.appName==="Microsoft Internet Explorer"?document.documentMode>=8:/iP(od|hone)/i.test(window.navigator.userAgent)?!1:/Android/i.test(window.navigator.userAgent)&&/Mobile/i.test(window.navigator.userAgent)?!1:!0},n.default_multiple_text="Select Some Options",n.default_single_text="Select an Option",n.default_no_result_text="No results match",n}();n=jQuery;n.fn.extend({chosen:function(t){return i.browser_is_supported()?this.each(function(){var u,i;u=n(this);i=u.data("chosen");t==="destroy"&&i?i.destroy():i||u.data("chosen",new r(this,t))}):this}});r=function(i){function r(){return u=r.__super__.constructor.apply(this,arguments)}return e(r,i),r.prototype.setup=function(){return this.form_field_jq=n(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex,this.is_rtl=this.form_field_jq.hasClass("chosen-rtl")},r.prototype.set_up_html=function(){var t,i;return t=["chosen-container"],t.push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&t.push(this.form_field.className),this.is_rtl&&t.push("chosen-rtl"),i={"class":t.join(" "),style:"width: "+this.container_width()+";",title:this.form_field.title},this.form_field.id.length&&(i.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=n("<div />",i),this.is_multiple?this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /><\/li><\/ul><div class="chosen-drop"><ul class="chosen-results"><\/ul><\/div>'):this.container.html('<a class="chosen-single chosen-default" tabindex="-1"><span>'+this.default_text+'<\/span><div><b><\/b><\/div><\/a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /><\/div><ul class="chosen-results"><\/ul><\/div>'),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior(),this.form_field_jq.trigger("chosen:ready",{chosen:this})},r.prototype.register_observers=function(){var n=this;return this.container.bind("mousedown.chosen",function(t){n.container_mousedown(t)}),this.container.bind("mouseup.chosen",function(t){n.container_mouseup(t)}),this.container.bind("mouseenter.chosen",function(t){n.mouse_enter(t)}),this.container.bind("mouseleave.chosen",function(t){n.mouse_leave(t)}),this.search_results.bind("mouseup.chosen",function(t){n.search_results_mouseup(t)}),this.search_results.bind("mouseover.chosen",function(t){n.search_results_mouseover(t)}),this.search_results.bind("mouseout.chosen",function(t){n.search_results_mouseout(t)}),this.search_results.bind("mousewheel.chosen DOMMouseScroll.chosen",function(t){n.search_results_mousewheel(t)}),this.form_field_jq.bind("chosen:brewgr_custom_reset.chosen",function(t,i){n.brewgr_custom_reset(i)}),this.form_field_jq.bind("chosen:updated.chosen",function(t){n.results_update_field(t)}),this.form_field_jq.bind("chosen:activate.chosen",function(t){n.activate_field(t)}),this.form_field_jq.bind("chosen:open.chosen",function(t){n.container_mousedown(t)}),this.search_field.bind("blur.chosen",function(t){n.input_blur(t)}),this.search_field.bind("keyup.chosen",function(t){n.keyup_checker(t)}),this.search_field.bind("keydown.chosen",function(t){n.keydown_checker(t)}),this.search_field.bind("focus.chosen",function(t){n.input_focus(t)}),this.is_multiple?this.search_choices.bind("click.chosen",function(t){n.choices_click(t)}):this.container.bind("click.chosen",function(n){n.preventDefault()})},r.prototype.destroy=function(){return n(document).unbind("click.chosen",this.click_test_action),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},r.prototype.search_field_disabled=function(){return(this.is_disabled=this.form_field_jq[0].disabled,this.is_disabled)?(this.container.addClass("chosen-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus.chosen",this.activate_action),this.close_field()):(this.container.removeClass("chosen-disabled"),this.search_field[0].disabled=!1,!this.is_multiple)?this.selected_item.bind("focus.chosen",this.activate_action):void 0},r.prototype.container_mousedown=function(t){if(!this.is_disabled&&(t&&t.type==="mousedown"&&!this.results_showing&&t.preventDefault(),!(t!=null&&n(t.target).hasClass("search-choice-close"))))return this.active_field?!this.is_multiple&&t&&(n(t.target)[0]===this.selected_item[0]||n(t.target).parents("a.chosen-single").length)&&(t.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),n(document).bind("click.chosen",this.click_test_action),this.results_show()),this.activate_field()},r.prototype.container_mouseup=function(n){if(n.target.nodeName==="ABBR"&&!this.is_disabled)return this.results_reset(n)},r.prototype.search_results_mousewheel=function(n){var t,i,r;return t=-((i=n.originalEvent)!=null?i.wheelDelta:void 0)||((r=n.originialEvent)!=null?r.detail:void 0),t!=null?(n.preventDefault(),n.type==="DOMMouseScroll"&&(t=t*40),this.search_results.scrollTop(t+this.search_results.scrollTop())):void 0},r.prototype.blur_test=function(){if(!this.active_field&&this.container.hasClass("chosen-container-active"))return this.close_field()},r.prototype.close_field=function(){return n(document).unbind("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},r.prototype.activate_field=function(){return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},r.prototype.test_active_click=function(t){return this.container.is(n(t.target).closest(".chosen-container"))?this.active_field=!0:this.close_field()},r.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=t.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},r.prototype.result_do_highlight=function(n){var t,i,r,f,u;if(n.length){if(this.result_clear_highlight(),this.result_highlight=n,this.result_highlight.addClass("highlighted"),r=parseInt(this.search_results.css("maxHeight"),10),u=this.search_results.scrollTop(),f=r+u,i=this.result_highlight.position().top+this.search_results.scrollTop(),t=i+this.result_highlight.outerHeight(),t>=f)return this.search_results.scrollTop(t-r>0?t-r:0);if(i<u)return this.search_results.scrollTop(i)}},r.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},r.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.container.addClass("chosen-with-drop"),this.form_field_jq.trigger("chosen:showing_dropdown",{chosen:this}),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results())},r.prototype.update_results_content=function(n){return this.search_results.html(n)},r.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.container.removeClass("chosen-with-drop"),this.form_field_jq.trigger("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},r.prototype.set_tab_index=function(){var n;if(this.form_field.tabIndex)return n=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field[0].tabIndex=n},r.prototype.set_label_behavior=function(){var t=this;return this.form_field_label=this.form_field_jq.parents("label"),!this.form_field_label.length&&this.form_field.id.length&&(this.form_field_label=n("label[for='"+this.form_field.id+"']")),this.form_field_label.length>0?this.form_field_label.bind("click.chosen",function(n){return t.is_multiple?t.container_mousedown(n):t.activate_field()}):void 0},r.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},r.prototype.search_results_mouseup=function(t){var i;return i=n(t.target).hasClass("active-result")?n(t.target):n(t.target).parents(".active-result").first(),i.length?(this.result_highlight=i,this.result_select(t),this.search_field.focus()):void 0},r.prototype.search_results_mouseover=function(t){var i;return i=n(t.target).hasClass("active-result")?n(t.target):n(t.target).parents(".active-result").first(),i?this.result_do_highlight(i):void 0},r.prototype.search_results_mouseout=function(t){if(n(t.target).hasClass("active-result"||n(t.target).parents(".active-result").first()))return this.result_clear_highlight()},r.prototype.choice_build=function(t){var i,r,u=this;return i=n("<li />",{"class":"search-choice"}).html("<span>"+t.html+"<\/span>"),t.disabled?i.addClass("search-choice-disabled"):(r=n("<a />",{"class":"search-choice-close","data-option-array-index":t.array_index}),r.bind("click.chosen",function(n){return u.choice_destroy_link_click(n)}),i.append(r)),this.search_container.before(i)},r.prototype.choice_destroy_link_click=function(t){return t.preventDefault(),t.stopPropagation(),this.is_disabled?void 0:this.choice_destroy(n(t.target))},r.prototype.choice_destroy=function(n){if(this.result_deselect(n[0].getAttribute("data-option-array-index")))return this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.search_field.val().length<1&&this.results_hide(),n.parents("li").first().remove(),this.search_field_scale()},r.prototype.results_reset=function(){return this.form_field.options[0].selected=!0,this.selected_option_count=null,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.form_field_jq.trigger("change"),this.active_field?this.results_hide():void 0},r.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},r.prototype.result_select=function(n){var i,t,r;if(this.result_highlight)return(i=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count())?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?i.removeClass("active-result"):(this.result_single_selected&&(this.result_single_selected.removeClass("result-selected"),r=this.result_single_selected[0].getAttribute("data-option-array-index"),this.results_data[r].selected=!1),this.result_single_selected=i),i.addClass("result-selected"),t=this.results_data[i[0].getAttribute("data-option-array-index")],t.selected=!0,this.form_field.options[t.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(t):this.single_set_selected_text(t.text),(n.metaKey||n.ctrlKey)&&this.is_multiple||this.results_hide(),this.search_field.val(""),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.form_field_jq.trigger("change",{selected:this.form_field.options[t.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,this.search_field_scale())},r.prototype.single_set_selected_text=function(n){return n==null&&(n=this.default_text),n===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").text(n)},r.prototype.result_deselect=function(n){var t;return t=this.results_data[n],this.form_field.options[t.options_index].disabled?!1:(t.selected=!1,this.form_field.options[t.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.form_field_jq.trigger("change",{deselected:this.form_field.options[t.options_index].value}),this.search_field_scale(),!0)},r.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect)return this.selected_item.find("abbr").length||this.selected_item.find("span").first().after('<abbr class="search-choice-close"><\/abbr>'),this.selected_item.addClass("chosen-single-with-deselect")},r.prototype.get_search_text=function(){return this.search_field.val()===this.default_text?"":n("<div/>").text(n.trim(this.search_field.val())).html()},r.prototype.winnow_results_set_highlight=function(){var n,t;return t=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),n=t.length?t.first():this.search_results.find(".active-result").first(),n!=null?this.result_do_highlight(n):void 0},r.prototype.no_results=function(t){var i;return i=n('<li class="no-results">'+this.results_none_found+' "<span><\/span>"<\/li>'),i.find("span").first().html(t),this.search_results.append(i)},r.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},r.prototype.keydown_arrow=function(){var n;if(this.results_showing&&this.result_highlight){if(n=this.result_highlight.nextAll("li.active-result").first(),n)return this.result_do_highlight(n)}else return this.results_show()},r.prototype.keyup_arrow=function(){var n;if(this.results_showing||this.is_multiple){if(this.result_highlight)return n=this.result_highlight.prevAll("li.active-result"),n.length?this.result_do_highlight(n.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight())}else return this.results_show()},r.prototype.keydown_backstroke=function(){var n;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(n=this.search_container.siblings("li.search-choice").last(),n.length&&!n.hasClass("search-choice-disabled"))?(this.pending_backstroke=n,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0},r.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},r.prototype.keydown_checker=function(n){var t,i;t=(i=n.which)!=null?i:n.keyCode;this.search_field_scale();t!==8&&this.pending_backstroke&&this.clear_backstroke();switch(t){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(n);this.mouse_on_container=!1;break;case 13:n.preventDefault();break;case 38:n.preventDefault();this.keyup_arrow();break;case 40:n.preventDefault();this.keydown_arrow()}},r.prototype.search_field_scale=function(){var t,u,h,f,e,o,i,r,s;if(this.is_multiple){for(h=0,i=0,e="position:absolute; left: -1000px; top: -1000px; display:none;",o=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"],r=0,s=o.length;r<s;r++)f=o[r],e+=f+":"+this.search_field.css(f)+";";return t=n("<div />",{style:e}),t.text(this.search_field.val()),n("body").append(t),i=t.width()+25,t.remove(),u=this.container.outerWidth(),i>u-10&&(i=u-10),this.search_field.css({width:i+"px"})}},r}(i)}.call(this),function(n){typeof define=="function"&&define.amd?define(["jquery"],n):n(window.jQuery||window.$)}(function(n){var u={className:"autosizejs",append:"",callback:!1,resizeDelay:10},r=["fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","textTransform","wordSpacing","textIndent"],i,t=n('<textarea tabindex="-1" style="position:absolute; top:-999px; left:0; right:auto; bottom:auto; border:0; padding: 0; -moz-box-sizing:content-box; -webkit-box-sizing:content-box; box-sizing:content-box; word-wrap:break-word; height:0 !important; min-height:0 !important; overflow:hidden; transition:none; -webkit-transition:none; -moz-transition:none;"/>').data("autosize",!0)[0];t.style.lineHeight="99px";n(t).css("lineHeight")==="99px"&&r.push("lineHeight");t.style.lineHeight="";n.fn.autosize=function(f){return this.length?(f=n.extend({},u,f||{}),t.parentNode!==document.body&&n(document.body).append(t),this.each(function(){function v(){var r,i;"getComputedStyle"in window?(r=window.getComputedStyle(u),i=u.getBoundingClientRect().width,n.each(["paddingLeft","paddingRight","borderLeftWidth","borderRightWidth"],function(n,t){i-=parseInt(r[t],10)}),t.style.width=i+"px"):t.style.width=Math.max(e.width(),0)+"px"}function b(){var o={},h,c;i=u;t.className=f.className;s=parseInt(e.css("maxHeight"),10);n.each(r,function(n,t){o[t]=e.css(t)});n(t).css(o);v();window.chrome&&(h=u.style.width,u.style.width="0px",c=u.offsetWidth,u.style.width=h)}function o(){var n,r;i!==u?b():v();t.value=u.value+f.append;t.style.overflowY=u.style.overflowY;r=parseInt(u.style.height,10);t.scrollTop=0;t.scrollTop=9e4;n=t.scrollTop;s&&n>s?(u.style.overflowY="scroll",n=s):(u.style.overflowY="hidden",n<h&&(n=h));n+=c;r!==n&&(u.style.height=n+"px",p&&f.callback.call(u,u))}function y(){clearTimeout(l);l=setTimeout(function(){var n=e.width();n!==a&&(a=n,o())},parseInt(f.resizeDelay,10))}var u=this,e=n(u),s,h,c=0,p=n.isFunction(f.callback),w={height:u.style.height,overflow:u.style.overflow,overflowY:u.style.overflowY,wordWrap:u.style.wordWrap,resize:u.style.resize},l,a=e.width();if(e.data("autosize")){o();return}if(e.data("autosize",!0),(e.css("box-sizing")==="border-box"||e.css("-moz-box-sizing")==="border-box"||e.css("-webkit-box-sizing")==="border-box")&&(c=e.outerHeight()-e.height()),h=Math.max(parseInt(e.css("minHeight"),10)-c||0,e.height()),e.css({overflow:"hidden",overflowY:"hidden",wordWrap:"break-word",resize:e.css("resize")==="none"||e.css("resize")==="vertical"?"none":"horizontal"}),"onpropertychange"in u)if("oninput"in u)e.on("input.autosize keyup.autosize",o);else e.on("propertychange.autosize",function(){event.propertyName==="value"&&o()});else e.on("input.autosize",o);if(f.resizeDelay!==!1)n(window).on("resize.autosize",y);e.on("autosize.resize",o);e.on("autosize.resizeIncludeStyle",function(){i=null;o()});e.on("autosize.destroy",function(){i=null;clearTimeout(l);n(window).off("resize",y);e.off("autosize").off(".autosize").css(w).removeData("autosize")});o()})):this}});$(function(){general_onReady();layout_onReady();common_onReady();feedback_onReady();search_onReady();home_onReady();builder_onReady();settings_onReady();loginRelated_onReady();waterinfusion_onReady();recipeDetail_onReady();misc_onReady();comment_onReady();dashboard_onReady();calculations_onReady()});WaterCalc={initialize:function(n,t,i){return $('[data-unit="'+$("[data-name=s_UnitType]").val()+'"]').addClass("active"),this.inputElement=n,this.outputElement=t,this.unitElement=i,this.wireCalcTriggers(),this.calculate(),this},useUnit:function(n){if($("[data-name=s_UnitType]")!==n){var t=n==="m"?"s":"m";$("[data-unit].active").removeClass("active");$('[data-unit="'+n+'"]').addClass("active");util.convert("[data-name=s_GrainWeight]",t,util.kg_To_lb,util.lb_To_kg);util.convert("[data-name=s_GrainTemp]",t,util.c_To_f,util.f_To_c);util.convert("[data-name=s_FermentVolume]",t,util.l_To_gal,util.gal_To_l);util.convert("[data-name=s_TargetMashTemp]",t,util.c_To_f,util.f_To_c);util.convert("[data-name=s_MashThickness]",t,util.l_To_qt,util.qt_To_l);util.convert("[data-name=s_BrewKettleLoss]",t,util.l_To_gal,util.gal_To_l);util.convert("[data-name=s_WortShrinkage]",t,util.l_To_gal,util.gal_To_l);util.convert("[data-name=s_MashTunLoss]",t,util.l_To_gal,util.gal_To_l);util.convert("[data-name=s_BoilLoss]",t,util.l_To_gal,util.gal_To_l);util.convert("[data-name=s_MashGrainAbsorption]",t,util.l_To_gal,util.gal_To_l);util.convert("[data-name=s_SpargeGrainAbsorption]",t,util.l_To_gal,util.gal_To_l);$("[data-name=s_GrainWeight]").keyup()}},calculate:function(){var n={grain:this.getValue(".wc_grain",util.kg_To_lb),fermentVol:this.getValue(".wc_fermentVol",util.l_To_gal),kettleLoss:this.getValue(".wc_kettleLoss",util.l_To_gal),wortShrinkage:this.getValue(".wc_wortShrinkage",util.l_To_gal),boilTime:this.getValue(".wc_boilTime"),boilLoss:this.getValue(".wc_boilLoss",util.l_To_gal),mashThickness:this.getValue(".wc_mashThickness",util.l_To_qt),mashTunLoss:this.getValue(".wc_mashTunLoss",util.l_To_gal),mashAbsorp:this.getValue(".wc_grainAbsorption",util.l_To_gal),spargeAbsorp:this.getValue(".wc_spargeGrainAbsorption",util.l_To_gal),mashTemp:this.getValue(".wc_targetMashTemp",util.c_To_f),grainTemp:this.getValue(".wc_grainTemp",util.c_To_f)},u=n.fermentVol+n.kettleLoss+n.wortShrinkage+n.boilTime*n.boilLoss/60,t,f,i,r;this.setValue(".wc_runoff",util.gal_To_l,u);t=n.mashThickness*n.grain/4+n.mashTunLoss;this.setValue(".wc_strikeVol",util.gal_To_l,t);f=n.grain*(.08+n.mashThickness/4);this.setValue(".wc_mashtuncapacity",util.gal_To_l,f);i=t-n.grain*n.mashAbsorp;this.setValue(".wc_firstRunnings",util.gal_To_l,i);r=u-i+n.spargeAbsorp*n.grain;this.setValue(".wc_spargeVol",util.gal_To_l,r);this.setValue(".wc_strikeTemp",util.f_To_c,((n.grain*.05+t)*n.mashTemp-n.grain*.05*n.grainTemp)/t);this.setValue(".wc_totalWater",util.gal_To_l,t+r)},wireCalcTriggers:function(){var n=this;this.inputElement.find(".wc_trig").keyup(function(){n.calculate()})},getValue:function(n,t){var i=tryNumber($(this.inputElement).find(n).val());return this.unitElement.val()=="m"?t!=null?t(i):i:i},setValue:function(n,t,i){var r=this.unitElement.val()=="m"?t(i):i;this.outputElement.find(n).val(r.toFixed(2))}};typeof String.prototype.trim!="function"&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")});var util={templateCache:[],userIsLoggedIn:function(){var n=!1;return $.ajax({url:"/UserIsLoggedIn",cache:!1,async:!1,success:function(t){n=t=="1"},error:function(){n=!1}}),n},isNumeric:function(n){return!isNaN(Number(n))&&isFinite(n)},safeRound:function(n,t){return typeof t=="undefined"&&(t=1e4),Math.round(n*t)/t},roundToTwo:function(n){return+(Math.round(n+"e+2")+"e-2")},applyTemplate:function(n,i){var r,u=$.grep(util.templateCache,function(t){return t.id==n});return u.length===0?(r=new t($("[data-template="+n+"]").html().replace("<!--[","").replace("]-->","")),util.templateCache.push({id:n,template:r})):r=u[0].template,$(r.render(i))},filterInput:function(n,t){t=="positiveInt"?t="[0-9]":t==="positiveFloat"?t="[0-9\\.]":t==="text"?t="[a-zA-Z ]":t==="ext-text"&&(t="[a-zA-Z0-9 \\.-]");$(n).filter_input({regex:t})},tanh:function(n){return(Math.exp(n)-Math.exp(-n))/(Math.exp(n)+Math.exp(-n))},srm_To_hex:function(n){var t=["#FFE699","#FFD878","#FFCA5A","#FFBF42","#FBB123","#F8A600","#F39C00","#EA8F00","#E58500","#DE7C00","#D77200","#CF6900","#CB6200","#C35900","#BB5100","#B54C00","#B04500","#A63E00","#A13700","#9B3200","#952D00","#8E2900","#882300","#821E00","#7B1A00","#771900","#701400","#6A0E00","#660D00","#5E0B00","#5A0A02","#600903","#520907","#4C0505","#470606","#440607","#3F0708","#3B0607","#3A070B","#36080A","#000000"];return n=parseFloat(n).toFixed(0),n>41?t[t.length-1]:t[n-1]},convert:function(n,t,i,r,u){var f;if($(n).length)if($(n).is("span")){if($(n).text().length==0)return;f=(t=="s"?r($(n).text()):i($(n).text())).toFixed(u||2);$(n).text(f)}else{if($(n).val().length==0)return;f=(t=="s"?r($(n).val()):i($(n).val())).toFixed(u||2);$(n).val(f)}},f_To_c:function(n){return util.safeRound((n-32)*5/9,10)},c_To_f:function(n){return util.safeRound(n*9/5+32,10)},lb_To_oz:function(n){return n*16},oz_To_lb:function(n){return n/16},oz_To_g:function(n){return n*28.3495},oz_To_kg:function(n){return n*.0283495},g_To_oz:function(n){return n/28.3495},kg_To_oz:function(n){return n/.0283495},kg_To_lb:function(n){return n*2.2046},lb_To_kg:function(n){return n/2.2046},ml_To_tsp:function(n){return n*.202884},l_To_gal:function(n){return n*.264172},l_To_qt:function(n){return n*1.0567},gal_To_l:function(n){return n/.264172},pt_To_l:function(n){return n*.473176},qt_To_l:function(n){return n*.946353},l_To_floz:function(n){return n*33.814},floz_To_ml:function(n){return n*29.5735},tbsp_To_ml:function(n){return n*14.7868},tsp_To_ml:function(n){return n*4.92892},qt_per_lb_To_l_per_kg:function(n){return n*2.08635},l_per_kg_To_qt_per_lb:function(n){return n*.47931},gal_per_lb_To_l_per_kg:function(n){return n*2.08635*4},l_per_kg_To_gal_per_lb:function(n){return n*.47931/4}},Layout={statusModal:function(n,t){var i='<div class="working-dialog"><img src="/img/colorbox/loading.gif" width="32" height="32" />'+n+"<\/div>";$.colorbox({html:i,speed:100,opacity:.35,height:75,overlayClose:!1,closeButton:!1,escKey:!1,scrolling:!1,onComplete:t});$("#cboxLoadedContent").height(38)}},Message={clear:function(){$("div.messages").hide();$("div.messages li").remove()},setParent:function(n){$(n).prepend($("div.messages"))},useSmall:function(){$("div.messages").addClass("small")},add:function(n,t){var i=t;$("div.messages ul").append('<li class="'+t+'">'+n+"<\/li>");$(".messages").is(":visible")||($(".messages").show(),$(".messages").removeClass("hidden"))},info:function(n){Message.add(n,"info")},success:function(n){Message.add(n,"success")},warn:function(n){Message.add(n,"warn")},error:function(n){Message.add(n,"error")}};Builder={doCalc:!0,initialize:function(){Builder.prepTemplates();Builder.wireControlsAndEvents();$("textarea[data-name=r_Description]").autosize();Builder.calcAndUpdate()},getRecipeId:function(){return Number($("[data-name=r_RecipeId]").val())},isNewRecipe:function(){return Builder.getRecipeId()===0},getRecipe:function(){var n=new Recipe;return $(".recipedata [data-name]").each(function(){var t=$(this).attr("data-name").replace("r_","");n[t]=$(this).val()}),$(".dataTable").each(function(){var t=$(this).attr("data-name").split("_")[0],i=t==="f"?n.Fermentables:t==="h"?n.Hops:t==="y"?n.Yeasts:t==="o"?n.Others:t==="m"?n.MashSteps:n.Steps;$(this).find("[data-datarow]").each(function(){var n={};$(this).find("[data-track]").each(function(){var i=$(this).attr("data-name").replace(t+"_","");n[i]=$(this).val()});i.push(n)})}),n.calculate(),n},pauseCalc:function(){Builder.doCalc=!1},resumeCalc:function(n){Builder.doCalc=!0;n&&Builder.calcAndUpdate()},wireControlsAndEvents:function(){$("[data-trigger],[data-name=r_StyleId]").chosen();$(".builder").on("keyup","[data-validate]",function(){$(this).val().trim().length>0?$(this).removeClass("field-error"):$(this).addClass("field-error")});$("#SaveRecipeButton").click(function(){var t,n,i;return($(".builder").attr("data-formchanged","false"),Message.clear(),!Builder.validate())?(Message.error("Uh oh, something needs your attention.  Please check the highlighted entries below."),window.scrollTo(0,1),!1):($(".builder").attr("data-isanon")||util.userIsLoggedIn()||$(".builder").attr("data-isanon","1"),$(".builder").attr("data-isanon")?(t="/loginviadialog"+(parseInt($("[data-name=r_RecipeId").val())>0?"?editMode=1":""),$.colorbox({href:t,iframe:!0,width:900,height:525,opacity:.35,overlayClose:!0,closeButton:!0,escKey:!1,scrolling:!0})):(n=Builder.getRecipe(),n.RecipeId==0?(Layout.statusModal("Saving Recipe..."),$(".builder").removeAttr("data-formchanged"),$("#RecipeJson").val(escape(n.getJSON())),$("#RecipeForm").submit()):n.RecipeId>0&&(i=function(){$.ajax({url:"/SaveRecipe",data:{RecipeJson:Builder.getRecipe().getJSON()},method:"post",success:function(n){switch(n){case"-1":Message.error("There was a problem saving your recipe.  Please try again");break;case"0":Message.error("Did you leave something blank?  Please check your entries and try again.");break;case"1":Message.success("Your Recipe has been saved");$(".builder").removeAttr("data-formchanged");$(".customname:visible").each(function(n,t){$(t).siblings(".ingName").text($(t).val()).show();$(t).hide()});$(".recipe-affiliate-add").hide();$(".recipe-affiliate-edit").show()}},error:function(){Message.error("There was a problem saving your recipe.  Please try again.")},complete:function(){$.colorbox.close();$(".compliment").css("position","").css("margin-left","").css("top","");window.scrollTo(0,0)}})},Layout.statusModal("Saving Recipe...",i))),!1)});$("#ScalePopupTrigger").click(function(){var n=Builder.getRecipe(),t=n.UnitType==="s"?100:400;return $("#ScaleSlider").slider({animate:!1,value:n.BatchSize,min:1,max:t,step:1,slide:function(n,t){$("#TargetVolume").val(t.value.toFixed(2))}}),$("#TargetVolume").val(Number(Builder.getRecipe().BatchSize).toFixed(2)).removeClass("input-validation-error"),$.colorbox({inline:!0,href:"#ScaleDialog",opacity:.35,width:"90%",maxWidth:"600px",overlayClose:!1,escKey:!0,scrolling:!1}),!1});$("#TargetVolume").keydown(function(n){return n.which==13?($("#ApplyScaleButton").click(),!1):!0});$("[data-name=r_BoilTime]").change(function(){var n=$(this).val();$('[data-name=h_Use] option[value="FirstWort"]:selected').each(function(t,i){$(i).parents("tr").find("[data-name=h_Min]").val(n)})});$("#ApplyScaleButton").click(function(){return isNaN($("#TargetVolume").val())||$("#TargetVolume").val().trim().length==0?($("#TargetVolume").addClass("input-validation-error"),!1):(Builder.scale(Number($("#TargetVolume").val())),$.colorbox.close(),!1)});Builder.isNewRecipe()?($("#PhotoPopupTrigger").click(function(){$.colorbox({inline:!0,href:"#PhotoDialog",opacity:.35,width:"90%",height:"35%",maxWidth:"600px",overlayClose:!1,escKey:!0,scrolling:!1})}),$("#SavePhotoButton").click(function(){$.colorbox.close()})):$("#PhotoPopupTrigger").click(function(){$.colorbox({iframe:!0,href:"/builderchangerecipephoto/"+Builder.getRecipeId(),opacity:.35,width:"90%",height:"35%",maxWidth:"600px",overlayClose:!1,escKey:!0,scrolling:!1})});Builder.wireCalcTriggers();Builder.wireIngAddTriggers();Builder.wireStepControls();Builder.wireSorting();Builder.wireStyleChart();$("[data-name=r_UnitType]").change(function(){Builder.useUnit($(this).val())});$("[data-name=r_IbuFormula]").change(function(){Builder.calcAndUpdate()});$(".dataTable").on("click","input[type=text]",function(){$(this).val().trim()=="0"&&$(this).select()});$("[data-name=f_table]").on("keyup","[data-name=f_Amt]",function(){Builder.updateFVals()});$("[data-name=f_table]").on("click","[data-name=remove]",function(){Builder.updateFVals()});$("[data-name=h_table]").on("change","[data-name=h_Use]",function(){var i=$(this).parents("[data-datarow]"),t=$(this).val(),n=i.find("[data-name=h_Min]"),r=i.find("[data-name=h_Day]");n.show().removeAttr("disabled");r.hide();t=="DryHop"&&(n.hide(),r.show());t=="FirstWort"&&n.val($("[data-name=r_BoilTime]").val()).attr("disabled","disabled");t=="FlameOut"&&n.val("0").attr("disabled","disabled")});$("[data-name=h_table]").on("keyup","[data-name=h_Amt]",function(){Builder.updateHVals()});$("[data-name=h_table]").on("click","[data-name=remove]",function(){Builder.updateHVals()});$("[data-name=s_table]").on("change","[data-name=s_Rank]",function(){$(this).closest("tr").find("[data-name=s_RankLabel]").text($(this).val()+".")});$("[data-name=r_StyleId]").change(function(){$(this).val()?$("[data-name=facts_stylename]").text($(this).find("option:selected").text().split(".")[1]):$("[data-name=facts_stylename]").text("")})},wireCalcTriggers:function(){$(".builder").on("keyup","input[data-track]",function(){Builder.calcAndUpdate()});$(".builder").on("change","select[data-track]",function(){Builder.calcAndUpdate()});$(".builder").on("click","img[data-name=remove]",function(){var t=$(this).parents(".dataTable"),n=t.attr("data-name").split("_")[0],i=$(this).parents("[data-datarow]");i.remove();Builder.reRankTable(n);n!="s"&&Builder.calcAndUpdate()})},wireIngAddTriggers:function(){$("[data-trigger]").change(function(){var r=$(this).attr("data-trigger"),n=$(this).find('option[value="'+$(this).val()+'"]'),u=Number(n.val()),t=n.text(),i;t=="Add Custom Ingredient"&&(t=null);i=null;r==="f"?(Builder.addF(0,u,0,0,t,Number(n.attr("data-ppg")),Number(n.attr("data-L")),n.attr("data-use")),i="Fermentables"):r==="h"?(Builder.addH(0,u,0,0,t,"Pellet","Boil",60,0,Number(n.attr("data-aa")).toFixed(1)),i="Hops"):r==="y"?(Builder.addY(0,u,0,t,Number(n.attr("data-atten"))),i="Yeast"):r==="o"?(Builder.addO(0,u,0,0,"each",t,n.attr("data-use")),i="Ingredients"):r==="m"&&(Builder.addM(0,u,0,t,"Decoction",Builder.getRecipe().UnitType=="s"?"150":"66","60"),i="Mash Steps");$(this).val("").trigger("chosen:brewgr_custom_reset","Add "+i+"...")})},wireStepControls:function(){$("[data-name=s_add]").click(function(){return Builder.addS(0,0,null).find("input").focus(),!1});$("[data-name=s_table] tbody").keydown(function(n){var t=$(this).attr("tabindex"),i=n.keyCode||n.which,r;if(n.shiftKey||i!="9"){if(n.shiftKey&&i=="9"&&t>1)return $("[data-name=s_table] tr input[tabindex="+(t-1)+"]").trigger("focus"),!1}else return r=$("[data-name=s_table] tr input:last"),r[0]==document.activeElement?(Builder.addS(0,0,null).find("input").focus(),!1):!0;return!0})},wireSorting:function(){$(".dataTable").each(function(){var n=$(this).attr("data-name");$("[data-name="+n+"].sort-wrap").sortable({connectWith:".sort-wrap",containment:"[data-name="+n+"]",tolerance:"pointer",placeholder:"placeholder",start:function(n,t){t.placeholder.html('<div class="panel panel-default"><div class="panel-body"><\/div>')},update:function(n,t){var i=$(t.item).parents(".dataTable").attr("data-name").split("_")[0];Builder.reRankTable(i);Builder.refreshTabIndices()}})})},wireStyleChart:function(){$("[data-name=r_StyleId]").change(function(){if($(this).val()=="")$("#recipe-facts .style").text(""),$("#selected-style-chart").empty();else{$("#recipe-facts .style").text($(this[this.selectedIndex]).text().split(". ")[1]);var n=StyleChart.GetStyle($(this[this.selectedIndex]).val());$("#selected-style-chart").empty();StyleChart.create(n,Builder.getRecipe(),$("#selected-style-chart"))}})},reRankTable:function(n){$("[data-name="+n+"_table] .row").each(function(t,i){$(i).find("[data-name="+n+"_Rank]").val(t+1).change();$(i).find("[data-name="+n+"_RankLabel]").text(t+1+".")})},prepTemplates:function(){$.ajax({url:"/buildertemplates-v2-2",async:!1,cache:!0,success:function(n){$(n).appendTo("body")}})},addF:function(n,t,i,r,u,f,e,o){Builder.addData("f",{Id:n,IngId:t,Rank:i,Amt:r,Name:u,CustomName:null,Ppg:f,L:e,Use:o});Builder.updateFVals()},updateFVals:function(){var o=0,n,r,t,f,i,s,e,u;for($("[data-name=f_Amt]").each(function(){o+=isNaN($(this).val())?0:Number($(this).val())}),n=[],r=[],$("[data-name=f_Amt]").each(function(){n.push(isNaN($(this).val())?0:Number($(this).val()))}),t=0,$.each(n,function(){t+=parseFloat(this)||0}),f=100,i=0;i<n.length;i++)s=t==0?0:n[i]/t*f,t-=n[i],e=Math.round(s),f-=e,r.push(e);u=0;$("[data-name=f_Per]").each(function(){$(this).text((isNaN(r[u])?"0":r[u])+"%");u++});$("[data-name=f_Total]").text(util.safeRound(o))},addH:function(n,t,i,r,u,f,e,o,s,h){Builder.addData("h",{Id:n,IngId:t,Rank:i,Amt:r,Name:u,Customname:null,Type:f,Use:e,Min:o,Day:s,AA:h,Ibu:0});Builder.updateHVals()},updateHVals:function(){var n=0;$("[data-name=h_Amt]").each(function(){var t=$(this).val().trim().length>0?Number($(this).val()):0;n+=t});$("[data-name=h_Total]").text(util.safeRound(n))},addY:function(n,t,i,r,u){Builder.addData("y",{Id:n,IngId:t,Rank:i,Name:r,CustomName:null,Atten:u.toFixed(2)})},addO:function(n,t,i,r,u,f,e){var o=Builder.addData("o",{Id:n,IngId:t,Rank:i,Amt:r,Unit:u,Name:f,CustomName:null,Use:e});o.find("[data-name=o_Unit][data-unit="+Builder.getRecipe().UnitType+"]").show().attr("data-track","1");o.find("[data-name=o_Unit][data-unit="+(Builder.getRecipe().UnitType=="s"?"m":"s")+"]").hide().removeAttr("data-track")},addM:function(n,t,i,r,u,f,e){Builder.addData("m",{Id:n,IngId:t,Rank:i,Name:r,Heat:u,Temp:f,Time:e})},addS:function(n,t,i){return Builder.addData("s",{Id:n,Rank:t,Text:i})},addData:function(n,t){var i,r,u;(t.Rank==null||t.Rank===0)&&(t.Rank=$("[data-name="+n+"_table] [data-datarow]").length+1);t.rownum=++Builder.rownum;i=util.applyTemplate(n+"_Row",t);for(r in t)t[r]!=null&&i.find("[data-name="+n+"_"+r+"]").val(t[r].toString());return i.find("[data-filter]").each(function(n,t){util.filterInput($(t),$(t).attr("data-filter"))}),n!=="s"&&(t.IngId===0?(i.find("[data-name="+n+"_Name]").hide(),i.find("[data-name="+n+"_CustomName]").show().removeClass("hidden")):(i.find("[data-name="+n+"_Name]").show().removeClass("hidden"),i.find("[data-name="+n+"_CustomName]").hide())),u=$("[data-name="+n+"_table]"),u.find(".introrow").remove(),u.next(".panel-footer").show(),u.append(i),Builder.refreshTabIndices(),i},useUnit:function(n){var f,t,i,r,u;$("[data-name=r_UnitType]")!==n&&(f=n==="m"?"s":"m",Builder.pauseCalc(),$("[data-unit]").hide(),$('[data-unit="'+n+'"]').show(),t=n==="m"?util.gal_To_l:util.l_To_gal,$("[data-name=r_BatchSize]").val().length>0&&$("[data-name=r_BatchSize]").val(util.safeRound(t(Number($("[data-name=r_BatchSize]").val())))),$("[data-name=r_BoilSize]").val().length>0&&$("[data-name=r_BoilSize]").val(util.safeRound(t(Number($("[data-name=r_BoilSize]").val())))),i=n==="m"?util.lb_To_kg:util.kg_To_lb,$("[data-name=f_Amt]").each(function(){$(this).val().length>0&&$(this).val(util.safeRound(i(Number($(this).val()))))}),r=n=="m"?util.oz_To_g:util.g_To_oz,$("[data-name=h_Amt]").each(function(){$(this).val().length>0&&$(this).val(util.safeRound(r(Number($(this).val()))))}),$("[data-name=o_Unit][data-track]").each(function(n,t){var i=$(this).parents("tr").find("[data-name=o_Amt]"),r=$(t).find("option:selected"),u;$(t).siblings("select").val($(r).attr("data-aunit")).attr("data-track","1");$(t).removeAttr("data-track");$(t).val()!="each"&&(u=window.util[$(this).val()+"_To_"+r.attr("data-aunit")],i.val(util.safeRound(u(Number(i.val())))))}),u=n==="m"?util.f_To_c:util.c_To_f,$("[data-name=m_Temp][data-track]").each(function(){$(this).val().length>0&&$(this).val(Math.round(u(Number($(this).val()))))}),Builder.resumeCalc(),Builder.updateFVals(),Builder.updateHVals())},scale:function(n){var t=Builder.getRecipe(),f=t.Ibu,i=Number($("[data-name=r_BatchSize]").val()),e=Number($("[data-name=r_BoilSize]").val()),r,u;isNaN(n)||n===i||(Builder.pauseCalc(),r=n/i,$("[data-name=r_BatchSize]").val(util.safeRound(n)),$("[data-name=r_BoilSize]").val(util.safeRound(n+(e-i))),$("[data-scale]").each(function(){$(this).val(util.safeRound(Number($(this).val())*r))}),Builder.resumeCalc(!0),t=Builder.getRecipe(),u=f/t.Ibu,$("[data-name=h_Amt]").each(function(){$(this).closest("tr").find("[data-name=h_Use]").val()=="Boil"&&$(this).val((Number($(this).val())*u).toFixed(4))}))},refreshTabIndices:function(){$("input[type=text],select,textarea").each(function(n){$(this).attr("tabindex",n+1)})},validate:function(){var n=!0,t=/^(?=.*\d)\d{0,6}(?:\.\d{1,})?$/;return $("[data-validate]").filter(":visible").each(function(i,r){$(r).val().trim().length==0&&($(r).addClass("field-error"),n=!1);$(r).attr("data-name").indexOf("_Amt")>-1&&(t.test($(r).val())||($(r).addClass("field-error"),n=!1))}),n},calcAndUpdate:function(){var n,i,r,u,t;if(Builder.doCalc&&(n=Builder.getRecipe(),n.calculate(),Builder.updateFVals(),Builder.updateHVals(),$("[data-name=h_table] [data-datarow]").each(function(){for(var r=Number($(this).find("[data-name=h_Rank]").val()),i,t=0;t<n.Hops.length;t++)Number(n.Hops[t].Rank)===r&&(i=Number(n.Hops[t].Ibu),$(this).find("[data-name=h_Ibu]").text(isNaN(i)?0:i.toFixed(1)))}),$("[data-name=facts_og]").text(Number(n.Og).toFixed(3)),$("[data-name=facts_fg]").text(Number(n.Fg).toFixed(3)),$("[data-name=facts_srm]").text(Number(n.Srm).toFixed(1)),$("[data-name=facts_abv]").text(Number(n.Abv).toFixed(1)),$("[data-name=facts_cal]").text(Math.round(n.Calories)),$("[data-name=facts_ibu]").text(n.Ibu.toFixed(1)+" IBU"),$("[data-name=facts_bggu]").text(Number(n.BgGu).toFixed(2)),$("[data-name=facts_batchsize]").text(Number(n.BatchSize).toFixed(2)),$("[data-name=facts_boilsize]").text(Number(n.BoilSize).toFixed(2)),$("[data-name=facts_boiltime]").text(n.BoilTime),$("[data-name=facts_efficiency]").text((Number(n.Efficiency)*100).toFixed(0)+"%"),$("[data-name=facts_ibuformula]").html("&nbsp;("+(n.IbuFormula==="r"?"rager":n.IbuFormula==="t"?"tinseth":"brewgr")+")"),$(".color").css("background-color",util.srm_To_hex(n.Srm)),i=StyleChart.GetStyle($("[data-name=r_StyleId]").val()),$("#selected-style-chart").empty(),StyleChart.create(i,n,$("#selected-style-chart")),$("#style-hidemore").is(":visible"))){for($("#similar-style-chart").empty(),r=StyleChart.SortStylesByClosestMatch(n),u=StyleChart.isWater(n)?1:3,t=0;t<u;t++)StyleChart.create(r[t],n,$("#similar-style-chart"));$("#style-showmore").hide();$("#style-hidemore").show()}}};SessionBuilder={initialize:function(){$('[data-unit="'+$("[data-name=s_UnitType]").val()+'"]').addClass("active");$("[data-name=s_UnitType]").change(function(){SessionBuilder.useUnit($(this).val());WaterCalc.useUnit($(this).val())});$("textarea[data-name=s_Notes]").autosize();$("[data-name=s_ConditionType]").change(function(){$(this).val()=="10"?($(".keg-field").hide(),$(".bottle-field").show()):$(this).val()=="20"?($(".keg-field").show(),$(".bottle-field").hide()):($(".keg-field").hide(),$(".bottle-field").hide())}).change();$(".builder").removeAttr("data-formchanged");$("#SaveBrewSessionButton").click(function(){SessionBuilder.save()})},getSession:function(){return{BrewSessionId:SessionBuilder.getValue("[data-name=s_BrewSessionId]"),RecipeId:SessionBuilder.getValue("[data-name=s_RecipeId]"),UnitTypeId:SessionBuilder.getValue("[data-name=s_UnitType]")=="s"?10:20,BrewDate:SessionBuilder.getValue("[data-name=s_BrewDate]"),Notes:SessionBuilder.getValue("[data-name=s_Notes]"),GrainWeight:SessionBuilder.getValue("[data-name=s_GrainWeight]"),GrainTemp:SessionBuilder.getValue("[data-name=s_GrainTemp]"),BoilTime:SessionBuilder.getValue("[data-name=s_BoilTime]"),BoilVolumeEst:SessionBuilder.getValue("[data-name=s_BoilVolumeEst]"),FermentVolumeEst:SessionBuilder.getValue("[data-name=s_FermentVolume]"),TargetMashTemp:SessionBuilder.getValue("[data-name=s_TargetMashTemp]"),MashThickness:SessionBuilder.getValue("[data-name=s_MashThickness]"),TotalWaterNeeded:SessionBuilder.getValue("[data-name=s_TotalWaterNeeded]"),StrikeWaterTemp:SessionBuilder.getValue("[data-name=s_StrikeWaterTemp]"),StrikeWaterVolume:SessionBuilder.getValue("[data-name=s_StrikeWaterVolume]"),MashTunCapacity:SessionBuilder.getValue("[data-name=s_MashTunCapacity]"),FirstRunningsVolume:SessionBuilder.getValue("[data-name=s_FirstRunningsVolume]"),SpargeWaterVolume:SessionBuilder.getValue("[data-name=s_SpargeWaterVolume]"),BrewKettleLoss:SessionBuilder.getValue("[data-name=s_BrewKettleLoss]"),WortShrinkage:SessionBuilder.getValue("[data-name=s_WortShrinkage]"),MashTunLoss:SessionBuilder.getValue("[data-name=s_MashTunLoss]"),BoilLoss:SessionBuilder.getValue("[data-name=s_BoilLoss]"),MashGrainAbsorption:SessionBuilder.getValue("[data-name=s_MashGrainAbsorption]"),SpargeGrainAbsorption:SessionBuilder.getValue("[data-name=s_SpargeGrainAbsorption]"),MashPH:SessionBuilder.getValue("[data-name=s_MashPH]"),MashStartTemp:SessionBuilder.getValue("[data-name=s_MashStartTemp]"),MashEndTemp:SessionBuilder.getValue("[data-name=s_MashEndTemp]"),MashTime:SessionBuilder.getValue("[data-name=s_MashTime]"),BoilVolumeActual:SessionBuilder.getValue("[data-name=s_BoilVolumeActual]"),PreBoilGravity:SessionBuilder.getValue("[data-name=s_PreBoilGravity]"),BoilTimeActual:SessionBuilder.getValue("[data-name=s_BoilTimeActual]"),PostBoilVolume:SessionBuilder.getValue("[data-name=s_PostBoilVolume]"),FermentVolumeActual:SessionBuilder.getValue("[data-name=s_FermentVolumeActual]"),OriginalGravity:SessionBuilder.getValue("[data-name=s_OriginalGravity]"),FinalGravity:SessionBuilder.getValue("[data-name=s_FinalGravity]"),ConditionDate:SessionBuilder.getValue("[data-name=s_ConditionDate]"),ConditionTypeId:SessionBuilder.getValue("[data-name=s_ConditionType]"),PrimingSugarType:SessionBuilder.getValue("[data-name=s_PrimingSugarType]"),PrimingSugarAmount:SessionBuilder.getValue("[data-name=s_PrimingSugarAmount]"),KegPSI:SessionBuilder.getValue("[data-name=s_KegPSI]")}},getValue:function(n){return $(n).length?$(n).val():null},useUnit:function(n){if($("[data-name=s_UnitType]")!==n){var t=n==="m"?"s":"m";$("[data-unit].active").removeClass("active");$('[data-unit="'+n+'"]').addClass("active");util.convert("[data-name=s_MashStartTemp]",t,util.c_To_f,util.f_To_c);util.convert("[data-name=s_MashEndTemp]",t,util.c_To_f,util.f_To_c);util.convert("[data-name=s_BoilVolumeActual]",t,util.l_To_gal,util.gal_To_l);util.convert("[data-name=s_PostBoilVolume]",t,util.l_To_gal,util.gal_To_l);util.convert("[data-name=s_FermentVolumeActual]",t,util.l_To_gal,util.gal_To_l);util.convert("[data-name=s_PrimingSugarAmount]",t,util.g_To_oz,util.oz_To_g);util.convert("[data-name=p_BoilVolumeEst]",t,util.l_To_gal,util.gal_To_l)}},save:function(){var n,t,i,r;if($(".builder").attr("data-formchanged","false"),Message.clear(),n=SessionBuilder.getSession(),$(".session .field-error").removeClass("field-error"),$("[data-name=s_BrewDate]").val()==null||$("[data-name=s_BrewDate]").val().length==0)return $("[data-name=s_BrewDate]").addClass("field-error"),Message.error("Uh oh, something needs your attention.  Please check the highlighted entries below."),window.scrollTo(0,1),!1;try{if(t=new Date($("[data-name=s_BrewDate]").val()),i=new Date,t>i.addDays(14))return $("[data-name=s_BrewDate]").addClass("field-error"),Message.error("Uh oh, something needs your attention. Brew date cannot be that far in the future."),window.scrollTo(0,1),!1}catch(u){return Message.error("Uh oh, something went wrong."),window.scrollTo(0,1),!1}return n.BrewSessionId==0?(Layout.statusModal("Saving Brew Session..."),$(".builder").removeAttr("data-formchanged"),$("#SessionJson").val(escape(JSON.stringify(n))),$("#SessionForm").submit()):(r=function(){$.ajax({url:"/brew/SaveSession",data:{SessionJson:JSON.stringify(n)},method:"post",success:function(n){switch(n){case"-1":Message.error("There was a problem saving your brew session.  Please try again");break;case"0":Message.error("Did you leave something blank?  Please check your entries and try again.");break;case"1":Message.success("Your Brew Session has been saved");$(".builder").removeAttr("data-formchanged")}},error:function(){Message.error("There was a problem saving your brew session.  Please try again.")},complete:function(){$.colorbox.close();$(".compliment").css("position","").css("margin-left","").css("top","");window.scrollTo(0,0)}})},Layout.statusModal("Saving Brew Session...",r)),!1}};Date.prototype.addDays=function(n){var t=new Date(this.valueOf());return t.setDate(t.getDate()+n),t};$(function(){$("#brew-session-form input, #brew-session-form select, #brew-session-form textarea").not("#taste-date").not("#NewTastingNotes").not(".CommentText").change(function(){$("#brew-session-form").attr("data-formchanged")||$("#brew-session-form").attr("data-formchanged","true")});$(window).bind("beforeunload",function(){if($("#brew-session-form[data-formchanged=true]").length>0)return"You have unsaved changes"});$("body").on("click",".delete-brewsession",function(){return $.colorbox({html:'<div style="padding: 12px 24px 0 24px;"><h3>Are you sure you want to delete this?<\/h3><p>Once you delete a brew session there is no way to get it back.<br /><a class="btn btn-danger btn-md" href="/brew/'+$(this).attr("data-brewsessionid")+'/delete">Yes, Delete<\/a>&nbsp;<a class="btn btn-default btn-md" href="#" onclick="$.colorbox.close()">No, don\'t delete<\/a><p/><\/div>',opacity:.35,overlayClose:!1,escKey:!1,scrolling:!1}),!1});$(".datepicker").datepicker();SessionBuilder.initialize()});SessionBuilder={initialize:function(){$("textarea[data-name=s_Notes]").autosize();$(".SaveBrewSessionButton").click(function(){SessionBuilder.save()})},getSession:function(){return{BrewSessionId:SessionBuilder.getValue("[data-name=s_BrewSessionId]"),RecipeId:SessionBuilder.getValue("[data-name=s_RecipeId]"),UnitTypeId:SessionBuilder.getValue("[data-name=s_UnitType]"),BrewDate:SessionBuilder.getValue("[data-name=s_BrewDate]"),Notes:SessionBuilder.getValue("[data-name=s_Notes]"),GrainWeight:SessionBuilder.getValue("[data-name=s_GrainWeight]"),GrainTemp:SessionBuilder.getValue("[data-name=s_GrainTemp]"),BoilTime:SessionBuilder.getValue("[data-name=s_BoilTime]"),BoilVolumeEst:SessionBuilder.getValue("[data-name=s_BoilVolumeEst]"),FermentVolumeEst:SessionBuilder.getValue("[data-name=s_FermentVolume]"),TargetMashTemp:SessionBuilder.getValue("[data-name=s_TargetMashTemp]"),MashThickness:SessionBuilder.getValue("[data-name=s_MashThickness]"),TotalWaterNeeded:SessionBuilder.getValue("[data-name=s_TotalWaterNeeded]"),StrikeWaterTemp:SessionBuilder.getValue("[data-name=s_StrikeWaterTemp]"),StrikeWaterVolume:SessionBuilder.getValue("[data-name=s_StrikeWaterVolume]"),MashTunCapacity:SessionBuilder.getValue("[data-name=s_MashTunCapacity]"),FirstRunningsVolume:SessionBuilder.getValue("[data-name=s_FirstRunningsVolume]"),SpargeWaterVolume:SessionBuilder.getValue("[data-name=s_SpargeWaterVolume]"),BrewKettleLoss:SessionBuilder.getValue("[data-name=s_BrewKettleLoss]"),WortShrinkage:SessionBuilder.getValue("[data-name=s_WortShrinkage]"),MashTunLoss:SessionBuilder.getValue("[data-name=s_MashTunLoss]"),HLTMTHeatLoss:SessionBuilder.getValue("[data-name=s_HLT_MT_HeatLoss]"),BoilLoss:SessionBuilder.getValue("[data-name=s_BoilLoss]"),MashGrainAbsorption:SessionBuilder.getValue("[data-name=s_MashGrainAbsorption]"),SpargeGrainAbsorption:SessionBuilder.getValue("[data-name=s_SpargeGrainAbsorption]"),MashPH:SessionBuilder.getValue("[data-name=s_MashPH]"),MashStartTemp:SessionBuilder.getValue("[data-name=s_MashStartTemp]"),MashEndTemp:SessionBuilder.getValue("[data-name=s_MashEndTemp]"),MashTime:SessionBuilder.getValue("[data-name=s_MashTime]"),BoilVolumeActual:SessionBuilder.getValue("[data-name=s_BoilVolumeActual]"),PreBoilGravity:SessionBuilder.getValue("[data-name=s_PreBoilGravity]"),BoilTimeActual:SessionBuilder.getValue("[data-name=s_BoilTimeActual]"),PostBoilVolume:SessionBuilder.getValue("[data-name=s_PostBoilVolume]"),FermentVolumeActual:SessionBuilder.getValue("[data-name=s_FermentVolumeActual]"),OriginalGravity:SessionBuilder.getValue("[data-name=s_OriginalGravity]"),FinalGravity:SessionBuilder.getValue("[data-name=s_FinalGravity]"),ConditionDate:SessionBuilder.getValue("[data-name=s_ConditionDate]"),ConditionTypeId:SessionBuilder.getValue("[data-name=s_ConditionType]"),PrimingSugarType:SessionBuilder.getValue("[data-name=s_PrimingSugarType]"),PrimingSugarAmount:SessionBuilder.getValue("[data-name=s_PrimingSugarAmount]"),KegPSI:SessionBuilder.getValue("[data-name=s_KegPSI]")}},getValue:function(n){return $(n).length?$(n).val():null},save:function(){var n,t,i,r;if($("#brew-session-form").attr("data-formchanged","false"),Message.clear(),n=SessionBuilder.getSession(),$(".session .field-error").removeClass("field-error"),$("[data-name=s_BrewDate]").val()==null||$("[data-name=s_BrewDate]").val().length==0)return $("[data-name=s_BrewDate]").addClass("field-error"),Message.error("Uh oh, something needs your attention.  Please check the highlighted entries below."),window.scrollTo(0,1),!1;try{if(t=new Date($("[data-name=s_BrewDate]").val()),i=new Date,t>i.addDays(14))return $("[data-name=s_BrewDate]").addClass("field-error"),Message.error("Uh oh, something needs your attention. Brew date cannot be that far in the future."),window.scrollTo(0,1),!1}catch(u){return Message.error("Uh oh, something went wrong."),window.scrollTo(0,1),!1}return n.BrewSessionId==0?(Layout.statusModal("Saving Brew Session..."),$(".builder").removeAttr("data-formchanged"),$("#SessionJson").val(escape(JSON.stringify(n))),$("#SessionForm").submit()):(r=function(){$.ajax({url:"/brew/SaveSession",data:{SessionJson:JSON.stringify(n)},method:"post",success:function(n){switch(n){case"-1":Message.error("There was a problem saving your brew session.  Please try again");break;case"0":Message.error("Did you leave something blank?  Please check your entries and try again.");break;case"1":Message.success("Your Brew Session has been saved");$(".builder").removeAttr("data-formchanged")}},error:function(){Message.error("There was a problem saving your brew session.  Please try again.")},complete:function(){$.colorbox.close();$(".compliment").css("position","").css("margin-left","").css("top","");window.scrollTo(0,0)}})},Layout.statusModal("Saving Brew Session...",r)),!1}};StyleChart={bjcpStyleChartValues:{og_low_graph:.995,og_high_graph:1.12,fg_low_graph:.995,fg_high_graph:1.12,ibu_low_graph:0,ibu_high_graph:120,srm_low_graph:0,srm_high_graph:40,abv_low_graph:0,abv_high_graph:14,bggu_low_graph:0,bggu_high_graph:2},allStyles:[{SubCategoryID:"0A",SubCategoryName:"Water",og_low:1,og_high:1,fg_low:1,fg_high:1,ibu_low:0,ibu_high:.01,srm_low:0,srm_high:.01,abv_low:0,abv_high:.01},{SubCategoryID:"10A",SubCategoryName:"Weissbier",og_low:1.044,og_high:1.052,fg_low:1.01,fg_high:1.014,ibu_low:8,ibu_high:15,srm_low:2,srm_high:6,abv_low:4.3,abv_high:5.6},{SubCategoryID:"10B",SubCategoryName:"Dunkles Weissbier",og_low:1.044,og_high:1.056,fg_low:1.01,fg_high:1.014,ibu_low:10,ibu_high:18,srm_low:14,srm_high:23,abv_low:4.3,abv_high:5.6},{SubCategoryID:"10C",SubCategoryName:"Weizenbock",og_low:1.064,og_high:1.09,fg_low:1.015,fg_high:1.022,ibu_low:15,ibu_high:30,srm_low:6,srm_high:25,abv_low:6.5,abv_high:9},{SubCategoryID:"11A",SubCategoryName:"Ordinary Bitter",og_low:1.03,og_high:1.039,fg_low:1.007,fg_high:1.011,ibu_low:25,ibu_high:35,srm_low:8,srm_high:14,abv_low:3.2,abv_high:3.8},{SubCategoryID:"11B",SubCategoryName:"Best Bitter",og_low:1.04,og_high:1.048,fg_low:1.008,fg_high:1.012,ibu_low:25,ibu_high:40,srm_low:8,srm_high:16,abv_low:3.8,abv_high:4.6},{SubCategoryID:"11C",SubCategoryName:"Strong Bitter",og_low:1.048,og_high:1.06,fg_low:1.01,fg_high:1.016,ibu_low:30,ibu_high:50,srm_low:8,srm_high:18,abv_low:4.6,abv_high:6.2},{SubCategoryID:"12A",SubCategoryName:"British Golden Ale",og_low:1.038,og_high:1.053,fg_low:1.006,fg_high:1.012,ibu_low:20,ibu_high:45,srm_low:2,srm_high:6,abv_low:3.8,abv_high:5},{SubCategoryID:"12B",SubCategoryName:"Australian Sparkling Ale",og_low:1.038,og_high:1.05,fg_low:1.004,fg_high:1.006,ibu_low:20,ibu_high:35,srm_low:4,srm_high:7,abv_low:4.5,abv_high:6},{SubCategoryID:"12C",SubCategoryName:"English IPA",og_low:1.05,og_high:1.075,fg_low:1.01,fg_high:1.018,ibu_low:40,ibu_high:60,srm_low:6,srm_high:14,abv_low:5,abv_high:7.5},{SubCategoryID:"13A",SubCategoryName:"Dark Mild",og_low:1.03,og_high:1.038,fg_low:1.008,fg_high:1.013,ibu_low:10,ibu_high:25,srm_low:12,srm_high:25,abv_low:3,abv_high:3.8},{SubCategoryID:"13B",SubCategoryName:"British Brown Ale",og_low:1.04,og_high:1.052,fg_low:1.008,fg_high:1.013,ibu_low:20,ibu_high:30,srm_low:12,srm_high:22,abv_low:4.2,abv_high:5.4},{SubCategoryID:"13C",SubCategoryName:"English Porter",og_low:1.04,og_high:1.052,fg_low:1.008,fg_high:1.014,ibu_low:18,ibu_high:35,srm_low:20,srm_high:30,abv_low:4,abv_high:5.4},{SubCategoryID:"14A",SubCategoryName:"Scottish Light",og_low:1.03,og_high:1.035,fg_low:1.01,fg_high:1.013,ibu_low:10,ibu_high:20,srm_low:17,srm_high:22,abv_low:2.5,abv_high:3.2},{SubCategoryID:"14B",SubCategoryName:"Scottish Heavy",og_low:1.035,og_high:1.04,fg_low:1.01,fg_high:1.015,ibu_low:10,ibu_high:20,srm_low:13,srm_high:22,abv_low:3.2,abv_high:3.9},{SubCategoryID:"14C",SubCategoryName:"Scottish Export",og_low:1.04,og_high:1.06,fg_low:1.01,fg_high:1.016,ibu_low:15,ibu_high:30,srm_low:13,srm_high:22,abv_low:3.9,abv_high:6},{SubCategoryID:"15A",SubCategoryName:"Irish Red Ale",og_low:1.036,og_high:1.046,fg_low:1.01,fg_high:1.014,ibu_low:18,ibu_high:28,srm_low:9,srm_high:14,abv_low:3.8,abv_high:5},{SubCategoryID:"15B",SubCategoryName:"Irish Stout",og_low:1.036,og_high:1.044,fg_low:1.007,fg_high:1.011,ibu_low:25,ibu_high:45,srm_low:25,srm_high:40,abv_low:4,abv_high:4.5},{SubCategoryID:"15C",SubCategoryName:"Irish Extra Stout",og_low:1.052,og_high:1.062,fg_low:1.01,fg_high:1.014,ibu_low:35,ibu_high:50,srm_low:25,srm_high:40,abv_low:5.5,abv_high:6.5},{SubCategoryID:"16A",SubCategoryName:"Sweet Stout",og_low:1.044,og_high:1.06,fg_low:1.012,fg_high:1.024,ibu_low:20,ibu_high:40,srm_low:30,srm_high:40,abv_low:4,abv_high:6},{SubCategoryID:"16B",SubCategoryName:"Oatmeal Stout",og_low:1.045,og_high:1.065,fg_low:1.01,fg_high:1.018,ibu_low:25,ibu_high:40,srm_low:22,srm_high:40,abv_low:4.2,abv_high:5.9},{SubCategoryID:"16C",SubCategoryName:"Tropical Stout",og_low:1.056,og_high:1.075,fg_low:1.01,fg_high:1.018,ibu_low:30,ibu_high:50,srm_low:30,srm_high:40,abv_low:5.5,abv_high:8},{SubCategoryID:"16D",SubCategoryName:"Foreign Extra Stout",og_low:1.056,og_high:1.075,fg_low:1.01,fg_high:1.018,ibu_low:50,ibu_high:70,srm_low:30,srm_high:40,abv_low:6.3,abv_high:8},{SubCategoryID:"17A",SubCategoryName:"British Strong Ale",og_low:1.055,og_high:1.08,fg_low:1.015,fg_high:1.022,ibu_low:30,ibu_high:60,srm_low:8,srm_high:22,abv_low:5.5,abv_high:8},{SubCategoryID:"17B",SubCategoryName:"Old Ale",og_low:1.055,og_high:1.088,fg_low:1.015,fg_high:1.022,ibu_low:30,ibu_high:60,srm_low:10,srm_high:22,abv_low:5.5,abv_high:9},{SubCategoryID:"17C",SubCategoryName:"Wee Heavy",og_low:1.07,og_high:1.13,fg_low:1.018,fg_high:1.04,ibu_low:17,ibu_high:35,srm_low:14,srm_high:25,abv_low:6.5,abv_high:10},{SubCategoryID:"17D",SubCategoryName:"English Barleywine",og_low:1.08,og_high:1.12,fg_low:1.018,fg_high:1.03,ibu_low:35,ibu_high:70,srm_low:8,srm_high:22,abv_low:8,abv_high:12},{SubCategoryID:"18A",SubCategoryName:"Blonde Ale",og_low:1.038,og_high:1.054,fg_low:1.008,fg_high:1.013,ibu_low:15,ibu_high:28,srm_low:3,srm_high:6,abv_low:3.8,abv_high:5.5},{SubCategoryID:"18B",SubCategoryName:"American Pale Ale",og_low:1.045,og_high:1.06,fg_low:1.01,fg_high:1.015,ibu_low:30,ibu_high:50,srm_low:5,srm_high:10,abv_low:4.5,abv_high:6.2},{SubCategoryID:"19A",SubCategoryName:"American Amber Ale",og_low:1.045,og_high:1.06,fg_low:1.01,fg_high:1.015,ibu_low:25,ibu_high:40,srm_low:10,srm_high:17,abv_low:4.5,abv_high:6.2},{SubCategoryID:"19B",SubCategoryName:"California Common ",og_low:1.048,og_high:1.054,fg_low:1.011,fg_high:1.014,ibu_low:30,ibu_high:45,srm_low:10,srm_high:14,abv_low:4.5,abv_high:5.5},{SubCategoryID:"19C",SubCategoryName:"American Brown Ale",og_low:1.045,og_high:1.06,fg_low:1.01,fg_high:1.016,ibu_low:20,ibu_high:30,srm_low:18,srm_high:35,abv_low:4.3,abv_high:6.2},{SubCategoryID:"1A",SubCategoryName:"American Light Lager",og_low:1.028,og_high:1.04,fg_low:.998,fg_high:1.008,ibu_low:8,ibu_high:12,srm_low:2,srm_high:3,abv_low:2.8,abv_high:4.2},{SubCategoryID:"1B",SubCategoryName:"American Lager",og_low:1.04,og_high:1.05,fg_low:1.004,fg_high:1.01,ibu_low:8,ibu_high:18,srm_low:2,srm_high:4,abv_low:4.2,abv_high:5.3},{SubCategoryID:"1C",SubCategoryName:"Cream Ale",og_low:1.042,og_high:1.055,fg_low:1.006,fg_high:1.012,ibu_low:8,ibu_high:20,srm_low:2.5,srm_high:5,abv_low:4.2,abv_high:5.6},{SubCategoryID:"1D",SubCategoryName:"American Wheat Beer",og_low:1.04,og_high:1.055,fg_low:1.008,fg_high:1.013,ibu_low:15,ibu_high:30,srm_low:3,srm_high:6,abv_low:4,abv_high:5.5},{SubCategoryID:"20A",SubCategoryName:"American Porter",og_low:1.05,og_high:1.07,fg_low:1.012,fg_high:1.018,ibu_low:25,ibu_high:50,srm_low:22,srm_high:40,abv_low:4.8,abv_high:6.5},{SubCategoryID:"20B",SubCategoryName:"American Stout",og_low:1.05,og_high:1.075,fg_low:1.01,fg_high:1.022,ibu_low:35,ibu_high:75,srm_low:30,srm_high:40,abv_low:5,abv_high:7},{SubCategoryID:"20C",SubCategoryName:"Imperial Stout",og_low:1.075,og_high:1.115,fg_low:1.018,fg_high:1.03,ibu_low:50,ibu_high:90,srm_low:30,srm_high:40,abv_low:8,abv_high:12},{SubCategoryID:"21A",SubCategoryName:"American IPA",og_low:1.056,og_high:1.07,fg_low:1.008,fg_high:1.014,ibu_low:40,ibu_high:70,srm_low:6,srm_high:14,abv_low:5.5,abv_high:7.5},{SubCategoryID:"21B-A",SubCategoryName:"Specialty IPA - Belgian IPA",og_low:1.058,og_high:1.08,fg_low:1.008,fg_high:1.016,ibu_low:50,ibu_high:100,srm_low:5,srm_high:15,abv_low:6.2,abv_high:9.5},{SubCategoryID:"21B-B",SubCategoryName:"Specialty IPA - Black IPA",og_low:1.05,og_high:1.085,fg_low:1.01,fg_high:1.018,ibu_low:50,ibu_high:90,srm_low:25,srm_high:40,abv_low:5.5,abv_high:9},{SubCategoryID:"21B-C",SubCategoryName:"Specialty IPA - Brown IPA",og_low:1.056,og_high:1.07,fg_low:1.008,fg_high:1.016,ibu_low:40,ibu_high:70,srm_low:11,srm_high:19,abv_low:5.5,abv_high:7.5},{SubCategoryID:"21B-D",SubCategoryName:"Specialty IPA - Red IPA",og_low:1.056,og_high:1.07,fg_low:1.008,fg_high:1.016,ibu_low:40,ibu_high:70,srm_low:11,srm_high:19,abv_low:5.5,abv_high:7.5},{SubCategoryID:"21B-E",SubCategoryName:"Specialty IPA - Rye IPA",og_low:1.056,og_high:1.075,fg_low:1.008,fg_high:1.014,ibu_low:50,ibu_high:75,srm_low:6,srm_high:14,abv_low:5.5,abv_high:8},{SubCategoryID:"21B-F",SubCategoryName:"Specialty IPA - White IPA",og_low:1.056,og_high:1.065,fg_low:1.01,fg_high:1.016,ibu_low:40,ibu_high:70,srm_low:5,srm_high:8,abv_low:5.5,abv_high:7},{SubCategoryID:"22A",SubCategoryName:"Double IPA",og_low:1.065,og_high:1.085,fg_low:1.008,fg_high:1.018,ibu_low:60,ibu_high:120,srm_low:6,srm_high:14,abv_low:7.5,abv_high:10},{SubCategoryID:"22B",SubCategoryName:"American Strong Ale",og_low:1.062,og_high:1.09,fg_low:1.014,fg_high:1.024,ibu_low:50,ibu_high:100,srm_low:7,srm_high:19,abv_low:6.3,abv_high:10},{SubCategoryID:"22C",SubCategoryName:"American Barleywine",og_low:1.08,og_high:1.12,fg_low:1.016,fg_high:1.03,ibu_low:50,ibu_high:100,srm_low:10,srm_high:19,abv_low:8,abv_high:12},{SubCategoryID:"22D",SubCategoryName:"Wheatwine",og_low:1.08,og_high:1.12,fg_low:1.016,fg_high:1.03,ibu_low:30,ibu_high:60,srm_low:8,srm_high:15,abv_low:8,abv_high:12},{SubCategoryID:"23A",SubCategoryName:"Berliner Weisse",og_low:1.028,og_high:1.032,fg_low:1.003,fg_high:1.006,ibu_low:3,ibu_high:8,srm_low:2,srm_high:3,abv_low:2.8,abv_high:3.8},{SubCategoryID:"23B",SubCategoryName:"Flanders Red Ale",og_low:1.048,og_high:1.057,fg_low:1.002,fg_high:1.012,ibu_low:10,ibu_high:25,srm_low:10,srm_high:16,abv_low:4.6,abv_high:6.5},{SubCategoryID:"23C",SubCategoryName:"Oud Bruin",og_low:1.04,og_high:1.074,fg_low:1.008,fg_high:1.012,ibu_low:20,ibu_high:25,srm_low:15,srm_high:22,abv_low:4,abv_high:8},{SubCategoryID:"23D",SubCategoryName:"Lambic",og_low:1.04,og_high:1.054,fg_low:1.001,fg_high:1.01,ibu_low:0,ibu_high:10,srm_low:3,srm_high:7,abv_low:5,abv_high:6.5},{SubCategoryID:"23E",SubCategoryName:"Gueuze ",og_low:1.04,og_high:1.06,fg_low:1,fg_high:1.006,ibu_low:0,ibu_high:10,srm_low:3,srm_high:7,abv_low:5,abv_high:8},{SubCategoryID:"23F",SubCategoryName:"Fruit Lambic",og_low:1.04,og_high:1.06,fg_low:1,fg_high:1.01,ibu_low:0,ibu_high:10,srm_low:3,srm_high:7,abv_low:5,abv_high:7},{SubCategoryID:"24A",SubCategoryName:"Witbier",og_low:1.044,og_high:1.052,fg_low:1.008,fg_high:1.012,ibu_low:8,ibu_high:20,srm_low:2,srm_high:4,abv_low:4.5,abv_high:5.5},{SubCategoryID:"24B",SubCategoryName:"Belgian Pale Ale",og_low:1.048,og_high:1.054,fg_low:1.01,fg_high:1.014,ibu_low:20,ibu_high:30,srm_low:8,srm_high:14,abv_low:4.8,abv_high:5.5},{SubCategoryID:"24C",SubCategoryName:"Bière de Garde",og_low:1.06,og_high:1.08,fg_low:1.008,fg_high:1.016,ibu_low:18,ibu_high:28,srm_low:6,srm_high:19,abv_low:6,abv_high:8.5},{SubCategoryID:"25A",SubCategoryName:"Belgian Blond Ale",og_low:1.062,og_high:1.075,fg_low:1.008,fg_high:1.018,ibu_low:15,ibu_high:30,srm_low:4,srm_high:7,abv_low:6,abv_high:7.5},{SubCategoryID:"25B",SubCategoryName:"Saison",og_low:1.048,og_high:1.065,fg_low:1.002,fg_high:1.008,ibu_low:20,ibu_high:35,srm_low:5,srm_high:22,abv_low:3.5,abv_high:9.5},{SubCategoryID:"25C",SubCategoryName:"Belgian Golden Strong Ale",og_low:1.07,og_high:1.095,fg_low:1.005,fg_high:1.016,ibu_low:22,ibu_high:35,srm_low:3,srm_high:6,abv_low:7.5,abv_high:10.5},{SubCategoryID:"26A",SubCategoryName:"Trappist Single",og_low:1.044,og_high:1.054,fg_low:1.004,fg_high:1.01,ibu_low:25,ibu_high:45,srm_low:3,srm_high:5,abv_low:4.8,abv_high:6},{SubCategoryID:"26B",SubCategoryName:"Belgian Dubbel",og_low:1.062,og_high:1.075,fg_low:1.008,fg_high:1.018,ibu_low:15,ibu_high:25,srm_low:10,srm_high:17,abv_low:6,abv_high:7.6},{SubCategoryID:"26C",SubCategoryName:"Belgian Tripel",og_low:1.075,og_high:1.085,fg_low:1.008,fg_high:1.014,ibu_low:20,ibu_high:40,srm_low:4.5,srm_high:7,abv_low:7.5,abv_high:9.5},{SubCategoryID:"26D",SubCategoryName:"Belgian Dark Strong Ale",og_low:1.075,og_high:1.11,fg_low:1.01,fg_high:1.024,ibu_low:20,ibu_high:35,srm_low:12,srm_high:22,abv_low:8,abv_high:12},{SubCategoryID:"27A-A",SubCategoryName:"Gose",og_low:1.036,og_high:1.056,fg_low:1.006,fg_high:1.01,ibu_low:5,ibu_high:12,srm_low:3,srm_high:4,abv_low:4.2,abv_high:4.8},{SubCategoryID:"27A-B",SubCategoryName:"Kentucky Common",og_low:1.044,og_high:1.055,fg_low:1.01,fg_high:1.018,ibu_low:15,ibu_high:30,srm_low:11,srm_high:20,abv_low:4,abv_high:5.5},{SubCategoryID:"27A-C",SubCategoryName:"Lichtenhainer",og_low:1.032,og_high:1.04,fg_low:1.004,fg_high:1.008,ibu_low:5,ibu_high:12,srm_low:3,srm_high:6,abv_low:3.5,abv_high:4.7},{SubCategoryID:"27A-D",SubCategoryName:"London Brown Ale",og_low:1.033,og_high:1.038,fg_low:1.012,fg_high:1.015,ibu_low:15,ibu_high:20,srm_low:22,srm_high:35,abv_low:2.8,abv_high:3.6},{SubCategoryID:"27A-E",SubCategoryName:"Piwo Grodziskie",og_low:1.028,og_high:1.032,fg_low:1.006,fg_high:1.012,ibu_low:20,ibu_high:35,srm_low:3,srm_high:6,abv_low:2.5,abv_high:3.3},{SubCategoryID:"27A-F",SubCategoryName:"Pre-Prohibition Lager",og_low:1.044,og_high:1.06,fg_low:1.01,fg_high:1.015,ibu_low:25,ibu_high:40,srm_low:3,srm_high:6,abv_low:4.5,abv_high:6},{SubCategoryID:"27A-G",SubCategoryName:"Pre-Prohibition Porter",og_low:1.046,og_high:1.06,fg_low:1.01,fg_high:1.016,ibu_low:20,ibu_high:30,srm_low:18,srm_high:30,abv_low:4.5,abv_high:6},{SubCategoryID:"27A-H",SubCategoryName:"Roggenbier",og_low:1.046,og_high:1.056,fg_low:1.01,fg_high:1.014,ibu_low:10,ibu_high:20,srm_low:14,srm_high:19,abv_low:4.5,abv_high:6},{SubCategoryID:"27A-I",SubCategoryName:"Sahti",og_low:1.076,og_high:1.12,fg_low:1.016,fg_high:1.02,ibu_low:7,ibu_high:15,srm_low:4,srm_high:22,abv_low:7,abv_high:11},{SubCategoryID:"28A",SubCategoryName:"Brett Beer",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"28B",SubCategoryName:"Mixed-Fermentation Sour Beer",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"28C",SubCategoryName:"Wild Specialty Beer",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"29A",SubCategoryName:"Fruit Beer",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"29B",SubCategoryName:"Fruit and Spice Beer",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"29C",SubCategoryName:"Specialty Fruit Beer",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"2A",SubCategoryName:"International Pale Lager",og_low:1.042,og_high:1.05,fg_low:1.008,fg_high:1.012,ibu_low:18,ibu_high:25,srm_low:2,srm_high:6,abv_low:4.6,abv_high:6},{SubCategoryID:"2B",SubCategoryName:"International Amber Lager",og_low:1.042,og_high:1.055,fg_low:1.008,fg_high:1.014,ibu_low:8,ibu_high:25,srm_low:7,srm_high:14,abv_low:4.6,abv_high:6},{SubCategoryID:"2C",SubCategoryName:"International Dark Lager",og_low:1.044,og_high:1.056,fg_low:1.008,fg_high:1.012,ibu_low:8,ibu_high:20,srm_low:14,srm_high:22,abv_low:4.2,abv_high:6},{SubCategoryID:"30A",SubCategoryName:"Spice, Herb, or Vegetable Beer",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"30B",SubCategoryName:"Autumn Seasonal Beer",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"30C",SubCategoryName:"Winter Seasonal Beer",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"31A",SubCategoryName:"Alternative Grain Beer",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"31B",SubCategoryName:"Alternative Sugar Beer",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"32A",SubCategoryName:"Classic Style Smoked Beer",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"32B",SubCategoryName:"Specialty Smoked Beer",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"33A",SubCategoryName:"Wood-Aged Beer",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"33B",SubCategoryName:"Specialty Wood-Aged Beer",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"34A",SubCategoryName:"Clone Beer",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"34B",SubCategoryName:"Mixed-Style Beer",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"34C",SubCategoryName:"Experimental Beer",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"3A",SubCategoryName:"Czech Pale Lager",og_low:1.028,og_high:1.044,fg_low:1.008,fg_high:1.014,ibu_low:20,ibu_high:35,srm_low:3,srm_high:6,abv_low:3,abv_high:4.1},{SubCategoryID:"3B",SubCategoryName:"Czech Premium Pale Lager",og_low:1.044,og_high:1.06,fg_low:1.013,fg_high:1.017,ibu_low:30,ibu_high:45,srm_low:3.5,srm_high:6,abv_low:4.2,abv_high:5.8},{SubCategoryID:"3C",SubCategoryName:"Czech Amber Lager",og_low:1.044,og_high:1.06,fg_low:1.013,fg_high:1.017,ibu_low:20,ibu_high:35,srm_low:10,srm_high:16,abv_low:4.4,abv_high:5.8},{SubCategoryID:"3D",SubCategoryName:"Czech Dark Lager",og_low:1.044,og_high:1.06,fg_low:1.013,fg_high:1.017,ibu_low:18,ibu_high:34,srm_low:14,srm_high:35,abv_low:4.4,abv_high:5.8},{SubCategoryID:"4A",SubCategoryName:"Munich Helles",og_low:1.044,og_high:1.048,fg_low:1.006,fg_high:1.012,ibu_low:16,ibu_high:22,srm_low:3,srm_high:5,abv_low:4.7,abv_high:5.4},{SubCategoryID:"4B",SubCategoryName:"Festbier",og_low:1.054,og_high:1.057,fg_low:1.01,fg_high:1.012,ibu_low:18,ibu_high:25,srm_low:4,srm_high:7,abv_low:5.8,abv_high:6.3},{SubCategoryID:"4C",SubCategoryName:"Helles Bock",og_low:1.064,og_high:1.072,fg_low:1.011,fg_high:1.018,ibu_low:23,ibu_high:35,srm_low:6,srm_high:11,abv_low:6.3,abv_high:7.4},{SubCategoryID:"5A",SubCategoryName:"German Leichtbier",og_low:1.026,og_high:1.034,fg_low:1.006,fg_high:1.01,ibu_low:15,ibu_high:28,srm_low:2,srm_high:5,abv_low:2.4,abv_high:3.6},{SubCategoryID:"5B",SubCategoryName:"Kölsch",og_low:1.044,og_high:1.05,fg_low:1.007,fg_high:1.011,ibu_low:18,ibu_high:30,srm_low:3.5,srm_high:5,abv_low:4.4,abv_high:5.2},{SubCategoryID:"5C",SubCategoryName:"German Helles Exportbier",og_low:1.048,og_high:1.056,fg_low:1.01,fg_high:1.015,ibu_low:20,ibu_high:30,srm_low:4,srm_high:7,abv_low:4.8,abv_high:6},{SubCategoryID:"5D",SubCategoryName:"German Pils",og_low:1.044,og_high:1.05,fg_low:1.008,fg_high:1.013,ibu_low:22,ibu_high:40,srm_low:2,srm_high:5,abv_low:4.4,abv_high:5.2},{SubCategoryID:"6A",SubCategoryName:"Märzen",og_low:1.054,og_high:1.06,fg_low:1.01,fg_high:1.014,ibu_low:18,ibu_high:24,srm_low:8,srm_high:17,abv_low:5.8,abv_high:6.3},{SubCategoryID:"6B",SubCategoryName:"Rauchbier",og_low:1.05,og_high:1.057,fg_low:1.012,fg_high:1.016,ibu_low:20,ibu_high:30,srm_low:12,srm_high:22,abv_low:4.8,abv_high:6},{SubCategoryID:"6C",SubCategoryName:"Dunkles Bock",og_low:1.064,og_high:1.072,fg_low:1.013,fg_high:1.019,ibu_low:20,ibu_high:27,srm_low:14,srm_high:22,abv_low:6.3,abv_high:7.2},{SubCategoryID:"7A",SubCategoryName:"Vienna Lager",og_low:1.048,og_high:1.055,fg_low:1.01,fg_high:1.014,ibu_low:18,ibu_high:30,srm_low:9,srm_high:15,abv_low:4.7,abv_high:5.5},{SubCategoryID:"7B",SubCategoryName:"Altbier",og_low:1.044,og_high:1.052,fg_low:1.008,fg_high:1.014,ibu_low:25,ibu_high:50,srm_low:11,srm_high:17,abv_low:4.3,abv_high:5.5},{SubCategoryID:"7C-A",SubCategoryName:"Pale Kellerbier",og_low:1.045,og_high:1.051,fg_low:1.008,fg_high:1.012,ibu_low:20,ibu_high:35,srm_low:3,srm_high:7,abv_low:4.7,abv_high:5.4},{SubCategoryID:"7C-B",SubCategoryName:"Amber Kellerbier",og_low:1.048,og_high:1.054,fg_low:1.012,fg_high:1.016,ibu_low:25,ibu_high:40,srm_low:7,srm_high:17,abv_low:4.8,abv_high:5.4},{SubCategoryID:"8A",SubCategoryName:"Munich Dunkel",og_low:1.048,og_high:1.056,fg_low:1.01,fg_high:1.016,ibu_low:18,ibu_high:28,srm_low:14,srm_high:28,abv_low:4.5,abv_high:5.6},{SubCategoryID:"8B",SubCategoryName:"Schwarzbier",og_low:1.046,og_high:1.052,fg_low:1.01,fg_high:1.016,ibu_low:20,ibu_high:30,srm_low:17,srm_high:30,abv_low:4.4,abv_high:5.4},{SubCategoryID:"9A",SubCategoryName:"Doppelbock",og_low:1.072,og_high:1.112,fg_low:1.016,fg_high:1.024,ibu_low:16,ibu_high:26,srm_low:6,srm_high:25,abv_low:7,abv_high:10},{SubCategoryID:"9B",SubCategoryName:"Eisbock",og_low:1.078,og_high:1.12,fg_low:1.02,fg_high:1.035,ibu_low:25,ibu_high:35,srm_low:18,srm_high:30,abv_low:9,abv_high:14},{SubCategoryID:"9C",SubCategoryName:"Baltic Porter",og_low:1.06,og_high:1.09,fg_low:1.016,fg_high:1.024,ibu_low:20,ibu_high:40,srm_low:17,srm_high:30,abv_low:6.5,abv_high:9.5},{SubCategoryID:"C1A",SubCategoryName:"New World Cider",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"C1B",SubCategoryName:"English Cider",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"C1C",SubCategoryName:"French Cider",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"C1D",SubCategoryName:"New World Perry",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"C1E",SubCategoryName:"Traditional Perry",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"C2A",SubCategoryName:"New England Cider",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"C2B",SubCategoryName:"Cider with Other Fruit",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"C2C",SubCategoryName:"Applewine",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"C2D",SubCategoryName:"Ice Cider",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"C2E",SubCategoryName:"Cider w/ Herbs/Spices",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"C2F",SubCategoryName:"Specialty Cider/Perry",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"M1A",SubCategoryName:"Dry Mead",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"M1B",SubCategoryName:"Semi-Sweet Mead",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"M1C",SubCategoryName:"Sweet Mead",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"M2A",SubCategoryName:"Cyser",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"M2B",SubCategoryName:"Pyment",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"M2C",SubCategoryName:"Berry Mead",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"M2D",SubCategoryName:"Stone Fruit Mead",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"M2E",SubCategoryName:"Melomel",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"M3A",SubCategoryName:"Fruit and Spice Mead",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"M3B",SubCategoryName:"Spice, Herb, or Vegetable Mead",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"M4A",SubCategoryName:"Braggot",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"M4B",SubCategoryName:"Historical Mead",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0},{SubCategoryID:"M4C",SubCategoryName:"Experimental Mead",og_low:0,og_high:0,fg_low:0,fg_high:0,ibu_low:0,ibu_high:0,srm_low:0,srm_high:0,abv_low:0,abv_high:0}],CalculatePercentForChart:function(n,t,i){return t<=n?0:t>=i?100:(t-n)/(i-n)*100},CalculateMatch:function(n,t,i){return n==0&&i==0?!0:t>=n&&t<=i},CalculateMidPoint:function(n,t){return(t-n)/2+n},Difference:function(n,t){return Math.abs(n-t)},CompareTotalPoints:function(n,t){return n.totalPoints<t.totalPoints?-1:n.totalPoints>t.totalPoints?1:0},isWater:function(n){return n==null?!0:n.Og<=1&&n.Fg<=1&&n.Ibu<=0?!0:!1},create:function(n,t,i){var f,e;if(n!=null&&t!=null){f=StyleChart.CalculatePercentForChart(StyleChart.bjcpStyleChartValues.og_low_graph,n.og_low,StyleChart.bjcpStyleChartValues.og_high_graph);e=StyleChart.CalculatePercentForChart(StyleChart.bjcpStyleChartValues.og_low_graph,n.og_high,StyleChart.bjcpStyleChartValues.og_high_graph)-f;n.og_low==0&&n.og_high==0&&(e=100);var b=StyleChart.CalculatePercentForChart(StyleChart.bjcpStyleChartValues.og_low_graph,t.Og,StyleChart.bjcpStyleChartValues.og_high_graph),k=StyleChart.CalculateMatch(n.og_low,t.Og,n.og_high)?"block":"none",s=StyleChart.CalculatePercentForChart(StyleChart.bjcpStyleChartValues.fg_low_graph,n.fg_low,StyleChart.bjcpStyleChartValues.fg_high_graph),h=StyleChart.CalculatePercentForChart(StyleChart.bjcpStyleChartValues.fg_low_graph,n.fg_high,StyleChart.bjcpStyleChartValues.fg_high_graph)-s;n.fg_low==0&&n.fg_high==0&&(h=100);var d=StyleChart.CalculatePercentForChart(StyleChart.bjcpStyleChartValues.fg_low_graph,t.Fg,StyleChart.bjcpStyleChartValues.fg_high_graph),g=StyleChart.CalculateMatch(n.fg_low,t.Fg,n.fg_high)?"block":"none",c=StyleChart.CalculatePercentForChart(StyleChart.bjcpStyleChartValues.ibu_low_graph,n.ibu_low,StyleChart.bjcpStyleChartValues.ibu_high_graph),l=StyleChart.CalculatePercentForChart(StyleChart.bjcpStyleChartValues.ibu_low_graph,n.ibu_high,StyleChart.bjcpStyleChartValues.ibu_high_graph)-c;n.ibu_low==0&&n.ibu_high==0&&(l=100);var nt=StyleChart.CalculatePercentForChart(StyleChart.bjcpStyleChartValues.ibu_low_graph,t.Ibu,StyleChart.bjcpStyleChartValues.ibu_high_graph),tt=StyleChart.CalculateMatch(n.ibu_low,t.Ibu,n.ibu_high)?"block":"none",a=StyleChart.CalculatePercentForChart(StyleChart.bjcpStyleChartValues.srm_low_graph,n.srm_low,StyleChart.bjcpStyleChartValues.srm_high_graph),v=StyleChart.CalculatePercentForChart(StyleChart.bjcpStyleChartValues.srm_low_graph,n.srm_high,StyleChart.bjcpStyleChartValues.srm_high_graph)-a;n.srm_low==0&&n.srm_high==0&&(v=100);var it=StyleChart.CalculatePercentForChart(StyleChart.bjcpStyleChartValues.srm_low_graph,t.Srm,StyleChart.bjcpStyleChartValues.srm_high_graph),rt=StyleChart.CalculateMatch(n.srm_low,t.Srm,n.srm_high)?"block":"none",y=StyleChart.CalculatePercentForChart(StyleChart.bjcpStyleChartValues.abv_low_graph,n.abv_low,StyleChart.bjcpStyleChartValues.abv_high_graph),p=StyleChart.CalculatePercentForChart(StyleChart.bjcpStyleChartValues.abv_low_graph,n.abv_high,StyleChart.bjcpStyleChartValues.abv_high_graph)-y;n.abv_low==0&&n.abv_high==0&&(p=100);var ut=StyleChart.CalculatePercentForChart(StyleChart.bjcpStyleChartValues.abv_low_graph,t.Abv.toFixed(1),StyleChart.bjcpStyleChartValues.abv_high_graph),ft=StyleChart.CalculateMatch(n.abv_low,t.Abv,n.abv_high)?"block":"none",r=StyleChart.CalculateBUGURatio(n.og_high,n.ibu_low),u=StyleChart.CalculateBUGURatio(n.og_low,n.ibu_high),w=StyleChart.CalculatePercentForChart(StyleChart.bjcpStyleChartValues.bggu_low_graph,r,StyleChart.bjcpStyleChartValues.bggu_high_graph),o=StyleChart.CalculatePercentForChart(StyleChart.bjcpStyleChartValues.bggu_low_graph,u,StyleChart.bjcpStyleChartValues.bggu_high_graph)-w;r==0&&u==0?o=100:n.SubCategoryID=="0A"&&(o=0);var et=StyleChart.CalculatePercentForChart(StyleChart.bjcpStyleChartValues.bggu_low_graph,t.BgGu,StyleChart.bjcpStyleChartValues.bggu_high_graph),ot=StyleChart.CalculateMatch(r,t.BgGu,u)?"block":"none",st=[{styleElement:"OG",currentBrewValue:t.Og.toFixed(3),styleStart:n.og_low.toFixed(3),styleEnd:n.og_high.toFixed(3),styleElementStartValue:StyleChart.bjcpStyleChartValues.og_low_graph.toFixed(3),styleElementEndValue:StyleChart.bjcpStyleChartValues.og_high_graph.toFixed(3),styleElementStartPercent:f,styleElementEndPercent:e,styleMarkerPercent:b,styleMatch:k},{styleElement:"FG",currentBrewValue:t.Fg.toFixed(3),styleStart:n.fg_low.toFixed(3),styleEnd:n.fg_high.toFixed(3),styleElementStartValue:StyleChart.bjcpStyleChartValues.fg_low_graph.toFixed(3),styleElementEndValue:StyleChart.bjcpStyleChartValues.fg_high_graph.toFixed(3),styleElementStartPercent:s,styleElementEndPercent:h,styleMarkerPercent:d,styleMatch:g},{styleElement:"IBU",currentBrewValue:t.Ibu.toFixed(0),styleStart:n.ibu_low,styleEnd:n.ibu_high,styleElementStartValue:StyleChart.bjcpStyleChartValues.ibu_low_graph,styleElementEndValue:StyleChart.bjcpStyleChartValues.ibu_high_graph,styleElementStartPercent:c,styleElementEndPercent:l,styleMarkerPercent:nt,styleMatch:tt},{styleElement:"SRM",currentBrewValue:t.Srm.toFixed(1),styleStart:n.srm_low,styleEnd:n.srm_high,styleElementStartValue:StyleChart.bjcpStyleChartValues.srm_low_graph,styleElementEndValue:StyleChart.bjcpStyleChartValues.srm_high_graph,styleElementStartPercent:a,styleElementEndPercent:v,styleMarkerPercent:it,styleMatch:rt},{styleElement:"ABV",currentBrewValue:t.Abv.toFixed(1),styleStart:n.abv_low,styleEnd:n.abv_high,styleElementStartValue:StyleChart.bjcpStyleChartValues.abv_low_graph,styleElementEndValue:StyleChart.bjcpStyleChartValues.abv_high_graph,styleElementStartPercent:y,styleElementEndPercent:p,styleMarkerPercent:ut,styleMatch:ft},{styleElement:"BG:GU",currentBrewValue:t.BgGu.toFixed(2),styleStart:r.toFixed(2),styleEnd:u.toFixed(2),styleElementStartValue:StyleChart.bjcpStyleChartValues.bggu_low_graph,styleElementEndValue:StyleChart.bjcpStyleChartValues.bggu_high_graph,styleElementStartPercent:w,styleElementEndPercent:o,styleMarkerPercent:et,styleMatch:ot},];$("#bjcpStyleTitle").tmpl(n).appendTo(i);$("#bjcpStyleTemplate").tmpl(st).appendTo(i);$(".bjcp-slider").tipsy();$(".bjcp-scale .progress").tipsy()}},SortStylesByClosestMatch:function(n){for(var i=StyleChart.allStyles,t=0;t<i.length;t++){if(i[t].og_low==0&&i[t].og_high==0&&i[t].fg_low==0&&i[t].fg_high==0&&i[t].ibu_low,i[t].ibu_high==0&&i[t].srm_low==0&&i[t].srm_high==0&&i[t].abv_low==0&&i[t].abv_high==0){i[t].totalPoints=99999;continue}og_midpoint=StyleChart.CalculateMidPoint(i[t].og_low,i[t].og_high);fg_midpoint=StyleChart.CalculateMidPoint(i[t].fg_low,i[t].fg_high);ibu_midpoint=StyleChart.CalculateMidPoint(i[t].ibu_low,i[t].ibu_high);srm_midpoint=StyleChart.CalculateMidPoint(i[t].srm_low,i[t].srm_high);abv_midpoint=StyleChart.CalculateMidPoint(i[t].abv_low,i[t].abv_high);og_percent=StyleChart.CalculatePercentForChart(StyleChart.bjcpStyleChartValues.og_low_graph,og_midpoint,StyleChart.bjcpStyleChartValues.og_high_graph);og_percent_brew=StyleChart.CalculatePercentForChart(StyleChart.bjcpStyleChartValues.og_low_graph,n.Og,StyleChart.bjcpStyleChartValues.og_high_graph);fg_percent=StyleChart.CalculatePercentForChart(StyleChart.bjcpStyleChartValues.fg_low_graph,fg_midpoint,StyleChart.bjcpStyleChartValues.fg_high_graph);fg_percent_brew=StyleChart.CalculatePercentForChart(StyleChart.bjcpStyleChartValues.fg_low_graph,n.Fg,StyleChart.bjcpStyleChartValues.fg_high_graph);ibu_percent=StyleChart.CalculatePercentForChart(StyleChart.bjcpStyleChartValues.ibu_low_graph,ibu_midpoint,StyleChart.bjcpStyleChartValues.ibu_high_graph);ibu_percent_brew=StyleChart.CalculatePercentForChart(StyleChart.bjcpStyleChartValues.ibu_low_graph,n.Ibu,StyleChart.bjcpStyleChartValues.ibu_high_graph);srm_percent=StyleChart.CalculatePercentForChart(StyleChart.bjcpStyleChartValues.srm_low_graph,srm_midpoint,StyleChart.bjcpStyleChartValues.srm_high_graph);srm_percent_brew=StyleChart.CalculatePercentForChart(StyleChart.bjcpStyleChartValues.srm_low_graph,n.Srm,StyleChart.bjcpStyleChartValues.srm_high_graph);abv_percent=StyleChart.CalculatePercentForChart(StyleChart.bjcpStyleChartValues.abv_low_graph,abv_midpoint,StyleChart.bjcpStyleChartValues.abv_high_graph);abv_percent_brew=StyleChart.CalculatePercentForChart(StyleChart.bjcpStyleChartValues.abv_low_graph,n.Abv,StyleChart.bjcpStyleChartValues.abv_high_graph);og_diff=n.Og>i[t].og_low&&n.Og<i[t].og_high?0:StyleChart.Difference(og_percent,og_percent_brew);fg_diff=n.Fg>i[t].fg_low&&n.Fg<i[t].fg_high?0:StyleChart.Difference(fg_percent,fg_percent_brew);ibu_diff=n.Ibu>i[t].ibu_low&&n.Ibu<i[t].ibu_high?0:StyleChart.Difference(ibu_percent,ibu_percent_brew);srm_diff=n.Srm>i[t].srm_low&&n.Srm<i[t].srm_high?0:StyleChart.Difference(srm_percent,srm_percent_brew);abv_diff=n.Abv>i[t].abv_low&&n.Abv<i[t].abv_high?0:StyleChart.Difference(abv_percent,abv_percent_brew);totalPointsForThisStyle=og_diff+fg_diff+ibu_diff+srm_diff+abv_diff;i[t].totalPoints=totalPointsForThisStyle}return i.sort(StyleChart.CompareTotalPoints)},GetStyle:function(n){for(var t=0;t<StyleChart.allStyles.length;t++)if(StyleChart.allStyles[t].SubCategoryID==n)return StyleChart.allStyles[t];return null},CalculateBUGURatio:function(n,t){return n<=1&&t>0?1:n==0||t==0?0:t/((n-1)*1e3)}}