jQuery(document).ready(function(a){var b,c,d,e,f,g=!1;c=function(){b=a("#media-items").sortable({items:"div.media-item",placeholder:"sorthelper",axis:"y",distance:2,handle:"div.filename",stop:function(){var b=a("#media-items").sortable("toArray"),c=b.length;a.each(b,function(b,d){var e=g?c-b:1+b;a("#"+d+" .menu_order input").val(e)})}})},d=function(){var b=a(".menu_order_input"),c=b.length;b.each(function(b){var d=g?c-b:1+b;a(this).val(d)})},e=function(b){b=b||0,a(".menu_order_input").each(function(){("0"===this.value||b)&&(this.value="")})},a("#asc").click(function(a){a.preventDefault(),g=!1,d()}),a("#desc").click(function(a){a.preventDefault(),g=!0,d()}),a("#clear").click(function(a){a.preventDefault(),e(1)}),a("#showall").click(function(b){b.preventDefault(),a("#sort-buttons span a").toggle(),a("a.describe-toggle-on").hide(),a("a.describe-toggle-off, table.slidetoggle").show(),a("img.pinkynail").toggle(!1)}),a("#hideall").click(function(b){b.preventDefault(),a("#sort-buttons span a").toggle(),a("a.describe-toggle-on").show(),a("a.describe-toggle-off, table.slidetoggle").hide(),a("img.pinkynail").toggle(!0)}),c(),e(),a("#media-items>*").length>1&&(f=wpgallery.getWin(),a("#save-all, #gallery-settings").show(),"undefined"!=typeof f.tinyMCE&&f.tinyMCE.activeEditor&&!f.tinyMCE.activeEditor.isHidden()?(wpgallery.mcemode=!0,wpgallery.init()):a("#insert-gallery").show())}),jQuery(window).unload(function(){window.tinymce=window.tinyMCE=window.wpgallery=null}),window.tinymce=null,window.wpgallery={mcemode:!1,editor:{},dom:{},is_update:!1,el:{},I:function(a){return document.getElementById(a)},init:function(){var a,b,c,d,e=this,f=e.getWin();if(e.mcemode){for(a=(""+document.location.search).replace(/^\?/,"").split("&"),b={},c=0;c