ACMS.Dispatch.Admin=function(context){var Admin=arguments.callee;if(typeof Config==="undefined")var Config=ACMS.Config;if("config_unit"==ACMS.Config.admin)Admin.Configunit(context);$("input#checkAll").change(function(){$('input[type=checkbox][name="checks[]"]:not(:disabled)').prop("checked",this.checked)});$(".adminTable",context).not(".acms-table-admin-edit").each(function(){var $tr=$("tbody > tr",this);var $theadtd=$("thead td",this);$theadtd.hover(function(){$(this).addClass("hover")},function(){$(this).removeClass("hover")});
$tr.click(function(event){if($(event.target).find("td").andSelf().filter("td").size()){var $checkbox=$(":checkbox:checked",this);if($checkbox.size())$checkbox.prop("checked",false);else $('input[name="checks[]"]',this).not(":disabled").prop("checked","checked")}})});$(".js-acms-tooltip",context).click(function(){Admin._tooltip(this);return false});$(".js-acms-tooltip-hover",context).hover(function(){Admin._tooltip(this,true);return false},function(){Admin._tooltip(this,false);return false});var $media=
$("#js-media_drop_area",context);if($media.size())Admin._media($media.get(0));$(".js-incremental_search",context).each(function(){Admin.acmsIncrementalSearch(this,$(".js-incremental_search_box",context))});$(".js-acms_admin_tabs",context).each(function(){Admin.acmsAdminTabs(this)});$(".js-acms-tab-select",context).each(function(){Admin.acmsSelectTabs(this)});$(".js-acms-dropdown-toggle",context).each(function(){Admin.acmsDropdown(this)});$(".js-acms-color-picker",context).each(function(){Admin.acmsColorPicker(this)});
$("table.js-admin_sortable tbody",context).each(function(){$(".sorthandle .arrowHandle",this).show();$(this).sortable({handle:".sorthandle",axis:"y",zIndex:999,opacity:0.6})});if($(".stay").length){var $navi=$(".stay").offset().top-$(".acms-navbar").height();var $naviBar=$("#sidebar").height()-$(".acms-navbar").height()-100;if($navi>$naviBar)$("#sidebar").scrollTop($navi)}var $map=$(".js-map-editable",context);if($map.size()){var region="";if(ACMS.Config.s2dRegion)region="&region="+ACMS.Config.s2dRegion;
ACMS.Library.googleLoadProxy("maps","3",{callback:function(){$map.each(function(){ACMS.Dispatch.Edit.map(this)})},other_params:"sensor="+ACMS.Config.Gmap.sensor+region})}var $yolp=$(".js-yolp-editable",context);if($yolp.size())ACMS.Library.yahooLoadProxy({callback:function(){$map.each(function(){ACMS.Dispatch.Edit.yolp(this)})}});$("table#js-arg_reference .js-arg_reference_trigger",context).click(function(){var self=arguments.callee;var $trigger=$(this);var field=$trigger.attr("name");if(1&&field!=
"bid"&&field!="cid"&&field!="ccd"&&field!="eid"&&field!="uid"&&field!="ucd")return false;$().dialog();$trigger.attr("disabled","disabled");if("undefined"==typeof self.$popup)self.$popup={};if(0==$("#reference-"+field,context).length){var url=ACMS.Library.acmsLink({tpl:"ajax/arg-reference.html",Query:{scope:field,hash:Math.random()}},true);$.get(url,function(html){var $popup=$($.parseHTML('<div style="z-index:10" id="reference-'+field+'">'+html+"</div>"));$popup.dialog({title:"\u5f15\u6570\u3092\u5019\u88dc\u304b\u3089\u9078\u629e ( ESC \u304b \u00d7 \u30de\u30fc\u30af \u3067\u9589\u3058\u308b )",
closeOnEscape:true,draggable:false,resizable:false,position:["center","center"],width:480,height:320,modal:true});$("a.js-arg_reference_anchor",$popup).click(function(){$("input[name="+field+"]").val($(this).attr("href"));$popup.dialog("close");return false});self.$popup[field]=$popup;$(ACMS.Config.acmsTabsMark,$popup).each(function(){ACMS.Dispatch.acmsTabs(this)});$.each(self.$popup,function(){this.dialog("close")});self.$popup[field].dialog("open")})}else{$.each(self.$popup,function(){this.dialog("close")});
self.$popup[field].dialog("open")}$trigger.removeAttr("disabled");return false});$("#js-arg_guidance_name",context).each(function(){var tag=this.tagName.toLowerCase();switch(tag){case "select":$(this).change(function(){var module=$(this).val();if(module!==""){var guide=ACMS.Config.Admin.argGuidance[module];var axisGuide=ACMS.Config.Admin.axisGuidance[module];if(typeof guide!=="undefined"){$("input:text, input:checkbox",$('[id^="js-arg_guidance_"]')).attr("disabled","disabled");$('tr[id^="js-arg_guidance_"]').css("color",
"silver");$.each(guide,function(){$('[name^="'+this+'"]').removeAttr("disabled");$("tr#js-arg_guidance_"+this).css("color","black")})}else{$("input:text, input:checkbox",$('[id^="js-arg_guidance_"]')).removeAttr("disabled");$('tr[id^="js-arg_guidance_"]').css("color","black")}if(typeof axisGuide!=="undefined"){$("input:text, input:checkbox, select",$('[id^="js-axis_guidance_"]')).attr("disabled","disabled");$('tr[id^="js-axis_guidance_"]').css("color","silver");$.each(axisGuide,function(){$('[name^="'+
this+'"]').removeAttr("disabled");$("tr#js-axis_guidance_"+this).css("color","black")})}else{$("input:text, input:checkbox, select",$('[id^="js-axis_guidance_"]')).removeAttr("disabled");$('tr[id^="js-axis_guidance_"]').css("color","black")}}});$(this).change();break;case "td":var module=$(this).text();var guide=ACMS.Config.Admin.argGuidance[module];var axisGuide=ACMS.Config.Admin.axisGuidance[module];$('tr[id^="js-arg_guidance_"]').css("color","silver");$('tr[id^="js-axis_guidance_"]').css("color",
"silver");$.each(guide,function(){$("tr#js-arg_guidance_"+this).css("color","black")});$.each(axisGuide,function(){$("tr#js-axis_guidance_"+this).css("color","black")});break}});$(".switching-function-btn:not(:checked)",context).each(function(){$(this).closest("table").next("div").hide()});$(".switching-function-btn",context).click(function(){var box=$(this).closest("table").next("div");if($(this).prop("checked")===true)box.slideDown("fast");else box.slideUp("fast")});$(".js-acms_column_add_type",
context).each(function(){if($(this).val()!==""){var attr=$(this).attr("name");$('input[type=text][name="'+attr+'"]').attr("disabled","disabled").hide()}});$(".js-acms_column_add_type",context).change(function(){var attr=$(this).attr("name");if($(this).val()!=="")$('input[type=text][name="'+attr+'"]').attr("disabled","disabled").hide();else $('input[type=text][name="'+attr+'"]').removeAttr("disabled").show()});$(".js-load_hide_box").hide();var browser=ACMS.Dispatch.Utility.browser();$("#js-select_theme_action").bind(browser.ltIE8?
"click":"change",function(){var key=$(this).children(":selected").attr("id");$(".tplYamlTable").hide();$(".js-theme_"+key).show()});$("#js-index_list_tabs").each(function(){var $self=$(this).show(),$items=$self.find("a"),$tabs=$(".indexListCategory");$tabs.not(":first").hide();$items.each(function(i){$(this).click(function(){$items.removeClass("selected");$(this).addClass("selected");$tabs.hide();$($tabs.get(i)).show();$.cookie("lastClickedIndex",i);return false})});if($.cookie("lastClickedIndex")!=
null)$($items.get($.cookie("lastClickedIndex"))).click();else $items.first().click()});$("#js-entry_index_category_filter_dup").val($("#js-entry_index_category_filter").val());$("#js-entry_index_category_filter").change(function(){$("#js-entry_index_category_filter_dup").val($(this).val())});$(".formDisable").find(":input").attr("disabled","disabled");var $inpSubmit=$(".js-submitlock",context);if($inpSubmit.size())$inpSubmit.click(function(){$(this).bind("click",function(){alert("\u9001\u4fe1\u4e2d\u3067\u3059");
return false});return true});$(".js-admin_action_toggle").click(function(){if($.cookie("acms_config_admin_action_box")=="on"){$("#js-admin_action_box").fadeOut(400);$.cookie("acms_config_admin_action_box","",{path:"/"})}else{$("#js-admin_action_box").fadeIn(400);$.cookie("acms_config_admin_action_box","on",{path:"/"})}return false});$(".js-acms_entry_index_duplicate").click(function(){var $self=$(this);var $row=$self.parents("tr");var $id=$('[name^="checks"]',$row).val();var $form=document.createElement("form");
var $checks=document.createElement("input");var $submit=document.createElement("input");$checks.name="checks[]";$checks.value=$id;$checks.type="hidden";$submit.name="ACMS_POST_Entry_Index_Duplicate";$submit.value="duplicate";$submit.type="hidden";$form.method="post";$form.appendChild($checks);$form.appendChild($submit);document.body.appendChild($form);$form.submit();return false});$(".js-acms_entry_index_delete").click(function(){if(confirm("\u30b4\u30df\u7bb1\u306b\u79fb\u3057\u307e\u3059\u3002\n\u3088\u308d\u3057\u3044\u3067\u3059\u304b?")){var $self=
$(this);var $row=$self.parents("tr");var $id=$('[name^="checks"]',$row).val();var $form=document.createElement("form");var $checks=document.createElement("input");var $submit=document.createElement("input");$checks.name="checks[]";$checks.value=$id;$checks.type="hidden";$submit.name="ACMS_POST_Entry_Index_Trash";$submit.value="delete";$submit.type="hidden";$form.method="post";$form.appendChild($checks);$form.appendChild($submit);document.body.appendChild($form);$form.submit()}return false});$(".js-acms_entry_index_trash").click(function(){if(confirm("\u975e\u516c\u958b\u3067\u5fa9\u5143\u3057\u307e\u3059\u3002\n\u3088\u308d\u3057\u3044\u3067\u3059\u304b\uff1f?")){var $self=
$(this);var $row=$self.parents("tr");var $id=$('[name^="checks"]',$row).val();var $form=document.createElement("form");var $checks=document.createElement("input");var $submit=document.createElement("input");$checks.name="checks[]";$checks.value=$id;$checks.type="hidden";$submit.name="ACMS_POST_Entry_Index_TrashRestore";$submit.value="restore";$submit.type="hidden";$form.method="post";$form.appendChild($checks);$form.appendChild($submit);document.body.appendChild($form);$form.submit()}return false});
if($(".js-acms_fix_marker").length){var $offset=$(".js-acms_fix_marker").offset();var $target=$(".js-acms_fix_target");var $next=$target.next();var $bar=$target.height();var $top=$next.css("margin-top");$(window).scroll(function(){if($(window).scrollTop()>$offset.top-$bar-18){$target.addClass("fixed");$next.css("margin-top",$bar+14)}else if($(window).scrollTop()<$offset.top){$target.removeClass("fixed");$next.css("margin-top",$top)}})}$(Config.adminTableSortableMark,context).each(function(){ACMS.Dispatch.Admin.adminTableSortable(this)});
$(Config.fieldgroupSortableMarkForm,context).each(function(){ACMS.Dispatch.Admin.fieldgroupSortableForm(this)});$(Config.innerFieldgroupListMark,context).each(function(){ACMS.Dispatch.Admin.innerFieldgroupList(this)});if(window.name==="popup_setting_result"||window.name==="popup_setting"){$("#acms-main").css({"padding-left":"20px","padding-top":"5px"});$(".acms_fix_bg").css({"padding-left":0,top:0,left:"10px"});$(".acms-navbar-admin, #nav").hide();if(window.name==="popup_setting_result"){if(Config.popupSettingConf.autoreload)window.opener.location.reload();
if(Config.popupSettingConf.autoclose)window.close()}$("form",context).bind("submit",function(){if(window.name==="popup_setting")window.name="popup_setting_result"})}var $form=$("#submitProgress",context),$body=$("body",context),$img=$($.parseHTML('<img src="'+ACMS.Config.root+'themes/system/images/ajax-loader.gif" style="display:none;" />'));function showProgressLoader(){var $prog=$($.parseHTML('<div id="js-entry_saving_progress"><span>\u691c\u7d22\u3057\u3066\u3044\u307e\u3059...</span></div>'));
$prog.css({top:document.body.scrollTop||document.documentElement.scrollTop,left:document.body.scrollLeft||document.documentElement.scrollLeft});$img.appendTo($prog).show();$body.css("overflow","hidden").append($prog);if(!jQuery.support.opacity)$prog.show();else $prog.fadeIn(100);return true}$body.css({height:"100%"});$("html").css({height:"100%"});$body.append($img);$form.bind("submit",showProgressLoader)};
ACMS.Dispatch.Admin.acmsIncrementalSearch=function(elm,$input){var $target=$(elm);var $item=$(".search_element",elm);$input.keyup(function(){var search=this.value.split(" ");for(var i=0;i<$item.length;i++){var itemName=$($item[i]).text();if(itemName.match(new RegExp(search[0],"i"))){$($item[i]).show();if(search.length>1)for(var j=1;j<search.length;j++)if(!itemName.match(new RegExp(search[j],"i")))$($item[i]).hide()}else $($item[i]).hide()}return false});if($input.val().length)$input.keyup()};
ACMS.Dispatch.Admin.acmsAdminTabs=function(elm){var $tabs=$();var $panels=$();var $expr=$("a[href^=#]",elm);function buildTab(panel){var $panel=$(panel);var hash=panel.replace(/^#/,"");$panels.hide();$panel.show();$("#js-tooltip").remove();if(location.hash!=panel){$panel.attr("id","");location.hash=panel;$panel.attr("id",hash)}return false}$expr.each(function(){var panel=$(this).attr("href");$tabs=$tabs.add(this);$panels=$panels.add($(panel));$(this).addClass("js-acms_tab");$(this).click(function(){$tabs.removeClass("js-acms_tab-active");
$(this).addClass("js-acms_tab-active");buildTab(panel);return false})});$panels.hide();if(!location.hash){$expr.filter(":first").click();$expr.filter("a[href=js-ready-acms_tabs]").click();$expr.filter(".js-ready-acms_tabs").click()}else{buildTab(location.hash);$expr.filter("a[href="+location.hash+"]").addClass("js-acms_tab-active")}setTimeout(function(){$(window).scrollTop(0)},200)};
ACMS.Dispatch.Admin.acmsSelectTabs=function(elm){var $select=$(".js-acms-tab-select-value",elm);var $expr=$(".js-acms-tab-select-panel",elm);$select.change(function(){$expr.each(function(){$(this).removeClass("js-acms-tab-select-active")});var id="#"+$(this).val();$(id,elm).addClass("js-acms-tab-select-active")})};
ACMS.Dispatch.Admin.acmsDropdown=function(elm){$(".js-acms-dropdown-btn",elm).click(function(){var $open=$(".js-acms-dropdown-menu",elm).css("display");$(".js-acms-dropdown-menu",document).hide();if($open==="block")$(".js-acms-dropdown-menu",elm).hide();else $(".js-acms-dropdown-menu",elm).show();$(document).unbind("click.dropdonw");$(document).bind("click.dropdonw",function(){$(".js-acms-dropdown-menu",document).hide();$(document).unbind("click.dropdonw")});return false})};
ACMS.Dispatch.Admin.acmsColorPicker=function(elm){var settings={palette:["ffffff","ffccc9","ffce93","fffc9e","ffffc7","9aff99","96fffb","cdffff","cbcefb","cfcfcf","fd6864","fe996b","fffe65","fcff2f","67fd9a","38fff8","68fdff","9698ed","c0c0c0","fe0000","f8a102","ffcc67","f8ff00","34ff34","68cbd0","34cdf9","6665cd","9b9b9b","cb0000","f56b00","ffcb2f","ffc702","32cb00","00d2cb","3166ff","6434fc","656565","9a0000","ce6301","cd9934","999903","009901","329a9d","3531ff","6200c9","343434","680100","963400",
"986536","646809","036400","34696d","00009b","303498","000000","330001","643403","663234","343300","013300","003532","010066","340096"],field:".js-acms-color-picker-value"},$submit=$(".js-acms-color-picker-submit, .js-acms-color-picker-target",elm);var i=0,iz=settings.palette.length,color,select='<div style="background-color:#FFF;">',$pallete;for(;i<iz;i++){color=settings.palette[i];select+='<a style="display:block; float:left; width:30px; height:30px; margin:5px; border:solid 1px #444; cursor:pointer; background-color: #'+
color+'">&nbsp;</a>'}select+="</div>";$pallete=$($.parseHTML(select));$("a",$pallete).bind("click",function(){var hex_rgb=$(this).css("background-color"),r,g,b,hex_color;if(hex_rgb.match(/^rgb\((\d+),\s?(\d+),\s?(\d+)\)$/)){r=parseInt(RegExp.$1);g=parseInt(RegExp.$2);b=parseInt(RegExp.$3);if(r!==void 0){r=("00"+r.toString(16)).slice(-2).toUpperCase();g=("00"+g.toString(16)).slice(-2).toUpperCase();b=("00"+b.toString(16)).slice(-2).toUpperCase();hex_color="#"+r+g+b}}if(r===void 0)hex_color=hex_rgb.toUpperCase();
$submit.css("background-color",hex_rgb);$(settings.field).val(hex_color);$pallete.dialog("close")});$submit.bind("click",function(){$pallete.dialog({title:"\u8272\u3092\u9078\u629e",close:function(){$pallete.hide()}});$win_w=$(window).width();$pallete.dialog("option",{width:$win_w>320?430:280});$pallete.dialog("open");$pallete.dialog("widget").position({of:$submit,my:"left bottom",at:"right top",collision:"none"});return false})};
ACMS.Dispatch.Admin.innerFieldgroupList=function(elm){var Config=ACMS.Config;var $groupList=$(elm);var $insert=$groupList.find(Config.innerFieldgroupListInsertMark);var $anchor=$groupList.find(Config.innerFieldgroupListTemplateMask);var $input=$groupList.find(Config.innerFieldgroupListInputMask);$anchor.find(":input").attr("disabled","");var $template=$anchor.clone();$anchor.find(":input").attr("disabled","disabled");$anchor.hide();number($groupList);if($insert.size()&&$anchor.size())$insert.unbind("click").click(function(){var $clone=
$template.clone();$clone.removeClass(Config.innerFieldgroupListTemplateMask.substr(1));$clone.find(":input").not(Config.innerFieldgroupListDeleteMask).val("");$clone.show();$clone.find(Config.innerFieldgroupListDeleteMask).click(function(){$(this).parents(Config.innerFieldgroupListItemMask).remove();number($(this).parents(Config.innerFieldgroupListMark));return false});$anchor.before($clone);number($(this).parents(Config.innerFieldgroupListMark));ACMS.Dispatch.Admin($clone);return false});$groupList.find(Config.innerFieldgroupListDeleteMask).click(function(){$(this).parents(Config.innerFieldgroupListItemMask).remove();
number($(this).parents(Config.innerFieldgroupListMark));return false});var n=0;$groupList.find(Config.fieldgroupListItemMark).each(function(){if("none"==$(this).css("display"))return true;n++});if(!n){var $clone=$template.clone();$clone.removeClass(Config.innerFieldgroupListTemplateMask.substr(1));$(':input[name$="]"]',$clone).each(function(){this.name=this.name.replace(/\[\d*\]$/,"[0]")});if($anchor.hasClass("new-box"))$anchor.before($clone);ACMS.Dispatch.Admin($clone)}function number($groupList){var $rows=
$groupList.find(Config.innerFieldgroupListItemMask+":visible");var n=0;$rows.each(function(){$(':input[name$="]"]',this).each(function(){this.name=n+"-"+this.name});n++});n=0;$rows.each(function(){$(':input[name$="]"]',this).each(function(){top_num=this.name.match(/\[\d*\]/);this.name=this.name.replace(/\[\d*\]\[\d*\]/,top_num+"["+n+"]")});n++});n=0;$rows.each(function(){var regex=new RegExp("^"+n+"-");$(':input[name$="]"]',this).each(function(){this.name=this.name.replace(regex,"")});n++})}};
ACMS.Dispatch.Admin.adminTableSortable=function(elm){if($(elm).data("sort-enable")!=="on"){$(".item-handle",elm).hide();return false}var $adminTable=$("tbody",elm);var $submitName=$(elm).data("sort-submit");var $targetForm=$(elm).data("sort-target");var $entryOrder=$(elm).data("sort-order");var $isException=$(elm).hasClass("exceptionSort");var $firstSortNum=$("tbody > tr:first",elm).find(".sort-number").val();$adminTable.sortable({activate:function(event,ui){var level=ui.item.data("sort-level");sortableItem(ui,
level)},deactivate:function(event,ui){$("tr",elm).removeClass("ui-state-disabled")},update:function(event,ui){var level=ui.item.data("sort-level");sortnumber(level)},handle:".item-handle",items:"tr:not(.ui-state-disabled)"});function sortableItem(ui,level){$("tr",elm).each(function(){if($(this).data("sort-level")===level)$(this).removeClass("ui-state-disabled");else $(this).addClass("ui-state-disabled")});$adminTable.sortable({items:"tr:not(.ui-state-disabled)"});$adminTable.sortable("refresh")}function sortnumber(level){var number=
1;var increment=true;if($entryOrder){if($entryOrder==="sort-asc")increment=true;else if($entryOrder==="sort-desc")increment=false;number=parseInt($firstSortNum)}$("tr",elm).each(function(){if($(this).data("sort-level")===level){var selctName=$(this).data("sort-name");$("[name^='"+selctName+"']",this).val(number);$("[name^=checks]",this).attr("checked",true);if(increment)number++;else number--}});if($isException)$adminTable.sortable("cancel");$("<input />").attr("type","hidden").attr("name",$submitName).attr("value",
"save").appendTo($targetForm);$($targetForm).submit()}};
ACMS.Dispatch.Admin.fieldgroupSortableForm=function(elm){var Config=ACMS.Config;var $sortable=$(elm);var $insert=$sortable.find(Config.fieldgroupSortableItemInsertMark);var $anchor=$sortable.find(Config.fieldgroupSortableItemTemplateMark);if($insert.size()&&$anchor.size()){var $template=$anchor.clone();$anchor.find(":input").attr("disabled","disabled");$anchor.hide();number($sortable);$insert.click(function(){var $clone=$template.clone();var $addFormUnitTypeLabel=$("#formUnitType option:selected").text();
var $addFormUnitTypeValue=$("#formUnitType option:selected").val();if($addFormUnitTypeValue&&$addFormUnitTypeLabel&&$clone.find(".form-label")){$clone.find(".form-label").text($addFormUnitTypeLabel);$clone.find('input[name*="formbuild_type"]').val($addFormUnitTypeValue);switch($addFormUnitTypeValue){case "text":case "textarea":$clone.find(".select-value-box").hide();break;case "radio":case "select":case "multiSelect":case "checkbox":$clone.find(".textTypeOnly").hide();break;default:$clone.find(".inputFormBody").hide();
break}}$clone.removeClass(Config.fieldgroupSortableItemTemplateMark.substr(1));$clone.show();$clone.find(Config.fieldgroupSortableItemDeleteMark).click(function(){var msg=Config.fieldgroupSortableItemDeleteMessage;if(!msg.length||confirm(msg)){detouch($sortable);$(this).parents(Config.fieldgroupSortableItemMark).remove();number($sortable);touch($sortable)}return false});$anchor.before($clone);number($sortable);$clone.find(Config.fieldgroupSortableItemHandleMark).css("cursor","pointer");ACMS.Dispatch($clone);
return false});var n=0;$sortable.find(Config.fieldgroupSortableItemMark).each(function(){var $block=$(this);if($block.find(".form-type"))switch($block.find(".form-type").val()){case "text":case "textarea":$block.find(".select-value-box").hide();break;case "radio":case "select":case "multiSelect":case "checkbox":$block.find(".textTypeOnly").hide();break;default:$block.find(".inputFormBody").hide();break}if("none"==$(this).css("display"))return true;n++});if(!n){var $clone=$template.clone();$clone.removeClass(Config.fieldgroupSortableItemTemplateMark.substr(1));
$(':input[name$="]"]',$clone).each(function(){this.name=this.name.replace(/\[\d*\]/,"[0]")});ACMS.Dispatch($clone);$anchor.before($clone)}$sortable.find(Config.fieldgroupSortableItemDeleteMark).click(function(){var msg=Config.fieldgroupSortableItemDeleteMessage;if(!msg.length||confirm(msg)){detouch($sortable);$(this).parents(Config.fieldgroupSortableItemMark).remove();number($sortable);touch($sortable)}return false})}$sortable.find(Config.fieldgroupSortableItemHandleMark).css("cursor","pointer");
$sortable.sortable({items:Config.fieldgroupSortableItemMark,handle:Config.fieldgroupSortableItemHandleMark,axis:"y",start:function(event,ui){detouch($sortable)},stop:function(event,ui){number($sortable);touch($sortable);ACMS.Dispatch($sortable)}});function touch(context){$.each(Config.emoArray.concat({mark:Config.emoMark,toolbar:Config.emoToolbar,config:Config.emoConfig}),function(){Config.emoToolbar=this.toolbar;Config.emoConfig=this.config;$(this.mark,context).each(function(){ACMS.Dispatch.emoditor(this)})})}
function detouch(context){$("textarea",context).each(function(){var editor=$(this).data("emoditor");if(editor)editor.destroy();$(this).removeData("emoditor")});return context}function number($sortable){var $rows=$sortable.find(Config.fieldgroupSortableItemMark).not(Config.fieldgroupSortableItemTemplateMark);var n=0;$rows.each(function(){$(':input[name$="]"]',this).each(function(){this.name=n+"-"+this.name});n++});n=0;$rows.each(function(){$(':input[name$="]"]',this).each(function(){this.name=this.name.replace(/\[\d*\]/,
"["+n+"]")});n++});n=0;$rows.each(function(){var regex=new RegExp("^"+n+"-");$(':input[name$="]"]',this).each(function(){this.name=this.name.replace(regex,"")});n++})}};if(typeof Davis=="function");
