// ***************************
// js.compressed/jquery/jquery.thumbnail-radio-checkbox.min.js
// ***************************
/*!=======================================================================*\
|| ###################################################################### ||
|| # vBulletin 5.1.9 Patch Level 4
|| # ------------------------------------------------------------------ # ||
|| # Copyright 2000-2016 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   # ||
|| ###################################################################### ||
\*========================================================================*/
(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/jquery/jquery.tinyscrollbar.custom.min.js
// ***************************
/*!
 * Tiny Scrollbar 1.65
 * http://www.baijs.nl/tinyscrollbar/
 *
 * Copyright 2010, Maarten Baijs
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.opensource.org/licenses/gpl-2.0.php
 *
 * Date: 10 / 05 / 2011
 * Depends on library: jQuery
 * 
 * Modified for vBulletin
 * 		- added namespace to event handlers to prevent affecting other attached similar events when unbinding
 * 		- added 'update' callback to the options to allow custom function to call whenever tinyscrollbar_update() is called
 */
(function(a){function b(b,c){function r(){d.update();t();return d}function s(){if(n<0)n=0;j.obj.css(l,n/h.ratio);g.obj.css(l,-n);p["start"]=j.obj.offset()[l];var a=m.toLowerCase();h.obj.css(a,i[c.axis]);i.obj.css(a,i[c.axis]);j.obj.css(a,j[c.axis])}function t(){j.obj.bind("mousedown."+q,u);j.obj[0].ontouchstart=function(a){a.preventDefault();j.obj.unbind("mousedown."+q);u(a.touches[0]);return false};i.obj.bind("mouseup."+q,x);if(c.scroll&&this.addEventListener){e[0].addEventListener("DOMMouseScroll",v,false);e[0].addEventListener("mousewheel",v,false)}else if(c.scroll){e[0].onmousewheel=v}}function u(b){p.start=k?b.pageX:b.pageY;var c=parseInt(j.obj.css(l));o.start=c=="auto"?0:c;a(document).bind("mousemove."+q,x);document.ontouchmove=function(b){a(document).unbind("mousemove."+q);x(b.touches[0])};a(document).bind("mouseup."+q,w);j.obj.bind("mouseup."+q,w);j.obj[0].ontouchend=document.ontouchend=function(b){a(document).unbind("mouseup."+q);j.obj.unbind("mouseup."+q);w(b.touches[0])};return false}function v(b){if(!(g.ratio>=1)){b=a.event.fix(b||window.event);var d=b.originalEvent.wheelDelta?b.originalEvent.wheelDelta/120:-b.originalEvent.detail/3;n-=d*c.wheel;n=Math.min(g[c.axis]-f[c.axis],Math.max(0,n));j.obj.css(l,n/h.ratio);g.obj.css(l,-n);b.preventDefault()}}function w(b){a(document).unbind("mousemove."+q,x);a(document).unbind("mouseup."+q,w);j.obj.unbind("mouseup."+q,w);document.ontouchmove=j.obj[0].ontouchend=document.ontouchend=null;return false}function x(a){if(!(g.ratio>=1)){o.now=Math.min(i[c.axis]-j[c.axis],Math.max(0,o.start+((k?a.pageX:a.pageY)-p.start)));n=o.now*h.ratio;g.obj.css(l,-n);j.obj.css(l,o.now)}return false}var d=this;var e=b;var f={obj:a(".viewport",b)};var g={obj:a(".overview",b)};var h={obj:a(".scrollbar",b)};var i={obj:a(".track",h.obj)};var j={obj:a(".thumb",h.obj)};var k=c.axis=="x",l=k?"left":"top",m=k?"Width":"Height";var n,o={start:0,now:0},p={};var q="tinyscrollbar";this.update=function(a){f[c.axis]=f.obj[0]["offset"+m];g[c.axis]=g.obj[0]["scroll"+m];g.ratio=f[c.axis]/g[c.axis];h.obj.toggleClass("disable",g.ratio>=1);i[c.axis]=c.size=="auto"?f[c.axis]:c.size;j[c.axis]=Math.min(i[c.axis],Math.max(0,c.sizethumb=="auto"?i[c.axis]*g.ratio:c.sizethumb));h.ratio=c.sizethumb=="auto"?g[c.axis]/i[c.axis]:(g[c.axis]-f[c.axis])/(i[c.axis]-j[c.axis]);n=a=="relative"&&g.ratio<=1?Math.min(g[c.axis]-f[c.axis],Math.max(0,n)):0;n=a=="bottom"&&g.ratio<=1?g[c.axis]-f[c.axis]:isNaN(parseInt(a))?n:parseInt(a);s();if(typeof c.update=="function"){c.update.apply(e)}};return r()}a.tiny=a.tiny||{};a.tiny.scrollbar={options:{axis:"y",wheel:40,scroll:true,size:"auto",sizethumb:"auto",update:null}};a.fn.tinyscrollbar=function(c){var c=a.extend({},a.tiny.scrollbar.options,c);this.each(function(){a(this).data("tsb",new b(a(this),c))});return this};a.fn.tinyscrollbar_update=function(b){return a(this).data("tsb").update(b)};})(jQuery);

// ***************************
// js.compressed/sb_page.js
// ***************************
/*=======================================================================*\
|| ###################################################################### ||
|| # vBulletin 5.1.9 Patch Level 4
|| # ------------------------------------------------------------------ # ||
|| # Copyright 2000-2016 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","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","drag_and_drop_module_here","drop_page_here","dropping_container_module_into_container_module_not_allowed","edit","edit_blog_categories","edit_custom_html_module","edit_locationx_ad","edit_navigation_item","edit_search_module","edit_site_logo","error_adding_widgets","error_cloning_widget","error_deleting_page","error_deleting_page","error_fetching_channels","error_loading_search_config_script","error_processing_site_logo","error_processing_site_logo_image_hosting","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_search_config_code","error_saving_site_logo","error_saving_site_logo_code","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","module_configuration","module_icon","move_not_allowed","moving_main_nav_to_own_sub_nav_error","moving_main_nav_with_sub_nav_error","my_custom_modules","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_gcpuser","yes","you_are_here","you_can_also_drag_and_drop_modules_here","you_must_specify_a_screen_layout"]);(function(g){var y,AC,AE,k=[],z,n,l,v=[],AI,m,o=false,Y=false,G={},R=false,c=false,V=false,d=false,X=false,S=false,AB=false,q=false,AF={},N={};function O(){var AS=g("#edit-page-dropdown .panel .panel-main-content:visible");if(AS.length>0){var AT=parseFloat(AS.css("margin-left"))+parseFloat(AS.css("margin-right"))+parseFloat(AS.css("border-left-width"))+parseFloat(AS.css("border-right-width"))+parseFloat(AS.css("padding-left"))+parseFloat(AS.css("padding-right"));g("#edit-page-dropdown .panel .panel-main-content").width(g("#edit-page-dropdown .panel:visible").width()-g("#edit-page-dropdown .panel .panel-header-text:visible").outerWidth(true)-AT-1);g("#edit-page-dropdown form .form-gutter-right").width(Math.ceil((g("#edit-page-dropdown form:visible").width()-g("#edit-page-dropdown .panel:visible").outerWidth(true))/2));if(k.length){var AQ=k[y.tabs("option","selected")];if(AQ){AQ.tinyscrollbar_update();var AR=g("#edit-content > .tabs > .ui-tabs-panel:not(.ui-tabs-hide)");var AM=AR.find("input:checked").closest(".list-item");if(AM.length>0&&!AR.find(".scrollbar").hasClass("disable")){var AL=AM.offset().left;var AP=AR.find(".scroller");var AU=AP.offset().left+parseInt(AM.css("margin-left"),10);var AN=AL-AU;var AO=AR.find(".overview").width()-AP.width();if(AN>AO){AN=AO}AQ.tinyscrollbar_update(AN)}}}}}function U(AM,AO){var AN=AM.find(".js-admin-widget-list"),AL=false;g.each(AO,function(){AN.append(this.rendered_template);AL=true});if(AL){AN.closest(".js-widget-content").removeClass("h-hide")}AN.closest(".js-widget-content").css({minHeight:"35px"});AN.css({minHeight:"0",height:"auto",paddingBottom:"10px"})}function B(AM,AN){var AL=g(".js-canvas-layout-container > .canvas-layout").attr("id");if(!vBulletin.sitebuilder.tempModuleHTMLCache){vBulletin.sitebuilder.tempModuleHTMLCache={};g(".js-canvas-layout-container .canvas-widget").each(function(){var AO=g(this).data("widget-instance-id");vBulletin.sitebuilder.tempModuleHTMLCache["widgetinstance_"+AO]=this.outerHTML})}g(".js-canvas-layout-container").text("");vBulletin.AJAX({url:vBulletin.getAjaxBaseurl()+"/ajax/get-layouts-for-sitebuilder",data:{pagetemplateid:pageData.pagetemplateid,channelid:pageData.channelid},success:function(AO){console.log("ajax/get-layouts-for-sitebuilder result:");console.dir(AO);var AP=g(".js-canvas-layout-container");AP.html(AO.screenlayoutlist);if(AO.widgets&&AO.widgets.length>0){var AQ=g("#"+AL);g.each(AO.widgets,function(AR,AS){var AT=AQ.find(".canvas-widget-list.section-"+AR);g.each(AS,function(AU,AW){AT.append(AW.rendered_template);if(typeof AW.subModules!="undefined"){var AV=AT.find(".canvas-widget").filter(function(){return g(this).data("widget-instance-id")==AW.widgetinstanceid});U(AV,AW.subModules)}})})}if(vBulletin.inlinemod&&vBulletin.inlinemod.initModMenuHover){vBulletin.inlinemod.initModMenuHover()}if(typeof AN=="function"){AN()}},title_phrase:"sitebuilder",error_phrase:"unable_to_load_layouts"})}function E(){if(!g(this).hasClass("selected")&&!g(document.body).hasClass("edit-mode")){g("#main-navbar .main-nav a").removeClass("selected").closest("li").addClass("h-disabled");g(this).addClass("selected").closest("li").removeClass("h-disabled");g(document.body).addClass("edit-mode "+this.id).removeClass("view-mode");g("#main-navbar ul.secondary-nav").addClass("h-disabled")}return false}function f(AN,AM){var AL=g("<div />").append(AN.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,'<span class="axd-placeholder">{0}'.format(vBulletin.phrase.get("x_will_show_up_here_when_saved",AM))).replace(/<vb\:/g,"&lt;vb:").replace(/<\/vb\:/g,"&lt;/vb:"));AL.find("span.axd-placeholder").not(":first").remove();AL.find("iframe").remove();return AL.html()}function e(){var AO=null;var AM=null;var Ab=null;var Ac="";var AY="";var AW="";var AR="";var Aa=function(Ad){if(!Ad){return false}if(Ad.match(/^https?:\/\//i)){return Ad}if(Ad.substr(0,1)=="/"){return pageData.baseurl+Ad}return pageData.baseurl+"/"+Ad};var AN=function(Aj,Af,Ag,Ai,Ad,Ae){Ad=Ad||[];console.log("createNavbarItem... Name: "+Af+" Url: "+Ag+" NewWindow: "+Ai+" UserGroups: "+Ad+" itemAttr: "+Ae);Af=JShtmlEncode(Af);var Ah=g("<li />").append("<label>{0}</label>".format(Af)).append(g("<div />").addClass("nav-item-controls h-right").append('<i>|</i><span class="navbar-item-delete" title="{0}"></span>'.format(vBulletin.phrase.get("delete"))).append('<i>|</i><span class="navbar-item-edit" title="{0}"></span>'.format(vBulletin.phrase.get("edit"))).append('<i>|</i><span class="navbar-item-opensubnav" title="{0}"></span>'.format(vBulletin.phrase.get("expand")))).data({"item-phrase":Aj,"item-name":Af,"item-url":Ag,"item-newwindow":Ai,"item-usergroups":Ad,"item-attr":Ae});return Ah};var AQ=function(Ad){return Ad.prevAll("li").size()};var AU=function(Af,Ah,Ai){return ;if(Ah=="add"){var Ak=Af.data("item-newwindow")?' target="_blank"':"";g("#channel-tabbar ul").append("<li><a"+Ak+' href="'+Aa(Af.data("item-url"))+'">'+Af.data("item-name")+"</a></li>")}else{if(Ah=="update"){var Ak=Af.data("item-newwindow")?' target="_blank"':"";var Al=AQ(Af);var Ag=g("#channel-tabbar ul li");Ag.eq(Al).replaceWith("<li><a"+Ak+' href="'+Aa(Af.data("item-url"))+'">'+Af.data("item-name")+"</a></li>")}else{if(Ah=="remove"){var Al=AQ(Af);var Ag=g("#channel-tabbar ul li");Ag.eq(Al).remove()}else{if(Ah=="move"){var Ag=g("#channel-tabbar ul li");var Ad=Ag.eq(Ai.from);Ad.remove();if(Ai.to>0){var Aj=(Ai.to>Ai.from)?(Ai.to):(Ai.to-1);var Ae=Ag.eq(Aj);Ad.insertAfter(Ae)}else{Ad.prependTo("#channel-tabbar ul")}}}}}};var AX=function(){console.log("generateNavbarDisplay");var Ad=(AR=="navbar")?g("#channel-tabbar ul"):g("#footer-tabbar ul.nav-list");var Ae=(AR=="navbar")?g("#channel-subtabbar ul"):g();Ad.html("");Ae.html("");g("#edit-navbar .navbar-ui-wrapper ul li").each(function(){var Ag=g(this);var Af=Ag.data("item-newwindow")?' target="_blank"':"";var Ah=Ag.hasClass("selected")&&AR!="footer"?' class="current"':"";Ad.append('<li{0}><a href="{1}"{2}>{3}</a></li>'.format(Ah,Aa(Ag.data("item-url")),Af,Ag.data("item-name")));if(Ag.hasClass("selected")){console.log(Ag.data("subnav-element"));g(Ag.data("subnav-element")).find("li").each(function(){var Aj=g(this);console.log(Aj.data("item-url"));var Ai=Aj.data("item-newwindow")?' target="_blank"':"";var Ak=Aj.hasClass("selected")?' class="current"':"";Ae.append('<li{0}><a href="{1}"{2}>{3}</a></li>'.format(Ak,Aa(Aj.data("item-url")),Ai,Aj.data("item-name")))})}})};var AP=function(Aj,Al,Ae,Af,Ah,Ak,Ag){var Ad=AN(Aj,Al,Ae,Af,Ah,Ag);console.log("insertNavbarItem... Name: "+Ad.data("item-name")+" Url: "+Ad.data("item-url")+" NewWindow: "+Ad.data("item-newwindow")+" UserGroups: "+Ad.data("item-usergroups")+" itemAttr: "+Ad.data("item-attr"));Ad.appendTo(AM);AU(Ad,"add");var Ai=g("<ul />").addClass("sub-navbar-list navbar-list sortable");g(Ak).each(function(){var As=this.phrase?this.phrase:"",An=this.title?this.title:"",Aq=this.url?this.url:"",Ar=this.newWindow?this.newWindow:false,Am=this.usergroups?this.usergroups:[],Ap=this.attr?this.attr:"";var Ao=AN(As,An,Aq,Ar,Am,Ap);Ao.appendTo(Ai)});(function(){var Am=null;Ai.sortable({start:function(An,Ao){Ao.placeholder.html(vBulletin.phrase.get("drop_page_here")).height(Ao.item.height()-2)},stop:function(An,Ao){AX()},receive:function(An,Ao){var Ap=Ao.item.data("subnav-element")||g();if(Ap.is(":visible")){Ao.sender.sortable("cancel");openAlertDialog({title:vBulletin.phrase.get("move_not_allowed"),message:vBulletin.phrase.get("moving_main_nav_to_own_sub_nav_error"),iconType:"warning"})}else{if(Ap.find("li").length>0){Ao.sender.sortable("cancel");openAlertDialog({title:vBulletin.phrase.get("move_not_allowed"),message:vBulletin.phrase.get("moving_main_nav_with_sub_nav_error"),iconType:"warning"})}}},connectWith:".sortable",placeholder:"sortable-highlight",forcePlaceholderSize:true}).disableSelection()})();Ai.hide();Ai.appendTo("#navbar-ui-container .subnavbar-list-container");Ad.data("subnav-element",Ai);AX()};var AT=function(Ae,Ag,Ah,Ai,Ad,Af){$newItem=AN(Ae.data("item-phrase"),Ag,Ah,Ai,Ad,Af);console.log("updateNavbarItem... Name: "+$newItem.data("item-name")+" Url: "+$newItem.data("item-url")+" NewWindow: "+$newItem.data("item-newwindow")+" itemAttr: "+$newItem.data("item-attr"));if(Ae.data("subnav-element")){$newItem.data("subnav-element",Ae.data("subnav-element"))}if(Ae.hasClass("selected")){$newItem.addClass("selected")}Ae.replaceWith($newItem);AX()};var AZ=function(Ad){AR=Ad;if(AR=="navbar"){Ac=g("#channel-tabbar ul").html();AY=g("#channel-subtabbar ul").html();AW=g("#channel-tabbar ul li.current a").attr("href");g("#channel-subtabbar.h-hide").toggleClass("h-hide default-hide")}else{Ac=g("#footer-tabbar ul.nav-list").html();AW=g("#footer-tabbar ul.nav-list li.current a").attr("href")}g("#admin-navbar-strip-gutter").removeClass().addClass("navbar-"+AR);g("#header").add("#header-axd").hide();g("#edit-navbar #navbar-ui-container .navbar-ui-wrapper").remove();g("#edit-navbar #navbar-ui-container .subnavbar-ui-wrapper").remove();g("#edit-navbar .panel-header-text").hide();g("#edit-navbar #panel-header-"+AR).show();g("#edit-navbar").slideDown("slow",function(){window.vBulletin.loadingIndicator.show();g("body").css("cursor","wait");var Ae=(AR=="navbar")?"loadHeaderNavbar":"loadFooterNavbar";g.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/site/"+Ae,data:({siteId:1,edit:1}),type:"POST",dataType:"json",complete:function(){window.vBulletin.loadingIndicator.hide();g("body").css("cursor","auto")},success:function(Af){console.log(Ae+" successful! result:"+JSON.stringify(Af));var Ai=g("<ul />").addClass("main-navbar-list navbar-list sortable "+AR);var Ah=g("<div />").addClass("new-nav-item main-nav").html(vBulletin.phrase.get("new_navigation_item"));var Ag=g("<h4 />").text(vBulletin.phrase.get("main_navigation_bar"));g("<div />").addClass("navbar-ui-wrapper").append(Ag).append(Ai).append(Ah).appendTo("#navbar-ui-container");var Al=null;Ai.sortable({start:function(An,Ao){Ao.placeholder.html(vBulletin.phrase.get("drop_page_here")).height(Ao.item.height()-2)},stop:function(An,Ao){AX()},connectWith:".sortable",placeholder:"sortable-highlight",forcePlaceholderSize:true}).disableSelection();AM=Ai;var Am=g("<div />").addClass("subnavbar-list-container");var Ak=g("<div />").addClass("new-nav-item sub-nav").html(vBulletin.phrase.get("new_subnavigation_item"));var Aj=g("<h4 />").text(vBulletin.phrase.get("sub_navigation_bar"));g("<div />").addClass("subnavbar-ui-wrapper").append(Aj).append(Am).append(Ak).appendTo("#navbar-ui-container").hide();if(Af){console.log("result:",Af);g(Af).each(function(){var At=this.phrase?this.phrase:"",Ao=this.title?this.title:"",Ar=this.url?this.url:"",As=this.newWindow?true:false,An=this.usergroups?this.usergroups:[],Aq=this.subnav?this.subnav:[],Ap=this.attr?this.attr:"";AP(At,Ao,Ar,As,An,Aq,Ap)});console.log("Done adding items")}g("#edit-navbar .navbar-ui-wrapper ul li").first().find(".navbar-item-opensubnav").filter(":visible").click()},error:function(Ah,Ag,Af){console.log(Ae+" failed! error:"+Af);openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_retrieving_navigation_bar_configuration"),iconType:"error",onAfterClose:function(){g("#config-dialog").dialog("close")}});g("#config-dialog .loader").hide()}})})};g(document).on("click","#main-navbar .sb-menu:not(.h-disabled) #lnkNavBar",function(){var Ad=this;if(g("#edit-navbar").is(":hidden")){vBulletin.assertUserHasAdminPermission("canusesitebuilder",Ad,function(){E.apply(Ad);AZ("navbar")})}return false});g(document).on("click","#main-navbar .sb-menu:not(.h-disabled) #lnkFooter",function(){var Ad=this;if(g("#edit-navbar").is(":hidden")){vBulletin.assertUserHasAdminPermission("canusesitebuilder",Ad,function(){E.apply(Ad);AZ("footer")})}return false});var AL=function(Ad){g("#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(){g("#navbar-edit-name").focus()}}).dialog("option","title",Ad||vBulletin.phrase.get("edit_navigation_item")).dialog("open")};g("#edit-navbar").on("click",".new-nav-item",function(){AO=null;if(g(this).closest(".navbar-ui-wrapper").size()>0){AM=g(this).closest(".navbar-ui-wrapper").find("ul")}else{AM=g(this).closest(".subnavbar-ui-wrapper").find("ul").filter(":visible")}g("#navbar-edit-name").val("");g("#navbar-edit-url").val("");g("#navbar-edit-attr").val("");g("#navbar-edit-newwindow").prop("checked",false);AL(g(this).html());return false});g(document).on("click","#navbar-edit-save",function(){if(g("#navbar-edit-name").val()==""){openAlertDialog({title:vBulletin.phrase.get("edit_navigation_item"),message:vBulletin.phrase.get("input_navigation_item_name"),iconType:"warning",onAfterClose:function(){g("#navbar-edit-name").focus()}})}else{if(g("#navbar-edit-url").val()==""){openAlertDialog({title:vBulletin.phrase.get("edit_navigation_item"),message:vBulletin.phrase.get("input_target_url"),iconType:"warning",onAfterClose:function(){g("#navbar-edit-url").focus()}})}else{console.log("Saving new/edited navbar item");if(!AO){AP("",g("#navbar-edit-name").val(),g("#navbar-edit-url").val(),g("#navbar-edit-newwindow").prop("checked"),g("#navbar-edit-item").data("edit-usergroups"),[],g("#navbar-edit-attr").val())}else{AT(AO,g("#navbar-edit-name").val(),g("#navbar-edit-url").val(),g("#navbar-edit-newwindow").prop("checked"),g("#navbar-edit-item").data("edit-usergroups"),g("#navbar-edit-attr").val())}AO=null;AM=null;g("#navbar-edit-item").dialog("close");console.log("Done saving new/edited navbar item")}}return false});g(document).on("click","#navbar-edit-cancel",function(){g("#navbar-edit-item").dialog("close");return false});var AS=false;g(document).on("click","#navbar-edit-usergroups",function(){var Ae=function(){g("#navbar-edit-usergroups-dialog .dialog-body input[type=checkbox]").prop("checked",false);var Ah=g("#navbar-edit-usergroups-dialog .select_all");var Af=function(){if(g("#navbar-edit-usergroups-dialog .navbar-usergroup-checkbox:checked").length==g("#navbar-edit-usergroups-dialog .navbar-usergroup-checkbox").length&&g("#navbar-edit-usergroups-dialog .navbar-usergroup-checkbox").eq(0).is(":checked")){Ah.prop("checked",true)}else{Ah.prop("checked",false)}};g("#navbar-edit-usergroups-dialog .navbar-usergroup-checkbox").off("change").on("change",Af);Ah.off("change").on("change",function(){if(g(this).prop("checked")){g("#navbar-edit-usergroups-dialog .navbar-usergroup-checkbox").prop("checked",true)}else{g("#navbar-edit-usergroups-dialog .navbar-usergroup-checkbox").prop("checked",false)}});if(!AO){return false}console.log("Prefilling checked usergroups");console.log(AO.data("item-name"));console.log(AO.data("item-url"));console.log(AO.data("item-usergroups"));if(AO.data("item-usergroups-temp")){var Ag=AO.data("item-usergroups-temp")}else{var Ag=AO.data("item-usergroups")}console.log(Ag);g.each(Ag,function(Ai,Aj){g("#navbar-edit-usergroups-dialog .dialog-body #navbar-usergroup-checkbox-"+Aj).prop("checked",true)});Af()};var Ad=function(){var Af=[];g("#navbar-edit-usergroups-dialog .dialog-body input[type=checkbox]").each(function(){if(g(this).prop("checked")){Af.push(g(this).val())}});g("#navbar-edit-item").data("edit-usergroups",Af);if(AO){AO.data("item-usergroups-temp",Af)}console.log("Saving checked usergroups")};if(!AS){g("#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(){g("#navbar-edit-usergroups-dialog .cancel-button").on("click",function(){g("#navbar-edit-usergroups-dialog").dialog("close")});g("#navbar-edit-usergroups-dialog .save-button").on("click",function(){Ad();g("#navbar-edit-usergroups-dialog").dialog("close")});g.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/usergroup/fetchUsergroupList",data:({siteId:1}),type:"POST",dataType:"json",complete:function(){g("body").css("cursor","auto")},success:function(Af){console.log("fetchUsergroupList successful! result:"+JSON.stringify(Af));if(Af){console.log("result:",Af);var Ag=[];g(Af).each(function(){Ag.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))});g("#navbar-edit-usergroups-dialog .dialog-body").html(Ag.join(""));g("#navbar-edit-usergroups-dialog").dialog("option","position","center");console.log("Done adding usergroups")}Ae()},error:function(Ah,Ag,Af){console.log("fetchUsergroupList failed! error:"+Af);openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_retrieving_list_user_groups"),iconType:"error",onAfterClose:function(){g("#config-dialog").dialog("close")}});g("#config-dialog .loader").hide()}})},close:function(){},open:function(){Ae()}});AS=true}else{g("#navbar-edit-usergroups-dialog").dialog("open")}return false});g("#edit-navbar").on("click",".navbar-item-delete",function(){AU(g(this).closest("li"),"remove");g(this).closest("li").remove();AX();return false});g("#edit-navbar").on("click",".navbar-item-edit",function(){var Ad=g(this).closest("li");console.log("Click to edit item... Name: "+Ad.data("item-name")+" Url: "+Ad.data("item-url")+" NewWindow: "+Ad.data("item-newwindow")+" UserGroups: "+Ad.data("item-usergroups"));AO=Ad;AM=Ad.closest("ul");AO.data("item-usergroups-temp",null);g("#navbar-edit-name").val(Ad.data("item-name"));g("#navbar-edit-url").val(Ad.data("item-url"));g("#navbar-edit-attr").val(Ad.data("item-attr"));g("#navbar-edit-newwindow").prop("checked",Ad.data("item-newwindow"));AL(g(this).html());return false});g("#edit-navbar").on("click",".navbar-item-opensubnav",function(){var Ad=g(this).closest("li");console.log("Click to open item subnav ... Name: "+Ad.data("item-name")+" Url: "+Ad.data("item-url")+" NewWindow: "+Ad.data("item-newwindow")+" UserGroups: "+Ad.data("item-usergroups"));g("#edit-navbar li").removeClass("h-disabled selected");Ad.addClass("selected");g("#edit-navbar .subnavbar-ui-wrapper ul").hide();g(Ad.data("subnav-element")).show();g("#edit-navbar .subnavbar-ui-wrapper").show();AX();return false});g(document).on("click",".navbar-navbar #admin-navbar-strip .lnkExitWithoutSaving, .navbar-footer #admin-navbar-strip .lnkExitWithoutSaving",function(){g("#edit-navbar").slideUp();g("#header").add("#header-axd").show();if(AR=="navbar"){g("#channel-tabbar ul").html(Ac);g("#channel-subtabbar ul").html(AY).parent(".default-hide").toggleClass("h-hide default-hide")}else{g("#footer-tabbar ul.nav-list").html(Ac)}});var AV=function(){var Ad=[];g("#edit-navbar .navbar-ui-wrapper ul li").each(function(){var Ag=g(this);var Af=[];Ag.data("subnav-element").find("li").each(function(){$subLi=g(this);Af.push({phrase:$subLi.data("item-phrase"),title:$subLi.data("item-name"),url:$subLi.data("item-url"),newWindow:$subLi.data("item-newwindow"),usergroups:$subLi.data("item-usergroups"),attr:$subLi.data("item-attr")})});Ad.push({phrase:Ag.data("item-phrase"),title:Ag.data("item-name"),url:Ag.data("item-url"),newWindow:Ag.data("item-newwindow"),usergroups:Ag.data("item-usergroups"),subnav:Af,attr:Ag.data("item-attr")})});var Ae=(AR=="navbar")?"saveHeaderNavbar":"saveFooterNavbar";g.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/site/"+Ae,data:({siteId:1,data:Ad}),type:"POST",dataType:"json",complete:function(){g("body").css("cursor","auto")},success:function(Ag){if(Ag.errors){console.log(Ae+" failed! error:"+JSON.stringify(Ag));openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_saving_navigation_bar_configuration"),iconType:"error"});return }console.log(Ae+" successful! result:"+JSON.stringify(Ag));g("#edit-navbar").slideUp();g("#header").add("#header-axd").show();g("#main-navbar ul.main-nav li").removeClass("h-disabled").find("a").removeClass("selected");g("#admin-navbar-strip-gutter").addClass("h-hide");g(document.body).removeClass("edit-mode lnkEditPage lnkNewPage lnkHeader lnkNavBar lnkFooter").addClass("view-mode");g("#main-navbar ul.secondary-nav").removeClass("h-disabled");if(AR=="navbar"){var Af=false;g("#edit-navbar .navbar-ui-wrapper ul li").each(function(){var Ah=g(this);if(Aa(Ah.data("item-url"))==AW){Af=true;g("#edit-navbar .navbar-ui-wrapper ul li").removeClass("selected");Ah.addClass("selected");return false}});if(Af){AX()}else{g("#channel-tabbar ul li").removeClass("current");g("#channel-subtabbar ul").html("")}}else{g("#footer-tabbar ul.nav-list li").removeClass("current");g("#footer-tabbar ul.nav-list li").filter(function(){var Ah=g(this).find("a").attr("href");return(Ah==AW)}).addClass("current")}},error:function(Ah,Ag,Af){console.log(Ae+" failed! error:"+Af);openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_saving_navigation_bar_configuration"),iconType:"error",onAfterClose:function(){g("#config-dialog").dialog("close")}});g("#config-dialog .loader").hide()}})};g(document).on("click",".navbar-navbar #admin-navbar-strip .lnkSaveChanges",function(){AV()});g(document).on("click",".navbar-footer #admin-navbar-strip .lnkSaveChanges",function(){AV()})}function x(){bindFormReset("#edit-page-dropdown form").trigger("reset",function(){g("#save-content .template-name").addClass("h-hide");g("input[type=hidden]",this).each(function(){this.value=this.defaultValue})});g("#main-navbar .main-nav li").removeClass("h-disabled");g(document).on("focus click mousedown","#main-navbar li.h-disabled a, #main-navbar ul.secondary-nav.h-disabled li, #main-navbar ul.secondary-nav.h-disabled li a",function(AN){this.blur();AN.stopPropagation();return false});g(document).on("click","#sitebuilder-wrapper .lnkExitWithoutSaving",function(){if(g(this).closest("#edit-page-dropdown").length==0){g("#main-navbar ul.secondary-nav").removeClass("h-disabled")}});var AL=g("#main-navbar li.sb-menu:not(.h-disabled)");g(document).on("click","#main-navbar .sb-menu:not(.h-disabled) #lnkPageManager",function(){var AN=this;vBulletin.assertUserHasAdminPermission("canusesitebuilder",AN,function(){E.apply(AN);AH(false);g(".edit-mode .canvas-widget-list .canvas-widget").addClass("shadow");g("#header, #header-axd, #save-content").hide();g("#manage-page").show();g("#edit-page-dropdown .lnkDeletePage").removeClass("h-hide");g("#manage-page-dropdown").removeClass("h-hide").slideDown("slow",I)});return false});g(document).on("click","#main-navbar .sb-menu:not(.h-disabled) #lnkEditPage",function(){var AN=this;if(g("#edit-page-dropdown-gutter").is(":hidden")){vBulletin.assertUserHasAdminPermission("canusesitebuilder",AN,function(){function AO(){q=false;AP();a();AH(false,".container-widget");g(".edit-mode .canvas-widget-list .canvas-widget").addClass("shadow");y.tabs("select",0);g("#header, #header-axd, #save-content").hide();g("#edit-content").show();g("#edit-page-dropdown .lnkSaveChanges .label").text(vBulletin.phrase.get("save_page"));g("#edit-page-dropdown .lnkDeletePage").removeClass("h-hide");g("#edit-page-dropdown-gutter").removeClass("h-hide").slideDown("slow",T);g(".canvas-widget.axd-widget .widget-content").each(function(){g(this).html(f(g(this).html(),vBulletin.phrase.get("ad")))})}function AP(){var AQ=[];g(".hidden-widget-placeholder").each(function(){AQ.push(g(this).attr("data-widget-instance-id"))});if(AQ.length<1){return }g.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/fetch-hidden-modules",data:({modules:AQ}),type:"POST",dataType:"json",complete:function(){console.log("fetch-hidden-modules complete.");AO()},success:function(AR){console.log("fetch-hidden-modules successful! result:"+JSON.stringify(AR));if(g.isArray(AR)){if(AR.length>0){g.each(AR,function(AS,AU){var AT=g(AU.template).addClass("hidden-widget");g('.hidden-widget-placeholder[data-widget-instance-id="'+AU.widgetinstanceid+'"]').replaceWith(AT)})}}else{openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("invalid_server_response_please_try_again"),iconType:"error"})}},error:function(AT,AS,AR){console.log("fetch-hidden-modules failed! error:"+AR);window.vBulletin.loadingIndicator.hide();openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_retrieving_modules",AT.status),iconType:"error"})}})}E.apply(AN);B(false,AO)})}return false});g(document).on("click","#main-navbar .sb-menu:not(.h-disabled) #lnkNewPage",function(){var AN=this;if(g("#edit-page-dropdown-gutter").is(":hidden")){vBulletin.assertUserHasAdminPermission("canusesitebuilder",AN,function(){function AO(){q=true;g(".canvas-widget-list").empty();y.tabs("select",0);g("#change-layout .layout-border.selected").removeClass("selected");g("#layout-wide-narrow").prev().trigger("click");o=false;g("#header, #header-axd, #save-content").hide();g("#edit-content").show();g("#edit-page-dropdown .lnkSaveChanges .label").text(vBulletin.phrase.get("save_new_page"));g("#edit-page-dropdown .lnkDeletePage").addClass("h-hide");g("#edit-page-dropdown-gutter").removeClass("h-hide").slideDown("slow",T)}E.apply(AN);B(true,AO)})}return false});var AM=false;g(document).on("click","#main-navbar .sb-menu:not(.h-disabled) #lnkHeader",function(){var AN=this;if(g("#admin-navbar-strip-gutter").is(":hidden")){vBulletin.assertUserHasAdminPermission("canusesitebuilder",AN,function(){E.apply(AN);AM=false;g("#admin-navbar-strip-gutter").addClass("navbar-header").removeClass("h-hide").find(".prompt-text").text(vBulletin.phrase.get("select_edit_link_header"));var AO=g("#header"),AP=g(".header-cell",AO);$siteLogoEditStrip=g("> .admin-only",AP).addClass("h-hide-imp"),w=AP.outerWidth();g(".disable-overlay",AO).width(AO.innerWidth()-w).height(AO.innerHeight()).show();$siteLogoEditStrip.width(w-(parseInt($siteLogoEditStrip.css("padding-left"),10)+parseInt($siteLogoEditStrip.css("padding-right"),10))).removeClass("h-hide-imp");g(document).on("focus click mousedown",".edit-mode.lnkHeader #header .site-logo > a",function(AQ){this.blur();AQ.stopPropagation();return false})})}return false});e();g("#main-navbar .main-nav").removeClass("h-hide");g(document).on("click","#admin-navbar-strip .lnkSaveChanges",function(){});g(document).on("click",".lnkHeader #admin-navbar-strip .lnkSaveChanges",function(){g("body").css("cursor","wait");if(Number(g("#header .site-logo img").attr("data-fileid"))>0){var AN=AM?function(){location.reload(true)}:null;H(AN)}else{if(AM){location.reload(true)}else{g("body").css("cursor","auto");g("#main-navbar li").removeClass("h-disabled").find("a").removeClass("selected");g("#admin-navbar-strip-gutter").addClass("h-hide").find(".prompt-text").text("");g(document.body).removeClass("edit-mode lnkHeader").addClass("view-mode");g("#header .disable-overlay").hide();g("#main-navbar ul.secondary-nav").removeClass("h-disabled")}}});g(document).on("click",".lnkHeader #admin-navbar-strip .lnkExitWithoutSaving",function(AO){if(AM){AO.stopImmediatePropagation();location.reload(true);return false}else{var AN=g("#header .site-logo img");if(AN.attr("src")!=AN.attr("data-orig-src")){AN.attr("src",AN.attr("data-orig-src")).removeAttr("data-fileid")}g("#admin-navbar-strip-gutter").find(".prompt-text").text("");g("#header .disable-overlay").hide()}});g(document).on("click","#admin-navbar-strip .lnkExitWithoutSaving",function(){g("#main-navbar li").removeClass("h-disabled").find("a").removeClass("selected");g("#admin-navbar-strip-gutter").addClass("h-hide");g(document.body).removeClass("edit-mode lnkEditPage lnkNewPage lnkHeader lnkNavBar lnkFooter").addClass("view-mode");g("#header").add("#header-axd").show();g("#edit-navbar").hide()});g("#header-axd .axdnum").change(function(){var AN=g(this),AO=parseInt(AN.val());window.vBulletin.loadingIndicator.show();g.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/ad/saveNumberOfHeaderAds",type:"POST",data:{number:AO},dataType:"json",success:function(AP){if(AP!==null&&typeof AP.errors!=="undefined"){openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get(AP.errors[0]),iconType:"error"})}else{if(AO==1){g("#header-axd").removeClass("axdnum_2").addClass("axdnum_1")}else{g("#header-axd").removeClass("axdnum_1").addClass("axdnum_2")}}},complete:function(){window.vBulletin.loadingIndicator.hide()}})});g(document).off("click",".axd-edit-button").on("click",".axd-edit-button",function(){var AN=g(this).attr("data-location"),AS=g(this).closest(".axd-container");if(AS.length==0){AS=g('.axd-container[data-widget-instance-id="'+AN+'"]')}AR();function AR(AT){AT=AT||false;g("body").css("cursor","wait");g.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/ad/listAdsByLocation",type:"POST",data:{adlocation:AN},dataType:"json",cache:false,success:function(AU){if(AU!==null&&typeof AU.errors!=="undefined"){openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get(AU.errors[0]),iconType:"error"})}else{if(AU){AO(AU)}else{if(!AT){AP({adlocation:AN})}else{AO([])}}}},complete:function(){g("body").css("cursor","default")}})}function AO(AT){if(typeof AF.axd_list_dialog=="undefined"){vBulletin.AJAX({url:vBulletin.getAjaxBaseurl()+"/ajax/render/dialog_axd_list",success:function(AU){AF.axd_list_dialog=AU;g("body").append(AU);AO(AT)},error_phrase:"error_fetching_dialog"});return }g("#axd-list-dialog").dialog({title:vBulletin.phrase.get("edit_locationx_ad",AN),autoOpen:true,modal:true,resizable:false,closeOnEscape:false,showCloseButton:false,width:600,dialogClass:"dialog-container ad-list-dialog-container input-dialog",open:function(){var AU=g(this);var AW=[];for(var AV in AT){AW.push([AT[AV].title,AT[AV].active,AT[AV].displayorder,AT[AV].adid])}g(".title",AU).text(vBulletin.phrase.get("ad_list_description",AN));g(".axdtable",AU).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(AY,AX){return'<input type="checkbox" class="isactive" data-id="{0}"{1} />'.format(AY.aData[3],((AX=="1")?' checked="checked"':""))}},{sTitle:vBulletin.phrase.get("display_order")+"<span></span>",sClass:"axdtable-display-order axd-cell",bSearchable:false,bUseRendered:false,fnRender:function(AY,AX){return'<input type="text" class="displayorder textbox" value="{0}" data-id="{1}" />'.format(AY.aData[2],AY.aData[3])}},{sTitle:vBulletin.phrase.get("action"),sClass:"axdtable-action axd-cell",bSearchable:false,bSortable:false,bUseRendered:false,fnRender:function(AY,AX){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(AY.aData[3],vBulletin.phrase.get("edit"),vBulletin.phrase.get("delete"))}}],aaData:AW});g(".dataTables_filter input[type=text]",AU).addClass("axdfilter textbox").on("keyup",function(){g(this).next()[this.value!=""?"removeClass":"addClass"]("h-hide")}).after('<button type="button" class="axdSearchBtn button secondary h-hide">{0}</button>'.format(vBulletin.phrase.get("reset")));g(".axdSearchBtn",AU).on("click",function(){g(this).addClass("h-hide").prev().val("").trigger("keyup")});g(".axdtable .editlink",AU).off("click").on("click",function(){var AX=g(this).attr("data-id");AU.dialog("close");AU.dialog("destroy");AP(AT[AX]);return false});g(".axdtable .deletelink",AU).off("click").on("click",function(){var AX=g(this).attr("data-id"),AY=g(this).closest("tr").find(".isactive").prop("checked");AU.dialog("close");AU.dialog("destroy");openConfirmDialog({title:vBulletin.phrase.get("confirm_deletion_x",AT[AX].title),message:vBulletin.phrase.get("are_you_sure_want_to_delete_ad_x",AT[AX].title,"adid",AX),iconType:"warning",onClickYes:function(){g("body").css("cursor","wait");g.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/ad/delete",type:"POST",data:{adid:AX},dataType:"json",success:function(AZ){if(AZ.errors){openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get(AZ.errors[0]),iconType:"error"})}else{AR(true);if(AY){AM=true}}}})},onClickNo:function(){AR()}});return false});g(".axdlist",AU).show();g(".btnAddAxd",AU).off("click").on("click",function(){AU.dialog("close");AU.dialog("destroy");AP({adlocation:AN});return false});g(".btnCancelAxd",AU).off("click").on("click",function(){AU.dialog("close");AU.dialog("destroy")});g(".btnSaveAxd",AU).off("click").on("click",function(){if(g(".isactive",AU).length==0){AU.dialog("close");AU.dialog("destroy");return false}g("body").css("cursor","wait");var AX={},AY=[];g(".isactive",AU).each(function(){var AZ=g(this).attr("data-id");AX[AZ]={};AX[AZ]["displayorder"]=g('.displayorder[data-id="'+AZ+'"]',AU).val();if(g(this).is(":checked")){AX[AZ]["active"]=1;var Aa=AX[AZ];Aa.snippet=AT[AZ].snippet;Aa.title=AT[AZ].title;AY.push(Aa)}else{AX[AZ]["active"]=0}});g.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/ad/quickSave",type:"POST",data:{data:AX},dataType:"json",success:function(AZ){if(AZ.errors){openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get(AZ.errors[0]),iconType:"error"})}else{var Aa=g(".axd_"+AN,AS);if(Aa.length==0){Aa=g(".widget-content",AS)}if(AY.length>0){AY.sort(function(Ae,Ad){return Ae.displayorder-Ad.displayorder});var Ac="",Ab="";g.map(AY,function(Ae,Ad){if(Ae.snippet){Ab+=f(Ae.snippet,Ae.title);Ac+=Ae.snippet}});Aa.html(Ab);AM=AQ(Ac)}else{Aa.html("")}Aa.show();AU.dialog("close");AU.dialog("destroy");g("html,body").animate({scrollTop:0},"slow")}},complete:function(){g("body").css("cursor","default")}})})}})}function AP(AU){var AT=AU.adlocation;if(typeof AF.axd_config_dialog=="undefined"){vBulletin.AJAX({url:vBulletin.getAjaxBaseurl()+"/ajax/render/dialog_axd_config",success:function(AV){AF.axd_config_dialog=AV;g("body").append(AV);AP(AU)},error_phrase:"error_fetching_dialog"});return }g("#axd-config-dialog").dialog({title:vBulletin.phrase.get("edit_locationx_ad",AT),autoOpen:true,modal:true,resizable:false,closeOnEscape:false,showCloseButton:false,width:720,dialogClass:"dialog-container axd-dialog-container input-dialog",open:function(){var AV=g(this);if(AU.adid){g(".title",AV).val(AU.title);g(".axd_html",AV).val(AU.snippet);if(AU.active=="1"){g(".active",AV).prop("checked",true)}else{g(".active",AV).prop("checked",false)}g(".axdid",AV).val(AU.adid);for(var AW in AU.criterias){g("[name=data\\[criteria\\]\\["+AU.criterias[AW].criteriaid+"\\]\\[active\\]]",AV).prop("checked",true);g("[name=data\\[criteria\\]\\["+AU.criterias[AW].criteriaid+"\\]\\[condition1\\]]",AV).val(AU.criterias[AW].condition1);g("[name=data\\[criteria\\]\\["+AU.criterias[AW].criteriaid+"\\]\\[condition2\\]]",AV).val(AU.criterias[AW].condition2);g("[name=data\\[criteria\\]\\["+AU.criterias[AW].criteriaid+"\\]\\[condition3\\]]",AV).val(AU.criterias[AW].condition3)}}else{g(".axdid",AV).val(0);g(".configform",AV).trigger("reset")}g(".axd_location",AV).val(AT);g(".blockrow select.custom-dropdown",AV).selectBox();g(".blockrow a.custom-dropdown, .blockrow input[type=text]",AV).on("click",function(AY){return false});g(".btnAttachHtmlAxd",AV).off("click").on("click",function(){var AY=g(".configform",AV).serialize();g("body").css("cursor","wait");g.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/ad/save",type:"POST",data:AY,dataType:"json",success:function(AZ){if(AZ){if(AZ.errors){openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get(AZ.errors[0]),iconType:"error"})}else{AX();AM=AQ(g(".configform .axd_html",AV).val())}}},complete:function(){g("body").css("cursor","default")}})});g(".btnCancelEditHtmlAxd",AV).off("click").on("click",function(){AX(true)});function AX(AY){AY=AY||false;g(":checkbox",AV).prop("checked",false);g("select",AV).val("");AV.dialog("close");AV.dialog("destory");AR(AY)}}})}function AQ(AV){var AU=g("<div>"+AV+"</div>");if(AU.filter("script").length>0){return true}else{var AT=AU.find("*").filter(function(){return(this.nodeName.toLowerCase().indexOf("vb:")==0)?this:null});return(AT.length>0||(/\{vb\s*\:\s*[a-z]+\s+.*\}/).test(AV))}}return false});g("#header .header-cell .edit.button").on("click",function(){g(".header-edit-box.selected").removeClass("selected");g(this).closest(".header-edit-box").addClass("selected");g("#edit-site-logo-dialog").dialog({title:vBulletin.phrase.get("edit_site_logo")+'<span class="dialog-subtitle">'+vBulletin.phrase.get("choose_options_site_logo")+"</span>",autoOpen:true,modal:true,resizable:false,closeOnEscape:false,showCloseButton:false,width:520,dialogClass:"dialog-container site-logo-dialog-container input-dialog",create:function(){g("#btnCancelEditSiteLogo").on("click",function(){g("#edit-site-logo-dialog").dialog("close")});g("#btnSaveEditSiteLogo").on("click",function(){if(Number(g("#header .site-logo img").attr("data-fileid"))>0){H(function(){g("#edit-site-logo-dialog").dialog("close")})}else{g("#edit-site-logo-dialog").dialog("close")}});g("#edit-site-logo-dialog .styleselection").change(function(){g("#header .site-logo img").attr({"data-styleselection":g(this).val()})});g("#edit-site-logo-dialog").fileupload({dropZone:null,dataType:"json",add:function(AO,AN){g("body").css("cursor","wait");g(AO.target).find(".upload-progress-bar:first").removeClass("h-hide");AN.submit()},done:function(AO,AN){if(AN.result&&AN.result.filedataid){g("#header .site-logo img").attr({src:AN.result.imageUrl,"data-fileid":AN.result.filedataid,"data-styleselection":g("#edit-site-logo-dialog .styleselection:checked").val()})}else{openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_uploading_logo"),iconType:"error"})}},fail:function(AO,AN){openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_uploading_logo"),iconType:"error"})},always:function(AO,AN){g("body").css("cursor","auto");g(AO.target).find(".upload-progress-bar:first").addClass("h-hide")}});g("#edit-site-logo-dialog #btnAttachLogo").on("click",function(){var AN=g.trim(g("#edit-site-logo-dialog #imageUrl").val());if(AN){g("body").css("cursor","wait");g(this).closest(".dialog-content").find(".upload-progress-bar:last").removeClass("h-hide");g.ajax({url:vBulletin.getAjaxBaseurl()+"/uploader/Url",data:({urlupload:AN}),type:"POST",dataType:"json",complete:function(){console.log("uploader/url complete.");g("body").css("cursor","auto");g("#edit-site-logo-dialog .upload-progress-bar:last").addClass("h-hide")},success:function(AO){console.log("saving site logo successful! result:"+AO);if(AO&&!AO.error){g("#header .site-logo img").attr({src:AO.imageUrl,"data-fileid":AO.filedataid,"data-styleselection":g("#edit-site-logo-dialog .styleselection:checked").val()})}else{if(AO.error){openAlertDialog({title:vBulletin.phrase.get("edit_site_logo"),message:vBulletin.phrase.get("invalid_image_url"),iconType:"warning",onAfterClose:function(){g("#edit-site-logo-dialog #imageUrl").select().focus()}})}else{openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_processing_site_logo"),iconType:"error",onAfterClose:function(){g("#edit-site-logo-dialog #imageUrl").focus()}})}}},error:function(AQ,AP,AO){console.log("remote url site logo failed! error:"+AO);openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_processing_site_logo_image_hosting",AQ.status),iconType:"error",onAfterClose:function(){g("#edit-site-logo-dialog #imageUrl").focus()}})}})}else{g("#edit-site-logo-dialog #imageUrl").focus()}})}})});g(".admin-button-flat").disableSelection();y=g("#edit-content .tabs").tabs({show:function(AN,AO){Q(AO.index);O()},select:function(AO,AP){g("#save-content").hide();if(AP.index==1){if(d){g("#edit-page-dropdown .layout-list .layout-border.selected").removeClass("selected");var AN=g("#edit-page-dropdown .layout-list input[type=radio][value={0}]".format(g(".canvas-layout:visible").attr("data-layout-id")));AN.prev().addClass("selected");z="canvas-"+AN.attr("id")}}}});g("#lnkAddModules").on("click",function(){y.tabs("select",0);return false});AD();g(document).on("click",".module-buttons .hide-icon input",function(){var AO=g(this);AO.closest(".canvas-widget")[this.checked?"addClass":"removeClass"]("hidden-widget");var AN=AO.attr("title");AO.attr("title",AO.data("toggle-title")).data("toggle-title",AN)});g(".canvas-layout-container .canvas-layout").each(function(){v[this.id]=g("#"+this.id+' div[class*="section-"]').length});if(!q){z="canvas-"+g("#edit-page-dropdown .layout-list input[type=radio][value={0}]".format(g(".canvas-layout:visible").attr("data-layout-id"))).prop("checked",true).attr("id")}n=g("#edit-page-dropdown .layout-list input[type=radio]").thumbnailRadioCheckbox({thumbnailClass:"layout-border"});n.thumbnailRadioCheckbox("option","select",function(AO,AN){g(".canvas-layout").addClass("h-hide");g("#canvas-"+AN.attr("id")).removeClass("h-hide");i("canvas-"+AN.attr("id"));b();AJ();o=true})}function i(AO){if(!z){g(".canvas-layout.h-hide input[type=hidden]").prop("disabled",true);g("#"+AO+" input[type=hidden]").prop("disabled",false);z=AO;return }else{if(z==AO){return }else{g(".canvas-layout.h-hide input[type=hidden]").prop("disabled",true);g("#"+AO+" input[type=hidden]").prop("disabled",false);var AM=v[AO];var AL=false;var AN=0;g("#"+z+" > .canvas-layout-row > .canvas-widget-list").each(function(){var AT=g(this);AL=C(AT,g("#"+AO+" > .canvas-layout-row > .canvas-widget-list"));if(!AL.length){AN=Z(this);AL=g("#"+AO+" > .canvas-layout-row > div.section-"+AN)}if(!AL.length){var AP=AM;while(AP>=0&&g("#"+AO+" > .canvas-layout-row > div.section-"+AP).length==0){AP--}AL=g("#"+AO+" > .canvas-layout-row > div.section-"+AP)}var AR=AT.children(".canvas-widget");var AU=parseInt(Math.ceil(AR.length/AL.length),10);console.log("Moving {0} widgets to {1} sections; ChunkSize {2}".format(AR.length,AL.length,AU));if(AU>0){var AS=0,AQ=0;AR.each(function(){g(this).appendTo(AL.eq(AQ));++AS;if(AS>=AU){AS=0;++AQ}})}})}}z=AO}function C(AL,AN){var AP=["js-sectiontype-notice","js-sectiontype-primary","js-sectiontype-secondary","js-sectiontype-extra"],AM,AO;for(AM in AP){if(AL.is("."+AP[AM])){AO=AP[AM];break}}return AN.filter(function(){return g(this).is("."+AO)})}function Z(AN){var AM=/section-(\d+)/gi;var AL=null;g(g(AN).attr("class").split(" ")).each(function(AP,AQ){var AO=AM.exec(AQ);if(AO&&!isNaN(AO[1])){AL=AO[1]}});return AL}function D(AL){if(!g.isArray(AL)||AL.length==0){return }window.vBulletin.loadingIndicator.show();g("body").css("cursor","wait");g.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/admin-template/widget",data:({widgets:AL,pagetemplateid:g("#save-page-form #pagetemplateid-yes").val()}),type:"POST",dataType:"json",complete:function(){console.log("admin-template/widget complete. moduleLoaded="+c);if(c){window.vBulletin.loadingIndicator.hide()}g("body").css("cursor","auto")},success:function(AM){console.log("admin-template/widget successful! result:");console.dir(AM);V=true;if(AM&&g.isArray(AM.widgets)){g.each(AM.widgets,function(AN,AP){if(!AP.widgetid||Number(AP.widgetid)<1||!g.trim(AP.template)){return true}var AQ=(AP.displaysection&&Number(AP.displaysection)>0)?AP.displaysection:0;var AO=g(AP.template);AO.appendTo(g(".canvas-layout:not(.h-hide) .canvas-widget-list.section-"+AQ).height("auto")).filter(":not(.container-widget)").find(".toggle-button").trigger("click",[true]);AO.find(".tabs").tabs()})}else{openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("invalid_server_response_please_try_again"),iconType:"error"})}},error:function(AO,AN,AM){console.log("admin-template/widget failed! error:"+AM);openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_adding_widgets",AO.status),iconType:"error"})}});return false}function AA(AL,AM){if(AL.text()=="<"){AL.text(">");AL.closest(".channel-item-container").children(".sub-channel-container").children(".channel-item-container").slideDown(150)}else{if(typeof (AM)==="undefined"||!AM){AL.text("<");AL.closest(".channel-item-container").children(".sub-channel-container").children(".channel-item-container").slideUp(150)}}}function W(){g(".channel-config-dialog .channel-list").sortable({placeholder:"main-channel-container-highlight drag-highlight h-clear",update:function(AL,AM){AM.item.css("z-index","0");G.forum=true;Y=true},sort:function(AL,AM){},start:function(AL,AM){if(g.browser.msie&&parseInt(g.browser.version,10)==8){AM.item.height(AM.item.height()-4)}AM.item.css("z-index","99999");AM.placeholder.height(AM.item.outerHeight())},over:function(AL,AM){},receive:function(AL,AM){},out:function(AL,AM){},handle:".grip-icon-main",items:".main-channel-container"})}function u(AL){AI=AL.find(".main-channel-container").sortable({connectWith:".sub-channel-container",placeholder:"channel-item-highlight drag-highlight",revert:true,update:function(AM,AN){var AO=AN.item.closest(".main-channel-container");if(AN.sender&&AN.sender.hasClass("main-channel-container")){if(g("> .channel-item-container",AN.sender).length==0){AN.sender.slideUp("fast",function(){g(this).remove()})}}G.forum=true;Y=true},sort:function(AM,AN){},activate:function(AM,AN){},start:function(AM,AN){},stop:function(AM,AN){g(".main-channel-container, .sub-channel-container").height("auto")},over:function(AM,AN){},receive:function(AM,AN){},out:function(AM,AN){},handle:".channel-item-inner > .grip-icon-item",items:".channel-item-container"})}function F(AL){m=AL.find(".sub-channel-container").sortable({connectWith:".sub-channel-container",revert:true,placeholder:"channel-item-highlight drag-highlight",update:function(AM,AN){if(AN.sender&&AN.sender.hasClass("main-channel-container")){if(g("> .channel-item-container",AN.sender).length==0){AN.sender.slideUp("fast",function(){g(this).remove()})}}G.forum=true;Y=true},sort:function(AM,AN){},start:function(AM,AN){},stop:function(AM,AN){g(".main-channel-container, .sub-channel-container").height("auto")},over:function(AN,AO){var AM=g(this).closest(".channel-item-container").children(".channel-item").find(".toggle-button");AA(AM,true)},receive:function(AM,AN){},out:function(AM,AN){},handle:".channel-item-inner > .grip-icon-item",items:".channel-item-container"})}function AK(AL,AO,AP,AQ,AT,AV,AS){var AR='<div class="'+(AT?"category-to-channel":"channel-to-category")+'"><a href="#">'+vBulletin.phrase.get((AT?"make_forum":"make_category"))+"</a></div>";var AU=g(('<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">'+AS+'</div>							<div class="add-subchannel-button h-right" title="'+vBulletin.phrase.get("add_subforum")+'"><a href="#">+</a></div>							'+AR+'							<div class="h-clear"></div>						</div>					</div>					<div class="sub-channel-container"></div>				</div>		 </div>').format(AO,AQ,AP)).appendTo(AL);if(AV){var AM=g("#top-level-forum .channel-config-dialog .channel-list");var AN=AM.find(".main-channel-container").last();g("html, body").animate({scrollTop:AN.offset().top},"fast")}G.forum=true;Y=true;return AU}function AG(AN,AO,AP,AS,AM,AR){var AQ='<div class="'+(AS?"category-to-channel":"channel-to-category")+'"><a href="#">'+vBulletin.phrase.get((AS?"make_forum":"make_category"))+"</a></div>";var AT=AM.hasClass("main-channel-container")?g("> .channel-item-container > .sub-channel-container",AM):g("> .sub-channel-container",AM);var AL=g(('<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">'+AR+'</div>						<div class="add-subchannel-button h-right" title="'+vBulletin.phrase.get("add_subforum")+'"><a href="#">+</a></div>						'+AQ+'						<div class="h-clear"></div>					</div>			 </div>			 <div class="sub-channel-container"></div>			</div>').format(AN,AP,AO)).hide().appendTo(AT);G.forum=true;Y=true;return AL}function t(){window.vBulletin.loadingIndicator.show();g("body").css("cursor","wait");g.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/fetch-widget-admin-template-list",type:"POST",dataType:"json",complete:function(){console.log("fetch-widget-admin-template-list complete. templatesLoaded="+R);if(R){window.vBulletin.loadingIndicator.hide()}g("body").css("cursor","auto");O();g(window).resize(O)},success:function(AN){console.log("fetch-widget-admin-template-list successful! result:");console.dir({result:AN});c=true;if(g.isArray(AN)){if(AN.length>0){var AO={},AS=0,AP=[];AO.customized_copy={count:0,title:vBulletin.phrase.get("my_custom_modules")};g.each(AN,function(AU,AV){if(!AV.widgetid||Number(AV.widgetid)<1){return true}AS++;if(!AO[AV.category]){AO[AV.category]={count:1,title:AV.category_title}}else{AO[AV.category].count++}var AT=g("#edit-page-dropdown .module-list .module-icon-template").clone();AT.attr("data-widget-id",AV.widgetid).attr("data-title",g.trim(AV.title).toLowerCase()).data("canbemultiple",AV.canbemultiple).removeClass("module-icon-template").addClass(("module-item list-item category-{0}"+(AV.cloneable=="1"?" module-cloneable":"")).format(AV.category));g(".module-icon",AT).html(g("<img />").attr("src",pageData.baseurl+"/admincp/img/"+g.trim(AV.icon)).attr("height",60).attr("width",60).attr("alt",vBulletin.phrase.get("module_icon")));g(".module-title .main-title",AT).html(g.trim(AV.title));AT.appendTo("#edit-page-dropdown .module-list").removeClass("h-hide");if(AV.category=="customized_copy"){AP.push(AV.widgetid)}});if(AO.customized_copy.count<1){delete AO.customized_copy}g(".canvas-layout-container .canvas-widget").filter(function(){var AT=g(this).attr("data-widget-id");return(g.inArray(AT,AP)!=-1)}).find(".module-buttons .edit-button").hide();g('<div class="custom-module-manage-links">							<a href="#" class="edit">'+vBulletin.phrase.get("edit")+'</a> 							<a href="#" class="rename">'+vBulletin.phrase.get("rename")+'</a> 							<a href="#" class="delete">'+vBulletin.phrase.get("delete")+"</a>						</div>").appendTo("#add-modules .module-list .category-customized_copy");g("#add-modules").on("click",".custom-module-manage-links a",function(AW){AW.preventDefault();var AY=g(this).attr("class");var AV=g(this).closest(".canvas-widget");if(AY=="edit"){AV.find(".module-buttons .admin-only .edit-button").click()}else{if(AY=="rename"){AV.draggable("disable");var AU=g(this);AU.hide();var AX=g(".main-title",AV);var AT=AX.text();AX.html('<input type="text" class="titleinput textbox" autocomplete="off" style="-moz-user-select:text;width:100%;" value="'+AT+'"> <a href="#" class="save">'+vBulletin.phrase.get("save")+'</a> <a href="#" class="cancel">'+vBulletin.phrase.get("cancel")+"</a>");g("a.save",AX).on("click",function(AZ){AZ.preventDefault();if(g(".titleinput",AX).val()==""){openAlertDialog({title:vBulletin.phrase.get("rename_custom_module"),message:vBulletin.phrase.get("please_enter_new_module_title"),iconType:"warning",onAfterClose:function(){g(".titleinput",AX).focus()}})}g("body").css("cursor","wait");g.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/widget/renameWidget",type:"POST",data:{widgetId:AV.attr("data-widget-id"),newtitle:g(".titleinput",AX).val()},dataType:"json",success:function(Aa){g("body").css("cursor","auto");if(Aa===true){AT=g(".titleinput",AX).val();AX.text(AT);AU.show()}else{openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("invalid_server_response_please_try_again"),iconType:"error",onAfterClose:function(){g("#config-dialog .action-buttons button").prop("disabled",false)}})}},error:function(Ac,Ab,Aa){g("body").css("cursor","auto");openAlertDialog({title:vBulletin.phrase.get("rename_custom_module"),message:vBulletin.phrase.get("error_renaming_module_title"),iconType:"error",onAfterClose:function(){g(".titleinput",AX).focus()}})},complete:function(Ab,Aa){AV.draggable("enable")}})});g("a.cancel",AX).on("click",function(AZ){AZ.preventDefault();AX.text(AT);AU.show();AV.draggable("enable")})}else{if(AY=="delete"){alert("Deleting is not yet implemented")}}}});g('<div id="create-custom-module" class="non-module-item canvas-widget module-item list-item category-customized_copy h-hide">							<div class="widget-header">								<div class="module-icon"><a href="#" title="'+vBulletin.phrase.get("create_new_custom_module")+'"><img width="60" height="60" alt="Create New Custom Module" src="'+pageData.baseurl+'/admincp/img/module-icon-create-new.png"></a></div>								<div class="module-title h-left"><a href="#" title="'+vBulletin.phrase.get("create_new_custom_module")+'">'+vBulletin.phrase.get("create_new_custom_module")+'</a></div>								<div class="h-clear"></div>							</div>						</div>').prependTo("#edit-page-dropdown .module-list");g("#create-custom-module a").on("click",function(){g("#create-new-module-dialog").dialog({title:vBulletin.phrase.get("choose_base_module"),autoOpen:true,modal:true,resizable:false,closeOnEscape:true,showCloseButton:true,width:950,dialogClass:"dialog-container pagemap-dialog-container input-dialog",create:function(){g("#create-new-module-dialog .cancel-button").on("click",function(){g("#create-new-module-dialog").dialog("close")});$modulelist=g(".module-list-container").clone();g("#create-new-module-dialog .dialog-body").append($modulelist);g("#create-new-module-dialog #create-custom-module").remove();g("#create-new-module-dialog .module-item").not(".module-cloneable").remove();g("#create-new-module-dialog .categories .category").each(function(){var AT=g(this).attr("id").substr("category-".length);var AU=g("#create-new-module-dialog .module-item").filter(".category-"+AT).size();if(AT=="all"){g(this).text("All ({0})".format(g("#create-new-module-dialog .module-item").size()))}else{if(AU<1){g(this).hide()}else{g(this).text((AO[AT].title+" ({0})").format(AU))}}});g("#create-new-module-dialog .module-list").css("width","800px");g("#create-new-module-dialog .module-item").css("cursor","pointer");g("#create-new-module-dialog .module-item").on("click",function(){window.vBulletin.loadingIndicator.show();var AT=g(this).attr("data-widget-id");g.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/widget/cloneWidget",data:({widgetId:AT}),type:"POST",dataType:"json",complete:function(){console.log("/ajax/api/widget/cloneWidget complete");g("body").css("cursor","auto")},success:function(AU){if(AU&&typeof AU.widget=="object"){console.log("/ajax/api/widget/cloneWidget successful");console.log(AU);g.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/fetch-widget-admin-template-list",data:({widgetids:[AU.widget.widgetid]}),type:"POST",dataType:"json",success:function(AV){if(g.isArray(AV)&&AV.length==1){var AX=AV[0];console.log("/ajax/fetch-widget-admin-template-list successful");console.log(AX);++AO[AX.category].count;var AW=g("#edit-page-dropdown .module-list .module-icon-template").clone();AW.attr("data-widget-id",AX.widgetid).attr("data-title",g.trim(AX.title).toLowerCase()).data("canbemultiple",AX.canbemultiple).removeClass("module-icon-template").addClass(("module-item list-item category-{0}"+(AX.cloneable=="1"?" module-cloneable":"")).format(AX.category));g(".module-icon",AW).html(g("<img />").attr("src",pageData.baseurl+"/admincp/img/"+g.trim(AX.icon)).attr("height",60).attr("width",60).attr("alt",vBulletin.phrase.get("module_icon")));g(".module-title .main-title",AW).html(g.trim(AX.title));AW.insertAfter("#add-modules #create-custom-module").removeClass("h-hide");AW.draggable({connectToSortable:".canvas-layout-row > .canvas-widget-list:visible",helper:"clone",revert:"invalid",appendTo:"#add-modules .module-list-container",zIndex:2000,start:function(AZ,Aa){if(g(this).data("canbemultiple")=="0"&&g("#content .canvas-layout .canvas-widget[data-widget-id={0}]".format(g(this).attr("data-widget-id"))).length>0){openAlertDialog({title:vBulletin.phrase.get("move_not_allowed"),message:vBulletin.phrase.get("adding_multiple_modules_not_allowed",g(".main-title",this).html()),iconType:"warning"});return false}X=true},stop:function(AZ,Aa){X=false}}).disableSelection();var AY=g("#add-modules .module-item").filter(".category-customized_copy").not(".non-module-item").size();g("#add-modules #category-customized_copy").text((AO.customized_copy.title+" ({0})").format(AY));g("#add-modules #category-all").click();g("#add-modules #category-customized_copy").click();g('<div class="custom-module-manage-links">																	<a href="#" class="edit">'+vBulletin.phrase.get("edit")+'</a> 																	<a href="#" class="rename">'+vBulletin.phrase.get("rename")+'</a> 																	<a href="#" class="delete">'+vBulletin.phrase.get("delete")+"</a>																</div>").appendTo(AW);window.vBulletin.loadingIndicator.hide();AW.css("background-color","#2E3741");AW.effect("highlight",{color:"#FFFF00"},2000,function(){g(this).css("background-color","transparent")})}else{console.log("/ajax/fetch-widget-admin-template-list successful, but response was not an array");console.log(AV);openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("invalid_server_response_please_try_again"),iconType:"error"})}},error:function(AX,AW,AV){console.log("/ajax/fetch-widget-admin-template-list failed, error: "+AV);openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_retrieving_cloned_widget_template",AX.status),iconType:"error"})}});g("#create-new-module-dialog").dialog("close")}else{console.log("/ajax/api/widget/cloneWidget successful, but response was not an array");console.log(AU);openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("invalid_server_response_please_try_again"),iconType:"error"})}},error:function(AW,AV,AU){console.log("/ajax/api/widget/cloneWidget failed, error: "+AU);openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_cloning_widget",AW.status),iconType:"error"})}})})},close:function(){g("#create-new-module-dialog .dialog-body").html("");g("#create-new-module-dialog").dialog("destroy")},open:function(){var AT=function(){var AU=g("#create-new-module-dialog .list-item");var AV=Math.max(AU.outerWidth(true)*AU.filter(":visible").length,parseFloat(AU.parent().css("min-width"),10));AU.parent().width(AV)};AT();k[3]=g("#create-new-module-dialog .module-list-container");k[3].tinyscrollbar({sizethumb:14,axis:"x",update:function(){}});k[3].tinyscrollbar_update();g("#create-new-module-dialog .categories .category").on("click",function(AW){AW.stopPropagation();var AU=g(this).closest(".module-list-container");var AX=g(".module-item",AU);g(".category.selected",AU).removeClass("selected");g(this).addClass("selected");AX.hide();g(".empty-module",AU).hide();var AV=this.id;if(AV=="category-all"){AX.show();g(".non-module-item",AU).hide();AT();k[3].tinyscrollbar_update()}else{if(AV=="category-result"){g("#search-module-keyword").triggerHandler("keyup",[true])}else{g(".module-item.{0}".format(AV),AU).show();AT();k[3].tinyscrollbar_update()}}return false}).disableSelection();g("#create-new-module-dialog #category-all").click()}});return false});g(('<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(AS)).insertBefore("#edit-page-dropdown .module-list-container .scroller");var AM=0;g.each(AO,function(AU,AV){var AT=g('<div id="category-{0}" class="category">{1} ({2})</div>'.format(AU,AV.title,AV.count)).insertBefore("#category-result");AM+=AT.outerWidth(true)});var AR=AM+g("#category-all").outerWidth(true);g(".categories").width(AR);if(g(".categories").width()<=g(".scroller.category").width()){g(".category-arrow-left, .category-arrow-right").css("visibility","hidden")}else{g(".category-arrow-right").css("visibility","visible")}Q(0);k[0]=g("#add-modules .module-list-container");k[0].tinyscrollbar({sizethumb:14,axis:"x",update:function(){if(g("#add-modules .module-list-container").innerHeight()<g("#add-modules .panel-header-text").height()){g("#add-modules .panel-header-text").height(g("#add-modules .module-list-container").innerHeight())}}});g("#edit-page-dropdown .module-list .module-item").not(".non-module-item").draggable({connectToSortable:".canvas-layout-row > .canvas-widget-list:visible",helper:"clone",revert:"invalid",appendTo:"#add-modules .module-list-container",zIndex:2000,start:function(AT,AU){if(g(this).data("canbemultiple")=="0"&&g("#content .canvas-layout .canvas-widget[data-widget-id={0}]".format(g(this).attr("data-widget-id"))).length>0){openAlertDialog({title:vBulletin.phrase.get("move_not_allowed"),message:vBulletin.phrase.get("adding_multiple_modules_not_allowed",g(".main-title",this).html()),iconType:"warning"});return false}X=true},stop:function(AT,AU){X=false}}).disableSelection();var AL=false;g("#search-module-keyword").on("keyup",function(AT,Ab){var Aa=g("#add-modules");var AX=g("#category-result");var AU=g(".categories",Aa);var AV=g(".scroller.category",Aa);var AW=false;g(".module-item",Aa).hide();if(!Ab){g(".category.selected",Aa).removeClass("selected")}var AZ=g.trim(this.value.toLowerCase());if(AZ){g('.module-item[data-title*="{0}"]'.format(AZ),Aa).show();AX.removeClass("h-hide").addClass("selected")}else{g(".module-item",Aa).show();g("#category-all").removeClass("h-hide").addClass("selected");AX.addClass("h-hide").removeClass("selected");AW=true}var Ac=g(".module-item:visible",Aa).length;g("span",AX).text(Ac);Q(0);k[0].tinyscrollbar_update();if(Ac==0){g(".empty-module",Aa).show()}else{g(".empty-module",Aa).hide()}if(AW){AU.width(AR)}else{AU.width(AR+AX.outerWidth(true))}if(AU.width()<=AV.width()){g(".category-arrow-left, .category-arrow-right",Aa).css("visibility","hidden");AV.scrollLeft(0)}else{if(AW){g(".category-arrow-left",Aa).css("visibility","hidden");g(".category-arrow-right",Aa).css("visibility","visible");AV.scrollLeft(0)}else{g(".category-arrow-left",Aa).css("visibility","visible");g(".category-arrow-right",Aa).css("visibility","hidden");var AY=AV.get(0);AV.scrollLeft(AY.scrollWidth-AY.clientWidth)}}return true});g("#add-modules .categories .category").on("click",function(AV){AV.stopPropagation();if(g(this).hasClass("selected")){return false}var AT=g(this).closest(".module-list-container");var AW=g(".module-item",AT);g(".category.selected",AT).removeClass("selected");g(this).addClass("selected");AW.hide();g(".empty-module",AT).hide();var AU=this.id;if(AU=="category-all"){AW.show();g(".non-module-item",AT).hide();Q(0);k[0].tinyscrollbar_update()}else{if(AU=="category-result"){g("#search-module-keyword").triggerHandler("keyup",[true])}else{g(".module-item.{0}".format(AU),AT).show();Q(0);k[0].tinyscrollbar_update()}}return false}).disableSelection();var AQ;g(".category-arrow-left").on({mousedown:function(){g(".category-arrow-right").css("visibility","visible");AQ=setInterval(function(){var AT=g(".scroller.category");AT.scrollLeft(AT.scrollLeft()-20);if(AT.scrollLeft()==0){g(".category-arrow-left").css("visibility","hidden");clearInterval(AQ)}},50)},mouseup:function(){clearInterval(AQ)}}).disableSelection();g(".category-arrow-right").on({mousedown:function(){g(".category-arrow-left").css("visibility","visible");AQ=setInterval(function(){var AU=g(".scroller.category");AU.scrollLeft(AU.scrollLeft()+20);var AT=AU.get(0);if(AU.scrollLeft()==AT.scrollWidth-AT.clientWidth){g(".category-arrow-right").css("visibility","hidden");clearInterval(AQ)}},50)},mouseup:function(){clearInterval(AQ)}}).disableSelection()}else{g('<div class="empty-module">'+vBulletin.phrase.get("no_modules")+"</div>").appendTo("#edit-page-dropdown .module-list")}}else{openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("invalid_server_response_please_try_again"),iconType:"error"})}},error:function(AN,AM,AL){console.log("fetch-widget-admin-template-list failed! error:"+AL);window.vBulletin.loadingIndicator.hide();openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_retrieving_modules",AN.status),iconType:"error"})}})}function A(){window.vBulletin.loadingIndicator.show();g("body").css("cursor","wait");g("#edit-page-dropdown .template-list").empty();g.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/pagetemplate/fetchPageTemplateList",dataType:"json",data:{pagetemplateid:g("#save-page-form #pagetemplateid-yes").val()},type:"POST",complete:function(){console.log("fetchPageTemplateList complete.");if(c){window.vBulletin.loadingIndicator.hide()}g("body").css("cursor","auto")},success:function(AM){console.log("fetchPageTemplateList successful! result:");console.dir({templates:AM});R=true;if(g.isArray(AM)&&AM.length>0){var AL=false;g.each(AM,function(AN,AO){g('<div class="template-item list-item h-left">								<input type="radio" id="pagetemplateid-{0}" name="pagetemplateid" value="{0}" data-thumbnail="{1}/{2}/img/template-icon-default.png"{3} />								<label class="label">{4}</label>							</div>'.format(AO.pagetemplateid,pageData.baseurl,"admincp",(!q&&g("#save-page-form #pagetemplateid-yes").val()==AO.pagetemplateid)?' checked="checked"':"",AO.title)).appendTo("#edit-page-dropdown .template-list").data({screenlayoutid:AO.screenlayoutid,widgetinstances:AO.widgetinstances});if(g("#save-page-form #pagetemplateid-yes").val()==AO.pagetemplateid){AL=true;if(AO.title==""){window.console.warn("The page template for this page does not have a title.")}}});if(!q&&!AL){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(g("#save-page-form #pagetemplateid-yes").val()))}g(".template-item",g("#edit-page-dropdown .template-list")).each(function(AN){g(this).attr("data-title",g(".label",g(this)).text().toLowerCase())});g("#search-template-keyword").on("keyup",function(AR){if(AR.keyCode==13){AR.preventDefault();return false}var AO=g("#select-template");var AS=g(".scroller",AO);var AQ=false;g(".template-item",AO).hide();var AN=g.trim(this.value.toLowerCase());if(AN){g('.template-item[data-title*="{0}"]'.format(AN),AO).show()}else{g(".template-item",AO).show();AQ=true}var AP=g(".template-item:visible",AO).length;Q(2);k[2].tinyscrollbar_update();if(AP==0){g(".empty-template",AO).show()}else{g(".empty-template",AO).hide()}return true});g("#search-template-keyword").on("keydown",function(AN){if(AN.keyCode==13){AN.preventDefault();return false}});l=g("#edit-page-dropdown .template-list .template-item input[type=radio]").thumbnailRadioCheckbox({thumbnailClass:"template-border",preselect:function(AO,AN){if(AN.is(":checked")){return false}if(o||Y){openConfirmDialog({title:vBulletin.phrase.get("switch_template"),message:vBulletin.phrase.get("template_changes_will_be_lost"),iconType:"warning",onClickYes:function(){o=false;Y=false;d=true;l.thumbnailRadioCheckbox("check",AN,true)}});return false}d=true;return true},select:function(AR,AN){g(".canvas-layout").addClass("h-hide");var AP=AN.closest(".template-item").data("screenlayoutid");g(".canvas-layout[data-layout-id="+AP+"]").removeClass("h-hide");b();AJ();g("#save-page-form #pagetemplateid-yes, #config_pagetemplateid").val(AN.val());g("#save-page-form .page-template-name").html(vBulletin.phrase.get("page_template_name_id",AN.closest(".template-item").find(".label").html(),AN.val()));if(d){g(".canvas-widget-list").empty();var AO=AN.closest(".template-item").data("widgetinstances");if(g.isArray(AO)&&AO.length>0){V=false;var AQ=[];g.each(AO,function(AS,AT){AQ.push({widgetid:AT.widgetid,widgetinstanceid:AT.widgetinstanceid})});D(AQ,true);a()}else{window.vBulletin.loadingIndicator.hide()}}g("body").removeClass("lnkNewPage").addClass("lnkEditPage");g("#save-page-form .new-page-template input").prop("disabled",true);g("#save-page-form .edit-page-template input").prop("disabled",false);d=true},unselect:function(){}});Q(2);k[2]=g("#select-template .template-list-container");k[2].tinyscrollbar({sizethumb:14,axis:"x",update:function(){if(g("#select-template .template-list-container").innerHeight()<g("#select-template .panel-header-text").height()){g("#select-template .panel-header-text").height(g("#select-template .template-list-container").innerHeight())}}})}else{window.vBulletin.loadingIndicator.hide();openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_retrieving_templates"),iconType:"error"})}},error:function(AN,AM,AL){console.log("fetchPageTemplateList failed! error:"+AL);window.vBulletin.loadingIndicator.hide();openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_retrieving_modules",AN.status),iconType:"error"})}})}function H(AL,AN,AM){g.ajax({url:vBulletin.getAjaxBaseurl()+"/uploader/set_logo",data:({filedataid:g("#header .site-logo img").attr("data-fileid"),styleselection:g("#header .site-logo img").attr("data-styleselection")}),type:"POST",dataType:"text",complete:function(){console.log("uploader/set_logo complete.");g("body").css("cursor","auto")},success:function(AO){console.log("saving site logo successful! result:"+AO);if(g.trim(AO)==="true"){g("#header .site-logo img").removeAttr("data-styleselection").removeAttr("data-fileid").attr("data-orig-src",g("#header .site-logo img").attr("src"));g("#main-navbar li").removeClass("h-disabled").find("a").removeClass("selected");g("#admin-navbar-strip-gutter").addClass("h-hide").find(".prompt-text").text("");g(document.body).removeClass("edit-mode lnkHeader").addClass("view-mode");g("#header .disable-overlay").hide();g("#main-navbar ul.secondary-nav").removeClass("h-disabled");if(typeof AL=="function"){AL()}}else{console.log("saving site logo failed!");openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_saving_site_logo"),iconType:"error"});if(typeof AN=="function"){AN()}}},error:function(AQ,AP,AO){console.log("saving site logo failed! error:"+AO);openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_saving_site_logo_code",AQ.status),iconType:"error"});if(typeof AM=="function"){AM()}}})}function L(AL,AM){g.each(AL,function(AO,AN){var AP=g(('<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(AN.nodeid,pageData.baseurl,AN.url,AN.title,(AN.lastPostTitle?AN.lastPostTitle:"<em>"+vBulletin.phrase.get("none")+"</em>"),pageData.baseurl_core,AN.parentid)).appendTo(AM);L(AL[AO].subchannels,AP.eq(0))})}function j(AM,AL){g.each(AM,function(AN,AP){var AO=g.map(AP.subchannels,function(AS,AR){return AR}).length;var AQ=AG(AP.nodeid,AP.parentid,AP.title,AP.category,AL,AO);j(AP.subchannels,AQ)})}function M(){y.tabs("select",0);var AR=g("#add-modules").height();y.tabs("select",1);var AL=g("#change-layout").height();y.tabs("select",2);var AM=g("#select-template").height();g("#edit-page-dropdown .lnkSaveChanges").trigger("click");var AO=g("#save-page-form").height();y.tabs("select",0);var AQ=Math.max(AR,AL,AM,AO);var AN=g("#edit-page-dropdown .panel-header-text");AN.each(function(){var AS=g(this);AS.css("min-height",AQ-parseFloat(AS.css("margin-top"))-parseFloat(AS.css("margin-bottom"))-parseFloat(AS.css("padding-top"))-parseFloat(AS.css("padding-bottom")))});var AP=g("#edit-page-dropdown .panel-main-content");AP.each(function(){var AS=g(this);AS.css("min-height",AQ-parseFloat(AS.css("margin-top"))-parseFloat(AS.css("margin-bottom"))-parseFloat(AS.css("padding-top"))-parseFloat(AS.css("padding-bottom")))})}function Q(AL){var AM=g("#edit-page-dropdown #edit-content > .tabs > .tab:eq({0}) .list > .list-item".format(AL));AM.parent().width(Math.max(AM.outerWidth(true)*AM.filter(":visible").length),parseFloat(AM.parent().css("min-width")))}function AH(AL,AM){var AN=(AM&&AM.length>0)?g(".canvas-layout .canvas-widget").not(AM).find(".widget-content"):g(".canvas-layout .canvas-widget .widget-content");if(AL){AN.each(function(){if(g(this).is(":hidden")){g(this).closest(".canvas-widget").find(".widget-header .toggle-button").trigger("click",[true])}})}else{AN.each(function(){if(!g(this).is(":hidden")){g(this).closest(".canvas-widget").find(".widget-header .toggle-button").trigger("click",[true])}})}}function P(AM,AL){if(AL){if(AM.find(".widget-content").is(":hidden")){AM.find(".toggle-button").trigger("click",[true])}}else{if(!AM.find(".widget-content").is(":hidden")){AM.find(".toggle-button").trigger("click",[true])}}}function a(){if(!q){var AL=g(".canvas-layout:visible .canvas-widget.subchannel-widget");if(AL.length==1){AL.find(".close-button").hide()}else{AL.find(".close-button").show()}}}function J(AN,AL){var AM=AN.attr("data-widget-id");if(N[AM]==null){window.vBulletin.loadingIndicator.show();g("body").css("cursor","wait");g.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/fetch-widget-template",data:({widgetid:AM}),type:"POST",dataType:"json",complete:function(){window.vBulletin.loadingIndicator.hide();g("body").css("cursor","auto")},success:function(AO){console.log("Fetching module admin template successful");var AQ=g.trim(AO);if(AQ){var AP=g(AQ.replace(/\<\s*script[^\>]*\>(.*?)\<\s*\/\s*script\>/g,""));AP.attr("data-title",function(){var AR=g(".module-title",AP).clone();AR.find(".hide-on-viewmode").children().unwrap();AR.find("*:hidden").remove();return g.trim(AR.text()).toLowerCase()});N[AM]=AP;if(typeof AL=="function"){AL(AP.clone(true))}}},error:function(AQ,AP,AO){console.log("Fetching module admin template failed, error: "+AO);openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_retrieving_cloned_widget_template",AQ.status),iconType:"error"})}})}else{if(typeof AL=="function"){AL(N[AM].clone(true))}}}function K(AL,AM){g(".edit-mode .canvas-widget.youtube-widget .widget-content").css("visibility",AL);if(AM){AM.find(".widget-content").css("visibility",(AL=="hidden"?"visible":"hidden"))}}function AD(){g(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=g(this).closest(".canvas-widget");var AM=g("> .widget-header .module-title",AQ);(function(){var AR=AQ.data("widget-instance-id");if(vBulletin.sitebuilder.tempModuleHTMLCache["widgetinstance_"+AR]){if(g("#sb-temp-module-cache").length==0){g('<div id="sb-temp-module-cache" class="h-hide"></div>').appendTo("body")}var AS=g(vBulletin.sitebuilder.tempModuleHTMLCache["widgetinstance_"+AR]);if(AS.find(".widget-tabs").length>0||AS.is(".widget-tabs")){g("#sb-temp-module-cache").append(AS);delete vBulletin.sitebuilder.tempModuleHTMLCache["widgetinstance_"+AR]}}var AT=g("#sb-temp-module-cache .canvas-widget").filter(function(){return g(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 }g("body").css("cursor","wait");var AO=AQ.attr("data-widget-id");var AN;if(g("span.admin-only",AM).length>0){AN=g("span.admin-only",AM).text()}else{AN=g(".hide-on-viewmode",AM).length>0?g(".hide-on-viewmode",AM).text():AM.text()}var AP=AQ.data("widget-type")||"";g("#config-dialog .loader").show();g("#config-dialog .widget-name h1").html(AN);g("#config-dialog .dialog-content .widget-config-container").hide().empty().removeClass("error notice");g("#config-dialog").data("selected-module",AQ);K("hidden");g("#config-dialog").dialog("open");g.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/widget/fetchConfigSchema",data:({widgetid:AO,widgetinstanceid:AQ.attr("data-widget-instance-id")||"",pagetemplateid:g("#config_pagetemplateid").val()||g("#select-template input[type=radio]:checked").val()||"",configtype:"admin"}),type:"POST",dataType:"json",complete:function(){g("body").css("cursor","auto")},success:function(Ah){console.log("fetchConfigSchema successful! result:"+JSON.stringify(Ah));if(Ah){g("#config_widgetid").val(Ah.widgetid);g("#config_widgetinstanceid").val(Ah.widgetinstanceid);g("#config_pagetemplateid, #save-page-form #pagetemplateid-yes, #save-page-form #pagetemplateid-new").val(Ah.pagetemplateid);AQ.attr("data-widget-instance-id",Ah.widgetinstanceid);if(!Ah.configs||Ah.configs.length==0){g("#config-dialog .widget-config-container").html(vBulletin.phrase.get("no_configurations_found")).addClass("notice");g("#btnSaveConfig").prop("disabled",true);g("#btnCloseConfig").focus()}else{var Ac=0;var AZ=g("#config-dialog .dialog-content .widget-config-container");g('<input type="hidden" name="data[widget_type]" />').addClass("widget-type").val(AP).appendTo(AZ);var Ag=false,Af=false,AV=false,Ae=false,AW,Ad=false,AR=(g("#debug-information").length==1);g.each(Ah.configs,function(Ao,Ak){var Aj;switch(Ak.type){case"ChannelSetup":g("#config-dialog .dialog-content .channel-config-dialog").css("display","block");return true;break;case"Text":Aj=g('<input type="text" name="data[{0}]" id="data[{0}]" tabindex="1" />'.format(Ak.name)).addClass("textbox config-textbox").val(Ak.defaultvalue||"");break;case"LongText":Aj=g('<textarea name="data[{0}]" id="data[{0}]" rows="3" tabindex="1" />'.format(Ak.name)).addClass("textbox config-textbox").val(Ak.defaultvalue||"");break;case"YesNo":var An={option_1:g('<input type="radio" value="1" name="data[{0}]" id="data[{0}_1]" tabindex="1" />'.format(Ak.name)),label_1:g("<label />").attr({"for":"data["+Ak.name+"_1]"}).text(vBulletin.phrase.get("yes")),option_0:g('<input type="radio" value="0" name="data[{0}]" id="data[{0}_0]" tabindex="1" />'.format(Ak.name)),label_0:g("<label />").attr({"for":"data["+Ak.name+"_0]"}).text(vBulletin.phrase.get("no"))};var As=An["option_"+Ak.defaultvalue];if(As){As.prop("checked",true)}Aj=g("<div />").append(An.option_1,An.label_1,An.option_0,An.label_0);break;case"Checkboxes":Aj=g("<div />");g.each(Ak.data,function(At,Av){var Au="";if(Ak.defaultvalue&&typeof Ak.defaultvalue[At]!="undefined"&&Ak.defaultvalue[At]==1){Au=' checked="checked"'}var Aw=g('<div><label><input type="checkbox" name="data[{0}][{1}]"{2} value="1" tabindex="1" class="js-checkbox-always-send" /> {3}</label></div>'.format(Ak.name,At,Au,Av));Aj.append(Aw)});break;case"Select":Ad=true;Aj=g('<select name="data[{0}]" tabindex="1" />'.format(Ak.name));var Am;if(Ak.data!=""){for(Am in Ak.data){if(Ak.defaultvalue==Am){g("<option />").attr("value",Am).attr("selected","selected").text(Ak.data[Am]).appendTo(Aj)}else{g("<option />").attr("value",Am).text(Ak.data[Am]).appendTo(Aj)}}}break;case"ChannelSelect":Ad=true;Aj=g('<select name="data[{0}]" tabindex="1" />'.format(Ak.name));var Aq=g('<optgroup label="{0}" />'.format(vBulletin.phrase.get("special_options"))),Al=g('<optgroup label="{0}" />'.format(vBulletin.phrase.get("channels"))),Ap=false,Ar=false;if(Ak.data){g.each(Ak.data,function(At,Au){var Av=null;if(Ak.defaultvalue==Au.nodeid){Av=g("<option />").attr("value",Au.nodeid).attr("selected","selected").html(Au.text)}else{Av=g("<option />").attr("value",Au.nodeid).html(Au.text)}if(Au.nodeid<1){Av.appendTo(Aq);Ap=true}else{Av.appendTo(Al);Ar=true}});if(Ap){Aq.appendTo(Aj)}if(Ar){Al.appendTo(Aj)}}break;case"ProfileFieldSelect":Ad=true;Aj=g('<select name="data[{0}]" tabindex="1" />'.format(Ak.name));if(Ak.data){g.each(Ak.data,function(At,Av){var Au=null;if(Ak.defaultvalue==Av.field){Au=g("<option />").attr("value",Av.field).attr("selected","selected").html(Av.title)}else{Au=g("<option />").attr("value",Av.field).html(Av.title)}Au.appendTo(Aj)})}break}$requiredMark=g("<div />").addClass("config-required-mark h-left").append(function(){return(Ak.isRequired==1)?"*":"&nbsp;"});if(Ak.isEditable==0){Aj.find("input").prop("disabled",false);Aj.prop("disabled",false)}var Ai=g("<div />").addClass("config-label h-left").addClass(Ak.name).html(Ak.label);if(AR){Ai.prop("title",Ak.name)}AZ.append(g("<div></div>").addClass(function(){return"h-clearfix config-row"+(((++Ac)%2!=0)?" odd":"")}).append(Ai,$requiredMark,g("<div></div>").addClass("config-value h-left").addClass(Ak.name).append(Aj)));if(Ak.name=="default_tab"){Ag=true}if(Ak.name=="display_tabs"){Af=true}if(Ak.name=="tab_order"){AV=true}if(Ak.name=="axd"){Ae=true}});var AS=null;var Ab=function(){AW=AL(AQ);var Al=AQ.attr("data-widget-default-tab"),Aj=g('select[name="data[default_tab]"]',AZ),Ak;Aj.empty();for(var Ai in AW){if(Af){if(!g('input:checkbox[value="'+AW[Ai].selector+'"]',AX).is(":checked")){continue}}else{if(!AW[Ai].displayed){continue}}Ak=g('<option value="'+AW[Ai].selector+'">'+AW[Ai].label+"</option>");if(AS&&AS==AW[Ai].selector){Ak.attr("selected","selected")}else{if(Al==AW[Ai].selector){Ak.attr("selected","selected")}}Aj.append(Ak)}};var AY=function(){AW=AL(AQ);var Aj=g(".config-value.tab_order",AZ),Ak,Al;Aj.empty().append("<ul>");for(var Ai in AW){if(Af){if(!g('input:checkbox[value="'+AW[Ai].selector+'"]',AX).is(":checked")){continue}}else{if(!AW[Ai].displayed){continue}}Ak=g('<li id="'+AW[Ai].selector+'">'+AW[Ai].label+"</li>");g("ul",Aj).append(Ak);Al=g('<input name="data[tab_order]['+AW[Ai].selector.substring(1)+']" value="'+Ai+'" type="hidden">');Aj.append(Al)}g("ul",Aj).sortable({stop:function(){var Am=g(this).sortable("toArray");Aj.find("input:hidden").remove();for(Ai in Am){Al=g('<input name="data[tab_order]['+Am[Ai].substring(1)+']" value="'+Ai+'" type="hidden">');Aj.append(Al)}}});g("ul",Aj).disableSelection()};if(Af){AW=AL(AQ);var AX=g(".config-value.display_tabs",AZ),Aa;for(var AU in AW){Aa=g('<label><input type="checkbox" name="data[display_tabs][]" value="'+AW[AU].selector+'" tabindex="1">'+AW[AU].label+"</label>");if(AW[AU].displayed){Aa.find("input:checkbox").attr("checked","checked")}AX.append(Aa)}if(Ag){g("input:checkbox",AX).on("click",function(){Ab();AY()})}}if(AV){AY();g('select[name="data[default_tab]"]',AZ).change(function(){AS=g(this).val()})}if(Ag){Ab()}if(Ae){var AT=g(".config-value.axd",AZ);AT.append('<button class="axd-edit-button button secondary" data-location="'+Ah.widgetinstanceid+'" tabindex="1">'+vBulletin.phrase.get("edit")+"</button>")}}}g("#config-dialog .dialog-content .widget-config-container").show();g("#config-dialog .loader").hide();if(Ad){g("#config-dialog .dialog-content .widget-config-container select").selectBox()}(function(){function Ai(){var Aj=g(this),Ak=Aj.next(".js-checkbox-always-send-hidden");if(Ak.length==0&&!Aj.prop("checked")){g('<input type="hidden" name="{0}" class="js-checkbox-always-send-hidden" value="0" />'.format(Aj.prop("name"))).insertAfter(Aj)}else{Ak.remove()}}g(".js-checkbox-always-send").off("click").on("click",Ai);g(".js-checkbox-always-send").each(Ai)})();g("#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 g(this).is(":visible")}).first().focus()},error:function(AT,AS,AR){console.log("fetchConfigSchema failed! error:"+AR);openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_retrieving_configuration",AN),iconType:"error",onAfterClose:function(){g("#config-dialog").dialog("close")}});g("#config-dialog .loader").hide()}});return false});function AL(AN){var AM=[];g("ul.widget-tabs-nav li a, .widget-header ul.ui-tabs-nav li a, .widget-tabs-nav ul.ui-tabs-nav li a",AN).each(function(){var AO=g(this),AP;if(g(this).closest("li").hasClass("h-hide")){AP=false}else{AP=true}AM.push({selector:AO.attr("href"),label:AO.text(),displayed:AP})});return AM}}function b(){g(".edit-mode .canvas-layout:visible > .canvas-widget-list").width("").each(function(){g(this).width(g(this).width())})}function AJ(){if(g.browser.msie&&parseInt(g.browser.version,10)==8){var AL=g(".edit-mode .canvas-layout:visible > .canvas-widget-list");AL.each(function(){var AM=g(".canvas-widget",this),AS=g(this);var AN=AM.outerHeight(true)||50;var AO=AM.length*AM.outerHeight(true);var AR=AS.height()-AO;console.log("offset:",AR);if(AR>=0&&AR<AN){var AQ=g(window);var AP=AQ.scrollTop();AS.height(AS.height()+(AN-AR));AQ.scrollTop(AP);return false}else{if((AR>AN&&AS.height()>parseInt(AS.css("min-height"),10))||AR<0){var AQ=g(window);var AP=AQ.scrollTop();AS.height(AO+AN);AQ.scrollTop(AP);return false}}})}}function h(){window.console.log("Fetching page manager forums (initializeForumEditor)");vBulletin.AJAX({url:vBulletin.getAjaxBaseurl()+"/ajax/api/widget/fetchPageManagerForums",complete:function(){g("#config-dialog .loader").hide();g("body").css("cursor","auto")},success:function(AL){window.console.log("Successfully fetched page manager forums (initializeForumEditor)");s=true;var AN=g("<div>").addClass("channel-list");g.each(AL,function(AP,AR){var AQ=g.map(AR.subchannels,function(AT,AS){return AS}).length;var AO=AK(AN,AR.nodeid,AR.parentid,AR.title,AR.category,false,AQ);j(AR.subchannels,AO)});var AM=g("#top-level-forum .channel-config-dialog");AM.find(".channel-list").remove();u(AN);F(AN);AM.append(AN);g(document).on("mousedown",".main-channel-container > .channel-item-container > .channel-item .grip-icon",function(){g(this).closest(".main-channel-container").height(g(this).closest(".main-channel-container").height())});g(document).on("mousedown",".sub-channel-container > .channel-item-container > .channel-item .grip-icon",function(){g(this).closest(".sub-channel-container").height(g(this).closest(".sub-channel-container").height())});Y=false;W()},error_phrase:"error_fetching_channels"});g(document).on("click keydown",".channel-config-dialog .add-channel-fieldset .add-button, .channel-config-dialog .add-channel-fieldset input",function(AL){if(((AL.type=="click"||AL.which!=13)&&this.type=="text")||(AL.type=="keydown"&&this.type=="button"&&AL.which!=13)){return true}var AO=(this.type=="text")?g(this):g(this).prev();var AM=g.trim(AO.val());if(AM&&AM!=AO.prop("defaultValue")){var AN=g("#top-level-forum .channel-config-dialog .channel-list");AK(AN,"","",vBulletin.htmlEntities(AM),0,true,0);u(AN);W();AO.val("");if(this.type=="button"){AO.focus()}}else{openAlertDialog({title:vBulletin.phrase.get("warning_gcpuser"),message:vBulletin.phrase.get("please_enter_channel_title"),iconType:"warning",onAfterClose:function(){AO.focus()}})}});g(document).on("click",".channel-config-dialog .main-channel-container .channel-item .channel-title div",function(){g(this).hide();var AL=g(this).next();AL.show();AL.select();AL.focus()});g(document).on("keydown blur",".channel-config-dialog .main-channel-container .channel-item .channel-title input",function(AL){if(AL.type=="focusout"||(AL.type=="keydown"&&AL.which==13)){if(!g.trim(this.value)&&AL.type=="focusout"){this.value=this.defaultValue}if(g.trim(this.value)){g(this).hide();g(this).prev().html(vBulletin.htmlEntities(this.value));g(this).prev().show()}}});g(document).on("click",".channel-config-dialog .channel-item .category-to-channel a",function(){var AL=g(this).closest(".channel-item");AL.attr("data-switch-category",0);g(this).parent().removeClass("category-to-channel").addClass("channel-to-category");g(this).html(vBulletin.phrase.get("make_category"));return false});g(document).on("click",".channel-config-dialog .channel-item .channel-to-category a",function(){var AL=g(this).closest(".channel-item");AL.attr("data-switch-category",1);g(this).parent().removeClass("channel-to-category").addClass("category-to-channel");g(this).html(vBulletin.phrase.get("make_forum"));return false});g(document).on("click",".channel-config-dialog .channel-item .toggle-button",function(){AA(g(this));return false});g(document).on("click",".channel-config-dialog .channel-item .add-subchannel-button a",function(){var AL=g(this).parent().siblings(".toggle-button");AA(AL,true);var AN=g(this).closest(".channel-item-container");var AM=AG("","",vBulletin.phrase.get("new_channel"),0,AN,0);F(AN);AM.slideDown(100,function(){var AO=AN.find(".channel-item-inner").first().find(".num-subchannels");AO.text(parseInt(AO.text())+1);g(".channel-title div",AM).click();g(".channel-title input",AM).get(0).scrollIntoView(false);W()});return false});g(document).on("click",".channel-config-dialog .channel-list .channel-item .close-button",function(){var AL=g(this);var AM=g("> .sub-channel-container > .channel-item-container",AL.closest(".channel-item-container")).length>0;openConfirmDialog({title:vBulletin.phrase.get("remove_forum_q"),message:vBulletin.phrase.get("do_you_want_to_remove_forum",g(this).prev().text(),(AM)?" "+vBulletin.phrase.get("subchannels_will_be_deleted"):""),iconType:"warning",onClickYes:function(){var AR=AL.closest(".channel-item-container");var AP=AR.parent();var AO=AL.closest(".channel-item").attr("data-channel-id");g("body").css("cursor","wait");var AN=function(){AR.remove();if(AP.hasClass("main-channel-container")){AP.slideUp("fast",function(){g(this).remove()})}};var AQ=function(){g("body").css("cursor","auto")};if(AO){g.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/content_channel/delete",data:{nodeid:AO},type:"POST",dataType:"json",complete:AQ,success:function(AS){console.log("Delete channel successful! result:"+JSON.stringify(AS));if(AS.errors){openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get(AS.errors[0]),iconType:"error"})}else{AN()}},error:function(AU,AT,AS){console.log("Delete channel failed! result:"+AS);openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_deleting_page",AU.status),iconType:"error"})}})}else{AN();AQ()}}})})}function r(AM){function AL(AO,AP,AN){vBulletin.AJAX({url:vBulletin.getAjaxBaseurl()+("/ajax/render/{0}_list").format(AO),data:{page:AP},complete:function(){g("#config-dialog .loader").hide();g("body").css("cursor","auto")},success:function(AQ){g(("#top-level-{0} .channel-config-dialog").format(AO)).html(AQ);if(AN){vBulletin.pagination({context:("#top-level-{0} .channel-config-dialog").format(AO),onPageChanged:function(AR,AS){AL(AO,AR)}})}},error_phrase:"error_fetching_channels"})}AL(AM,1,true);g(document).on("click",".page_manager_table .channel_name div",function(){g(this).hide();var AN=g(this).next();AN.show();AN.select();AN.focus()});g(document).on("keydown blur",".page_manager_table .channel_name input",function(AP){if(AP.type=="focusout"||(AP.type=="keydown"&&AP.which==13)){if(!g.trim(this.value)&&AP.type=="focusout"){this.value=this.defaultValue}var AO=g.trim(this.value);var AN=g(this);if(AO&&AN.prev().html()!=AO){g("body").css("cursor","wait");vBulletin.AJAX({url:vBulletin.getAjaxBaseurl()+"/ajax/api/Content_Channel/update",data:{nodeid:AN.parents(".channel_row").data("nodeid"),data:{title:AO}},complete:function(){g("#config-dialog .loader").hide();g("body").css("cursor","auto")},success:function(AQ){AN.hide();AN.prev().html(AO);AN.prev().show()},error_phrase:"error_saving_page"})}}});g(document).on("click",".page_manager_table .delete",function(){var AN=g(this);openConfirmDialog({title:vBulletin.phrase.get("remove_channel_q"),message:vBulletin.phrase.get("do_you_want_to_remove_channel",AN.parents(".channel_row").find(".channel_name_val").text()),iconType:"warning",onClickYes:function(){g("body").css("cursor","wait");vBulletin.AJAX({url:vBulletin.getAjaxBaseurl()+"/ajax/api/content_channel/delete",data:{nodeid:AN.parents(".channel_row").data("nodeid")},complete:function(){g("body").css("cursor","auto")},success:function(AO){AN.parents(".channel_row").remove()}})}})})}var s=false;function I(){g("body").css("cursor","wait");AC=g("#manage-page .tabs").tabs({show:function(AL,AM){if(AM.index==0&&!s){h()}if(AM.index!=0&&Y){openConfirmDialog({title:vBulletin.phrase.get("exit_without_saving_page"),message:vBulletin.phrase.get("forum_changes_will_be_lost"),iconType:"warning",onClickYes:function(){Y=false}});return false}},select:function(AL,AM){}});AC.tabs("select",0);AE=g("#manage-pages").tabs({show:function(AL,AM){if((AM.index==1||AM.index==2)){r(g(AM.tab).data("top-level"))}}});AE.tabs("select",0);g("#manage-page-dropdown .lnkSaveChanges").on("click",function(){console.log("Saving forum/channel data");var AL=g(this);if(AL.hasClass("h-disabled")){console.log("We're busy saving already. Try again later.");return }AL.addClass("h-disabled");vBulletin.loadingIndicator.show();g("body").css("cursor","wait");var AM=[];function AN(AQ,AO,AP){var AR=g("> .channel-item-container",AQ);if(AR.length>0){AR.each(function(AT){var AS=g("> .channel-item",this);var AU=AS.attr("data-channel-id");var AV=AS.attr("data-parent-id");subchannelObj={nodeid:AU||"0",previousParentId:AV,title:g(".channel-title div",AS).html(),displayorder:AT+1,parentid:AP||"0",subchannels:[]};if(AS.attr("data-switch-category")!=null){subchannelObj.switchCategory=AS.attr("data-switch-category")}AO.subchannels.push(subchannelObj);AN(AS.next(".sub-channel-container"),AO.subchannels[AT],AU)})}}if(G.forum){g(".channel-config-dialog .channel-list .main-channel-container").each(function(AQ){var AP=g("> .channel-item-container > .channel-item",this);var AR=AP.attr("data-channel-id");var AS=AP.attr("data-parent-id");var AO={nodeid:AR,previousParentId:AS,title:g(".channel-title div",AP).html(),displayorder:AQ+1,subchannels:[]};if(AP.attr("data-switch-category")!=null){AO.switchCategory=AP.attr("data-switch-category")}AN(AP.next(".sub-channel-container"),AO,AR);AM.push(AO)});vBulletin.AJAX({url:vBulletin.getAjaxBaseurl()+"/ajax/api/widget/saveForums",data:{data:JSON.stringify(AM)},complete:function(){g("body").css("cursor","auto");vBulletin.loadingIndicator.hide();AL.removeClass("h-disabled")},success:function(AO){console.log("Forum/channel changes successfully saved");if(AO&&AO.forums&&AO.forums.length>0){Y=false;G.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();g("body").css("cursor","auto");AL.removeClass("h-disabled")}});g(document).on("click","#manage-page-dropdown .lnkExitWithoutSaving",function(){if(Y){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 T(){g(document).on("focus click",".edit-mode .widget-content a, .edit-mode #channel-tabbar a, .edit-mode #btnSearch, .edit-mode #q",function(AS){this.blur();return false});if(!c){t()}if(!R){A()}else{l.thumbnailRadioCheckbox("check",g("#select-template .template-border.selected").next("input"),false);if(!q){g("#select-template .template-item input[value={0}]".format(g("#pagetemplateid-yes").val())).prev().trigger("click")}}k[1]=g("#change-layout .layout-list-container");k[1].tinyscrollbar({sizethumb:14,axis:"x",update:function(){if(g("#change-layout .layout-list-container").innerHeight()<g("#change-layout .panel-header-text").height()){g("#change-layout .panel-header-text").height(g("#change-layout .layout-list-container").innerHeight())}}});g("#config_pagetemplateid").val("");if(q){g("#save-page-form #pagetitle").val("");g("#save-page-form #pageurl").val("");g("#save-page-form #pagetemplateid").val("0");g("#save-page-form #pageid").val("0")}g("#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({url:vBulletin.getAjaxBaseurl()+"/ajax/api/page/delete",data:{pageid:pageData.pageid},dataType:"json",complete:function(){g("body").css("cursor","auto")},success:function(AS){console.log("deleted page "+pageData.pageid);window.location.href=pageData.baseurl},error:function(AU,AT,AS){console.log("page delete  failed! result:"+AS);openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_deleting_page",AU.status),iconType:"error"})}})}})});g("#edit-page-dropdown .lnkSaveChanges").on("click",function(){g("#edit-page-dropdown .tabs li").removeClass("ui-tabs-selected ui-state-active");g("#edit-page-dropdown .tabs .tab").addClass("ui-tabs-hide");g("#save-content").show();g("#save-page-form .edit-page-template").css("display","");g("#save-page-form .edit-page-template").prev("label").css("display","");if(g("body").hasClass("lnkNewPage")){g("#save-page-form .new-page-template input").prop("disabled",false);g("#save-page-form .edit-page-template input").prop("disabled",true)}else{if(!g("#pagetemplateid-yes").prop("checked")&&!g("#pagetemplateid-no").prop("checked")){g("#pagetemplateid-yes").prop("checked",true)}g("#save-page-form .edit-page-template input").prop("disabled",false);g("#save-page-form .new-page-template input").prop("disabled",true);if(q&&(!o&&!Y)){g("#save-page-form .edit-page-template").css("display","none");g("#save-page-form .edit-page-template").prev("label").css("display","none")}if(g("#pagetemplateid-yes").prop("checked")){g("#save-page-form #templatetitle").prop("disabled",false);g("#save-page-form #templatetitle-edit").prop("disabled",true);g("#save-page-form .page-template-name").removeClass("h-hide")}else{g("#save-page-form #templatetitle").prop("disabled",true);g("#save-page-form #templatetitle-edit").prop("disabled",false);g("#save-page-form .page-template-name").addClass("h-hide")}}});g(document).on("click","#edit-page-dropdown .lnkExitWithoutSaving",function(){if(o||Y||d||(!q&&(g("#pagetitle").val()!=g("#pagetitle").prop("defaultValue")||g("#pageurl").val()!=g("#pageurl").prop("defaultValue")))||(q&&(g("#pagetitle").val()!=""||g("#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(){location.reload(true)}})}else{location.reload(true)}});var AL=0;g(window).on("resize.canvas",function(){clearTimeout(AL);AL=setTimeout(b,200)});var AO=function(AS){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"),AS?' checked="checked"':"")};g(".canvas-widget.container-widget .canvas-widget:not(.dummy-widget)").each(function(){var AS=g(this).hasClass("hidden-widget");g(".module-buttons .admin-only",this).prepend(AO(AS));if(AS){g(".module-buttons .admin-only .hide-icon input",this).trigger("click").prop("checked",true)}});var AR=function(AU,AV,AX){var AW=AV.item,AX=AV.item.hasClass("module-item");var AS=g("> .canvas-widget.container-widget {0}".format(AX?".module-item":".canvas-widget.container-widget"),this);if(AS.length>0){var AT=AS.closest(".canvas-widget.container-widget");if(AT.attr("data-widget-id")==AS.attr("data-widget-id")){if(AX){AS.remove()}else{if(AV.sender){AV.sender.sortable("cancel")}else{g(this).sortable("cancel")}}AP=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 AN=function(AS){if(AS.parents(".canvas-widget.container-widget").length>0){if(g(".module-buttons .admin-only .hide-icon",AS).length==0){g(".module-buttons .admin-only",AS).prepend(AO())}}else{AS.removeClass("hidden-widget").find("> .widget-header .module-buttons .admin-only .hide-icon").remove()}};var AP=false;g(".edit-mode .canvas-layout .canvas-widget-list").sortable({revert:true,tolerance:"pointer",connectWith:".edit-mode .canvas-layout:visible .canvas-widget-list",placeholder:"canvas-widget canvas-widget-highlight drag-highlight h-clear",create:function(){b();AJ()},update:function(AS,AT){var AU=this;if(S){if(!AP){J(AT.item,function(AV){AT.item.replaceWith(AV);AV.filter(":not(.container-widget)").find(".toggle-button").trigger("click",[true]);if(!AR.apply(AU,[AS,AT])){AN(AV);AV.addClass("shadow").find(".widget-tabs").andSelf().filter(".widget-tabs").tabs();a();AV.parents(".canvas-widget.container-widget").find(".canvas-widget.dummy-widget").remove();var AW=AV.parents(".canvas-widget.container-widget");if(AW.length==1){AW.find(".canvas-widget-highlight").remove();AW.find(".module-item").remove()}}})}}else{if(!AR.apply(AU,[AS,AT])){AN(AT.item);a()}}o=true},out:function(AS,AT){},sort:function(AS,AT){if(X){S=true}var AU=AT.placeholder.closest(".canvas-widget.container-widget");if(AU.length==1&&AU.find(".canvas-widget:last-child").hasClass("canvas-widget-highlight")){AT.placeholder.css({"margin-bottom":0,"margin-top":-3})}else{AT.placeholder.css({"margin-bottom":"","margin-top":""})}},start:function(AS,AT){K("hidden",AT.item)},over:function(AS,AT){},stop:function(AT,AU){AP=false;AJ();S=false;AU.item.height("auto");K("visible");g(".canvas-layout .canvas-widget-list .canvas-widget-highlight").remove();var AS=g(".canvas-layout > .canvas-layout-row .canvas-widget-list > .canvas-widget.container-widget");g(".canvas-layout > .canvas-layout-row .canvas-widget-list > .canvas-widget.container-widget").each(function(){var AV=g(".canvas-widget-list",this);if(AV.children().length==0){AV.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(AV.find(".canvas-widget.dummy-widget").length>0&&AV.find(".canvas-widget:not(.dummy-widget,.canvas-widget-highlight)").length>0){AV.find(".canvas-widget.dummy-widget").remove()}}})},receive:function(AS,AT){if(AT.item.hasClass("module-item")){AR.apply(this,[AS,AT,true])}},handle:".move-icon",items:".canvas-widget"}).find(".canvas-widget .widget-header").disableSelection();g(document).on("click",".edit-mode .canvas-widget .close-button",function(){var AS=g(this);openConfirmDialog({title:vBulletin.phrase.get("remove_module_q"),message:vBulletin.phrase.get("do_you_want_to_remove_module",AS.closest(".widget-header").find(".module-title").text()),iconType:"warning",onClickYes:function(){var AU=AS.closest(".canvas-widget"),AT=AU.parents(".canvas-widget.container-widget");AU.remove();AJ();a();o=true;if(AT.find(".canvas-widget").length==0){AT.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")))}}})});g(document).on("click",".edit-mode .js-search-widget .edit-button",function(){K("hidden");AM(g(this).closest(".js-search-widget"));g("#search-config-dialog").dialog("open");return false});function AQ(AZ,AY){var AS=g("#edit-page-dropdown .lnkSaveChanges .label").text();if(!AY){if(!g.trim(g("#save-page-form #pagetitle").val())){openAlertDialog({title:AS,message:vBulletin.phrase.get("please_enter_page_name"),iconType:"warning",onAfterClose:function(){g("#save-page-form #pagetitle").focus()}});return false}if(g("body").hasClass("lnkEditPage")){var AX=g("#save-page-form #pagetemplateid-yes");var AT=g("#save-page-form #pagetemplateid-no");if(!AX.prop("checked")&&!AT.prop("checked")){openAlertDialog({title:AS,message:vBulletin.phrase.get("please_choose_overwrite_template_options"),iconType:"warning",onAfterClose:function(){g("#save-page-form #pagetemplateid-yes").focus()}});return false}else{if(AT.prop("checked")){var AU=g("#save-page-form #templatetitle-edit");var Ac=g.trim(AU.val());if(!Ac||Ac==AU.prop("defaultValue")){openAlertDialog({title:AS,message:vBulletin.phrase.get("please_enter_new_template_name"),iconType:"warning",onAfterClose:function(){g("#save-page-form #templatetitle-edit").focus()}});return false}openConfirmDialog({title:AS,message:vBulletin.phrase.get("applying_new_template",g("#save-page-form #templatetitle-edit").val()),buttonLabel:{yesLabel:vBulletin.phrase.get("save_page"),noLabel:vBulletin.phrase.get("cancel")},iconType:"warning",onClickYes:function(){g("#save-page-form #btnOK").trigger("click",true)}});return false}else{if(AX.prop("checked")){if(q&&(!o&&!Y)){g("#save-page-form #btnOK").trigger("click",true)}else{openConfirmDialog({title:AS,message:vBulletin.phrase.get("overwrite_template_continue"),buttonLabel:{yesLabel:vBulletin.phrase.get("save_page"),noLabel:vBulletin.phrase.get("cancel")},iconType:"warning",onClickYes:function(){g("#save-page-form #btnOK").trigger("click",true)}})}return false}}}}else{var AU=g("#save-page-form #templatetitle-new");var Ac=g.trim(AU.val());if(!Ac||Ac==AU.prop("defaultValue")){openAlertDialog({title:AS,message:vBulletin.phrase.get("please_enter_new_template_name"),iconType:"warning",onAfterClose:function(){g("#save-page-form #templatetitle-new").focus()}});return false}}}var Ab=g(".canvas-layout:visible");z=Ab.attr("id");g("#save-page-form #screenlayoutid").val(Ab.attr("data-layout-id"));function AV(Af){var Ag={widgetId:Af.attr("data-widget-id"),widgetInstanceId:(Af.attr("data-widget-instance-id")||"0")};if(Af.hasClass("container-widget")){var Ad=[];var Ae=[];g("div.canvas-widget-list > div.canvas-widget",Af).each(function(Ah){if(!g(this).hasClass("hidden-widget")){Ae.push(g(this).attr("data-widget-instance-id"))}Ad.push(AV(g(this)))});Ag.subModules=Ad;Ag.displaySubModules=Ae}return Ag}g('input[type=hidden][name*="displaysections"]',Ab).clone().appendTo(g("#moduleData").empty());g("#"+z+" > .canvas-layout-row > div.canvas-widget-list").each(function(){var Ad=[];var Ae=Z(this);g(this).children("div.canvas-widget").each(function(){Ad.push(AV(g(this)))});g('#save-page-form input[name="displaysections['+Ae+']"]').val(JSON.stringify(Ad))});var Aa={};var AW=g("#save-page-form").serializeArray();g.each(AW,function(Ad,Ae){Aa[Ae.name]=Ae.value});g.ajax({url:vBulletin.getAjaxBaseurl()+"/admin/savepage",data:{input:Aa,url:window.location.href},type:"POST",dataType:"json",complete:function(){g("body").css("cursor","auto")},success:function(Ad){console.log("savePage successful! result:"+JSON.stringify(Ad));if(Ad&&Ad.url!=null){window.location.href=pageData.baseurl+Ad.url}else{openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get(Ad.errors[0]),iconType:"error"})}},error:function(Af,Ae,Ad){console.log("saveChannelWidgetConfig failed! result:"+Ad);openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_saving_page",Af.status),iconType:"error"})}})}g(document).on("click","#save-page-form #btnOK",AQ);g("#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(){g("#config-dialog .loader").show();g("body").css("cursor","wait")},create:function(){g(document).on("submit",".sitebuilder-widget-form",function(){function AT(AX){g("body").css("cursor","wait");g("#config-dialog .action-buttons button").prop("disabled",true);var AY=g("#config-dialog").data("selected-module");var AV=g(AX).find("#config_widgetid");var AU=AY.hasClass("category-customized_copy");var AW=AU?AX.action.replace(/saveAdminConfig/,"saveDefaultConfig"):AX.action;g.ajax({url:AW,type:AX.method,data:(g(AX).serializeArray()),dataType:"json",success:function(Aa){console.log("saveAdminConfig successful!");g("body").css("cursor","auto");if(Aa&&Aa.data){var Ae=g("#config-dialog").data("selected-module");var AZ=Aa.data.title||Aa.data.searchResultTitle||Aa.data.searchTitle;if(AZ){Ae.find(".module-title .admin-only").text(vBulletin.phrase.get("x_module",AZ))}switch(Aa.data.widget_type){case"custom-html-widget":Ae.find(".widget-content").html(Aa.data.html);P(Ae,true);break;case"video-widget":var Ab=Aa.data.embed_data;if(Ab){var Af=Ae.find(".widget-content .videocontainer");if(Af.length==0){Af=g("<div />").addClass("videocontainer").appendTo(Ae.find(".widget-content"))}var Ad={code:Ab.code,provider:Ab.provider,width:"100%",height:260};g.post(vBulletin.getAjaxBaseurl()+"/ajax/render/bbcode_video",Ad,function(Ag){if(Ag){Af.empty().append(Ag);P(Ae,true)}},"json");Ae.find(".widget-content").find(".note").addClass("h-hide")}break}var Ac=g('select[name="data[default_tab]"]',g(AX));if(Ac.length>0){Ae.attr("data-widget-default-tab",Ac.val())}Y=true}else{openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("invalid_server_response_please_try_again"),iconType:"error",onAfterClose:function(){g("#config-dialog .action-buttons button").prop("disabled",false)}});g("#config-dialog .loader").hide()}g("#config-dialog").dialog("close")},error:function(Ab,Aa,AZ){console.log("saveAdminConfig failed! error:"+AZ);g("body").css("cursor","auto");openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_saving_configuration_module",g("#config-dialog .widget-name h1").text()),iconType:"error",onAfterClose:function(){g("#config-dialog .action-buttons button").prop("disabled",false)}});g("#config-dialog .loader").hide()}})}var AS=this;AT(AS);return false});g("#btnCloseConfig").on("click",function(){g(".channel-config-dialog .channel-list").empty();g("#config-dialog").dialog("close")})},close:function(){K("visible");g("#config-dialog .dialog-content .channel-config-dialog").css("display","none");g("#config-dialog .action-buttons button").prop("disabled",false)}});g("#pagetitle").on("keyup blur",function(AS){if(q){g("#pageurl").val(this.value.replace(/[^\w-]+/g,""))}return true});g("#save-page-form #pagetemplateid-yes").on("click",function(){g("#save-page-form .template-name").addClass("h-hide");g("#save-page-form #templatetitle").prop("disabled",false);g("#save-page-form #templatetitle-edit").prop("disabled",true);g("#save-page-form .page-template-name").removeClass("h-hide")});g("#save-page-form #pagetemplateid-no").on("click",function(){g("#save-page-form .template-name").removeClass("h-hide");g("#save-page-form #templatetitle").prop("disabled",true);g("#save-page-form #templatetitle-edit").prop("disabled",false);g("#save-page-form .page-template-name").addClass("h-hide")});function AM(AS){if(typeof AF.search_config_dialog=="undefined"){vBulletin.AJAX({url:vBulletin.getAjaxBaseurl()+"/ajax/render/dialog_search_config",success:function(AT){AF.search_config_dialog=AT;g("body").append(AT);AM(AS)},error_phrase:"error_fetching_dialog"});return }if(AS){g("#search-config-dialog").data("search-widget",AS)}g("#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(){K("visible")},open:function(){var AT=this;g("#customSearchDialog",AT).addClass("h-invisible");g("body").css("cursor","wait");setTimeout(function(){vBulletin.search=vBulletin.search||{};var AW=function(){AB=new vBulletin.search.SearchControl("#customSearchDialog");p(AB)};var AV=g("#search-config-dialog").data("search-widget");var AY={id:AV.attr("data-widget-id"),instanceid:AV.attr("data-widget-instance-id")};if(typeof vBulletin.search.SearchControl=="undefined"){var AX=["/js/jquery/jquery.qtip.min.js","/js/tag-editor.js","/js/sb_search.js"];var AU=function(){if(AX.length==0){g("body").css("cursor","auto");g("#customSearchDialog",AT).removeClass("h-invisible");AW();return }var AZ=AX.shift();g.getScript(vBulletin.getAjaxBaseurl()+AZ+"?"+pageData.simpleversion,AU).error(function(Ad,Ac,Aa){var Ab=(Aa&&Aa.message)?"{0}: {1}".format(vBulletin.phrase.get("error"),Aa.message):"HTTP {0}: {1}".format(Ad.status,Ad.statusText);g("#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"),Ab),iconType:"error"})}).complete(function(){})};AU()}else{g("#customSearchDialog",AT).removeClass("h-invisible");AW()}},1);Y=false},create:function(){g("#btnSaveSearchConfig").on("click",function(){g("body").css("cursor","wait");var AU=g("#search-config-dialog").data("search-widget");var AZ={id:AU.attr("data-widget-id"),instanceid:AU.attr("data-widget-instance-id")};var AW={pageid:pageData.pageid,widgetid:AZ.id,widgetinstanceid:AZ.instanceid,pagetemplateid:g("#select-template input[type=radio]:checked").val(),searchJSON:{}};var AX=g("#searchTitle");if(AX.length>0&&g.trim(AX.val()).length>0){AW.searchTitle=g.trim(AX.val());AX.data("defaultValue",AW.searchTitle)}var AT=g("#resultsPerPage");if(AT.length>0&&g.trim(AT.val()).length>0){AW.resultsPerPage=g.trim(AT.val());AT.data("defaultValue",AW.resultsPerPage)}var AV=g("#searchconfig_hide_avatars_yes");if(AV.length>0&&AV.prop("checked")){AW.hide_avatars="1";AV.data("defaultValue","1")}else{AW.hide_avatars="0";AV.data("defaultValue","0")}var AY=g(".js-searchmodule-show-at-breakpoints");if(AY.length>0){AW.show_at_breakpoints={desktop:1,small:1,xsmall:1};AY.find("input").each(function(){var Aa=g(this);switch(Aa.prop("name")){case"show_at_breakpoints[desktop]":AW.show_at_breakpoints.desktop=Aa.prop("checked")?1:0;break;case"show_at_breakpoints[small]":AW.show_at_breakpoints.small=Aa.prop("checked")?1:0;break;case"show_at_breakpoints[xsmall]":AW.show_at_breakpoints.xsmall=Aa.prop("checked")?1:0;break}});AY.data("defaultValue",AW.show_at_breakpoints)}AW.searchJSON=AB.load();g.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/widget/saveSearchWidgetConfig",data:{data:JSON.stringify(AW)},type:"POST",dataType:"json",complete:function(){g("body").css("cursor","auto")},success:function(Aa){console.log("savesearchWidgetConfig successful! result:"+JSON.stringify(Aa));if(Aa&&Aa.widgetinstanceid>0&&Aa.searchJSON){AU.attr("data-widget-instance-id",Aa.widgetinstanceid);AU.find(".main-title").text(AW.searchTitle);g("#config_widgetinstanceid").val(Aa.widgetinstanceid);g("#config_pagetemplateid").val(Aa.pagetemplateid);g("#pagetemplateid-new").val(Aa.pagetemplateid);g("#search-config-dialog").dialog("close");P(AU,true);Y=true}else{openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_saving_search_config"),iconType:"error"})}},error:function(Ac,Ab,Aa){console.log("saveSearchWidgetConfig failed! result:"+Aa);openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_saving_search_config_code",Ac.status),iconType:"error"})}})});g("#btnCancelSearchConfig").on("click",function(){function AT(){g("#search-config-dialog").dialog("close");AB.set("{}");var AY=g("#search-config-dialog #searchTitle");AY.val(AY.data("defaultValue"));var AV=g("#search-config-dialog #resultsPerPage");AV.val(AV.data("defaultValue"));var AW=g("#search-config-dialog #searchconfig_hide_avatars_yes");if(AW.data("defaultValue")=="1"){AW.prop("checked",true)}else{g("#search-config-dialog #searchconfig_hide_avatars_no").prop("checked",true)}var AZ=g("#search-config-dialog .js-searchmodule-show-at-breakpoints");if(AZ.length>0){var AX=AZ.data("defaultValue");AZ.find("input").each(function(){var Aa=g(this);switch(Aa.prop("name")){case"show_at_breakpoints[desktop]":Aa.prop("checked",AX.desktop?"checked":"");break;case"show_at_breakpoints[small]":Aa.prop("checked",AX.small?"checked":"");break;case"show_at_breakpoints[xsmall]":Aa.prop("checked",AX.xsmall?"checked":"");break}})}}if(Y){var AU=g(this);openConfirmDialog({title:vBulletin.phrase.get("cancel_edit"),message:vBulletin.phrase.get("do_you_want_to_cancel_editing_search_module"),iconType:"warning",onClickYes:AT})}else{AT()}})}})}g("#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(){K("visible")},open:function(){var AS=this;Y=false},create:function(){g("#blog-category-dialog #btnSaveCategories").on("click",function(){g("body").css("cursor","wait");g("#blog-category-dialog dialog-content loader").show();var AS=g("#search-config-dialog").data("blog-category-widget");var AT={id:AS.attr("data-widget-id"),instanceid:AS.attr("data-widget-instance-id")};vBulletin.AJAX({url:vBulletin.getAjaxBaseurl()+"/ajax/api/widget/saveBlogCategories",data:{},complete:function(){g("body").css("cursor","auto");g("#blog-category-dialog dialog-content loader").hide()},success:function(AU){g("#blog-category-dialog dialog-content widget-config-container").html(AU)},error_phrase:"error_saving_blog_categories"})});g("#blog-category-dialog #btnNewCategory").on("click",function(){});g("#blog-category-dialog #btnCloseCategories").on("click",function(){if(Y){var AS=g(this);openConfirmDialog({title:vBulletin.phrase.get("cancel_edit"),message:vBulletin.phrase.get("do_you_want_to_cancel_editing_blog_categories_module"),iconType:"warning",onClickYes:g("#blog-category-dialog").dialog("close")})}else{g("#blog-category-dialog").dialog("close")}})}})}function p(AL){var AN=g(this).closest(".canvas-widget");var AM=g("#search-config-dialog").data("search-widget");var AO={id:AM.attr("data-widget-id"),instanceid:AM.attr("data-widget-instance-id")};g.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/widget/fetchSearchConfig",data:({widgetid:AO.id,widgetinstanceid:AO.instanceid||"",pagetemplateid:g("#config_pagetemplateid").val()||g("#select-template input[type=radio]:checked").val()||"",configtype:"admin"}),type:"POST",dataType:"json",complete:function(){g("body").css("cursor","auto")},success:function(AP){console.log("fetchConfig successful! result:"+JSON.stringify(AP));if(AP.searchTitle){var AS=g("#searchTitle");if(AS.length>0){AS.val(AP.searchTitle)}}if(AP.resultsPerPage){var AQ=g("#resultsPerPage");if(AQ.length>0){AQ.val(AP.resultsPerPage)}}if(AP.hide_avatars&&parseInt(AP.hide_avatars,10)==1){var AR=g("#searchconfig_hide_avatars_yes");if(AR.length>0){AR.prop("checked",true)}}else{g("#searchconfig_hide_avatars_no").prop("checked",true)}if(AP.show_at_breakpoints){var AT=g("#search-config-dialog .js-searchmodule-show-at-breakpoints");if(AT.length>0){AT.find("input").each(function(){var AU=g(this);switch(AU.prop("name")){case"show_at_breakpoints[desktop]":AU.prop("checked",AP.show_at_breakpoints.desktop?"checked":"");break;case"show_at_breakpoints[small]":AU.prop("checked",AP.show_at_breakpoints.small?"checked":"");break;case"show_at_breakpoints[xsmall]":AU.prop("checked",AP.show_at_breakpoints.xsmall?"checked":"");break}})}}AL.set(AP.searchJSON||{},AP.contentTypes||{},AP.channels||{});g("#config-dialog .dialog-content .widget-config-container").show();g("#search-config-dialog .form_layout .form_row .field_column select").selectBox();g("#config-dialog .loader").hide()},error:function(AR,AQ,AP){console.log("fetchConfigSchema failed! error:"+AP);openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_retrieving_configuration",widgetName),iconType:"error",onAfterClose:function(){g("#config-dialog").dialog("close")}});g("#config-dialog .loader").hide()}})}g(document).ready(function(){x()})})(jQuery);;

// ***************************
// js.compressed/admin-sbpanel-style.js
// ***************************
/*=======================================================================*\
|| ###################################################################### ||
|| # vBulletin 5.1.9 Patch Level 4
|| # ------------------------------------------------------------------ # ||
|| # Copyright 2000-2016 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(L){var J=false,K,U,S=0,Y=function(h){var g=this;vBulletin.assertUserHasAdminPermission("canusesitebuilder",g,function(){E.call(g)});return false},E=function(g,l){var k=L(this),j=L(document.body),i=!k.hasClass("selected"),h=true;if(typeof g!="undefined"){i=!!g}if(typeof l!="undefined"){h=!!l}b(!i,k);if(i){F();D();L(".js-style-panel").css("display","none").removeClass("h-hide").slideDown("400",A)}else{L(".js-style-panel").slideUp("fast",function(){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)}})}},B=function(g){E(false,g)},b=function(g,i){var h=function(j){this.blur();j.stopPropagation();return false};if(g){L("#main-navbar .main-nav a, #main-navbar .secondary-nav .sb-menu a").removeClass("selected").closest("li").removeClass("h-disabled");L("#main-navbar .secondary-nav li").removeClass("h-disabled");i.removeClass("selected").closest("li").removeClass("h-disabled");L(document).off("focus click mousedown","#main-navbar .h-disabled a",h)}else{L("#main-navbar .main-nav a, #main-navbar .secondary-nav .sb-menu a").removeClass("selected").closest("li").addClass("h-disabled");L("#main-navbar .secondary-nav li").addClass("h-disabled");i.addClass("selected").closest("li").removeClass("h-disabled");L(document).on("focus click mousedown","#main-navbar .h-disabled a",h)}},D=function(){},a=function(h,i){var g=L(".js-theme-selector__list:visible .js-theme-selector__theme-radio:checked").val();vBulletin.AJAX({url:vBulletin.getAjaxBaseurl()+"/ajax/api/style/setDefaultStyle",data:{styleid:g},error_phrase:"error_setting_theme",success:function(){var j=new Date();j.setDate(j.getDate()+365);L.cookie(pageData.cookie_prefix+"userstyleid",g,{path:pageData.cookie_path,domain:pageData.cookie_domain,expires:j});if(typeof i=="undefined"||i){B(true)}}});return false},T=function(g){B(false);return false},e=function(g){c(K.getValue(),null,S)},I=function(g){openConfirmDialog({title:vBulletin.phrase.get("revert"),message:vBulletin.phrase.get("revert_extra_css_warning"),iconType:"warning",onClickYes:function(h){U="";K.setValue("");c("",V,S)}});return false},P=function(g){B(true);return false},N=function(g){K.setValue(U)},C=function(k,g,l){if(!g&&k&&k.target){var g=L(k.target).closest(".js-theme-selector__theme").data("preview-url")}if(!l){var l=L(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=L("<img />").prop("src",g)}else{i=L("<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(){L(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(){L(this).remove()}});i.fadeIn({duration:600,queue:false})}},d=function(){var g=L(this);g.closest(".js-theme-selector__list").find(".js-theme-selector__theme").removeClass("b-theme-selector__theme--selected js-theme-selector__theme--selected");g.closest(".js-theme-selector__theme").addClass("b-theme-selector__theme--selected js-theme-selector__theme--selected")},Z=function(q,l,h){var k=this,j="js-theme-selector__theme b-theme-selector__theme h-margin-right-xl",m=L('<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=L("<label />").prop("title",k.title),n=L("<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=L("<img />").addClass("h-margin-s h-margin-bottom-m").prop("src",k.iconurl),i=L("<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");C({},k.previewurl,q);j+=" js-theme-selector__theme--selected b-theme-selector__theme--selected"}i.append(g);n.prepend(m);o.append(i).append(n);L("<div />").addClass(j).data("preview-url",(k.previewurl||"")).append(o).appendTo(q);f.call(g.get(0),2)},f=function(q){var k=L(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=L("<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)})}}},H=function(h,l){var j,k=0,g=vBulletin.options.get("styleid");l.html("");if(h&&h.themes){L.each(h.themes,function(){Z.apply(this,[l,g,k]);++k})}if(!k){L("<div />").addClass("b-theme-selector__message").text(vBulletin.phrase.get("there_are_no_themes_installed")).appendTo(l)}else{Q(l,k)}},Q=function(g,j){var h=g.find(".js-theme-selector__theme").first().outerWidth(true),i=h*j;g.width(i);g.closest(".js-theme-selector__container").tinyscrollbar({sizethumb:14,axis:"x"});G(g)},G=function(l){var h=l.find(".js-theme-selector__theme--selected");if(h.length==1){var n=l.find(".js-theme-selector__theme"),o=n.first().outerWidth(true),g=n.length,m=parseInt(h.position().left,10),q=o*g,k=l.position().left,t=Math.round(k)*-1,r=l.closest(".js-theme-selector__container"),p=r.innerWidth(),j=p+t-o,i=0;if(m<t){i=m-t}else{if(j<m){i=m-j}}if(i!=0){var s=t+i;r.tinyscrollbar_update(s)}}},M=function(j,k,h){var i=L(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);C.call(this,j);G(k);if(h.liveUpdate){a.call(this,j,false)}},W=function(h){var g={liveUpdate:false,container:document};h=L.extend({},g,h);var j=L(".js-theme-selector__list",h.containerSelector);function i(k){M.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({url:vBulletin.getAjaxBaseurl()+"/ajax/api/style/getThemeInfo",error:function(){vBulletin.makeErrorAlertCallback("error","error_fetching_themes")();var k=L("<div />").addClass("b-theme-selector__message").text(vBulletin.phrase.get("error_fetching_themes"));j.html(k)},success:function(k){H.apply(this,[k,j])}})},R=function(g){if(isNaN(parseFloat(L(g.target).val()))){return false}currentText=K.getValue();if(U!=K.getValue()){X()}else{V()}},V=function(){$select=L(".js-style-panel #admin-stylepanel-csseditor .js_stylepanel_selectStyle");L.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/template/fetchBulk",type:"POST",dataType:"json",data:{template_names:{0:"css_additional.css"},styleid:$select.val(),type:"uncompiled"},success:function(g){if(g!=null){console.log(g);if(g&&!g.errors){if(typeof (g["css_additional.css"])=="undefined"){U=""}else{U=g["css_additional.css"]}K.setValue(U)}else{if(L.isArray(g.errors)&&g.errors.length>0){K.setValue("")}}}S=$select.val()},error:function(){openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_loading_css"),iconType:"error"})}})},X=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(K.getValue(),V,S)},onClickNo:function(g){L(".js-style-panel #admin-stylepanel-csseditor .js_stylepanel_selectStyle").val(S)}})},c=function(i,h,g){L.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/template/saveAdditional",type:"POST",data:{text:i,styleid:g},dataType:"json",success:function(j){U=i;if(L.isArray(j.errors)&&j.errors.length>0){openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_saving_css"),iconType:"error"})}else{if(typeof (h)=="function"){openAlertDialog({title:vBulletin.phrase.get("success"),message:vBulletin.phrase.get("css_saved"),iconType:"success",onBeforeClose:function(){h()}})}else{openAlertDialog({title:vBulletin.phrase.get("success"),message:vBulletin.phrase.get("css_saved"),iconType:"success"})}}},error:function(){openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_saving_css"),iconType:"error"})}})},A=function(){function g(){if(typeof (K)=="undefined"){K=CodeMirror.fromTextArea(L(".sb-style-panel_cssextraedit").get(0),{mode:"css",lineNumbers:true});U="";L(".js-style-panel #admin-stylepanel-csseditor .js_stylepanel_selectStyle").change();L(".sb-style-panel .tab-item a").off("click",g)}}L(".sb-style-panel .tab-item a").off("click",g).on("click",g);if(L(".js-style-panel .js-admin-stylepanel-csseditor").is(":visible")){g()}},F=function(){if(J){return }L(".js-style-panel .tabs").tabs();L(document).off("click",".js-style-panel #admin-stylepanel-themes .action-buttons .save").on("click",".js-style-panel #admin-stylepanel-themes .action-buttons .save",a);L(document).off("click",".js-style-panel #admin-stylepanel-themes .action-buttons .cancel").on("click",".js-style-panel #admin-stylepanel-themes .action-buttons .cancel",T);L(document).off("click",".js-style-panel #admin-stylepanel-csseditor .action-buttons .revert").on("click",".js-style-panel #admin-stylepanel-csseditor .action-buttons .revert",I);L(document).off("click",".js-style-panel #admin-stylepanel-csseditor .action-buttons .cancel").on("click",".js-style-panel #admin-stylepanel-csseditor .action-buttons .cancel",N);L(document).off("click",".js-style-panel #admin-stylepanel-csseditor .action-buttons .close").on("click",".js-style-panel #admin-stylepanel-csseditor .action-buttons .close",P);L(document).off("click",".js-style-panel #admin-stylepanel-csseditor .action-buttons .save").on("click",".js-style-panel #admin-stylepanel-csseditor .action-buttons .save",e);L(document).off("change",".js-style-panel #admin-stylepanel-csseditor .js_stylepanel_selectStyle").on("change",".js-style-panel #admin-stylepanel-csseditor .js_stylepanel_selectStyle",R);if(L(".js-style-panel .js-theme-selector__container").length==1){W({liveUpdate:false,containerSelector:".js-style-panel"})}if(L(".js-style-panel .js-admin-stylepanel-csseditor").length==1){A()}J=true},O=function(){L(function(){L(document).off("click","#main-navbar .sb-menu:not(.h-disabled) #lnkStylePanel").on("click","#main-navbar .sb-menu:not(.h-disabled) #lnkStylePanel",Y);if(typeof (pageData.adminAction)!="undefined"&&pageData.adminAction=="stylePanel"){L("#lnkStylePanel").click()}})};window.vBulletin=window.vBulletin||{};window.vBulletin.sitebuilder=window.vBulletin.sitebuilder||{};window.vBulletin.sitebuilder.initThemesInQuickConfig=function(){W({liveUpdate:true,containerSelector:".js-config-site-panel"})};O()})(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){openPromptDialog({message:B,initialValue:A,validation:{type:"string"},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);
;

