Program: CWE-79
Project: CVE-2018-10937
Buggy source:
/*
       2014, Black Cat Development
   @link            http://blackcat-cms.org
   @license         http://www.gnu.org/licenses/gpl.html
   @category        CAT_Core
   @package         freshcat

*/
function getMethods(a){var b=[],c;for(c in a)try{"function"==typeof a[c]&&b.push(c+": "+a[c].toString())}catch(e){b.push(c+": inaccessible")}return b}function dump(a,b){var c="";b||(b=0);for(var e="",d=0;d<b+1;d++)e+=" ";if("object"==typeof a)for(var f in a)d=a[f],"object"==typeof d?(c+=e+"'"+f+"' ...\n",c+=dump(d,b+1)):c+=e+"'"+f+"' => \""+d+'"\n';else c="===>"+a+"<===("+typeof a+")";return c};(function(a){a.fn.fc_set_tab_list=function(b){var c={toggle_speed:300,fc_list_forms:a(".fc_list_forms"),fc_list_add:a("#fc_list_add")};b=a.extend(c,b);return this.each(function(){var c=a(this),d=c.closest("ul").children("li"),f="fc_list_"+c.children("input").val(),g=a("#"+f),h=a("#fc_install_new");b.fc_list_forms.not(":first").slideUp(0);0===b.fc_list_add.size()?d.filter(":first").addClass("fc_active"):b.fc_list_add.unbind().click(function(){d.removeClass("fc_active");b.fc_list_forms.not(h).slideUp(0);
h.slideDown(0);h.find("ul.fc_groups_tabs a:first").click();h.find("input[type=text]:first").focus();jQuery("#addon_details").html("")});c.not(".fc_type_heading").click(function(){d.removeClass("fc_active");c.addClass("fc_active");b.fc_list_forms.not("#"+f).slideUp(0);g.slideDown(0);g.find("ul.fc_groups_tabs a:first").click();jQuery("#fc_add_new_module").hide()})})}})(jQuery);(function(a){a.fn.fc_toggle_element=function(b){b=a.extend({show_on_start:!1,toggle_speed:300},b);return this.each(function(){var c=a(this),e="show";if(c.is("select")){var d=c.children("option:selected"),f=match_class_prefix("show___",d),e="show";if("undefined"==typeof f||0===f.length)f=match_class_prefix("hide___",d),e="hide";"undefined"!=typeof f&&(g=a("#"+f));!1===b.show_on_start?g.slideUp(0).addClass("fc_inactive_element hidden").removeClass("fc_active_element"):g.slideDown(0).addClass("fc_active_element").removeClass("fc_inactive_element hidden");
c.change(function(){var d=c.children("option:selected"),e=match_class_prefix("show___",d),f="show";if("undefined"==typeof e||0===e.length)e=match_class_prefix("hide___",d),f="hide";"undefined"!=typeof e&&(g=a("#"+e));"show"==f?g.removeClass("hidden").slideUp(0).slideDown(b.toggle_speed,function(){g.addClass("fc_active_element").removeClass("fc_inactive_element")}):g.slideUp(b.toggle_speed,function(){g.addClass("fc_inactive_element hidden").removeClass("fc_active_element")})}).change()}else if(c.is("input:checkbox")||
c.is("input:radio")){var g=a("#"+c.prop("rel")),f=match_class_prefix("show___",c),e="show";if("undefined"==typeof f||0===f.length)f=match_class_prefix("hide___",c),e="hide";"undefined"!=typeof f&&(g=a("#"+f));"undefined"!=typeof g&&0<g.length&&(console.log(f+": "+e+" - "+c.prop("checked")),"show"==e&&c.prop("checked")?b.show_on_start=!0:"hide"==e&&c.prop("checked")?b.show_on_start=!1:"show"!=e||c.prop("checked")||(b.show_on_start=!1));!1===b.show_on_start?(console.log(f+" "+e+" - "+b.show_on_start),
g.addClass("fc_inactive_element hidden").slideUp(0).removeClass("fc_active_element")):g.slideDown(0).addClass("fc_active_element").removeClass("hidden fc_inactive_element");c.click(function(){c.prop("checked")&&"show"==e?g.removeClass("hidden").slideUp(0).slideDown(b.toggle_speed,function(){g.addClass("fc_active_element").removeClass("fc_inactive_element")}):g.slideUp(b.toggle_speed,function(){g.addClass("fc_inactive_element hidden").removeClass("fc_active_element")})})}})}})(jQuery);(function(a){a.fn.resize_elements=function(b){var c={sidebar:a("#fc_sidebar"),sidebar_content:a("#fc_sidebar_content"),main_content:a("#fc_main_content"),leftside:a("#fc_sidebar, #fc_content_container"),rightside:a("#fc_content_container, #fc_content_footer"),rightcontent:a("#fc_content_container"),overview_list:a("#fc_list_overview"),side_add:a("#fc_add_page"),media:a("#fc_media_browser"),bottomright:130,bottomleft:79};b=a.extend(c,b);return this.each(function(){var c=a(this);c.resize(function(){var d=
parseInt(c.height(),10),f=parseInt(c.width(),10),g=parseInt(b.sidebar.width(),10);b.main_content.css({maxHeight:d-b.bottomright+"px"});b.media.css({maxHeight:d-b.bottomright+"px"});b.leftside.height(d-b.bottomright+30);b.sidebar.height(d-b.bottomright+48);b.rightcontent.height(d-b.bottomleft);b.rightside.width(f-g);b.sidebar_content.height(d-b.bottomright+26);f=0<a("#fc_list_add").size()?58:30;b.overview_list.css({maxHeight:d-b.bottomright-f+"px"});b.side_add.css({left:g+"px",height:d-b.bottomright+
51+"px"})}).resize()})}})(jQuery);(function(a){a.fn.fc_show_popup=function(b){b=a.extend({functionOpen:!1},b);return this.each(function(){var b=a(this),e=match_class_prefix("form_",b),d=a("#"+e);b.unbind().click(function(){d.find(".fc_valid, .fc_invalid").removeClass("fc_invalid fc_valid");var b=d.find('input[name="form_title"]').val();buttonsOpts=[];0<d.find(".fc_confirm_bar").size()&&(d.find(".fc_confirm_bar input").each(function(){var b=a(this);if(b.hasClass("hidden"))var c=function(){},e="hidden";else"reset"==b.prop("type")?(c=
function(){d.find('input[type="reset"]').click();d.dialog("close")},e="reset"):(c=function(){d.submit()},e="submit");buttonsOpts.push({text:b.val(),click:c,"class":e})}),d.find(".fc_confirm_bar").hide());d.dialog({create:function(b,c){a(".ui-widget-header").removeClass("ui-corner-all").addClass("ui-corner-top")},open:function(a,b){"undefined"!=typeof functionOpen&&!1!==functionOpen&&functionOpen.call(this)},modal:!0,closeOnEscape:!0,title:b,minWidth:600,minHeight:400,buttons:buttonsOpts})})})}})(jQuery);function toTimeString(a){return(new Date(1E3*a)).toUTCString().match(/(\d\d:\d\d:\d\d)/)[0]}function TimeStringToSecs(a){a=a.split(":");return 3600*+a[0]+60*+a[1]+ +a[2]}
"undefined"!=typeof jQuery&&($.ajaxPrefilter(function(a,b,c){c.originalRequestOptions=b}),jQuery.ajaxSetup({error:function(a,b,c){0===a.status?alert("Not connected.\n Verify Network."):404==a.status?alert("Requested page not found. [404]"):500==a.status?alert("Internal Server Error [500]."):"parsererror"===c?alert("JSON parse failed."):"timeout"===c?alert("Time out error."):"abort"===c?alert("Ajax request aborted."):-1!=a.responseText.indexOf("fc_login_form")?location.href=CAT_ADMIN_URL+"/login/index.php":
a.responseText.match(/CSRF check failed/ig)?(alert(cattranslate("CSRF check failed. Maybe a token timeout. Trying to reload page.")),location.reload(!0)):a.responseText.match(/ACCESS DENIED!/ig)?(alert(cattranslate("Access denied! Maybe a missing entry in database table class_secure.")),location.reload(!0)):alert("Uncaught AJAX Error.\n"+a.responseText)}}));
(function(){for(var a,b=function(){},c="assert clear count debug dir dirxml error exception group groupCollapsed groupEnd info log markTimeline profile profileEnd table time timeEnd timeStamp trace warn".split(" "),e=c.length,d=window.console=window.console||{};e--;)a=c[e],d[a]||(d[a]=b)})();$.expr[":"].containsi=$.expr.createPseudo(function(a,b,c){return function(b){return-1<(b.textContent||b.innerText||$.text(b)).toLowerCase().indexOf(a.toLowerCase())}});
function isValidEmailAddress(a){return(new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i)).test(a)}function getThemeName(){return"freshcat"}
function getDatesFromQuerystring(a){var b=[],c;if(void 0!=a){a=a.split("&");for(var e=0;e<a.length;e++)c=a[e].split("="),b.push(c[1]),b[c[0]]=c[1]}return b}function match_class_prefix(a,b){for(var c=b.prop("class").split(" "),e=new RegExp("^"+a+"(.+)","g"),d=0;d<c.length;d++){var f=e.exec(c[d]);if(null!==f)return f[1]}}
function togglePageTree(){if($("#fc_sidebar").is(":visible"))$("#fc_sidebar, #fc_sidebar_footer").css({width:0}).hide();else{var a="undefined"!=typeof $.cookie("sidebar")?$.cookie("sidebar"):200;$("#fc_sidebar, #fc_sidebar_footer").css({width:a}).show()}$(window).resize()}
function return_error(a,b){"undefined"!=typeof a&&a.slideUp(1200,function(){a.remove()});0===$(".fc_popup").size()&&$("#fc_admin_header").prepend('<div class="fc_popup" />');if("undefined"==typeof b||""==b)b="Unknown error";$(".fc_popup").html(b);var c=set_popup_title();$(".fc_popup").dialog({modal:!0,show:"fade",closeOnEscape:!0,title:c,buttons:[{text:"Ok",click:function(){$(".fc_popup").dialog("destroy")},"class":"submit"}]})}
function return_success(a,b){"undefined"!=typeof b?(a.html(b).addClass("fc_active"),setTimeout(function(){a.slideUp(1200,function(){a.remove()})},5E3)):a.slideUp(1200,function(){a.remove()})}function set_activity(a){"undefined"==typeof a&&(a="Loading");var b=$('<div class="fc_process fc_gradient1 fc_border" />').appendTo("#fc_activity");b.slideUp(0,function(){b.html('<div class="fc_process_title">'+cattranslate(a)+'</div><div class="loader" />').slideDown(300)});return b}
function set_popup_title(){var a="undefined"!=typeof cattranslate?cattranslate("Notification"):"Notification";0<$(".fc_popup .fc_popup_header").size()&&(a=$(".fc_popup .fc_popup_header").text(),$(".fc_popup .fc_popup_header").remove());return a}
function dialog_confirm(a,b,c,e,d,f,g,h,k){0===$(".fc_popup").size()&&$("#fc_admin_header").prepend('<div class="fc_popup" />');"undefined"!=typeof cattranslate&&(a=cattranslate(a),b=cattranslate(b));$(".fc_popup").html(a);c="undefined"==typeof c||!1===c?alert("You sent an invalid url"):c;d="undefined"==typeof d||!1===d?"POST":d;f="undefined"==typeof f||!1===f?"JSON":f;k="undefined"==typeof k||!1===k?$("document.body"):k;b="undefined"==typeof b||!1===b?set_popup_title():b;buttonsOpts=[];e._cat_ajax=
1;buttonsOpts.push({text:cattranslate("Yes"),click:function(){$.ajax({type:d,context:k,url:c,dataType:f,data:e,cache:!1,beforeSend:function(a){a.process=set_activity(b);$(".fc_popup").dialog("destroy").remove();"undefined"!=typeof g&&!1!==g&&g.call(this,a)},success:function(a,b,c){!0===a.success||0<$(a).find(".fc_success_box").size()?return_success(c.process,a.message):return_error(c.process,a.message);"undefined"!=typeof h&&!1!==h&&h.call(this,a)}})},"class":"submit"});buttonsOpts.push({text:cattranslate("No"),
click:function(){$(".fc_popup").dialog("destroy")},"class":"reset"});$(".fc_popup").dialog({modal:!0,show:"fade",closeOnEscape:!0,title:b,buttons:buttonsOpts})}
function dialog_ajax(a,b,c,e,d,f,g,h){b="undefined"==typeof b||!1===b?alert("You send an invalid url"):b;e="undefined"==typeof e||!1===e?"POST":e;d="undefined"==typeof d||!1===d?"JSON":d;h="undefined"==typeof h||!1===h?$("document.body"):h;a="undefined"==typeof a||!1===a?set_popup_title():a;c._cat_ajax=1;$.ajax({type:e,url:b,dataType:d,context:h,data:c,beforeSend:function(b){$(".fc_popup").remove();b.process=set_activity(a);"undefined"!=typeof f&&!1!==f&&f.call(this)},success:function(a,b,c){return_success(c.process,
a.message);!0===a.success?"undefined"!=typeof g&&!1!==g&&g.call(this,a):return_error(c.process,a.message)}})}
function dialog_form(a,b,c,e,d){"undefined"==typeof e&&(e="json");a.submit(function(f){f.preventDefault();a.ajaxSubmit({context:a,dataType:e,beforeSerialize:function(a,b){"undefined"!=typeof d&&!1!==d&&d.call(this,a,b)},beforeSend:function(c,d,e){var f=0<a.find("input[name=fc_form_title]").size()?a.find("input[name=fc_form_title]").val():"Loading";c.process=set_activity(f);a.is(":data(dialog)")&&a.dialog("destroy");"undefined"!=typeof b&&!1!==b&&b.call(this,c,d,e)},success:function(a,b,d){!0===a.success?
(return_success(d.process,a.message),"undefined"!=typeof c&&!1!==c&&c.call(this,a,b,d)):return_error(d.process,a.message)},error:function(a,b,c){a.process.remove();console.log(a);console.log(b);console.log(c);alert(b+": "+c)}})})}function set_buttons(a){a.find(".fc_toggle_element").fc_toggle_element()}
function searchUsers(a){$("#fc_list_overview li").removeClass("fc_activeSearch").slideDown(0);0<a.length?($("#fc_list_overview li:containsi("+a+")").not(".fc_no_search").addClass("fc_activeSearch"),$("#fc_list_overview").hasClass("fc_settings_list")&&$(".fc_list_forms:containsi("+a+")").each(function(){var a=$(this).prop("id");$("input[value*="+a.substr(8)+"]").closest("li").addClass("fc_activeSearch")}),$("#fc_list_overview li").not(".fc_activeSearch").slideUp(300),1==$("#fc_list_overview li.fc_activeSearch").size()&&
$("#fc_list_overview li.fc_activeSearch").click()):$("#fc_list_overview li").not("fc_no_search").slideDown(300)}function confirm_link(a,b,c){var e="HTML";"undefined"!=typeof c&&(e="JSON");dialog_confirm(a,"Confirmation",b,!1,"GET",e,!1,function(){location.reload(!0)})}
jQuery(document).ready(function(){if("undefined"!==typeof $.cookie("sidebar")){var a=parseInt($(window).width(),10),b=$.cookie("sidebar");$("#fc_content_container, #fc_content_footer").css({width:a-b+"px"});$("#fc_sidebar_footer, #fc_sidebar, #fc_activity, #fc_sidebar_content").css({width:b+"px"})}$(window).resize_elements();set_buttons($("body"));b="undefined"!=typeof cattranslate?cattranslate("Search"):"Search";$("#fc_list_search input").livesearch({searchCallback:searchUsers,queryDelay:250,innerText:b,
minimumSearchLength:2});$(".fc_input_fake label").click(function(){var a=$(this).prop("for");$("#"+a).val("");searchUsers("")});$(".ajaxForm").each(function(){dialog_form($(this))});$("a.ajaxLink").click(function(a){a.preventDefault();a=$(this).prop("href");dialog_ajax("Saving",a,getDatesFromQuerystring(document.URL.split("?")[1]))});$("#fc_sidebar_footer, #fc_sidebar").resizable({handles:"e",minWidth:100,start:function(b,e){a=parseInt($(window).width(),10)},resize:function(b,e){$("#fc_content_container, #fc_content_footer").css({width:a-
e.size.width+"px"});$("#fc_sidebar_footer, #fc_sidebar, #fc_activity, #fc_sidebar_content").css({width:e.size.width+"px"});$("#fc_add_page").css({left:e.size.width+"px"})},stop:function(a,b){$.cookie("sidebar",b.size.width,{path:"/"})}});$("#fc_add_page_nav").find("a").click(function(){var a=$(this);a.hasClass("fc_active")||($("#fc_add_page").find(".fc_active").removeClass("fc_active"),a.addClass("fc_active"),a=a.attr("href"),$(a).addClass("fc_active"));return!1});$("#fc_footer_info").on("click",
"#fc_showFooter_info",function(){$(this).toggleClass("fc_active").parent("#fc_footer_info").children("ul").slideToggle(300)});void 0!==typeof window.qtip&&$('[title!=""]').qtip({content:{attr:"title"},style:{classes:"qtip-light qtip-shadow qtip-rounded"}})});(function(a){a.fn.page_tree=function(b){b=a.extend({beforeSend:function(){},afterSend:function(){}},b);return this.each(function(){var b=a(this);1<b.find("li").size()&&b.find("ul").sortable({cancel:".ui-state-disabled",helper:"clone",handle:"div.fc_page_link",axis:"y",update:function(e,d){var f={page_id:a(this).sortable("toArray"),table:"pages",_cat_ajax:1};a.ajax({type:"POST",url:CAT_ADMIN_URL+"/pages/ajax_reorder.php",dataType:"json",data:f,cache:!1,beforeSend:function(a){a.process=set_activity("Reorder pages")},
success:function(d,e,f){var l=a(this);a(".popup").dialog("destroy").remove();b.children("span").removeClass("fc_page_loader");!0===d.success?(return_success(f.process,d.message),l.slideUp(300,function(){l.remove()})):return_error(f.process,d.message)},error:function(b,c,d){a(".popup").dialog("destroy").remove();alert(c+": "+d)}})}});b.find(".fc_page_tree_options_open").add("#fc_add_page button:reset").on("click",function(b){b.preventDefault();var c=a(this);b=a("#fc_add_page");a(".page_tree_open_options").removeClass("page_tree_open_options");
if(c.is("input")||c.hasClass("fc_side_add")){var f={_cat_ajax:1,parent_id:a("#fc_addPage_parent_page_id").val()},g=CAT_ADMIN_URL+"/pages/ajax_get_dropdown.php";a("#fc_addPage_keywords").val("");b.find(".fc_restorePageOnly, .fc_changePageOnly").hide();b.find("nav, ul, .fc_addPageOnly").show()}else c.is("button:reset")?(f={_cat_ajax:1},g=CAT_ADMIN_URL+"/pages/ajax_get_dropdown.php",a("#fc_addPage_keywords").val(""),b.find(".fc_restorePageOnly, .fc_changePageOnly").hide(),b.find("nav, ul, .fc_addPageOnly").show()):
(f={page_id:c.closest("li").find("input").val(),_cat_ajax:1},g=CAT_ADMIN_URL+"/pages/ajax_page_settings.php",c.closest("li").addClass("page_tree_open_options"),b.find(".fc_restorePageOnly, .fc_addPageOnly").hide(),b.find("nav, ul, .fc_changePageOnly").show());a.ajax({type:"POST",url:g,dataType:"json",data:f,cache:!1,beforeSend:function(b){a("#fc_addPage_keywords_ul").remove();a("#fc_add_page").is(":visible")&&a("#fc_add_page").stop().animate({width:"toggle"},200)},success:function(b,e,f){e=a("#fc_add_page");
var g='<option value="">['+cattranslate("None")+"]</option>";"deleted"==b.visibility?(e.find("nav, ul, .fc_changePageOnly, .fc_addPageOnly").hide(),e.find(".fc_restorePageOnly").show()):(null!==b.parent_list&&a.each(b.parent_list,function(a,b){g=g+'<option value="'+b.page_id+'"';g=!1===b.is_editable||!0===b.is_current||!0===b.is_direct_parent?g+' disabled="disabled">':g+">";for(var c=0;c<b.level;c++)g+="|-- ";g=g+b.menu_title+"</option>"}),f=a("#fc_addPage_parent").html(g),"undefined"!==typeof b.parent_id&&
""!==b.parent_id?f.children("option").prop("selected",!1).filter('option[value="'+b.parent_id+'"]').prop("selected",!0):a("#fc_addPage_parent option").prop("selected",!1).filter('option[value="'+b.parent+'"]').prop("selected",!0),a("#fc_addPage_title").val(b.menu_title),a("#fc_addPage_page_title").val(b.page_title),a("#fc_addPage_description").val(b.description),a("#fc_addPage_keywords").val(b.keywords),a("#fc_addPage_page_link").val(b.short_link),a("#fc_addPage_menu option").prop("selected",!1).filter('option[value="'+
b.menu+'"]').prop("selected",!0),a("#fc_addPage_target option").prop("selected",!1).filter('option[value="'+b.target+'"]').prop("selected",!0),a("#fc_default_template_variant").empty(),0<a(b.variants).size()?(a.each(b.variants,function(b,c){a("<option/>").val(c).text(c).appendTo("#fc_default_template_variant")}),"object"!==typeof b.template_variant&&0<b.template_variant.length&&(a('#fc_default_template_variant option[value="'+b.template_variant+'"]').prop("selected",!0),a("#fc_default_template_variant").val(b.template_variant)),
a("#fc_div_template_variants").show()):a("#fc_div_template_variants").hide(),!0===b.auto_add_modules?a("#fc_div_template_autoadd").show():a("#fc_div_template_autoadd").hide(),""===b.template?a("#fc_addPage_template option").prop("selected",!1).filter("option:first").prop("selected",!0):a("#fc_addPage_template option").prop("selected",!1).filter('option[value="'+b.template+'"]').prop("selected",!0),a("#fc_addPage_language option").prop("selected",!1).filter('option[value="'+b.language+'"]').prop("selected",
!0),a("#fc_addPage_visibility option").prop("selected",!1).filter('option[value="'+b.visibility+'"]').prop("selected",!0),a("#fc_addPage_Searching").prop("checked",b.searching),a("#fc_addPage_admin_groups input").each(function(){var c=a(this),d=c.val();-1==a.inArray(d,b.admin_groups)?c.prop("checked",!1):c.prop("checked",!0)}),a("#fc_addPage_allowed_viewers input").each(function(){var c=a(this),d=c.val();-1==a.inArray(d,b.viewing_groups)?c.prop("checked",!1):c.prop("checked",!0)}),a("#fc_addPage_keywords_ul").remove(),
a('<ul id="fc_addPage_keywords_ul" />').insertBefore(a("#fc_addPage_keywords")).tagit({allowSpaces:!0,singleField:!0,singleFieldDelimiter:",",singleFieldNode:a("#fc_addPage_keywords"),beforeTagAdded:function(a,b){b.tag.addClass("icon-tag")}}));c.is("button:reset")?e.animate({width:"hide"},300):e.animate({width:"toggle"},300)}})});b.find(".fc_toggle_tree").on("click",function(){var b=a(this).closest("li"),c=SESSION+b.prop("id");b.hasClass("fc_tree_open")?(b.removeClass("fc_tree_open").addClass("fc_tree_close"),
a.removeCookie(c,{path:"/"})):(b.addClass("fc_tree_open").removeClass("fc_tree_close"),a.cookie(c,"open",{path:"/"}))});b.find("li > a").mouseenter(function(){a(this).parent("li").addClass("fc_tree_hover")}).mouseleave(function(){a(this).parent("li").removeClass("fc_tree_hover")})})}})(jQuery);
(function(a){a.fn.page_treeSearch=function(b){var c={options_ul:a("#fc_search_page_options"),page_tree:a("#fc_page_tree_top"),defaultValue:a("#fc_search_page_tree_default")};b=a.extend(c,b);return this.each(function(){function c(d){var f=b.page_tree.find("li");f.removeClass("fc_activeSearch fc_inactiveSearch fc_matchedSearch");b.page_tree.removeHighlight();if(0<d.length)switch(f.addClass("fc_inactiveSearch"),f=a(".fc_activeSearchOption").index(),b.options_ul.slideDown(300),b.options_ul.find("li").each(function(){var b=
a(this);b.text(b.prop("title")+" "+d)}),b.options_ul.find("li").smartTruncation(),parseInt(f,10)){case 0:a("dd:containsi("+d+")").parents("li").addClass("fc_activeSearch").removeClass("fc_inactiveSearch");b.page_tree.highlight(d);b.page_tree.find(".highlight").closest("li").addClass("fc_matchedSearch");break;case 1:a("dd.fc_search_MenuTitle:containsi("+d+")").parents("li").addClass("fc_activeSearch").removeClass("fc_inactiveSearch");b.page_tree.highlight(d);b.page_tree.find(".highlight").closest("li").addClass("fc_matchedSearch");
break;case 2:a("dd.fc_search_PageTitle:containsi("+d+")").closest("li").addClass("fc_activeSearch fc_matchedSearch").removeClass("fc_inactiveSearch").parents("li").addClass("fc_activeSearch").removeClass("fc_inactiveSearch");break;case 3:a("dd.fc_search_SectionName:containsi("+d+")").closest("li").addClass("fc_activeSearch fc_matchedSearch").removeClass("fc_inactiveSearch").parents("li").addClass("fc_activeSearch").removeClass("fc_inactiveSearch");break;case 4:a("dd.fc_search_PageID").each(function(){current_search_item=
a(this);current_search_item.text()==d&&current_search_item.closest("li").addClass("fc_activeSearch fc_matchedSearch").removeClass("fc_inactiveSearch").parents("li").addClass("fc_activeSearch").removeClass("fc_inactiveSearch")});break;case 5:a("dd.fc_search_SectionID").each(function(){current_search_item=a(this);current_search_item.text()==d&&current_search_item.closest("li").addClass("fc_activeSearch fc_matchedSearch").removeClass("fc_inactiveSearch").parents("li").addClass("fc_activeSearch").removeClass("fc_inactiveSearch")})}else a(".fc_activeSearchOption").removeClass("fc_activeSearchOption"),
b.options_ul.find("li:first").addClass("fc_activeSearchOption"),b.options_ul.slideUp(300),a("#fc_searchOption").remove()}function d(){var d=b.options_ul.find(".fc_activeSearchOption").prop("id"),h=f.val();c(h);a('<div id="fc_searchOption" class="fc_br_all fc_border fc_gradient1 fc_gradient_hover"><span class="fc_br_left fc_gradient_blue">'+d+"</span><strong>"+h+"</strong></div>").prependTo("#fc_search_tree");a("#fc_searchOption").click(function(){c("");f.show().val("").focus()})}var f=a(this);f.val("").hide();
f.keyup(function(g){switch(g.keyCode){case 40:b.options_ul.find("li:last").hasClass("fc_activeSearchOption")||a(".fc_activeSearchOption").removeClass("fc_activeSearchOption").next("li").addClass("fc_activeSearchOption");c(f.val());break;case 38:b.options_ul.find("li:first").hasClass("fc_activeSearchOption")||a(".fc_activeSearchOption").removeClass("fc_activeSearchOption").prev("li").addClass("fc_activeSearchOption");c(f.val());break;case 13:d();f.val("").hide().blur();break;default:g=f.val(),""!==
g&&c(g)}});b.defaultValue.click(function(){b.defaultValue.hide();c("");f.show().val("").focus()});f.blur(function(){setTimeout(function(){var c=f.val();0===a("#fc_searchOption").size()&&""===c?b.defaultValue.show():0===a("#fc_searchOption").size()&&(d(),f.val("").hide());b.options_ul.slideUp(300)},300)});a("#fc_search_tree .fc_close").click(function(){c("");f.show().val("").focus()});b.options_ul.find("li").click(function(){a(".fc_activeSearchOption").removeClass("fc_activeSearchOption");a(this).addClass("fc_activeSearchOption");
d();b.options_ul.slideUp(300);f.hide().val("")})})}})(jQuery);
jQuery(document).ready(function(){$("#fc_sidebar, #fc_add_page").page_tree();$("#fc_search_page_tree").page_treeSearch();$("fc_page_tree_not_editable > a").click(function(a){a.preventDefault()});$("#fc_add_page").slideUp(0);$(".fc_side_home").click(function(a){a.preventDefault();window.open(CAT_URL)});$("#fc_addPageSubmit").click(function(a){a.preventDefault();$(this).closest("form");a=$(".page_tree_open_options");var b=[],c=[];$("#fc_addPage_admin_groups").children("input:checked").each(function(){b.push($(this).val())});$("#fc_addPage_viewers_groups").children("input:checked").each(function(){c.push($(this).val())});
var e={page_id:a.children("input[name=page_id]").val(),page_title:$("#fc_addPage_page_title").val(),menu_title:$("#fc_addPage_title").val(),page_link:$("#fc_addPage_page_link").val(),type:$("#fc_addPage_type option:selected").val(),parent:$("#fc_addPage_parent option:selected").val(),menu:$("#fc_addPage_menu option:selected").val(),target:$("#fc_addPage_target option:selected").val(),template:$("#fc_addPage_template option:selected").val(),variant:$("#fc_default_template_variant option:selected").val(),
language:$("#fc_addPage_language option:selected").val(),description:$("#fc_addPage_description").val(),keywords:$("#fc_addPage_keywords").val(),searching:$("#fc_addPage_Searching").is(":checked")?1:0,visibility:$("#fc_addPage_visibility option:selected").val(),page_groups:$("#fc_addPage_page_groups").val(),visibility:$("#fc_addPage_visibility option:selected").val(),auto_add_modules:$("#fc_template_autoadd").is(":checked")?1:0,admin_groups:b,viewing_groups:c,_cat_ajax:1};$.ajax({context:a,type:"POST",
url:CAT_ADMIN_URL+"/pages/ajax_add_page.php",dataType:"json",data:e,cache:!1,beforeSend:function(a){a.process=set_activity("Save page")},success:function(a,b,c){!0===a.success?(return_success(c.process,a.message),$(this),window.location.replace(a.url)):return_error(c.process,a.message)}})});$("#fc_savePageSubmit").click(function(a){a.preventDefault();$(this).closest("form");a=$(".page_tree_open_options");var b=[],c=[];$("#fc_addPage_admin_groups").children("input:checked").each(function(){b.push($(this).val())});
$("#fc_addPage_viewers_groups").children("input:checked").each(function(){c.push($(this).val())});var e={page_id:a.children("input[name=page_id]").val(),page_title:$("#fc_addPage_page_title").val(),menu_title:$("#fc_addPage_title").val(),parent:$("#fc_addPage_parent option:selected").val(),menu:$("#fc_addPage_menu option:selected").val(),target:$("#fc_addPage_target option:selected").val(),template:$("#fc_addPage_template option:selected").val(),template_variant:$("#fc_default_template_variant option:selected").val(),
language:$("#fc_addPage_language option:selected").val(),page_link:$("#fc_addPage_page_link").val(),description:$("#fc_addPage_description").val(),keywords:$("#fc_addPage_keywords").val(),searching:$("#fc_addPage_Searching").is(":checked")?1:0,visibility:$("#fc_addPage_visibility option:selected").val(),page_groups:$("#fc_addPage_page_groups").val(),visibility:$("#fc_addPage_visibility option:selected").val(),admin_groups:b,viewing_groups:c,_cat_ajax:1};$.ajax({context:a,type:"POST",url:CAT_ADMIN_URL+
"/pages/ajax_settings_save.php",dataType:"json",data:e,cache:!1,beforeSend:function(a){a.process=set_activity(cattranslate("Saving page"))},success:function(a,b,c){if(!0===a.success){return_success(c.process,a.message);b=$(this);c=$("#pageid_"+a.parent);var h=b.parent().closest("li");$("#fc_add_page button:reset").click();switch(a.visibility){case "public":var k="icon-screen";break;case "private":k="icon-key";break;case "registered":k="icon-users";break;case "hidden":k="icon-eye-2";break;case "deleted":k=
"icon-remove";break;default:k="icon-eye-blocked"}e.parent!=h.children("input[name=page_id]").val()&&(0===e.parent?$("#fc_page_tree_top").children("ul").append(b):0<c.children("ul").size()?(0===b.siblings("li").size()&&(h.removeClass("fc_tree_open"),h.find("ul").remove(),h.find(".fc_toggle_tree").remove()),b.appendTo(c.children("ul"))):(c.children(".fc_page_link").prepend('<span class="fc_toggle_tree" />'),$('<ul class="ui-sortable" />').appendTo(c).append(b)),c.parentsUntil("#fc_page_tree_top","li").andSelf().addClass("fc_expandable fc_tree_open").removeClass("fc_tree_close"));
b.children("dl").children(".fc_search_MenuTitle").text(a.menu_title);b.children("dl").children(".fc_search_PageTitle").text(a.page_title);b.children(".fc_page_link").children("a").children(".fc_page_tree_menu_title").removeClass().addClass("fc_page_tree_menu_title "+k).text(" "+a.menu_title);b.children(".fc_page_link > a:first").prop("title","Page title: "+a.page_title)}else return_error(c.process,a.message)}})});$("#fc_removePageSubmit").click(function(a){a.preventDefault();$(this).closest("form");
a=$(".page_tree_open_options");var b=a.find("input[name=page_id]").val(),c=$("div#fc_add_module").find('input[name="page_id"]').val(),e={page_id:b,_cat_ajax:1};dialog_confirm(cattranslate("Do you really want to delete this page?"),cattranslate("Remove page"),CAT_ADMIN_URL+"/pages/ajax_delete_page.php",e,"POST","JSON",!1,function(a,e,g){$("#fc_add_page input[type=reset]").click();e=$(this);g=e.prev();if(!0===a.success&&0===a.status){a=e.parent().parent().find(".fc_page_link").find(".fc_toggle_tree");
var h=e.parent().parent();e.remove();0===h.find("ul.ui-sortable").children("li").length&&a.remove()}else e.find(".fc_page_link").find(".fc_page_tree_menu_title").removeClass().addClass("fc_page_tree_menu_title icon-remove");$("#fc_add_page button:reset").click();c==b&&(location.href="undefined"!=typeof g?CAT_ADMIN_URL+"/pages/modify.php?page_id="+g.prop("id").replace("pageid_",""):CAT_ADMIN_URL+"/start/index.php")},a)});$("#fc_restorePageSubmit").click(function(a){a.preventDefault();$(this).closest("form");
a=$(".page_tree_open_options");var b={page_id:a.children("input[name=page_id]").val(),_cat_ajax:1};dialog_ajax("Restoring page",CAT_ADMIN_URL+"/pages/ajax_restore_page.php",b,"POST","JSON",!1,function(a,b,d){$("#fc_add_page input[type=reset]").click();b=$(this);!0===a.success?b.find(".fc_page_link").find(".fc_page_tree_menu_title").removeClass().addClass("fc_page_tree_menu_title icon-screen"):return_error(d.process,a.message)},a)});$("#fc_addPageChildSubmit").click(function(a){a.preventDefault();
$("#fc_addPage_parent_page_id").val($(".page_tree_open_options").children("input[name=page_id]").val());$(".fc_side_add").click()});$("select[id=fc_addPage_template]").change(function(){var a={_cat_ajax:1,template:$("#fc_addPage_template").val()};$.ajax({type:"POST",url:CAT_ADMIN_URL+"/settings/ajax_get_template_variants.php",dataType:"json",data:a,cache:!1,success:function(a,c,e){!0===a.success?($(this),$("#fc_default_template_variant").empty(),0<$(a.variants).size()?($.each(a.variants,function(a,
b){$("<option/>").val(b).text(b).appendTo("#fc_default_template_variant")}),$("#fc_div_template_variants").show()):$("#fc_div_template_variants").hide(),!0===a.auto_add_modules?($("#fc_template_autoadd").prop("checked","checked"),$("#fc_div_template_autoadd").show()):$("#fc_div_template_autoadd").hide()):return_error(e.process,a.message)}})});$("#fc_add_page_close").click(function(a){a.preventDefault();$("button#fc_addPageReset").click()})});var dlg_title=cattranslate("Your session has expired!"),dlg_text=cattranslate("Please enter your login details to log in again."),txt_username=cattranslate("Username"),txt_password=cattranslate("Password"),txt_login=cattranslate("Login"),txt_details=cattranslate("Please enter your login details!"),sessionTimeoutDialog=!1;
function sessionTimedOutDialog(){$("#sessionTimeoutDialog").dialog("close").dialog("destroy");$.ajax({type:"POST",url:CAT_ADMIN_URL+"/logout/index.php",dataType:"json",cache:!1,data:{_cat_ajax:1},success:function(a,b,c){}});var a=Math.random().toString(36).slice(2),b=Math.random().toString(36).slice(2),c={username_fieldname:"username_"+a,password_fieldname:"password_"+b,_cat_ajax:1,redirect:!1};$('<div id="sessionTimedOutDialog"></div>').html('<span class="icon icon-warning" style="color:#c00;"></span> '+
dlg_text+'<br /><br /><div id="login_error_field" style="display:none;color:#c00;padding:5px;"></div><br /><br /><form><label for="username" class="fc_label_200">'+txt_username+':</label><input type="text" name="username_'+a+'" id="username_'+a+'" /><br /><label for="pass" class="fc_label_200">'+txt_password+':</label><input type="password" name="password_'+b+'" id="password_'+b+'" /><br /><br />').dialog({modal:!0,closeOnEscape:!1,open:function(a,b){$(".ui-dialog-titlebar-close").hide()},title:dlg_title,
width:600,height:300,buttons:[{text:txt_login,icons:{primary:"ui-icon-check"},open:function(){$(this).keypress(function(a){a.keyCode==$.ui.keyCode.ENTER&&$(this).find(".ui-dialog-buttonset button").eq(0).trigger("click")})},click:function(){var e=$(this);""==$("#username_"+a).val()||""==$("#password_"+b).val()?(""==$("#username_"+a).val()&&$("#username_"+a).css("border","1px solid #c00"),""==$("#password_"+b).val()&&$("#password_"+b).css("border","1px solid #c00"),$("#login_error_field").text(txt_details).show()):
(c["username_"+a]=$("#username_"+a).val(),c["password_"+b]=$("#password_"+b).val(),$.ajax({type:"POST",url:CAT_ADMIN_URL+"/login/ajax_index.php",dataType:"json",data:c,cache:!1,success:function(a,b,c){!0===a.success?($(e).dialog("close").dialog("destroy"),sessionSetTimer(a.timer)):$("#login_error_field").text(a.message).show()}}))}}]}).on("keyup",function(a){13==a.keyCode&&$(".ui-button-text-icon-primary").click()});$(".ui-widget-overlay").css("background-image","none").css("background-color","#000").css("opacity",
"0.9")}function sessionSetTimer(a){var b=$("#fc_session_counter");"undefined"!=typeof a&&b.text(toTimeString(a));timerId=setInterval(function(){var a=TimeStringToSecs(b.text())-1;300>a&&b.parent().addClass("fc_gradient_red");5==a&&$("#fc_dlg_timer").css("color","#c00");0==a&&(clearInterval(timerId),sessionTimedOutDialog());b.text(toTimeString(a));$("span#fc_dlg_timer").text(a)},1E3)}jQuery(document).ready(function(a){sessionSetTimer()});


Fixed version (ground truth):
/*
       2014, Black Cat Development
   @link            http://blackcat-cms.org
   @license         http://www.gnu.org/licenses/gpl.html
   @category        CAT_Core
   @package         freshcat

*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,b,c){a instanceof String&&(a=String(a));for(var d=a.length,e=0;e<d;e++){var f=a[e];if(b.call(c,f,e,a))return{i:e,v:f}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};
$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,b,c,d){if(b){c=$jscomp.global;a=a.split(".");for(d=0;d<a.length-1;d++){var e=a[d];e in c||(c[e]={});c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&$jscomp.defineProperty(c,a,{configurable:!0,writable:!0,value:b})}};
$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,c){return $jscomp.findInternal(this,a,c).v}},"es6","es3");function getMethods(a){var b=[],c;for(c in a)try{"function"==typeof a[c]&&b.push(c+": "+a[c].toString())}catch(d){b.push(c+": inaccessible")}return b}
function dump(a,b){var c="";b||(b=0);for(var d="",e=0;e<b+1;e++)d+=" ";if("object"==typeof a)for(var f in a)e=a[f],"object"==typeof e?(c+=d+"'"+f+"' ...\n",c+=dump(e,b+1)):c+=d+"'"+f+"' => \""+e+'"\n';else c="===>"+a+"<===("+typeof a+")";return c};(function(a){a.fn.fc_set_tab_list=function(b){var c={toggle_speed:300,fc_list_forms:a(".fc_list_forms"),fc_list_add:a("#fc_list_add")};b=a.extend(c,b);return this.each(function(){var c=a(this),e=c.closest("ul").children("li"),f="fc_list_"+c.children("input").val(),g=a("#"+f),h=a("#fc_install_new");b.fc_list_forms.not(":first").slideUp(0);0===b.fc_list_add.size()?e.filter(":first").addClass("fc_active"):b.fc_list_add.unbind().click(function(){e.removeClass("fc_active");b.fc_list_forms.not(h).slideUp(0);
h.slideDown(0);h.find("ul.fc_groups_tabs a:first").click();h.find("input[type=text]:first").focus();jQuery("#addon_details").html("")});c.not(".fc_type_heading").click(function(){e.removeClass("fc_active");c.addClass("fc_active");b.fc_list_forms.not("#"+f).slideUp(0);g.slideDown(0);g.find("ul.fc_groups_tabs a:first").click();jQuery("#fc_add_new_module").hide()})})}})(jQuery);(function(a){a.fn.fc_toggle_element=function(b){b=a.extend({show_on_start:!1,toggle_speed:300},b);return this.each(function(){var c=a(this),d="show";if(c.is("select")){var e=c.children("option:selected"),f=match_class_prefix("show___",e);d="show";if("undefined"==typeof f||0===f.length)f=match_class_prefix("hide___",e),d="hide";"undefined"!=typeof f&&(g=a("#"+f));!1===b.show_on_start?g.slideUp(0).addClass("fc_inactive_element hidden").removeClass("fc_active_element"):g.slideDown(0).addClass("fc_active_element").removeClass("fc_inactive_element hidden");
c.change(function(){var d=c.children("option:selected"),e=match_class_prefix("show___",d),f="show";if("undefined"==typeof e||0===e.length)e=match_class_prefix("hide___",d),f="hide";"undefined"!=typeof e&&(g=a("#"+e));"show"==f?g.removeClass("hidden").slideUp(0).slideDown(b.toggle_speed,function(){g.addClass("fc_active_element").removeClass("fc_inactive_element")}):g.slideUp(b.toggle_speed,function(){g.addClass("fc_inactive_element hidden").removeClass("fc_active_element")})}).change()}else if(c.is("input:checkbox")||
c.is("input:radio")){var g=a("#"+c.prop("rel"));f=match_class_prefix("show___",c);d="show";if("undefined"==typeof f||0===f.length)f=match_class_prefix("hide___",c),d="hide";"undefined"!=typeof f&&(g=a("#"+f));"undefined"!=typeof g&&0<g.length&&(console.log(f+": "+d+" - "+c.prop("checked")),"show"==d&&c.prop("checked")?b.show_on_start=!0:"hide"==d&&c.prop("checked")?b.show_on_start=!1:"show"!=d||c.prop("checked")||(b.show_on_start=!1));!1===b.show_on_start?(console.log(f+" "+d+" - "+b.show_on_start),
g.addClass("fc_inactive_element hidden").slideUp(0).removeClass("fc_active_element")):g.slideDown(0).addClass("fc_active_element").removeClass("hidden fc_inactive_element");c.click(function(){c.prop("checked")&&"show"==d?g.removeClass("hidden").slideUp(0).slideDown(b.toggle_speed,function(){g.addClass("fc_active_element").removeClass("fc_inactive_element")}):g.slideUp(b.toggle_speed,function(){g.addClass("fc_inactive_element hidden").removeClass("fc_active_element")})})}})}})(jQuery);(function(a){a.fn.resize_elements=function(b){var c={sidebar:a("#fc_sidebar"),sidebar_content:a("#fc_sidebar_content"),main_content:a("#fc_main_content"),leftside:a("#fc_sidebar, #fc_content_container"),rightside:a("#fc_content_container, #fc_content_footer"),rightcontent:a("#fc_content_container"),overview_list:a("#fc_list_overview"),side_add:a("#fc_add_page"),media:a("#fc_media_browser"),bottomright:130,bottomleft:79};b=a.extend(c,b);return this.each(function(){var c=a(this);c.resize(function(){var e=
parseInt(c.height(),10),d=parseInt(c.width(),10),g=parseInt(b.sidebar.width(),10);b.main_content.css({maxHeight:e-b.bottomright+"px"});b.media.css({maxHeight:e-b.bottomright+"px"});b.leftside.height(e-b.bottomright+30);b.sidebar.height(e-b.bottomright+48);b.rightcontent.height(e-b.bottomleft);b.rightside.width(d-g);b.sidebar_content.height(e-b.bottomright+26);d=0<a("#fc_list_add").size()?58:30;b.overview_list.css({maxHeight:e-b.bottomright-d+"px"});b.side_add.css({left:g+"px",height:e-b.bottomright+
51+"px"})}).resize()})}})(jQuery);(function(a){a.fn.fc_show_popup=function(b){b=a.extend({functionOpen:!1},b);return this.each(function(){var b=a(this),d=match_class_prefix("form_",b),e=a("#"+d);b.unbind().click(function(){e.find(".fc_valid, .fc_invalid").removeClass("fc_invalid fc_valid");var b=e.find('input[name="form_title"]').val();buttonsOpts=[];0<e.find(".fc_confirm_bar").size()&&(e.find(".fc_confirm_bar input").each(function(){var b=a(this);if(b.hasClass("hidden"))var c=function(){},d="hidden";else"reset"==b.prop("type")?(c=
function(){e.find('input[type="reset"]').click();e.dialog("close")},d="reset"):(c=function(){e.submit()},d="submit");buttonsOpts.push({text:b.val(),click:c,"class":d})}),e.find(".fc_confirm_bar").hide());e.dialog({create:function(b,c){a(".ui-widget-header").removeClass("ui-corner-all").addClass("ui-corner-top")},open:function(a,b){"undefined"!=typeof functionOpen&&!1!==functionOpen&&functionOpen.call(this)},modal:!0,closeOnEscape:!0,title:b,minWidth:600,minHeight:400,buttons:buttonsOpts})})})}})(jQuery);function toTimeString(a){return(new Date(1E3*a)).toUTCString().match(/(\d\d:\d\d:\d\d)/)[0]}function TimeStringToSecs(a){a=a.split(":");return 3600*+a[0]+60*+a[1]+ +a[2]}
"undefined"!=typeof jQuery&&($.ajaxPrefilter(function(a,b,c){c.originalRequestOptions=b}),jQuery.ajaxSetup({error:function(a,b,c){0===a.status?alert("Not connected.\n Verify Network."):404==a.status?alert("Requested page not found. [404]"):500==a.status?alert("Internal Server Error [500]."):"parsererror"===c?alert("JSON parse failed."):"timeout"===c?alert("Time out error."):"abort"===c?alert("Ajax request aborted."):-1!=a.responseText.indexOf("fc_login_form")?location.href=CAT_ADMIN_URL+"/login/index.php":
a.responseText.match(/CSRF check failed/ig)?(alert(cattranslate("CSRF check failed. Maybe a token timeout. Trying to reload page.")),location.reload(!0)):a.responseText.match(/ACCESS DENIED!/ig)?(alert(cattranslate("Access denied! Maybe a missing entry in database table class_secure.")),location.reload(!0)):alert("Uncaught AJAX Error.\n"+a.responseText)}}));
(function(){for(var a,b=function(){},c="assert clear count debug dir dirxml error exception group groupCollapsed groupEnd info log markTimeline profile profileEnd table time timeEnd timeStamp trace warn".split(" "),d=c.length,e=window.console=window.console||{};d--;)a=c[d],e[a]||(e[a]=b)})();$.expr[":"].containsi=$.expr.createPseudo(function(a,b,c){return function(b){return-1<(b.textContent||b.innerText||$.text(b)).toLowerCase().indexOf(a.toLowerCase())}});
function isValidEmailAddress(a){return(new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i)).test(a)}function getThemeName(){return"freshcat"}
function getDatesFromQuerystring(a){var b=[];if(void 0!=a){a=a.split("&");for(var c=0;c<a.length;c++){var d=a[c].split("=");b.push(d[1]);b[d[0]]=d[1]}}return b}function match_class_prefix(a,b){b=b.prop("class").split(" ");a=new RegExp("^"+a+"(.+)","g");for(var c=0;c<b.length;c++){var d=a.exec(b[c]);if(null!==d)return d[1]}}
function togglePageTree(){if($("#fc_sidebar").is(":visible"))$("#fc_sidebar, #fc_sidebar_footer").css({width:0}).hide();else{var a="undefined"!=typeof $.cookie("sidebar")?$.cookie("sidebar"):200;$("#fc_sidebar, #fc_sidebar_footer").css({width:a}).show()}$(window).resize()}
function return_error(a,b){"undefined"!=typeof a&&a.slideUp(1200,function(){a.remove()});0===$(".fc_popup").size()&&$("#fc_admin_header").prepend('<div class="fc_popup" />');if("undefined"==typeof b||""==b)b="Unknown error";$(".fc_popup").html(b);b=set_popup_title();$(".fc_popup").dialog({modal:!0,show:"fade",closeOnEscape:!0,title:b,buttons:[{text:"Ok",click:function(){$(".fc_popup").dialog("destroy")},"class":"submit"}]})}
function return_success(a,b){"undefined"!=typeof b?(a.html(b).addClass("fc_active"),setTimeout(function(){a.slideUp(1200,function(){a.remove()})},5E3)):a.slideUp(1200,function(){a.remove()})}function set_activity(a){"undefined"==typeof a&&(a="Loading");var b=$('<div class="fc_process fc_gradient1 fc_border" />').appendTo("#fc_activity");b.slideUp(0,function(){b.html('<div class="fc_process_title">'+cattranslate(a)+'</div><div class="loader" />').slideDown(300)});return b}
function set_popup_title(){var a="undefined"!=typeof cattranslate?cattranslate("Notification"):"Notification";0<$(".fc_popup .fc_popup_header").size()&&(a=$(".fc_popup .fc_popup_header").text(),$(".fc_popup .fc_popup_header").remove());return a}
function dialog_confirm(a,b,c,d,e,f,g,h,k){0===$(".fc_popup").size()&&$("#fc_admin_header").prepend('<div class="fc_popup" />');"undefined"!=typeof cattranslate&&(a=cattranslate(a),b=cattranslate(b));$(".fc_popup").html(a);c="undefined"==typeof c||!1===c?alert("You sent an invalid url"):c;e="undefined"==typeof e||!1===e?"POST":e;f="undefined"==typeof f||!1===f?"JSON":f;k="undefined"==typeof k||!1===k?$("document.body"):k;b="undefined"==typeof b||!1===b?set_popup_title():b;buttonsOpts=[];d._cat_ajax=
1;buttonsOpts.push({text:cattranslate("Yes"),click:function(){$.ajax({type:e,context:k,url:c,dataType:f,data:d,cache:!1,beforeSend:function(a){a.process=set_activity(b);$(".fc_popup").dialog("destroy").remove();"undefined"!=typeof g&&!1!==g&&g.call(this,a)},success:function(a,b,c){!0===a.success||0<$(a).find(".fc_success_box").size()?return_success(c.process,a.message):return_error(c.process,a.message);"undefined"!=typeof h&&!1!==h&&h.call(this,a)}})},"class":"submit"});buttonsOpts.push({text:cattranslate("No"),
click:function(){$(".fc_popup").dialog("destroy")},"class":"reset"});$(".fc_popup").dialog({modal:!0,show:"fade",closeOnEscape:!0,title:b,buttons:buttonsOpts})}
function dialog_ajax(a,b,c,d,e,f,g,h){b="undefined"==typeof b||!1===b?alert("You send an invalid url"):b;d="undefined"==typeof d||!1===d?"POST":d;e="undefined"==typeof e||!1===e?"JSON":e;h="undefined"==typeof h||!1===h?$("document.body"):h;a="undefined"==typeof a||!1===a?set_popup_title():a;c._cat_ajax=1;$.ajax({type:d,url:b,dataType:e,context:h,data:c,beforeSend:function(b){$(".fc_popup").remove();b.process=set_activity(a);"undefined"!=typeof f&&!1!==f&&f.call(this)},success:function(a,b,c){return_success(c.process,
a.message);!0===a.success?"undefined"!=typeof g&&!1!==g&&g.call(this,a):return_error(c.process,a.message)}})}
function dialog_form(a,b,c,d,e){"undefined"==typeof d&&(d="json");a.submit(function(f){f.preventDefault();a.ajaxSubmit({context:a,dataType:d,beforeSerialize:function(a,b){"undefined"!=typeof e&&!1!==e&&e.call(this,a,b)},beforeSend:function(c,d,e){var f=0<a.find("input[name=fc_form_title]").size()?a.find("input[name=fc_form_title]").val():"Loading";c.process=set_activity(f);a.is(":data(dialog)")&&a.dialog("destroy");"undefined"!=typeof b&&!1!==b&&b.call(this,c,d,e)},success:function(a,b,d){!0===a.success?
(return_success(d.process,a.message),"undefined"!=typeof c&&!1!==c&&c.call(this,a,b,d)):return_error(d.process,a.message)},error:function(a,b,c){a.process.remove();console.log(a);console.log(b);console.log(c);alert(b+": "+c)}})})}function set_buttons(a){a.find(".fc_toggle_element").fc_toggle_element()}
function searchUsers(a){$("#fc_list_overview li").removeClass("fc_activeSearch").slideDown(0);0<a.length?($("#fc_list_overview li:containsi("+a+")").not(".fc_no_search").addClass("fc_activeSearch"),$("#fc_list_overview").hasClass("fc_settings_list")&&$(".fc_list_forms:containsi("+a+")").each(function(){var a=$(this).prop("id");$("input[value*="+a.substr(8)+"]").closest("li").addClass("fc_activeSearch")}),$("#fc_list_overview li").not(".fc_activeSearch").slideUp(300),1==$("#fc_list_overview li.fc_activeSearch").size()&&
$("#fc_list_overview li.fc_activeSearch").click()):$("#fc_list_overview li").not("fc_no_search").slideDown(300)}function confirm_link(a,b,c){var d="HTML";"undefined"!=typeof c&&(d="JSON");dialog_confirm(a,"Confirmation",b,!1,"GET",d,!1,function(){location.reload(!0)})}
jQuery(document).ready(function(){if("undefined"!==typeof $.cookie("sidebar")){var a=parseInt($(window).width(),10),b=$.cookie("sidebar");$("#fc_content_container, #fc_content_footer").css({width:a-b+"px"});$("#fc_sidebar_footer, #fc_sidebar, #fc_activity, #fc_sidebar_content").css({width:b+"px"})}$(window).resize_elements();set_buttons($("body"));b="undefined"!=typeof cattranslate?cattranslate("Search"):"Search";$("#fc_list_search input").livesearch({searchCallback:searchUsers,queryDelay:250,innerText:b,
minimumSearchLength:2});$(".fc_input_fake label").click(function(){var a=$(this).prop("for");$("#"+a).val("");searchUsers("")});$(".ajaxForm").each(function(){dialog_form($(this))});$("a.ajaxLink").click(function(a){a.preventDefault();a=$(this).prop("href");dialog_ajax("Saving",a,getDatesFromQuerystring(document.URL.split("?")[1]))});$("#fc_sidebar_footer, #fc_sidebar").resizable({handles:"e",minWidth:100,start:function(b,d){a=parseInt($(window).width(),10)},resize:function(b,d){$("#fc_content_container, #fc_content_footer").css({width:a-
d.size.width+"px"});$("#fc_sidebar_footer, #fc_sidebar, #fc_activity, #fc_sidebar_content").css({width:d.size.width+"px"});$("#fc_add_page").css({left:d.size.width+"px"})},stop:function(a,b){$.cookie("sidebar",b.size.width,{path:"/"})}});$("#fc_add_page_nav").find("a").click(function(){var a=$(this);a.hasClass("fc_active")||($("#fc_add_page").find(".fc_active").removeClass("fc_active"),a.addClass("fc_active"),a=a.attr("href"),$(a).addClass("fc_active"));return!1});$("#fc_footer_info").on("click",
"#fc_showFooter_info",function(){$(this).toggleClass("fc_active").parent("#fc_footer_info").children("ul").slideToggle(300)});$('[title!=""]').qtip({content:{attr:"title"},style:{classes:"qtip-light qtip-shadow qtip-rounded"}})});(function(a){a.fn.page_tree=function(b){b=a.extend({beforeSend:function(){},afterSend:function(){}},b);return this.each(function(){var b=a(this);1<b.find("li").size()&&b.find("ul").sortable({cancel:".ui-state-disabled",helper:"clone",handle:"div.fc_page_link",axis:"y",update:function(c,e){c={page_id:a(this).sortable("toArray"),table:"pages",_cat_ajax:1};a.ajax({type:"POST",url:CAT_ADMIN_URL+"/pages/ajax_reorder.php",dataType:"json",data:c,cache:!1,beforeSend:function(a){a.process=set_activity("Reorder pages")},
success:function(c,d,e){var f=a(this);a(".popup").dialog("destroy").remove();b.children("span").removeClass("fc_page_loader");!0===c.success?(return_success(e.process,c.message),f.slideUp(300,function(){f.remove()})):return_error(e.process,c.message)},error:function(b,c,e){a(".popup").dialog("destroy").remove();alert(c+": "+e)}})}});b.find(".fc_page_tree_options_open").add("#fc_add_page button:reset").on("click",function(b){b.preventDefault();var c=a(this);b=a("#fc_add_page");a(".page_tree_open_options").removeClass("page_tree_open_options");
if(c.is("input")||c.hasClass("fc_side_add")){var d={_cat_ajax:1,parent_id:a("#fc_addPage_parent_page_id").val()},g=CAT_ADMIN_URL+"/pages/ajax_get_dropdown.php";a("#fc_addPage_keywords").val("");b.find(".fc_restorePageOnly, .fc_changePageOnly").hide();b.find("nav, ul, .fc_addPageOnly").show()}else c.is("button:reset")?(d={_cat_ajax:1},g=CAT_ADMIN_URL+"/pages/ajax_get_dropdown.php",a("#fc_addPage_keywords").val(""),b.find(".fc_restorePageOnly, .fc_changePageOnly").hide(),b.find("nav, ul, .fc_addPageOnly").show()):
(d={page_id:c.closest("li").find("input").val(),_cat_ajax:1},g=CAT_ADMIN_URL+"/pages/ajax_page_settings.php",c.closest("li").addClass("page_tree_open_options"),b.find(".fc_restorePageOnly, .fc_addPageOnly").hide(),b.find("nav, ul, .fc_changePageOnly").show());a.ajax({type:"POST",url:g,dataType:"json",data:d,cache:!1,beforeSend:function(b){a("#fc_addPage_keywords_ul").remove();a("#fc_add_page").is(":visible")&&a("#fc_add_page").stop().animate({width:"toggle"},200)},success:function(b,e,d){e=a("#fc_add_page");
var f='<option value="">['+cattranslate("None")+"]</option>";"deleted"==b.visibility?(e.find("nav, ul, .fc_changePageOnly, .fc_addPageOnly").hide(),e.find(".fc_restorePageOnly").show()):(null!==b.parent_list&&a.each(b.parent_list,function(a,b){f=f+'<option value="'+b.page_id+'"';f=!1===b.is_editable||!0===b.is_current||!0===b.is_direct_parent?f+' disabled="disabled">':f+">";for(a=0;a<b.level;a++)f+="|-- ";f=f+b.menu_title+"</option>"}),d=a("#fc_addPage_parent").html(f),"undefined"!==typeof b.parent_id&&
""!==b.parent_id?d.children("option").prop("selected",!1).filter('option[value="'+b.parent_id+'"]').prop("selected",!0):a("#fc_addPage_parent option").prop("selected",!1).filter('option[value="'+b.parent+'"]').prop("selected",!0),a("#fc_addPage_title").val(b.menu_title),a("#fc_addPage_page_title").val(b.page_title),a("#fc_addPage_description").val(b.description),a("#fc_addPage_keywords").val(b.keywords),a("#fc_addPage_page_link").val(b.short_link),a("#fc_addPage_menu option").prop("selected",!1).filter('option[value="'+
b.menu+'"]').prop("selected",!0),a("#fc_addPage_target option").prop("selected",!1).filter('option[value="'+b.target+'"]').prop("selected",!0),a("#fc_default_template_variant").empty(),0<a(b.variants).size()?(a.each(b.variants,function(b,c){a("<option/>").val(c).text(c).appendTo("#fc_default_template_variant")}),"object"!==typeof b.template_variant&&0<b.template_variant.length&&(a('#fc_default_template_variant option[value="'+b.template_variant+'"]').prop("selected",!0),a("#fc_default_template_variant").val(b.template_variant)),
a("#fc_div_template_variants").show()):a("#fc_div_template_variants").hide(),!0===b.auto_add_modules?a("#fc_div_template_autoadd").show():a("#fc_div_template_autoadd").hide(),""===b.template?a("#fc_addPage_template option").prop("selected",!1).filter("option:first").prop("selected",!0):a("#fc_addPage_template option").prop("selected",!1).filter('option[value="'+b.template+'"]').prop("selected",!0),a("#fc_addPage_language option").prop("selected",!1).filter('option[value="'+b.language+'"]').prop("selected",
!0),a("#fc_addPage_visibility option").prop("selected",!1).filter('option[value="'+b.visibility+'"]').prop("selected",!0),a("#fc_addPage_Searching").prop("checked",b.searching),a("#fc_addPage_admin_groups input").each(function(){var c=a(this),e=c.val();-1==a.inArray(e,b.admin_groups)?c.prop("checked",!1):c.prop("checked",!0)}),a("#fc_addPage_allowed_viewers input").each(function(){var c=a(this),e=c.val();-1==a.inArray(e,b.viewing_groups)?c.prop("checked",!1):c.prop("checked",!0)}),a("#fc_addPage_keywords_ul").remove(),
a('<ul id="fc_addPage_keywords_ul" />').insertBefore(a("#fc_addPage_keywords")).tagit({allowSpaces:!0,singleField:!0,singleFieldDelimiter:",",singleFieldNode:a("#fc_addPage_keywords"),beforeTagAdded:function(a,b){b.tag.addClass("icon-tag")}}));c.is("button:reset")?e.animate({width:"hide"},300):e.animate({width:"toggle"},300)}})});b.find(".fc_toggle_tree").on("click",function(){var b=a(this).closest("li"),c=SESSION+b.prop("id");b.hasClass("fc_tree_open")?(b.removeClass("fc_tree_open").addClass("fc_tree_close"),
a.removeCookie(c,{path:"/"})):(b.addClass("fc_tree_open").removeClass("fc_tree_close"),a.cookie(c,"open",{path:"/"}))});b.find("li > a").mouseenter(function(){a(this).parent("li").addClass("fc_tree_hover")}).mouseleave(function(){a(this).parent("li").removeClass("fc_tree_hover")})})}})(jQuery);
(function(a){a.fn.page_treeSearch=function(b){var c={options_ul:a("#fc_search_page_options"),page_tree:a("#fc_page_tree_top"),defaultValue:a("#fc_search_page_tree_default")};b=a.extend(c,b);return this.each(function(){function c(c){c=c.replace(/(<([^>]+)>)/ig,"");var e=b.page_tree.find("li");e.removeClass("fc_activeSearch fc_inactiveSearch fc_matchedSearch");b.page_tree.removeHighlight();if(0<c.length)switch(e.addClass("fc_inactiveSearch"),e=a(".fc_activeSearchOption").index(),b.options_ul.slideDown(300),
b.options_ul.find("li").each(function(){var b=a(this);b.text(b.prop("title")+" "+c)}),b.options_ul.find("li").smartTruncation(),parseInt(e,10)){case 0:a("dd:containsi("+c+")").parents("li").addClass("fc_activeSearch").removeClass("fc_inactiveSearch");b.page_tree.highlight(c);b.page_tree.find(".highlight").closest("li").addClass("fc_matchedSearch");break;case 1:a("dd.fc_search_MenuTitle:containsi("+c+")").parents("li").addClass("fc_activeSearch").removeClass("fc_inactiveSearch");b.page_tree.highlight(c);
b.page_tree.find(".highlight").closest("li").addClass("fc_matchedSearch");break;case 2:a("dd.fc_search_PageTitle:containsi("+c+")").closest("li").addClass("fc_activeSearch fc_matchedSearch").removeClass("fc_inactiveSearch").parents("li").addClass("fc_activeSearch").removeClass("fc_inactiveSearch");break;case 3:a("dd.fc_search_SectionName:containsi("+c+")").closest("li").addClass("fc_activeSearch fc_matchedSearch").removeClass("fc_inactiveSearch").parents("li").addClass("fc_activeSearch").removeClass("fc_inactiveSearch");
break;case 4:a("dd.fc_search_PageID").each(function(){current_search_item=a(this);current_search_item.text()==c&&current_search_item.closest("li").addClass("fc_activeSearch fc_matchedSearch").removeClass("fc_inactiveSearch").parents("li").addClass("fc_activeSearch").removeClass("fc_inactiveSearch")});break;case 5:a("dd.fc_search_SectionID").each(function(){current_search_item=a(this);current_search_item.text()==c&&current_search_item.closest("li").addClass("fc_activeSearch fc_matchedSearch").removeClass("fc_inactiveSearch").parents("li").addClass("fc_activeSearch").removeClass("fc_inactiveSearch")})}else a(".fc_activeSearchOption").removeClass("fc_activeSearchOption"),
b.options_ul.find("li:first").addClass("fc_activeSearchOption"),b.options_ul.slideUp(300),a("#fc_searchOption").remove()}function e(){var e=b.options_ul.find(".fc_activeSearchOption").prop("id"),d=f.val();c(d);d=d.replace(/(<([^>]+)>)/ig,"");a('<div id="fc_searchOption" class="fc_br_all fc_border fc_gradient1 fc_gradient_hover"><span class="fc_br_left fc_gradient_blue">'+e+"</span><strong>"+d+"</strong></div>").prependTo("#fc_search_tree");a("#fc_searchOption").click(function(){c("");f.show().val("").focus()})}
var f=a(this);f.val("").hide();f.keyup(function(d){switch(d.keyCode){case 40:b.options_ul.find("li:last").hasClass("fc_activeSearchOption")||a(".fc_activeSearchOption").removeClass("fc_activeSearchOption").next("li").addClass("fc_activeSearchOption");c(f.val());break;case 38:b.options_ul.find("li:first").hasClass("fc_activeSearchOption")||a(".fc_activeSearchOption").removeClass("fc_activeSearchOption").prev("li").addClass("fc_activeSearchOption");c(f.val());break;case 13:e();f.val("").hide().blur();
break;default:d=f.val(),""!==d&&c(d)}});b.defaultValue.click(function(){b.defaultValue.hide();c("");f.show().val("").focus()});f.blur(function(){setTimeout(function(){var c=f.val();0===a("#fc_searchOption").size()&&""===c?b.defaultValue.show():0===a("#fc_searchOption").size()&&(e(),f.val("").hide());b.options_ul.slideUp(300)},300)});a("#fc_search_tree .fc_close").click(function(){c("");f.show().val("").focus()});b.options_ul.find("li").click(function(){a(".fc_activeSearchOption").removeClass("fc_activeSearchOption");
a(this).addClass("fc_activeSearchOption");e();b.options_ul.slideUp(300);f.hide().val("")})})}})(jQuery);
jQuery(document).ready(function(){$("#fc_sidebar, #fc_add_page").page_tree();$("#fc_search_page_tree").page_treeSearch();$("fc_page_tree_not_editable > a").click(function(a){a.preventDefault()});$("#fc_add_page").slideUp(0);$(".fc_side_home").click(function(a){a.preventDefault();window.open(CAT_URL)});$("#fc_addPageSubmit").click(function(a){a.preventDefault();$(this).closest("form");a=$(".page_tree_open_options");var b=[],c=[];$("#fc_addPage_admin_groups").children("input:checked").each(function(){b.push($(this).val())});
$("#fc_addPage_viewers_groups").children("input:checked").each(function(){c.push($(this).val())});var d={page_id:a.children("input[name=page_id]").val(),page_title:$("#fc_addPage_page_title").val(),menu_title:$("#fc_addPage_title").val(),page_link:$("#fc_addPage_page_link").val(),type:$("#fc_addPage_type option:selected").val(),parent:$("#fc_addPage_parent option:selected").val(),menu:$("#fc_addPage_menu option:selected").val(),target:$("#fc_addPage_target option:selected").val(),template:$("#fc_addPage_template option:selected").val(),
variant:$("#fc_default_template_variant option:selected").val(),language:$("#fc_addPage_language option:selected").val(),description:$("#fc_addPage_description").val(),keywords:$("#fc_addPage_keywords").val(),searching:$("#fc_addPage_Searching").is(":checked")?1:0,visibility:$("#fc_addPage_visibility option:selected").val(),page_groups:$("#fc_addPage_page_groups").val(),visibility:$("#fc_addPage_visibility option:selected").val(),auto_add_modules:$("#fc_template_autoadd").is(":checked")?1:0,admin_groups:b,
viewing_groups:c,_cat_ajax:1};$.ajax({context:a,type:"POST",url:CAT_ADMIN_URL+"/pages/ajax_add_page.php",dataType:"json",data:d,cache:!1,beforeSend:function(a){a.process=set_activity("Save page")},success:function(a,b,c){!0===a.success?(return_success(c.process,a.message),$(this),window.location.replace(a.url)):return_error(c.process,a.message)}})});$("#fc_savePageSubmit").click(function(a){a.preventDefault();$(this).closest("form");a=$(".page_tree_open_options");var b=[],c=[];$("#fc_addPage_admin_groups").children("input:checked").each(function(){b.push($(this).val())});
$("#fc_addPage_viewers_groups").children("input:checked").each(function(){c.push($(this).val())});var d={page_id:a.children("input[name=page_id]").val(),page_title:$("#fc_addPage_page_title").val(),menu_title:$("#fc_addPage_title").val(),parent:$("#fc_addPage_parent option:selected").val(),menu:$("#fc_addPage_menu option:selected").val(),target:$("#fc_addPage_target option:selected").val(),template:$("#fc_addPage_template option:selected").val(),template_variant:$("#fc_default_template_variant option:selected").val(),
language:$("#fc_addPage_language option:selected").val(),page_link:$("#fc_addPage_page_link").val(),description:$("#fc_addPage_description").val(),keywords:$("#fc_addPage_keywords").val(),searching:$("#fc_addPage_Searching").is(":checked")?1:0,visibility:$("#fc_addPage_visibility option:selected").val(),page_groups:$("#fc_addPage_page_groups").val(),visibility:$("#fc_addPage_visibility option:selected").val(),admin_groups:b,viewing_groups:c,_cat_ajax:1};$.ajax({context:a,type:"POST",url:CAT_ADMIN_URL+
"/pages/ajax_settings_save.php",dataType:"json",data:d,cache:!1,beforeSend:function(a){a.process=set_activity(cattranslate("Saving page"))},success:function(a,b,c){if(!0===a.success){return_success(c.process,a.message);b=$(this);c=$("#pageid_"+a.parent);var e=b.parent().closest("li");$("#fc_add_page button:reset").click();switch(a.visibility){case "public":var f="icon-screen";break;case "private":f="icon-key";break;case "registered":f="icon-users";break;case "hidden":f="icon-eye-2";break;case "deleted":f=
"icon-remove";break;default:f="icon-eye-blocked"}d.parent!=e.children("input[name=page_id]").val()&&(0===d.parent?$("#fc_page_tree_top").children("ul").append(b):0<c.children("ul").size()?(0===b.siblings("li").size()&&(e.removeClass("fc_tree_open"),e.find("ul").remove(),e.find(".fc_toggle_tree").remove()),b.appendTo(c.children("ul"))):(c.children(".fc_page_link").prepend('<span class="fc_toggle_tree" />'),$('<ul class="ui-sortable" />').appendTo(c).append(b)),c.parentsUntil("#fc_page_tree_top","li").andSelf().addClass("fc_expandable fc_tree_open").removeClass("fc_tree_close"));
b.children("dl").children(".fc_search_MenuTitle").text(a.menu_title);b.children("dl").children(".fc_search_PageTitle").text(a.page_title);b.children(".fc_page_link").children("a").children(".fc_page_tree_menu_title").removeClass().addClass("fc_page_tree_menu_title "+f).text(" "+a.menu_title);b.children(".fc_page_link > a:first").prop("title","Page title: "+a.page_title)}else return_error(c.process,a.message)}})});$("#fc_removePageSubmit").click(function(a){a.preventDefault();$(this).closest("form");
a=$(".page_tree_open_options");var b=a.find("input[name=page_id]").val(),c=$("div#fc_add_module").find('input[name="page_id"]').val(),d={page_id:b,_cat_ajax:1};dialog_confirm(cattranslate("Do you really want to delete this page?"),cattranslate("Remove page"),CAT_ADMIN_URL+"/pages/ajax_delete_page.php",d,"POST","JSON",!1,function(a,d,g){$("#fc_add_page input[type=reset]").click();d=$(this);g=d.prev();if(!0===a.success&&0===a.status){a=d.parent().parent().find(".fc_page_link").find(".fc_toggle_tree");
var e=d.parent().parent();d.remove();0===e.find("ul.ui-sortable").children("li").length&&a.remove()}else d.find(".fc_page_link").find(".fc_page_tree_menu_title").removeClass().addClass("fc_page_tree_menu_title icon-remove");$("#fc_add_page button:reset").click();c==b&&(location.href="undefined"!=typeof g?CAT_ADMIN_URL+"/pages/modify.php?page_id="+g.prop("id").replace("pageid_",""):CAT_ADMIN_URL+"/start/index.php")},a)});$("#fc_restorePageSubmit").click(function(a){a.preventDefault();$(this).closest("form");
a=$(".page_tree_open_options");var b={page_id:a.children("input[name=page_id]").val(),_cat_ajax:1};dialog_ajax("Restoring page",CAT_ADMIN_URL+"/pages/ajax_restore_page.php",b,"POST","JSON",!1,function(a,b,e){$("#fc_add_page input[type=reset]").click();b=$(this);!0===a.success?b.find(".fc_page_link").find(".fc_page_tree_menu_title").removeClass().addClass("fc_page_tree_menu_title icon-screen"):return_error(e.process,a.message)},a)});$("#fc_addPageChildSubmit").click(function(a){a.preventDefault();
$("#fc_addPage_parent_page_id").val($(".page_tree_open_options").children("input[name=page_id]").val());$(".fc_side_add").click()});$("select[id=fc_addPage_template]").change(function(){var a={_cat_ajax:1,template:$("#fc_addPage_template").val()};$.ajax({type:"POST",url:CAT_ADMIN_URL+"/settings/ajax_get_template_variants.php",dataType:"json",data:a,cache:!1,success:function(a,c,d){!0===a.success?($(this),$("#fc_default_template_variant").empty(),0<$(a.variants).size()?($.each(a.variants,function(a,
b){$("<option/>").val(b).text(b).appendTo("#fc_default_template_variant")}),$("#fc_div_template_variants").show()):$("#fc_div_template_variants").hide(),!0===a.auto_add_modules?($("#fc_template_autoadd").prop("checked","checked"),$("#fc_div_template_autoadd").show()):$("#fc_div_template_autoadd").hide()):return_error(d.process,a.message)}})});$("#fc_add_page_close").click(function(a){a.preventDefault();$("button#fc_addPageReset").click()})});var dlg_title=cattranslate("Your session has expired!"),dlg_text=cattranslate("Please enter your login details to log in again."),txt_username=cattranslate("Username"),txt_password=cattranslate("Password"),txt_login=cattranslate("Login"),txt_details=cattranslate("Please enter your login details!"),sessionTimeoutDialog=!1;
function sessionTimedOutDialog(){$("#sessionTimeoutDialog").dialog("close").dialog("destroy");$.ajax({type:"POST",url:CAT_ADMIN_URL+"/logout/index.php",dataType:"json",cache:!1,data:{_cat_ajax:1},success:function(a,b,c){}});var a=Math.random().toString(36).slice(2),b=Math.random().toString(36).slice(2),c={username_fieldname:"username_"+a,password_fieldname:"password_"+b,_cat_ajax:1,redirect:!1};$('<div id="sessionTimedOutDialog"></div>').html('<span class="icon icon-warning" style="color:#c00;"></span> '+
dlg_text+'<br /><br /><div id="login_error_field" style="display:none;color:#c00;padding:5px;"></div><br /><br /><form><label for="username" class="fc_label_200">'+txt_username+':</label><input type="text" name="username_'+a+'" id="username_'+a+'" /><br /><label for="pass" class="fc_label_200">'+txt_password+':</label><input type="password" name="password_'+b+'" id="password_'+b+'" /><br /><br />').dialog({modal:!0,closeOnEscape:!1,open:function(a,b){$(".ui-dialog-titlebar-close").hide()},title:dlg_title,
width:600,height:300,buttons:[{text:txt_login,icons:{primary:"ui-icon-check"},open:function(){$(this).keypress(function(a){a.keyCode==$.ui.keyCode.ENTER&&$(this).find(".ui-dialog-buttonset button").eq(0).trigger("click")})},click:function(){var d=$(this);""==$("#username_"+a).val()||""==$("#password_"+b).val()?(""==$("#username_"+a).val()&&$("#username_"+a).css("border","1px solid #c00"),""==$("#password_"+b).val()&&$("#password_"+b).css("border","1px solid #c00"),$("#login_error_field").text(txt_details).show()):
(c["username_"+a]=$("#username_"+a).val(),c["password_"+b]=$("#password_"+b).val(),$.ajax({type:"POST",url:CAT_ADMIN_URL+"/login/ajax_index.php",dataType:"json",data:c,cache:!1,success:function(a,b,c){!0===a.success?($(d).dialog("close").dialog("destroy"),sessionSetTimer(a.timer)):$("#login_error_field").text(a.message).show()}}))}}]}).on("keyup",function(a){13==a.keyCode&&$(".ui-button-text-icon-primary").click()});$(".ui-widget-overlay").css("background-image","none").css("background-color","#000").css("opacity",
"0.9")}function sessionSetTimer(a){var b=$("#fc_session_counter");"undefined"!=typeof a&&b.text(toTimeString(a));timerId=setInterval(function(){var a=TimeStringToSecs(b.text())-1;300>a&&b.parent().addClass("fc_gradient_red");5==a&&$("#fc_dlg_timer").css("color","#c00");0==a&&(clearInterval(timerId),sessionTimedOutDialog());b.text(toTimeString(a));$("span#fc_dlg_timer").text(a)},1E3)}jQuery(document).ready(function(a){sessionSetTimer()});