function PMA_adjustTotals(){var i=[PMA_messages.strB,PMA_messages.strKiB,PMA_messages.strMiB,PMA_messages.strGiB,PMA_messages.strTiB,PMA_messages.strPiB,PMA_messages.strEiB],a=$("#tablesForm table.data tbody:first tr"),c=a.size(),g=0,b=0,f=0,d=false;a.each(function(){var j=$(this),e=j.find(".tbl_rows").text();if(e.indexOf("~")==0){d=true;e=e.substring(1,e.length-1)}e=e.replace(/[,.]/g,"");e=parseInt(e,10);isNaN(e)||(g+=e);var o=e=0,n=$.trim(j.find(".tbl_size span:not(.unit)").text()),p=$.trim(j.find(".tbl_size span.unit").text()),
q=$.trim(j.find(".tbl_overhead span:not(.unit)").text());j=$.trim(j.find(".tbl_overhead span.unit").text());for(var l=0;l<i.length;l++)if(p==i[l]){n=parseFloat(n);e=n*Math.pow(1024,l);break}for(l=0;l<i.length;l++)if(j==i[l]){n=parseFloat(q);o=n*Math.pow(1024,l);break}b+=e;f+=o});a=g+"";for(var m=/(\d+)(\d{3})/;m.test(a);)a=a.replace(m,"$1,$2");if(d)a="~"+a;for(var h=m=0;b>=1024;){b/=1024;m++}for(;f>=1024;){f/=1024;h++}b=Math.round(b*10)/10;f=Math.round(f*10)/10;var k=$("#tbl_summary_row");k.find(".tbl_num").text($.sprintf(PMA_messages.strTables,
c));k.find(".tbl_rows").text(a);k.find(".tbl_size").text(b+" "+i[m]);k.find(".tbl_overhead").text(f+" "+i[h])}
$(document).ready(function(){var i;$("td.insert_table a.ajax").live("click",function(a){a.preventDefault();i=$(this);a=$(this).attr("href");if(a.substring(0,15)=="tbl_change.php?")a=a.substring(15);$("#insert_table_dialog").length>0&&$("#insert_table_dialog").remove();var c=$('<div id="insert_table_dialog"></div>'),g={};g[PMA_messages.strCancel]=function(){$(this).dialog("close").remove()};var b={};b[PMA_messages.strOK]=function(){$(this).dialog("close").remove()};var f=PMA_ajaxShowMessage();$.get("tbl_change.php",
a+"&ajax_request=true",function(d){if(d.success!=undefined&&d.success==false)c.append(d.error).dialog({title:PMA_messages.strInsertTable,height:230,width:900,modal:true,open:PMA_verifyColumnsProperties,buttons:b});else{d=c.append(d).dialog({title:PMA_messages.strInsertTable,height:600,width:900,modal:true,open:PMA_verifyColumnsProperties,buttons:g});d.find("#topmenucontainer").hide();d.find(".datefield, .datetimefield").each(function(){PMA_addDatepicker($(this))});$(".insertRowTable").addClass("ajax");
$("#buttonYes").addClass("ajax");c=$("#insert_table_dialog");PMA_convertFootnotesToTooltips(c)}PMA_ajaxRemoveMessage(f)})});$("#insertForm .insertRowTable.ajax input[type=submit]").live("click",function(a){a.preventDefault();a=$("#insertForm");$("#result_query").remove();PMA_prepareForAjaxRequest(a);$.post(a.attr("action"),a.serialize(),function(c){c.success==true?PMA_ajaxShowMessage(c.message):PMA_ajaxShowMessage(c.error,false);$("#insert_table_dialog").length>0&&$("#insert_table_dialog").dialog("close").remove();
i.closest("tr").find(".value.tbl_rows").html(c.row_count);PMA_adjustTotals()})});$("#buttonYes.ajax").live("click",function(a){a.preventDefault();a=$("#insertForm");var c=$("#insertForm").find("#actions_panel .control_at_footer option:selected").attr("value"),g=$("#insertForm").find("#actions_panel select[name=after_insert] option:selected").attr("value");$("#result_query").remove();PMA_prepareForAjaxRequest(a);$.post(a.attr("action"),a.serialize(),function(b){if(b.success==true){PMA_ajaxShowMessage(b.message);
if(c=="showinsert"){$(b.sql_query).insertAfter("#floating_menubar");$("#result_query .notice").remove();$("#result_query").prepend(b.message)}g=="new_insert"&&i.trigger("click")}else PMA_ajaxShowMessage(b.error,false);$("#insert_table_dialog").length>0&&$("#insert_table_dialog").dialog("close").remove();i.closest("tr").find(".value.tbl_rows").html(b.row_count);PMA_adjustTotals()})});$(".truncate_table_anchor").live("click",function(a){a.preventDefault();var c=$(this);a="TRUNCATE "+c.parents("tr").children("th").children("a").text();
c.PMA_confirm(a,c.attr("href"),function(g){PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);$.get(g,{is_js_confirmed:1,ajax_request:true},function(b){if(b.success==true){PMA_ajaxShowMessage(b.message);b=c.closest("tr");b.find(".tbl_rows").text("0");b.find(".tbl_size, .tbl_overhead").text("-");b=c.html().replace(/b_empty/,"bd_empty");c.replaceWith(b).removeClass("truncate_table_anchor");PMA_adjustTotals()}else PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest+" : "+b.error,false)})})});
$(".drop_table_anchor").live("click",function(a){a.preventDefault();a=$(this);var c=a.parents("tr"),g="DROP TABLE "+c.children("th").children("a").text();a.PMA_confirm(g,a.attr("href"),function(b){PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);$.get(b,{is_js_confirmed:1,ajax_request:true},function(f){if(f.success==true){PMA_ajaxShowMessage(f.message);toggleRowColors(c.next());c.hide("medium").remove();PMA_adjustTotals();window.parent&&window.parent.frame_navigation&&window.parent.frame_navigation.location.reload()}else PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest+
" : "+f.error,false)})})});$(".drop_tracking_anchor").live("click",function(a){a.preventDefault();a=$(this);var c=a.parents("tr");a.PMA_confirm(PMA_messages.strDeleteTrackingData,a.attr("href"),function(g){PMA_ajaxShowMessage(PMA_messages.strDeletingTrackingData);$.get(g,{is_js_confirmed:1,ajax_request:true},function(b){if(b.success==true){var f=c.parents("table"),d=c.find("td:nth-child(2)").text();if(f.find("tbody tr").length===1)$("#tracked_tables").hide("slow").remove();else{toggleRowColors(c.next());
c.hide("slow",function(){$(this).remove()})}$untracked_table=$("table#noversions");if($untracked_table.length>0){var m=$untracked_table.find("tbody tr");m.each(function(h){var k=$(this),j=k.find("td:first-child").text();h=h==m.length-1;if(j>d||h){h=k.clone();h.find("td:first-child").text(d);var e=h.find("td:nth-child(2) a").attr("href").replace("table="+j,"table="+encodeURIComponent(d));h.find("td:nth-child(2) a").attr("href",e);if(j>d){h.insertBefore(k);toggleRowColors(k);return false}else{h.insertAfter(k);
toggleRowColors(h)}}})}PMA_ajaxShowMessage(b.message)}else PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest+" : "+b.error,false)})})});$("#real_end_input").live("click",function(a){a.preventDefault();a=PMA_messages.strOperationTakesLongTime;$(this).PMA_confirm(a,"",function(){return true});return false})},"top.frame_content");
