varwpNavMenu,WPNavMenuHandler=function(d){vari={},g=30,c=11,l=function(n,r,o,q){if(n&&n[0]){varp=d.parseJSON(n[0]);if(p.post_title){if(p.ID&&p.post_type){i[p.post_title]={ID:p.ID,object_type:p.post_type}}returnp.post_title}}},m=function(n,r,o,q){if(n&&n[0]){varp=d.parseJSON(n[0]);if(p.post_title){returnp.post_title}}},b=function(t,s){if(!t){returnfalse}s=s||document;varo=["menu-item-db-id","menu-item-object-id","menu-item-object","menu-item-parent-id","menu-item-position","menu-item-type","menu-item-append","menu-item-title","menu-item-url","menu-item-description","menu-item-attr-title","menu-item-target","menu-item-classes","menu-item-xfn"],n={},p=s.getElementsByTagName("input"),r=p.length,q;while(r--){q=o.length;while(q--){if(p[r]&&p[r].name&&"menu-item["+t+"]["+o[q]+"]"==p[r].name){n[o[q]]=p[r].value}}}returnn},a=function(){h.find(".menu-item-data-position").val(function(n){returnn+1})},f=function(n){returnn*g},j=function(n){returnMath.floor(n/g)},h,k,e;d.fn.extend({menuItemDepth:function(){returnj(this.eq(0).css("margin-left").slice(0,-2))},updateDepthClass:function(o,n){returnthis.each(function(){varp=d(this);n=n||p.menuItemDepth();d(this).removeClass("menu-item-depth-"+n).addClass("menu-item-depth-"+o)})},shiftDepthClass:function(n){returnthis.each(function(){varo=d(this),p=o.menuItemDepth();d(this).removeClass("menu-item-depth-"+p).addClass("menu-item-depth-"+(p+n))})},childMenuItems:function(){varn=d();this.each(function(){varo=d(this),q=o.menuItemDepth(),p=o.next();while(p.length&&p.menuItemDepth()>q){n=n.add(p);p=p.next()}});returnn},updateParentMenuItemDBId:function(){returnthis.each(function(){varp=d(this),n=p.find(".menu-item-data-parent-id"),q=p.menuItemDepth(),o=p.prev();if(q==0){n.val(0)}else{while(o.menuItemDepth()!=q-1){o=o.prev()}n.val(o.find(".menu-item-data-db-id").val())}})},hideAdvancedMenuItemFields:function(){returnthis.each(function(){varn=d(this);d(".hide-column-tog").not(":checked").each(function(){n.find(".field-"+d(this).val()).addClass("hidden-field")})})},selectItem:function(){returnthis.each(function(){d(this).addClass("selected-menu-item").next().children("input").attr("checked","checked")})},deselectItem:function(){returnthis.each(function(){d(this).removeClass("selected-menu-item").next().children("input").removeAttr("checked")})},toggleItem:function(){returnthis.each(function(){varn=d(this);if(n.hasClass("selected-menu-item")){n.deselectItem()}else{n.selectItem()}})},addSelectedToMenu:function(n){returnthis.each(function(){varo=d(this),q=o.find(".tabs-panel-active .categorychecklist li input:checked"),p=newRegExp("menu-item\\[([^\\]]*)");n=n||e.addMenuItemToBottom;if(!q.length){returnfalse}o.find("img.waiting").show();d(q).each(function(){vars=d(this),r=s.parent().prev();listItemDBIDMatch=p.exec(s.attr("name"));listItemDBID="undefined"==typeoflistItemDBIDMatch[1]?0:parseInt(listItemDBIDMatch[1],10);listItemData=b(listItemDBID);menuItem={};menuItem[listItemDBID]=listItemData;e.addItemToMenu(menuItem,n,function(){r.deselectItem()})});o.find("img.waiting").hide()})},});returne={init:function(){h=d("#menu-to-edit");k=h;this.attachMenuEditListeners();this.setupInputWithDefaultTitle();this.attachAddMenuItemListeners();this.attachQuickSearchListeners();this.attachTabsPanelListeners();this.attachHomeLinkListener();if(h.length){this.initSortables()}this.initToggles();this.initTabManager();this.initAddMenuItemDraggables();this.checkForEmptyMenu()},initToggles:function(){postboxes.add_postbox_toggles("nav-menus");columns.useCheckboxesForHidden();columns.checked=function(n){d(".field-"+n).removeClass("hidden-field")};columns.unchecked=function(n){d(".field-"+n).addClass("hidden-field")};h.hideAdvancedMenuItemFields()},initSortables:function(){vart=0,s,r,n,q=h.offset().left,u,p;h.sortable({handle:".menu-item-handle",placeholder:"sortable-placeholder",start:function(C,B){varw,A,z,x,y;p=B.item.children(".menu-item-transport");u=(B.helper.hasClass("new-menu-item"));s=(u)?0:B.item.menuItemDepth();o(B,s);if(!u){z=(B.item.next()[0]==B.placeholder[0])?B.item.next():B