jQuery(document).ready(function(a){function d(f){a(this).val(f.data.span_type);a("#table_contents").undelegate("textarea","click",d);b()}function h(f){a(this).val(a(this).val()+f.data.html);a("#table_contents").undelegate("textarea","click",h);b()}function g(){edCanvas=this;a("#table_contents").undelegate("textarea","click",g);var f=a("#a-insert-image");tb_show(f.attr("title"),f.attr("href"),!1);tb_my_position();a(this).blur();b()}function b(){WP_Table_Reloaded_Admin.option_show_exit_warning&&(window.onbeforeunload=
function(){return WP_Table_Reloaded_Admin.str_saveAlert},a("#wp_table_reloaded_edit_table").undelegate("#table_name, textarea, .wp-table-reloaded-options input, .wp-table-reloaded-options select","change",b))}a("#a-hide-rows").click(function(){0==a('#table_contents tr:not(".table-foot") :checked').length?alert(WP_Table_Reloaded_Admin.str_UnHideRowsNoSelection):(a('#table_contents tr:not(".table-foot") :checked').removeAttr("checked").next().val(!0).parents("tr").addClass("row-hidden"),b());return!1});
a("#a-unhide-rows").click(function(){0==a('#table_contents tr:not(".table-foot") :checked').length?alert(WP_Table_Reloaded_Admin.str_UnHideRowsNoSelection):(a('#table_contents tr:not(".table-foot") :checked').removeAttr("checked").next().val(!1).parents("tr").removeClass("row-hidden"),b());return!1});a("#a-hide-columns").click(function(){0==a("#table_contents .table-foot :checked").length?alert(WP_Table_Reloaded_Admin.str_UnHideColsNoSelection):(a("#table_contents .table-foot :checked").removeAttr("checked").next().val(!0).each(function(){a("#table_contents ."+
this.id).addClass("column-hidden")}),b());return!1});a("#a-unhide-columns").click(function(){0==a("#table_contents .table-foot :checked").length?alert(WP_Table_Reloaded_Admin.str_UnHideColsNoSelection):(a("#table_contents .table-foot :checked").removeAttr("checked").next().val(!1).each(function(){a("#table_contents ."+this.id).removeClass("column-hidden")}),b());return!1});a("#button-insert-rows").click(function(){return 0==a('#table_contents tr:not(".table-foot") :checked').length?(alert(WP_Table_Reloaded_Admin.str_InsertRowsNoSelection),
!1):!0});a("#button-insert-columns").click(function(){return 0==a("#table_contents .table-foot :checked").length?(alert(WP_Table_Reloaded_Admin.str_InsertColsNoSelection),!1):!0});a("#a-add-colspan").click(function(){confirm(WP_Table_Reloaded_Admin.str_DataManipulationAddColspan)&&a("#table_contents").delegate("textarea","click",{span_type:"#colspan#"},d);return!1});a("#a-add-rowspan").click(function(){confirm(WP_Table_Reloaded_Admin.str_DataManipulationAddRowspan)&&a("#table_contents").delegate("textarea",
"click",{span_type:"#rowspan#"},d);return!1});var e=a(null);WP_Table_Reloaded_Admin.option_growing_textareas&&a("#table_contents").delegate("textarea","focus",function(){e.removeClass("focus");e=a(this).closest("tr").addClass("focus")});a("#options_custom_css").one("focus",function(){a(this).addClass("focus")});a("#export_format").change(function(){"csv"==a(this).val()?a(".tr-export-delimiter").show():a(".tr-export-delimiter").hide()}).change();var c=a(".wp-table-reloaded-table-information #table_id").val();
a(".wp-table-reloaded-table-information #table_id").change(function(){c!=a(this).val()&&(confirm(WP_Table_Reloaded_Admin.str_ChangeTableID)?(c=a(this).val(),b()):a(this).val(c))});a(".tr-import-addreplace input").click(function(){"replace"==a(".tr-import-addreplace input:checked").val()?a(".tr-import-addreplace-table").show():a(".tr-import-addreplace-table").hide()});a(".tr-import-addreplace input:checked").click();a(".tr-import-from input").click(function(){a(".tr-import-file-upload, .tr-import-url, .tr-import-form-field, .tr-import-server").hide();
a(".tr-import-"+a(".tr-import-from input:checked").val()).show()});a(".tr-import-from input:checked").click();a("#options_use_custom_css").change(function(){this.checked?a("#options_custom_css").removeAttr("disabled"):a("#options_custom_css").attr("disabled","disabled")});a("#options_enable_tablesorter").change(function(){this.checked?a("#options_tablesorter_script").removeAttr("disabled"):a("#options_tablesorter_script").attr("disabled","disabled")});WP_Table_Reloaded_Admin.option_tablesorter_enabled&&
WP_Table_Reloaded_Admin.option_datatables_active?(a("#table_options_first_row_th").change(function(){this.checked?a("#table_options_use_tablesorter").removeAttr("disabled").change():(a("#table_options_use_tablesorter").attr("disabled","disabled"),a(".wp-table-reloaded-datatables-options input").attr("disabled","disabled"))}),a("#table_options_use_tablesorter").change(function(){this.checked?(a(".wp-table-reloaded-datatables-options input").removeAttr("disabled"),a("#table_options_datatables_paginate").change()):
a(".wp-table-reloaded-datatables-options input").attr("disabled","disabled")}),a("#table_options_datatables_paginate").change(function(){this.checked?a("#table_options_datatables_paginate_entries").removeAttr("disabled"):a("#table_options_datatables_paginate_entries").attr("disabled","disabled")})):WP_Table_Reloaded_Admin.option_tablesorter_enabled&&a("#table_options_first_row_th").change(function(){this.checked?a("#table_options_use_tablesorter").removeAttr("disabled"):a("#table_options_use_tablesorter").attr("disabled",
"disabled")});a("#table_options_print_name, #table_options_print_description").change(function(){this.checked?a("#"+this.id+"_position").removeAttr("disabled"):a("#"+this.id+"_position").attr("disabled","disabled")});a("#options_uninstall_upon_deactivation").click(function(){if(this.checked)return confirm(WP_Table_Reloaded_Admin.str_UninstallCheckboxActivation)});a("#a-insert-link").click(function(){var b=prompt(WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertURL+":","http://");if(b){var c=
prompt(WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertText+":",WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertText);if(c){var d="";WP_Table_Reloaded_Admin.option_add_target_blank_to_links&&(d=' target="_blank"');(b=prompt(WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertExplain,'<a href="'+b+'"'+d+">"+c+"</a>"))&&a("#table_contents").delegate("textarea","click",{html:b},h)}}return!1});a("#a-insert-image").click(function(){confirm(WP_Table_Reloaded_Admin.str_DataManipulationImageInsertThickbox)&&
a("#table_contents").delegate("textarea","click",g);return!1});a("#insert_custom_field_name").keyup(function(){a(this).val(a(this).val().toLowerCase().replace(/[^a-z0-9_-]/g,""))});a(".focus-blur-change").focus(function(){a(this).attr("title")==a(this).val()&&a(this).val("")}).blur(function(){""==a(this).val()&&a(this).val(a(this).attr("title"))});a("#table_custom_fields").delegate("textarea","focus",function(){a("#table_custom_fields .focus").removeClass("focus");a(this).addClass("focus")});a("input.bulk_copy_tables").click(function(){return confirm(WP_Table_Reloaded_Admin.str_BulkCopyTablesLink)});
a("input.bulk_delete_tables").click(function(){return confirm(WP_Table_Reloaded_Admin.str_BulkDeleteTablesLink)});a("input.bulk_wp_table_import_tables").click(function(){return confirm(WP_Table_Reloaded_Admin.str_BulkImportwpTableTablesLink)});a("a.copy_table_link").click(function(){return confirm(WP_Table_Reloaded_Admin.str_CopyTableLink)});a("#wp-table-reloaded-list a.delete_table_link").click(function(){return confirm(WP_Table_Reloaded_Admin.str_DeleteTableLink)});a("#button-delete-rows").click(function(){var b=
a('#table_contents tr:not(".table-foot") :checkbox').length-1,c=a('#table_contents tr:not(".table-foot") :checked').length;return 0==c?(alert(WP_Table_Reloaded_Admin.str_DeleteRowsFailedNoSelection),!1):b==c?(alert(WP_Table_Reloaded_Admin.str_DeleteRowsFailedNotAll),!1):confirm(WP_Table_Reloaded_Admin.str_DeleteRowsConfirm)});a("#button-delete-columns").click(function(){var b=a("#table_contents .table-foot :checkbox").length,c=a("#table_contents .table-foot :checked").length;return 0==c?(alert(WP_Table_Reloaded_Admin.str_DeleteColsFailedNoSelection),
!1):b==c?(alert(WP_Table_Reloaded_Admin.str_DeleteColsFailedNotAll),!1):confirm(WP_Table_Reloaded_Admin.str_DeleteColsConfirm)});a("a.import_wptable_link").click(function(){return confirm(WP_Table_Reloaded_Admin.str_ImportwpTableLink)});a("#import_wp_table_reloaded_dump_file").click(function(){return confirm(WP_Table_Reloaded_Admin.str_ImportDumpFile)});a("#uninstall_plugin_link").click(function(){return confirm(WP_Table_Reloaded_Admin.str_UninstallPluginLink_1)?confirm(WP_Table_Reloaded_Admin.str_UninstallPluginLink_2):
!1});a("a.cf_shortcode_link").click(function(){prompt(WP_Table_Reloaded_Admin.str_CFShortcodeMessage,a(this).attr("title"));return!1});a("a.table_shortcode_link").click(function(){prompt(WP_Table_Reloaded_Admin.str_TableShortcodeMessage,a(this).attr("title"));return!1});a(".postbox h3, .postbox .handlediv").click(function(){a(a(this).parent().get(0)).toggleClass("closed")});WP_Table_Reloaded_Admin.option_show_exit_warning&&(a("#wp_table_reloaded_edit_table").delegate("#table_name, textarea, .wp-table-reloaded-options input, .wp-table-reloaded-options select",
"change",b),a("#wp_table_reloaded_edit_table").find('input[name="submit[update]"], input[name="submit[save_back]"]').click(function(){window.onbeforeunload=null}));a("#wp_table_reloaded_edit_table").find('input[name="submit[update]"], input[name="submit[save_back]"]').click(function(){a("#wp_table_reloaded_edit_table .wp-table-reloaded-options").find("input, select").removeAttr("disabled")});tb_init("a.help-link");tb_init("a.preview-link");tb_my_position()});
function send_to_editor(a){jQuery(edCanvas).val(jQuery(edCanvas).val()+a);tb_remove()}var tb_my_position;
(function(a){tb_my_position=function(){var d=a("#TB_window"),h=a(window).width(),g=a(window).height(),b=720<h?720:h,e=0;a("body.admin-bar").length&&(e=28);d.size()&&(d.width(b-50).height(g-45-e),a("#TB_iframeContent").width(b-50).height(g-75-e),d.css({"margin-left":"-"+parseInt((b-50)/2,10)+"px"}),"undefined"!=typeof document.body.style.maxWidth&&d.css({top:20+e+"px","margin-top":"0"}));return a("a.preview-link").each(function(){var c=a(this).attr("href");c&&(c=c.replace(/&width=[0-9]+/g,""),c=c.replace(/&height=[0-9]+/g,
""),a(this).attr("href",c+"&width="+(b-80)+"&height="+(g-85-e)))})};a(window).resize(function(){tb_my_position()})})(jQuery);