$(function(){function h(){var c,d,k,l;$("table.data").after(l=$('<table id="testTable" style="width:100%;"><tr><td>'+a+"</td></tr></table>"));k=$("#testTable").width();l.remove();d=($("table.data").width()-k)/i;if($("body").innerWidth()<$("table.data").width()+10||$("body").innerWidth()>$("table.data").width()+20){var g=0;$("table.data tbody tr td:nth-child(2)").each(function(){g=Math.max($(this).text().length,g)});d>0&&g<50||$("table.data tbody tr td:nth-child(2)").each(function(){if(d>0&&$(this).text().length>
g-d||d<0&&$(this).find("abbr.cutoff").length>0){if($(this).find("abbr.cutoff").length>0)c=$(this).find("abbr.cutoff").attr("title");else{c=$(this).text();if(c.length!=$(this).html().length)return 0}c.length<g-d?$(this).html(c):$(this).html('<abbr class="cutoff" title="'+c+'">'+c.substr(0,g-d-3)+"...</abbr>")}})}}function j(){var c=false,d;e=false;$("table.filteredData tbody tr").each(function(){d=$(this).children(":first");if(c||f==null||f.exec(d.text())){c=$(this).hasClass("diffSession")&&!c;e=!e;
$(this).css("display","");if(e){$(this).addClass("odd");$(this).removeClass("even")}else{$(this).addClass("even");$(this).removeClass("odd")}}else $(this).css("display","none")})}var f=null,e=false,a="abcdefghijklmnopqrstuvwxyz0123456789,ABCEFGHIJKLMOPQRSTUVWXYZ",b,i;editLink='<a href="#" class="editLink" onclick="return editVariable(this);">'+PMA_getImage("b_edit.png")+" "+PMA_messages.strEdit+"</a>";saveLink='<a href="#" class="saveLink">'+PMA_getImage("b_save.png")+" "+PMA_messages.strSave+"</a> ";
cancelLink='<a href="#" class="cancelLink">'+PMA_getImage("b_close.png")+" "+PMA_messages.strCancel+"</a> ";is_superuser&&$("table.data tbody tr td:nth-child(2)").hover(function(){$(this).parent().children("th").length>0&&!$(this).hasClass("edit")&&$(this).prepend(editLink)},function(){$(this).find("a.editLink").remove()});$("fieldset#tableFilter").css("display","");$("#filterText").keyup(function(){f=$(this).val().length==0?null:RegExp("(^| )"+$(this).val().replace(/_/g," "),"i");j()});if(location.hash.substr(1).split("=")[0]==
"filter"){b=location.hash.substr(1).split("=")[1];b.match(/[^0-9a-zA-Z_]+/)||$("#filterText").attr("value",b).trigger("keyup")}$("table.data").after(b=$("<span>"+a+"</span>"));i=b.width()/a.length;b.remove();$(window).resize(h);h()});
function editVariable(h){var j=$(h).parent().parent().find("th:first").first().text().replace(/ /g,"_"),f=$(saveLink),e=$(cancelLink),a=$(h).parent();a.addClass("edit");a.find("a.editLink").remove();f.click(function(){$.get("server_variables.php?"+url_query,{ajax_request:true,type:"setval",varName:j,varValue:a.find("input").attr("value")},function(b){if(b.success)a.html(b.variable);else{PMA_ajaxShowMessage(b.error,false);a.html(a.find("span.oldContent").html())}a.removeClass("edit")},"json");return false});
e.click(function(){a.html(a.find("span.oldContent").html());a.removeClass("edit");return false});$.get("server_variables.php?"+url_query,{ajax_request:true,type:"getval",varName:j},function(b){a.html('<span class="oldContent" style="display:none;">'+a.html()+"</span>");a.prepend('<table class="serverVariableEditTable" border="0"><tr><td></td><td style="width:100%;"><input type="text" id="variableEditArea" value="'+b+'" /></td></tr></table>');a.find("table td:first").append(f);a.find("table td:first").append(" ");
a.find("table td:first").append(e);$("input#variableEditArea").focus();$("input#variableEditArea").keydown(function(i){i.keyCode==13&&f.trigger("click");i.keyCode==27&&e.trigger("click")})});return false};
