function wp_nav_menu_autocomplete(a){jQuery("#add-"+a+" .quick-search").autocomplete(jQuery("#add-"+a+" .autocomplete").val().split("|"));jQuery("#add-"+a+" .quick-search").result(function(b,d,c){jQuery("#add-"+a+" .list-wrap").css("display","block");jQuery("#add-"+a+" .list-wrap li:contains('"+d+"')").css("display","block");jQuery("#add-"+a+" .show-all").hide();jQuery("#add-"+a+" .hide-all").show()})}function wp_edit_menu_item(a){var f=jQuery("#menu-item-type"+a).val();var b=jQuery("#menu-item-title"+a).val();var g=jQuery("#menu-item-url"+a).val();var c=jQuery("#menu-item-attr-title"+a).val();var d=jQuery("#menu-item-target"+a).val();var h=jQuery("#menu-item-description"+a).val();var e=jQuery("#menu-item-classes"+a).val();var i=jQuery("#menu-item-xfn"+a).val();if("custom"!=f){jQuery("#edit-menu-item-url").attr("disabled","disabled")}jQuery("#edit-menu-item-id").val(a);jQuery("#edit-menu-item-title").val(b);jQuery("#edit-menu-item-url").val(g);jQuery("#edit-menu-item-attr-title").val(c);jQuery("#edit-menu-item-target").val(d);jQuery("#edit-menu-item-target option[value='"+d+"']").attr("selected","selected");jQuery("#edit-menu-item-description").val(h);jQuery("#edit-menu-item-classes").val(e);jQuery("#edit-menu-item-xfn").val(i);jQuery("#edit-menu-item-title").focus()}function wp_update_menu_item(){var h=jQuery("#edit-menu-item-id").val();var f=jQuery("#edit-menu-item-title").val();var b=jQuery("#edit-menu-item-url").val();var g=jQuery("#edit-menu-item-attr-title").val();var d=jQuery("#edit-menu-item-target").val();var c=jQuery("#edit-menu-item-description").val();var a=jQuery("#edit-menu-item-classes").val();var e=jQuery("#edit-menu-item-xfn").val();jQuery(".menu #menu-item"+h).find("span.item-title").html(f);jQuery(".menu #menu-item-title"+h).val(f);jQuery(".menu #menu-item-url"+h).val(b);jQuery(".menu #menu-item-attr-title"+h).val(g);jQuery(".menu #menu-item-target"+h).val(d);jQuery(".menu #menu-item-description"+h).val(c);jQuery(".menu #menu-item-classes"+h).val(a);jQuery(".menu #menu-item-xfn"+h).val(e);jQuery(".menu #menu-item"+h+" dt:first").animate({backgroundColor:"#FFFF33"},{duration:"normal",complete:function(){jQuery(this).css("backgroundColor","")}})}function wp_remove_menu_item(b){var a=document.getElementById("menu-item"+b);if(a){jQuery(a).find("dt").each(function(){jQuery(this).animate({backgroundColor:"#FF3333"},{duration:"normal",complete:function(){jQuery(this).parent().parent().remove()}})})}}function wp_add_item_to_menu(a,k,f,n,l,b,m,h,e,d,c,i){var j=wp_get_unique_menu_id();var g=wp_get_hidden_inputs(j,a,k,f,n,l,b,m,h,e,d,c,i);jQuery(".menu").append('
");jQuery(".menu #menu-item"+j+" dt:first").animate({backgroundColor:"#FFFF33"},{duration:"normal",complete:function(){jQuery(this).css("backgroundColor","")}});wp_drag_and_drop();tb_init("a.thickbox, area.thickbox, input.thickbox")}function wp_add_checked_items_to_menu(b){var a=jQuery(b).siblings(".list-wrap").find(":checked");if(0==a.length){return false}jQuery(a).each(function(){var h=jQuery(this).parent().siblings(".menu-item-type").val();if("custom"==h){var e=jQuery(this).parent().siblings(".menu-item-attr-title").val();var f=jQuery(this).parent().siblings(".menu-item-target").val();var g=jQuery(this).parent().siblings(".menu-item-classes").val();var j=jQuery(this).parent().siblings(".menu-item-xfn").val()}else{var e="";var f="_self";var g="";var j=""}var c=jQuery(this).parent().siblings(".menu-item-db-id").val();var k=jQuery(this).parent().siblings(".menu-item-object-id").val();var n=jQuery(this).parent().siblings(".menu-item-append").val();var l=jQuery(this).parent().siblings(".menu-item-parent-id").val();var d=jQuery(this).parent().siblings(".menu-item-title").val();var m=jQuery(this).parent().siblings(".menu-item-url").val();var i=jQuery(this).parent().siblings(".menu-item-description").val();if(undefined==i){i=""}wp_add_item_to_menu(c,k,h,n,l,d,m,i,e,f,g,j);jQuery(this).attr("checked",false)})}function wp_drag_and_drop(){jQuery(".menu li").each(function(){if(!jQuery(this).children(".dropzone").attr("class")){jQuery(this).prepend('')}});jQuery(".menu li").draggable({handle:" > dl",opacity:0.8,addClasses:false,helper:"clone",zIndex:100});jQuery(".menu li dl, .menu li .dropzone").droppable({accept:".menu li",tolerance:"pointer",drop:function(f,d){var a=jQuery(this).parent();var g=!jQuery(this).hasClass("dropzone");if(g&&a.children("ul").length==0){a.append('')}if(g){a.children("ul").append(d.draggable)}else{a.before(d.draggable)}a.find("dl,.dropzone").css({backgroundColor:"",borderColor:""});var c=d.draggable.attr("value");var b=a.attr("value");a.find("#menu-"+c).find("#parent"+c).val(b);jQuery(this).parent().find("dt").removeAttr("style");jQuery(this).parent().find("div:first").removeAttr("style")},over:function(){if(jQuery(this).attr("class")=="dropzone ui-droppable"){jQuery(this).parent().find("div:first").css("background","none").css("height","50px")}else{if(jQuery(this).attr("class")=="ui-droppable"){jQuery(this).parent().find("dt:first").css("background","#d8d8d8")}else{}}var a=jQuery(this).parent().attr("id")},out:function(){jQuery(this).parent().find("dt").removeAttr("style");jQuery(this).parent().find("div:first").removeAttr("style");jQuery(this).filter(".dropzone").css({borderColor:""})}})}function wp_update_post_data(){var a=0;jQuery(".menu li").each(function(c){c=c+1;var b=jQuery(this).attr("value");jQuery(this).find("#menu-item-position"+b).attr("value",c);jQuery(this).attr("id","menu-item"+c);jQuery(this).attr("value",c);jQuery(this).find("#menu-item-db-id"+b).attr("id","menu-item-db-id"+c);jQuery(this).find("#menu-item-object-id"+b).attr("id","menu-item-object-id"+c);jQuery(this).find("#menu-item-append"+b).attr("id","menu-item-append"+c);jQuery(this).find("#menu-item-type"+b).attr("id","menu-item-type"+c);jQuery(this).find("#menu-item-position"+b).attr("id","menu-item-position"+c);var d=jQuery(this).find("#menu-item-parent-id"+b).parent().parent().parent().attr("value");jQuery(this).find("#menu-item-parent-id"+b).attr("id","menu-item-parent-id"+c);if(d){}else{d=0}jQuery(this).find("#menu-item-parent-id"+b).attr("value",d);jQuery(this).find("#menu-item-title"+b).attr("id","menu-item-title"+c);jQuery(this).find("#menu-item-url"+b).attr("id","menu-item-url"+c);jQuery(this).find("#menu-item-description"+b).attr("id","menu-item-description"+c);jQuery(this).find("#menu-item-classes"+b).attr("id","menu-item-classes"+c);jQuery(this).find("#menu-item-xfn"+b).attr("id","menu-item-xfn"+c);jQuery(this).find("#menu-item-description"+b).attr("id","menu-item-description"+c);jQuery(this).find("#menu-item-attr-title"+b).attr("id","menu-item-attr-title"+c);jQuery(this).find("#menu-item-target"+b).attr("id","menu-item-target"+c);jQuery("#li-count").attr("value",c)})}function wp_get_unique_menu_id(){var d=jQuery(".menu li").length+1;var e=d;var a=0;try{var f=document.getElementById("menu-"+e.toString()).value}catch(c){a=1}while(a==0){e=e+1;try{var b=document.getElementById("menu-"+e.toString()).value}catch(c){a=1}}return e}function wp_get_hidden_inputs(j,a,k,f,n,l,b,m,h,e,d,c,i){var g="";g+='';g+='';g+='';g+='';g+='';g+='';g+='';g+='';g+='';g+='';g+='';g+='';g+='';return g}jQuery(document).ready(function(a){wp_drag_and_drop();a("#update-nav-menu .deletion").click(function(){if(confirm(navMenuL10n.warnDelete)){return true}else{return false}});a("#save_menu").click(function(){return wp_update_post_data()});a("#create-menu-name").keypress(function(b){if(13==b.keyCode){a("#create-menu-button").click();return false}});a("#custom-menu-item-url, #custom-menu-item-name").keypress(function(b){if(13==b.keyCode){a("#add-custom-links a.button").click();return false}}).focus(function(){if(a(this).val()==a(this).attr("defaultValue")&&a(this).attr("id")!="custom-menu-item-url"){a(this).val("")}}).blur(function(){if(a(this).val()==""){a(this).val(a(this).attr("defaultValue"))}});a("#create-menu-name").focus(function(){if(a(this).val()==a(this).attr("defaultValue")){a(this).val("")}}).blur(function(){if(a(this).val()==""){a(this).val(a(this).attr("defaultValue"))}});a(".if-js-closed").removeClass("if-js-closed").addClass("closed");postboxes.add_postbox_toggles("menus");a(".quick-search").click(function(){a(this).attr("value","")});a(".quick-search-submit").click(function(){a(this).siblings(".quick-search").search()});a("#menu-container .item-edit").click(function(){return wp_edit_menu_item(a(this).attr("value"))});a("#menu-container .item-delete").live("click",function(b){return wp_remove_menu_item(a(this).attr("value"))});a("#update-menu-item").click(function(){wp_update_menu_item();return tb_remove()});a("#cancel-save").click(function(){return tb_remove()});a(".show-all").click(function(b){jQuery(b.currentTarget).parent().siblings(".list-wrap").css("display","block");jQuery(b.currentTarget).parent().siblings(".list-wrap").find("li").css("display","block");jQuery(b.currentTarget).hide();jQuery(b.currentTarget).siblings(".hide-all").show()});a(".hide-all").click(function(b){jQuery(b.currentTarget).parent().siblings(".list-wrap").css("display","none");jQuery(b.currentTarget).parent().siblings(".list-wrap").find("li").css("display","none");jQuery(b.currentTarget).hide();jQuery(b.currentTarget).siblings(".show-all").show()});a(".add-to-menu").click(function(b){return wp_add_checked_items_to_menu(b.currentTarget)});a("#add-custom-links .add-to-menu a").click(function(b){if(a("#custom-menu-item-url").val()==a("#custom-menu-item-url").attr("defaultValue")){return}wp_add_item_to_menu(0,"","custom",navMenuL10n.custom,0,a("#custom-menu-item-name").val(),a("#custom-menu-item-url").val(),"","","_self","","");a("#custom-menu-item-name").val(a("#custom-menu-item-name").attr("defaultValue"));a("#custom-menu-item-url").val(a("#custom-menu-item-url").attr("defaultValue")).focus()})});