/*!=======================================================================*\
|| ###################################################################### ||
|| # vBulletin 5.4.0 Release Candidate 1
|| # ------------------------------------------------------------------ # ||
|| # Copyright 2000-2018 vBulletin Solutions Inc. All Rights Reserved.  # ||
|| # This file may not be redistributed in whole or significant part.   # ||
|| # ----------------- VBULLETIN IS NOT FREE SOFTWARE ----------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html   # ||
|| ###################################################################### ||
\*========================================================================*/
// ***************************
// js.compressed/jquery/jquery.thumbnail-radio-checkbox.min.js
// ***************************
(function(a){function i(){return"radio-checkbox-"+this.attr("name").replace(/\[|\]/g,"")}var b="thumbnailRadioCheckbox",c="radio-checkbox-thumbnail-container",d="radio-checkbox-thumbnail",e="selected",f="disabled";var g={thumbnailClass:"",preselect:null,select:null,unselect:null};var h={init:function(h){var j=this;if(typeof h==="object"){j.settings=a.extend({},g,h)}j.each(function(){var g=a(this);g.hide();a("<div></div>").addClass(c).addClass(function(){return g.attr("type")=="radio"?i.apply(g):""}).insertBefore(g).append(a("<div></div>").attr("id",g.attr("id")?"thumbnail-"+g.attr("id"):"").addClass(d+" "+j.settings.thumbnailClass).addClass(function(){return g.attr("type")=="radio"?"has-hover":"no-hover"}).bind("mousedown."+b,function(){return typeof j.settings.preselect==="function"?j.settings.preselect(a("img",this),g):true}).bind("click."+b,function(){if(a(this).hasClass(f)||g.attr("type")=="radio"&&a(this).hasClass(e)){return}if(g.attr("type")=="checkbox"){a(this).toggleClass(e);if(a(this).hasClass(e)){g.attr("checked","checked");if(typeof j.settings.select==="function")j.settings.select(a("img",this),g)}else{g.removeAttr("checked");if(typeof j.settings.unselect==="function")j.settings.unselect(a("img",this),g)}}else{g.attr("checked","checked");a("."+c+"."+i.apply(g)+" > div."+e).removeClass(e);a(this).addClass(e);if(typeof j.settings.unselect==="function")j.settings.unselect(a("img",this),g);if(typeof j.settings.select==="function")j.settings.select(a("img",this),g)}}).append(a("<img />").attr({src:g.attr("data-thumbnail"),alt:g.next("label").text(),title:""}).css({width:g.attr("data-thumbnail-width")?g.attr("data-thumbnail-width")+"px":"auto",height:g.attr("data-thumbnail-height")?g.attr("data-thumbnail-height")+"px":"auto"})).append(g.nextAll(".radio-checkbox-inside-thumbnail"))).append(g.removeAttr("data-thumbnail").removeAttr("data-thumbnail-width").removeAttr("data-thumbnail-height"),g.nextAll());if(g.is(":checked")){g.prev().addClass(e);if(typeof j.settings.select==="function")j.settings.select(a("img",g.prev()),g)}if(g.is(":disabled")){g.prev().addClass(f)}});return this},enable:function(b,c){b.each(function(){var b=a(this);if(c){b.prev().removeClass(f);b.removeAttr("disabled")}else{b.prev().addClass(f);b.attr("disabled","disabled")}});return this},check:function(b,d){var f=b.prev();var g=a("img",f);if(!d){f.removeClass(e);b.removeAttr("checked");if(typeof this.settings.unselect==="function"){this.settings.unselect(g,b)}}else{if(b.attr("type")=="radio"){a("."+c+"."+i.apply(b)+" > div."+e).removeClass(e);if(typeof this.settings.unselect==="function")this.settings.unselect(g,b)}f.addClass(e);b.attr("checked","checked");if(typeof this.settings.select==="function"){this.settings.select(g,b)}}return this},option:function(){if(arguments.length>=2){this.settings[arguments[0]]=arguments[1];return this}else if(arguments.length===1){return this.settings[arguments[0]]}return this}};a.fn.thumbnailRadioCheckbox=function(){var b=arguments[0];this.settings=this.settings||g;if(h[b]){return h[b].apply(this,Array.prototype.slice.call(arguments,1))}else if(typeof b==="object"||!b){return h.init.apply(this,arguments)}else{a.error("Method "+b+" does not exist.")}}})(jQuery);

// ***************************
// js.compressed/sb_page.js
// ***************************
/*=======================================================================*\
|| ###################################################################### ||
|| # vBulletin 5.4.0 Release Candidate 1
|| # ------------------------------------------------------------------ # ||
|| # Copyright 2000-2018 vBulletin Solutions Inc. All Rights Reserved.  # ||
|| # This file may not be redistributed in whole or significant part.   # ||
|| # ----------------- VBULLETIN IS NOT FREE SOFTWARE ----------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html   # ||
|| ###################################################################### ||
\*========================================================================*/
window.vBulletin=window.vBulletin||{};window.vBulletin.phrase=window.vBulletin.phrase||{};window.vBulletin.phrase.precache=window.vBulletin.phrase.precache||[];window.vBulletin.phrase.precache=$.merge(window.vBulletin.phrase.precache,["action","active","ad_list_description","add_modules","add_subforum","adding_multiple_modules_not_allowed","all","applying_new_template","are_you_sure_want_to_delete_ad_x","cancel","cannot_add_system_module","cannot_convert_channel","cannot_remove_system_module","channels","check_to_hide_module","choose_base_module","choose_options_site_logo","click_text_edit_title","confirm_deletion_gcpglobal","confirm_deletion_x","confirm_remove_page_desc","content_types","create_ad","create_new_custom_module","delete","display_order","do_you_want_to_cancel_editing_search_module","do_you_want_to_exit_without_saving_page","do_you_want_to_remove_channel","do_you_want_to_remove_forum","do_you_want_to_remove_module","do_you_want_to_remove_tab","drag_and_drop_module_here","drop_page_here","dropping_container_module_into_container_module_not_allowed","edit","edit_ad_x","edit_blog_categories","edit_custom_html_module","edit_navigation_item","edit_search_module","edit_site_logo","error_adding_widgets","error_cloning_widget","error_deleting_page","error_fetching_channels","error_loading_search_config_script","error_processing_site_logo","error_renaming_module_title","error_retrieving_cloned_widget_template","error_retrieving_configuration","error_retrieving_list_user_groups","error_retrieving_modules","error_retrieving_navigation_bar_configuration","error_retrieving_page_map","error_retrieving_templates","error_saving_configuration_module","error_saving_forums","error_saving_forums_code","error_saving_navigation_bar_configuration","error_saving_page","error_saving_search_config","error_saving_site_logo","error_uploading_logo","exit_without_saving_page","expand","forum_changes_will_be_lost","input_navigation_item_name","input_target_url","invalid_image_url","main_navigation_bar","make_category","make_forum","manage_ads","module_configuration","module_icon","move_not_allowed","moving_main_nav_to_own_sub_nav_error","moving_main_nav_with_sub_nav_error","new_navigation_item","new_subnavigation_item","next","no","no_ad_added","no_configurations_found","no_modules","no_permission","none","overwrite_template_continue","page_template_title_cannot_be_empty","page_title_cannot_be_empty","please_choose_overwrite_template_options","please_enter_channel_title","please_enter_new_module_title","please_enter_new_template_name","please_enter_page_name","previous","remove_channel","remove_channel_q","remove_forum","remove_forum_q","remove_module_q","rename","rename_custom_module","reset","save","save_new_page","save_page","search_results","select_edit_link_header","special_options","sub_navigation_bar","subchannels_will_be_deleted","switch_template","template_changes_will_be_lost","this_url_is_already_used","title","unable_to_delete_widget_instances","uncheck_to_unhide_module","url_too_long","user_group_settings","warning","warning_gcpuser","yes","you_are_here","you_can_also_drag_and_drop_modules_here","you_cannot_revert_this_layout_confirm","you_must_specify_a_screen_layout"]);(function(AT){var e,AS,m,Ab,AD,a,z=[],AB,AH,r=false,u=false,n={},x=false,AE=false,k=false,t=false,AY=false,S=false,s=false,g={},v={},AM={},H={},b,AL,p,AZ={saveNewWidgetInstance:false},A=AT("<div>"),P;function Ai(){window.setTimeout(function(){if(vBulletin.vBScroller&&vBulletin.vBScroller.initializeScroller){AT(".js-vbscroller-wrapper:visible").each(function(){vBulletin.vBScroller.initializeScroller(AT(this))})}},0)}function Ah(){var Ak=AT("#edit-page-dropdown .panel .panel-main-content:visible");if(Ak.length>0){var Aj=parseFloat(Ak.css("margin-left"))+parseFloat(Ak.css("margin-right"))+parseFloat(Ak.css("border-left-width"))+parseFloat(Ak.css("border-right-width"))+parseFloat(Ak.css("padding-left"))+parseFloat(Ak.css("padding-right"));AT("#edit-page-dropdown .panel .panel-main-content").width(AT("#edit-page-dropdown .panel:visible").width()-AT("#edit-page-dropdown .panel .panel-header-text:visible").outerWidth(true)-Aj-1);AT("#edit-page-dropdown form .form-gutter-right").width(Math.ceil((AT("#edit-page-dropdown form:visible").width()-AT("#edit-page-dropdown .panel:visible").outerWidth(true))/2));Ai()}}function AU(Ak,Am){if(AT.isEmptyObject(Am)){return }var Al=Ak.find(".js-admin-widget-list"),Aj=false;AT.each(Am,function(){Al.append(this.rendered_template);Aj=true});if(Aj){Al.closest(".js-widget-content").removeClass("h-hide")}Al.closest(".js-widget-content").css({minHeight:"35px"});Al.css({minHeight:"0",height:"auto",paddingBottom:"10px"})}function AK(Am,Aj,Ao){var Ak=Am.attr("data-widget-id"),An=Am.attr("data-widget-instance-id")||"",Al={widgetinstanceid:An,widgetid:Ak,guid:"",userid:0,channelId:0,withTemplate:false,};if(typeof Ao=="undefined"){Ao=false}else{Ao=Boolean(Ao)}vBulletin.AJAX({call:"/ajax/api/widget/fetchConfigAndIsUserEditable",data:Al,success:function(Ap){console.log("fetchConfig in getModuleConfig() successful! result:"+JSON.stringify(Ap));var Aq=Ap;if(!Ao){Aq=Ap.config}if(typeof Aj=="function"){Aj(Aq)}}})}function AA(Ak){if(!Ak.tab_data){Ak.tab_data=[]}if(!Ak.default_tab){Ak.default_tab=0}if(!Ak.submodules_key){console.log({msg:"Missing submodules key!",config:Ak,});Ak.submodules_key="tabbedContainerSubModules__temp"}if(!Ak.display_tabs){Ak.display_tabs=""}if(Ak.display_tabs==""){var Aj={};AT.each(Ak.tab_data,function(Am,Al){Aj[Am]="1"});Ak.display_tabs=Aj}return Ak}function W(){if(typeof p=="undefined"){p=AT("#config_pagetemplateid").val()||AT("#select-template input[type=radio]:checked").val()||""}return p}function c(Aj){Aj=parseInt(Aj,10);p=Aj;AT("#config_pagetemplateid, #save-page-form #pagetemplateid-yes, #save-page-form #pagetemplateid-new").val(p)}function Z(Ak,Aj){console.log({msg:"saveModuleConfig()",$module:Ak,config:Aj,});vBulletin.AJAX({call:"/ajax/api/widget/saveAdminConfig",data:{widgetid:Ak.attr("data-widget-id"),widgetinstanceid:Ak.attr("data-widget-instance-id")||"",pagetemplateid:W(),data:Aj},complete:function(){AT("body").css("cursor","auto")},success:function(Al){console.log("saveAdminConfig in saveModuleConfig() successful! result:"+JSON.stringify(Al))}})}function q(Ak){var Aj=Ak.parents(".canvas-widget");if(Aj.length){$parentModule=AT(Aj[0]);return parseInt($parentModule.data("widget-instance-id"),10)}return 0}function R(Ak){var Aj=Ak.parents(".canvas-widget[data-is-tabbed-container='true']");if(Ak.data("is-tabbed-container")){console.log("---updating self tabbed container config");V(Ak)}if(Aj.length==0){console.log("---no parent tabbed container to update");return }console.log("---updating parent tabbed container config");V(AT(Aj[0]))}function f(Ak){var Aj={};Ak.find("> .js-admin-widget-content > .js-admin-widget-tab").each(function(){var Ao=AT(this),An=[],Al=Ao&&Ao.data("tab-number")||0,Am=Ao&&Ao.data("tab-title")||"";Aj[Al]={title:Am};Ao.find("> .widget-content > .canvas-layout-row > .canvas-widget-list > .canvas-widget:not(.dummy-widget)").each(function(){var As=AT(this),Ap=As.data("widget-id"),Aq=As.data("widget-instance-id")||As.attr("data-widget-instance-id"),Ar={};if(Aq){Ar.widgetinstanceid=Aq}if(Ap){Ar.widgetid=Ap}if(!AT.isEmptyObject(Ar)){An.push(Ar)}});Aj[Al]["widgets"]=An});return Aj}function V(Ak){var Aj=function(Al){var Al=AA(Al);Al.tab_data=f(Ak);if(!AT.isEmptyObject(Al)){Z(Ak,Al)}};AK(Ak,Aj)}function AO(Aj){vBulletin.AJAX({call:"/ajax/api/widget/deleteWidgetInstances",data:{widgetInstanceIds:Aj},success:function(Ak){console.log("saveAdminConfig in saveModuleConfig() successful! removeInstances: "+JSON.stringify(Aj)+" result:"+JSON.stringify(Ak))},emptyResponse:function(Ak){console.log("Empty response from deleteWidgetInstances after parent tab delete.")},api_error:vBulletin.ajaxtools.logApiError,})}function i(An,Am,Ak,Ao){var Ap=W(),Al=(Ap==""||Ap==0),Aj="save-new-widgetinstance-pagetemplateid-ready";if(Al){if(!AZ.saveNewWidgetInstance){AZ.saveNewWidgetInstance=true}else{A.one(Aj,function(Aq){i(An,Am,Ak,Ao)});return }}vBulletin.AJAX({call:"/ajax/api/widget/saveNewWidgetInstance",data:{containerinstanceid:An,widgetid:Am,pagetemplateid:Ap,subWidgetConfig:Ak,},success:function(Aq){console.log({msg:"/ajax/api/widget/saveNewWidgetInstance success!",result:Aq,});if(Al&&Aq.pagetemplateid){c(Aq.pagetemplateid);A.trigger(Aj)}if(Aq.widgetinstanceid){if(typeof Ao=="function"){Ao(Aq.widgetinstanceid)}}}})}function h(Ar){if(!Ar.data("is-tabbed-container")){return }var Ap=Ar.attr("data-widget-instance-id");if(!Ap){var Al=q(Ar),Ak=function(Ax){console.log({msg:"added missing tabbed container widgetinstance",widgetinstanceid:Ax,parentContainerinstanceid:Al,});Ar.attr("data-widget-instance-id",Ax);return h(Ar)};return i(Al,Ar.attr("data-widget-id"),{},Ak)}if(AT.isEmptyObject(AM)){return l(h,[Ar])}if(Ar.data("tabbed-container-initialized")){return }var Av=Ar.find(".js-admin-widget-tab-panel-template"),Au=Av.find(".js-admin-widget-list"),Ao=Ar.find(".js-admin-widget-tab-header-template"),As=Ar.find(".js-admin-widget-content"),Am=As.find(".js-tab-headers"),Aw=Am.find(".js-tab-add"),Aq,Aj;Av.detach().removeClass("js-admin-widget-tab-panel-template");Ao.detach().removeClass("js-admin-widget-tab-header-template");As.tabs({beforeActivate:function(Ax,Ay){if(AT(Ay.newTab).hasClass("js-tab-add")){return false}},});Aq=As.tabs("widget");Au.css({minHeight:"60px",height:"auto",paddingBottom:"10px"});Am.find(".js-tab-add").on("click",function(){var Ax=function(Az){var A1=AA(Az.config),A2=A1.tab_data,A3=A2.length||0,A0=A3,Ay=Az.isusereditable.tab_data||false;openPromptDialog({title:vBulletin.phrase.get("enter_tab_title"),message:"",buttonLabel:{okLabel:vBulletin.phrase.get("ok"),cancelLabel:vBulletin.phrase.get("cancel")},onClickOK:function(A4){if(!A4){return false}An(A4,[],A0,A0,Ay);A1.display_tabs[A0]="1";A1.tab_data=f(Ar);if(!AT.isEmptyObject(A1)){Z(Ar,A1)}}})};AK(Ar,Ax,true)});Ao.find(".js-edit-tab-button").on("click",function(){var A1=AT(this),Ax=A1.closest("li[aria-controls]"),Ay=Ax.attr("aria-controls"),A0=Aq.find(".js-admin-widget-tab[id='"+Ay+"']"),Az=A0&&A0.data("tab-title")||"";var A2=function(A3){var A4=AA(A3),A5=A4.tab_data;openPromptDialog({title:vBulletin.phrase.get("enter_tab_title"),message:"",initialValue:Az,buttonLabel:{okLabel:vBulletin.phrase.get("ok"),cancelLabel:vBulletin.phrase.get("cancel")},onClickOK:function(A6){Ax.find("span.js-tab-title").text(A6);A0.data("tab-title",A6);A4.tab_data=f(Ar);if(!AT.isEmptyObject(A4)){Z(Ar,A4)}}})};AK(Ar,A2);return false});Ao.find(".js-remove-tab-button").on("click",function(){var A1=AT(this),Ay=A1.closest("li[aria-controls]"),Az=Ay.attr("aria-controls"),A0=Aq.find(".js-admin-widget-tab[id='"+Az+"']");var Ax=function(A2){var A4=AA(A2.config),A5=A4.tab_data,A6=A5.length||0,A3=A0.data("tab-number");openConfirmDialog({title:vBulletin.phrase.get("remove_tab_q"),message:vBulletin.phrase.get("do_you_want_to_remove_tab",A0.data("tab-title")),iconType:"warning",onClickYes:function(){if(A4.default_tab==A3){A4.default_tab=0}if(!Array.isArray(A4.display_tabs)){A4.display_tabs=AT.map(A4.display_tabs,function(A8){return A8})}A4.display_tabs.splice(A3,1);var A7=[];A0.find(".canvas-widget").each(function(A8,BA){var A9=AT(this).data("widget-instance-id");if(A9){A7.push(A9)}});if(A7.length){AO(A7)}Ay.remove();A0.remove();Am.find("li:not('.js-tab-add')").each(function(A8,BC){var A9=AT(this),BB=A9.attr("aria-controls"),BA=Aq.find(".js-admin-widget-tab[id='"+BB+"']");if(BA.length){BA.data("tab-number",A8)}});Aq.tabs("refresh");A4.tab_data=f(Ar);if(!AT.isEmptyObject(A4)){Z(Ar,A4)}y();M();r=true}})};AK(Ar,Ax,true);return false});var An=function(A9,BA,Ax,A8,Az){if(typeof A9=="undefined"){A9="Untitled Tab"}if(typeof BA=="undefined"){BA=[]}if(typeof Ax=="undefined"){var BD=Ar.find(".js-admin-widget-tab");Ax=BD.length}var A0=BA.length,A4=Av.clone().uniqueId().removeClass("h-hide").data("tab-number",Ax).data("tab-title",A9),A7=A4.find(".js-admin-widget-list"),Ay=A4.attr("id"),A2=Ao.clone(true).removeClass("h-hide");A2.children("a.js-tab-header-link").attr("href","#"+Ay);A2.find("span.js-tab-title").text(A9);for(var A3=0;A3<A0;A3++){var BB=BA[A3],A1=BB.widgetid||AM[BB.guid],BC=BB.widgetinstanceid||"",A5=AT('<div data-widget-id="'+A1+'" />');A5.attr("data-tab-number",Ax);A5.attr("data-widget-order",A3);A5.attr("data-widget-instance-id",BC);A5.append(AT('<img src="images/loader-box-blue.gif" /> '));A7.append(A5);if(A1){var A6=(function(BH,BF,BG,BE){return function(BN){if(!BG){var BI=BH.adminconfig||{},BL=function(BQ){BN.attr("data-widget-instance-id",BQ);V(Ar)};i(Ap,BF,BI,BL)}else{BN.attr("data-widget-instance-id",BG)}if(!Az){var BO=BN.find(".js-move-button"),BJ=BN.find(".js-edit-button"),BP=BN.find(".js-remove-button"),BK=BN.find(".js-edit-tab-button"),BM=BN.find(".js-remove-tab-button");BO.hide();BJ.hide();BP.hide();BK.hide();BM.hide();BN.addClass("js-widget-non-sortable")}BE.replaceWith(BN);BN.filter(":not(.container-widget)").find(".toggle-button").trigger("click",[true]);h(BN)}})(BB,A1,BC,A5);Ag(A5,A6)}}Aw.before(A2);Aq.append(A4);Aq.tabs("refresh");Aq.tabs("option","active",A8);A7.prepend('<div class="canvas-widget dummy-widget dummy-widget--no-fixed-height"><span>{0}</span></div>'.format(vBulletin.phrase.get("drag_and_drop_modules_below")))};var At=function(A3){var Az=AA(A3.config),A7=Az.tab_data,A5=A7.length,A6=Az.default_tab,A0=A3.isusereditable.tab_data||false;for(var A2=0;A2<A5;A2++){An(A7[A2].title,A7[A2].widgets,A2,A6,A0)}if(A0){var Ay,A1,Ax,A4;Am.sortable({helper:"clone",opacity:1,axis:"x",items:"li:not('.js-tab-add')",cancel:".js-edit-tab-button, .js-remove-tab-button",start:function(){old_numidx_to_controls={};new_controls_to_numidx={};Aq.find(".js-admin-widget-tab").each(function(A8,A9){old_numidx_to_controls[A8]=AT(this).attr("id")})},stop:function(){Am.find("li:not('.js-tab-add')").each(function(A9,BD){var BA=AT(this),BC=BA.attr("aria-controls"),BB=Aq.find(".js-admin-widget-tab[id='"+BC+"']");if(BB.length){BB.data("tab-number",A9);Aq.append(BB)}new_controls_to_numidx[BC]=A9});Aq.tabs("refresh");var A8=function(A9){A6=new_controls_to_numidx[old_numidx_to_controls[A6]];A9.default_tab=A6;var BC={};for(var BD in A9.display_tabs){var BA=new_controls_to_numidx[old_numidx_to_controls[BD]],BB=A9.display_tabs[BD];BC[BA]=BB}A9.display_tabs=BC;A9.tab_data=f(Ar);if(!AT.isEmptyObject(A9)){Z(Ar,A9)}};AK(Ar,A8)},})}else{Aw.hide()}};AK(Ar,At,true);Ar.data("tabbed-container-initialized",true)}function I(Ak,Al){var Aj=AT(".js-canvas-layout-container > .canvas-layout").attr("id");if(!vBulletin.sitebuilder.tempModuleHTMLCache){vBulletin.sitebuilder.tempModuleHTMLCache={};AT(".js-canvas-layout-container .canvas-widget").each(function(){var Am=AT(this).data("widget-instance-id");vBulletin.sitebuilder.tempModuleHTMLCache["widgetinstance_"+Am]=this.outerHTML})}AT(".js-canvas-layout-container").text("");vBulletin.AJAX({call:"/ajax/get-layouts-for-sitebuilder",data:{pagetemplateid:pageData.pagetemplateid,channelid:pageData.channelid},success:function(Am){console.log("ajax/get-layouts-for-sitebuilder result:");console.dir(Am);var An=AT(".js-canvas-layout-container");An.html(Am.screenlayoutlist);if(Am.widgets&&Am.widgets.length>0){var Ao=AT("#"+Aj);AT.each(Am.widgets,function(Ap,Aq){var Ar=Ao.find(".canvas-widget-list.section-"+Ap);AT.each(Aq,function(As,Au){Ar.append(Au.rendered_template);var At=Ar.find(".canvas-widget").filter(function(){return AT(this).data("widget-instance-id")==Au.widgetinstanceid});if(typeof Au.subModules!="undefined"){AU(At,Au.subModules)}h(At)})})}if(vBulletin.inlinemod&&vBulletin.inlinemod.initModMenuHover){vBulletin.inlinemod.initModMenuHover()}if(typeof Al=="function"){Al()}},title_phrase:"sitebuilder",error_phrase:"unable_to_load_layouts"})}function L(Al,An){var Aj=An.enableButtons,Am=AT(".js-top-menu-sitebuilder--list .js-top-menu-link");if(Aj){AT(".js-top-menu-user").removeClass("h-hide");Am.removeClass("b-top-menu__item-link--selected b-top-menu__item-link--disabled")}else{var Ak=AT(An.currentButton);Am.removeClass("b-top-menu__item-link--selected").addClass("b-top-menu__item-link--disabled");Ak.addClass("b-top-menu__item-link--selected");AT(".js-top-menu-user").addClass("h-hide")}}AT(document).on("vb-toggle-sitebuilder-menu",L);function Ae(Am){var Al=AT(Am.target),Aj=Al.data("panel-name");if(Al.is(".b-top-menu__item-link--disabled")){this.blur();Am.stopPropagation();return false}if(Al.is(".js-top-menu-tab--admincp")){return true}var Ak="vb-sitebuilder-panel--"+Aj;AT(document).trigger(Ak);return false}AT(document).on("click",".js-top-menu-sitebuilder--list .js-top-menu-link",Ae);function AV(Al,Ak){var Aj=AT(".js-top-menu-sitebuilder .js-top-menu-link");L(null,{enableButtons:!Ak,currentButton:Al});AT(document.body).toggleClass("edit-mode "+Al.id,Ak).toggleClass("view-mode",!Ak);AT(".js-top-menu-user").toggleClass("h-hide",Ak)}function d(){if(!AT(this).hasClass("selected")&&!AT(document.body).hasClass("edit-mode")){AV(this,true)}return false}vBulletin.sitebuilder.activateSB=d;function D(){AV(this,false);return false}function Y(Al,Ak){var Aj=AT("<div />").append(Al.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,'<span class="axd-placeholder">{0}'.format(vBulletin.phrase.get("x_will_show_up_here_when_saved",Ak))).replace(/<vb\:/g,"&lt;vb:").replace(/<\/vb\:/g,"&lt;/vb:"));Aj.find("span.axd-placeholder").not(":first").remove();Aj.find("iframe").remove();return Aj.html()}function AR(){var At=null,Am=null,An=null,Ao="",Av="",Ay="",Ax="";var Az=function(A0){if(!A0){A0=""}if(A0.match(/^https?:\/\//i)){return A0}if(A0.substr(0,1)=="/"){return pageData.baseurl+A0}return pageData.baseurl+"/"+A0};var As=function(A6,A2,A3,A5,A0,A1){A0=A0||[];console.log("createNavbarItem... Name: "+A2+" Url: "+A3+" NewWindow: "+A5+" UserGroups: "+A0+" itemAttr: "+A1);A2=JShtmlEncode(A2);var A4=AT("<li />").append("<label>{0}</label>".format(A2)).append(AT("<div />").addClass("nav-item-controls h-right").append('<i>|</i><span class="navbar-item-delete b-icon b-icon__trash b-icon--active" title="{0}"></span>'.format(vBulletin.phrase.get("delete"))).append('<i>|</i><span class="navbar-item-edit b-icon b-icon__pencil b-icon--active" title="{0}"></span>'.format(vBulletin.phrase.get("edit"))).append('<i>|</i><span class="navbar-item-opensubnav b-icon b-icon__arrow-right-m" title="{0}"></span>'.format(vBulletin.phrase.get("expand")))).data({"item-phrase":A6,"item-name":A2,"item-url":A3,"item-newwindow":A5,"item-usergroups":A0,"item-attr":A1});return A4};var Aj=function(A0){return A0.prevAll("li").size()};var Ak=function(){var A1=(Ax=="navbar"),A0=A1?AT("#channel-tabbar ul"):AT("#footer-tabbar ul.nav-list"),A2=A1?AT("#channel-subtabbar ul"):AT();A0.html("");A2.html("");var A3=function(A9,A7,A4){var A6=A7.data("item-newwindow")?' target="_blank"':"",A8=A7.hasClass("selected")&&A4?' class="current"':"",A5=AT("<li{0}><a {1}>{2}</a></li>".format(A8,A6,A7.data("item-name")));A5.find("a").prop("href",Az(A7.data("item-url")));A9.append(A5)};AT("#edit-navbar .navbar-ui-wrapper ul li").each(function(){var A4=AT(this);A3(A0,A4,A1);if(A4.hasClass("selected")){AT(A4.data("subnav-element")).find("li").each(function(){A3(A2,AT(this),true)})}})};var Aw=function(A6,A8,A1,A2,A4,A7,A3){var A0=As(A6,A8,A1,A2,A4,A3);console.log("insertNavbarItem... Name: "+A0.data("item-name")+" Url: "+A0.data("item-url")+" NewWindow: "+A0.data("item-newwindow")+" UserGroups: "+A0.data("item-usergroups")+" itemAttr: "+A0.data("item-attr"));A0.appendTo(Am);var A5=AT("<ul />").addClass("sub-navbar-list navbar-list sortable");AT(A7).each(function(){var BF=this.phrase?this.phrase:"",BA=this.title?this.title:"",BD=this.url?this.url:"",BE=this.newWindow?this.newWindow:false,A9=this.usergroups?this.usergroups:[],BC=this.attr?this.attr:"";var BB=As(BF,BA,BD,BE,A9,BC);BB.appendTo(A5)});(function(){var A9=null;A5.sortable({start:function(BA,BB){BB.placeholder.html(vBulletin.phrase.get("drop_page_here")).height(BB.item.height()-2)},stop:function(BA,BB){Ak()},receive:function(BA,BB){var BC=BB.item.data("subnav-element")||AT();if(BC.is(":visible")){BB.sender.sortable("cancel");vBulletin.warning("move_not_allowed","moving_main_nav_to_own_sub_nav_error")}else{if(BC.find("li").length>0){BB.sender.sortable("cancel");vBulletin.warning("move_not_allowed","moving_main_nav_with_sub_nav_error")}}},connectWith:".sortable",placeholder:"sortable-highlight",forcePlaceholderSize:true}).disableSelection()})();A5.hide();A5.appendTo("#navbar-ui-container .subnavbar-list-container");A0.data("subnav-element",A5);Ak()};var Aq=function(A1,A3,A4,A5,A0,A2){$newItem=As(A1.data("item-phrase"),A3,A4,A5,A0,A2);console.log("updateNavbarItem... Name: "+$newItem.data("item-name")+" Url: "+$newItem.data("item-url")+" NewWindow: "+$newItem.data("item-newwindow")+" itemAttr: "+$newItem.data("item-attr"));if(A1.data("subnav-element")){$newItem.data("subnav-element",A1.data("subnav-element"))}if(A1.hasClass("selected")){$newItem.addClass("selected")}A1.replaceWith($newItem);Ak()};var Ar=function(A1){Ax=A1;if(Ax=="navbar"){Ao=AT("#channel-tabbar ul").html();Av=AT("#channel-subtabbar ul").html();Ay=AT("#channel-tabbar ul li.current a").attr("href");AT("#channel-subtabbar.h-hide").toggleClass("h-hide default-hide")}else{Ao=AT("#footer-tabbar ul.nav-list").html();Ay=AT("#footer-tabbar ul.nav-list li.current a").attr("href")}AT("#admin-navbar-strip-gutter").removeClass().addClass("navbar-"+Ax);AT("#header").add("#header-axd").hide();AT("#navbar-ui-container").find(".navbar-ui-wrapper, .subnavbar-ui-wrapper").remove();var A0=AT("#edit-navbar");A0.find(".panel-header-text").hide();AT("#edit-navbar #panel-header-"+Ax).show();A0.slideDown("slow",function(){vBulletin.AJAX({call:"/ajax/api/site/"+(Ax=="navbar"?"loadHeaderNavbar":"loadFooterNavbar"),data:({siteId:1,edit:1}),success:function(A2){var A5=AT("<ul />").addClass("main-navbar-list navbar-list sortable "+Ax),A4=AT("<div />").addClass("new-nav-item main-nav").html(vBulletin.phrase.get("new_navigation_item")),A3=AT("<h4 />").text(vBulletin.phrase.get("main_navigation_bar"));AT("<div />").addClass("navbar-ui-wrapper").append(A3).append(A5).append(A4).appendTo("#navbar-ui-container");var A8=null;A5.sortable({start:function(BA,BB){BB.placeholder.html(vBulletin.phrase.get("drop_page_here")).height(BB.item.height()-2)},stop:function(BA,BB){Ak()},connectWith:".sortable",placeholder:"sortable-highlight",forcePlaceholderSize:true}).disableSelection();Am=A5;var A9=AT("<div />").addClass("subnavbar-list-container"),A7=AT("<div />").addClass("new-nav-item sub-nav").html(vBulletin.phrase.get("new_subnavigation_item")),A6=AT("<h4 />").text(vBulletin.phrase.get("sub_navigation_bar"));AT("<div />").addClass("subnavbar-ui-wrapper").append(A6).append(A9).append(A7).appendTo("#navbar-ui-container").hide();if(A2){console.log("result:",A2);AT(A2).each(function(){var BG=this.phrase?this.phrase:"",BB=this.title?this.title:"",BE=this.url?this.url:"",BF=this.newWindow?true:false,BA=this.usergroups?this.usergroups:[],BD=this.subnav?this.subnav:[],BC=this.attr?this.attr:"";Aw(BG,BB,BE,BF,BA,BD,BC)})}AT("#edit-navbar .navbar-ui-wrapper ul li").first().find(".navbar-item-opensubnav").filter(":visible").click()},error_phrase:"error_retrieving_navigation_bar_configuration"})})};AT(document).on("vb-sitebuilder-panel--navbar",function(){var A0=AT(".js-top-menu-tab--navbar").get(0);if(AT("#edit-navbar").is(":hidden")){vBulletin.assertUserHasAdminPermission("canusesitebuilder",A0,function(){d.apply(A0);Ar("navbar")})}return false});AT(document).on("vb-sitebuilder-panel--footer",function(){var A0=AT(".js-top-menu-tab--footer").get(0);if(AT("#edit-navbar").is(":hidden")){vBulletin.assertUserHasAdminPermission("canusesitebuilder",A0,function(){d.apply(A0);Ar("footer")})}return false});var Ap=function(A0){AT("#navbar-edit-item").dialog({autoOpen:true,modal:true,resizable:false,closeOnEscape:false,showCloseButton:false,width:400,dialogClass:"dialog-container navbar-item-dialog-container",open:function(){AT("#navbar-edit-name").focus()}}).dialog("option","title",A0||vBulletin.phrase.get("edit_navigation_item")).dialog("open")};AT("#edit-navbar").on("click",".new-nav-item",function(){At=null;if(AT(this).closest(".navbar-ui-wrapper").size()>0){Am=AT(this).closest(".navbar-ui-wrapper").find("ul")}else{Am=AT(this).closest(".subnavbar-ui-wrapper").find("ul").filter(":visible")}AT("#navbar-edit-name").val("");AT("#navbar-edit-url").val("");AT("#navbar-edit-attr").val("");AT("#navbar-edit-newwindow").prop("checked",false);Ap(AT(this).html());return false});AT(document).on("click","#navbar-edit-save",function(){if(AT("#navbar-edit-name").val()==""){vBulletin.warning("edit_navigation_item","input_navigation_item_name",function(){AT("#navbar-edit-name").focus()})}else{if(AT("#navbar-edit-url").val()==""){vBulletin.warning("edit_navigation_item","input_target_url",function(){AT("#navbar-edit-url").focus()})}else{console.log("Saving new/edited navbar item");if(!At){Aw("",AT("#navbar-edit-name").val(),AT("#navbar-edit-url").val(),AT("#navbar-edit-newwindow").prop("checked"),AT("#navbar-edit-item").data("edit-usergroups"),[],AT("#navbar-edit-attr").val())}else{Aq(At,AT("#navbar-edit-name").val(),AT("#navbar-edit-url").val(),AT("#navbar-edit-newwindow").prop("checked"),AT("#navbar-edit-item").data("edit-usergroups"),AT("#navbar-edit-attr").val())}At=null;Am=null;AT("#navbar-edit-item").dialog("close");console.log("Done saving new/edited navbar item")}}return false});AT(document).on("click","#navbar-edit-cancel",function(){AT("#navbar-edit-item").dialog("close");return false});var Al=false;AT(document).on("click","#navbar-edit-usergroups",function(){var A1=function(){var A5=AT("#navbar-edit-usergroups-dialog .select_all"),A2=AT("#navbar-edit-usergroups-dialog .navbar-usergroup-checkbox");A2.prop("checked",false);var A3=function(){var A6=(A2.filter(":checked").length==A2.length&&A2.eq(0).is(":checked"));A5.prop("checked",A6)};A2.off("change").on("change",A3);A5.off("change").on("change",function(){A2.prop("checked",AT(this).prop("checked"))});if(!At){return false}console.log("Prefilling checked usergroups");console.log(At.data("item-name"));console.log(At.data("item-url"));console.log(At.data("item-usergroups"));if(At.data("item-usergroups-temp")){var A4=At.data("item-usergroups-temp")}else{var A4=At.data("item-usergroups")}console.log(A4);AT.each(A4,function(A6,A7){AT("#navbar-usergroup-checkbox-"+A7).prop("checked",true)});A3()};var A0=function(){var A2=[];AT("#navbar-edit-usergroups-dialog .dialog-body input[type=checkbox]").each(function(){if(AT(this).prop("checked")){A2.push(AT(this).val())}});AT("#navbar-edit-item").data("edit-usergroups",A2);if(At){At.data("item-usergroups-temp",A2)}console.log("Saving checked usergroups")};if(!Al){AT("#navbar-edit-usergroups-dialog").dialog({title:vBulletin.phrase.get("user_group_settings"),autoOpen:true,modal:true,resizable:false,closeOnEscape:false,showCloseButton:false,width:500,dialogClass:"dialog-container pagemap-dialog-container input-dialog",create:function(){AT("#navbar-edit-usergroups-dialog .cancel-button").on("click",function(){AT("#navbar-edit-usergroups-dialog").dialog("close")});AT("#navbar-edit-usergroups-dialog .save-button").on("click",function(){A0();AT("#navbar-edit-usergroups-dialog").dialog("close")});vBulletin.AJAX({call:"/ajax/api/usergroup/fetchUsergroupList",complete:function(){AT("body").css("cursor","auto")},success:function(A2){var A3=[];AT(A2).each(function(){A3.push('<div class="blockrow"><label><input type="checkbox" class="navbar-usergroup-checkbox" id="navbar-usergroup-checkbox-{0}" value="{0}"><span>{1}</span></label></div>'.format(this.usergroupid,this.title))});AT("#navbar-edit-usergroups-dialog .dialog-body").html(A3.join(""));AT("#navbar-edit-usergroups-dialog").dialog("option","position",{of:window});console.log("Done adding usergroups");A1()},error_phrase:"error_retrieving_list_user_groups",after_error:function(){AT("#navbar-edit-usergroups-dialog").dialog("close")}})},close:function(){},open:function(){A1()}});Al=true}else{AT("#navbar-edit-usergroups-dialog").dialog("open")}return false});AT("#edit-navbar").on("click",".navbar-item-delete",function(){AT(this).closest("li").remove();Ak();return false});AT("#edit-navbar").on("click",".navbar-item-edit",function(){var A0=AT(this).closest("li");console.log("Click to edit item... Name: "+A0.data("item-name")+" Url: "+A0.data("item-url")+" NewWindow: "+A0.data("item-newwindow")+" UserGroups: "+A0.data("item-usergroups"));At=A0;Am=A0.closest("ul");At.data("item-usergroups-temp",null);AT("#navbar-edit-name").val(A0.data("item-name"));AT("#navbar-edit-url").val(A0.data("item-url"));AT("#navbar-edit-attr").val(A0.data("item-attr"));AT("#navbar-edit-newwindow").prop("checked",A0.data("item-newwindow"));Ap(AT(this).html());return false});AT("#edit-navbar").on("click",".navbar-item-opensubnav",function(){var A2=AT(this),A3=A2.closest("li"),A1=AT("#edit-navbar"),A0=A1.find(".subnavbar-ui-wrapper");console.log("Click to open item subnav ... Name: "+A3.data("item-name")+" Url: "+A3.data("item-url")+" NewWindow: "+A3.data("item-newwindow")+" UserGroups: "+A3.data("item-usergroups"));A1.find("li").removeClass("h-disabled selected");A1.find(".navbar-item-opensubnav").removeClass("b-icon--active");A3.addClass("selected");A2.addClass("b-icon--active");A0.find("ul").hide();AT(A3.data("subnav-element")).show();A0.show();Ak();return false});AT(document).on("click",".navbar-navbar #admin-navbar-strip .lnkExitWithoutSaving, .navbar-footer #admin-navbar-strip .lnkExitWithoutSaving",function(){AT("#edit-navbar").slideUp();AT("#header").add("#header-axd").show();if(Ax=="navbar"){AT("#channel-tabbar ul").html(Ao);AT("#channel-subtabbar ul").html(Av).parent(".default-hide").toggleClass("h-hide default-hide")}else{AT("#footer-tabbar ul.nav-list").html(Ao)}});var Au=function(){var A0=[];AT("#edit-navbar .navbar-ui-wrapper ul li").each(function(){var A4=AT(this);var A2=function(A5){return{phrase:A5.data("item-phrase"),title:A5.data("item-name"),url:A5.data("item-url"),newWindow:A5.data("item-newwindow"),usergroups:A5.data("item-usergroups"),attr:A5.data("item-attr")}};var A3=[];A4.data("subnav-element").find("li").each(function(){$subLi=AT(this);A3.push(A2($subLi))});var A1=A2(A4);A1.subnav=A3;A0.push(A1)});vBulletin.AJAX({call:"/ajax/api/site/"+(Ax=="navbar"?"saveHeaderNavbar":"saveFooterNavbar"),data:({siteId:1,data:A0}),success:function(A2){AT("#edit-navbar").slideUp();AT("#header").add("#header-axd").show();AT("#admin-navbar-strip-gutter").addClass("h-hide");AT(document.body).removeClass("edit-mode lnkEditPage lnkNewPage lnkHeader lnkNavBar lnkFooter").addClass("view-mode");L(null,{enableButtons:true,currentButton:null});if(Ax=="navbar"){var A1=false;AT("#edit-navbar .navbar-ui-wrapper ul li").each(function(){var A3=AT(this);if(Az(A3.data("item-url"))==Az(Ay)){A1=true;AT("#edit-navbar .navbar-ui-wrapper ul li").removeClass("selected");A3.addClass("selected");return false}});if(A1){Ak()}else{AT("#channel-tabbar ul li").removeClass("current");AT("#channel-subtabbar ul").html("")}}},error_phrase:"error_saving_navigation_bar_configuration"})};AT(document).on("click","#admin-navbar-strip .lnkSaveChanges",function(){Au()})}function AJ(){bindFormReset("#edit-page-dropdown form").trigger("reset",function(){AT("#save-content .template-name").addClass("h-hide");AT("input[type=hidden]",this).each(function(){this.value=this.defaultValue})});AT(".js-top-menu-sitebuilder--list .js-top-menu-link").removeClass("b-top-menu__item-link--disabled");AT(document).on("click","#sitebuilder-wrapper .lnkExitWithoutSaving",function(){if(AT(this).closest("#edit-page-dropdown").length==0){L(null,{enableButtons:true,currentButton:null})}});AT(document).on("vb-sitebuilder-panel--channels",function(){var Aq=AT(".js-top-menu-tab--channels").get(0);vBulletin.assertUserHasAdminPermission("canusesitebuilder",Aq,function(){d.apply(Aq);X(false);AT(".edit-mode .canvas-widget-list .canvas-widget").addClass("shadow");AT("#header, #header-axd, #save-content").hide();AT("#manage-page").show();AT("#edit-page-dropdown .lnkDeletePage").removeClass("h-hide");AT("#manage-page-dropdown").removeClass("h-hide").slideDown("slow",AC)});return false});function Ao(){var Aq=AT(".js-sbpanel-pagelist-wrapper");Aq.find(".tab-item a").on("click",function(Ar){Ar.preventDefault()});Aq.tabs()}function An(){var At=AT(".js-sbpanel-pagelist-wrapper"),Ar=At.find(".js-delayed-template-render-insert-here"),As=At.find(".js-loading-placeholder"),Aq={};At.find(".js-simple-pagination-wrapper").each(function(){var Au=AT(this);Aq[Au.attr("id")]=Au.find(".js-pagenum").val()||0});At.tabs("disable");Ar.html("");As.removeClass("h-hide");vBulletin.AJAX({call:"/ajax/render/admin_sbpanel_pagelist_content_wrapper",success:function(Au){Ar.html(Au);At.tabs("refresh");At.tabs("enable");At.find(".js-simple-pagination-wrapper").each(function(){var Av=AT(this);Am(Av,Aq[Av.attr("id")]);Aj(Av);Ap(Av)})},error_phrase:"error_fetching_dialog",complete:function(){As.addClass("h-hide")}})}AT(document).on("vb-sitebuilder-panel--pages",function(){var Aq=AT(".js-top-menu-tab--pages").get(0),Ar=AT(".js-sbpanel-pagelist-wrapper");if(!Ar.data("panel-initialized")){Ar.data("tabspanel-initialized",true);Ao()}vBulletin.assertUserHasAdminPermission("canusesitebuilder",Aq,function(){if(Ar.hasClass("h-hide")){d.apply(Aq);Ar.removeClass("h-hide").slideDown("slow");An()}else{D.apply(Aq);Ar.slideUp("fast",function(){Ar.addClass("h-hide")})}});return false});AT(document).on("click",".js-sbpanel-pagelist-wrapper .js-button--close-panel",function(){var Aq=AT("#lnkPageList")[0],Ar=AT(".js-sbpanel-pagelist-wrapper");if(!Ar.hasClass("h-hide")){D.apply(Aq);Ar.slideUp("fast",function(){Ar.addClass("h-hide")})}});function Aj(Ar){var Aq=Ar.data("select-all-checkboxes-initialized")||false;if(Aq){console.log({msg:"Skipping checkbox init because it's already done.",$wrapper:Ar,});return }else{Ar.data("select-all-checkboxes-initialized",true)}Ar.find(".js-checkbox--checkall").each(function(){var As=AT(this),Au=As.data("group-id"),Aw=Ar.find(".js-checkbox[data-group-id='"+Au+"']"),Av=Aw.length,At=Aw;As.on("change",function(Ax){var Ay=AT(this).prop("checked");As.prop("indeterminate",false);if(Ay){Aw.prop("checked",true)}else{Aw.prop("checked",false)}});Aw.on("change",function(Ax){var Az=AT(this).prop("checked"),Ay=Aw.filter(":checked").length;if(Av>Ay){if(As.prop("checked")&&Ay>0){As.prop("indeterminate",true)}As.prop("checked",false)}else{As.prop("indeterminate",false);As.prop("checked",true)}})})}function Ap(Ar){var Aq=Ar.data("actions-initialized")||false;if(Aq){console.log({msg:"Skipping actions init because it's already done.",$wrapper:Ar,});return }else{Ar.data("actions-initialized",true)}Ar.find(".js-delete-orphaned-pagetemplates").on("click",function(As){var Aw=AT(this),Au=Aw.data("group-id"),At=Ar.find(".js-checkbox[data-group-id='"+Au+"']:checked"),Av={};At.each(function(){Av[this.name]=AT(this).val()});if(At.length<1){vBulletin.error("error","delete_orphaned_pagetemplates_please_select_one")}else{openConfirmDialog({title:vBulletin.phrase.get("delete"),message:vBulletin.phrase.get("delete_orphaned_pagetemplates_prompt_x",At.length),iconType:"warning",onClickYes:function(){vBulletin.AJAX({call:"/ajax/api/page/deleteOrphanedPagetemplates",data:At.serializeArray(),success:function(Ax){console.log({msg:"/ajax/api/widget/deleteOrphanedPagetemplates success!",result:Ax,});An()}})}})}})}function Am(Av,Aw){var At=Av.data("pagination-initialized")||false;if(At){console.log({msg:"Skipping pagination init because it's already done.",$wrapper:Av,});return }else{Av.data("pagination-initialized",true)}var Aq=Av.find(".js-pagenav-goprev");var Ax=Av.find(".js-pagenav-gopost");var Ar=Av.find(".js-pagenum");var Aw=(Aw&&parseInt(Aw,10))||parseInt(Ar.val(),10);var Ay=Av.find(".js-paginated-page");var Au={};var Az=0;Ay.each(function(){Az++;Au[Az]=AT(this)});Ar.on("blur keyup",function(A1){if(A1.type=="blur"||A1.keyCode=="13"){var A0=parseInt(Ar.val(),10);As(A0)}});Aq.on("click",function(A1){var A0=parseInt(Ar.val(),10);A0--;As(A0)});Ax.on("click",function(A1){var A0=parseInt(Ar.val(),10);A0++;As(A0)});function As(A0){if(A0<1){A0=1}if(A0>Az){A0=Az}Ay.addClass("h-hide");if(Au[A0]){Au[A0].removeClass("h-hide")}Ar.val(A0)}As(Aw)}AT(document).on("vb-sitebuilder-panel--editpage",function(){var Aq=AT(".js-top-menu-tab--editpage").get(0);if(AT("#edit-page-dropdown-gutter").is(":hidden")){vBulletin.assertUserHasAdminPermission("canusesitebuilder",Aq,function(){function Ar(){s=false;As();M();X(false,".container-widget");AT(".edit-mode .canvas-widget-list .canvas-widget").addClass("shadow");e.tabs("option","active",0);AT("#header, #header-axd, #save-content").hide();AT("#edit-content").show();AT("#edit-page-dropdown .lnkSaveChanges .label").text(vBulletin.phrase.get("save_page"));AT("#edit-page-dropdown .lnkDeletePage").removeClass("h-hide");AT("#edit-page-dropdown-gutter").removeClass("h-hide").slideDown("slow",Q);AT(".canvas-widget.axd-widget .widget-content").each(function(){AT(this).html(Y(AT(this).html(),vBulletin.phrase.get("ad")))})}function As(){var At=[];AT(".hidden-widget-placeholder").each(function(){At.push(AT(this).attr("data-widget-instance-id"))});if(At.length<1){return }vBulletin.AJAX({call:"/ajax/fetch-hidden-modules",data:({modules:At}),complete:function(){Ar()},success:function(Au){if(Au.length>0){AT.each(Au,function(Av,Ax){var Aw=AT(Ax.template).addClass("hidden-widget");AT('.hidden-widget-placeholder[data-widget-instance-id="'+Ax.widgetinstanceid+'"]').replaceWith(Aw)})}}})}d.apply(Aq);I(false,Ar)})}return false});AT(document).on("vb-sitebuilder-panel--newpage",function(){var Aq=AT(".js-top-menu-tab--newpage").get(0);if(AT("#edit-page-dropdown-gutter").is(":hidden")){vBulletin.assertUserHasAdminPermission("canusesitebuilder",Aq,function(){function Ar(){s=true;AT(".canvas-widget-list").empty();e.tabs("option","active",0);AT("#change-layout .layout-border.selected").removeClass("selected");AT("#layout-wide-narrow").prev().trigger("click");r=false;AT("#header, #header-axd, #save-content").hide();AT("#edit-content").show();AT("#edit-page-dropdown .lnkSaveChanges .label").text(vBulletin.phrase.get("save_new_page"));AT("#edit-page-dropdown .lnkDeletePage").addClass("h-hide");AT("#edit-page-dropdown-gutter").removeClass("h-hide").slideDown("slow",Q)}d.apply(Aq);I(true,Ar)})}return false});var Al=false;AT(document).on("vb-sitebuilder-panel--header",function(){var Aq=AT(".js-top-menu-tab--header").get(0);if(AT("#admin-navbar-strip-gutter").is(":hidden")){vBulletin.assertUserHasAdminPermission("canusesitebuilder",Aq,function(){d.apply(Aq);Al=false;AT("#admin-navbar-strip-gutter").addClass("navbar-header").removeClass("h-hide").find(".prompt-text").text(vBulletin.phrase.get("select_edit_link_header"));var Ar=AT("#header"),As=AT(".header-cell",Ar);$siteLogoEditStrip=AT("> .admin-only",As).addClass("h-hide-imp"),w=As.outerWidth();AT(".disable-overlay",Ar).width(Ar.innerWidth()-w).height(Ar.innerHeight()).show();$siteLogoEditStrip.width(w-(parseInt($siteLogoEditStrip.css("padding-left"),10)+parseInt($siteLogoEditStrip.css("padding-right"),10))).removeClass("h-hide-imp");AT(document).on("focus click mousedown",".edit-mode.lnkHeader #header .site-logo > a",function(At){this.blur();At.stopPropagation();return false})})}return false});AR();AT(".js-top-menu-sitebuilder").removeClass("h-hide");AT(document).on("click",".lnkHeader #admin-navbar-strip .lnkSaveChanges",function(){AT("body").css("cursor","wait");if(Number(AT("#header .site-logo img").attr("data-fileid"))>0){var Aq=Al?function(){location.reload(true)}:null;AG(Aq)}else{if(Al){location.reload(true)}else{AT("body").css("cursor","auto");AT("#admin-navbar-strip-gutter").addClass("h-hide").find(".prompt-text").text("");AT(document.body).removeClass("edit-mode lnkHeader").addClass("view-mode");AT("#header .disable-overlay").hide();L(null,{enableButtons:true,currentButton:null})}}});AT(document).on("click",".lnkHeader #admin-navbar-strip .lnkExitWithoutSaving",function(Ar){if(Al){Ar.stopImmediatePropagation();location.reload(true);return false}else{var Aq=AT("#header .site-logo img");if(Aq.attr("src")!=Aq.attr("data-orig-src")){Aq.attr("src",Aq.attr("data-orig-src")).removeAttr("data-fileid")}AT("#admin-navbar-strip-gutter").find(".prompt-text").text("");AT("#header .disable-overlay").hide();L(null,{enableButtons:true,currentButton:null})}});AT(document).on("click","#admin-navbar-strip .lnkExitWithoutSaving",function(){AT("#admin-navbar-strip-gutter").addClass("h-hide");AT(document.body).removeClass("edit-mode lnkEditPage lnkNewPage lnkHeader lnkNavBar lnkFooter").addClass("view-mode");AT("#header").add("#header-axd").show();AT("#edit-navbar").hide();L(null,{enableButtons:true,currentButton:null})});AT("#header-axd .axdnum").change(function(){var Aq=AT(this),Ar=parseInt(Aq.val());window.vBulletin.loadingIndicator.show();vBulletin.AJAX({call:"/ajax/api/ad/saveNumberOfHeaderAds",data:{number:Ar},success:function(As){if(Ar==1){AT("#header-axd").removeClass("axdnum_2").addClass("axdnum_1")}else{AT("#header-axd").removeClass("axdnum_1").addClass("axdnum_2")}},complete:function(){window.vBulletin.loadingIndicator.hide()}})});AT(document).off("click",".axd-edit-button").on("click",".axd-edit-button",function(){var Ar=AT(this).attr("data-location"),Aw=AT(this).closest(".axd-container");if(Aw.length==0){Aw=AT('.axd-container[data-widget-instance-id="'+Ar+'"]')}Av();function Av(Ax){Ax=Ax||false;AT("body").css("cursor","wait");vBulletin.AJAX({call:"/ajax/api/ad/listAdsByLocation",data:{adlocation:Ar},cache:false,success:As,emptyResponse:function(){if(!Ax){At({adlocation:Ar})}else{As([])}},complete:function(){AT("body").css("cursor","default")}})}function As(Ax){if(typeof g.axd_list_dialog=="undefined"){vBulletin.AJAX({call:"/ajax/render/dialog_axd_list",success:function(Ay){g.axd_list_dialog=Ay;AT("body").append(Ay);As(Ax)},error_phrase:"error_fetching_dialog"});return }AT("#axd-list-dialog").dialog({title:vBulletin.phrase.get("manage_ads"),autoOpen:true,modal:true,resizable:false,closeOnEscape:false,showCloseButton:false,width:600,dialogClass:"dialog-container ad-list-dialog-container input-dialog",open:function(){var Ay=AT(this),A0=[];var A1=function(){Ay.dialog("close");Ay.dialog("destroy")};for(var Az in Ax){A0.push([Ax[Az].title,Ax[Az].active,Ax[Az].displayorder,Ax[Az].adid])}AT(".title",Ay).text(vBulletin.phrase.get("ad_list_description"));AT(".axdtable",Ay).dataTable({bPaginate:false,bLengthChange:false,bInfo:false,bAutoWidth:false,bDestroy:true,aaSorting:[[2,"asc"]],aoColumns:[{sTitle:vBulletin.phrase.get("title")+"<span></span>",sClass:"axdtable-title axd-cell"},{sTitle:vBulletin.phrase.get("active"),sClass:"axdtable-active axd-cell",bSortable:false,bSearchable:false,fnRender:function(A3,A2){return'<input type="checkbox" class="isactive" data-id="{0}"{1} />'.format(A3.aData[3],((A2=="1")?' checked="checked"':""))}},{sTitle:vBulletin.phrase.get("display_order")+"<span></span>",sClass:"axdtable-display-order axd-cell",bSearchable:false,bUseRendered:false,fnRender:function(A3,A2){return'<input type="text" class="displayorder textbox" value="{0}" data-id="{1}" />'.format(A3.aData[2],A3.aData[3])}},{sTitle:vBulletin.phrase.get("action"),sClass:"axdtable-action axd-cell",bSearchable:false,bSortable:false,bUseRendered:false,fnRender:function(A3,A2){return'<a href="#" class="editlink" data-id="{0}" title="{1}"><span></span></a> <a href="#" class="deletelink" data-id="{0}" title="{2}"><span></span></a>'.format(A3.aData[3],vBulletin.phrase.get("edit"),vBulletin.phrase.get("delete"))}}],aaData:A0});AT(".dataTables_filter input[type=text]",Ay).addClass("axdfilter textbox").on("keyup",function(){AT(this).next()[this.value!=""?"removeClass":"addClass"]("h-hide")}).after('<button type="button" class="axdSearchBtn b-button b-button--secondary b-button--sitebuilder h-hide">{0}</button>'.format(vBulletin.phrase.get("reset")));AT(".axdSearchBtn",Ay).on("click",function(){AT(this).addClass("h-hide").prev().val("").trigger("keyup")});AT(".axdtable .editlink",Ay).off("click").on("click",function(){var A2=AT(this).attr("data-id");A1();At(Ax[A2]);return false});AT(".axdtable .deletelink",Ay).off("click").on("click",function(){var A2=AT(this).attr("data-id"),A3=AT(this).closest("tr").find(".isactive").prop("checked");A1();openConfirmDialog({title:vBulletin.phrase.get("confirm_deletion_x",Ax[A2].title),message:vBulletin.phrase.get("are_you_sure_want_to_delete_ad_x",Ax[A2].title,"adid",A2),iconType:"warning",onClickYes:function(){AT("body").css("cursor","wait");vBulletin.AJAX({call:"/ajax/api/ad/delete",data:{adid:A2},success:function(A4){Av(true);if(A3){Al=true}}})},onClickNo:function(){Av()}});return false});AT(".axdlist",Ay).show();AT(".btnAddAxd",Ay).off("click").on("click",function(){A1();At({adlocation:Ar});return false});AT(".btnCancelAxd",Ay).off("click").on("click",function(){A1()});AT(".btnSaveAxd",Ay).off("click").on("click",function(){if(AT(".isactive",Ay).length==0){A1();return false}AT("body").css("cursor","wait");var A2={},A3=[];AT(".isactive",Ay).each(function(){var A4=AT(this).attr("data-id");A2[A4]={};A2[A4]["displayorder"]=AT('.displayorder[data-id="'+A4+'"]',Ay).val();if(AT(this).is(":checked")){A2[A4]["active"]=1;var A5=A2[A4];A5.snippet=Ax[A4].snippet;A5.title=Ax[A4].title;A3.push(A5)}else{A2[A4]["active"]=0}});vBulletin.AJAX({call:"/ajax/api/ad/quickSave",data:{data:A2},success:function(A4){var A5=AT(".axd_"+Ar,Aw);if(A5.length==0){A5=AT(".widget-content",Aw)}if(A3.length>0){A3.sort(function(A9,A8){return A9.displayorder-A8.displayorder});var A7="",A6="";AT.map(A3,function(A9,A8){if(A9.snippet){A6+=Y(A9.snippet,A9.title);A7+=A9.snippet}});A5.html(A6);Al=Au(A7)}else{A5.html("")}A5.show();A1();AT("html,body").animate({scrollTop:0},"slow")},complete:function(){AT("body").css("cursor","default")}})})}})}function At(Ax){vBulletin.AJAX({call:"/ajax/render/dialog_axd_config",success:function(Ay){g.axd_config_dialog=Ay;AT("body").append(Ay);Aq(Ax)},error_phrase:"error_fetching_dialog"})}function Aq(Ay){var Ax=Ay.adlocation;AT("#axd-config-dialog").dialog({title:vBulletin.phrase.get(Ay.adid?["edit_ad_x",Ay.title]:"create_ad"),autoOpen:true,modal:true,resizable:false,closeOnEscape:false,showCloseButton:false,width:720,dialogClass:"dialog-container axd-dialog-container input-dialog",open:function(){var Az=AT(this);if(Ay.adid){AT(".title",Az).val(Ay.title);AT(".axd_html",Az).val(Ay.snippet);if(Ay.active=="1"){AT(".active",Az).prop("checked",true)}else{AT(".active",Az).prop("checked",false)}AT(".axdid",Az).val(Ay.adid);for(var A0 in Ay.criterias){AT("[name=data\\[criteria\\]\\["+Ay.criterias[A0].criteriaid+"\\]\\[active\\]]",Az).prop("checked",true);AT("[name=data\\[criteria\\]\\["+Ay.criterias[A0].criteriaid+"\\]\\[condition1\\]]",Az).val(Ay.criterias[A0].condition1);AT("[name=data\\[criteria\\]\\["+Ay.criterias[A0].criteriaid+"\\]\\[condition2\\]]",Az).val(Ay.criterias[A0].condition2);AT("[name=data\\[criteria\\]\\["+Ay.criterias[A0].criteriaid+"\\]\\[condition3\\]]",Az).val(Ay.criterias[A0].condition3)}}else{AT(".axdid",Az).val(0);AT(".configform",Az).trigger("reset")}AT(".axd_location",Az).val(Ax);AT(".blockrow select.custom-dropdown",Az).selectBox();AT(".blockrow a.custom-dropdown, .blockrow input[type=text]",Az).on("click",function(A2){return false});AT(".btnAttachHtmlAxd",Az).off("click").on("click",function(){var A2=AT(".configform",Az).serialize();AT("body").css("cursor","wait");vBulletin.AJAX({call:"/ajax/api/ad/save",data:A2,success:function(A3){A1();Al=Au(AT(".configform .axd_html",Az).val())},complete:function(){AT("body").css("cursor","default")}})});AT(".btnCancelEditHtmlAxd",Az).off("click").on("click",function(){A1(true)});function A1(A2){A2=A2||false;AT(":checkbox",Az).prop("checked",false);AT("select",Az).val("");Az.dialog("close");Az.dialog("destroy");AT("#axd-config-dialog").remove();Av(A2)}}})}function Au(Az){var Ay=AT("<div>"+Az+"</div>");if(Ay.filter("script").length>0){return true}else{var Ax=Ay.find("*").filter(function(){return(this.nodeName.toLowerCase().indexOf("vb:")==0)?this:null});return(Ax.length>0||(/\{vb\s*\:\s*[a-z]+\s+.*\}/).test(Az))}}return false});AT("#header .header-cell .js-edit-logo").on("click",function(){AT(".header-edit-box.selected").removeClass("selected");AT(this).closest(".header-edit-box").addClass("selected");AT("#edit-site-logo-dialog").dialog({title:vBulletin.phrase.get("edit_site_logo"),autoOpen:true,modal:true,resizable:false,closeOnEscape:false,showCloseButton:false,width:520,dialogClass:"dialog-container site-logo-dialog-container input-dialog",create:function(){var Aq=AT(this).closest(".ui-dialog").find(".ui-dialog-title");Aq.append('<span class="dialog-subtitle"></span>');Aq.children("span.dialog-subtitle").text(vBulletin.phrase.get("choose_options_site_logo"));AT("#btnCancelEditSiteLogo").on("click",function(){AT("#edit-site-logo-dialog").dialog("close")});AT("#btnSaveEditSiteLogo").on("click",function(){if(Number(AT("#header .site-logo img").attr("data-fileid"))>0){AG(function(){AT("#edit-site-logo-dialog").dialog("close")})}else{AT("#edit-site-logo-dialog").dialog("close")}});AT("#edit-site-logo-dialog .styleselection").change(function(){AT("#header .site-logo img").attr({"data-styleselection":AT(this).val()})});AT("#edit-site-logo-dialog").fileupload({dropZone:null,dataType:"json",add:function(As,Ar){AT("body").css("cursor","wait");AT(As.target).find(".js-upload-progress:first").removeClass("h-hide");Ar.submit()},done:function(As,Ar){if(Ar.result&&Ar.result.filedataid){AT("#header .site-logo img").attr({src:Ar.result.imageUrl,"data-fileid":Ar.result.filedataid,"data-styleselection":AT("#edit-site-logo-dialog .styleselection:checked").val()})}else{vBulletin.error("error","error_uploading_logo")}},fail:function(As,Ar){vBulletin.error("error","error_uploading_logo")},always:function(As,Ar){AT("body").css("cursor","auto");AT(As.target).find(".js-upload-progress:first").addClass("h-hide")}});AT("#edit-site-logo-dialog #btnAttachLogo").on("click",function(){var Ar=AT.trim(AT("#edit-site-logo-dialog #imageUrl").val());if(Ar){AT("body").css("cursor","wait");AT(this).closest(".dialog-content").find(".js-upload-progress:last").removeClass("h-hide");vBulletin.AJAX({call:"/uploader/Url",data:({urlupload:Ar}),complete:function(){AT("body").css("cursor","auto");AT("#edit-site-logo-dialog .js-upload-progress:last").addClass("h-hide")},success:function(As){AT("#header .site-logo img").attr({src:As.imageUrl,"data-fileid":As.filedataid,"data-styleselection":AT("#edit-site-logo-dialog .styleselection:checked").val()})},title_phrase:"edit_site_logo",error_phrase:"error_processing_site_logo",after_error:function(){AT("#edit-site-logo-dialog #imageUrl").focus()}})}else{AT("#edit-site-logo-dialog #imageUrl").focus()}})}})});AT(".admin-button-flat").disableSelection();var Ak=function(Aq){Ah()};e=AT("#edit-content .tabs").tabs({beforeActivate:function(Ar,As){AT("#save-content").hide();if(As.newTab.index()==1){if(k){AT("#edit-page-dropdown .layout-list .layout-border.selected").removeClass("selected");var Aq=AT("#edit-page-dropdown .layout-list input[type=radio][value={0}]".format(AT(".canvas-layout:visible").attr("data-layout-id")));Aq.prev().addClass("selected");Ab="canvas-"+Aq.attr("id")}}},create:function(Aq,Ar){Ak(Ar.tab.index())},activate:function(Aq,Ar){Ak(Ar.newTab.index())}});AT("#lnkAddModules").on("click",function(){e.tabs("option","active",0);return false});AQ();AT(document).on("click",".module-buttons .hide-icon input",function(){var Ar=AT(this);Ar.closest(".canvas-widget")[this.checked?"addClass":"removeClass"]("hidden-widget");var Aq=Ar.attr("title");Ar.attr("title",Ar.data("toggle-title")).data("toggle-title",Aq)});AT(".canvas-layout-container .canvas-layout").each(function(){z[this.id]=AT("#"+this.id+' div[class*="section-"]').length});if(!s){Ab="canvas-"+AT("#edit-page-dropdown .layout-list input[type=radio][value={0}]".format(AT(".canvas-layout:visible").attr("data-layout-id"))).prop("checked",true).attr("id")}AD=AT("#edit-page-dropdown .layout-list input[type=radio]").thumbnailRadioCheckbox({thumbnailClass:"layout-border"});AD.thumbnailRadioCheckbox("option","select",function(Ar,Aq){AT(".canvas-layout").addClass("h-hide");AT("#canvas-"+Aq.attr("id")).removeClass("h-hide");B("canvas-"+Aq.attr("id"));O();y();r=true})}function B(Am){if(!Ab){AT(".canvas-layout.h-hide input[type=hidden]").prop("disabled",true);AT("#"+Am+" input[type=hidden]").prop("disabled",false);Ab=Am;return }else{if(Ab==Am){return }else{AT(".canvas-layout.h-hide input[type=hidden]").prop("disabled",true);AT("#"+Am+" input[type=hidden]").prop("disabled",false);var Ak=z[Am];var Aj=false;var Al=0;AT("#"+Ab+" > .canvas-layout-row > .canvas-widget-list").each(function(){var Ar=AT(this);Aj=AP(Ar,AT("#"+Am+" > .canvas-layout-row > .canvas-widget-list"));if(!Aj.length){Al=J(this);Aj=AT("#"+Am+" > .canvas-layout-row > div.section-"+Al)}if(!Aj.length){var An=Ak;while(An>=0&&AT("#"+Am+" > .canvas-layout-row > div.section-"+An).length==0){An--}Aj=AT("#"+Am+" > .canvas-layout-row > div.section-"+An)}var Ap=Ar.children(".canvas-widget");var As=parseInt(Math.ceil(Ap.length/Aj.length),10);console.log("Moving {0} widgets to {1} sections; ChunkSize {2}".format(Ap.length,Aj.length,As));if(As>0){var Aq=0,Ao=0;Ap.each(function(){AT(this).appendTo(Aj.eq(Ao));++Aq;if(Aq>=As){Aq=0;++Ao}})}})}}Ab=Am}function AP(Aj,Al){var An=["js-sectiontype-notice","js-sectiontype-primary","js-sectiontype-secondary","js-sectiontype-extra"],Ak,Am;for(Ak in An){if(Aj.is("."+An[Ak])){Am=An[Ak];break}}return Al.filter(function(){return AT(this).is("."+Am)})}function J(Al){var Ak=/section-(\d+)/gi;var Aj=null;AT(AT(Al).attr("class").split(" ")).each(function(An,Ao){var Am=Ak.exec(Ao);if(Am&&!isNaN(Am[1])){Aj=Am[1]}});return Aj}function Ac(Aj){if(!AT.isArray(Aj)||Aj.length==0){return }vBulletin.AJAX({call:"/ajax/admin-template/widget",data:({widgets:Aj,pagetemplateid:AT("#save-page-form #pagetemplateid-yes").val()}),success:function(Ak){if(AT.isArray(Ak.widgets)){AT.each(Ak.widgets,function(Al,An){if(!An.widgetid||Number(An.widgetid)<1||!AT.trim(An.template)){return true}var Ao=(An.displaysection&&Number(An.displaysection)>0)?An.displaysection:0,Am=AT(An.template);Am.appendTo(AT(".canvas-layout:not(.h-hide) .canvas-widget-list.section-"+Ao).height("auto")).filter(":not(.container-widget)").find(".toggle-button").trigger("click",[true]);Am.find(".tabs").tabs()})}},error_phrase:"error_adding_widgets",});return false}function Aa(Aj,Ak){var Al=Aj.closest(".channel-item-container").children(".sub-channel-container").children(".channel-item-container");if(Aj.text()=="<"){Aj.text(">");Al.slideDown(150)}else{if(typeof (Ak)==="undefined"||!Ak){Aj.text("<");itemContainer.slideUp(150)}}}function K(){AT(".channel-config-dialog .channel-list").sortable({placeholder:"main-channel-container-highlight drag-highlight h-clear",update:function(Aj,Ak){Ak.item.css("z-index","0");n.forum=true;u=true},sort:function(Aj,Ak){},start:function(Aj,Ak){if(AT.browser.msie&&parseInt(AT.browser.version,10)==8){Ak.item.height(Ak.item.height()-4)}Ak.item.css("z-index","99999");Ak.placeholder.height(Ak.item.outerHeight())},over:function(Aj,Ak){},receive:function(Aj,Ak){},out:function(Aj,Ak){},handle:".grip-icon-main",items:".main-channel-container"})}function F(Aj){AB=Aj.find(".main-channel-container").sortable({connectWith:".sub-channel-container",placeholder:"channel-item-highlight drag-highlight",revert:true,update:function(Ak,Al){var Am=Al.item.closest(".main-channel-container");if(Al.sender&&Al.sender.hasClass("main-channel-container")){if(AT("> .channel-item-container",Al.sender).length==0){Al.sender.slideUp("fast",function(){AT(this).remove()})}}n.forum=true;u=true},sort:function(Ak,Al){},activate:function(Ak,Al){},start:function(Ak,Al){},stop:function(Ak,Al){AT(".main-channel-container, .sub-channel-container").height("auto")},over:function(Ak,Al){},receive:function(Ak,Al){},out:function(Ak,Al){},handle:".channel-item-inner > .grip-icon-item",items:".channel-item-container"})}function U(Aj){AH=Aj.find(".sub-channel-container").sortable({connectWith:".sub-channel-container",revert:true,placeholder:"channel-item-highlight drag-highlight",update:function(Ak,Al){if(Al.sender&&Al.sender.hasClass("main-channel-container")){if(AT("> .channel-item-container",Al.sender).length==0){Al.sender.slideUp("fast",function(){AT(this).remove()})}}n.forum=true;u=true},sort:function(Ak,Al){},start:function(Ak,Al){},stop:function(Ak,Al){AT(".main-channel-container, .sub-channel-container").height("auto")},over:function(Al,Am){var Ak=AT(this).closest(".channel-item-container").children(".channel-item").find(".toggle-button");Aa(Ak,true)},receive:function(Ak,Al){},out:function(Ak,Al){},handle:".channel-item-inner > .grip-icon-item",items:".channel-item-container"})}function Ad(Aj,Am,An,Ao,Ar,At,Aq){var Ap='<div class="'+(Ar?"category-to-channel":"channel-to-category")+'"><a href="#">'+vBulletin.phrase.get((Ar?"make_forum":"make_category"))+"</a></div>";var As=AT(('<div class="main-channel-container">				<div class="grip-icon grip-icon-main h-left"><div>&uml;</div><div>&uml;</div><div>&uml;</div><div>&uml;</div><div>&uml;</div></div>				<div class="channel-item-container">					<div class="channel-item shadow" data-channel-id="{0}" data-parent-id="{2}">						<div class="channel-item-inner">							<div class="grip-icon grip-icon-item h-left"><div>&uml;</div><div>&uml;</div><div>&uml;</div><div>&uml;</div><div>&uml;</div></div>							<div class="channel-title"><div title="'+vBulletin.phrase.get("click_text_edit_title")+'">{1}</div><input type="text" name="channeltitle" value="{1}" /></div>							<div class="close-button" title="'+vBulletin.phrase.get("remove_forum")+'">x</div>							<div class="toggle-button"><</div>							<div class="num-subchannels">'+Aq+'</div>							<div class="add-subchannel-button h-right" title="'+vBulletin.phrase.get("add_subforum")+'"><a href="#">+</a></div>							'+Ap+'							<div class="h-clear"></div>						</div>					</div>					<div class="sub-channel-container"></div>				</div>		 </div>').format(Am,Ao,An)).appendTo(Aj);if(At){var Ak=AT("#top-level-forum .channel-config-dialog .channel-list");var Al=Ak.find(".main-channel-container").last();AT("html, body").animate({scrollTop:Al.offset().top},"fast")}n.forum=true;u=true;return As}function AN(Al,Am,An,Aq,Ak,Ap){var Ao='<div class="'+(Aq?"category-to-channel":"channel-to-category")+'"><a href="#">'+vBulletin.phrase.get((Aq?"make_forum":"make_category"))+"</a></div>";var Ar=Ak.hasClass("main-channel-container")?AT("> .channel-item-container > .sub-channel-container",Ak):AT("> .sub-channel-container",Ak);var Aj=AT(('<div class="channel-item-container">				<div class="channel-item shadow" data-channel-id="{0}" data-parent-id="{2}">					<div class="channel-item-inner">						<div class="grip-icon grip-icon-item h-left"><div>&uml;</div><div>&uml;</div><div>&uml;</div><div>&uml;</div><div>&uml;</div></div>						<div class="channel-title"><div title="Click text to edit title">{1}</div><input type="text" name="channeltitle" value="{1}" /></div>						<div class="close-button" title="'+vBulletin.phrase.get("remove_forum")+'">x</div>						<div class="toggle-button"><</div>						<div class="num-subchannels">'+Ap+'</div>						<div class="add-subchannel-button h-right" title="'+vBulletin.phrase.get("add_subforum")+'"><a href="#">+</a></div>						'+Ao+'						<div class="h-clear"></div>					</div>			 </div>			 <div class="sub-channel-container"></div>			</div>').format(Al,An,Am)).hide().appendTo(Ar);n.forum=true;u=true;return Aj}function AX(){vBulletin.AJAX({call:"/ajax/fetch-widget-admin-template-list",complete:function(){Ah();AT(window).resize(Ah)},success:function(Al){AE=true;if(AT.isArray(Al)){if(Al.length>0){var Am={},Ap=0;AT.each(Al,function(Ar,As){if(!As.widgetid||Number(As.widgetid)<1){return true}Ap++;if(!Am[As.category]){Am[As.category]={count:1,title:As.category_title}}else{Am[As.category].count++}var Aq=AT("#edit-page-dropdown .module-list .module-icon-template").clone();Aq.attr("data-widget-id",As.widgetid).attr("data-title",AT.trim(As.title).toLowerCase()).data("canbemultiple",As.canbemultiple).removeClass("module-icon-template").addClass(("module-item category-{0}"+(As.cloneable=="1"?" module-cloneable":"")).format(As.category));AT(".module-icon",Aq).html(AT("<img />").attr("src",pageData.baseurl+"/images/sitebuilder/"+AT.trim(As.icon)).attr("height",60).attr("width",60).attr("alt",vBulletin.phrase.get("module_icon")));AT(".module-title .main-title",Aq).html(AT.trim(As.title));Aq.appendTo("#edit-page-dropdown .module-list").removeClass("h-hide")});AT(('<div class="category-arrow-left h-left" title="'+vBulletin.phrase.get("previous")+'">&lsaquo;</div>							<div class="scroller category h-left">								<div class="categories h-left">									<div id="category-all" class="category selected">'+vBulletin.phrase.get("all")+' ({0})</div>									<div id="category-result" class="category h-hide">'+vBulletin.phrase.get("search_results")+' (<span></span>)</div>								</div>							</div>							<div class="category-arrow-right h-left" title="'+vBulletin.phrase.get("next")+'">&rsaquo;</div>							<div class="h-clear"></div>').format(Ap)).insertBefore("#edit-page-dropdown .module-list-container .scroller");var Ak=0;AT.each(Am,function(Ar,As){var Aq=AT('<div id="category-{0}" class="category">{1} ({2})</div>'.format(Ar,As.title,As.count)).insertBefore("#category-result");Ak+=Aq.outerWidth(true)});var Ao=Ak+AT("#category-all").outerWidth(true);AT(".categories").width(Ao);if(AT(".categories").width()<=AT(".scroller.category").width()){AT(".category-arrow-left, .category-arrow-right").css("visibility","hidden")}else{AT(".category-arrow-right").css("visibility","visible")}Ai();b=AT("#edit-page-dropdown .module-list .module-item").not(".non-module-item");b.draggable({connectToSortable:".canvas-layout-row > .canvas-widget-list:visible",helper:"clone",revert:"invalid",appendTo:"#add-modules .module-list-container",zIndex:2000,start:function(Aq,Ar){if(AT(this).data("canbemultiple")=="0"&&AT("#content .canvas-layout .canvas-widget[data-widget-id={0}]".format(AT(this).attr("data-widget-id"))).length>0){vBulletin.warning("move_not_allowed",["adding_multiple_modules_not_allowed",AT(".main-title",this).html()]);return false}t=true},stop:function(Aq,Ar){t=false}}).disableSelection();var Aj=false;AT("#search-module-keyword").on("keyup",function(Aq,Ay){var Ax=AT("#add-modules"),Au=AT("#category-result"),Ar=AT(".categories",Ax),As=AT(".scroller.category",Ax),At=false;AT(".module-item",Ax).hide();if(!Ay){AT(".category.selected",Ax).removeClass("selected")}var Aw=AT.trim(this.value.toLowerCase());if(Aw){AT('.module-item[data-title*="{0}"]'.format(Aw),Ax).show();Au.removeClass("h-hide").addClass("selected")}else{AT(".module-item",Ax).show();AT("#category-all").removeClass("h-hide").addClass("selected");Au.addClass("h-hide").removeClass("selected");At=true}var Az=AT(".module-item:visible",Ax).length;AT("span",Au).text(Az);Ai();if(Az==0){AT(".empty-module",Ax).show()}else{AT(".empty-module",Ax).hide()}if(At){Ar.width(Ao)}else{Ar.width(Ao+Au.outerWidth(true))}if(Ar.width()<=As.width()){AT(".category-arrow-left, .category-arrow-right",Ax).css("visibility","hidden");As.scrollLeft(0)}else{if(At){AT(".category-arrow-left",Ax).css("visibility","hidden");AT(".category-arrow-right",Ax).css("visibility","visible");As.scrollLeft(0)}else{AT(".category-arrow-left",Ax).css("visibility","visible");AT(".category-arrow-right",Ax).css("visibility","hidden");var Av=As.get(0);As.scrollLeft(Av.scrollWidth-Av.clientWidth)}}return true});AT("#add-modules .categories .category").on("click",function(As){As.stopPropagation();if(AT(this).hasClass("selected")){return false}var Aq=AT(this).closest(".module-list-container"),At=AT(".module-item",Aq);AT(".category.selected",Aq).removeClass("selected");AT(this).addClass("selected");At.hide();AT(".empty-module",Aq).hide();var Ar=this.id;if(Ar=="category-all"){At.show();AT(".non-module-item",Aq).hide()}else{if(Ar=="category-result"){AT("#search-module-keyword").triggerHandler("keyup",[true])}else{AT(".module-item.{0}".format(Ar),Aq).show()}}Ai();return false}).disableSelection();var An;AT(".category-arrow-left").on({mousedown:function(){AT(".category-arrow-right").css("visibility","visible");An=setInterval(function(){var Aq=AT(".scroller.category");Aq.scrollLeft(Aq.scrollLeft()-20);if(Aq.scrollLeft()==0){AT(".category-arrow-left").css("visibility","hidden");clearInterval(An)}},50)},mouseup:function(){clearInterval(An)}}).disableSelection();AT(".category-arrow-right").on({mousedown:function(){AT(".category-arrow-left").css("visibility","visible");An=setInterval(function(){var Ar=AT(".scroller.category");Ar.scrollLeft(Ar.scrollLeft()+20);var Aq=Ar.get(0);if(Ar.scrollLeft()==Aq.scrollWidth-Aq.clientWidth){AT(".category-arrow-right").css("visibility","hidden");clearInterval(An)}},50)},mouseup:function(){clearInterval(An)}}).disableSelection()}else{AT('<div class="empty-module">'+vBulletin.phrase.get("no_modules")+"</div>").appendTo("#edit-page-dropdown .module-list")}}},error_phrase:"error_retrieving_modules",})}function l(Ak,Aj){vBulletin.AJAX({call:"/ajax/api/widget/fetchWidgetGuidToWidgetidMap",success:function(Al){if(Al.map){AM=Al.map}else{AM={error_result:Al}}if(typeof Ak=="function"){Ak.apply(this,Aj)}}})}function o(){AT("#edit-page-dropdown .template-list").empty();vBulletin.AJAX({call:"/ajax/api/pagetemplate/fetchPageTemplateList",data:{pagetemplateid:AT("#save-page-form #pagetemplateid-yes").val()},success:function(Ak){x=true;if(AT.isArray(Ak)&&Ak.length>0){var Aj=false;AT.each(Ak,function(Al,Am){AT('<div class="template-item">								<input type="radio" id="pagetemplateid-{0}" name="pagetemplateid" value="{0}" data-thumbnail="{1}/images/sitebuilder/icon-layout-{4}.png"{2} />								<label class="label">{3}</label>							</div>'.format(Am.pagetemplateid,pageData.baseurl,(!s&&AT("#save-page-form #pagetemplateid-yes").val()==Am.pagetemplateid)?' checked="checked"':"",Am.title,Am.screenlayoutvarname)).appendTo("#edit-page-dropdown .template-list").data({screenlayoutid:Am.screenlayoutid,widgetinstances:Am.widgetinstances});if(AT("#save-page-form #pagetemplateid-yes").val()==Am.pagetemplateid){Aj=true;if(Am.title==""){window.console.warn("The page template for this page does not have a title.")}}});if(!s&&!Aj){window.console.error("The page template for this page was not in the list returned by fetchPageTemplateList! Expected pagetemplateid: {0}. Please ensure that this page template has a title.".format(AT("#save-page-form #pagetemplateid-yes").val()))}AT(".template-item",AT("#edit-page-dropdown .template-list")).each(function(Al){AT(this).attr("data-title",AT(".label",AT(this)).text().toLowerCase())});AT("#search-template-keyword").on("keyup",function(Ap){if(Ap.keyCode==13){Ap.preventDefault();return false}var Am=AT("#select-template"),Aq=AT(".scroller",Am),Ao=false;AT(".template-item",Am).hide();var Al=AT.trim(this.value.toLowerCase());if(Al){AT('.template-item[data-title*="{0}"]'.format(Al),Am).show()}else{AT(".template-item",Am).show();Ao=true}var An=AT(".template-item:visible",Am).length;Ai();AT(".empty-template",Am).toggle(An==0);return true});AT("#search-template-keyword").on("keydown",function(Al){if(Al.keyCode==13){Al.preventDefault();return false}});a=AT("#edit-page-dropdown .template-list .template-item input[type=radio]").thumbnailRadioCheckbox({thumbnailClass:"template-border",preselect:function(Am,Al){if(Al.is(":checked")){return false}if(r||u){openConfirmDialog({title:vBulletin.phrase.get("switch_template"),message:vBulletin.phrase.get("template_changes_will_be_lost"),iconType:"warning",onClickYes:function(){r=false;u=false;k=true;a.thumbnailRadioCheckbox("check",Al,true)}});return false}k=true;return true},select:function(Ap,Al){AT(".canvas-layout").addClass("h-hide");var An=Al.closest(".template-item").data("screenlayoutid");AT(".canvas-layout[data-layout-id="+An+"]").removeClass("h-hide");O();y();AT("#save-page-form #pagetemplateid-yes, #config_pagetemplateid").val(Al.val());AT("#save-page-form .page-template-name").html(vBulletin.phrase.get("page_template_name_id",Al.closest(".template-item").find(".label").html(),Al.val()));if(k){AT(".canvas-widget-list").empty();var Am=Al.closest(".template-item").data("widgetinstances");if(AT.isArray(Am)&&Am.length>0){var Ao=[];AT.each(Am,function(Aq,Ar){Ao.push({widgetid:Ar.widgetid,widgetinstanceid:Ar.widgetinstanceid})});Ac(Ao,true);M()}else{window.vBulletin.loadingIndicator.hide()}}AT("body").removeClass("lnkNewPage").addClass("lnkEditPage");AT("#save-page-form .new-page-template input").prop("disabled",true);AT("#save-page-form .edit-page-template input").prop("disabled",false);k=true},unselect:function(){}});Ai()}},})}function AG(Aj){vBulletin.AJAX({call:"/uploader/setlogo",data:({filedataid:AT("#header .site-logo img").attr("data-fileid"),styleselection:AT("#header .site-logo img").attr("data-styleselection")}),complete:function(){AT("body").css("cursor","auto")},success:function(Ak){if(AT.trim(Ak)==="true"){AT("#header .site-logo img").removeAttr("data-styleselection").removeAttr("data-fileid").attr("data-orig-src",AT("#header .site-logo img").attr("src"));AT("#admin-navbar-strip-gutter").addClass("h-hide").find(".prompt-text").text("");AT(document.body).removeClass("edit-mode lnkHeader").addClass("view-mode");AT("#header .disable-overlay").hide();L(null,{enableButtons:true,currentButton:null});if(typeof Aj=="function"){Aj()}}},error_phrase:"error_saving_site_logo"})}function N(Aj,Ak){AT.each(Aj,function(Am,Al){var An=AT(('<div class="sub-channel channel" data-channel-id="{0}" data-parent-id="{6}">				<div class="avatar h-left"></div>				<div class="title"><a href="{1}{2}">{3}</a></div>				<div class="info">					<span class="label">'+vBulletin.phrase.get("last_post")+':</span>					<span class="title">{4}</span>				</div>				<div class="h-clear"></div>').format(Al.nodeid,pageData.baseurl,Al.url,Al.title,(Al.lastPostTitle?Al.lastPostTitle:"<em>"+vBulletin.phrase.get("none")+"</em>"),pageData.baseurl_core,Al.parentid)).appendTo(Ak);N(Aj[Am].subchannels,An.eq(0))})}function AF(Ak,Aj){AT.each(Ak,function(Al,An){var Am=AT.map(An.subchannels,function(Aq,Ap){return Ap}).length;var Ao=AN(An.nodeid,An.parentid,An.title,An.category,Aj,Am);AF(An.subchannels,Ao)})}function AW(){e.tabs("option","active",0);var Ap=AT("#add-modules").height();e.tabs("option","active",1);var Aj=AT("#change-layout").height();e.tabs("option","active",2);var Ak=AT("#select-template").height();AT("#edit-page-dropdown .lnkSaveChanges").trigger("click");var Am=AT("#save-page-form").height();e.tabs("option","active",0);var Ao=Math.max(Ap,Aj,Ak,Am);var Al=AT("#edit-page-dropdown .panel-header-text");Al.each(function(){var Aq=AT(this);Aq.css("min-height",Ao-parseFloat(Aq.css("margin-top"))-parseFloat(Aq.css("margin-bottom"))-parseFloat(Aq.css("padding-top"))-parseFloat(Aq.css("padding-bottom")))});var An=AT("#edit-page-dropdown .panel-main-content");An.each(function(){var Aq=AT(this);Aq.css("min-height",Ao-parseFloat(Aq.css("margin-top"))-parseFloat(Aq.css("margin-bottom"))-parseFloat(Aq.css("padding-top"))-parseFloat(Aq.css("padding-bottom")))})}function X(Aj,Ak){var Al=(Ak&&Ak.length>0)?AT(".canvas-layout .canvas-widget").not(Ak).find(".widget-content"):AT(".canvas-layout .canvas-widget .widget-content");if(Aj){Al.each(function(){if(AT(this).is(":hidden")){AT(this).closest(".canvas-widget").find(".widget-header .toggle-button").trigger("click",[true])}})}else{Al.each(function(){if(!AT(this).is(":hidden")){AT(this).closest(".canvas-widget").find(".widget-header .toggle-button").trigger("click",[true])}})}}function j(Ak,Aj){if(Aj){if(Ak.find(".widget-content").is(":hidden")){Ak.find(".toggle-button").trigger("click",[true])}}else{if(!Ak.find(".widget-content").is(":hidden")){Ak.find(".toggle-button").trigger("click",[true])}}}function M(){if(!s){var Aj=AT(".canvas-layout:visible .canvas-widget.subchannel-widget");if(Aj.length==1){Aj.find(".close-button").hide()}else{Aj.find(".close-button").show()}}}function Ag(Al,Aj){var Ak=Al.attr("data-widget-id");if(v[Ak]==null){vBulletin.AJAX({call:"/ajax/fetch-widget-template",data:({widgetid:Ak}),success:function(Am){var Ao=AT.trim(Am);if(Ao){var An=AT(Ao.replace(/\<\s*script[^\>]*\>(.*?)\<\s*\/\s*script\>/g,""));An.attr("data-title",function(){var Ap=AT(".module-title",An).clone();Ap.find(".hide-on-viewmode").children().unwrap();Ap.find("*:hidden").remove();return AT.trim(Ap.text()).toLowerCase()});v[Ak]=An;if(typeof Aj=="function"){Aj(An.clone(true))}}},error_phrase:"error_retrieving_cloned_widget_template",})}else{if(typeof Aj=="function"){Aj(v[Ak].clone(true))}}}function E(Aj,Ak){AT(".edit-mode .canvas-widget.youtube-widget .widget-content").css("visibility",Aj);if(Ak){Ak.find(".widget-content").css("visibility",(Aj=="hidden"?"visible":"hidden"))}}function C(Aj){var Am="js-sb-module-config--viewpermissions--template";if(!Am.length){return""}if(!Aj.hasOwnProperty("defaultvalue")){Aj.defaultvalue={show:"all",}}var Aq=AT("."+Am).clone().removeClass(Am+" h-hide"),As=Aj.defaultvalue,Ar=(As.hasOwnProperty("hide")?"hide":"show"),Ao=(Ar=="show"&&typeof As[Ar]=="string"&&As[Ar]=="all"),Ak=Aq.find("input.js-module_viewpermissions__key[value='show_all']"),Ap=Aq.find("input.js-module_viewpermissions__key[value='show']"),Al=Aq.find("input.js-module_viewpermissions__key[value='hide']"),An=Aq.find(".js-module_viewpermissions_ugchecklist");if(Ar=="hide"){Ar="show";Ao=true;Ak.prop("checked",false);Ap.prop("checked",true)}if(Ar=="hide"){Ak.prop("checked",false);Ap.prop("checked",false);Al.prop("checked",true)}else{if(Ao){Ak.prop("checked",true);Ap.prop("checked",false);Al.prop("checked",false);An.addClass("h-hide")}else{Ak.prop("checked",false);Ap.prop("checked",true);Al.prop("checked",false)}}if(!Ao){AT.each(As[Ar],function(At,Au){An.find("input.js-module_viewpermissions__value[value='"+Au+"']").prop("checked",true)})}Aq.find("input.js-module_viewpermissions__key").on("change",function(At){if(this.value=="show_all"){An.addClass("h-hide")}else{An.removeClass("h-hide")}});return Aq}function AQ(){AT(document).off("click",".canvas-widget.default-widget:not(.js-search-widget) .edit-button").on("click",".canvas-widget.default-widget:not(.js-search-widget) .edit-button",function(){var Aq=AT(this).closest(".canvas-widget"),Ak=Aq;var Al=AT("> .widget-header .module-title",Aq);(function(){var Ar=Aq.data("widget-instance-id");if(vBulletin.sitebuilder.tempModuleHTMLCache["widgetinstance_"+Ar]){if(AT("#sb-temp-module-cache").length==0){AT('<div id="sb-temp-module-cache" class="h-hide"></div>').appendTo("body")}var As=AT(vBulletin.sitebuilder.tempModuleHTMLCache["widgetinstance_"+Ar]);if(As.find(".widget-tabs").length>0||As.is(".widget-tabs")){AT("#sb-temp-module-cache").append(As);delete vBulletin.sitebuilder.tempModuleHTMLCache["widgetinstance_"+Ar]}}var At=AT("#sb-temp-module-cache .canvas-widget").filter(function(){return AT(this).data("widget-instance-id")==Ar});if(At.length==1&&(At.find(".widget-tabs").length>0||At.is(".widget-tabs"))){Aq=At}})();if(Aq.is(".js-search-widget")){return }var An=Aq.attr("data-widget-id");var Am;if(AT("span.admin-only",Al).length>0){Am=AT("span.admin-only",Al).text()}else{Am=AT(".hide-on-viewmode",Al).length>0?AT(".hide-on-viewmode",Al).text():Al.text()}var Ap=Aq.data("widget-type")||"";AT("#config-dialog .loader").show();AT("#config-dialog .widget-name h1").html(Am);AT("#config-dialog .dialog-content .widget-config-container").hide().empty().removeClass("error notice");AT("#config-dialog").data("selected-module",Ak);E("hidden");AT("#config-dialog").dialog("open");var Ao=Ak.attr("data-widget-instance-id")||"";vBulletin.AJAX({call:"/ajax/api/widget/fetchConfigSchema",data:({widgetid:An,widgetinstanceid:Ao,pagetemplateid:W(),configtype:"admin"}),success:function(A6){AT("#config_widgetid").val(A6.widgetid);AT("#config_widgetinstanceid").val(A6.widgetinstanceid);c(A6.pagetemplateid);Ak.attr("data-widget-instance-id",A6.widgetinstanceid);if(!Ao){R(Ak)}if(!A6.configs||A6.configs.length==0){AT("#config-dialog .widget-config-container").html(vBulletin.phrase.get("no_configurations_found")).addClass("notice");AT("#btnSaveConfig").prop("disabled",true);AT("#btnCloseConfig").focus()}else{var A8=0;var A7=AT("#config-dialog .dialog-content .widget-config-container");AT('<input type="hidden" name="data[widget_type]" />').addClass("widget-type").val(Ap).appendTo(A7);var BD=false,At=false,A2=false,Aw=false,BF,BE=false,A1=Ak.data("is-tabbed-container"),A3={display_tabs:false,default_tab:false},A0=(AT("#debug-information").length==1);AT.each(A6.configs,function(BR,BK){var BJ=null;switch(BK.type){case"ChannelSetup":AT("#config-dialog .dialog-content .channel-config-dialog").css("display","block");return true;break;case"Text":var BL=typeof (BK.defaultvalue!="undefined")?BK.defaultvalue:"";BJ=AT('<input type="text" name="data[{0}]" id="data[{0}]" />'.format(BK.name)).addClass("textbox config-textbox").val(BL);break;case"LongText":var BL=typeof (BK.defaultvalue!="undefined")?BK.defaultvalue:"";BJ=AT('<textarea name="data[{0}]" id="data[{0}]" rows="3" />'.format(BK.name)).addClass("textbox config-textbox").val(BL);break;case"YesNo":var BP={option_1:AT('<input type="radio" value="1" name="data[{0}]" id="data[{0}_1]" />'.format(BK.name)),label_1:AT("<label />").attr({"for":"data["+BK.name+"_1]"}).text(vBulletin.phrase.get("yes")),option_0:AT('<input type="radio" value="0" name="data[{0}]" id="data[{0}_0]" />'.format(BK.name)),label_0:AT("<label />").attr({"for":"data["+BK.name+"_0]"}).text(vBulletin.phrase.get("no"))};var BV=BP["option_"+BK.defaultvalue];if(BV){BV.prop("checked",true)}BJ=AT("<div />").append(BP.option_1,BP.label_1,BP.option_0,BP.label_0);break;case"Checkboxes":BJ=AT("<div />");AT.each(BK.data,function(BX,BZ){var BY="";if(BK.defaultvalue&&typeof BK.defaultvalue[BX]!="undefined"&&BK.defaultvalue[BX]==1){BY=' checked="checked"'}var Ba=AT('<div><label><input type="checkbox" name="data[{0}][{1}]"{2} value="1" class="js-checkbox-always-send" /> {3}</label></div>'.format(BK.name,BX,BY,BZ));BJ.append(Ba)});break;case"Select":BE=true;BJ=AT('<select name="data[{0}]" />'.format(BK.name));var BO;if(BK.data!=""){for(BO in BK.data){if(BK.defaultvalue==BO){AT("<option />").attr("value",BO).attr("selected","selected").text(BK.data[BO]).appendTo(BJ)}else{AT("<option />").attr("value",BO).text(BK.data[BO]).appendTo(BJ)}}}break;case"ChannelSelect":BE=true;BJ=AT('<select name="data[{0}]" />'.format(BK.name));var BT=AT('<optgroup label="{0}" />'.format(vBulletin.phrase.get("special_options"))),BM=AT('<optgroup label="{0}" />'.format(vBulletin.phrase.get("channels"))),BS=false,BU=false;if(BK.data){AT.each(BK.data,function(BX,BY){var BZ=null;if(BK.defaultvalue==BY.nodeid){BZ=AT("<option />").attr("value",BY.nodeid).attr("selected","selected").html(BY.text)}else{BZ=AT("<option />").attr("value",BY.nodeid).html(BY.text)}if(BY.nodeid<1){BZ.appendTo(BT);BS=true}else{BZ.appendTo(BM);BU=true}});if(BS){BT.appendTo(BJ)}if(BU){BM.appendTo(BJ)}}break;case"ContentTypeSelect":BE=true;BJ=AT('<select name="data[{0}]" />'.format(BK.name));var BT=AT('<optgroup label="{0}" />'.format(vBulletin.phrase.get("special_options"))),BQ=AT('<optgroup label="{0}" />'.format(vBulletin.phrase.get("content_types"))),BS=false,BN=false;if(BK.data){AT.each(BK.data,function(BX,BZ){var BY=null;if(BK.defaultvalue==BZ.value){BY=AT("<option />").attr("value",BZ.value).attr("selected","selected").html(vBulletin.phrase.get(BZ.phrase))}else{BY=AT("<option />").attr("value",BZ.value).html(vBulletin.phrase.get(BZ.phrase))}if(BZ.special){BY.appendTo(BT);BS=true}else{BY.appendTo(BQ);BN=true}});if(BS){BT.appendTo(BJ)}if(BN){BQ.appendTo(BJ)}}break;case"ProfileFieldSelect":BE=true;BJ=AT('<select name="data[{0}]" />'.format(BK.name));if(BK.data){AT.each(BK.data,function(BX,BZ){var BY=null;if(BK.defaultvalue==BZ.field){BY=AT("<option />").attr("value",BZ.field).attr("selected","selected").html(BZ.title)}else{BY=AT("<option />").attr("value",BZ.field).html(BZ.title)}BY.appendTo(BJ)})}break;case"Custom":switch(BK.name){case"tab_data":BJ=AT("<div />");var BW=f(Ak),BI=AT("<div />");AT.each(BW,function(Ba,BX){var BY="[tab_data]["+Ba+"][title]",BZ=BX.title,Bb=AT('<input type="text" name="data{0}" id="data{0}" />'.format(BY)).addClass("textbox config-textbox").attr("value",BZ);BJ.append(Bb);AT.each(BX.widgets,function(Bc,Bd){AT.each(Bd,function(Bf,Be){BY="[tab_data]["+Ba+"][widgets]["+Bc+"]["+Bf+"]";BZ=Be;Bb=AT('<input type="text" name="data{0}" id="data{0}" />'.format(BY)).addClass("textbox config-textbox").attr("value",BZ);BJ.append(Bb)})})});break;case"module_viewpermissions":BJ=C(BK);break;default:break}break}$requiredMark=AT("<div />").addClass("config-required-mark h-left").append(function(){return(BK.isRequired==1)?"*":"&nbsp;"});if(BK.isEditable==0&&BJ){BJ.find("input").prop("readonly",true);if(!BJ.is("input")){BJ.prop("disabled",true)}}var BH=AT("<div />").addClass("config-label h-left").addClass(BK.name).html(BK.label);if(A0){BH.prop("title",BK.name)}if(BK.description){AT("<div />").addClass("config-description").html(BK.description).appendTo(BH)}if(BK.ishiddeninput&&BJ){BJ.attr("hidden",true);A7.append(BJ)}else{A7.append(AT("<div></div>").addClass(function(){return"h-clearfix config-row"+(((++A8)%2!=0)?" odd":"")}).append(BH,$requiredMark,AT("<div></div>").addClass("config-value h-left").addClass(BK.name).append(BJ)))}if(BK.name=="default_tab"){if(A1){A3.default_tab=BK}else{BD=true}}if(BK.name=="display_tabs"){if(A1){A3.display_tabs=BK}else{At=true}}if(BK.name=="tab_order"){if(!A1){A2=true}}if(BK.name=="axd"){Aw=true}});var BC=null;var Au=function(){BF=Aj(Aq);var BK=Aq.attr("data-widget-default-tab"),BI=AT('select[name="data[default_tab]"]',A7),BJ;BI.empty();for(var BH in BF){if(At){if(!AT('input:checkbox[value="'+BF[BH].selector+'"]',A9).is(":checked")){continue}}else{if(!BF[BH].displayed){continue}}BJ=AT('<option value="'+BF[BH].selector+'">'+BF[BH].label+"</option>");if(BC&&BC==BF[BH].selector){BJ.attr("selected","selected")}else{if(BK==BF[BH].selector){BJ.attr("selected","selected")}}BI.append(BJ)}};var BA=function(){BF=Aj(Aq);var BI=AT(".config-value.tab_order",A7),BJ,BK;BI.empty().append("<ul>");for(var BH in BF){if(At){if(!AT('input:checkbox[value="'+BF[BH].selector+'"]',A9).is(":checked")){continue}}else{if(!BF[BH].displayed){continue}}BJ=AT('<li id="'+BF[BH].selector+'">'+BF[BH].label+"</li>");AT("ul",BI).append(BJ);BK=AT('<input name="data[tab_order]['+BF[BH].selector.substring(1)+']" value="'+BH+'" type="hidden">');BI.append(BK)}AT("ul",BI).sortable({stop:function(){var BL=AT(this).sortable("toArray");BI.find("input:hidden").remove();for(BH in BL){BK=AT('<input name="data[tab_order]['+BL[BH].substring(1)+']" value="'+BH+'" type="hidden">');BI.append(BK)}}});AT("ul",BI).disableSelection()};if(At){BF=Aj(Aq);var A9=AT(".config-value.display_tabs",A7),Ax;for(var BB in BF){Ax=AT('<label><input type="checkbox" name="data[display_tabs][]" value="'+BF[BB].selector+'">'+BF[BB].label+"</label>");if(BF[BB].displayed){Ax.find("input:checkbox").attr("checked","checked")}A9.append(Ax)}if(BD){AT("input:checkbox",A9).on("click",function(){Au();BA()})}}if(A2){BA();AT('select[name="data[default_tab]"]',A7).change(function(){BC=AT(this).val()})}if(BD){Au()}var As=q(Ak);if(As){AT("<input type='hidden' name='data[containerinstanceid]' value='"+As+"' />").appendTo(A7)}if(A1){var Az=f(Ak),Av=AT('select[name="data[default_tab]"]',A7),BG=AT(".config-value.display_tabs",A7),Ar=A3.display_tabs&&A3.display_tabs.defaultvalue||"";if(Ar==""){Ar={};AT.each(Az,function(BI,BH){Ar[BI]="1"})}var A5=function(){var BH;Av.empty();AT.each(Az,function(BJ,BI){BH=AT('<option value="'+BJ+'">'+BI.title+"</option>");if(Ar[BJ]=="0"){BH.prop("disabled",true)}else{if(A3.default_tab.defaultvalue==BJ){BH.attr("selected","selected")}}Av.append(BH)});if(Av.is(".selectBox")){Av.selectBox("refresh")}};if(A3.default_tab){A5()}if(A3.display_tabs){var Ay;BG.empty();AT.each(Ar,function(BJ,BI){var BH="data[display_tabs]["+BJ+"]";Ay=AT("<label />").append(AT('<input type="hidden" name="'+BH+"\" value='0'/>")).append(AT('<input type="checkbox" name="'+BH+"\" value='1' data-tab-number=\""+BJ+'" />')).append(document.createTextNode(Az[BJ]["title"]));if(BI=="1"){Ay.find("input:checkbox").prop("checked",true)}BG.append(Ay)});AT("input:checkbox",BG).on("click",function(){var BL=AT(this),BI=BL.prop("checked"),BK=BL.data("tab-number"),BH=Av.find("option[value='"+BK+"']"),BJ=(BH.prop("disabled")!=!BI);Ar[BK]=BI;if(BJ){A5()}})}}if(Aw){var A4=AT(".config-value.axd",A7);A4.append('<button class="axd-edit-button b-button b-button--secondary b-button--sitebuilder" data-location="'+A6.widgetinstanceid+'">'+vBulletin.phrase.get("edit")+"</button>")}}AT("#config-dialog .dialog-content .widget-config-container").show();AT("#config-dialog .loader").hide();if(BE){AT("#config-dialog .dialog-content .widget-config-container select").selectBox()}(function(){function BH(){var BI=AT(this),BJ=BI.next(".js-checkbox-always-send-hidden");if(BJ.length==0&&!BI.prop("checked")){AT('<input type="hidden" name="{0}" class="js-checkbox-always-send-hidden" value="0" />'.format(BI.prop("name"))).insertAfter(BI)}else{BJ.remove()}}AT(".js-checkbox-always-send").off("click").on("click",BH);AT(".js-checkbox-always-send").each(BH)})();AT("#config-dialog .dialog-content .widget-config-container input,						#config-dialog .dialog-content .widget-config-container textarea,						#config-dialog .dialog-content .widget-config-container select,						#config-dialog .dialog-content .widget-config-container button").filter(function(){return AT(this).is(":visible")}).first().focus()},error_phrase:["error_retrieving_configuration",Am],after_error:function(){AT("#config-dialog .loader").hide();AT("#config-dialog").dialog("close")},});return false});function Aj(Al){var Ak=[];AT("ul.widget-tabs-nav li a, .widget-header ul.ui-tabs-nav li a, .widget-tabs-nav ul.ui-tabs-nav li a",Al).each(function(){var Am=AT(this),An;if(AT(this).closest("li").hasClass("h-hide")){An=false}else{An=true}Ak.push({selector:Am.attr("href"),label:Am.text(),displayed:An})});return Ak}}function O(){AT(".edit-mode .canvas-layout:visible > .canvas-widget-list").width("").each(function(){AT(this).width(AT(this).width())})}function y(){if(AT.browser.msie&&parseInt(AT.browser.version,10)==8){var Aj=AT(".edit-mode .canvas-layout:visible > .canvas-widget-list");Aj.each(function(){var Ak=AT(".canvas-widget",this),Aq=AT(this);var Al=Ak.outerHeight(true)||50;var Am=Ak.length*Ak.outerHeight(true);var Ap=Aq.height()-Am;console.log("offset:",Ap);if(Ap>=0&&Ap<Al){var Ao=AT(window);var An=Ao.scrollTop();Aq.height(Aq.height()+(Al-Ap));Ao.scrollTop(An);return false}else{if((Ap>Al&&Aq.height()>parseInt(Aq.css("min-height"),10))||Ap<0){var Ao=AT(window);var An=Ao.scrollTop();Aq.height(Am+Al);Ao.scrollTop(An);return false}}})}}function AI(){window.console.log("Fetching page manager forums (initializeForumEditor)");vBulletin.AJAX({call:"/ajax/api/widget/fetchPageManagerForums",complete:function(){AT("#config-dialog .loader").hide()},success:function(Aj){G=true;var Al=AT("<div>").addClass("channel-list");AT.each(Aj,function(An,Ap){var Ao=AT.map(Ap.subchannels,function(Ar,Aq){return Aq}).length;var Am=Ad(Al,Ap.nodeid,Ap.parentid,Ap.title,Ap.category,false,Ao);AF(Ap.subchannels,Am)});var Ak=AT("#top-level-forum .channel-config-dialog");Ak.find(".channel-list").remove();F(Al);U(Al);Ak.append(Al);AT(document).on("mousedown",".main-channel-container > .channel-item-container > .channel-item .grip-icon",function(){AT(this).closest(".main-channel-container").height(AT(this).closest(".main-channel-container").height())});AT(document).on("mousedown",".sub-channel-container > .channel-item-container > .channel-item .grip-icon",function(){AT(this).closest(".sub-channel-container").height(AT(this).closest(".sub-channel-container").height())});u=false;K()},error_phrase:"error_fetching_channels"});AT(document).on("click keydown",".channel-config-dialog .add-channel-fieldset .add-button, .channel-config-dialog .add-channel-fieldset input",function(Aj){if(((Aj.type=="click"||Aj.which!=13)&&this.type=="text")||(Aj.type=="keydown"&&this.type=="button"&&Aj.which!=13)){return true}var Am=(this.type=="text")?AT(this):AT(this).prev();var Ak=AT.trim(Am.val());if(Ak&&Ak!=Am.prop("defaultValue")){var Al=AT("#top-level-forum .channel-config-dialog .channel-list");Ad(Al,"","",vBulletin.htmlEntities(Ak),0,true,0);F(Al);K();Am.val("");if(this.type=="button"){Am.focus()}}else{vBulletin.warning("warning_gcpuser","please_enter_channel_title",function(){Am.focus()})}});AT(document).on("click",".channel-config-dialog .main-channel-container .channel-item .channel-title div",function(){AT(this).hide();var Aj=AT(this).next();Aj.show();Aj.select();Aj.focus()});AT(document).on("keydown blur",".channel-config-dialog .main-channel-container .channel-item .channel-title input",function(Aj){if(Aj.type=="focusout"||(Aj.type=="keydown"&&Aj.which==13)){if(!AT.trim(this.value)&&Aj.type=="focusout"){this.value=this.defaultValue}if(AT.trim(this.value)){AT(this).hide();AT(this).prev().text(this.value);AT(this).prev().show()}}});AT(document).on("click",".channel-config-dialog .channel-item .category-to-channel a",function(){var Aj=AT(this).closest(".channel-item");Aj.attr("data-switch-category",0);AT(this).parent().removeClass("category-to-channel").addClass("channel-to-category");AT(this).html(vBulletin.phrase.get("make_category"));return false});AT(document).on("click",".channel-config-dialog .channel-item .channel-to-category a",function(){var Aj=AT(this).closest(".channel-item");Aj.attr("data-switch-category",1);AT(this).parent().removeClass("channel-to-category").addClass("category-to-channel");AT(this).html(vBulletin.phrase.get("make_forum"));return false});AT(document).on("click",".channel-config-dialog .channel-item .toggle-button",function(){Aa(AT(this));return false});AT(document).on("click",".channel-config-dialog .channel-item .add-subchannel-button a",function(){var Aj=AT(this).parent().siblings(".toggle-button");Aa(Aj,true);var Al=AT(this).closest(".channel-item-container");var Ak=AN("","",vBulletin.phrase.get("new_channel"),0,Al,0);U(Al);Ak.slideDown(100,function(){var Am=Al.find(".channel-item-inner").first().find(".num-subchannels");Am.text(parseInt(Am.text())+1);AT(".channel-title div",Ak).click();AT(".channel-title input",Ak).get(0).scrollIntoView(false);K()});return false});AT(document).on("click",".channel-config-dialog .channel-list .channel-item .close-button",function(){var Ak=AT(this),Al=AT("> .sub-channel-container > .channel-item-container",Ak.closest(".channel-item-container")).length>0,Aj=vBulletin.htmlEntities(Ak.prev().text());openConfirmDialog({title:vBulletin.phrase.get("remove_forum_q"),message:vBulletin.phrase.get("do_you_want_to_remove_forum",Aj,(Al)?" "+vBulletin.phrase.get("subchannels_will_be_deleted"):""),iconType:"warning",onClickYes:function(){var Ap=Ak.closest(".channel-item-container"),Ao=Ap.parent(),An=Ak.closest(".channel-item").attr("data-channel-id");var Am=function(){Ap.remove();if(Ao.hasClass("main-channel-container")){Ao.slideUp("fast",function(){AT(this).remove()})}};if(An){vBulletin.AJAX({call:"/ajax/api/content_channel/delete",data:{nodeid:An},success:function(Aq){Am()},})}else{Am()}}})})}function Af(Ak){function Aj(Am,An,Al){vBulletin.AJAX({call:"/ajax/render/{0}_list".format(Am),data:{page:An,isAjaxTemplateRenderWithData:true},complete:function(){AT("#config-dialog .loader").hide();AT("body").css("cursor","auto")},success:function(Ao){AT(("#top-level-{0} .channel-config-dialog").format(Am)).html(Ao.template);if(Al){vBulletin.pagination({context:("#top-level-{0} .channel-config-dialog").format(Am),onPageChanged:function(Ap,Aq){Aj(Am,Ap)}})}},error_phrase:"error_fetching_channels"})}Aj(Ak,1,true);AT(document).on("click",".page_manager_table .channel_name div",function(){AT(this).hide();var Al=AT(this).next();Al.show();Al.select();Al.focus()});AT(document).on("keydown blur",".page_manager_table .channel_name input",function(An){if(An.type=="focusout"||(An.type=="keydown"&&An.which==13)){if(!AT.trim(this.value)&&An.type=="focusout"){this.value=this.defaultValue}var Am=AT.trim(this.value),Al=AT(this);if(Am&&Al.prev().html()!=Am){AT("body").css("cursor","wait");vBulletin.AJAX({call:"/ajax/api/Content_Channel/update",data:{nodeid:Al.parents(".channel_row").data("nodeid"),data:{title:Am}},complete:function(){AT("#config-dialog .loader").hide();AT("body").css("cursor","auto")},success:function(Ao){Al.hide();Al.prev().html(Am);Al.prev().show()},error_phrase:"error_saving_page"})}}});AT(document).on("click",".page_manager_table .delete",function(){var Al=AT(this);openConfirmDialog({title:vBulletin.phrase.get("remove_channel_q"),message:vBulletin.phrase.get("do_you_want_to_remove_channel",Al.parents(".channel_row").find(".channel_name_val").text()),iconType:"warning",onClickYes:function(){vBulletin.AJAX({call:"/ajax/api/content_channel/delete",data:{nodeid:Al.parents(".channel_row").data("nodeid")},success:function(Am){Al.parents(".channel_row").remove()}})}})})}var G=false;function AC(){AT("body").css("cursor","wait");var Aj=function(Al){var Ak=Al.index();if(Ak==0&&!G){AI()}if((Ak==1||Ak==2)){Af(AT(Al.context).data("top-level"))}};m=AT("#manage-pages").tabs({beforeActivate:function(Am,An){var Al=An.newTab.index();if(Al!=0&&u){var Ak=openConfirmDialog({title:vBulletin.phrase.get("exit_without_saving_page"),message:vBulletin.phrase.get("forum_changes_will_be_lost"),iconType:"warning",onClickYes:function(){u=false;m.tabs("option","active",Al)}});return false}},create:function(Ak,Al){Aj(Al.tab)},activate:function(Ak,Al){Aj(Al.newTab)}});m.tabs("option","active",0);AT("#manage-page-dropdown .lnkSaveChanges").on("click",function(){console.log("Saving forum/channel data");var Ak=AT(this);if(Ak.hasClass("h-disabled")){console.log("We're busy saving already. Try again later.");return }Ak.addClass("h-disabled");vBulletin.loadingIndicator.show();AT("body").css("cursor","wait");var Al=[];function Am(Ap,An,Ao){var Aq=AT("> .channel-item-container",Ap);if(Aq.length>0){Aq.each(function(As){var Ar=AT("> .channel-item",this);var At=Ar.attr("data-channel-id");var Au=Ar.attr("data-parent-id");subchannelObj={nodeid:At||"0",previousParentId:Au,title:AT(".channel-title div",Ar).html(),displayorder:As+1,parentid:Ao||"0",subchannels:[]};if(Ar.attr("data-switch-category")!=null){subchannelObj.switchCategory=Ar.attr("data-switch-category")}An.subchannels.push(subchannelObj);Am(Ar.next(".sub-channel-container"),An.subchannels[As],At)})}}if(n.forum){AT(".channel-config-dialog .channel-list .main-channel-container").each(function(Ap){var Ao=AT("> .channel-item-container > .channel-item",this);var Aq=Ao.attr("data-channel-id");var Ar=Ao.attr("data-parent-id");var An={nodeid:Aq,previousParentId:Ar,title:AT(".channel-title div",Ao).html(),displayorder:Ap+1,subchannels:[]};if(Ao.attr("data-switch-category")!=null){An.switchCategory=Ao.attr("data-switch-category")}Am(Ao.next(".sub-channel-container"),An,Aq);Al.push(An)});vBulletin.AJAX({call:"/ajax/api/widget/saveForums",data:{data:JSON.stringify(Al)},complete:function(){AT("body").css("cursor","auto");vBulletin.loadingIndicator.hide();Ak.removeClass("h-disabled")},success:function(An){console.log("Forum/channel changes successfully saved");if(An&&An.forums&&An.forums.length>0){u=false;n.forum=false;location.reload(true)}else{openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_saving_forums"),iconType:"error"});return false}},error_phrase:"error_saving_channels_code"})}else{console.log("No forum/channel changes to save");vBulletin.loadingIndicator.hide();AT("body").css("cursor","auto");Ak.removeClass("h-disabled")}});AT(document).on("click","#manage-page-dropdown .lnkExitWithoutSaving",function(){if(u){openConfirmDialog({title:vBulletin.phrase.get("exit_without_saving_page"),message:vBulletin.phrase.get("do_you_want_to_exit_without_saving_page"),iconType:"warning",onClickYes:function(){location.reload(true)}})}else{location.reload(true)}})}function Q(){AT(document).on("focus click",".edit-mode .widget-content a, .edit-mode #channel-tabbar a, .edit-mode #btnSearch, .edit-mode #q",function(Aq){this.blur();return false});if(!AE){AX()}if(!x){o()}else{a.thumbnailRadioCheckbox("check",AT("#select-template .template-border.selected").next("input"),false);if(!s){AT("#select-template .template-item input[value={0}]".format(AT("#pagetemplateid-yes").val())).prev().trigger("click")}}if(AT.isEmptyObject(AM)){l()}Ai();AT("#config_pagetemplateid").val("");p=undefined;if(s){AT("#save-page-form #pagetitle").val("");AT("#save-page-form #pageurl").val("");AT("#save-page-form #pagetemplateid").val("0");AT("#save-page-form #pageid").val("0")}AT("#edit-page-dropdown .lnkDeletePage").on("click",function(){openConfirmDialog({title:vBulletin.phrase.get("confirm_deletion_gcpglobal"),message:vBulletin.phrase.get("confirm_remove_page_desc"),buttonLabel:{yesLabel:vBulletin.phrase.get("delete_page"),noLabel:vBulletin.phrase.get("cancel")},iconType:"warning",onClickYes:function(){vBulletin.AJAX({call:"/ajax/api/page/delete",data:{pageid:pageData.pageid},dataType:"json",complete:function(){AT("body").css("cursor","auto")},success:function(Aq){console.log("deleted page "+pageData.pageid);window.location.href=pageData.baseurl},error:function(As,Ar,Aq){console.log("page delete  failed! result:"+Aq);openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_deleting_page",As.status),iconType:"error"})}})}})});AT("#edit-page-dropdown .lnkSaveChanges").on("click",function(){AT("#edit-page-dropdown .tabs li").removeClass("ui-tabs-active ui-state-active");AT("#edit-page-dropdown .tabs .tab").addClass("ui-tabs-hide");AT("#save-content").show();AT("#save-page-form .edit-page-template").css("display","");AT("#save-page-form .edit-page-template").prev("label").css("display","");if(AT("body").hasClass("lnkNewPage")){AT("#save-page-form .new-page-template input").prop("disabled",false);AT("#save-page-form .edit-page-template input").prop("disabled",true)}else{if(!AT("#pagetemplateid-yes").prop("checked")&&!AT("#pagetemplateid-no").prop("checked")){AT("#pagetemplateid-yes").prop("checked",true)}AT("#save-page-form .edit-page-template input").prop("disabled",false);AT("#save-page-form .new-page-template input").prop("disabled",true);if(s&&(!r&&!u)){AT("#save-page-form .edit-page-template").css("display","none");AT("#save-page-form .edit-page-template").prev("label").css("display","none")}if(AT("#pagetemplateid-yes").prop("checked")){AT("#save-page-form #templatetitle").prop("disabled",false);AT("#save-page-form #templatetitle-edit").prop("disabled",true);AT("#save-page-form .page-template-name").removeClass("h-hide")}else{AT("#save-page-form #templatetitle").prop("disabled",true);AT("#save-page-form #templatetitle-edit").prop("disabled",false);AT("#save-page-form .page-template-name").addClass("h-hide")}}});AT(document).on("click","#edit-page-dropdown .lnkExitWithoutSaving",function(){if(r||u||k||(!s&&(AT("#pagetitle").val()!=AT("#pagetitle").prop("defaultValue")||AT("#pageurl").val()!=AT("#pageurl").prop("defaultValue")))||(s&&(AT("#pagetitle").val()!=""||AT("#pageurl").val()!=""))){openConfirmDialog({title:vBulletin.phrase.get("exit_without_saving_page"),message:vBulletin.phrase.get("do_you_want_to_exit_without_saving_page"),iconType:"warning",onClickYes:function(){var Aq=parseInt(AT("input#pagetemplateid-new").val(),10);if(!isNaN(Aq)&&Aq>0){vBulletin.AJAX({call:"/ajax/api/page/deleteOrphanedPagetemplates",data:{pagetemplateids:[Aq]},success:function(Ar){console.log({msg:"/ajax/api/widget/deleteOrphanedPagetemplates success!",result:Ar,})},complete:function(){location.reload(true)},})}else{location.reload(true)}}})}else{location.reload(true)}});var Aj=0;AT(window).on("resize.canvas",function(){clearTimeout(Aj);Aj=setTimeout(O,200)});var Am=function(Aq){return'<label class="hide-icon module-button-item"><input type="checkbox" title="{0}" data-toggle-title="{1}"{2} /></label>'.format(vBulletin.phrase.get("check_to_hide_module"),vBulletin.phrase.get("uncheck_to_unhide_module"),Aq?' checked="checked"':"")};AT(".canvas-widget.container-widget .canvas-widget:not(.dummy-widget)").each(function(){var Aq=AT(this).hasClass("hidden-widget");AT(".module-buttons .admin-only",this).prepend(Am(Aq));if(Aq){AT(".module-buttons .admin-only .hide-icon input",this).trigger("click").prop("checked",true)}});var Ap=function(As,At,Av){var Au=At.item,Av=At.item.hasClass("module-item");var Aq=AT("> .canvas-widget.container-widget {0}".format(Av?".module-item":".canvas-widget.container-widget"),this);if(Aq.length>0){var Ar=Aq.closest(".canvas-widget.container-widget");if(Ar.attr("data-widget-id")==Aq.attr("data-widget-id")){if(Av){Aq.remove()}else{if(At.sender){At.sender.sortable("cancel")}else{AT(this).sortable("cancel")}}An=true;openAlertDialog({title:vBulletin.phrase.get("move_not_allowed"),message:vBulletin.phrase.get("dropping_container_module_into_container_module_not_allowed"),iconType:"warning"});return true}return false}return false};var Al=function(Aq){if(Aq.parents(".canvas-widget.container-widget").length>0){if(AT(".module-buttons .admin-only .hide-icon",Aq).length==0){AT(".module-buttons .admin-only",Aq).prepend(Am())}}else{Aq.removeClass("hidden-widget").find("> .widget-header .module-buttons .admin-only .hide-icon").remove()}};var An=false;AL=AT(".edit-mode .canvas-layout .canvas-widget-list:not(.js-draggable-module-target)");AL.sortable({revert:true,tolerance:"pointer",connectWith:".edit-mode .canvas-layout:visible .canvas-widget-list",placeholder:"canvas-widget canvas-widget-highlight drag-highlight",create:function(){O();y()},update:function(Ar,As){var Av=this;if(AY){if(!An){Ag(As.item,function(Az){As.item.replaceWith(Az);Az.filter(":not(.container-widget)").find(".toggle-button").trigger("click",[true]);if(!Ap.apply(Av,[Ar,As])){Al(Az);Az.addClass("shadow").find(".widget-tabs").andSelf().filter(".widget-tabs").tabs();M();Az.parents(".canvas-widget.container-widget").find(".canvas-widget.dummy-widget").remove();var A0=Az.parents(".canvas-widget.container-widget");if(A0.length==1){A0.find(".canvas-widget-highlight").remove();A0.find(".module-item").remove()}}var Ax=Az.data("widget-id"),Aw=q(Az),Ay=function(A1){Az.attr("data-widget-instance-id",A1);if(Aw){R(Az)}h(Az)};if(Ax){i(Aw,Ax,{},Ay)}})}}else{if(!Ap.apply(Av,[Ar,As])){Al(As.item);M()}if(AT.contains(this,As.item[0])){var Au=As.item.closest(".canvas-widget"),Aq=q(Au),At=Au.data("widget-instance-id")||0;R(Au);if(At){vBulletin.AJAX({call:"/ajax/api/widget/saveWidgetinstanceContainerinstanceid",data:{widgetinstanceid:At,containerinstanceid:Aq},success:function(Aw){console.log("saveWidgetinstanceContainerinstanceid success: "+JSON.stringify(Aw))}})}}}if(As.sender){var Au=As.sender.closest(".canvas-widget");if(Au.length){R(Au)}}r=true},out:function(Aq,Ar){AT(this).css("overflow","")},sort:function(Aq,Ar){if(t){AY=true}var As=Ar.placeholder.closest(".canvas-widget.container-widget");if(As.length==1&&As.find(".canvas-widget:last-child").hasClass("canvas-widget-highlight")){Ar.placeholder.css({"margin-bottom":0,"margin-top":-3})}else{Ar.placeholder.css({"margin-bottom":"","margin-top":""})}},start:function(Aq,Ar){E("hidden",Ar.item)},over:function(Aq,Ar){},stop:function(Ar,As){AT(this).css("overflow","");An=false;y();AY=false;As.item.height("auto");E("visible");AT(".canvas-layout .canvas-widget-list .canvas-widget-highlight").remove();var Aq=AT(".canvas-layout > .canvas-layout-row .canvas-widget-list > .canvas-widget.container-widget");AT(".canvas-layout > .canvas-layout-row .canvas-widget-list > .canvas-widget.container-widget").each(function(){var At=AT(".canvas-widget-list",this);if(At.children().length==0){At.append('<div class="canvas-widget dummy-widget"><span>{0}</span></div>'.format(vBulletin.phrase.get("you_can_also_drag_and_drop_modules_here")))}else{if(At.find(".canvas-widget.dummy-widget").length>0&&At.find(".canvas-widget:not(.dummy-widget,.canvas-widget-highlight)").length>0){At.find(".canvas-widget.dummy-widget").remove()}}})},receive:function(Aq,Ar){if(Ar.item.hasClass("module-item")){Ap.apply(this,[Aq,Ar,true])}},handle:".move-icon",items:".canvas-widget:not(.js-widget-non-sortable,.js-widget-pinned-sortable)",}).find(".canvas-widget .widget-header").disableSelection();AT(document).on("click",".edit-mode .canvas-widget .js-pin-module-button",function(){var Av=AT(this),Au=Av.closest(".canvas-widget"),Aq=Au.find("js-move-button"),At="js-widget-pinned-sortable",As="pin-icon--pinned",Ar=Au.hasClass(At);Au.toggleClass(At,!Ar);Av.toggleClass(As,!Ar)});AT(document).on("click",".edit-mode .canvas-widget .close-button",function(){var Aq=AT(this);openConfirmDialog({title:vBulletin.phrase.get("remove_module_q"),message:vBulletin.phrase.get("do_you_want_to_remove_module",Aq.closest(".widget-header").find(".module-title").text()),iconType:"warning",onClickYes:function(){var Au=Aq.closest(".canvas-widget"),At=Au.data("widget-instance-id"),As=Au.parent(),Ar=Au.parents(".canvas-widget.container-widget");Au.remove();y();M();r=true;AO([At]);R(As);if(Ar.find(".canvas-widget").length==0){Ar.find(".canvas-widget-list").append('<div class="canvas-widget dummy-widget"><span>{0}</span></div>'.format(vBulletin.phrase.get("you_can_also_drag_and_drop_modules_here")))}}})});AT(document).on("click",".edit-mode .js-search-widget .edit-button",function(){E("hidden");Ak(AT(this).closest(".js-search-widget"));AT("#search-config-dialog").dialog("open");return false});function Ao(A0,Az){var Aq=AT("#edit-page-dropdown .lnkSaveChanges .label").text();if(!Az){if(!AT.trim(AT("#save-page-form #pagetitle").val())){openAlertDialog({title:Aq,message:vBulletin.phrase.get("please_enter_page_name"),iconType:"warning",onAfterClose:function(){AT("#save-page-form #pagetitle").focus()}});return false}if(AT("body").hasClass("lnkEditPage")){var Ay=AT("#save-page-form #pagetemplateid-yes");var Ar=AT("#save-page-form #pagetemplateid-no");if(!Ay.prop("checked")&&!Ar.prop("checked")){openAlertDialog({title:Aq,message:vBulletin.phrase.get("please_choose_overwrite_template_options"),iconType:"warning",onAfterClose:function(){AT("#save-page-form #pagetemplateid-yes").focus()}});return false}else{if(Ar.prop("checked")){var As=AT("#save-page-form #templatetitle-edit");var A4=AT.trim(As.val());if(!A4||A4==As.prop("defaultValue")){openAlertDialog({title:Aq,message:vBulletin.phrase.get("please_enter_new_template_name"),iconType:"warning",onAfterClose:function(){AT("#save-page-form #templatetitle-edit").focus()}});return false}openConfirmDialog({title:Aq,message:vBulletin.phrase.get("applying_new_template",AT("#save-page-form #templatetitle-edit").val()),buttonLabel:{yesLabel:vBulletin.phrase.get("save_page"),noLabel:vBulletin.phrase.get("cancel")},iconType:"warning",onClickYes:function(){},onAfterClose:function(){if(AT(this).attr("id")=="btnConfirmDialogYes"){AT("#save-page-form #btnOK").trigger("click",true)}}});return false}else{if(Ay.prop("checked")){if(s&&(!r&&!u)){AT("#save-page-form #btnOK").trigger("click",true)}else{openConfirmDialog({title:Aq,message:vBulletin.phrase.get("overwrite_template_continue"),buttonLabel:{yesLabel:vBulletin.phrase.get("save_page"),noLabel:vBulletin.phrase.get("cancel")},iconType:"warning",onClickYes:function(){},onAfterClose:function(){if(AT(this).attr("id")=="btnConfirmDialogYes"){AT("#save-page-form #btnOK").trigger("click",true)}}})}return false}}}}else{var As=AT("#save-page-form #templatetitle-new");var A4=AT.trim(As.val());if(!A4||A4==As.prop("defaultValue")){openAlertDialog({title:Aq,message:vBulletin.phrase.get("please_enter_new_template_name"),iconType:"warning",onAfterClose:function(){AT("#save-page-form #templatetitle-new").focus()}});return false}}}var A3=AT(".canvas-layout:visible");Ab=A3.attr("id");var Ax=parseInt(A3.attr("data-layout-id"),10);AT("#save-page-form #screenlayoutid").val(Ax);function At(A8){var A9={widgetId:A8.attr("data-widget-id"),widgetInstanceId:(A8.attr("data-widget-instance-id")||"0")};if(A8.hasClass("container-widget")){var A5=[];var A7=[];AT("div.canvas-widget-list > div.canvas-widget",A8).each(function(BA){if(!AT(this).hasClass("hidden-widget")){A7.push(AT(this).attr("data-widget-instance-id"))}A5.push(At(AT(this)))});A9.subModules=A5;A9.displaySubModules=A7}if(A8.data("is-tabbed-container")){var A6=[];A8.find("> .js-admin-widget-content > .js-admin-widget-tab").each(function(){var BA=AT(this);BA.find("> .widget-content > .canvas-layout-row > .canvas-widget-list > .canvas-widget:not(.dummy-widget)").each(function(){var BB=AT(this);A6.push(At(BB))})});A9.tabbedContainerSubModules=A6}return A9}AT('input[type=hidden][name*="displaysections"]',A3).clone().appendTo(AT("#moduleData").empty());AT("#"+Ab+" > .canvas-layout-row > div.canvas-widget-list").each(function(){var A5=[];var A6=J(this);AT(this).children("div.canvas-widget").each(function(){A5.push(At(AT(this)))});AT('#save-page-form input[name="displaysections['+A6+']"]').val(JSON.stringify(A5))});var A1={};var Aw=AT("#save-page-form").serializeArray();AT.each(Aw,function(A5,A6){A1[A6.name]=A6.value});function A2(A5){vBulletin.AJAX({call:"/admin/savepage",data:{input:A5,url:window.location.href},complete:function(){AT("body").css("cursor","auto")},success:function(A6){if(A6.url!=null){window.location.href=pageData.baseurl+A6.url}},error_phrase:"error_saving_page",})}var Au=AT("input[name='screenlayoutid'][value='"+Ax+"']");if(Au.length>0&&Au.attr("data-guid")=="vbulletin-screenlayout-bare-full-57433eecd10803.93763070"){var Av={title:vBulletin.phrase.get("warning"),message:vBulletin.phrase.get("you_cannot_revert_this_layout_confirm"),onClickYes:function(){A2(A1)}};openConfirmDialog(Av)}else{A2(A1)}}AT(document).on("click","#save-page-form #btnOK",Ao);AT("#config-dialog").dialog({title:vBulletin.phrase.get("module_configuration"),autoOpen:false,modal:true,resizable:false,closeOnEscape:false,showCloseButton:false,height:500,width:800,dialogClass:"dialog-container config-dialog-container input-dialog",open:function(){AT("#config-dialog .loader").show();AT("body").css("cursor","wait")},create:function(){AT(document).on("submit",".sitebuilder-widget-form",function(){function Ar(At){AT("body").css("cursor","wait");AT("#config-dialog .js-button").prop("disabled",true);var Au=AT("#config-dialog").data("selected-module");var As=At.action;vBulletin.AJAX({url:As,type:At.method,data:(AT(At).serializeArray()),success:function(Aw){AT("body").css("cursor","auto");if(Aw.data){var Av=Aw.data.title||Aw.data.searchResultTitle||Aw.data.searchTitle;if(Av){Au.find(".module-title .admin-only").text(vBulletin.phrase.get("x_module",Av))}switch(Aw.data.widget_type){case"custom-html-widget":Au.find(".widget-content").html(Aw.data.html);j(Au,true);break;case"video-widget":var Ax=Aw.data.embed_data;if(Ax){var A0=Au.find(".widget-content .videocontainer");if(A0.length==0){A0=AT("<div />").addClass("videocontainer").appendTo(Au.find(".widget-content"))}var Az={code:Ax.code,provider:Ax.provider,width:"100%",height:260};AT.post(vBulletin.getAjaxBaseurl()+"/ajax/render/bbcode_video",Az,function(A1){if(A1){A0.empty().append(A1);j(Au,true)}},"json");Au.find(".widget-content").find(".note").addClass("h-hide")}break}var Ay=AT('select[name="data[default_tab]"]',AT(At));if(Ay.length>0){Au.attr("data-widget-default-tab",Ay.val())}u=true}AT("#config-dialog").dialog("close")},after_error:function(){AT("#config-dialog .loader").hide();AT("#config-dialog .js-button").prop("disabled",false)},error_phrase:["error_saving_configuration_module",AT("#config-dialog .widget-name h1").text()],})}var Aq=this;Ar(Aq);return false});AT("#btnCloseConfig").on("click",function(){AT(".channel-config-dialog .channel-list").empty();AT("#config-dialog").dialog("close")})},close:function(){E("visible");AT("#config-dialog .dialog-content .channel-config-dialog").css("display","none");AT("#config-dialog .js-button").prop("disabled",false)}});AT("#pagetitle").on("keyup blur",function(Aq){if(s){AT("#pageurl").val(this.value.replace(/[^\w-]+/g,""))}return true});AT("#save-page-form #pagetemplateid-yes").on("click",function(){AT("#save-page-form .template-name").addClass("h-hide");AT("#save-page-form #templatetitle").prop("disabled",false);AT("#save-page-form #templatetitle-edit").prop("disabled",true);AT("#save-page-form .page-template-name").removeClass("h-hide")});AT("#save-page-form #pagetemplateid-no").on("click",function(){AT("#save-page-form .template-name").removeClass("h-hide");AT("#save-page-form #templatetitle").prop("disabled",true);AT("#save-page-form #templatetitle-edit").prop("disabled",false);AT("#save-page-form .page-template-name").addClass("h-hide")});function Ak(Aq){if(typeof g.search_config_dialog=="undefined"){vBulletin.AJAX({call:"/ajax/render/dialog_search_config",success:function(Ar){g.search_config_dialog=Ar;AT("body").append(Ar);Ak(Aq)},error_phrase:"error_fetching_dialog"});return }if(Aq){AT("#search-config-dialog").data("search-widget",Aq)}AT("#search-config-dialog").dialog({title:vBulletin.phrase.get("edit_search_module"),autoOpen:true,modal:true,resizable:false,closeOnEscape:false,showCloseButton:false,width:800,dialogClass:"dialog-container search-config-dialog-container input-dialog",close:function(){E("visible")},open:function(){var Ar=this;AT("#customSearchDialog",Ar).addClass("h-invisible");AT("body").css("cursor","wait");setTimeout(function(){vBulletin.search=vBulletin.search||{};var Au=function(){S=new vBulletin.search.SearchControl("#customSearchDialog");T(S)};var At=AT("#search-config-dialog").data("search-widget");var Aw={id:At.attr("data-widget-id"),instanceid:At.attr("data-widget-instance-id")};if(typeof vBulletin.search.SearchControl=="undefined"){var Av=["/js/jquery/jquery.qtip.min.js","/js/tag-editor.js","/js/sb_search.js"];var As=function(){if(Av.length==0){AT("body").css("cursor","auto");AT("#customSearchDialog",Ar).removeClass("h-invisible");Au();return }var Ax=Av.shift();AT.getScript(vBulletin.getAjaxBaseurl()+Ax+"?"+pageData.simpleversion,As).error(function(A1,A0,Ay){var Az=(Ay&&Ay.message)?"{0}: {1}".format(vBulletin.phrase.get("error"),Ay.message):"HTTP {0}: {1}".format(A1.status,A1.statusText);AT("#search-config-dialog").dialog("close");openAlertDialog({title:vBulletin.phrase.get("error"),message:"{0}<br /><br />({1})".format(vBulletin.phrase.get("error_loading_search_config_script"),Az),iconType:"error"})}).complete(function(){})};As()}else{AT("#customSearchDialog",Ar).removeClass("h-invisible");Au()}},1);u=false},create:function(){AT("#btnSaveSearchConfig").on("click",function(){AT("body").css("cursor","wait");var At=AT("#search-config-dialog").data("search-widget");var A1={id:At.attr("data-widget-id"),instanceid:At.attr("data-widget-instance-id")};var Aw={pageid:pageData.pageid,widgetid:A1.id,widgetinstanceid:A1.instanceid,pagetemplateid:AT("#select-template input[type=radio]:checked").val(),searchJSON:{}};var A5=AT("#searchTitle");if(A5.length>0&&AT.trim(A5.val()).length>0){Aw.searchTitle=AT.trim(A5.val());A5.data("defaultValue",Aw.searchTitle)}var Ay=AT("#resultsPerPage");if(Ay.length>0&&AT.trim(Ay.val()).length>0){Aw.resultsPerPage=AT.trim(Ay.val());Ay.data("defaultValue",Aw.resultsPerPage)}var Au=["hide_avatars","hide_module_when_empty","displayFooter"];for(var Ax=0;Ax<Au.length;Ax++){var Ar=Au[Ax],Av=AT("input[name='"+Ar+"'][value='1']");if(Av.length>0&&Av.prop("checked")){Aw[Ar]="1";Av.data("defaultValue","1")}else{Aw[Ar]="0";Av.data("defaultValue","0")}}var A0=AT(".js-searchmodule-show-at-breakpoints");if(A0.length>0){Aw.show_at_breakpoints={desktop:1,small:1,xsmall:1};A0.find("input").each(function(){var A6=AT(this);switch(A6.prop("name")){case"show_at_breakpoints[desktop]":Aw.show_at_breakpoints.desktop=A6.prop("checked")?1:0;break;case"show_at_breakpoints[small]":Aw.show_at_breakpoints.small=A6.prop("checked")?1:0;break;case"show_at_breakpoints[xsmall]":Aw.show_at_breakpoints.xsmall=A6.prop("checked")?1:0;break}});A0.data("defaultValue",Aw.show_at_breakpoints)}var A4=AT("#search-config-dialog .js-sb-module-config--viewpermissions");if(A4.length>0){Aw.module_viewpermissions={};var Az=A4.find("input.js-module_viewpermissions__key:checked"),A3="show_all",As=A4.find("input.js-module_viewpermissions__value:checked"),A2="all";if(Az.length){A3=Az.prop("value")}if(As.length){A2=[];AT.each(As,function(A6,A7){A2.push(AT(A7).prop("value"))})}Aw.module_viewpermissions={key:A3,value:A2,}}Aw.searchJSON=S.load();vBulletin.AJAX({call:"/ajax/api/widget/saveSearchWidgetConfig",data:{data:JSON.stringify(Aw)},complete:function(){AT("body").css("cursor","auto")},success:function(A6){if(A6.widgetinstanceid>0&&A6.searchJSON){At.attr("data-widget-instance-id",A6.widgetinstanceid);At.find(".main-title").text(Aw.searchTitle);AT("#config_widgetinstanceid").val(A6.widgetinstanceid);AT("#config_pagetemplateid").val(A6.pagetemplateid);AT("#pagetemplateid-new").val(A6.pagetemplateid);AT("#search-config-dialog").dialog("close");j(At,true);u=true}},error_phrase:"error_saving_search_config",})});AT("#btnCancelSearchConfig").on("click",function(){function Ar(){AT("#search-config-dialog").dialog("close");S.set("{}");var A1=AT("#search-config-dialog #searchTitle");A1.val(A1.data("defaultValue"));var Ax=AT("#search-config-dialog #resultsPerPage");Ax.val(Ax.data("defaultValue"));var Au=["hide_avatars","hide_module_when_empty","displayFooter"];for(var Aw=0;Aw<Au.length;Aw++){var At=Au[Aw],Av=AT("#search-config-dialog input[name='"+At+"'][value='1']"),Ay=AT("#search-config-dialog input[name='"+At+"'][value='0']");if(Av.data("defaultValue")=="1"){Av.prop("checked",true)}else{Ay.prop("checked",true)}}var Az=AT("#search-config-dialog .js-searchmodule-show-at-breakpoints");if(Az.length>0){var A0=Az.data("defaultValue");if(typeof (A0)!="undefined"){Az.find("input").each(function(){var A2=AT(this);switch(A2.prop("name")){case"show_at_breakpoints[desktop]":A2.prop("checked",A0.desktop?"checked":"");break;case"show_at_breakpoints[small]":A2.prop("checked",A0.small?"checked":"");break;case"show_at_breakpoints[xsmall]":A2.prop("checked",A0.xsmall?"checked":"");break}})}}}if(u){var As=AT(this);openConfirmDialog({title:vBulletin.phrase.get("cancel_edit"),message:vBulletin.phrase.get("do_you_want_to_cancel_editing_search_module"),iconType:"warning",onClickYes:Ar})}else{Ar()}})}})}AT("#blog-category-dialog").dialog({title:vBulletin.phrase.get("edit_blog_categories"),autoOpen:false,modal:true,resizable:false,closeOnEscape:false,showCloseButton:false,width:800,dialogClass:"dialog-container blog-category-dialog-container input-dialog",close:function(){E("visible")},open:function(){var Aq=this;u=false},create:function(){AT("#blog-category-dialog #btnSaveCategories").on("click",function(){AT("body").css("cursor","wait");AT("#blog-category-dialog dialog-content loader").show();var Aq=AT("#search-config-dialog").data("blog-category-widget");var Ar={id:Aq.attr("data-widget-id"),instanceid:Aq.attr("data-widget-instance-id")};vBulletin.AJAX({call:"/ajax/api/widget/saveBlogCategories",data:{},complete:function(){AT("body").css("cursor","auto");AT("#blog-category-dialog dialog-content loader").hide()},success:function(As){AT("#blog-category-dialog dialog-content widget-config-container").html(As)},error_phrase:"error_saving_blog_categories"})});AT("#blog-category-dialog #btnNewCategory").on("click",function(){});AT("#blog-category-dialog #btnCloseCategories").on("click",function(){if(u){var Aq=AT(this);openConfirmDialog({title:vBulletin.phrase.get("cancel_edit"),message:vBulletin.phrase.get("do_you_want_to_cancel_editing_blog_categories_module"),iconType:"warning",onClickYes:AT("#blog-category-dialog").dialog("close")})}else{AT("#blog-category-dialog").dialog("close")}})}})}function T(Aj){var Al=AT(this).closest(".canvas-widget"),Ak=AT("#search-config-dialog").data("search-widget"),Am={id:Ak.attr("data-widget-id"),instanceid:Ak.attr("data-widget-instance-id")};vBulletin.AJAX({call:"/ajax/api/widget/fetchSearchConfig",data:({widgetid:Am.id,widgetinstanceid:Am.instanceid||"",pagetemplateid:W(),configtype:"admin"}),complete:function(){AT("body").css("cursor","auto")},success:function(An){if(An.searchTitle){AT("#searchTitle").val(An.searchTitle)}if(An.resultsPerPage){AT("#resultsPerPage").val(An.resultsPerPage)}var As=["hide_avatars","hide_module_when_empty","displayFooter"];for(var Ar=0;Ar<As.length;Ar++){var Ap=As[Ar];value=((An[Ap]&&parseInt(An[Ap],10)==1)?1:0);AT("input[name='"+Ap+"'][value='"+value+"']").prop("checked",true)}if(An.show_at_breakpoints){var At=AT("#search-config-dialog .js-searchmodule-show-at-breakpoints");if(At.length>0){At.find("input").each(function(){var Au=AT(this);switch(Au.prop("name")){case"show_at_breakpoints[desktop]":Au.prop("checked",An.show_at_breakpoints.desktop?"checked":"");break;case"show_at_breakpoints[small]":Au.prop("checked",An.show_at_breakpoints.small?"checked":"");break;case"show_at_breakpoints[xsmall]":Au.prop("checked",An.show_at_breakpoints.xsmall?"checked":"");break}})}if(An.module_viewpermissions){var Ao=AT("#search-config-dialog .js-searchmodule-module_viewpermissions--replaceme"),Aq=C({defaultvalue:An.module_viewpermissions});Ao.replaceWith(Aq)}}Aj.set(An.searchJSON||{},An.contentTypes||{},An.channels||{});AT("#config-dialog .dialog-content .widget-config-container").show();AT("#search-config-dialog .form_layout .form_row .field_column select").selectBox();AT("#config-dialog .loader").hide()},after_error:function(){AT("#config-dialog .loader").hide();AT("#config-dialog").dialog("close")}})}AT(document).ready(function(){AJ()})})(jQuery);;

// ***************************
// js.compressed/admin-sbpanel-style.js
// ***************************
/*=======================================================================*\
|| ###################################################################### ||
|| # vBulletin 5.4.0 Release Candidate 1
|| # ------------------------------------------------------------------ # ||
|| # Copyright 2000-2018 vBulletin Solutions Inc. All Rights Reserved.  # ||
|| # This file may not be redistributed in whole or significant part.   # ||
|| # ----------------- VBULLETIN IS NOT FREE SOFTWARE ----------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html   # ||
|| ###################################################################### ||
\*========================================================================*/
window.vBulletin=window.vBulletin||{};window.vBulletin.phrase=window.vBulletin.phrase||{};window.vBulletin.phrase.precache=window.vBulletin.phrase.precache||[];window.vBulletin.phrase.precache=$.merge(window.vBulletin.phrase.precache,["cancel","changed_extra_css_warning","error_loading_css","error_setting_theme","loading_themes","no_preview_available","revert","revert_extra_css_warning","save_and_continue","success","there_are_no_themes_installed","confirm_action"]);window.vBulletin.options=window.vBulletin.options||{};window.vBulletin.options.precache=window.vBulletin.options.precache||[];window.vBulletin.options.precache=$.merge(window.vBulletin.options.precache,["styleid"]);(function(K){var I=false,J,T,R=0,Z=false,X=function(h){var g=this;vBulletin.assertUserHasAdminPermission("canusesitebuilder",g,function(){E.call(g)});return false},E=function(g,l){var k=K(this),j=K(document.body),i=!k.hasClass("selected"),h=true;if(typeof g!="undefined"){i=!!g}if(typeof l!="undefined"){h=!!l}if(i){K(document.body).addClass("js-edit-mode-style");F();D();K(".js-style-panel").css("display","none").removeClass("h-hide").slideDown("400",A)}else{b(!i,k);K(".js-style-panel").slideUp("fast",function(){K(document.body).removeClass("js-edit-mode-style");if(!h){return }var m=window.location.href;if(m.indexOf("adminAction=stylePanel&")!=-1){m=m.replace("adminAction=stylePanel&","")}else{m=m.replace("?adminAction=stylePanel","")}if(m!=window.location.href){window.location.href=m}else{window.location.reload(true)}})}},C=function(g){E(false,g)},b=function(g,h){K(document).trigger("vb-toggle-sitebuilder-menu",{enableButtons:g,currentButton:h})},D=function(){},a=function(h,i){var g=K(".js-theme-selector__list:visible .js-theme-selector__theme-radio:checked").val();vBulletin.AJAX({call:"/ajax/api/style/setDefaultStyle",data:{styleid:g},error_phrase:"error_setting_theme",success:function(){var j=new Date();j.setDate(j.getDate()+365);K.cookie(pageData.cookie_prefix+"userstyleid",g,{path:pageData.cookie_path,domain:pageData.cookie_domain,expires:j});if(typeof i=="undefined"||i){C(true)}}});return false},S=function(g){C(false);return false},e=function(g){c(J.getValue(),null,R)},H=function(g){openConfirmDialog({title:vBulletin.phrase.get("revert"),message:vBulletin.phrase.get("revert_extra_css_warning"),iconType:"warning",onClickYes:function(h){T="";J.setValue("");c("",U,R)}});return false},O=function(g){C(true);return false},M=function(g){J.setValue(T)},B=function(k,g,l){if(!g&&k&&k.target){var g=K(k.target).closest(".js-theme-selector__theme").data("preview-url")}if(!l){var l=K(k.target).closest(".js-theme-selector__list")}var j=l.closest(".js-panel").find(".js-theme-selector__theme-preview"),i,h=j.find("> img, > p");if(j.length!=1){return }if(g){i=K("<img />").prop("src",g)}else{i=K("<p />").addClass("b-theme-selector__theme-preview-message").text(vBulletin.phrase.get("no_preview_available"))}if(h.is("p")&&i.is("p")){h.fadeTo(200,"0.5",function(){K(this).fadeTo(400,1)})}else{h.css("zIndex","2");i.css("zIndex","1").hide();j.append(i);h.fadeOut({duration:300,queue:false,complete:function(){K(this).remove()}});i.fadeIn({duration:600,queue:false})}},d=function(){var g=K(this);g.closest(".js-theme-selector__list").find(".js-theme-selector__theme").removeClass("b-theme-selector__theme--selected js-theme-selector__theme--selected js-vbscroller-selected-item");g.closest(".js-theme-selector__theme").addClass("b-theme-selector__theme--selected js-theme-selector__theme--selected js-vbscroller-selected-item")},Y=function(q,l,h){var k=this,j="js-theme-selector__theme b-theme-selector__theme h-margin-right-xl",m=K('<input type="radio" name="styleid" value="'+k.styleid+'" />').addClass("js-theme-selector__theme-radio b-theme-selector__theme-radio h-margin-none h-margin-right-s"),o=K("<label />").prop("title",k.title),n=K("<div />").addClass("h-margin-s h-margin-bottom-none b-theme-selector__theme-title").text(k.title.length>30?k.title.substr(0,20)+" ...":k.title),g=K("<img />").addClass("h-margin-s h-margin-bottom-m").prop("src",k.iconurl),i=K("<div />").addClass("b-theme-selector__theme-thumbnail");var p=function(r){var s=new Image();s.src=r};p(k.iconurl);p(k.previewurl);if(l==k.styleid){m.prop("checked","checked");m.attr("checked","checked");B({},k.previewurl,q);j+=" js-theme-selector__theme--selected b-theme-selector__theme--selected js-vbscroller-selected-item"}i.append(g);n.prepend(m);o.append(i).append(n);K("<div />").addClass(j).data("preview-url",(k.previewurl||"")).append(o).appendTo(q);f.call(g.get(0),2)},f=function(q){var k=K(this);k.css({maxWidth:"none",maxHeight:"none"});var j=k.outerWidth()||0,r=k.outerHeight()||0,g=j>r?"height":"width",s,m,h,n=false;if(j>0&&r>0){var p=false;if(g=="width"&&j>100){s=100/j;m=j*s;h=r*s;p=true}else{if(g=="height"&&r>100){s=100/r;m=j*s;h=r*s;p=true}else{}}if(p){k.removeClass("h-margin-s h-margin-bottom-m").css({maxWidth:m,maxHeight:h});var l=k.parent();var o=K("<div />").addClass("b-theme-selector__image-resize-wrapper h-margin-s h-margin-bottom-m").css({width:100,height:100,overflow:"hidden"});o.append(k);l.append(o);n=true}}else{}if(!n){k.css({maxWidth:"100px",maxHeight:"100px"});if(q>0){var i=this;window.setTimeout(function(){f.call(i,--q)},100)}else{var i=this;k.off("load").on("load",function(){f.call(i,--q)})}}},G=function(h,l){var j,k=0,g=vBulletin.options.get("styleid");l.html("");if(h&&h.themes){K.each(h.themes,function(){Y.apply(this,[l,g,k]);++k})}if(!k){K("<div />").addClass("b-theme-selector__message").text(vBulletin.phrase.get("there_are_no_themes_installed")).appendTo(l)}else{P(l)}},P=function(g){if(vBulletin.vBScroller&&vBulletin.vBScroller.initializeScroller){var h=g.closest(".js-vbscroller-wrapper");vBulletin.vBScroller.initializeScroller(h)}},L=function(j,k,h){var i=K(this).closest(".js-theme-selector__theme"),g=i.find(".js-theme-selector__theme-radio");if(i.is(".js-theme-selector__theme--selected")){return }g.attr("checked","checked");d.call(this);B.call(this,j);if(h.liveUpdate){a.call(this,j,false)}},V=function(h){var g={liveUpdate:false,container:document};h=K.extend({},g,h);var j=K(".js-theme-selector__list",h.containerSelector);function i(k){L.call(this,k,j,h)}j.off("change",".js-theme-selector__theme-radio").on("change",".js-theme-selector__theme-radio",i);j.off("click",".js-theme-selector__theme label img").on("click",".js-theme-selector__theme label img",i);vBulletin.AJAX({call:"/ajax/api/style/getThemeInfo",error:function(){var k=K("<div />").addClass("b-theme-selector__message").text(vBulletin.phrase.get("error_fetching_themes"));j.html(k)},success:function(k){G.apply(this,[k,j])}})},Q=function(g){if(isNaN(parseFloat(K(g.target).val()))){return false}currentText=J.getValue();if(T!=J.getValue()){W()}else{U()}},U=function(){var h=K(".js_stylepanel_selectStyle");if(!Z){var g=K.cookie(pageData.cookie_prefix+"userstyleid");if(g){h.val(g)}h.selectBox();Z=true}vBulletin.AJAX({call:"/ajax/api/template/fetchBulk",data:{template_names:{0:"css_additional.css"},styleid:h.val(),type:"uncompiled"},success:function(i){if(typeof (i["css_additional.css"])=="undefined"){T=""}else{T=i["css_additional.css"]}J.setValue(T);R=h.val()},api_error:function(){J.setValue("")},error_phrase:"error_loading_css",})},W=function(){openConfirmDialog({title:vBulletin.phrase.get("confirm_action"),message:vBulletin.phrase.get("changed_extra_css_warning"),iconType:"warning",buttonLabel:{yesLabel:vBulletin.phrase.get("save_and_continue"),noLabel:vBulletin.phrase.get("cancel")},onClickYes:function(g){c(J.getValue(),U,R)},onClickNo:function(g){K(".js_stylepanel_selectStyle").selectBox("value",R)}})},c=function(i,h,g){vBulletin.AJAX({call:"/ajax/api/template/saveAdditional",data:{text:i,styleid:g},success:function(){T=i;vBulletin.alert("success","css_saved","",h)},error_phrase:"error_saving_css",})},A=function(){function g(){if(typeof (J)=="undefined"){var h=K(".sb-style-panel_cssextraedit").get(0);J=CodeMirror.fromTextArea(h,{mode:"css",lineNumbers:true});var i=K(h).attr("dir");if(i){K(J.display.wrapper).attr("dir",i)}T="";K(".js-style-panel #admin-stylepanel-csseditor .js_stylepanel_selectStyle").change();K(".sb-style-panel .tab-item a").off("click",g)}}K(".sb-style-panel .tab-item a").off("click",g).on("click",g);if(K(".js-style-panel .js-admin-stylepanel-csseditor").is(":visible")){g()}},F=function(){if(I){return }K(".js-style-panel .tabs").tabs();var g;g=".js-style-panel #admin-stylepanel-themes .js-button--save";K(document).off("click",g).on("click",g,a);g=".js-style-panel #admin-stylepanel-themes .js-button--cancel";K(document).off("click",g).on("click",g,S);g=".js-style-panel #admin-stylepanel-csseditor .js-button--revert";K(document).off("click",g).on("click",g,H);g=".js-style-panel #admin-stylepanel-csseditor .js-button--cancel";K(document).off("click",g).on("click",g,M);g=".js-style-panel #admin-stylepanel-csseditor .js-button--close";K(document).off("click",g).on("click",g,O);g=".js-style-panel #admin-stylepanel-csseditor .js-button--save";K(document).off("click",g).on("click",g,e);g=".js-style-panel #admin-stylepanel-csseditor .js_stylepanel_selectStyle";K(document).off("change",g).on("change",g,Q);if(K(".js-style-panel .js-theme-selector__container").length==1){V({liveUpdate:false,containerSelector:".js-style-panel"})}if(K(".js-style-panel .js-admin-stylepanel-csseditor").length==1){A()}I=true},N=function(){K(function(){K(document).on("vb-sitebuilder-panel--style",X);if(typeof (pageData.adminAction)!="undefined"&&pageData.adminAction=="stylePanel"){K(".js-top-menu-tab--style").click()}})};window.vBulletin=window.vBulletin||{};window.vBulletin.sitebuilder=window.vBulletin.sitebuilder||{};window.vBulletin.sitebuilder.initThemesInQuickConfig=function(){V({liveUpdate:true,containerSelector:".js-config-site-panel"})};N()})(jQuery);;

// ***************************
// js.compressed/vbulletin_stylegenerator.js
// ***************************
window.vBulletin=window.vBulletin||{};window.vBulletin.phrase=window.vBulletin.phrase||{};window.vBulletin.phrase.precache=window.vBulletin.phrase.precache||[];window.vBulletin.phrase.precache=$.merge(window.vBulletin.phrase.precache,["style_generator_browser_not_supported","show_tooltips","hide_tooltips","enter_hex_value","enter_distance_angle","enter_complement_hue","enter_hue","err_invalid_name","err_order_need_name","err_order_need_order","err_order_negative","err_order_too_large","ok_js","cancel_js","done","error","saved_style_x_successfully","complementary_color","secondary_color_a","primary_color","enter_hex","primary0_info","primary1_info","primary2_info","primary3_info","primary4_info","secondary0_info","secondary1_info","secondary2_info","secondary4_info","warning"]);var drag={on:false,dot:null};var defs={FPSlimiter:10,MaxRedrawRate:200,dotSize:6,wheelMid:{X:190,Y:190},sliderMid:{X:95,Y:95},sliderWidth:140,CBPreview:0};var API={on:false};var SchemeID,styleGeneratorContent;$("#edit-content .tab-item a[id!=colorStyleTab]").on("click",function(){changePreview("","default")});$("#colorStyleTab").on("click",function(){var A=parseInt($.browser.version,10);if($.browser.msie&&A<7){openAlertDialog({title:vBulletin.phrase.get("warning"),message:vBulletin.phrase.get("style_generator_browser_not_supported"),iconType:"warning"});return }if(typeof styleGeneratorContent=="undefined"){vBulletin.AJAX({url:vBulletin.getAjaxBaseurl()+"/ajax/render/style_generator",success:function(B){styleGeneratorContent=B;$("#color-style").html(B);showStyleGenerator()},error_phrase:"error_fetching_dialog"});return }showStyleGenerator()});function showStyleGenerator(){$("#jscheck").hide();$("#color-style").show().find("select.custom-dropdown").selectBox().end().find("a").on("click",function(){$(this).blur()});$("#model a").on("click",function(){setScheme(this.id);return false});$("#tab-wheel").on("click",function(){togglePane("wheel");return false});$("#tab-vars").on("click",function(){togglePane("vars");return false});$("#wheel,#saturation,#contrast").on("mousedown",function(H){H.preventDefault();var J=$(this);var I=J.offset();drag.on=true;drag.dW=J.width();drag.dH=J.height();drag.dX=I.left+drag.dW/2;drag.dY=I.top+drag.dH/2;J.on("mousemove",function(K){K.preventDefault();dragMove(K,this)});if(!drag.dot){dragMove(H,this)}}).on("mouseup",function(H){H.preventDefault();$(this).off("mousemove");drag.on=false;drag.dot=null;updateColorData()});$(".dot").on("mousedown",function(H){drag.dot=this}).on("mouseup",function(H){drag.dot=null});$("#dot1").on("dblclick",enterHue);$("#hue-val").on("click",enterHue);$("#dot2").on("dblclick",enterComplHue);$("#dot3").on("dblclick",enterDist);$("#dist-val").on("click",enterDist);$("#rgb-val").on("click",enterRGB);$("#sample-val").on("dblclick",function(I){var H=prompt(vBulletin.phrase.get("enter_hex"))});toggleContrast();$("#tab-light-ps").on("click",function(){pagePreview("light-ps");return false});$("#tab-light-pt").on("click",function(){pagePreview("light-pt");return false});$("#tab-grey").on("click",function(){pagePreview("grey");return false});$("#tab-dark").on("click",function(){pagePreview("dark");return false});$("#menu a").on("click",function(H){H.preventDefault();$(this).blur()});$("#menu-undo").on("click",function(){History.back();return false});$("#menu-redo").on("click",function(){History.fwd();return false});$("#save-color-style").on("click",function(){exportCols();return false});$("#menu-tooltips").on("click",function(){useShowTooltips();return false});$("#preview-palette .cbox").on("click",function(){if($("#tab-vars").hasClass("sel")&&UseManualVars){var H=$(this).attr("rel");var I=H.split("-");I=I[0];$("#manualvars a.ttl").filter(function(){return $(this).attr("rel")==I}).click();$("#manualvars a.col").filter(function(){return $(this).attr("rel")==H}).click()}return false});showTooltips();History.updateMenu();var D=document.location.search.substring(1);if(D){D=D.split("&");var C,A,E,B,G;API.data={};for(C=0,A=D.length;C<A;C++){E=D[C].split("=");B=E[0].toString();G=E[1].toString();API.data[B]=G}if(API.data.returnurl){API.on=true;if(API.data.format!="hex"&&API.data.format!="rgb"){API.data.format="hex"}if(API.data.method!="get"&&API.data.method!="post"){API.data.format="get"}}}var F=document.location.hash.substring(1);if(F){loadScheme(F)}else{loadScheme("3E11TvVw5w0w0");usePreset("default");updateScheme();if(Palette.UseVarsOverlay){toggleContrast()}}populatePaletteText("light-ps");changePreview()}function setStyleAttr(D,A,C,B){if(D instanceof $&&D.length>0){return D.each(function(){var E=$(this),G=E.attr("style")?E.attr("style").split(";"):[],F=[];$.each(G,function(I,H){if(A==$.trim(H.split(":")[0])){F.push("{0}:{1}{2}".format(A,C,(B?" !important":"")))}else{F.push(H)}});if(!E.data("orig-style")&&E.attr("style")){E.data("orig-style",E.attr("style"))}E.attr("style",F.join(";"))})}return $()}function loadScheme(A){Palette.unserialize(A);updateScheme();if(Palette.UseVarsOverlay){toggleContrast()}}function togglePane(B,A){if(A==undefined){var A=true}if(!$("#tab-"+B).hasClass("sel")){$(".pane").hide();$("#pane-"+B).fadeIn(250);$("#tabs-color a").removeClass("sel");$("#tab-"+B).addClass("sel").blur()}if(B=="wheel"){updateWheel();$("#manualvars a.sel").removeClass("sel");$("#manualvars a#pal-pri-0").addClass("sel")}else{if((B=="vars")&&(A)){updateVars();setOriginalColor()}}}function toggleContrast(A){if(A=="c1"){Palette.resetVarsOverlay()}else{$("#manualvars, #ttl-c2").fadeIn(750);UseManualVars=true}updateVars()}function setScheme(A){Palette.setScheme(A);updateScheme()}function usePreset(B){if(!B){return }var A=Palette.usePreset(B);updateVars()}function useColorBlind(A){defs.CBPreview=A;$("#menu-vision, #colorblind a").removeClass("sel");if(A>0){$("#menu-vision").addClass("sel");$("#colorblind a").eq(A).addClass("sel");$("#cb-warning").show()}else{$("#cb-warning").hide()}colorize()}function useShowTooltips(){var A=!$("#menu-tooltips").hasClass("sel");if(A){showTooltips()}else{hideTooltips()}}function checkFPS_on(){}function checkFPS_off(){}function updateScheme(){var A=Palette.Scheme;$("#model a").removeClass("sel");$("#"+A).addClass("sel").blur();$("#dot3").css("display",Boolean(Palette.Sec1)?"block":"none");$("#dist-val").css("display",Boolean(Palette.Sec1)?"block":"none");updateWheel();if($("#tab-vars").hasClass("sel")){updateVars()}}function updateWheel(){checkFPS_on();moveDot(1,Palette.Primary);moveDot(3,Palette.Sec1);var A=Palette.Primary.Col[0].RGB;$("#hue-val span").html(Palette.H+"&deg;");$("#rgb-val span").text(A.getHex());$("#rgb-r").html(Math.round(A.R/255*100)+" %");$("#rgb-g").html(Math.round(A.G/255*100)+" %");$("#rgb-b").html(Math.round(A.B/255*100)+" %");$("#dist-val span").html(Palette.Dist+"&deg;");colorize();checkFPS_off()}function updateVars(){if(UseManualVars){updateManualVars()}else{$("#saturation").css("background-color",Palette.Primary.Base.RGB.getCSS());updateContrast()}updateSV()}function updateSV(){checkFPS_on();var A,C;if(UseManualVars){var B=Palette.getVarOverlay(VarSelected[0],VarSelected[1]);A=B[0];C=B[1];A=A-0.5;C=C-0.5;moveSliderDot("#dots,#dotv"+VarSelected[1],A,-C)}else{A=Palette.dS;C=Palette.dV;A=A<0?(A+1)*0.9-0.5:0.4+A*0.1;C=C<0?(C+1)*0.9-0.5:0.4+C*0.1;moveSliderDot("#dots",A,-C)}colorize();checkFPS_off()}function updateContrast(){checkFPS_on();var A=Palette.cL,B=Palette.cS;moveSliderDot("#dotc",A-0.5,0.5-B);colorize();checkFPS_off()}var UseManualVars=false;var VarSelected=[0,0];var ColorHash={pri:0,sec1:1,sec2:2,compl:3};function updateManualVars(){function A(J,I,C){var H,F,D,G='<a class="ttl" rel="'+I+'" href="#"></a>';G+='<ul class="var-set" id="">';for(var E=0;E<5;E++){H=J.getVarRGB(E).getHex();F=I+"-"+E;G+='<li><a class="col" id="pal-'+F+'" rel="'+F+'" href="#"><img src="'+pageData.baseurl+'/images/style_generator/e.png" id="cbox-bg-'+F+'" class="cbox bg-'+F+'" />';G+='<span id="info-'+I+"-"+E+'" class="paletteInfo"></span>';G+="</a></li>"}G+="</ul>";return G}var B='<ul class="palettedisplay">';B+="<li>"+A(Palette.Primary,"pri","")+"</li>";B+="<li>"+A(Palette.Sec1,"sec1","")+"</li>";B+="</ul>";$("#manualvars").html(B);$("#manualvars a.ttl").on("click",function(){var D,C,E=$(this).attr("rel");for(D=0;D<5;D++){C=Palette.getVarOverlay(ColorHash[E],D);moveSliderDot("#dotv"+D,C[0]-0.5,-C[1]+0.5)}if($(this).next(".var-set").hasClass("sel")){return false}$("#manualvars .var-set.sel").removeClass("sel").slideUp("fast");$(this).blur().next(".var-set").addClass("sel").slideDown("fast").find("a.col").eq(0).click();return false});$("#manualvars a.col").on("mouseenter",function(){var C=$("#preview-palette").find(".bg-"+$(this).attr("rel")).addClass("hilite")}).on("mouseleave",function(){var C=$("#preview-palette").find(".bg-"+$(this).attr("rel")).removeClass("hilite")}).on("click",function(){$("#manualvars a.sel").removeClass("sel");$(this).blur().addClass("sel");VarSelected=$(this).attr("rel").split("-");VarSelected[0]=ColorHash[VarSelected[0]];$("#saturation").css("background-color",Palette.getColorByIdx(VarSelected[0]).Base.RGB.getCSS());setOriginalColor();updateSV();return false});$("#manualvars a.ttl").eq(0).click();$("#manualvars a.col").on("click",function(){togglePane("vars",false)});populatePaletteText($("#tabs-preview a.sel").attr("id").replace(/tab-/g,""))}function exportCols(){if(check_save_valid!==undefined){if(!check_save_valid()){return false}}function B(H){var G=[];for(var F=0;F<5;F++){v=H.getVarRGB(F);G.push({hex:v.getHex(),r:v.R,g:v.G,b:v.B})}return G}var A={primary:B(Palette.Primary)};if(Palette.Sec1){A.secondary=B(Palette.Sec1)}if(Palette.Compl){A.complement=B("Palette.Compl")}var E=$("#styleform #form-name").val();var C=$("#styleform select[name=parentid]");var D=C.val();vBulletin.AJAX({url:vBulletin.getAjaxBaseurl()+"/style/saveGeneratedStyle",error_phrase:"style_errors",data:{type:$(".previewtab.sel").data("type"),id:SchemeID,scheme:A,name:E,parentid:D,displayorder:$("#styleform #form-displayorder").val(),userselect:$("#styleform input:radio[name=userselect]:checked").val()},success:function(F){var G=$("#styleform select[name=parentid] option[value={0}]".format(D));var H=G.data("depth")+2;G.after('<option value="{0}" data-depth="{2}">{1}</option>'.format(F.overwritestyleid,str_repeat(C.data("indent"),H)+E,H));C.val(F.overwritestyleid);$("#styleform #form-name").val("");openAlertDialog({title:vBulletin.phrase.get("done"),message:vBulletin.phrase.get("saved_style_x_successfully",E)})}})}function pagePreview(A){var B=$("#tabs-preview a.sel").attr("id").replace("tab-","");$("a.previewtab").removeClass("sel");$("#tab-"+A).addClass("sel").blur();$("a.previewing").removeClass("selected");$("li.savemenu").removeClass("selected");$("#menu-"+A).addClass("selected").blur();$("#menu-export-"+A).addClass("selected").blur();populatePaletteText(A);changePreview(B,A);colorize()}function changePreview(B,G){function A(I){$.each(I,function(J,K){$(J).removeClass(K);$(J).attr("style",$(J).data("orig-style"))})}function F(I){$.each(I,function(J,K){$(J).addClass(K);$(J).css("background-color","")})}var E={"#vb-page-body":"bg-pri-0","#vb-page-body":"col-pri-0","#wrapper":"bg-pri-3","#header":"bg-pri-2","#channel-tabbar, #channel-subtabbar, #footer-subtabbar, #footer-tabbar":"bg-pri-2","#channel-tabbar ul, #channel-subtabbar ul, #footer-subtabbar ul, #footer-tabbar ul.nav-list":"bg-sec1-0","#channel-tabbar ul li, #channel-subtabbar ul li, #footer-subtabbar ul li, #footer-tabbar ul.nav-list li":"bg-sec1-0","#channel-tabbar ul li a, #channel-subtabbar ul li a, #footer-subtabbar ul li a,  #footer-tabbar ul.nav-list li a":"col-pri-1",".canvas-widget":"bg-pri-1","#subforumdescription":"bg-pri-3","#footer-tabbar":"bg-pri-2",".topic-title":"col-pri-2",".b-post-control__label":"col-pri-2",".widget-content, .post-content":"col-pri-0",};var D={"#wrapper":"bg-wh-sec0","#vb-page-body":"col-pri-1","#channel-tabbar, #channel-subtabbar, #footer-subtabbar, #footer-tabbar":"bg-pri-1","#channel-tabbar ul, #channel-subtabbar ul, #footer-subtabbar ul, #footer-tabbar ul.nav-list":"bg-pri-1","#channel-tabbar ul li, #channel-subtabbar ul li, #footer-subtabbar ul li, #footer-tabbar ul.nav-list li":"bg-pri-2","#channel-tabbar ul li a, #channel-subtabbar ul li a, #footer-subtabbar ul li a,  #footer-tabbar ul.nav-list li a":"col-pri-1",".canvas-widget":"bg-wy-sec0",".topic-title":"col-pri-0",".b-post-control__label":"col-pri-0",".widget-content, .post-content":"col-pri-0",".list-item":"bg-wy-sec0"};var C={"#vb-page-body":"bg-gy-pri0","#wrapper":"bg-gy-sec0","#header":"bg-gy-pri0","#channel-tabbar, #channel-subtabbar, #footer-subtabbar, #footer-tabbar":"bg-gy-pri0","#channel-tabbar ul, #channel-subtabbar ul, #footer-subtabbar ul, #footer-tabbar ul.nav-list":"bg-pri-0","#channel-tabbar ul li, #channel-subtabbar ul li, #footer-subtabbar ul li, #footer-tabbar ul.nav-list li":"bg-pri-0",".canvas-widget":"bg-gy-sec0","#subforumdescription":"bg-gy-pri0",".topic-title":"col-pri-3",".b-post-control__label":"col-pri-3",".widget-content, .post-content":"col-pri-0",".list-item":"bg-gy-sec0"};var H={"#vb-page-body":"bg-dk-pri0","#wrapper":"bg-dk-pri0","#header":"bg-dk-pri0","#channel-tabbar, #channel-subtabbar, #footer-subtabbar, #footer-tabbar":"bg-dk-pri0","#channel-tabbar ul, #channel-subtabbar ul, #footer-subtabbar ul, #footer-tabbar ul.nav-list":"bg-pri-0","#channel-tabbar ul li, #channel-subtabbar ul li, #footer-subtabbar ul li, #footer-tabbar ul.nav-list li":"bg-pri-0",".canvas-widget":"bg-pri-0","#subforumdescription":"bg-dk-pri0",".topic-title":"col-pri-3",".b-post-control__label":"col-pri-3",".widget-content, .post-content":"col-dk-sec0",".list-item":"bg-dk-sec0"};switch(B){case"light-ps":A(E);break;case"light-pt":A(D);break;case"grey":A(C);break;case"dark":A(H);break;default:A(E);A(D);A(C);A(H)}switch(G){case"light-pt":F(D);break;break;case"grey":F(C);break;case"dark":F(H);break;case"default":break;case"light-ps":default:F(E)}}var LastRefresh=0,RefreshTimerID;function colorize(){var A=new Date().valueOf();var B=A-LastRefresh;if(B<defs.MaxRedrawRate){if(!RefreshTimerID){RefreshTimerID=setTimeout(doColorize,defs.MaxRedrawRate-B)}}else{doColorize()}}function doColorize(){if(RefreshTimerID){clearTimeout(RefreshTimerID)}RefreshTimerID=null;LastRefresh=new Date().valueOf();var F,E,G,A;$(".bg-pri").css("background-color",Palette.Primary.Base.RGB.getCSS());for(var D=0;D<5;D++){G=Palette.Primary.Col[D];if(Palette.Sec1){A=Palette.Sec1.Col[D]}else{A=Palette.Primary.Col[3]}F=G.RGB;E=A.RGB;if(defs.CBPreview){F="#"+ColorBlind.getHex(F.R,F.G,F.B,defs.CBPreview);E="#"+ColorBlind.getHex(E.R,E.G,E.B,defs.CBPreview)}else{F=F.getCSS();E=E.getCSS()}var C=parseInt($.browser.version,10);if($.browser.msie&&C==7){$("#cbox-bg-pri-"+D).attr("title",rgb2hex(F));$("#cbox-bg-sec1-"+D).attr("title",rgb2hex(E))}$(".col-pri-"+D).css("color",F);$(".col-sec1-"+D).css("color",E);$(".bg-pri-"+D).css("background-color",F).each(function(){this.paletteInfo={col:G,out:F}});$(".bg-sec1-"+D).css("background-color",E).each(function(){this.paletteInfo={col:A,out:E}});$("#currentcolor").css("background-color",$(".var-set .sel img").css("background-color"));$(".brd-pri-"+D).css("border-color",F);$(".brd-sec1-"+D).css("border-color",E)}SchemeID=Palette.serialize();var B=SchemeID;if(B.length>64){B="ID too long to display"}$("#schemeid a").html(B).attr("href",document.location.pathname+"#"+SchemeID);if(!drag.on){updateColorData()}}function updateColorData(){History.add();var A=parseInt($.browser.version,10);if($.browser.msie&&A==7){return }colorTooltips()}var History={List:[],Ptr:-1,add:function(){setOriginalColor();if(this.Ptr<0||this.List[this.Ptr]!=SchemeID){if(this.List.length>this.Ptr+1){this.List=this.List.splice(0,this.Ptr+1)}this.List.push(SchemeID);this.Ptr++;this.updateMenu()}},back:function(){if(this.Ptr<1){return }this.Ptr--;loadScheme(this.List[this.Ptr]);this.updateMenu()},fwd:function(){if(this.Ptr>=this.List.length-1){return }this.Ptr++;loadScheme(this.List[this.Ptr]);this.updateMenu()},updateMenu:function(){if(this.Ptr>0){$("#menu-undo").removeClass("h-disabled")}else{$("#menu-undo").addClass("h-disabled")}if(this.Ptr<this.List.length-1){$("#menu-redo").removeClass("h-disabled")}else{$("#menu-redo").addClass("h-disabled")}}};var moveTimer=0;function dragMove(B,C){var A=new Date();if(A-moveTimer<defs.FPSlimiter){return false}moveTimer=A;if(C.id=="wheel"){moveOnWheel(B)}else{moveOnSlider(B,C)}}function moveOnWheel(E){var A,H,C,D,G=false,F=false;if(E){A=E.pageX-drag.dX;H=E.pageY-drag.dY;C=Math.round(((Math.atan2(-A,H)*180/Math.PI)+180)%360);D=Math.sqrt(A*A+H*H)}else{G=true,F=true}if(D>60&&D<160){var B="dot1";if(drag.dot){B=drag.dot.id}if(B=="dot1"||B=="dot2"){if(D>125){if(D<135){C=(Math.floor((C-7.5)/15+1)*15)%360}else{C=(Math.floor((C-15)/30+1)*30)%360}}if(B=="dot2"){C=(C+180)%360}G=Palette.setHue(C)}else{if(Palette.Scheme=="m1"&&B=="dot4"){C=(C+180)%360}F=Palette.setDist(C)}}if(G||F){updateWheel()}}function moveOnSlider(F,H){var B=F.pageX-drag.dX;var G=F.pageY-drag.dY;B=B/defs.sliderWidth;G=G/defs.sliderWidth;if(B<-0.5){B=-0.5}if(B>0.5){B=0.5}if(G<-0.5){G=-0.5}if(G>0.5){G=0.5}if(H.id=="saturation"){var E,C;if(UseManualVars){E=B+0.5;C=-G+0.5;Palette.setVarOverlay(VarSelected[0],VarSelected[1],E,C)}else{E=B>0.4?(B-0.4)/0.1:(B+0.5)/0.9-1;G=-G;C=G>0.4?(G-0.4)/0.1:(G+0.5)/0.9-1;Palette.setSV(E,C)}updateSV()}else{if(H.id=="contrast"){var A=B+0.5;var D=0.5-G;Palette.setContrast(D,A);updateContrast()}}}function moveDot(D,A){if(!A){return }var B=A.Col[0].HSV.H;var C=(B-90)/360*2*Math.PI;x=Math.round(defs.wheelMid.X+109*Math.cos(C))-defs.dotSize;y=Math.round(defs.wheelMid.Y+109*Math.sin(C))-defs.dotSize;$("#dot"+D).css("left",x+"px").css("top",y+"px")}function moveSliderDot(B,A,C){A=defs.sliderMid.X+A*defs.sliderWidth-defs.dotSize+1;C=defs.sliderMid.Y+C*defs.sliderWidth-defs.dotSize+3;$(B).css("left",A+"px").css("top",C+"px")}function myPrompt(B,A,C){vBulletin.openPromptDialog({message:B,initialValue:A,validation:{callback:vBulletin.openPromptDialog.validationString,showError:true},onClickOK:C})}function getExpr(s){if(!s){return""}s=String(s);if(s.match(/[0-9\.\+\-\*/ ]+/)){s=eval(s)}return s}function enterHue(){myPrompt(vBulletin.phrase.get("enter_hue")+" (0&deg;-360&deg;)",Palette.H,enterHue2)}function enterHue2(A){A=parseInt(getExpr(A),10)%360;if(A>=0&&A<=360){Palette.setHue(A%360);updateWheel()}}function enterComplHue(){myPrompt(vBulletin.phrase.get("enter_complement_hue")+" (0&deg;&ndash;360&deg;)",(Palette.H+180)%360,enterComplHue2)}function enterComplHue2(A){A=parseInt(getExpr(A),10)%360;if(A>=0&&A<=360){Palette.setHue((A+180)%360);updateWheel()}}function enterDist(){var B=Palette.SchemeModel.minD,A=Palette.SchemeModel.maxD;myPrompt(vBulletin.phrase.get("enter_distance_angle")+" ("+B+"&deg;&ndash;"+A+"&deg;)",Palette.Dist,enterDist2)}function enterDist2(B){var C=Palette.SchemeModel.minD,A=Palette.SchemeModel.maxD;B=Math.abs(parseInt(getExpr(B),10));if(B>=C&&B<=A){Palette.setDistNum(B);updateWheel()}}function enterRGB(){myPrompt(vBulletin.phrase.get("enter_hex_value")+" (000000&ndash;FFFFFF)",Palette.Primary.getVarRGB(0).getHex(),enterRGB2)}function enterRGB2(D){if(!D){return""}D=String(D);if(D.match(/^\s*#?([0-9a-f]{6}|[0-9a-f]{3})\s*$/i)){if(D.length==3){D="#"+D}if(D.length==4){D=D.substr(1,1)+D.substr(1,1)+D.substr(2,1)+D.substr(2,1)+D.substr(3,1)+D.substr(3,1)}if(D.length==6){D="#"+D}D=D.substr(1,6);var F=hex2dec(D.substring(0,2));var E=hex2dec(D.substring(2,4));var A=hex2dec(D.substring(4,6));var C=new RGB(F,E,A);var B=ColorWheel.getColorByRGB(C);Palette.setHSV(B);updateWheel()}}function colorTooltips(){}function showTooltips(){$("#menu-tooltips").addClass("sel").html(vBulletin.phrase.get("hide_tooltips"))}function hideTooltips(){$("#menu-tooltips").removeClass("sel").html(vBulletin.phrase.get("show_tooltips"))}function populatePaletteText(B){var G=$("#debug-information").length==1;switch(B){case"light-ps":var E=palInfoColorPri;var F=palInfoColorSec;break;case"light-pt":var E=palInfoWhitePri;var F=palInfoWhiteSec;break;default:var E=palInfoDarkPri;var F=palInfoDarkSec}for(var D=0;D<5;D++){$("#pal-pri-"+D).parent().css("display",E[D]==""?"none":"");$("#pal-sec1-"+D).parent().css("display",F[D]==""?"none":"");var C=parseInt($.browser.version,10);if($.browser.msie&&C==7){var A=$("#cbox-bg-pri-"+D).css("background-color");var H=rgb2hex(A);$("#cbox-bg-pri-"+D).attr("title",H);$("#cbox-bg-sec1-"+D).attr("title",H)}$("#info-pri-"+D).html(vBulletin.phrase.get(E[D])+(G?" (Primary "+D+")":""));$("#info-sec1-"+D).html(vBulletin.phrase.get(F[D])+(G?" (Secondary "+D+")":""))}}function rgb2hex(A){A=A.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);if(!A){return""}return"#"+hex(A[1])+hex(A[2])+hex(A[3])}function hex(A){hexDigits=new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F");return isNaN(A)?"00":hexDigits[(A-A%16)/16]+hexDigits[A%16]}function setOriginalColor(){$("#originalcolor").css("background-color",$("#manualvars a.sel img").css("background-color"))}function check_save_valid(){var B=document.getElementById("form-name");if(B===null){openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("err_order_need_name"),iconType:"warning"});return false}B.value=$.trim(B.value);if(B.value==""){openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("err_order_need_name"),iconType:"warning",onAfterClose:function(){B.focus()}});return false}if(B.value.length>128||B.value.indexOf("'")!==-1||B.value.indexOf('"')!==-1){openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("err_invalid_name"),iconType:"warning",onAfterClose:function(){B.focus()}});return false}var A=document.getElementById("form-displayorder");if(A===null){openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("err_order_need_order"),iconType:"warning"});return false}if(isNaN(parseInt(A.value))){openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("err_order_need_order"),iconType:"warning",onAfterClose:function(){A.focus()}});return false}if(parseInt(A.value)<=0){openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("err_order_negative"),iconType:"warning",onAfterClose:function(){A.focus()}});return false}if(parseInt(A.value)>=1000){openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("err_order_too_large"),iconType:"warning",onAfterClose:function(){A.focus()}});return false}return true}var palInfoColorPri=["primary0_info","primary1_info","primary2_info","primary3_info","primary4_info"];var palInfoColorSec=["secondary0_info","secondary1_info","secondary2_info","","secondary4_info"];var palInfoWhitePri=["primary0_info","primary1_info","primary2_info","",""];var palInfoWhiteSec=["","","","",""];var palInfoDarkPri=["primary0_info","","","primary3_info",""];var palInfoDarkSec=["","","","",""];;

// ***************************
// js.compressed/vbulletin_stylegeneratorcolor.js
// ***************************
function HSV(C,B,A){this.set=function(F,E,D){this.H=F;this.S=E;this.V=D};this.copy=function(){return new HSV(this.H,this.S,this.V)};this.set(C,B,A)}function RGB(C,A,D){this.set=function(F,E,H){this.R=Math.round(F);this.G=Math.round(E);this.B=Math.round(H)};this.copy=function(){return new RGB(this.R,this.G,this.B)};this.toWebCol=function(){this.R=Math.round(this.R/51)*51;this.G=Math.round(this.G/51)*51;this.B=Math.round(this.B/51)*51};this.getCSS=function(){return"rgb("+this.R+","+this.G+","+this.B+")"};this.getHex=function(){return dec2hex(this.R)+dec2hex(this.G)+dec2hex(this.B)};this.set(C,A,D)}var Primary={R:{RGB:new RGB(255,0,0),HSV:new HSV(0,1,1)},RG:{RGB:new RGB(255,255,0),HSV:new HSV(120,1,1)},G:{RGB:new RGB(0,255,0),HSV:new HSV(180,1,0.8)},GB:{RGB:new RGB(0,255,255),HSV:new HSV(210,1,0.6)},B:{RGB:new RGB(0,0,255),HSV:new HSV(255,0.85,0.7)},BR:{RGB:new RGB(255,0,255),HSV:new HSV(315,1,0.65)}};function gInc(B,A,C){return(C==-1)?B:B+(A-B)/(1+C)}function gDec(B,A,C){return(C==-1)?A:A+(B-A)/(1+C)}var ColorWheel={getArc:function(A){if(A<120){return this.RRG}if(A<180){return this.RGG}if(A<210){return this.GGB}if(A<255){return this.GBB}if(A<315){return this.BBR}return this.BRR},RRG:{a:Primary.R,b:Primary.RG,f:function(A){if(A==0){return -1}return Math.tan((120-A)/120*Math.PI/2)*0.5},fi:function(A){if(A==-1){return 0}return 120-Math.atan(A/0.5)*120/Math.PI*2},g:gInc,orderRGB:function(A,B,C){return new RGB(A,B,C)}},RGG:{a:Primary.RG,b:Primary.G,f:function(A){if(A==180){return -1}return Math.tan((A-120)/60*Math.PI/2)*0.5},fi:function(A){if(A==-1){return 180}return 120+Math.atan(A/0.5)*60/Math.PI*2},g:gDec,orderRGB:function(A,B,C){return new RGB(B,A,C)}},GGB:{a:Primary.G,b:Primary.GB,f:function(A){if(A==180){return -1}return Math.tan((210-A)/30*Math.PI/2)*0.75},fi:function(A){if(A==-1){return 180}return 210-Math.atan(A/0.75)*30/Math.PI*2},g:gInc,orderRGB:function(A,B,C){return new RGB(C,A,B)}},GBB:{a:Primary.GB,b:Primary.B,f:function(A){if(A==255){return -1}return Math.tan((A-210)/45*Math.PI/2)*1.33},fi:function(A){if(A==-1){return 255}return 210+Math.atan(A/1.33)*45/Math.PI*2},g:gDec,orderRGB:function(A,B,C){return new RGB(C,B,A)}},BBR:{a:Primary.B,b:Primary.BR,f:function(A){if(A==255){return -1}return Math.tan((315-A)/60*Math.PI/2)*1.33},fi:function(A){if(A==-1){return 255}return 315-Math.atan(A/1.33)*60/Math.PI*2},g:gInc,orderRGB:function(A,B,C){return new RGB(B,C,A)}},BRR:{a:Primary.BR,b:Primary.R,f:function(A){if(A==0){return -1}return Math.tan((A-315)/45*Math.PI/2)*1.33},fi:function(A){if(A==-1){return 0}return 315+Math.atan(A/1.33)*45/Math.PI*2},g:gDec,orderRGB:function(A,B,C){return new RGB(A,C,B)}},getBaseColorByHue:function(E){E=E%360;var D,A,C=this.getArc(E);var B=C.f(E);A=C.g(C.a.HSV.V,C.b.HSV.V,B);D=C.g(C.a.HSV.S,C.b.HSV.S,B);return{HSV:new HSV(E,D,A),RGB:this._getRGB(E,D,A,C,B)}},getRGB:function(E,D,A){var C=this.getArc(E);var B=C.f(E);return this._getRGB(E,D,A,C,B)},_getRGB:function(J,E,C,A,D){var G,I,F,B=A.a.RGB;G=Math.max(B.R,Math.max(B.G,B.B));G=G*C;F=G*(1-E);if(D==-1){I=F}else{I=(G+F*D)/(1+D)}return A.orderRGB(G,I,F)},getColorByRGB:function(F){var J,D,B;if(F.R==F.B&&F.R==F.G){J=0;D=0;B=getLum(F)}else{var G,I,E,A,C;G=Math.max(F.R,Math.max(F.G,F.B));E=Math.min(F.R,Math.min(F.G,F.B));if(G==F.R){if(E==F.B){I=F.G;A=this.RRG}else{I=F.B;A=this.BRR}}else{if(G==F.G){if(E==F.R){I=F.B;A=this.GGB}else{I=F.R;A=this.RGG}}else{if(E==F.R){I=F.G;A=this.GBB}else{I=F.R;A=this.BBR}}}if(I==E){C=-1}else{C=(G-I)/(I-E)}J=A.fi(C);D=(G-E)/G;B=G/255}return new HSV(J,D,B)}};var Model={m1:{getH:function(B,A){return{S1:(B+A)%360,S2:(B-A+360)%360}},minD:5,maxD:360,getD:function(B,A){var C=Math.abs(angleDiff(B,A));return C}}};function angleDiff(C,B){if(B>C){var A=B-C}else{var A=360-(C-B)}return A}var CModel={shadow:[{dS:-0.5,dV:-0.5},{dS:1,dV:-0.7}],light:[{dS:-0.5,dV:1},{dS:-0.9,dV:1}],get:function(D,B){var C,A=[];A.push({dS:this.shadow[0].dS*D,dV:this.shadow[0].dV*D});A.push({dS:this.shadow[1].dS*D,dV:this.shadow[1].dV*D});A.push({dS:this.light[0].dS*B,dV:this.light[0].dV*B});A.push({dS:this.light[1].dS*B,dV:this.light[1].dV*B});return A}};function ColorVar(D,F,B,E,G){this.getVariant=function(M,L,K){function J(N,O){return(O<=0)?N*(O+1):N+(1-N)*O}var I=new HSV(M.H,J(M.S,L),J(M.V,K));var H=ColorWheel.getRGB(I.H,I.S,I.V);return{HSV:I,RGB:H}};this.getOverlayVariant=function(L,K,H){var J=new HSV(L.H,K,H);var I=ColorWheel.getRGB(J.H,J.S,J.V);return{HSV:J,RGB:I}};this.setCol=function(J,I,H){this.Col[J]=this.getVariant(this.Col0.HSV,I,H)};this.getVarHSV=function(H){return this.Col[H].HSV};this.getVarRGB=function(H){return this.Col[H].RGB};this.H=D;this.Base=ColorWheel.getBaseColorByHue(D);this.Col0=this.getVariant(this.Base.HSV,F,B);this.Col=[];if(G[0]){this.Col.push(this.getOverlayVariant(this.Base.HSV,G[0][0],G[0][1]))}else{this.Col.push(this.Col0)}for(var C=0,A=E.length;C<A;C++){if(G[C+1]){this.Col[C+1]=this.getOverlayVariant(this.Base.HSV,G[C+1][0],G[C+1][1])}else{this.Col[C+1]=this.getVariant(this.Col0.HSV,E[C].dS,E[C].dV)}}}var Palette={Scheme:"m1",SchemeModel:Model.m1,H:0,Dist:15,dS:0,dV:0,cS:0.5,cL:0.5,ContrastModel:CModel.get(0.5,0.5),UseVarsOverlay:false,VarsOverlay:[[],[],[],[]],setScheme:function(A){this.Scheme=A;this.SchemeModel=Model[this.Scheme];this.resetVarsOverlay(false);if(this.Sec1){this.setDist(this.Sec1.H)}},setHue:function(A){if(this.H===A){return false}this.H=Math.round(A)%360;this.resetVarsOverlay(false);return true},setHSV:function(A){this.setHue(A.H);var B=this.Primary.Base.HSV;if(B.S==0){this.dS=0}else{if(A.S>B.S){this.dS=(A.S-B.S)/(1-B.S)}else{this.dS=A.S/B.S-1}}if(B.V==0){this.dV=0}else{if(A.V>B.V){this.dV=(A.V-B.V)/(1-B.V)}else{this.dV=A.V/B.V-1}}this.resetVarsOverlay(false)},setDist:function(A){this.Dist=this.SchemeModel.getD(this.H,A);this.resetVarsOverlay(false);return true},setDistNum:function(A){this.Dist=A;this.resetVarsOverlay(false);return true},setSV:function(B,A){this.dS=B;this.dV=A;this.resetVarsOverlay(false)},setContrast:function(B,A){this.UseVarsOverlay=false;this.cS=B;this.cL=A;this.ContrastModel=CModel.get(B,A);this.resetVarsOverlay(false)},resetVarsOverlay:function(A){this.UseVarsOverlay=false;this.VarsOverlay=[[],[],[],[]];if(!A){this.update()}},setVarOverlay:function(C,B,E,D,A){this.UseVarsOverlay=true;this.VarsOverlay[C][B]=[E,D];if(!A){this.update()}},getVarOverlay:function(C,B){var A=this.VarsOverlay[C][B];if(A){return A}var D=this.getColorByIdx(C).Col[B].HSV;return[D.S,D.V]},update:function(A){var B=this.SchemeModel.getH(this.H,this.Dist);if(!A){this.Primary=new ColorVar(this.H,this.dS,this.dV,this.ContrastModel,this.VarsOverlay[0]);this.Compl=B.C==undefined?null:new ColorVar(B.C,this.dS,this.dV,this.ContrastModel,this.VarsOverlay[3])}this.Sec1=B.S1==undefined?null:new ColorVar(B.S1,this.dS,this.dV,this.ContrastModel,this.VarsOverlay[1]);this.Sec2=B.S2==undefined?null:new ColorVar(B.S2,this.dS,this.dV,this.ContrastModel,this.VarsOverlay[2])},serialize:function(){var C="";C+=myB64.encodeInt(this.H,2);C+=this.Scheme.substring(1);C+=myB64.encodeInt(this.Dist+90,2);C+=myB64.encodeFloat((this.dS+1)/2,2);C+=myB64.encodeFloat((this.dV+1)/2,2);C+=myB64.encodeFloat(this.cS,2);C+=myB64.encodeFloat(this.cL,2);if(this.UseVarsOverlay){var B,A;for(B=0;B<4;B++){for(A=0;A<5;A++){if(this.VarsOverlay[B][A]){C+=myB64.encodeInt(8*B+A,1);C+=myB64.encodeFloat((this.VarsOverlay[B][A][0]+1)/2,2);C+=myB64.encodeFloat((this.VarsOverlay[B][A][1]+1)/2,2)}}}}return C},unserialize:function(H){var C,A=[];var F=0;C=H.substring(F,F+2);C=myB64.decodeInt(C);if(C>=0&&C<360){A.push(C)}else{return false}F+=2;C="m"+H.substring(F,F+1);if(Model[C]){A.push(C)}else{return false}F+=1;C=H.substring(F,F+2);C=myB64.decodeInt(C)-90;if(C>=-180&&C<=180){A.push(C)}else{return false}F+=2;C=H.substring(F,F+2);C=myB64.decodeFloat(C,2,5)*2-1;if(C>=-1&&C<=1){A.push(C)}else{return false}F+=2;C=H.substring(F,F+2);C=myB64.decodeFloat(C,2,5)*2-1;if(C>=-1&&C<=1){A.push(C)}else{return false}F+=2;C=H.substring(F,F+2);C=myB64.decodeFloat(C,2,5);if(C>=0&&C<=1){A.push(C)}else{return false}F+=2;C=H.substring(F,F+2);C=myB64.decodeFloat(C,2,5);if(C>=0&&C<=1){A.push(C)}else{return false}F+=2;this.setAll(A[1],A[0],A[2],A[3],A[4],A[5],A[6]);if(H.length>F){var E,D,G,B;while(H.length>F){C=H.substring(F,F+1);C=myB64.decodeInt(C);E=Math.floor(C/8);D=C-E*8;if(E<0||E>3||D<0||D>4){return false}F+=1;C=H.substring(F,F+2);G=myB64.decodeFloat(C,2,5)*2-1;if(G<-1||G>1){return false}F+=2;C=H.substring(F,F+2);B=myB64.decodeFloat(C,2,5)*2-1;if(B<-1||B>1){return false}F+=2;this.setVarOverlay(E,D,G,B,true);push}this.update()}},setAll:function(C,E,G,F,B,D,A){this.Scheme=C;this.SchemeModel=Model[this.Scheme];this.H=E;this.Dist=G;this.dS=F;this.dV=B;this.cS=D;this.cL=A;this.ContrastModel=CModel.get(this.cS,this.cL);this.resetVarsOverlay()},Presets:[{id:"default",name:"Default Scheme",dS:0,dV:0,cS:0.5,cL:0.5}],getPreset:function(C){for(var B=0,A=this.Presets.length;B<A;B++){if(this.Presets[B].id==C){return this.Presets[B]}}return this.Presets[0]},usePreset:function(B){this.resetVarsOverlay();var A=this.getPreset(B);this.setSV(A.dS,A.dV);this.setContrast(A.cS,A.cL)},getColorByIdx:function(B){var A=["Primary","Sec1"];if(!A[B]){B=0}return this[A[B]]}};Palette.update();function dec2hex(C,A){if(!A){A=2}var B=C.toString(16);while(B.length<A){B="0"+B}return B.toUpperCase()}function hex2dec(A){return parseInt(A,16)}function flags2dec(B){var A=0;for(var C=0;C<8;C++){if(B[C]){A|=Math.pow(2,C)}}return A}function dec2flags(C){var A=[];for(var B=0;B<8;B++){A[B]=C&Math.pow(2,B)}return A}function rgb2hex(A){return dec2hex(A.R)+dec2hex(A.G)+dec2hex(A.B)}function getLum(A){return lum=(A.R*0.299+A.G*0.587+A.B*0.114)/255}function col2Gray(B){var A=Math.round(getLum(B)*255);return rgb2hex({R:A,G:A,B:A})}var myB64={_key:"0123456789abcdefghijklmnopqrstuvwxyz.ABCDEFGHIJKLMNOPQRSTUVWXYZ-",_pad:"0000000000000000",encodeInt:function(E,B){var D="",C,A=E;if(!E){D="0"}while(A){C=A&63;D=this._key.charAt(C)+D;A>>=6}if(B){D=this._pad+D;D=D.substring(D.length-B)}return D},decodeInt:function(D){var B,C,E=0;if(!D){return 0}for(var C=0,A=D.length;C<A;C++){E<<=6;B=this._key.indexOf(D.charAt(C));E|=B}return E},encodeFloat:function(B,A){if(!A){A=1}var C=Math.round((Math.pow(64,A)-1)*B);return this.encodeInt(C,A)},decodeFloat:function(D,B,F){var E=this.decodeInt(D);if(!E){return 0}var A=E/(Math.pow(64,B)-1);if(F){var C=Math.pow(10,F);A=Math.round(A*C)/C}return A}};var ColorBlind={getHex:function(A,G,N,L){function E(T,Q,S,R){return Math.round(T-Math.abs((S-R)/51)*(T-Q))}var D=Math.round(A/51)*51;var B=Math.round(G/51)*51;var O=Math.round(N/51)*51;var C=(D<A)?D+51:((D>A)?D-51:D);var P=(B<G)?B+51:((B>G)?B-51:B);var M=(O<N)?O+51:((O>N)?O-51:O);var I=this.colTbl[dec2hex(D)+dec2hex(B)+dec2hex(O)][L];var H=this.colTbl[dec2hex(C)+dec2hex(P)+dec2hex(M)][L];var F=E(hex2dec(I.substring(0,2)),hex2dec(H.substring(0,2)),D,A);var K=E(hex2dec(I.substring(2,4)),hex2dec(H.substring(2,4)),B,G);var J=E(hex2dec(I.substring(4,6)),hex2dec(H.substring(4,6)),O,N);return dec2hex(F)+dec2hex(K)+dec2hex(J)},typeDesc:["Normal vision (85.5 % of population)","Protanopy (1 % of men, 0.02 % of women)","Deuteranopy (1 % of men, 0.1 % of women)","Tritanopy (0.003 % of population)","Protanomaly (1 % of men, 0.01% of women)","Deuteranomaly (5 % of men, 0.4 % of women)","Tritanomaly (0.01 % of population)","Full colorblindness (0.005 % of population)","Atypical monochromatism (0.005 % of population)"],colTbl:{FFFFFF:["FFFFFF","FFFAFA","FFE8EF","F4F0FF","FFFCFC","FFF3F7","F9F7FF","FFFFFF","FFFFFF"],FFFFCC:["FFFFCC","FFF2C8","FFDFC8","FDEFFF","FFF8CA","FFEFCA","FEF7E5","EEEEEE","F1F1E7"],FFFF99:["FFFF99","FFEDA2","FFDAAD","FFEAF9","FFF69D","FFECA3","FFF4C9","DDDDDD","E3E3CF"],FFFF66:["FFFF66","FFEA86","FFD79D","FFE6F5","FFF476","FFEB81","FFF2AD","CCCCCC","D6D6B7"],FFFF33:["FFFF33","FFE975","FFD594","FFE5F3","FFF454","FFEA63","FFF293","BBBBBB","C8C89F"],FFFF00:["FFFF00","FFE871","FFD592","FFE4F2","FFF338","FFEA49","FFF179","AAAAAA","BBBB88"],FFCCFF:["FFCCFF","CFD7FF","E1D8FD","FBD1E1","E7D1FF","F0D2FE","FDCEF0","EEEEEE","F1E7F1"],FFCCCC:["FFCCCC","DED8D2","F1D2CB","FFCAD8","EED2CF","F8CFCB","FFCBD2","DDDDDD","E3D9D9"],FFCC99:["FFCC99","E5D69D","FCCD99","FFC4D1","F2D19B","FDCC99","FFC8B5","CCCCCC","D6CCC1"],FFCC66:["FFCC66","E9D469","FFCA6F","FFC0CD","F4D067","FFCB6A","FFC699","BBBBBB","C8BEAA"],FFCC33:["FFCC33","ECD435","FFC857","FFBFCA","F5D034","FFCA45","FFC57E","AAAAAA","BBB092"],FFCC00:["FFCC00","ECD30F","FFC750","FFBECA","F5CF07","FFC928","FFC565","999999","ADA37A"],FF99FF:["FF99FF","AABDFF","B0BCF9","F6A9B5","D4ABFF","D7AAFC","FAA1DA","DDDDDD","E3CFE3"],FF99CC:["FF99CC","B1B8E0","C5B5C7","FC9FAA","D8A8D6","E2A7C9","FD9CBB","CCCCCC","D6C1CC"],FF9999:["FF9999","BDB6A8","D2B095","FF99A2","DEA7A0","E8A497","FF999D","BBBBBB","C8B4B4"],FF9966:["FF9966","C4B470","DAAC62","FF959E","E1A66B","ECA264","FF9782","AAAAAA","BBA69C"],FF9933:["FF9933","C7B43A","DEAB2A","FF949D","E3A636","EEA22E","FF9668","999999","AD9984"],FF9900:["FF9900","C8B317","DFAA00","FF949C","E3A60B","EFA100","FF964E","888888","9F8B6C"],FF66FF:["FF66FF","98B2FF","85A7F5","F28791","CB8CFF","C286FA","F876C8","CCCCCC","D6B7D6"],FF66CC:["FF66CC","82A0F6","A09FC3","F87981","C083E1","CF82C7","FB6FA6","BBBBBB","C8AABE"],FF6699:["FF6699","999DB9","B19992","FD6E74","CC81A9","D87F95","FE6A86","AAAAAA","BB9CA6"],FF6666:["FF6666","A59B7C","BB955E","FF666C","D28071","DD7D62","FF6669","999999","AD8E8E"],FF6633:["FF6633","AA9A42","BF9322","FF656A","D4803A","DF7C2A","FF654E","888888","9F8177"],FF6600:["FF6600","AC9A1E","C09300","FF6569","D5800F","DF7C00","FF6534","777777","92735F"],FF33FF:["FF33FF","96B1FF","679BF2","F07178","CA72FF","B367F8","F752BB","BBBBBB","C89FC8"],FF33CC:["FF33CC","779DFF","8A92C1","F75E63","BB68E5","C462C6","FB4897","AAAAAA","BB92B0"],FF3399:["FF3399","7A8ECE","9D8B8F","FB4C4F","BC60B3","CE5F94","FD3F74","999999","AD8499"],FF3366:["FF3366","8F8C8B","A7875C","FE3D3E","C75F78","D35D61","FE3852","888888","9F7781"],FF3333:["FF3333","988B4A","AD841C","FF3332","CB5F3E","D65B27","FF3332","777777","926969"],FF3300:["FF3300","9A8B23","AE8600","FF3331","CC5F11","D65C00","FF3318","666666","845B51"],FF00FF:["FF00FF","96B1FF","5E98F1","F06A71","CA58FF","AE4CF8","F735B8","AAAAAA","BB88BB"],FF00CC:["FF00CC","7BA0FF","838FC0","F6555A","BD50E5","C147C6","FA2A93","999999","AD7AA3"],FF0099:["FF0099","6E89D7","97888E","FA4042","B644B8","CB4493","FC206D","888888","9F6C8B"],FF0066:["FF0066","888892","A2835B","FD2B28","C3447C","D04160","FE1547","777777","925F73"],FF0033:["FF0033","93874E","A8801A","FE1A00","C94340","D34026","FE0D19","666666","84515B"],FF0000:["FF0000","968726","A98200","FE1C00","CA4313","D44100","FE0E00","555555","774444"],CCFFFF:["CCFFFF","F8F4F8","FFEAFD","CBEFFF","E2F9FB","E5F4FE","CBF7FF","EEEEEE","E7F1F1"],CCFFCC:["CCFFCC","FFF1C5","FFDECC","D3EFFF","E5F8C8","E5EECC","CFF7E5","DDDDDD","D9E3D9"],CCFF99:["CCFF99","FFEB97","FFD8AB","D9EEFF","E5F598","E5EBA2","D2F6CC","CCCCCC","CCD6C1"],CCFF66:["CCFF66","FFE873","FFD497","DDEEFF","E5F36C","E5E97E","D4F6B2","BBBBBB","BEC8AA"],CCFF33:["CCFF33","FFE75C","FFD38C","E0EEFF","E5F347","E5E95F","D6F699","AAAAAA","B0BB92"],CCFF00:["CCFF00","FFE655","FFD389","E0EEFF","E5F22A","E5E944","D6F67F","999999","A3AD7A"],CCCCFF:["CCCCFF","C4CEFF","CBCCFF","C6D1E1","C8CDFF","CBCCFF","C9CEF0","DDDDDD","D9D9E3"],CCCCCC:["CCCCCC","CFCBCB","DEC6CD","CECAD9","CDCBCB","D5C9CC","CDCBD2","CCCCCC","CCCCCC"],CCCC99:["CCCC99","D7C997","EAC19B","D3C4D3","D1CA98","DBC69A","CFC8B6","BBBBBB","BEBEB4"],CCCC66:["CCCC66","DBC764","F1BE6A","D7C1CF","D3C965","DEC568","D1C69A","AAAAAA","B0B09C"],CCCC33:["CCCC33","DDC631","F5BC3B","D8BFCD","D4C932","E0C437","D2C580","999999","A3A384"],CCCC00:["CCCC00","DDC600","F6C600","D9BECC","D4C900","E1C900","D2C566","888888","95956C"],CC99FF:["CC99FF","98B1FF","8FAEFB","BFA9B6","B2A5FF","ADA3FD","C5A1DA","CCCCCC","CCC1D6"],CC99CC:["CC99CC","9EA8D7","AAA7C9","C79FAB","B5A0D1","BBA0CA","C99CBB","BBBBBB","BEB4BE"],CC9999:["CC9999","AAA5A0","BAA198","CD98A2","BB9F9C","C39D98","CC989D","AAAAAA","B0A6A6"],CC9966:["CC9966","B1A46A","C49D65","D0929D","BE9E68","C89B65","CE9581","999999","A3998E"],CC9933:["CC9933","B5A336","C99B32","D2909A","C09E34","CA9A32","CF9466","888888","958B77"],CC9900:["CC9900","B5A20E","CA9A00","D38F99","C09D07","CB9900","CF944C","777777","887D5F"],CC66FF:["CC66FF","87A7FF","4C97F6","BB8791","A986FF","8C7EFA","C376C8","BBBBBB","BEAAC8"],CC66CC:["CC66CC","648CEB","7B8DC5","C37982","9879DB","A379C8","C76FA7","AAAAAA","B09CB0"],CC6699:["CC6699","7F88AF","918694","C96E75","A577A4","AE7696","CA6A87","999999","A38E99"],CC6666:["CC6666","8C8675","9E8161","CC656C","AC766D","B57363","CC6569","888888","958181"],CC6633:["CC6633","92853C","A47E2B","CE6067","AF7537","B8722F","CD634D","777777","887369"],CC6600:["CC6600","948415","A67F00","CF5F65","B0750A","B97200","CD6232","666666","7A6651"],CC33FF:["CC33FF","8AAAFF","008DEF","B87178","AB6EFF","6660F7","C252BB","AAAAAA","B092BB"],CC33CC:["CC33CC","4387FF","577EC2","C15E64","875DE5","9158C7","C64898","999999","A384A3"],CC3399:["CC3399","5275C8","767591","C64C50","8F54B0","A15495","C93F74","888888","95778B"],CC3366:["CC3366","707387","856F5F","CA3D3F","9E5376","A85162","CB3852","777777","886973"],CC3333:["CC3333","7B7146","8C6C27","CC3334","A3523C","AC4F2D","CC3333","666666","7A5B5B"],CC3300:["CC3300","7E711B","8F6D00","CC3030","A5520D","AD5000","CC3118","555555","6C4E44"],CC00FF:["CC00FF","8CABFF","008CEC","B76A71","AC55FF","6646F5","C135B8","999999","A37AAD"],CC00CC:["CC00CC","5D91FF","4B7AC0","C0555A","9448E5","8B3DC6","C62A93","888888","956C95"],CC0099:["CC0099","356FD5","6E7190","C64043","8037B7","9D3894","C9206E","777777","885F7D"],CC0066:["CC0066","646D90","7E6A5E","CA2B2B","98367B","A53562","CB1548","666666","7A5166"],CC0033:["CC0033","746C4C","856726","CB170B","A0363F","A8332C","CB0B1F","555555","6C444E"],CC0000:["CC0000","786C1E","886900","CC1600","A2360F","AA3400","CC0B00","444444","5F3636"],"99FFFF":["99FFFF","EFECF4","F4E4FF","A6EFFF","C4F5F9","C6F1FF","9FF7FF","DDDDDD","CFE3E3"],"99FFCC":["99FFCC","F7E9C1","FFDDD0","ACEFFF","C8F4C6","CCEECE","A2F7E5","CCCCCC","C1D6CC"],"99FF99":["99FF99","FBE790","FFD6A9","B0EEFF","CAF394","CCEAA1","A4F6CC","BBBBBB","B4C8B4"],"99FF66":["99FF66","FEE65E","FFD291","B4EEFF","CBF262","CCE87B","A6F6B2","AAAAAA","A6BB9C"],"99FF33":["99FF33","FFE532","FFD184","B5EDFF","CCF232","CCE85B","A7F699","999999","99AD84"],"99FF00":["99FF00","FFE41C","FFD080","B6EDFF","CCF10E","CCE740","A7F67F","888888","8B9F6C"],"99CCFF":["99CCFF","B9C5FA","B9C4FF","91D1E1","A9C8FC","A9C8FF","95CEF0","CCCCCC","C1CCD6"],"99CCCC":["99CCCC","C4C1C6","CEBDCF","9CCAD9","AEC6C9","B3C4CD","9ACBD2","BBBBBB","B4BEBE"],"99CC99":["99CC99","CBBF93","DBB89D","A3C4D3","B2C596","BAC29B","9EC8B6","AAAAAA","A6B0A6"],"99CC66":["99CC66","CFBD61","E4B56C","A8C1CF","B4C463","BEC069","A0C69A","999999","99A38E"],"99CC33":["99CC33","D1BC2F","E8B33F","AABFCD","B5C431","C0BF39","A1C580","888888","8B9577"],"99CC00":["99CC00","D2BC00","E9B22A","ABBECD","B5C400","C1BF15","A2C566","777777","7D885F"],"9999FF":["9999FF","83A4FF","6FA4FD","86A9B6","8E9EFF","849EFE","8FA1DA","BBBBBB","B4B4C8"],"9999CC":["9999CC","8F9CCE","929BCC","929FAB","949ACD","959ACC","959CBB","AAAAAA","A6A6B0"],"999999":["999999","9B9899","A6949A","9A97A3","9A9899","9F9699","99989E","999999","999999"],"999966":["999966","A29665","B29068","9F929D","9D9765","A59467","9C9581","888888","8B8B81"],"999933":["999933","A59532","B78E37","A2909A","9F9732","A89335","9D9466","777777","7D7D69"],"999900":["999900","A69500","A69500","A28F99","9F9700","9F9700","9D944C","666666","707051"],"9966FF":["9966FF","709BFF","0090F3","7E8791","8480FF","4C7BF9","8B76C8","AAAAAA","A69CBB"],"9966CC":["9966CC","497BDF","507FC7","8C7982","7170D5","7472C9","926FA7","999999","998EA3"],"996699":["996699","6A77A5","737696","946D75","816E9F","866E97","966987","888888","8B818B"],"996666":["996666","78746D","847064","9A656C","886D69","8E6B65","996569","777777","7D7373"],"996633":["996633","7E7237","8C6D31","9C6067","8B6C35","926932","9A634D","666666","70665B"],"996600":["996600","7F720D","8E6C00","9D5F66","8C6C06","936900","9B6233","555555","625844"],"9933FF":["9933FF","7DA2FF","008DE8","7A7078","8B6AFF","4C60F3","8951BB","999999","9984AD"],"9933CC":["9933CC","007AF6","0073C2","885D64","4C56E1","4C53C7","904898","888888","8B7795"],"993399":["993399","005EBF","496192","914C51","4C48AC","714A95","953F75","777777","7D697D"],"993366":["993366","505B80","625961","963D40","744773","7D4663","973853","666666","705B66"],"993333":["993333","5F5941","6C552D","993335","7C463A","824430","993334","555555","624E4E"],"993300":["993300","635913","705600","9A3032","7E4609","844400","993119","444444","554036"],"9900FF":["9900FF","83A6FF","008CE5","796A71","8E53FF","4C46F2","8935B8","888888","8B6C9F"],"9900CC":["9900CC","2782FF","0073C0","87555B","6041E5","4C39C6","902A93","777777","7D5F88"],"990099":["990099","0067D0","385B90","904044","4C33B4","682D94","94206E","666666","705170"],"990066":["990066","39538F","57535F","962B2C","69297A","782962","971549","555555","624458"],"990033":["990033","55514A","634E2C","981612","77283E","7E272F","980B22","444444","553640"],"990000":["990000","5A5117","674F00","991100","79280B","802700","990800","333333","472828"],"66FFFF":["66FFFF","EAE7F0","EBDFFF","88EFFF","A8F3F7","A8EFFF","77F7FF","CCCCCC","B7D6D6"],"66FFCC":["66FFCC","F1E4BF","FFDDD3","8BEFFF","ABF1C5","B2EECF","78F7E5","BBBBBB","AAC8BE"],"66FF99":["66FF99","F6E28D","FFD5A7","8EEEFF","AEF093","B2EAA0","7AF6CC","AAAAAA","9CBBA6"],"66FF66":["66FF66","F8E15D","FFD08B","90EEFF","AFF061","B2E778","7BF6B2","999999","8EAD8E"],"66FF33":["66FF33","FAE02A","FFCF7C","92EDFF","B0EF2E","B2E757","7CF699","888888","819F77"],"66FF00":["66FF00","FAE000","FFCE79","92EDFF","B0EF00","B2E63C","7CF67F","777777","73925F"],"66CCFF":["66CCFF","B2BEF5","ADBEFF","57D1E1","8CC5FA","89C5FF","5ECEF0","BBBBBB","AABEC8"],"66CCCC":["66CCCC","BDBBC1","C3B7D1","6BCAD9","91C3C6","94C1CE","68CBD2","AAAAAA","9CB0B0"],"66CC99":["66CC99","C4B88F","D2B29F","77C4D3","95C294","9CBF9C","6EC8B6","999999","8EA399"],"66CC66":["66CC66","C8B65E","DAAE6E","7EC1CF","97C162","A0BD6A","72C69A","888888","819581"],"66CC33":["66CC33","CAB52D","DFAC42","81BFCD","98C030","A2BC3A","73C580","777777","738869"],"66CC00":["66CC00","CAB500","E0AC2E","82BECD","98C000","A3BC17","74C566","666666","667A51"],"6699FF":["6699FF","6E98FE","519CFE","3EA9B6","6A98FE","5B9AFE","52A1DA","AAAAAA","9CA6BB"],"6699CC":["6699CC","8593C7","8093CD","5A9FAB","7596C9","7396CC","609CBB","999999","8E99A3"],"669999":["669999","918F93","978C9C","6997A3","7B9496","7E929A","67989E","888888","818B8B"],"669966":["669966","988C61","A4876A","71929D","7F9263","859068","6B9581","777777","737D73"],"669933":["669933","9B8B2F","AA853B","74909A","809231","888F37","6D9466","666666","66705B"],"669900":["669900","9B8B00","AC8421","758F9A","809200","898E10","6D944D","555555","586244"],"6666FF":["6666FF","518DFF","0090EE","228791","5B79FF","337BF6","4476C8","999999","8E8EAD"],"6666CC":["6666CC","326ED5","0076C9","4D7982","4C6AD0","336ECA","596FA7","888888","818195"],"666699":["666699","59699C","586A98","5E6D75","5F679A","5F6898","626987","777777","73737D"],"666666":["666666","686666","6F6367","67656C","676666","6A6466","666569","666666","666666"],"666633":["666633","6D6432","795F35","6B6067","696532","6F6234","68634D","555555","58584E"],"666600":["666600","6F6300","7B5E11","6C5F66","6A6400","706208","696233","444444","4A4A36"],"6633FF":["6633FF","6E9AFF","008CE4","007179","6A66FF","335FF1","3352BC","888888","81779F"],"6633CC":["6633CC","0074EA","0076C2","445D64","3353DB","3354C7","554898","777777","736988"],"663399":["663399","0059B4","005995","584C51","3346A6","334697","5F3F75","666666","665B70"],"663366":["663366","324676","3D4763","623D41","4C3C6E","513D64","643853","555555","584E58"],"663333":["663333","46433A","4F4031","663336","563B36","5A3932","663334","444444","4A4040"],"663300":["663300","4A420B","534000","673033","583A05","5C3900","663119","333333","3D3328"],"6600FF":["6600FF","7AA1FF","008BE1","006B73","7050FF","3345F0","3335B9","777777","735F92"],"6600CC":["6600CC","007CF8","0076BF","42545B","333EE2","333BC5","542A93","666666","66517A"],"660099":["660099","0065CA","005A94","563F44","3332B1","332D96","5E1F6E","555555","584462"],"660066":["660066","00478E","253D60","602B2D","33237A","451E63","631549","444444","4A364A"],"660033":["660033","323748","3F352F","651615","4C1B3D","521A31","650B24","333333","3D2833"],"660000":["660000","3C360F","453500","660B00","511B07","551A00","660500","222222","2F1B1B"],"33FFFF":["33FFFF","E7E5EF","E7DDFF","74EFFF","8DF2F7","8DEEFF","53F7FF","BBBBBB","9FC8C8"],"33FFCC":["33FFCC","EEE2BD","FCDBD4","76EFFF","90F0C4","97EDD0","54F7E5","AAAAAA","92BBB0"],"33FF99":["33FF99","F3DF8C","FFD4A6","78EEFF","93EF92","99E99F","55F6CC","999999","84AD99"],"33FF66":["33FF66","F5DE5C","FFCF88","79EEFF","94EE61","99E777","56F6B2","888888","779F81"],"33FF33":["33FF33","F7DD29","FFCD78","7AEDFF","95EE2E","99E655","56F699","777777","699269"],"33FF00":["33FF00","F7DD00","FFCD74","7AEDFF","95EE00","99E63A","56F67F","666666","5B8451"],"33CCFF":["33CCFF","AEBBF2","A7BBFF","00D1E0","70C3F8","6DC3FF","19CEEF","AAAAAA","92B0BB"],"33CCCC":["33CCCC","B9B7BF","BDB4D1","3ECAD9","76C1C5","78C0CE","38CBD2","999999","84A3A3"],"33CC99":["33CC99","C0B48E","CCAEA0","54C4D3","79C093","7FBD9C","43C8B6","888888","77958B"],"33CC66":["33CC66","C4B25D","D6AB6F","5EC1CF","7BBF61","84BB6A","48C69A","777777","698873"],"33CC33":["33CC33","C6B22C","DAA943","63BFCD","7CBF2F","86BA3B","4BC580","666666","5B7A5B"],"33CC00":["33CC00","C6B100","DBA830","64BFD7","7CBE00","87BA18","4BC56B","555555","4E6C44"],"3399FF":["3399FF","6993FA","3999FF","00ABB7","4E96FC","3699FF","19A2DB","999999","8499AD"],"3399CC":["3399CC","7F8EC3","758FCE","00A0AC","5993C7","5494CD","199CBC","888888","778B95"],"339999":["339999","8C8A90","8F879D","3997A3","5F9194","61909B","36989E","777777","697D7D"],"339966":["339966","92875E","9D826B","49929D","629062","688D68","3E9581","666666","5B7066"],"339933":["339933","95862E","A4803C","4F909A","648F30","6B8C37","419466","555555","4E624E"],"339900":["339900","958600","A58600","518F9A","648F00","6C8F00","42944D","444444","405536"],"3366FF":["3366FF","2581FF","0090EC","009099","2C73FF","197BF5","197BCC","888888","77819F"],"3366CC":["3366CC","2067CD","0078C9","007F87","2966CC","196FCA","1972A9","777777","697388"],"336699":["336699","506195","43639A","146D76","416397","3B6499","236987","666666","5B6670"],"336666":["336666","5E5D61","615B68","35656D","486163","4A6067","346569","555555","4E5858"],"336633":["336633","645B2F","6D5737","3F6068","4B6031","505E35","39634D","444444","404A40"],"336600":["336600","655B00","705617","415F66","4C6000","515E0B","3A6233","333333","333D28"],"3333FF":["3333FF","6094FF","008CE2","008187","4963FF","195FF0","195AC3","777777","696992"],"3333CC":["3333CC","0070E1","0078C2","006A70","1951D6","1955C7","194E9E","666666","5B5B7A"],"333399":["333399","0054AA","005D99","005056","1943A1","194899","194177","555555","4E4E62"],"333366":["333366","19376A","003B65","263C41","263568","193765","2C3753","444444","40404A"],"333333":["333333","343333","373133","333236","333333","353233","333234","333333","333333"],"333300":["333300","373200","3D2F09","363033","353200","383104","343119","222222","25251B"],"3300FF":["3300FF","739DFF","008BDF","007C82","534EFF","1945EF","193EC0","666666","5B5184"],"3300CC":["3300CC","0079F2","0076BF","006469","193CDF","193BC5","19329A","555555","4E446C"],"330099":["330099","0062C4","005D96","00474B","1931AE","192E97","192372","444444","403655"],"330066":["330066","00468B","003F67","212A2D","192378","191F66","2A1549","333333","33283D"],"330033":["330033","002448","131E30","301517","19123D","230F31","310A25","222222","251B25"],"330000":["330000","1E1B08","221A00","330600","280D04","2A0D00","330300","111111","170D0D"],"00FFFF":["00FFFF","E6E4EE","E6DCFF","6EEFFF","73F1F6","73EDFF","37F7FF","AAAAAA","88BBBB"],"00FFCC":["00FFCC","EDE1BD","FBDAD4","70EFFF","76F0C4","7DECD0","38F7E5","999999","7AADA3"],"00FF99":["00FF99","F2DF8C","FFD3A6","72EEFF","79EF92","7FE99F","39F6CC","888888","6C9F8B"],"00FF66":["00FF66","F5DD5C","FFCF87","73EEFF","7AEE61","7FE776","39F6B2","777777","5F9273"],"00FF33":["00FF33","F6DD29","FFCD77","73EDFF","7BEE2E","7FE655","39F699","666666","51845B"],"00FF00":["00FF00","F6DC00","FFCD72","73EDFF","7BED00","7FE639","39F67F","555555","447744"],"00CCFF":["00CCFF","ADBAF2","A5BBFF","00D0DF","56C3F8","52C3FF","00CEEF","999999","7AA3AD"],"00CCCC":["00CCCC","B8B6BF","BBB3D1","29CAD9","5CC1C5","5DBFCE","14CBD2","888888","6C9595"],"00CC99":["00CC99","BFB38D","CBAEA0","47C4D3","5FBF93","65BD9C","23C8B6","777777","5F887D"],"00CC66":["00CC66","C3B25D","D4AA6F","54C1CF","61BF61","6ABB6A","2AC69A","666666","517A66"],"00CC33":["00CC33","C5B12B","D9A844","59BFCD","62BE2F","6CBA3B","2CC580","555555","446C4E"],"00CC00":["00CC00","C5B000","DAA831","5ABFCD","62BE00","6DBA18","2DC566","444444","365F36"],"0099FF":["0099FF","6792F8","3398FF","00ACB7","3395FB","1998FF","00A2DB","888888","6C8B9F"],"0099CC":["0099CC","7E8DC2","728ECF","00A1AC","3F93C7","3993CD","009DBC","777777","5F7D88"],"009999":["009999","8A898F","8D869D","1F97A3","459194","468F9B","0F989E","666666","517070"],"009966":["009966","90865E","9B816C","39929D","488F62","4D8D69","1C9581","555555","446258"],"009933":["009933","93852D","A27E3D","42909A","498F30","518B38","219466","444444","365540"],"009900":["009900","948500","A37E25","448F9A","4A8F00","518B12","22944D","333333","284728"],"0066FF":["0066FF","007EFE","0090EC","00929A","0072FE","007BF5","007CCC","777777","5F7392"],"0066CC":["0066CC","1A66CC","0078C9","00828A","0D66CC","006FCA","0074AB","666666","51667A"],"006699":["006699","4E5F93","3D629A","00727A","276296","1E6499","006C89","555555","445862"],"006666":["006666","5C5B5F","5E5A69","15656D","2E6062","2F6067","0A6569","444444","364A4A"],"006633":["006633","61592E","6A5538","2A6068","305F30","355D35","15634D","333333","283D33"],"006600":["006600","635800","6D5418","2D5F66","315F00","365D0C","166233","222222","1B2F1B"],"0033FF":["0033FF","5B91FF","008CE2","008389","2D62FF","005FF0","005BC4","666666","515B84"],"0033CC":["0033CC","006FDE","0078C2","006F74","0051D5","0055C7","0051A0","555555","444E6C"],"003399":["003399","0053A6","005E9A","00595E","00439F","004899","00467B","444444","364055"],"003366":["003366","0D3366","003E68","004347","063366","003867","003B56","333333","28333D"],"003333":["003333","2E2E30","2F2D34","0A3236","173031","173033","053234","222222","1B2525"],"003300":["003300","312C00","362A0C","173033","182F00","1B2E06","0B3119","111111","0D170D"],"0000FF":["0000FF","719CFF","008BDF","007F85","384EFF","0045EF","003FC2","555555","444477"],"0000CC":["0000CC","0078F0","0076BE","006A6E","003CDE","003BC5","00359D","444444","36365F"],"000099":["000099","0060C1","005E97","005155","0030AD","002F98","002877","333333","282847"],"000066":["000066","004487","004168","003739","002276","002067","001B4F","222222","1B1B2F"],"000033":["000033","002346","002135","001C1D","00113C","001034","000E28","111111","0D0D17"],"000000":["000000","000000","000000","000000","000000","000000","000000","000000","000000"]}};;

// ***************************
// js.compressed/jquery/datatables/js/jquery.dataTables.min.js
// ***************************
/*
 * File:        jquery.dataTables.min.js
 * Version:     1.9.1
 * Author:      Allan Jardine (www.sprymedia.co.uk)
 * Info:        www.datatables.net
 * 
 * Copyright 2008-2012 Allan Jardine, all rights reserved.
 *
 * This source file is free software, under either the GPL v2 license or a
 * BSD style license, available at:
 *   http://datatables.net/license_gpl2
 *   http://datatables.net/license_bsd
 * 
 * This source file is distributed in the hope that it will be useful, but 
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
 * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
 */
(function(h,V,l,m){var j=function(e){function o(a,b){var c=j.defaults.columns,d=a.aoColumns.length,c=h.extend({},j.models.oColumn,c,{sSortingClass:a.oClasses.sSortable,sSortingClassJUI:a.oClasses.sSortJUI,nTh:b?b:l.createElement("th"),sTitle:c.sTitle?c.sTitle:b?b.innerHTML:"",aDataSort:c.aDataSort?c.aDataSort:[d],mDataProp:c.mDataProp?c.oDefaults:d});a.aoColumns.push(c);if(a.aoPreSearchCols[d]===m||null===a.aoPreSearchCols[d])a.aoPreSearchCols[d]=h.extend({},j.models.oSearch);else{c=a.aoPreSearchCols[d];
if(c.bRegex===m)c.bRegex=!0;if(c.bSmart===m)c.bSmart=!0;if(c.bCaseInsensitive===m)c.bCaseInsensitive=!0}s(a,d,null)}function s(a,b,c){b=a.aoColumns[b];if(c!==m&&null!==c){if(c.sType!==m)b.sType=c.sType,b._bAutoType=!1;h.extend(b,c);p(b,c,"sWidth","sWidthOrig");if(c.iDataSort!==m)b.aDataSort=[c.iDataSort];p(b,c,"aDataSort")}b.fnGetData=W(b.mDataProp);b.fnSetData=ta(b.mDataProp);if(!a.oFeatures.bSort)b.bSortable=!1;if(!b.bSortable||-1==h.inArray("asc",b.asSorting)&&-1==h.inArray("desc",b.asSorting))b.sSortingClass=
a.oClasses.sSortableNone,b.sSortingClassJUI="";else if(b.bSortable||-1==h.inArray("asc",b.asSorting)&&-1==h.inArray("desc",b.asSorting))b.sSortingClass=a.oClasses.sSortable,b.sSortingClassJUI=a.oClasses.sSortJUI;else if(-1!=h.inArray("asc",b.asSorting)&&-1==h.inArray("desc",b.asSorting))b.sSortingClass=a.oClasses.sSortableAsc,b.sSortingClassJUI=a.oClasses.sSortJUIAscAllowed;else if(-1==h.inArray("asc",b.asSorting)&&-1!=h.inArray("desc",b.asSorting))b.sSortingClass=a.oClasses.sSortableDesc,b.sSortingClassJUI=
a.oClasses.sSortJUIDescAllowed}function k(a){if(!1===a.oFeatures.bAutoWidth)return!1;ba(a);for(var b=0,c=a.aoColumns.length;b<c;b++)a.aoColumns[b].nTh.style.width=a.aoColumns[b].sWidth}function x(a,b){for(var c=-1,d=0;d<a.aoColumns.length;d++)if(!0===a.aoColumns[d].bVisible&&c++,c==b)return d;return null}function r(a,b){for(var c=-1,d=0;d<a.aoColumns.length;d++)if(!0===a.aoColumns[d].bVisible&&c++,d==b)return!0===a.aoColumns[d].bVisible?c:null;return null}function v(a){for(var b=0,c=0;c<a.aoColumns.length;c++)!0===
a.aoColumns[c].bVisible&&b++;return b}function A(a){for(var b=j.ext.aTypes,c=b.length,d=0;d<c;d++){var f=b[d](a);if(null!==f)return f}return"string"}function E(a,b){for(var c=b.split(","),d=[],f=0,g=a.aoColumns.length;f<g;f++)for(var i=0;i<g;i++)if(a.aoColumns[f].sName==c[i]){d.push(i);break}return d}function y(a){for(var b="",c=0,d=a.aoColumns.length;c<d;c++)b+=a.aoColumns[c].sName+",";return b.length==d?"":b.slice(0,-1)}function J(a,b,c,d){var f,g,i,e,u;if(b)for(f=b.length-1;0<=f;f--){var n=b[f].aTargets;
h.isArray(n)||F(a,1,"aTargets must be an array of targets, not a "+typeof n);for(g=0,i=n.length;g<i;g++)if("number"===typeof n[g]&&0<=n[g]){for(;a.aoColumns.length<=n[g];)o(a);d(n[g],b[f])}else if("number"===typeof n[g]&&0>n[g])d(a.aoColumns.length+n[g],b[f]);else if("string"===typeof n[g])for(e=0,u=a.aoColumns.length;e<u;e++)("_all"==n[g]||h(a.aoColumns[e].nTh).hasClass(n[g]))&&d(e,b[f])}if(c)for(f=0,a=c.length;f<a;f++)d(f,c[f])}function H(a,b){var c;c=h.isArray(b)?b.slice():h.extend(!0,{},b);var d=
a.aoData.length,f=h.extend(!0,{},j.models.oRow);f._aData=c;a.aoData.push(f);for(var g,f=0,i=a.aoColumns.length;f<i;f++)if(c=a.aoColumns[f],"function"===typeof c.fnRender&&c.bUseRendered&&null!==c.mDataProp?I(a,d,f,R(a,d,f)):I(a,d,f,w(a,d,f)),c._bAutoType&&"string"!=c.sType&&(g=w(a,d,f,"type"),null!==g&&""!==g))if(g=A(g),null===c.sType)c.sType=g;else if(c.sType!=g&&"html"!=c.sType)c.sType="string";a.aiDisplayMaster.push(d);a.oFeatures.bDeferRender||ca(a,d);return d}function ua(a){var b,c,d,f,g,i,e,
u,n;if(a.bDeferLoading||null===a.sAjaxSource){e=a.nTBody.childNodes;for(b=0,c=e.length;b<c;b++)if("TR"==e[b].nodeName.toUpperCase()){u=a.aoData.length;e[b]._DT_RowIndex=u;a.aoData.push(h.extend(!0,{},j.models.oRow,{nTr:e[b]}));a.aiDisplayMaster.push(u);i=e[b].childNodes;g=0;for(d=0,f=i.length;d<f;d++)if(n=i[d].nodeName.toUpperCase(),"TD"==n||"TH"==n)I(a,u,g,h.trim(i[d].innerHTML)),g++}}e=S(a);i=[];for(b=0,c=e.length;b<c;b++)for(d=0,f=e[b].childNodes.length;d<f;d++)g=e[b].childNodes[d],n=g.nodeName.toUpperCase(),
("TD"==n||"TH"==n)&&i.push(g);for(f=0,e=a.aoColumns.length;f<e;f++){n=a.aoColumns[f];if(null===n.sTitle)n.sTitle=n.nTh.innerHTML;g=n._bAutoType;u="function"===typeof n.fnRender;var o=null!==n.sClass,k=n.bVisible,m,s;if(g||u||o||!k)for(b=0,c=a.aoData.length;b<c;b++){d=a.aoData[b];m=i[b*e+f];if(g&&"string"!=n.sType&&(s=w(a,b,f,"type"),""!==s))if(s=A(s),null===n.sType)n.sType=s;else if(n.sType!=s&&"html"!=n.sType)n.sType="string";if("function"===typeof n.mDataProp)m.innerHTML=w(a,b,f,"display");if(u)s=
R(a,b,f),m.innerHTML=s,n.bUseRendered&&I(a,b,f,s);o&&(m.className+=" "+n.sClass);k?d._anHidden[f]=null:(d._anHidden[f]=m,m.parentNode.removeChild(m));n.fnCreatedCell&&n.fnCreatedCell.call(a.oInstance,m,w(a,b,f,"display"),d._aData,b,f)}}if(0!==a.aoRowCreatedCallback.length)for(b=0,c=a.aoData.length;b<c;b++)d=a.aoData[b],D(a,"aoRowCreatedCallback",null,[d.nTr,d._aData,b])}function K(a,b){return b._DT_RowIndex!==m?b._DT_RowIndex:null}function da(a,b,c){for(var b=L(a,b),d=0,a=a.aoColumns.length;d<a;d++)if(b[d]===
c)return d;return-1}function X(a,b,c){for(var d=[],f=0,g=a.aoColumns.length;f<g;f++)d.push(w(a,b,f,c));return d}function w(a,b,c,d){var f=a.aoColumns[c];if((c=f.fnGetData(a.aoData[b]._aData,d))===m){if(a.iDrawError!=a.iDraw&&null===f.sDefaultContent)F(a,0,"Requested unknown parameter "+("function"==typeof f.mDataProp?"{mDataprop function}":"'"+f.mDataProp+"'")+" from the data source for row "+b),a.iDrawError=a.iDraw;return f.sDefaultContent}if(null===c&&null!==f.sDefaultContent)c=f.sDefaultContent;
else if("function"===typeof c)return c();return"display"==d&&null===c?"":c}function I(a,b,c,d){a.aoColumns[c].fnSetData(a.aoData[b]._aData,d)}function W(a){if(null===a)return function(){return null};if("function"===typeof a)return function(b,d){return a(b,d)};if("string"===typeof a&&-1!=a.indexOf(".")){var b=a.split(".");return function(a){for(var d=0,f=b.length;d<f;d++)if(a=a[b[d]],a===m)return m;return a}}return function(b){return b[a]}}function ta(a){if(null===a)return function(){};if("function"===
typeof a)return function(b,d){a(b,"set",d)};if("string"===typeof a&&-1!=a.indexOf(".")){var b=a.split(".");return function(a,d){for(var f=0,g=b.length-1;f<g;f++)if(a=a[b[f]],a===m)return;a[b[b.length-1]]=d}}return function(b,d){b[a]=d}}function Y(a){for(var b=[],c=a.aoData.length,d=0;d<c;d++)b.push(a.aoData[d]._aData);return b}function ea(a){a.aoData.splice(0,a.aoData.length);a.aiDisplayMaster.splice(0,a.aiDisplayMaster.length);a.aiDisplay.splice(0,a.aiDisplay.length);B(a)}function fa(a,b){for(var c=
-1,d=0,f=a.length;d<f;d++)a[d]==b?c=d:a[d]>b&&a[d]--; -1!=c&&a.splice(c,1)}function R(a,b,c){var d=a.aoColumns[c];return d.fnRender({iDataRow:b,iDataColumn:c,oSettings:a,aData:a.aoData[b]._aData,mDataProp:d.mDataProp},w(a,b,c,"display"))}function ca(a,b){var c=a.aoData[b],d;if(null===c.nTr){c.nTr=l.createElement("tr");c.nTr._DT_RowIndex=b;if(c._aData.DT_RowId)c.nTr.id=c._aData.DT_RowId;c._aData.DT_RowClass&&h(c.nTr).addClass(c._aData.DT_RowClass);for(var f=0,g=a.aoColumns.length;f<g;f++){var i=a.aoColumns[f];
d=l.createElement(i.sCellType);d.innerHTML="function"===typeof i.fnRender&&(!i.bUseRendered||null===i.mDataProp)?R(a,b,f):w(a,b,f,"display");if(null!==i.sClass)d.className=i.sClass;i.bVisible?(c.nTr.appendChild(d),c._anHidden[f]=null):c._anHidden[f]=d;i.fnCreatedCell&&i.fnCreatedCell.call(a.oInstance,d,w(a,b,f,"display"),c._aData,b,f)}D(a,"aoRowCreatedCallback",null,[c.nTr,c._aData,b])}}function va(a){var b,c,d;if(0!==a.nTHead.getElementsByTagName("th").length)for(b=0,d=a.aoColumns.length;b<d;b++){if(c=
a.aoColumns[b].nTh,c.setAttribute("role","columnheader"),a.aoColumns[b].bSortable&&(c.setAttribute("tabindex",a.iTabIndex),c.setAttribute("aria-controls",a.sTableId)),null!==a.aoColumns[b].sClass&&h(c).addClass(a.aoColumns[b].sClass),a.aoColumns[b].sTitle!=c.innerHTML)c.innerHTML=a.aoColumns[b].sTitle}else{var f=l.createElement("tr");for(b=0,d=a.aoColumns.length;b<d;b++)c=a.aoColumns[b].nTh,c.innerHTML=a.aoColumns[b].sTitle,c.setAttribute("tabindex","0"),null!==a.aoColumns[b].sClass&&h(c).addClass(a.aoColumns[b].sClass),
f.appendChild(c);h(a.nTHead).html("")[0].appendChild(f);T(a.aoHeader,a.nTHead)}h(a.nTHead).children("tr").attr("role","row");if(a.bJUI)for(b=0,d=a.aoColumns.length;b<d;b++){c=a.aoColumns[b].nTh;f=l.createElement("div");f.className=a.oClasses.sSortJUIWrapper;h(c).contents().appendTo(f);var g=l.createElement("span");g.className=a.oClasses.sSortIcon;f.appendChild(g);c.appendChild(f)}if(a.oFeatures.bSort)for(b=0;b<a.aoColumns.length;b++)!1!==a.aoColumns[b].bSortable?ga(a,a.aoColumns[b].nTh,b):h(a.aoColumns[b].nTh).addClass(a.oClasses.sSortableNone);
""!==a.oClasses.sFooterTH&&h(a.nTFoot).children("tr").children("th").addClass(a.oClasses.sFooterTH);if(null!==a.nTFoot){c=O(a,null,a.aoFooter);for(b=0,d=a.aoColumns.length;b<d;b++)if(c[b])a.aoColumns[b].nTf=c[b],a.aoColumns[b].sClass&&h(c[b]).addClass(a.aoColumns[b].sClass)}}function U(a,b,c){var d,f,g,i=[],e=[],h=a.aoColumns.length,n;c===m&&(c=!1);for(d=0,f=b.length;d<f;d++){i[d]=b[d].slice();i[d].nTr=b[d].nTr;for(g=h-1;0<=g;g--)!a.aoColumns[g].bVisible&&!c&&i[d].splice(g,1);e.push([])}for(d=0,f=
i.length;d<f;d++){if(a=i[d].nTr)for(;g=a.firstChild;)a.removeChild(g);for(g=0,b=i[d].length;g<b;g++)if(n=h=1,e[d][g]===m){a.appendChild(i[d][g].cell);for(e[d][g]=1;i[d+h]!==m&&i[d][g].cell==i[d+h][g].cell;)e[d+h][g]=1,h++;for(;i[d][g+n]!==m&&i[d][g].cell==i[d][g+n].cell;){for(c=0;c<h;c++)e[d+c][g+n]=1;n++}i[d][g].cell.rowSpan=h;i[d][g].cell.colSpan=n}}}function z(a){var b,c,d=[],f=0,g=a.asStripeClasses.length;b=a.aoOpenRows.length;c=D(a,"aoPreDrawCallback","preDraw",[a]);if(-1!==h.inArray(!1,c))G(a,
!1);else{a.bDrawing=!0;if(a.iInitDisplayStart!==m&&-1!=a.iInitDisplayStart)a._iDisplayStart=a.oFeatures.bServerSide?a.iInitDisplayStart:a.iInitDisplayStart>=a.fnRecordsDisplay()?0:a.iInitDisplayStart,a.iInitDisplayStart=-1,B(a);if(a.bDeferLoading)a.bDeferLoading=!1,a.iDraw++;else if(a.oFeatures.bServerSide){if(!a.bDestroying&&!wa(a))return}else a.iDraw++;if(0!==a.aiDisplay.length){var i=a._iDisplayStart;c=a._iDisplayEnd;if(a.oFeatures.bServerSide)i=0,c=a.aoData.length;for(;i<c;i++){var e=a.aoData[a.aiDisplay[i]];
null===e.nTr&&ca(a,a.aiDisplay[i]);var j=e.nTr;if(0!==g){var n=a.asStripeClasses[f%g];if(e._sRowStripe!=n)h(j).removeClass(e._sRowStripe).addClass(n),e._sRowStripe=n}D(a,"aoRowCallback",null,[j,a.aoData[a.aiDisplay[i]]._aData,f,i]);d.push(j);f++;if(0!==b)for(e=0;e<b;e++)if(j==a.aoOpenRows[e].nParent){d.push(a.aoOpenRows[e].nTr);break}}}else{d[0]=l.createElement("tr");if(a.asStripeClasses[0])d[0].className=a.asStripeClasses[0];b=a.oLanguage;g=b.sZeroRecords;if(1==a.iDraw&&null!==a.sAjaxSource&&!a.oFeatures.bServerSide)g=
b.sLoadingRecords;else if(b.sEmptyTable&&0===a.fnRecordsTotal())g=b.sEmptyTable;b=l.createElement("td");b.setAttribute("valign","top");b.colSpan=v(a);b.className=a.oClasses.sRowEmpty;b.innerHTML=ha(a,g);d[f].appendChild(b)}D(a,"aoHeaderCallback","header",[h(a.nTHead).children("tr")[0],Y(a),a._iDisplayStart,a.fnDisplayEnd(),a.aiDisplay]);D(a,"aoFooterCallback","footer",[h(a.nTFoot).children("tr")[0],Y(a),a._iDisplayStart,a.fnDisplayEnd(),a.aiDisplay]);f=l.createDocumentFragment();b=l.createDocumentFragment();
if(a.nTBody){g=a.nTBody.parentNode;b.appendChild(a.nTBody);if(!a.oScroll.bInfinite||!a._bInitComplete||a.bSorted||a.bFiltered)for(;b=a.nTBody.firstChild;)a.nTBody.removeChild(b);for(b=0,c=d.length;b<c;b++)f.appendChild(d[b]);a.nTBody.appendChild(f);null!==g&&g.appendChild(a.nTBody)}D(a,"aoDrawCallback","draw",[a]);a.bSorted=!1;a.bFiltered=!1;a.bDrawing=!1;a.oFeatures.bServerSide&&(G(a,!1),a._bInitComplete||Z(a))}}function $(a){a.oFeatures.bSort?P(a,a.oPreviousSearch):a.oFeatures.bFilter?M(a,a.oPreviousSearch):
(B(a),z(a))}function xa(a){var b=h("<div></div>")[0];a.nTable.parentNode.insertBefore(b,a.nTable);a.nTableWrapper=h('<div id="'+a.sTableId+'_wrapper" class="'+a.oClasses.sWrapper+'" role="grid"></div>')[0];a.nTableReinsertBefore=a.nTable.nextSibling;for(var c=a.nTableWrapper,d=a.sDom.split(""),f,g,i,e,u,n,o,k=0;k<d.length;k++){g=0;i=d[k];if("<"==i){e=h("<div></div>")[0];u=d[k+1];if("'"==u||'"'==u){n="";for(o=2;d[k+o]!=u;)n+=d[k+o],o++;"H"==n?n="fg-toolbar ui-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix":
"F"==n&&(n="fg-toolbar ui-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix");-1!=n.indexOf(".")?(u=n.split("."),e.id=u[0].substr(1,u[0].length-1),e.className=u[1]):"#"==n.charAt(0)?e.id=n.substr(1,n.length-1):e.className=n;k+=o}c.appendChild(e);c=e}else if(">"==i)c=c.parentNode;else if("l"==i&&a.oFeatures.bPaginate&&a.oFeatures.bLengthChange)f=ya(a),g=1;else if("f"==i&&a.oFeatures.bFilter)f=za(a),g=1;else if("r"==i&&a.oFeatures.bProcessing)f=Aa(a),g=1;else if("t"==i)f=Ba(a),g=
1;else if("i"==i&&a.oFeatures.bInfo)f=Ca(a),g=1;else if("p"==i&&a.oFeatures.bPaginate)f=Da(a),g=1;else if(0!==j.ext.aoFeatures.length){e=j.ext.aoFeatures;o=0;for(u=e.length;o<u;o++)if(i==e[o].cFeature){(f=e[o].fnInit(a))&&(g=1);break}}1==g&&null!==f&&("object"!==typeof a.aanFeatures[i]&&(a.aanFeatures[i]=[]),a.aanFeatures[i].push(f),c.appendChild(f))}b.parentNode.replaceChild(a.nTableWrapper,b)}function T(a,b){var c=h(b).children("tr"),d,f,g,i,e,j,n,o;a.splice(0,a.length);for(f=0,j=c.length;f<j;f++)a.push([]);
for(f=0,j=c.length;f<j;f++)for(g=0,n=c[f].childNodes.length;g<n;g++)if(d=c[f].childNodes[g],"TD"==d.nodeName.toUpperCase()||"TH"==d.nodeName.toUpperCase()){var k=1*d.getAttribute("colspan"),m=1*d.getAttribute("rowspan"),k=!k||0===k||1===k?1:k,m=!m||0===m||1===m?1:m;for(i=0;a[f][i];)i++;o=i;for(e=0;e<k;e++)for(i=0;i<m;i++)a[f+i][o+e]={cell:d,unique:1==k?!0:!1},a[f+i].nTr=c[f]}}function O(a,b,c){var d=[];if(!c)c=a.aoHeader,b&&(c=[],T(c,b));for(var b=0,f=c.length;b<f;b++)for(var g=0,i=c[b].length;g<
i;g++)if(c[b][g].unique&&(!d[g]||!a.bSortCellsTop))d[g]=c[b][g].cell;return d}function wa(a){if(a.bAjaxDataGet){a.iDraw++;G(a,!0);var b=Ea(a);ia(a,b);a.fnServerData.call(a.oInstance,a.sAjaxSource,b,function(b){Fa(a,b)},a);return!1}return!0}function Ea(a){var b=a.aoColumns.length,c=[],d,f,g,i;c.push({name:"sEcho",value:a.iDraw});c.push({name:"iColumns",value:b});c.push({name:"sColumns",value:y(a)});c.push({name:"iDisplayStart",value:a._iDisplayStart});c.push({name:"iDisplayLength",value:!1!==a.oFeatures.bPaginate?
a._iDisplayLength:-1});for(g=0;g<b;g++)d=a.aoColumns[g].mDataProp,c.push({name:"mDataProp_"+g,value:"function"===typeof d?"function":d});if(!1!==a.oFeatures.bFilter){c.push({name:"sSearch",value:a.oPreviousSearch.sSearch});c.push({name:"bRegex",value:a.oPreviousSearch.bRegex});for(g=0;g<b;g++)c.push({name:"sSearch_"+g,value:a.aoPreSearchCols[g].sSearch}),c.push({name:"bRegex_"+g,value:a.aoPreSearchCols[g].bRegex}),c.push({name:"bSearchable_"+g,value:a.aoColumns[g].bSearchable})}if(!1!==a.oFeatures.bSort){var e=
0;d=null!==a.aaSortingFixed?a.aaSortingFixed.concat(a.aaSorting):a.aaSorting.slice();for(g=0;g<d.length;g++){f=a.aoColumns[d[g][0]].aDataSort;for(i=0;i<f.length;i++)c.push({name:"iSortCol_"+e,value:f[i]}),c.push({name:"sSortDir_"+e,value:d[g][1]}),e++}c.push({name:"iSortingCols",value:e});for(g=0;g<b;g++)c.push({name:"bSortable_"+g,value:a.aoColumns[g].bSortable})}return c}function ia(a,b){D(a,"aoServerParams","serverParams",[b])}function Fa(a,b){if(b.sEcho!==m){if(1*b.sEcho<a.iDraw)return;a.iDraw=
1*b.sEcho}(!a.oScroll.bInfinite||a.oScroll.bInfinite&&(a.bSorted||a.bFiltered))&&ea(a);a._iRecordsTotal=parseInt(b.iTotalRecords,10);a._iRecordsDisplay=parseInt(b.iTotalDisplayRecords,10);var c=y(a),c=b.sColumns!==m&&""!==c&&b.sColumns!=c,d;c&&(d=E(a,b.sColumns));for(var f=W(a.sAjaxDataProp)(b),g=0,i=f.length;g<i;g++)if(c){for(var e=[],h=0,n=a.aoColumns.length;h<n;h++)e.push(f[g][d[h]]);H(a,e)}else H(a,f[g]);a.aiDisplay=a.aiDisplayMaster.slice();a.bAjaxDataGet=!1;z(a);a.bAjaxDataGet=!0;G(a,!1)}function za(a){var b=
a.oPreviousSearch,c=a.oLanguage.sSearch,c=-1!==c.indexOf("_INPUT_")?c.replace("_INPUT_",'<input type="text" />'):""===c?'<input type="text" />':c+' <input type="text" />',d=l.createElement("div");d.className=a.oClasses.sFilter;d.innerHTML="<label>"+c+"</label>";if(!a.aanFeatures.f)d.id=a.sTableId+"_filter";c=h('input[type="text"]',d);d._DT_Input=c[0];c.val(b.sSearch.replace('"',"&quot;"));c.bind("keyup.DT",function(){for(var c=a.aanFeatures.f,d=""===this.value?"":this.value,i=0,e=c.length;i<e;i++)c[i]!=
h(this).parents("div.dataTables_filter")[0]&&h(c[i]._DT_Input).val(d);d!=b.sSearch&&M(a,{sSearch:d,bRegex:b.bRegex,bSmart:b.bSmart,bCaseInsensitive:b.bCaseInsensitive})});c.attr("aria-controls",a.sTableId).bind("keypress.DT",function(a){if(13==a.keyCode)return!1});return d}function M(a,b,c){var d=a.oPreviousSearch,f=a.aoPreSearchCols,g=function(a){d.sSearch=a.sSearch;d.bRegex=a.bRegex;d.bSmart=a.bSmart;d.bCaseInsensitive=a.bCaseInsensitive};if(a.oFeatures.bServerSide)g(b);else{Ga(a,b.sSearch,c,b.bRegex,
b.bSmart,b.bCaseInsensitive);g(b);for(b=0;b<a.aoPreSearchCols.length;b++)Ha(a,f[b].sSearch,b,f[b].bRegex,f[b].bSmart,f[b].bCaseInsensitive);Ia(a)}a.bFiltered=!0;h(a.oInstance).trigger("filter",a);a._iDisplayStart=0;B(a);z(a);ja(a,0)}function Ia(a){for(var b=j.ext.afnFiltering,c=0,d=b.length;c<d;c++)for(var f=0,g=0,i=a.aiDisplay.length;g<i;g++){var e=a.aiDisplay[g-f];b[c](a,X(a,e,"filter"),e)||(a.aiDisplay.splice(g-f,1),f++)}}function Ha(a,b,c,d,f,g){if(""!==b)for(var i=0,b=ka(b,d,f,g),d=a.aiDisplay.length-
1;0<=d;d--)f=la(w(a,a.aiDisplay[d],c,"filter"),a.aoColumns[c].sType),b.test(f)||(a.aiDisplay.splice(d,1),i++)}function Ga(a,b,c,d,f,g){d=ka(b,d,f,g);f=a.oPreviousSearch;c||(c=0);0!==j.ext.afnFiltering.length&&(c=1);if(0>=b.length)a.aiDisplay.splice(0,a.aiDisplay.length),a.aiDisplay=a.aiDisplayMaster.slice();else if(a.aiDisplay.length==a.aiDisplayMaster.length||f.sSearch.length>b.length||1==c||0!==b.indexOf(f.sSearch)){a.aiDisplay.splice(0,a.aiDisplay.length);ja(a,1);for(b=0;b<a.aiDisplayMaster.length;b++)d.test(a.asDataSearch[b])&&
a.aiDisplay.push(a.aiDisplayMaster[b])}else for(b=c=0;b<a.asDataSearch.length;b++)d.test(a.asDataSearch[b])||(a.aiDisplay.splice(b-c,1),c++)}function ja(a,b){if(!a.oFeatures.bServerSide){a.asDataSearch.splice(0,a.asDataSearch.length);for(var c=b&&1===b?a.aiDisplayMaster:a.aiDisplay,d=0,f=c.length;d<f;d++)a.asDataSearch[d]=ma(a,X(a,c[d],"filter"))}}function ma(a,b){var c="";if(a.__nTmpFilter===m)a.__nTmpFilter=l.createElement("div");for(var d=a.__nTmpFilter,f=0,g=a.aoColumns.length;f<g;f++)a.aoColumns[f].bSearchable&&
(c+=la(b[f],a.aoColumns[f].sType)+"  ");if(-1!==c.indexOf("&"))d.innerHTML=c,c=d.textContent?d.textContent:d.innerText,c=c.replace(/\n/g," ").replace(/\r/g,"");return c}function ka(a,b,c,d){if(c)return a=b?a.split(" "):na(a).split(" "),a="^(?=.*?"+a.join(")(?=.*?")+").*$",RegExp(a,d?"i":"");a=b?a:na(a);return RegExp(a,d?"i":"")}function la(a,b){return"function"===typeof j.ext.ofnSearch[b]?j.ext.ofnSearch[b](a):null===a?"":"html"==b?a.replace(/[\r\n]/g," ").replace(/<.*?>/g,""):"string"===typeof a?
a.replace(/[\r\n]/g," "):a}function na(a){return a.replace(RegExp("(\\/|\\.|\\*|\\+|\\?|\\||\\(|\\)|\\[|\\]|\\{|\\}|\\\\|\\$|\\^)","g"),"\\$1")}function Ca(a){var b=l.createElement("div");b.className=a.oClasses.sInfo;if(!a.aanFeatures.i)a.aoDrawCallback.push({fn:Ja,sName:"information"}),b.id=a.sTableId+"_info";a.nTable.setAttribute("aria-describedby",a.sTableId+"_info");return b}function Ja(a){if(a.oFeatures.bInfo&&0!==a.aanFeatures.i.length){var b=a.oLanguage,c=a._iDisplayStart+1,d=a.fnDisplayEnd(),
f=a.fnRecordsTotal(),g=a.fnRecordsDisplay(),i;i=0===g&&g==f?b.sInfoEmpty:0===g?b.sInfoEmpty+" "+b.sInfoFiltered:g==f?b.sInfo:b.sInfo+" "+b.sInfoFiltered;i+=b.sInfoPostFix;i=ha(a,i);null!==b.fnInfoCallback&&(i=b.fnInfoCallback.call(a.oInstance,a,c,d,f,g,i));a=a.aanFeatures.i;b=0;for(c=a.length;b<c;b++)h(a[b]).html(i)}}function ha(a,b){var c=a.fnFormatNumber(a._iDisplayStart+1),d=a.fnDisplayEnd(),d=a.fnFormatNumber(d),f=a.fnRecordsDisplay(),f=a.fnFormatNumber(f),g=a.fnRecordsTotal(),g=a.fnFormatNumber(g);
a.oScroll.bInfinite&&(c=a.fnFormatNumber(1));return b.replace("_START_",c).replace("_END_",d).replace("_TOTAL_",f).replace("_MAX_",g)}function aa(a){var b,c,d=a.iInitDisplayStart;if(!1===a.bInitialised)setTimeout(function(){aa(a)},200);else{xa(a);va(a);U(a,a.aoHeader);a.nTFoot&&U(a,a.aoFooter);G(a,!0);a.oFeatures.bAutoWidth&&ba(a);for(b=0,c=a.aoColumns.length;b<c;b++)if(null!==a.aoColumns[b].sWidth)a.aoColumns[b].nTh.style.width=q(a.aoColumns[b].sWidth);a.oFeatures.bSort?P(a):a.oFeatures.bFilter?
M(a,a.oPreviousSearch):(a.aiDisplay=a.aiDisplayMaster.slice(),B(a),z(a));null!==a.sAjaxSource&&!a.oFeatures.bServerSide?(c=[],ia(a,c),a.fnServerData.call(a.oInstance,a.sAjaxSource,c,function(c){var g=""!==a.sAjaxDataProp?W(a.sAjaxDataProp)(c):c;for(b=0;b<g.length;b++)H(a,g[b]);a.iInitDisplayStart=d;a.oFeatures.bSort?P(a):(a.aiDisplay=a.aiDisplayMaster.slice(),B(a),z(a));G(a,!1);Z(a,c)},a)):a.oFeatures.bServerSide||(G(a,!1),Z(a))}}function Z(a,b){a._bInitComplete=!0;D(a,"aoInitComplete","init",[a,
b])}function oa(a){var b=j.defaults.oLanguage;!a.sEmptyTable&&a.sZeroRecords&&"No data available in table"===b.sEmptyTable&&p(a,a,"sZeroRecords","sEmptyTable");!a.sLoadingRecords&&a.sZeroRecords&&"Loading..."===b.sLoadingRecords&&p(a,a,"sZeroRecords","sLoadingRecords")}function ya(a){if(a.oScroll.bInfinite)return null;var b='<select size="1" '+('name="'+a.sTableId+'_length"')+">",c,d,f=a.aLengthMenu;if(2==f.length&&"object"===typeof f[0]&&"object"===typeof f[1])for(c=0,d=f[0].length;c<d;c++)b+='<option value="'+
f[0][c]+'">'+f[1][c]+"</option>";else for(c=0,d=f.length;c<d;c++)b+='<option value="'+f[c]+'">'+f[c]+"</option>";b+="</select>";f=l.createElement("div");if(!a.aanFeatures.l)f.id=a.sTableId+"_length";f.className=a.oClasses.sLength;f.innerHTML="<label>"+a.oLanguage.sLengthMenu.replace("_MENU_",b)+"</label>";h('select option[value="'+a._iDisplayLength+'"]',f).attr("selected",!0);h("select",f).bind("change.DT",function(){var b=h(this).val(),f=a.aanFeatures.l;for(c=0,d=f.length;c<d;c++)f[c]!=this.parentNode&&
h("select",f[c]).val(b);a._iDisplayLength=parseInt(b,10);B(a);if(a.fnDisplayEnd()==a.fnRecordsDisplay()&&(a._iDisplayStart=a.fnDisplayEnd()-a._iDisplayLength,0>a._iDisplayStart))a._iDisplayStart=0;if(-1==a._iDisplayLength)a._iDisplayStart=0;z(a)});h("select",f).attr("aria-controls",a.sTableId);return f}function B(a){a._iDisplayEnd=!1===a.oFeatures.bPaginate?a.aiDisplay.length:a._iDisplayStart+a._iDisplayLength>a.aiDisplay.length||-1==a._iDisplayLength?a.aiDisplay.length:a._iDisplayStart+a._iDisplayLength}
function Da(a){if(a.oScroll.bInfinite)return null;var b=l.createElement("div");b.className=a.oClasses.sPaging+a.sPaginationType;j.ext.oPagination[a.sPaginationType].fnInit(a,b,function(a){B(a);z(a)});a.aanFeatures.p||a.aoDrawCallback.push({fn:function(a){j.ext.oPagination[a.sPaginationType].fnUpdate(a,function(a){B(a);z(a)})},sName:"pagination"});return b}function pa(a,b){var c=a._iDisplayStart;if("number"===typeof b){if(a._iDisplayStart=b*a._iDisplayLength,a._iDisplayStart>a.fnRecordsDisplay())a._iDisplayStart=
0}else if("first"==b)a._iDisplayStart=0;else if("previous"==b){if(a._iDisplayStart=0<=a._iDisplayLength?a._iDisplayStart-a._iDisplayLength:0,0>a._iDisplayStart)a._iDisplayStart=0}else if("next"==b)0<=a._iDisplayLength?a._iDisplayStart+a._iDisplayLength<a.fnRecordsDisplay()&&(a._iDisplayStart+=a._iDisplayLength):a._iDisplayStart=0;else if("last"==b)if(0<=a._iDisplayLength){var d=parseInt((a.fnRecordsDisplay()-1)/a._iDisplayLength,10)+1;a._iDisplayStart=(d-1)*a._iDisplayLength}else a._iDisplayStart=
0;else F(a,0,"Unknown paging action: "+b);h(a.oInstance).trigger("page",a);return c!=a._iDisplayStart}function Aa(a){var b=l.createElement("div");if(!a.aanFeatures.r)b.id=a.sTableId+"_processing";b.innerHTML=a.oLanguage.sProcessing;b.className=a.oClasses.sProcessing;a.nTable.parentNode.insertBefore(b,a.nTable);return b}function G(a,b){if(a.oFeatures.bProcessing)for(var c=a.aanFeatures.r,d=0,f=c.length;d<f;d++)c[d].style.visibility=b?"visible":"hidden";h(a.oInstance).trigger("processing",[a,b])}function Ba(a){if(""===
a.oScroll.sX&&""===a.oScroll.sY)return a.nTable;var b=l.createElement("div"),c=l.createElement("div"),d=l.createElement("div"),f=l.createElement("div"),g=l.createElement("div"),i=l.createElement("div"),e=a.nTable.cloneNode(!1),j=a.nTable.cloneNode(!1),n=a.nTable.getElementsByTagName("thead")[0],o=0===a.nTable.getElementsByTagName("tfoot").length?null:a.nTable.getElementsByTagName("tfoot")[0],k=a.oClasses;c.appendChild(d);g.appendChild(i);f.appendChild(a.nTable);b.appendChild(c);b.appendChild(f);d.appendChild(e);
e.appendChild(n);null!==o&&(b.appendChild(g),i.appendChild(j),j.appendChild(o));b.className=k.sScrollWrapper;c.className=k.sScrollHead;d.className=k.sScrollHeadInner;f.className=k.sScrollBody;g.className=k.sScrollFoot;i.className=k.sScrollFootInner;if(a.oScroll.bAutoCss)c.style.overflow="hidden",c.style.position="relative",g.style.overflow="hidden",f.style.overflow="auto";c.style.border="0";c.style.width="100%";g.style.border="0";d.style.width=""!==a.oScroll.sXInner?a.oScroll.sXInner:"100%";e.removeAttribute("id");
e.style.marginLeft="0";a.nTable.style.marginLeft="0";if(null!==o)j.removeAttribute("id"),j.style.marginLeft="0";d=h(a.nTable).children("caption");0<d.length&&(d=d[0],"top"===d._captionSide?e.appendChild(d):"bottom"===d._captionSide&&o&&j.appendChild(d));if(""!==a.oScroll.sX){c.style.width=q(a.oScroll.sX);f.style.width=q(a.oScroll.sX);if(null!==o)g.style.width=q(a.oScroll.sX);h(f).scroll(function(){c.scrollLeft=this.scrollLeft;if(null!==o)g.scrollLeft=this.scrollLeft})}if(""!==a.oScroll.sY)f.style.height=
q(a.oScroll.sY);a.aoDrawCallback.push({fn:Ka,sName:"scrolling"});a.oScroll.bInfinite&&h(f).scroll(function(){!a.bDrawing&&0!==h(this).scrollTop()&&h(this).scrollTop()+h(this).height()>h(a.nTable).height()-a.oScroll.iLoadGap&&a.fnDisplayEnd()<a.fnRecordsDisplay()&&(pa(a,"next"),B(a),z(a))});a.nScrollHead=c;a.nScrollFoot=g;return b}function Ka(a){var b=a.nScrollHead.getElementsByTagName("div")[0],c=b.getElementsByTagName("table")[0],d=a.nTable.parentNode,f,g,i,e,j,n,o,k,m=[],s=null!==a.nTFoot?a.nScrollFoot.getElementsByTagName("div")[0]:
null,p=null!==a.nTFoot?s.getElementsByTagName("table")[0]:null,l=h.browser.msie&&7>=h.browser.version;h(a.nTable).children("thead, tfoot").remove();i=h(a.nTHead).clone()[0];a.nTable.insertBefore(i,a.nTable.childNodes[0]);null!==a.nTFoot&&(j=h(a.nTFoot).clone()[0],a.nTable.insertBefore(j,a.nTable.childNodes[1]));if(""===a.oScroll.sX)d.style.width="100%",b.parentNode.style.width="100%";var r=O(a,i);for(f=0,g=r.length;f<g;f++)o=x(a,f),r[f].style.width=a.aoColumns[o].sWidth;null!==a.nTFoot&&N(function(a){a.style.width=
""},j.getElementsByTagName("tr"));if(a.oScroll.bCollapse&&""!==a.oScroll.sY)d.style.height=d.offsetHeight+a.nTHead.offsetHeight+"px";f=h(a.nTable).outerWidth();if(""===a.oScroll.sX){if(a.nTable.style.width="100%",l&&(h("tbody",d).height()>d.offsetHeight||"scroll"==h(d).css("overflow-y")))a.nTable.style.width=q(h(a.nTable).outerWidth()-a.oScroll.iBarWidth)}else if(""!==a.oScroll.sXInner)a.nTable.style.width=q(a.oScroll.sXInner);else if(f==h(d).width()&&h(d).height()<h(a.nTable).height()){if(a.nTable.style.width=
q(f-a.oScroll.iBarWidth),h(a.nTable).outerWidth()>f-a.oScroll.iBarWidth)a.nTable.style.width=q(f)}else a.nTable.style.width=q(f);f=h(a.nTable).outerWidth();g=a.nTHead.getElementsByTagName("tr");i=i.getElementsByTagName("tr");N(function(a,b){n=a.style;n.paddingTop="0";n.paddingBottom="0";n.borderTopWidth="0";n.borderBottomWidth="0";n.height=0;k=h(a).width();b.style.width=q(k);m.push(k)},i,g);h(i).height(0);null!==a.nTFoot&&(e=j.getElementsByTagName("tr"),j=a.nTFoot.getElementsByTagName("tr"),N(function(a,
b){n=a.style;n.paddingTop="0";n.paddingBottom="0";n.borderTopWidth="0";n.borderBottomWidth="0";n.height=0;k=h(a).width();b.style.width=q(k);m.push(k)},e,j),h(e).height(0));N(function(a){a.innerHTML="";a.style.width=q(m.shift())},i);null!==a.nTFoot&&N(function(a){a.innerHTML="";a.style.width=q(m.shift())},e);if(h(a.nTable).outerWidth()<f){e=d.scrollHeight>d.offsetHeight||"scroll"==h(d).css("overflow-y")?f+a.oScroll.iBarWidth:f;if(l&&(d.scrollHeight>d.offsetHeight||"scroll"==h(d).css("overflow-y")))a.nTable.style.width=
q(e-a.oScroll.iBarWidth);d.style.width=q(e);b.parentNode.style.width=q(e);if(null!==a.nTFoot)s.parentNode.style.width=q(e);""===a.oScroll.sX?F(a,1,"The table cannot fit into the current element which will cause column misalignment. The table has been drawn at its minimum possible width."):""!==a.oScroll.sXInner&&F(a,1,"The table cannot fit into the current element which will cause column misalignment. Increase the sScrollXInner value or remove it to allow automatic calculation")}else if(d.style.width=
q("100%"),b.parentNode.style.width=q("100%"),null!==a.nTFoot)s.parentNode.style.width=q("100%");if(""===a.oScroll.sY&&l)d.style.height=q(a.nTable.offsetHeight+a.oScroll.iBarWidth);if(""!==a.oScroll.sY&&a.oScroll.bCollapse&&(d.style.height=q(a.oScroll.sY),l=""!==a.oScroll.sX&&a.nTable.offsetWidth>d.offsetWidth?a.oScroll.iBarWidth:0,a.nTable.offsetHeight<d.offsetHeight))d.style.height=q(a.nTable.offsetHeight+l);l=h(a.nTable).outerWidth();c.style.width=q(l);b.style.width=q(l);c=h(a.nTable).height()>
d.clientHeight||"scroll"==h(d).css("overflow-y");b.style.paddingRight=c?a.oScroll.iBarWidth+"px":"0px";if(null!==a.nTFoot)p.style.width=q(l),s.style.width=q(l),s.style.paddingRight=c?a.oScroll.iBarWidth+"px":"0px";h(d).scroll();if(a.bSorted||a.bFiltered)d.scrollTop=0}function N(a,b,c){for(var d=0,f=b.length;d<f;d++)for(var g=0,i=b[d].childNodes.length;g<i;g++)1==b[d].childNodes[g].nodeType&&(c?a(b[d].childNodes[g],c[d].childNodes[g]):a(b[d].childNodes[g]))}function La(a,b){if(!a||null===a||""===a)return 0;
b||(b=l.getElementsByTagName("body")[0]);var c,d=l.createElement("div");d.style.width=q(a);b.appendChild(d);c=d.offsetWidth;b.removeChild(d);return c}function ba(a){var b=0,c,d=0,f=a.aoColumns.length,g,i=h("th",a.nTHead),e=a.nTable.getAttribute("width");for(g=0;g<f;g++)if(a.aoColumns[g].bVisible&&(d++,null!==a.aoColumns[g].sWidth)){c=La(a.aoColumns[g].sWidthOrig,a.nTable.parentNode);if(null!==c)a.aoColumns[g].sWidth=q(c);b++}if(f==i.length&&0===b&&d==f&&""===a.oScroll.sX&&""===a.oScroll.sY)for(g=
0;g<a.aoColumns.length;g++){if(c=h(i[g]).width(),null!==c)a.aoColumns[g].sWidth=q(c)}else{b=a.nTable.cloneNode(!1);g=a.nTHead.cloneNode(!0);d=l.createElement("tbody");c=l.createElement("tr");b.removeAttribute("id");b.appendChild(g);null!==a.nTFoot&&(b.appendChild(a.nTFoot.cloneNode(!0)),N(function(a){a.style.width=""},b.getElementsByTagName("tr")));b.appendChild(d);d.appendChild(c);d=h("thead th",b);0===d.length&&(d=h("tbody tr:eq(0)>td",b));i=O(a,g);for(g=d=0;g<f;g++){var j=a.aoColumns[g];j.bVisible&&
null!==j.sWidthOrig&&""!==j.sWidthOrig?i[g-d].style.width=q(j.sWidthOrig):j.bVisible?i[g-d].style.width="":d++}for(g=0;g<f;g++)a.aoColumns[g].bVisible&&(d=Ma(a,g),null!==d&&(d=d.cloneNode(!0),""!==a.aoColumns[g].sContentPadding&&(d.innerHTML+=a.aoColumns[g].sContentPadding),c.appendChild(d)));f=a.nTable.parentNode;f.appendChild(b);if(""!==a.oScroll.sX&&""!==a.oScroll.sXInner)b.style.width=q(a.oScroll.sXInner);else if(""!==a.oScroll.sX){if(b.style.width="",h(b).width()<f.offsetWidth)b.style.width=
q(f.offsetWidth)}else if(""!==a.oScroll.sY)b.style.width=q(f.offsetWidth);else if(e)b.style.width=q(e);b.style.visibility="hidden";Na(a,b);f=h("tbody tr:eq(0)",b).children();0===f.length&&(f=O(a,h("thead",b)[0]));if(""!==a.oScroll.sX){for(g=d=c=0;g<a.aoColumns.length;g++)a.aoColumns[g].bVisible&&(c=null===a.aoColumns[g].sWidthOrig?c+h(f[d]).outerWidth():c+(parseInt(a.aoColumns[g].sWidth.replace("px",""),10)+(h(f[d]).outerWidth()-h(f[d]).width())),d++);b.style.width=q(c);a.nTable.style.width=q(c)}for(g=
d=0;g<a.aoColumns.length;g++)if(a.aoColumns[g].bVisible){c=h(f[d]).width();if(null!==c&&0<c)a.aoColumns[g].sWidth=q(c);d++}f=h(b).css("width");a.nTable.style.width=-1!==f.indexOf("%")?f:q(h(b).outerWidth());b.parentNode.removeChild(b)}if(e)a.nTable.style.width=q(e)}function Na(a,b){if(""===a.oScroll.sX&&""!==a.oScroll.sY)h(b).width(),b.style.width=q(h(b).outerWidth()-a.oScroll.iBarWidth);else if(""!==a.oScroll.sX)b.style.width=q(h(b).outerWidth())}function Ma(a,b){var c=Oa(a,b);if(0>c)return null;
if(null===a.aoData[c].nTr){var d=l.createElement("td");d.innerHTML=w(a,c,b,"");return d}return L(a,c)[b]}function Oa(a,b){for(var c=-1,d=-1,f=0;f<a.aoData.length;f++){var g=w(a,f,b,"display")+"",g=g.replace(/<.*?>/g,"");if(g.length>c)c=g.length,d=f}return d}function q(a){if(null===a)return"0px";if("number"==typeof a)return 0>a?"0px":a+"px";var b=a.charCodeAt(a.length-1);return 48>b||57<b?a:a+"px"}function Pa(){var a=l.createElement("p"),b=a.style;b.width="100%";b.height="200px";b.padding="0px";var c=
l.createElement("div"),b=c.style;b.position="absolute";b.top="0px";b.left="0px";b.visibility="hidden";b.width="200px";b.height="150px";b.padding="0px";b.overflow="hidden";c.appendChild(a);l.body.appendChild(c);b=a.offsetWidth;c.style.overflow="scroll";a=a.offsetWidth;if(b==a)a=c.clientWidth;l.body.removeChild(c);return b-a}function P(a,b){var c,d,f,g,i,e,o=[],n=[],k=j.ext.oSort,s=a.aoData,l=a.aoColumns,p=a.oLanguage.oAria;if(!a.oFeatures.bServerSide&&(0!==a.aaSorting.length||null!==a.aaSortingFixed)){o=
null!==a.aaSortingFixed?a.aaSortingFixed.concat(a.aaSorting):a.aaSorting.slice();for(c=0;c<o.length;c++)if(d=o[c][0],f=r(a,d),g=a.aoColumns[d].sSortDataType,j.ext.afnSortData[g])if(i=j.ext.afnSortData[g].call(a.oInstance,a,d,f),i.length===s.length)for(f=0,g=s.length;f<g;f++)I(a,f,d,i[f]);else F(a,0,"Returned data sort array (col "+d+") is the wrong length");for(c=0,d=a.aiDisplayMaster.length;c<d;c++)n[a.aiDisplayMaster[c]]=c;var q=o.length,x;for(c=0,d=s.length;c<d;c++)for(f=0;f<q;f++){x=l[o[f][0]].aDataSort;
for(i=0,e=x.length;i<e;i++)g=l[x[i]].sType,g=k[(g?g:"string")+"-pre"],s[c]._aSortData[x[i]]=g?g(w(a,c,x[i],"sort")):w(a,c,x[i],"sort")}a.aiDisplayMaster.sort(function(a,b){var c,d,f,g,i;for(c=0;c<q;c++){i=l[o[c][0]].aDataSort;for(d=0,f=i.length;d<f;d++)if(g=l[i[d]].sType,g=k[(g?g:"string")+"-"+o[c][1]](s[a]._aSortData[i[d]],s[b]._aSortData[i[d]]),0!==g)return g}return k["numeric-asc"](n[a],n[b])})}(b===m||b)&&!a.oFeatures.bDeferRender&&Q(a);for(c=0,d=a.aoColumns.length;c<d;c++)g=l[c].sTitle.replace(/<.*?>/g,
""),f=l[c].nTh,f.removeAttribute("aria-sort"),f.removeAttribute("aria-label"),l[c].bSortable?0<o.length&&o[0][0]==c?(f.setAttribute("aria-sort","asc"==o[0][1]?"ascending":"descending"),f.setAttribute("aria-label",g+("asc"==(l[c].asSorting[o[0][2]+1]?l[c].asSorting[o[0][2]+1]:l[c].asSorting[0])?p.sSortAscending:p.sSortDescending))):f.setAttribute("aria-label",g+("asc"==l[c].asSorting[0]?p.sSortAscending:p.sSortDescending)):f.setAttribute("aria-label",g);a.bSorted=!0;h(a.oInstance).trigger("sort",a);
a.oFeatures.bFilter?M(a,a.oPreviousSearch,1):(a.aiDisplay=a.aiDisplayMaster.slice(),a._iDisplayStart=0,B(a),z(a))}function ga(a,b,c,d){Qa(b,{},function(b){if(!1!==a.aoColumns[c].bSortable){var g=function(){var d,g;if(b.shiftKey){for(var e=!1,h=0;h<a.aaSorting.length;h++)if(a.aaSorting[h][0]==c){e=!0;d=a.aaSorting[h][0];g=a.aaSorting[h][2]+1;a.aoColumns[d].asSorting[g]?(a.aaSorting[h][1]=a.aoColumns[d].asSorting[g],a.aaSorting[h][2]=g):a.aaSorting.splice(h,1);break}!1===e&&a.aaSorting.push([c,a.aoColumns[c].asSorting[0],
0])}else 1==a.aaSorting.length&&a.aaSorting[0][0]==c?(d=a.aaSorting[0][0],g=a.aaSorting[0][2]+1,a.aoColumns[d].asSorting[g]||(g=0),a.aaSorting[0][1]=a.aoColumns[d].asSorting[g],a.aaSorting[0][2]=g):(a.aaSorting.splice(0,a.aaSorting.length),a.aaSorting.push([c,a.aoColumns[c].asSorting[0],0]));P(a)};a.oFeatures.bProcessing?(G(a,!0),setTimeout(function(){g();a.oFeatures.bServerSide||G(a,!1)},0)):g();"function"==typeof d&&d(a)}})}function Q(a){var b,c,d,f,g,e=a.aoColumns.length,j=a.oClasses;for(b=0;b<
e;b++)a.aoColumns[b].bSortable&&h(a.aoColumns[b].nTh).removeClass(j.sSortAsc+" "+j.sSortDesc+" "+a.aoColumns[b].sSortingClass);f=null!==a.aaSortingFixed?a.aaSortingFixed.concat(a.aaSorting):a.aaSorting.slice();for(b=0;b<a.aoColumns.length;b++)if(a.aoColumns[b].bSortable){g=a.aoColumns[b].sSortingClass;d=-1;for(c=0;c<f.length;c++)if(f[c][0]==b){g="asc"==f[c][1]?j.sSortAsc:j.sSortDesc;d=c;break}h(a.aoColumns[b].nTh).addClass(g);a.bJUI&&(c=h("span."+j.sSortIcon,a.aoColumns[b].nTh),c.removeClass(j.sSortJUIAsc+
" "+j.sSortJUIDesc+" "+j.sSortJUI+" "+j.sSortJUIAscAllowed+" "+j.sSortJUIDescAllowed),c.addClass(-1==d?a.aoColumns[b].sSortingClassJUI:"asc"==f[d][1]?j.sSortJUIAsc:j.sSortJUIDesc))}else h(a.aoColumns[b].nTh).addClass(a.aoColumns[b].sSortingClass);g=j.sSortColumn;if(a.oFeatures.bSort&&a.oFeatures.bSortClasses){d=L(a);if(a.oFeatures.bDeferRender)h(d).removeClass(g+"1 "+g+"2 "+g+"3");else if(d.length>=e)for(b=0;b<e;b++)if(-1!=d[b].className.indexOf(g+"1"))for(c=0,a=d.length/e;c<a;c++)d[e*c+b].className=
h.trim(d[e*c+b].className.replace(g+"1",""));else if(-1!=d[b].className.indexOf(g+"2"))for(c=0,a=d.length/e;c<a;c++)d[e*c+b].className=h.trim(d[e*c+b].className.replace(g+"2",""));else if(-1!=d[b].className.indexOf(g+"3"))for(c=0,a=d.length/e;c<a;c++)d[e*c+b].className=h.trim(d[e*c+b].className.replace(" "+g+"3",""));var j=1,o;for(b=0;b<f.length;b++){o=parseInt(f[b][0],10);for(c=0,a=d.length/e;c<a;c++)d[e*c+o].className+=" "+g+j;3>j&&j++}}}function qa(a){if(a.oFeatures.bStateSave&&!a.bDestroying){var b,
c;b=a.oScroll.bInfinite;var d={iCreate:(new Date).getTime(),iStart:b?0:a._iDisplayStart,iEnd:b?a._iDisplayLength:a._iDisplayEnd,iLength:a._iDisplayLength,aaSorting:h.extend(!0,[],a.aaSorting),oSearch:h.extend(!0,{},a.oPreviousSearch),aoSearchCols:h.extend(!0,[],a.aoPreSearchCols),abVisCols:[]};for(b=0,c=a.aoColumns.length;b<c;b++)d.abVisCols.push(a.aoColumns[b].bVisible);D(a,"aoStateSaveParams","stateSaveParams",[a,d]);a.fnStateSave.call(a.oInstance,a,d)}}function Ra(a,b){if(a.oFeatures.bStateSave){var c=
a.fnStateLoad.call(a.oInstance,a);if(c){var d=D(a,"aoStateLoadParams","stateLoadParams",[a,c]);if(-1===h.inArray(!1,d)){a.oLoadedState=h.extend(!0,{},c);a._iDisplayStart=c.iStart;a.iInitDisplayStart=c.iStart;a._iDisplayEnd=c.iEnd;a._iDisplayLength=c.iLength;a.aaSorting=c.aaSorting.slice();a.saved_aaSorting=c.aaSorting.slice();h.extend(a.oPreviousSearch,c.oSearch);h.extend(!0,a.aoPreSearchCols,c.aoSearchCols);b.saved_aoColumns=[];for(d=0;d<c.abVisCols.length;d++)b.saved_aoColumns[d]={},b.saved_aoColumns[d].bVisible=
c.abVisCols[d];D(a,"aoStateLoaded","stateLoaded",[a,c])}}}}function Sa(a){for(var b=V.location.pathname.split("/"),a=a+"_"+b[b.length-1].replace(/[\/:]/g,"").toLowerCase()+"=",b=l.cookie.split(";"),c=0;c<b.length;c++){for(var d=b[c];" "==d.charAt(0);)d=d.substring(1,d.length);if(0===d.indexOf(a))return decodeURIComponent(d.substring(a.length,d.length))}return null}function t(a){for(var b=0;b<j.settings.length;b++)if(j.settings[b].nTable===a)return j.settings[b];return null}function S(a){for(var b=
[],a=a.aoData,c=0,d=a.length;c<d;c++)null!==a[c].nTr&&b.push(a[c].nTr);return b}function L(a,b){var c=[],d,f,g,e,h,j;f=0;var o=a.aoData.length;b!==m&&(f=b,o=b+1);for(g=f;g<o;g++)if(j=a.aoData[g],null!==j.nTr){f=[];for(e=0,h=j.nTr.childNodes.length;e<h;e++)d=j.nTr.childNodes[e].nodeName.toLowerCase(),("td"==d||"th"==d)&&f.push(j.nTr.childNodes[e]);d=0;for(e=0,h=a.aoColumns.length;e<h;e++)a.aoColumns[e].bVisible?c.push(f[e-d]):(c.push(j._anHidden[e]),d++)}return c}function F(a,b,c){a=null===a?"DataTables warning: "+
c:"DataTables warning (table id = '"+a.sTableId+"'): "+c;if(0===b)if("alert"==j.ext.sErrMode)alert(a);else throw Error(a);else V.console&&console.log&&console.log(a)}function p(a,b,c,d){d===m&&(d=c);b[c]!==m&&(a[d]=b[c])}function Ta(a,b){for(var c in b)b.hasOwnProperty(c)&&("object"===typeof e[c]&&!1===h.isArray(b[c])?h.extend(!0,a[c],b[c]):a[c]=b[c]);return a}function Qa(a,b,c){h(a).bind("click.DT",b,function(b){a.blur();c(b)}).bind("keypress.DT",b,function(a){13===a.which&&c(a)}).bind("selectstart.DT",
function(){return!1})}function C(a,b,c,d){c&&a[b].push({fn:c,sName:d})}function D(a,b,c,d){for(var b=a[b],f=[],g=b.length-1;0<=g;g--)f.push(b[g].fn.apply(a.oInstance,d));null!==c&&h(a.oInstance).trigger(c,d);return f}function Ua(a){return function(){var b=[t(this[j.ext.iApiIndex])].concat(Array.prototype.slice.call(arguments));return j.ext.oApi[a].apply(this,b)}}var Va=V.JSON?JSON.stringify:function(a){var b=typeof a;if("object"!==b||null===a)return"string"===b&&(a='"'+a+'"'),a+"";var c,d,f=[],g=
h.isArray(a);for(c in a)d=a[c],b=typeof d,"string"===b?d='"'+d+'"':"object"===b&&null!==d&&(d=Va(d)),f.push((g?"":'"'+c+'":')+d);return(g?"[":"{")+f+(g?"]":"}")};this.$=function(a,b){var c,d,f=[],g=t(this[j.ext.iApiIndex]);b||(b={});b=h.extend({},{filter:"none",order:"current",page:"all"},b);if("current"==b.page)for(c=g._iDisplayStart,d=g.fnDisplayEnd();c<d;c++)f.push(g.aoData[g.aiDisplay[c]].nTr);else if("current"==b.order&&"none"==b.filter)for(c=0,d=g.aiDisplayMaster.length;c<d;c++)f.push(g.aoData[g.aiDisplayMaster[c]].nTr);
else if("current"==b.order&&"applied"==b.filter)for(c=0,d=g.aiDisplay.length;c<d;c++)f.push(g.aoData[g.aiDisplay[c]].nTr);else if("original"==b.order&&"none"==b.filter)for(c=0,d=g.aoData.length;c<d;c++)f.push(g.aoData[c].nTr);else if("original"==b.order&&"applied"==b.filter)for(c=0,d=g.aoData.length;c<d;c++)-1!==h.inArray(c,g.aiDisplay)&&f.push(g.aoData[c].nTr);else F(g,1,"Unknown selection options");d=h(f);c=d.filter(a);d=d.find(a);return h([].concat(h.makeArray(c),h.makeArray(d)))};this._=function(a,
b){var c=[],d,f,g=this.$(a,b);for(d=0,f=g.length;d<f;d++)c.push(this.fnGetData(g[d]));return c};this.fnAddData=function(a,b){if(0===a.length)return[];var c=[],d,f=t(this[j.ext.iApiIndex]);if("object"===typeof a[0]&&null!==a[0])for(var g=0;g<a.length;g++){d=H(f,a[g]);if(-1==d)return c;c.push(d)}else{d=H(f,a);if(-1==d)return c;c.push(d)}f.aiDisplay=f.aiDisplayMaster.slice();(b===m||b)&&$(f);return c};this.fnAdjustColumnSizing=function(a){var b=t(this[j.ext.iApiIndex]);k(b);a===m||a?this.fnDraw(!1):
(""!==b.oScroll.sX||""!==b.oScroll.sY)&&this.oApi._fnScrollDraw(b)};this.fnClearTable=function(a){var b=t(this[j.ext.iApiIndex]);ea(b);(a===m||a)&&z(b)};this.fnClose=function(a){for(var b=t(this[j.ext.iApiIndex]),c=0;c<b.aoOpenRows.length;c++)if(b.aoOpenRows[c].nParent==a)return(a=b.aoOpenRows[c].nTr.parentNode)&&a.removeChild(b.aoOpenRows[c].nTr),b.aoOpenRows.splice(c,1),0;return 1};this.fnDeleteRow=function(a,b,c){var d=t(this[j.ext.iApiIndex]),f,g,a="object"===typeof a?K(d,a):a,e=d.aoData.splice(a,
1);for(f=0,g=d.aoData.length;f<g;f++)if(null!==d.aoData[f].nTr)d.aoData[f].nTr._DT_RowIndex=f;f=h.inArray(a,d.aiDisplay);d.asDataSearch.splice(f,1);fa(d.aiDisplayMaster,a);fa(d.aiDisplay,a);"function"===typeof b&&b.call(this,d,e);if(d._iDisplayStart>=d.aiDisplay.length&&(d._iDisplayStart-=d._iDisplayLength,0>d._iDisplayStart))d._iDisplayStart=0;if(c===m||c)B(d),z(d);return e};this.fnDestroy=function(a){var b=t(this[j.ext.iApiIndex]),c=b.nTableWrapper.parentNode,d=b.nTBody,f,g,a=a===m?!1:!0;b.bDestroying=
!0;D(b,"aoDestroyCallback","destroy",[b]);for(f=0,g=b.aoColumns.length;f<g;f++)!1===b.aoColumns[f].bVisible&&this.fnSetColumnVis(f,!0);h(b.nTableWrapper).find("*").andSelf().unbind(".DT");h("tbody>tr>td."+b.oClasses.sRowEmpty,b.nTable).parent().remove();b.nTable!=b.nTHead.parentNode&&(h(b.nTable).children("thead").remove(),b.nTable.appendChild(b.nTHead));b.nTFoot&&b.nTable!=b.nTFoot.parentNode&&(h(b.nTable).children("tfoot").remove(),b.nTable.appendChild(b.nTFoot));b.nTable.parentNode.removeChild(b.nTable);
h(b.nTableWrapper).remove();b.aaSorting=[];b.aaSortingFixed=[];Q(b);h(S(b)).removeClass(b.asStripeClasses.join(" "));h("th, td",b.nTHead).removeClass([b.oClasses.sSortable,b.oClasses.sSortableAsc,b.oClasses.sSortableDesc,b.oClasses.sSortableNone].join(" "));b.bJUI&&(h("th span."+b.oClasses.sSortIcon+", td span."+b.oClasses.sSortIcon,b.nTHead).remove(),h("th, td",b.nTHead).each(function(){var a=h("div."+b.oClasses.sSortJUIWrapper,this),c=a.contents();h(this).append(c);a.remove()}));!a&&b.nTableReinsertBefore?
c.insertBefore(b.nTable,b.nTableReinsertBefore):a||c.appendChild(b.nTable);for(f=0,g=b.aoData.length;f<g;f++)null!==b.aoData[f].nTr&&d.appendChild(b.aoData[f].nTr);if(!0===b.oFeatures.bAutoWidth)b.nTable.style.width=q(b.sDestroyWidth);h(d).children("tr:even").addClass(b.asDestroyStripes[0]);h(d).children("tr:odd").addClass(b.asDestroyStripes[1]);for(f=0,g=j.settings.length;f<g;f++)j.settings[f]==b&&j.settings.splice(f,1);b=null};this.fnDraw=function(a){var b=t(this[j.ext.iApiIndex]);!1===a?(B(b),
z(b)):$(b)};this.fnFilter=function(a,b,c,d,f,g){var e=t(this[j.ext.iApiIndex]);if(e.oFeatures.bFilter){if(c===m||null===c)c=!1;if(d===m||null===d)d=!0;if(f===m||null===f)f=!0;if(g===m||null===g)g=!0;if(b===m||null===b){if(M(e,{sSearch:a+"",bRegex:c,bSmart:d,bCaseInsensitive:g},1),f&&e.aanFeatures.f){b=e.aanFeatures.f;c=0;for(d=b.length;c<d;c++)h(b[c]._DT_Input).val(a)}}else h.extend(e.aoPreSearchCols[b],{sSearch:a+"",bRegex:c,bSmart:d,bCaseInsensitive:g}),M(e,e.oPreviousSearch,1)}};this.fnGetData=
function(a,b){var c=t(this[j.ext.iApiIndex]);if(a!==m){var d=a;if("object"===typeof a){var f=a.nodeName.toLowerCase();"tr"===f?d=K(c,a):"td"===f&&(d=K(c,a.parentNode),b=da(c,d,a))}return b!==m?w(c,d,b,""):c.aoData[d]!==m?c.aoData[d]._aData:null}return Y(c)};this.fnGetNodes=function(a){var b=t(this[j.ext.iApiIndex]);return a!==m?b.aoData[a]!==m?b.aoData[a].nTr:null:S(b)};this.fnGetPosition=function(a){var b=t(this[j.ext.iApiIndex]),c=a.nodeName.toUpperCase();if("TR"==c)return K(b,a);return"TD"==c||
"TH"==c?(c=K(b,a.parentNode),a=da(b,c,a),[c,r(b,a),a]):null};this.fnIsOpen=function(a){for(var b=t(this[j.ext.iApiIndex]),c=0;c<b.aoOpenRows.length;c++)if(b.aoOpenRows[c].nParent==a)return!0;return!1};this.fnOpen=function(a,b,c){var d=t(this[j.ext.iApiIndex]),f=S(d);if(-1!==h.inArray(a,f)){this.fnClose(a);var f=l.createElement("tr"),g=l.createElement("td");f.appendChild(g);g.className=c;g.colSpan=v(d);"string"===typeof b?g.innerHTML=b:h(g).html(b);b=h("tr",d.nTBody);-1!=h.inArray(a,b)&&h(f).insertAfter(a);
d.aoOpenRows.push({nTr:f,nParent:a});return f}};this.fnPageChange=function(a,b){var c=t(this[j.ext.iApiIndex]);pa(c,a);B(c);(b===m||b)&&z(c)};this.fnSetColumnVis=function(a,b,c){var d=t(this[j.ext.iApiIndex]),f,g,e=d.aoColumns,h=d.aoData,o,n;if(e[a].bVisible!=b){if(b){for(f=g=0;f<a;f++)e[f].bVisible&&g++;n=g>=v(d);if(!n)for(f=a;f<e.length;f++)if(e[f].bVisible){o=f;break}for(f=0,g=h.length;f<g;f++)null!==h[f].nTr&&(n?h[f].nTr.appendChild(h[f]._anHidden[a]):h[f].nTr.insertBefore(h[f]._anHidden[a],L(d,
f)[o]))}else for(f=0,g=h.length;f<g;f++)null!==h[f].nTr&&(o=L(d,f)[a],h[f]._anHidden[a]=o,o.parentNode.removeChild(o));e[a].bVisible=b;U(d,d.aoHeader);d.nTFoot&&U(d,d.aoFooter);for(f=0,g=d.aoOpenRows.length;f<g;f++)d.aoOpenRows[f].nTr.colSpan=v(d);if(c===m||c)k(d),z(d);qa(d)}};this.fnSettings=function(){return t(this[j.ext.iApiIndex])};this.fnSort=function(a){var b=t(this[j.ext.iApiIndex]);b.aaSorting=a;P(b)};this.fnSortListener=function(a,b,c){ga(t(this[j.ext.iApiIndex]),a,b,c)};this.fnUpdate=function(a,
b,c,d,f){var e=t(this[j.ext.iApiIndex]),b="object"===typeof b?K(e,b):b;if(e.__fnUpdateDeep===m&&h.isArray(a)&&"object"===typeof a){e.aoData[b]._aData=a.slice();e.__fnUpdateDeep=!0;for(c=0;c<e.aoColumns.length;c++)this.fnUpdate(w(e,b,c),b,c,!1,!1);e.__fnUpdateDeep=m}else if(e.__fnUpdateDeep===m&&null!==a&&"object"===typeof a){e.aoData[b]._aData=h.extend(!0,{},a);e.__fnUpdateDeep=!0;for(c=0;c<e.aoColumns.length;c++)this.fnUpdate(w(e,b,c),b,c,!1,!1);e.__fnUpdateDeep=m}else{I(e,b,c,a);var a=w(e,b,c,"display"),
i=e.aoColumns[c];null!==i.fnRender&&(a=R(e,b,c),i.bUseRendered&&I(e,b,c,a));if(null!==e.aoData[b].nTr)L(e,b)[c].innerHTML=a}c=h.inArray(b,e.aiDisplay);e.asDataSearch[c]=ma(e,X(e,b,"filter"));(f===m||f)&&k(e);(d===m||d)&&$(e);return 0};this.fnVersionCheck=j.ext.fnVersionCheck;this.oApi={_fnExternApiFunc:Ua,_fnInitialise:aa,_fnInitComplete:Z,_fnLanguageCompat:oa,_fnAddColumn:o,_fnColumnOptions:s,_fnAddData:H,_fnCreateTr:ca,_fnGatherData:ua,_fnBuildHead:va,_fnDrawHead:U,_fnDraw:z,_fnReDraw:$,_fnAjaxUpdate:wa,
_fnAjaxParameters:Ea,_fnAjaxUpdateDraw:Fa,_fnServerParams:ia,_fnAddOptionsHtml:xa,_fnFeatureHtmlTable:Ba,_fnScrollDraw:Ka,_fnAdjustColumnSizing:k,_fnFeatureHtmlFilter:za,_fnFilterComplete:M,_fnFilterCustom:Ia,_fnFilterColumn:Ha,_fnFilter:Ga,_fnBuildSearchArray:ja,_fnBuildSearchRow:ma,_fnFilterCreateSearch:ka,_fnDataToSearch:la,_fnSort:P,_fnSortAttachListener:ga,_fnSortingClasses:Q,_fnFeatureHtmlPaginate:Da,_fnPageChange:pa,_fnFeatureHtmlInfo:Ca,_fnUpdateInfo:Ja,_fnFeatureHtmlLength:ya,_fnFeatureHtmlProcessing:Aa,
_fnProcessingDisplay:G,_fnVisibleToColumnIndex:x,_fnColumnIndexToVisible:r,_fnNodeToDataIndex:K,_fnVisbleColumns:v,_fnCalculateEnd:B,_fnConvertToWidth:La,_fnCalculateColumnWidths:ba,_fnScrollingWidthAdjust:Na,_fnGetWidestNode:Ma,_fnGetMaxLenString:Oa,_fnStringToCss:q,_fnDetectType:A,_fnSettingsFromNode:t,_fnGetDataMaster:Y,_fnGetTrNodes:S,_fnGetTdNodes:L,_fnEscapeRegex:na,_fnDeleteIndex:fa,_fnReOrderIndex:E,_fnColumnOrdering:y,_fnLog:F,_fnClearTable:ea,_fnSaveState:qa,_fnLoadState:Ra,_fnCreateCookie:function(a,
b,c,d,e){var g=new Date;g.setTime(g.getTime()+1E3*c);var c=V.location.pathname.split("/"),a=a+"_"+c.pop().replace(/[\/:]/g,"").toLowerCase(),i;null!==e?(i="function"===typeof h.parseJSON?h.parseJSON(b):eval("("+b+")"),b=e(a,i,g.toGMTString(),c.join("/")+"/")):b=a+"="+encodeURIComponent(b)+"; expires="+g.toGMTString()+"; path="+c.join("/")+"/";e="";g=9999999999999;if(4096<(null!==Sa(a)?l.cookie.length:b.length+l.cookie.length)+10){for(var a=l.cookie.split(";"),j=0,o=a.length;j<o;j++)if(-1!=a[j].indexOf(d)){var k=
a[j].split("=");try{i=eval("("+decodeURIComponent(k[1])+")")}catch(m){continue}if(i.iCreate&&i.iCreate<g)e=k[0],g=i.iCreate}if(""!==e)l.cookie=e+"=; expires=Thu, 01-Jan-1970 00:00:01 GMT; path="+c.join("/")+"/"}l.cookie=b},_fnReadCookie:Sa,_fnDetectHeader:T,_fnGetUniqueThs:O,_fnScrollBarWidth:Pa,_fnApplyToChildren:N,_fnMap:p,_fnGetRowData:X,_fnGetCellData:w,_fnSetCellData:I,_fnGetObjectDataFn:W,_fnSetObjectDataFn:ta,_fnApplyColumnDefs:J,_fnBindAction:Qa,_fnExtend:Ta,_fnCallbackReg:C,_fnCallbackFire:D,
_fnJsonString:Va,_fnRender:R,_fnNodeToColumnIndex:da,_fnInfoMacros:ha};h.extend(j.ext.oApi,this.oApi);for(var ra in j.ext.oApi)ra&&(this[ra]=Ua(ra));var sa=this;return this.each(function(){var a=0,b,c,d;c=this.getAttribute("id");var f=!1,g=!1;if("table"!=this.nodeName.toLowerCase())F(null,0,"Attempted to initialise DataTables on a node which is not a table: "+this.nodeName);else{for(a=0,b=j.settings.length;a<b;a++){if(j.settings[a].nTable==this){if(e===m||e.bRetrieve)return j.settings[a].oInstance;
if(e.bDestroy){j.settings[a].oInstance.fnDestroy();break}else{F(j.settings[a],0,"Cannot reinitialise DataTable.\n\nTo retrieve the DataTables object for this table, pass no arguments or see the docs for bRetrieve and bDestroy");return}}if(j.settings[a].sTableId==this.id){j.settings.splice(a,1);break}}if(null===c||""===c)this.id=c="DataTables_Table_"+j.ext._oExternConfig.iNextUnique++;var i=h.extend(!0,{},j.models.oSettings,{nTable:this,oApi:sa.oApi,oInit:e,sDestroyWidth:h(this).width(),sInstance:c,
sTableId:c});j.settings.push(i);i.oInstance=1===sa.length?sa:h(this).dataTable();e||(e={});e.oLanguage&&oa(e.oLanguage);e=Ta(h.extend(!0,{},j.defaults),e);p(i.oFeatures,e,"bPaginate");p(i.oFeatures,e,"bLengthChange");p(i.oFeatures,e,"bFilter");p(i.oFeatures,e,"bSort");p(i.oFeatures,e,"bInfo");p(i.oFeatures,e,"bProcessing");p(i.oFeatures,e,"bAutoWidth");p(i.oFeatures,e,"bSortClasses");p(i.oFeatures,e,"bServerSide");p(i.oFeatures,e,"bDeferRender");p(i.oScroll,e,"sScrollX","sX");p(i.oScroll,e,"sScrollXInner",
"sXInner");p(i.oScroll,e,"sScrollY","sY");p(i.oScroll,e,"bScrollCollapse","bCollapse");p(i.oScroll,e,"bScrollInfinite","bInfinite");p(i.oScroll,e,"iScrollLoadGap","iLoadGap");p(i.oScroll,e,"bScrollAutoCss","bAutoCss");p(i,e,"asStripeClasses");p(i,e,"asStripClasses","asStripeClasses");p(i,e,"fnServerData");p(i,e,"fnFormatNumber");p(i,e,"sServerMethod");p(i,e,"aaSorting");p(i,e,"aaSortingFixed");p(i,e,"aLengthMenu");p(i,e,"sPaginationType");p(i,e,"sAjaxSource");p(i,e,"sAjaxDataProp");p(i,e,"iCookieDuration");
p(i,e,"sCookiePrefix");p(i,e,"sDom");p(i,e,"bSortCellsTop");p(i,e,"iTabIndex");p(i,e,"oSearch","oPreviousSearch");p(i,e,"aoSearchCols","aoPreSearchCols");p(i,e,"iDisplayLength","_iDisplayLength");p(i,e,"bJQueryUI","bJUI");p(i,e,"fnCookieCallback");p(i,e,"fnStateLoad");p(i,e,"fnStateSave");p(i.oLanguage,e,"fnInfoCallback");C(i,"aoDrawCallback",e.fnDrawCallback,"user");C(i,"aoServerParams",e.fnServerParams,"user");C(i,"aoStateSaveParams",e.fnStateSaveParams,"user");C(i,"aoStateLoadParams",e.fnStateLoadParams,
"user");C(i,"aoStateLoaded",e.fnStateLoaded,"user");C(i,"aoRowCallback",e.fnRowCallback,"user");C(i,"aoRowCreatedCallback",e.fnCreatedRow,"user");C(i,"aoHeaderCallback",e.fnHeaderCallback,"user");C(i,"aoFooterCallback",e.fnFooterCallback,"user");C(i,"aoInitComplete",e.fnInitComplete,"user");C(i,"aoPreDrawCallback",e.fnPreDrawCallback,"user");i.oFeatures.bServerSide&&i.oFeatures.bSort&&i.oFeatures.bSortClasses?C(i,"aoDrawCallback",Q,"server_side_sort_classes"):i.oFeatures.bDeferRender&&C(i,"aoDrawCallback",
Q,"defer_sort_classes");if(e.bJQueryUI){if(h.extend(i.oClasses,j.ext.oJUIClasses),e.sDom===j.defaults.sDom&&"lfrtip"===j.defaults.sDom)i.sDom='<"H"lfr>t<"F"ip>'}else h.extend(i.oClasses,j.ext.oStdClasses);h(this).addClass(i.oClasses.sTable);if(""!==i.oScroll.sX||""!==i.oScroll.sY)i.oScroll.iBarWidth=Pa();if(i.iInitDisplayStart===m)i.iInitDisplayStart=e.iDisplayStart,i._iDisplayStart=e.iDisplayStart;if(e.bStateSave)i.oFeatures.bStateSave=!0,Ra(i,e),C(i,"aoDrawCallback",qa,"state_save");if(null!==e.iDeferLoading)i.bDeferLoading=
!0,a=h.isArray(e.iDeferLoading),i._iRecordsDisplay=a?e.iDeferLoading[0]:e.iDeferLoading,i._iRecordsTotal=a?e.iDeferLoading[1]:e.iDeferLoading;null!==e.aaData&&(g=!0);""!==e.oLanguage.sUrl?(i.oLanguage.sUrl=e.oLanguage.sUrl,h.getJSON(i.oLanguage.sUrl,null,function(a){oa(a);h.extend(!0,i.oLanguage,e.oLanguage,a);aa(i)}),f=!0):h.extend(!0,i.oLanguage,e.oLanguage);if(null===e.asStripeClasses)i.asStripeClasses=[i.oClasses.sStripeOdd,i.oClasses.sStripeEven];c=!1;d=h(this).children("tbody").children("tr");
for(a=0,b=i.asStripeClasses.length;a<b;a++)if(d.filter(":lt(2)").hasClass(i.asStripeClasses[a])){c=!0;break}if(c)i.asDestroyStripes=["",""],h(d[0]).hasClass(i.oClasses.sStripeOdd)&&(i.asDestroyStripes[0]+=i.oClasses.sStripeOdd+" "),h(d[0]).hasClass(i.oClasses.sStripeEven)&&(i.asDestroyStripes[0]+=i.oClasses.sStripeEven),h(d[1]).hasClass(i.oClasses.sStripeOdd)&&(i.asDestroyStripes[1]+=i.oClasses.sStripeOdd+" "),h(d[1]).hasClass(i.oClasses.sStripeEven)&&(i.asDestroyStripes[1]+=i.oClasses.sStripeEven),
d.removeClass(i.asStripeClasses.join(" "));c=[];a=this.getElementsByTagName("thead");0!==a.length&&(T(i.aoHeader,a[0]),c=O(i));if(null===e.aoColumns){d=[];for(a=0,b=c.length;a<b;a++)d.push(null)}else d=e.aoColumns;for(a=0,b=d.length;a<b;a++){if(e.saved_aoColumns!==m&&e.saved_aoColumns.length==b)null===d[a]&&(d[a]={}),d[a].bVisible=e.saved_aoColumns[a].bVisible;o(i,c?c[a]:null)}J(i,e.aoColumnDefs,d,function(a,b){s(i,a,b)});for(a=0,b=i.aaSorting.length;a<b;a++){i.aaSorting[a][0]>=i.aoColumns.length&&
(i.aaSorting[a][0]=0);var k=i.aoColumns[i.aaSorting[a][0]];i.aaSorting[a][2]===m&&(i.aaSorting[a][2]=0);e.aaSorting===m&&i.saved_aaSorting===m&&(i.aaSorting[a][1]=k.asSorting[0]);for(c=0,d=k.asSorting.length;c<d;c++)if(i.aaSorting[a][1]==k.asSorting[c]){i.aaSorting[a][2]=c;break}}Q(i);a=h(this).children("caption").each(function(){this._captionSide=h(this).css("caption-side")});b=h(this).children("thead");0===b.length&&(b=[l.createElement("thead")],this.appendChild(b[0]));i.nTHead=b[0];b=h(this).children("tbody");
0===b.length&&(b=[l.createElement("tbody")],this.appendChild(b[0]));i.nTBody=b[0];i.nTBody.setAttribute("role","alert");i.nTBody.setAttribute("aria-live","polite");i.nTBody.setAttribute("aria-relevant","all");b=h(this).children("tfoot");if(0===b.length&&0<a.length&&(""!==i.oScroll.sX||""!==i.oScroll.sY))b=[l.createElement("tfoot")],this.appendChild(b[0]);if(0<b.length)i.nTFoot=b[0],T(i.aoFooter,i.nTFoot);if(g)for(a=0;a<e.aaData.length;a++)H(i,e.aaData[a]);else ua(i);i.aiDisplay=i.aiDisplayMaster.slice();
i.bInitialised=!0;!1===f&&aa(i)}})};j.fnVersionCheck=function(e){for(var h=function(e,h){for(;e.length<h;)e+="0";return e},m=j.ext.sVersion.split("."),e=e.split("."),k="",l="",r=0,v=e.length;r<v;r++)k+=h(m[r],3),l+=h(e[r],3);return parseInt(k,10)>=parseInt(l,10)};j.fnIsDataTable=function(e){for(var h=j.settings,m=0;m<h.length;m++)if(h[m].nTable===e||h[m].nScrollHead===e||h[m].nScrollFoot===e)return!0;return!1};j.fnTables=function(e){var o=[];jQuery.each(j.settings,function(j,k){(!e||!0===e&&h(k.nTable).is(":visible"))&&
o.push(k.nTable)});return o};j.version="1.9.1";j.settings=[];j.models={};j.models.ext={afnFiltering:[],afnSortData:[],aoFeatures:[],aTypes:[],fnVersionCheck:j.fnVersionCheck,iApiIndex:0,ofnSearch:{},oApi:{},oStdClasses:{},oJUIClasses:{},oPagination:{},oSort:{},sVersion:j.version,sErrMode:"alert",_oExternConfig:{iNextUnique:0}};j.models.oSearch={bCaseInsensitive:!0,sSearch:"",bRegex:!1,bSmart:!0};j.models.oRow={nTr:null,_aData:[],_aSortData:[],_anHidden:[],_sRowStripe:""};j.models.oColumn={aDataSort:null,
asSorting:null,bSearchable:null,bSortable:null,bUseRendered:null,bVisible:null,_bAutoType:!0,fnCreatedCell:null,fnGetData:null,fnRender:null,fnSetData:null,mDataProp:null,nTh:null,nTf:null,sClass:null,sContentPadding:null,sDefaultContent:null,sName:null,sSortDataType:"std",sSortingClass:null,sSortingClassJUI:null,sTitle:null,sType:null,sWidth:null,sWidthOrig:null};j.defaults={aaData:null,aaSorting:[[0,"asc"]],aaSortingFixed:null,aLengthMenu:[10,25,50,100],aoColumns:null,aoColumnDefs:null,aoSearchCols:[],
asStripeClasses:null,bAutoWidth:!0,bDeferRender:!1,bDestroy:!1,bFilter:!0,bInfo:!0,bJQueryUI:!1,bLengthChange:!0,bPaginate:!0,bProcessing:!1,bRetrieve:!1,bScrollAutoCss:!0,bScrollCollapse:!1,bScrollInfinite:!1,bServerSide:!1,bSort:!0,bSortCellsTop:!1,bSortClasses:!0,bStateSave:!1,fnCookieCallback:null,fnCreatedRow:null,fnDrawCallback:null,fnFooterCallback:null,fnFormatNumber:function(e){if(1E3>e)return e;for(var h=e+"",e=h.split(""),j="",h=h.length,k=0;k<h;k++)0===k%3&&0!==k&&(j=this.oLanguage.sInfoThousands+
j),j=e[h-k-1]+j;return j},fnHeaderCallback:null,fnInfoCallback:null,fnInitComplete:null,fnPreDrawCallback:null,fnRowCallback:null,fnServerData:function(e,j,m,k){k.jqXHR=h.ajax({url:e,data:j,success:function(e){h(k.oInstance).trigger("xhr",k);m(e)},dataType:"json",cache:!1,type:k.sServerMethod,error:function(e,h){"parsererror"==h&&k.oApi._fnLog(k,0,"DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error.")}})},fnServerParams:null,fnStateLoad:function(e){var e=
this.oApi._fnReadCookie(e.sCookiePrefix+e.sInstance),j;try{j="function"===typeof h.parseJSON?h.parseJSON(e):eval("("+e+")")}catch(m){j=null}return j},fnStateLoadParams:null,fnStateLoaded:null,fnStateSave:function(e,h){this.oApi._fnCreateCookie(e.sCookiePrefix+e.sInstance,this.oApi._fnJsonString(h),e.iCookieDuration,e.sCookiePrefix,e.fnCookieCallback)},fnStateSaveParams:null,iCookieDuration:7200,iDeferLoading:null,iDisplayLength:10,iDisplayStart:0,iScrollLoadGap:100,iTabIndex:0,oLanguage:{oAria:{sSortAscending:": activate to sort column ascending",
sSortDescending:": activate to sort column descending"},oPaginate:{sFirst:"First",sLast:"Last",sNext:"Next",sPrevious:"Previous"},sEmptyTable:"No data available in table",sInfo:"Showing _START_ to _END_ of _TOTAL_ entries",sInfoEmpty:"Showing 0 to 0 of 0 entries",sInfoFiltered:"(filtered from _MAX_ total entries)",sInfoPostFix:"",sInfoThousands:",",sLengthMenu:"Show _MENU_ entries",sLoadingRecords:"Loading...",sProcessing:"Processing...",sSearch:"Search:",sUrl:"",sZeroRecords:"No matching records found"},
oSearch:h.extend({},j.models.oSearch),sAjaxDataProp:"aaData",sAjaxSource:null,sCookiePrefix:"SpryMedia_DataTables_",sDom:"lfrtip",sPaginationType:"two_button",sScrollX:"",sScrollXInner:"",sScrollY:"",sServerMethod:"GET"};j.defaults.columns={aDataSort:null,asSorting:["asc","desc"],bSearchable:!0,bSortable:!0,bUseRendered:!0,bVisible:!0,fnCreatedCell:null,fnRender:null,iDataSort:-1,mDataProp:null,sCellType:"td",sClass:"",sContentPadding:"",sDefaultContent:null,sName:"",sSortDataType:"std",sTitle:null,
sType:null,sWidth:null};j.models.oSettings={oFeatures:{bAutoWidth:null,bDeferRender:null,bFilter:null,bInfo:null,bLengthChange:null,bPaginate:null,bProcessing:null,bServerSide:null,bSort:null,bSortClasses:null,bStateSave:null},oScroll:{bAutoCss:null,bCollapse:null,bInfinite:null,iBarWidth:0,iLoadGap:null,sX:null,sXInner:null,sY:null},oLanguage:{fnInfoCallback:null},aanFeatures:[],aoData:[],aiDisplay:[],aiDisplayMaster:[],aoColumns:[],aoHeader:[],aoFooter:[],asDataSearch:[],oPreviousSearch:{},aoPreSearchCols:[],
aaSorting:null,aaSortingFixed:null,asStripeClasses:null,asDestroyStripes:[],sDestroyWidth:0,aoRowCallback:[],aoHeaderCallback:[],aoFooterCallback:[],aoDrawCallback:[],aoRowCreatedCallback:[],aoPreDrawCallback:[],aoInitComplete:[],aoStateSaveParams:[],aoStateLoadParams:[],aoStateLoaded:[],sTableId:"",nTable:null,nTHead:null,nTFoot:null,nTBody:null,nTableWrapper:null,bDeferLoading:!1,bInitialised:!1,aoOpenRows:[],sDom:null,sPaginationType:"two_button",iCookieDuration:0,sCookiePrefix:"",fnCookieCallback:null,
aoStateSave:[],aoStateLoad:[],oLoadedState:null,sAjaxSource:null,sAjaxDataProp:null,bAjaxDataGet:!0,jqXHR:null,fnServerData:null,aoServerParams:[],sServerMethod:null,fnFormatNumber:null,aLengthMenu:null,iDraw:0,bDrawing:!1,iDrawError:-1,_iDisplayLength:10,_iDisplayStart:0,_iDisplayEnd:10,_iRecordsTotal:0,_iRecordsDisplay:0,bJUI:null,oClasses:{},bFiltered:!1,bSorted:!1,bSortCellsTop:null,oInit:null,aoDestroyCallback:[],fnRecordsTotal:function(){return this.oFeatures.bServerSide?parseInt(this._iRecordsTotal,
10):this.aiDisplayMaster.length},fnRecordsDisplay:function(){return this.oFeatures.bServerSide?parseInt(this._iRecordsDisplay,10):this.aiDisplay.length},fnDisplayEnd:function(){return this.oFeatures.bServerSide?!1===this.oFeatures.bPaginate||-1==this._iDisplayLength?this._iDisplayStart+this.aiDisplay.length:Math.min(this._iDisplayStart+this._iDisplayLength,this._iRecordsDisplay):this._iDisplayEnd},oInstance:null,sInstance:null,iTabIndex:0,nScrollHead:null,nScrollFoot:null};j.ext=h.extend(!0,{},j.models.ext);
h.extend(j.ext.oStdClasses,{sTable:"dataTable",sPagePrevEnabled:"paginate_enabled_previous",sPagePrevDisabled:"paginate_disabled_previous",sPageNextEnabled:"paginate_enabled_next",sPageNextDisabled:"paginate_disabled_next",sPageJUINext:"",sPageJUIPrev:"",sPageButton:"paginate_button",sPageButtonActive:"paginate_active",sPageButtonStaticDisabled:"paginate_button paginate_button_disabled",sPageFirst:"first",sPagePrevious:"previous",sPageNext:"next",sPageLast:"last",sStripeOdd:"odd",sStripeEven:"even",
sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"sorting_asc",sSortDesc:"sorting_desc",sSortable:"sorting",sSortableAsc:"sorting_asc_disabled",sSortableDesc:"sorting_desc_disabled",sSortableNone:"sorting_disabled",sSortColumn:"sorting_",sSortJUIAsc:"",sSortJUIDesc:"",sSortJUI:"",sSortJUIAscAllowed:"",sSortJUIDescAllowed:"",sSortJUIWrapper:"",
sSortIcon:"",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot",sScrollFootInner:"dataTables_scrollFootInner",sFooterTH:""});h.extend(j.ext.oJUIClasses,j.ext.oStdClasses,{sPagePrevEnabled:"fg-button ui-button ui-state-default ui-corner-left",sPagePrevDisabled:"fg-button ui-button ui-state-default ui-corner-left ui-state-disabled",sPageNextEnabled:"fg-button ui-button ui-state-default ui-corner-right",
sPageNextDisabled:"fg-button ui-button ui-state-default ui-corner-right ui-state-disabled",sPageJUINext:"ui-icon ui-icon-circle-arrow-e",sPageJUIPrev:"ui-icon ui-icon-circle-arrow-w",sPageButton:"fg-button ui-button ui-state-default",sPageButtonActive:"fg-button ui-button ui-state-default ui-state-disabled",sPageButtonStaticDisabled:"fg-button ui-button ui-state-default ui-state-disabled",sPageFirst:"first ui-corner-tl ui-corner-bl",sPageLast:"last ui-corner-tr ui-corner-br",sPaging:"dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi ui-buttonset-multi paging_",
sSortAsc:"ui-state-default",sSortDesc:"ui-state-default",sSortable:"ui-state-default",sSortableAsc:"ui-state-default",sSortableDesc:"ui-state-default",sSortableNone:"ui-state-default",sSortJUIAsc:"css_right ui-icon ui-icon-triangle-1-n",sSortJUIDesc:"css_right ui-icon ui-icon-triangle-1-s",sSortJUI:"css_right ui-icon ui-icon-carat-2-n-s",sSortJUIAscAllowed:"css_right ui-icon ui-icon-carat-1-n",sSortJUIDescAllowed:"css_right ui-icon ui-icon-carat-1-s",sSortJUIWrapper:"DataTables_sort_wrapper",sSortIcon:"DataTables_sort_icon",
sScrollHead:"dataTables_scrollHead ui-state-default",sScrollFoot:"dataTables_scrollFoot ui-state-default",sFooterTH:"ui-state-default"});h.extend(j.ext.oPagination,{two_button:{fnInit:function(e,j,m){var k=e.oLanguage.oPaginate,l=function(h){e.oApi._fnPageChange(e,h.data.action)&&m(e)},k=!e.bJUI?'<a class="'+e.oClasses.sPagePrevDisabled+'" tabindex="'+e.iTabIndex+'" role="button">'+k.sPrevious+'</a><a class="'+e.oClasses.sPageNextDisabled+'" tabindex="'+e.iTabIndex+'" role="button">'+k.sNext+"</a>":
'<a class="'+e.oClasses.sPagePrevDisabled+'" tabindex="'+e.iTabIndex+'" role="button"><span class="'+e.oClasses.sPageJUIPrev+'"></span></a><a class="'+e.oClasses.sPageNextDisabled+'" tabindex="'+e.iTabIndex+'" role="button"><span class="'+e.oClasses.sPageJUINext+'"></span></a>';h(j).append(k);var r=h("a",j),k=r[0],r=r[1];e.oApi._fnBindAction(k,{action:"previous"},l);e.oApi._fnBindAction(r,{action:"next"},l);if(!e.aanFeatures.p)j.id=e.sTableId+"_paginate",k.id=e.sTableId+"_previous",r.id=e.sTableId+
"_next",k.setAttribute("aria-controls",e.sTableId),r.setAttribute("aria-controls",e.sTableId)},fnUpdate:function(e){if(e.aanFeatures.p)for(var h=e.oClasses,j=e.aanFeatures.p,k=0,m=j.length;k<m;k++)if(0!==j[k].childNodes.length)j[k].childNodes[0].className=0===e._iDisplayStart?h.sPagePrevDisabled:h.sPagePrevEnabled,j[k].childNodes[1].className=e.fnDisplayEnd()==e.fnRecordsDisplay()?h.sPageNextDisabled:h.sPageNextEnabled}},iFullNumbersShowPages:5,full_numbers:{fnInit:function(e,j,m){var k=e.oLanguage.oPaginate,
l=e.oClasses,r=function(h){e.oApi._fnPageChange(e,h.data.action)&&m(e)};h(j).append('<a  tabindex="'+e.iTabIndex+'" class="'+l.sPageButton+" "+l.sPageFirst+'">'+k.sFirst+'</a><a  tabindex="'+e.iTabIndex+'" class="'+l.sPageButton+" "+l.sPagePrevious+'">'+k.sPrevious+'</a><span></span><a tabindex="'+e.iTabIndex+'" class="'+l.sPageButton+" "+l.sPageNext+'">'+k.sNext+'</a><a tabindex="'+e.iTabIndex+'" class="'+l.sPageButton+" "+l.sPageLast+'">'+k.sLast+"</a>");var v=h("a",j),k=v[0],l=v[1],A=v[2],v=v[3];
e.oApi._fnBindAction(k,{action:"first"},r);e.oApi._fnBindAction(l,{action:"previous"},r);e.oApi._fnBindAction(A,{action:"next"},r);e.oApi._fnBindAction(v,{action:"last"},r);if(!e.aanFeatures.p)j.id=e.sTableId+"_paginate",k.id=e.sTableId+"_first",l.id=e.sTableId+"_previous",A.id=e.sTableId+"_next",v.id=e.sTableId+"_last"},fnUpdate:function(e,m){if(e.aanFeatures.p){var l=j.ext.oPagination.iFullNumbersShowPages,k=Math.floor(l/2),x=Math.ceil(e.fnRecordsDisplay()/e._iDisplayLength),r=Math.ceil(e._iDisplayStart/
e._iDisplayLength)+1,v="",A,E=e.oClasses,y,J=e.aanFeatures.p,H=function(h){e.oApi._fnBindAction(this,{page:h+A-1},function(h){e.oApi._fnPageChange(e,h.data.page);m(e);h.preventDefault()})};-1===e._iDisplayLength?r=k=A=1:x<l?(A=1,k=x):r<=k?(A=1,k=l):r>=x-k?(A=x-l+1,k=x):(A=r-Math.ceil(l/2)+1,k=A+l-1);for(l=A;l<=k;l++)v+=r!==l?'<a tabindex="'+e.iTabIndex+'" class="'+E.sPageButton+'">'+e.fnFormatNumber(l)+"</a>":'<a tabindex="'+e.iTabIndex+'" class="'+E.sPageButtonActive+'">'+e.fnFormatNumber(l)+"</a>";
for(l=0,k=J.length;l<k;l++)0!==J[l].childNodes.length&&(h("span:eq(0)",J[l]).html(v).children("a").each(H),y=J[l].getElementsByTagName("a"),y=[y[0],y[1],y[y.length-2],y[y.length-1]],h(y).removeClass(E.sPageButton+" "+E.sPageButtonActive+" "+E.sPageButtonStaticDisabled),h([y[0],y[1]]).addClass(1==r?E.sPageButtonStaticDisabled:E.sPageButton),h([y[2],y[3]]).addClass(0===x||r===x||-1===e._iDisplayLength?E.sPageButtonStaticDisabled:E.sPageButton))}}}});h.extend(j.ext.oSort,{"string-pre":function(e){"string"!=
typeof e&&(e=null!==e&&e.toString?e.toString():"");return e.toLowerCase()},"string-asc":function(e,h){return e<h?-1:e>h?1:0},"string-desc":function(e,h){return e<h?1:e>h?-1:0},"html-pre":function(e){return e.replace(/<.*?>/g,"").toLowerCase()},"html-asc":function(e,h){return e<h?-1:e>h?1:0},"html-desc":function(e,h){return e<h?1:e>h?-1:0},"date-pre":function(e){e=Date.parse(e);if(isNaN(e)||""===e)e=Date.parse("01/01/1970 00:00:00");return e},"date-asc":function(e,h){return e-h},"date-desc":function(e,
h){return h-e},"numeric-pre":function(e){return"-"==e||""===e?0:1*e},"numeric-asc":function(e,h){return e-h},"numeric-desc":function(e,h){return h-e}});h.extend(j.ext.aTypes,[function(e){if("number"===typeof e)return"numeric";if("string"!==typeof e)return null;var h,j=!1;h=e.charAt(0);if(-1=="0123456789-".indexOf(h))return null;for(var k=1;k<e.length;k++){h=e.charAt(k);if(-1=="0123456789.".indexOf(h))return null;if("."==h){if(j)return null;j=!0}}return"numeric"},function(e){var h=Date.parse(e);return null!==
h&&!isNaN(h)||"string"===typeof e&&0===e.length?"date":null},function(e){return"string"===typeof e&&-1!=e.indexOf("<")&&-1!=e.indexOf(">")?"html":null}]);h.fn.DataTable=j;h.fn.dataTable=j;h.fn.dataTableSettings=j.settings;h.fn.dataTableExt=j.ext})(jQuery,window,document,void 0);
;

