ACMS.Dispatch=function(context){var Config=ACMS.Config;var Dispatch=arguments.callee;Dispatch.Utility(context);$(Config.swfoMark,context).each(function(){Dispatch.swfobject(this)});if(ACMS.Config.eid){Dispatch.revisionIndex();Dispatch._revision()}$("a.updateTime",context).each(function(){Dispatch.updatetime(this)});$("a.updateDate",context).each(function(){Dispatch.updatedate(this)});$("#js-admin_action_box",context).each(function(){$("#adminBox",this).removeClass("js-dragAdminBox")});$(":not(#js-admin_action_box) .js-dragAdminBox",
context).each(function(){var $status=$.cookie("acms_config_admin_box_display_status");var $box=$(".js-dragAdminBox.normalBox");var $minBox=$(".js-dragAdminBox.minBox");$(this).draggable({cursor:"move",axis:"x",containment:"document",handle:".dragBoxHandle",opacity:0.7,drag:function(event,pr){var $disp="show";if($minBox.css("display")=="block")$disp="hide";$.cookie("acms_config_admin_box_display_status",$disp+":"+pr.position.left,{path:"/"})}});if($status){$status=$status.split(":");var $display=$status[0];
var $itemLeft=$status[1];if($display=="hide"){$minBox.css("left",parseInt($itemLeft));$box.hide();$minBox.show()}else{$box.css("left",parseInt($itemLeft));$minBox.hide();$box.show()}}else{$minBox.hide();$box.show()}});$(":not(#js-admin_action_box) .js-dragAdminBox .dragBoxToggle",context).each(function(){$(this).click(function(event){var $box=$(".js-dragAdminBox.normalBox");var $minBox=$(".js-dragAdminBox.minBox");var $status="show:10";if($box.css("display")=="block"){var $itemLeft=$box.position().left+
$box.width()-$minBox.width();if($itemLeft<0)$itemLeft=0;$minBox.css("left",$itemLeft);$box.slideUp(200,function(){$minBox.slideDown(200)});$status="hide:"+$itemLeft}else{var $itemLeft=$minBox.position().left-($box.width()-$minBox.width());if($itemLeft<0)$itemLeft=0;$box.css("left",$itemLeft);$minBox.slideUp(200,function(){$box.slideDown(200)});$status="show:"+$itemLeft}$.cookie("acms_config_admin_box_display_status",$status,{path:"/"})})});var $images=$(Config.ppMark,context),$caption;if($images.size()){if(Config.ppCaption2Title)$images.each(function(){$caption=
$(this).parent().find("p.caption");if($caption.size())$(this).attr("title",$caption.text())});$images.prettyPhoto(Config.ppConfig)}if($("pre").size()&&typeof ACMS.Library.googleCodePrettify==="function")ACMS.Library.googleCodePrettify();var $aImg=$(Config.adaptiveImageMark);if($aImg.size()){var resolved=false,$window=$(window);$aImg=$aImg.filter(function(){var $self=$(this),nowWidth=~~$self.attr("width"),baseWidth=~~$self.attr("data-width"),src=$self.attr("src");return!(nowWidth>=baseWidth)&&src.indexOf("tiny-")!==
-1});$window.resize(function(){if(!resolved&&$window.width()>Config.adaptiveImageSize){resolved=true;$aImg.each(function(i){var $self=$(this),width=~~$self.attr("data-width"),height=~~$self.attr("data-height"),src=$self.attr("src"),$div=$self.closest("div");if($div.get(0).className.indexOf("column-image-")!==-1)$div.css("width",width);$self.attr({width:width,height:height,src:src.replace("tiny-","")})})}}).resize()}$(Config.popupSettingMark,context).each(function(){$(this).parent(".acms-module-edit").parent().addClass("acms-module-edit-wrapper");
var $conf=Config.popupSettingConf;$(this).bind("click",function(){window.open(this.href,"popup_setting","width="+$conf.width+", height="+$conf.height+", status=no, scrollbars=yes");return false})});$.each(Config.hsArray.concat({mark:Config.hsMark,config:Config.hsConfig}),function(){Config.hsConfig=this.config;$(this.mark,context).each(function(){Dispatch.highslide(this)})});$(Config.ckeMark,context).each(function(){Dispatch.ckeditor(this)});$.each(Config.biggerlinkArray.concat({mark:Config.biggerlinkMark,
conf:Config.biggerlinkConf}),function(){Config.biggerlinkConf=this.conf;$(this.mark,context).each(function(){Dispatch.biggerlink(this)})});$.each(Config.bxsliderArray.concat({mark:Config.bxsliderMark,conf:Config.bxsliderConf}),function(){Config.bxsliderConf=this.conf;$(this.mark,context).each(function(){Dispatch.bxslider(this)})});$.each(Config.autoHeightConfArray.concat({mark:Config.autoHeightMark}),function(){$(this.mark,context).each(function(){Dispatch.autoheight()})});$.each(Config.dpicArray.concat({mark:Config.dpicMark,
config:Config.dpicConfig}),function(){Config.dpicConfig=this.config;$(this.mark,context).each(function(){Dispatch.datepicker(this)})});$(Config.fieldgroupSortableMark,context).each(function(){Dispatch.fieldgroupSortable(this)});$.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(){Dispatch.emoditor(this)})});var $s2dReady=$(ACMS.Config.s2dReadyMark,
context);if($s2dReady.size()){var region="";if(ACMS.Config.s2dRegion)region="&region="+ACMS.Config.s2dRegion;ACMS.Library.googleLoadProxy("maps","3",{callback:function(){$s2dReady.each(function(){Dispatch._static2dynamic(this)})},other_params:"sensor="+Config.Gmap.sensor+region})}$(Config.s2dMark,context).each(function(){Dispatch.static2dynamic(this)});var $s2dYolpReady=$(ACMS.Config.s2dYolpReadyMark,context);if($s2dYolpReady.size())ACMS.Library.yahooLoadProxy({callback:function(){$s2dYolpReady.each(function(){Dispatch._static2dynamic_yolp(this)})}});
$(Config.s2dYolpMark,context).each(function(){Dispatch.static2dynamic_yolp(this)});$.each(Config.accordionArray.concat({mark:Config.accordionMark,config:Config.accordionConfig}),function(){Config.accordionConfig=this.config;$(this.mark,context).each(function(){Dispatch.accordion(this)})});$.each(Config.tabsArray.concat({mark:Config.tabsMark,config:Config.tabsConfig}),function(){Config.tabsConfig=this.config;$(this.mark,context).each(function(){Dispatch.tabs(this)})});$.each(Config.acmsTabsArray.concat({mark:Config.acmsTabsMark,
config:Config.acmsTabsConfig}),function(){Config.acmsTabsConfig=this.config;$(this.mark,context).each(function(){Dispatch.acmsTabs(this)})});$(Config.acmsAlertCloseMark,context).each(function(){Dispatch.acmsAlertClose(this)});$.each(Config.acmsAlertCloseArray.concat({mark:Config.acmsAlertCloseMark,config:Config.acmsAlertCloseConfig}),function(){Config.acmsAlertCloseConfig=this.config;$(this.mark,context).each(function(){Dispatch.acmsAlertClose(this)})});$.each(Config.faderArray.concat({mark:Config.faderMark,
config:Config.faderConfig}),function(){Config.faderConfig=this.config;$(this.mark,context).each(function(){Dispatch.fader(this)})});$.each(Config.toggleArray.concat({mark:Config.toggleMark,config:Config.toggleConfig}),function(){Config.toggleConfig=this.config;$(this.mark,context).each(function(){Dispatch.toggle(this)})});try{if(ACMS.Config.admin==="entry-edit"&&ACMS.Config.webStorage==="on"&&typeof localStorage!="undefined"){var $key=$.cookie("acms_del_storage");if($key)if(ACMS.Config.webWtorageCapacity===
"limitless")if(ACMS.Config.webStorageType==="session")sessionStorage.removeItem($key);else if(ACMS.Config.webStorageType==="local")localStorage.removeItem($key);else{sessionStorage.clear();localStorage.clear()}else{sessionStorage.clear();localStorage.clear()}$.cookie("acms_del_storage",null)}}catch(e){}Dispatch.Postinclude(context);Dispatch.Linkmatchlocation(context);$(Config.validatorFormMark,context).each(function(){Dispatch.validator(this)});$(Config.rolloverImgMark,context).each(function(){Dispatch.rollover(this)});
$(Config.scrollToMark,context).each(function(){Dispatch.scrollto(this)});$(Config.select2textMark,context).each(function(){Dispatch.select2text(this)});$(Config.zebraMark,context).each(function(){Dispatch.zebra(this)});$(Config.placeholderMark,context).each(function(){Dispatch.placeholder(this)});if(!("placeholder"in document.createElement("input")))$("[placeholder]",context).each(function(){Dispatch.crossBrowserPlaceholder(this)});$(Config.hoverMark,context).each(function(){Dispatch.hover(this)});
$(Config.clickSelectionInputTextMark,context).each(function(){Dispatch.selection(this)});$(Config.countupMark,context).each(function(){Dispatch.countup(this)});$(Config.externalFormButtonMark,context).each(function(){Dispatch.ExternalSubmit(this)});var $viewing=$('a[href="'+encodeURI(document.location.href)+'"]',context);if($viewing.size()){$viewing.filter(Config.viewingMark).each(function(){if($(this).attr("id"))return true;if($(this).parent().attr("id"))return true;$(this).parent().attr("id",Config.viewingId);
$(this).parent().addClass(Config.viewingClass)});$viewing.filter(Config.viewingEraseMark).each(function(){var display=$(this).css("display");if(display.indexOf("block")!==-1)return true;$(this).after($(this).html());$(this).remove()})}var innerlinkPtn=new RegExp("https?://("+Config.domains.replace(/,/g,"|")+")/");$(Config.linkOutsideBlankMark,context).each(function(){if(innerlinkPtn.exec(this.href))return true;$(this).attr("target","_blank")});if("https:"==document.location.protocol)$(Config.linkHttpsDisablerMark,
context).each(function(){this.href=this.href.replace(/https:\/\//,"http://")});else $(Config.linkHttpsEnablerMark,context).each(function(){this.href=this.href.replace(/http:\/\//,"https://")});$(".selectLink",context).change(function(){var url=$(":selected",this).val(),admin;if(url!==""&&url.indexOf("http")===0){if(location.href.match(/admin\/(.*)$/)){admin=RegExp.$1;if(admin.match(/^[a-z]+_edit\//))admin=admin.replace(/^([a-z]+)_(edit\/.*)$/,"$1_index");url=url.replace(/admin\/.*$/,"admin/"+admin)}location.href=
url}}).show();if(Config.sid&&$.cookie(Config.session))$('a[href*="/'+Config.session+"/"+Config.sid+'"]',context).click(function(){this.href=this.href.replace("/"+Config.session+"/"+Config.sid,"/"+Config.session+"/"+$.cookie(Config.session))});if(Config.admin)if($(':input[name^="ACMS_POST_Entry_Insert"], :input[name^="ACMS_POST_Entry_Update"], :input[name^="ACMS_POST_Form2_Update"], :input[name^="ACMS_POST_Entry_Add"]',context).size()){Dispatch.Edit(context);if(Config.admin==="entry_editor")Dispatch.Admin(context)}else Dispatch.Admin(context);
if($(".js-edit_inplace",context).length)ACMS.Load.Dispatch.Edit._inplace(function(){Dispatch.Edit(context)});if($(".js-direct-unit",context).length){$(".js-direct-unit",context).unbind("click");$(".js-direct-unit",context).click(function(){ACMS.Dispatch.Edit._direct(this);return false})}};
ACMS.Dispatch.Linkmatchlocation=function(context){var Config=ACMS.Config;var Linkmatchlocation=arguments.callee;$.each(Config.linkMatchLocationArray.concat({mark:Config.linkMatchLocationMark,type:"part",className:Config.linkMatchLocationClass},{mark:Config.linkMatchLocationFullMark,type:"full",className:Config.linkMatchLocationFullClass},{mark:Config.linkMatchLocationBlogMark,type:"blog",className:Config.linkMatchLocationBlogClass},{mark:Config.linkMatchLocationCategoryMark,type:"category",className:Config.linkMatchLocationCategoryClass},
{mark:Config.linkMatchLocationEntryMark,type:"entry",className:Config.linkMatchLocationEntryClass}),function(){var mark=this.mark;var type=this.type;Config.linkMatchLocationClass=this.className;$(mark,context).each(function(){Linkmatchlocation[type](this)})})};
ACMS.Dispatch.Postinclude=function(context){var Config=ACMS.Config;var Postinclude=arguments.callee;$.each(Config.postIncludeArray.concat({mark:Config.postIncludeOnsubmitMark,type:"submit",method:Config.postIncludeMethod,effect:Config.postIncludeEffect,effectSpeed:Config.postIncludeEffectSpeed},{mark:Config.postIncludeOnreadyMark,type:"ready",method:Config.postIncludeMethod,effect:Config.postIncludeEffect,effectSpeed:Config.postIncludeEffectSpeed,delay:Config.postIncludeReadyDelay},{mark:Config.postIncludeOnBottomMark,
type:"bottom",method:Config.postIncludeMethod,effect:Config.postIncludeEffect,effectSpeed:Config.postIncludeEffectSpeed,offset:Config.postIncludeOffset},{mark:Config.postIncludeOnIntervalMark,type:"interval",method:Config.postIncludeMethod,effect:Config.postIncludeEffect,effectSpeed:Config.postIncludeEffectSpeed,interval:Config.postIncludeIntervalTime}),function(){var type=this.type;Config.postIncludeMethod=this.method;Config.postIncludeEffect=this.effect;Config.postIncludeEffectSpeed=this.effectSpeed;
if(type==="bottom")Config.postIncludeOffset=this.offset;if(type==="interval")Config.postIncludeIntervalTime=this.interval;if(type==="ready")Config.postIncludeReadyDelay=this.delay;$(this.mark,context).each(function(){Postinclude[type](this)})})};
ACMS.Dispatch.ExternalSubmit=function(elm){var form=elm;if("undefined"!=typeof form.returnValue)if(!form.returnValue)return false;var target=form;if(form.target){var $target=$(form.target);if(!$target.size())return false;target=$target[0]}if($(target).size()){form.target="_self";$(target).click(function(){form.submit()})}else return false};
ACMS.Dispatch.scrollto=function(elm){$(elm).click(function(){var hash=elm.hash.slice(1),$target;var offset=$(elm).data("offset");var $setting={};if(!(typeof offset!="number"&&typeof offset!="string"))$setting={offset:offset};if(!!hash){$target=$('[name="'+hash+'"]'+", "+"#"+hash);ACMS.Library.scrollToElm($target,$setting)}else ACMS.Library.scrollToElm(null,$setting);return false})};ACMS.Dispatch.biggerlink=function(elm){(function(conf){$(elm).biggerlink(conf)})(ACMS.Config.biggerlinkConf)};
ACMS.Dispatch.bxslider=function(elm){(function(conf){$(elm).bxSlider(conf)})(ACMS.Config.bxsliderConf)};ACMS.Dispatch.autoheight=function(){$(ACMS.Config.autoHeightConfArray).each(function(){for(var i in this)$(ACMS.Config.autoHeightMark+" "+i).autoheight({column:this[i],clear:1})})};ACMS.Dispatch.datepicker=function(elm){(function(config){$(elm).datepicker(config)})(ACMS.Config.dpicConfig)};ACMS.Dispatch.accordion=function(elm){(function(config){$(elm).accordion(config)})(ACMS.Config.accordionConfig)};
ACMS.Dispatch.tabs=function(elm){(function(config){$(elm).tabs(config)})(ACMS.Config.tabsConfig)};
ACMS.Dispatch.acmsTabs=function(elm){(function(config){var $tabs=$();var $panels=$();var $expr=$("a[href^=#]",elm);$expr.each(function(){var panel=$(this).attr("href");$tabs=$tabs.add(this);$panels=$panels.add($(panel));$(this).addClass(config.tabClass);$(this).click(function(){$tabs.removeClass(config.activeClass);$(this).addClass(config.activeClass);$panels.hide();$(panel).show();return false})});$panels.hide();$expr.filter(":first").click();if(config.readyMark!=""&&"undefined"!=typeof config.readyMark){$expr.filter("a[href="+
config.readyMark+"]").click();$expr.filter(config.readyMark).click()}})(ACMS.Config.acmsTabsConfig)};ACMS.Dispatch.acmsAlertClose=function(elm){(function(config){$(elm).click(function(){var $alert=$(this).parent(config.target);$alert.remove()})})(ACMS.Config.acmsAlertCloseConfig)};
ACMS.Dispatch.fader=function(elm){(function(config){var $head=$(elm);var $body=$(elm.href.replace(/^[^#]+/,""));if("hide"==config.initial){$body.not(config.readyMark).hide();if("none"!=$body.css("display"))$head.addClass(config.activeClass)}else if("show"==config.initial)$body.show();$head.click(function(){if("slide"==config.effect)if("none"==$body.css("display")){$head.addClass(config.activeClass);$body.slideDown(config.speed)}else{$head.removeClass(config.activeClass);$body.slideUp(config.speed)}else if("fade"==
config.effect)if("none"==$body.css("display")){$body.fadeIn(config.speed);$head.addClass(config.activeClass)}else{$body.fadeOut(config.speed);$head.removeClass(config.activeClass)}return false})})(ACMS.Config.faderConfig)};
ACMS.Dispatch.toggle=function(elm){(function(config){var $head=$(elm).find(config.toggleHead);var $ready=$(elm).find(config.readyMark);var $hide=$(elm).find(config.hideMark);$ready.show();$hide.hide();$head.click(function(){if($ready.css("display")=="none")$hide.fadeOut(config.speed,function(){$ready.fadeIn(config.speed)});else $ready.fadeOut(config.speed,function(){$hide.fadeIn(config.speed)});return false})})(ACMS.Config.toggleConfig)};
ACMS.Dispatch.swfobject=function(elm){if(!$("dl.flashvars, dl.params, dl.attributes, dl.embed",elm).size())return true;var flashvars=ACMS.Library.dl2object($("dl.flashvars",elm));var params=ACMS.Library.dl2object($("dl.params",elm));var attributes=ACMS.Library.dl2object($("dl.attributes",elm));var embed=ACMS.Library.dl2object($("dl.embed",elm));swfobject.embedSWF(embed.swfUrlStr,$(elm).attr("id"),embed.widthStr,embed.heightStr,embed.swfVersionStr,ACMS.Config.jsRoot+"swfobject/expressInstall.swf",
flashvars,params,attributes)};
ACMS.Dispatch.revisionIndex=function(context){$(".js-get_revisions").unbind().bind("click",function(){var $revisionBox=$("#js-revision_index");var eid=ACMS.Config.eid;var w=window.innerWidth?window.innerWidth:$(window).width();var h=window.innerHeight?window.innerHeight:$(window).height();$revisionBox.remove();$revisionBox=$($.parseHTML('<div id="js-revision_index"></div>')).appendTo("body");$revisionBox.css("position","absolute");$.ajax({type:"GET",url:ACMS.Library.acmsLink({eid:eid,tpl:"ajax/revision-index.html",
Query:{hash:Math.random().toString()}},true),dataType:"html",success:function(res){$raw=$($.parseHTML(res));$revisionBox.append($raw);var $top=(h-$revisionBox.height())/2+$(window).scrollTop();var $left=(w-$revisionBox.width())/2;if($top<0)$top=0;$revisionBox.fadeIn("fast").css({top:$top,left:$left});ACMS.Dispatch($revisionBox);$(".js-revision_close").attr("onclick","").val("\u9589\u3058\u308b").bind("click",function(){$revisionBox.hide();return false})}})})};
ACMS.Dispatch.updatedate=function(elm){$(elm).click(function(){$("#"+$(elm).attr("rel")).val(date());return false});function date(){var D=new Date;var Y=D.getFullYear().toString();var m=(D.getMonth()+1).toString();var d=D.getDate().toString();if(1>=m.length)m="0"+m;if(1>=d.length)d="0"+d;return Y+"-"+m+"-"+d}};
ACMS.Dispatch.updatetime=function(elm){$(elm).click(function(){$("#"+$(elm).attr("rel")).val(time());return false});function time(){var d=new Date;var h=d.getHours().toString();var m=d.getMinutes().toString();var s=d.getSeconds().toString();if(1>=h.length)h="0"+h;if(1>=m.length)m="0"+m;if(1>=s.length)s="0"+s;return h+":"+m+":"+s}};
ACMS.Dispatch.rollover=function(elm){$(elm).each(function(){var s=elm.src;var i=s.lastIndexOf(".");if(0>i)i=s.length;var o=s.substring(0,i)+ACMS.Config.rolloverImgSuffix+s.substring(i);(new Image).src=o;elm.s=s;elm.o=o;$(elm).hover(function(){this.src=this.o},function(){this.src=this.s})})};
ACMS.Dispatch.static2dynamic=function(elm){function s2dMap(){var region="";if(ACMS.Config.s2dRegion)region="&region="+ACMS.Config.s2dRegion;ACMS.Library.googleLoadProxy("maps","3",{callback:function(){ACMS.Dispatch._static2dynamic(elm)},other_params:"sensor="+ACMS.Config.Gmap.sensor+region})}$(elm).click(function(){s2dMap()});if(elm.width>ACMS.Config.s2dMaxSize)s2dMap()};ACMS.Dispatch.static2dynamic_yolp=function(elm){$(elm).click(function(){ACMS.Library.yahooLoadProxy({callback:function(){ACMS.Dispatch._static2dynamic_yolp(elm)}})})};
ACMS.Dispatch.validator=function(elm){$(ACMS.Config.validatorOverlookMark,elm).click(function(){$(this).addClass("js--clicked")});$(elm).submit(function(){return ACMS.Dispatch._validate(this)})};ACMS.Dispatch.select2text=function(elm){var self=elm;var aryValue=[];$elm=$(":selected",self);if(!$elm.size())$elm=$("option:first-child",self);$elm.each(function(){aryValue.push($(this).text())});$(self).replaceWith(aryValue.join(","))};
ACMS.Dispatch.zebra=function(elm){var tag=elm.tagName.toLowerCase();switch(tag){case "table":$("tr:nth-child(odd)",elm).addClass(ACMS.Config.zebraOddClass);$("tr:nth-child(even)",elm).addClass(ACMS.Config.zebraEvenClass);break;case "ul":case "ol":$("li:nth-child(odd)",elm).addClass(ACMS.Config.zebraOddClass);$("li:nth-child(even)",elm).addClass(ACMS.Config.zebraEvenClass);break;case "dl":$("dt:nth-child(odd)",elm).addClass(ACMS.Config.zebraOddClass);$("dt:nth-child(even)",elm).addClass(ACMS.Config.zebraEvenClass);
$("dd:nth-child(odd)",elm).addClass(ACMS.Config.zebraOddClass);$("dd:nth-child(even)",elm).addClass(ACMS.Config.zebraEvenClass);break}};
ACMS.Dispatch.placeholder=function(elm){var $self=$(elm);$.data(elm,"placeholder-string",$self.attr("title"));$.data(elm,"placeholder-color",$self.css("color"));switch($self.val()){case "":$self.val($.data(elm,"placeholder-string"));case $.data(elm,"placeholder-string"):$self.css("color",ACMS.Config.placeholderColor);break}$self.focus(function(){if($(this).val()==$.data(this,"placeholder-string")){$(this).val("");$(this).css("color",$.data(this,"placeholder-color"))}});$self.blur(function(){if($(this).val()==
""){$(this).val($.data(this,"placeholder-string"));$(this).css("color",ACMS.Config.placeholderColor)}});$self.parents().filter("form").submit(function(){if($self.val()==$.data(elm,"placeholder-string"))$self.val("");return true})};
ACMS.Dispatch.crossBrowserPlaceholder=function(elm){var $self=$(elm),placeholderText=$self.attr("placeholder"),placeholderColor="#999",defaultColor=$self.css("color");$self.focus(function(){if($self.val()===placeholderText)$self.val("").css("color",defaultColor)}).blur(function(){if($self.attr("type")!=="password"&&$self.val().replace(/[\s\t\n\r]/g,"")==="")$self.val(placeholderText).css("color",placeholderColor);else if($self.val()===placeholderText)$self.css("color",placeholderColor)}).blur().parents("form").submit(function(){if($self.val()===
placeholderText)$self.val("")})};ACMS.Dispatch.hover=function(elm){(function(className){$(elm).hover(function(){$(this).addClass(className)},function(){$(this).removeClass(className)})})(ACMS.Config.hoverClass)};ACMS.Dispatch.selection=function(elm){$(elm).click(function(){$(this).select();return false})};
ACMS.Dispatch.countup=function(elm){var tag=elm.tagName.toLowerCase();$(elm).bind("keydown keyup keypress change",function(){var thislength=$(this).val().length;var name=$(this).attr("name");var target=$(Config.countupMark+"-"+name);if($(this).attr("title").length>0&&$(this).attr("title")==$(this).val())thislength=0;target.html(thislength);var targetnum=$(this).attr("class").match(/countnum([0-9]+)/);if(targetnum!=null&&targetnum[1]>0&&Config.countupMarkOver.length>0)if(targetnum[1]<thislength&&$(this).hasClass(ACMS.Config.countupMarkOver)==
false){$(this).addClass(ACMS.Config.countupMarkOver);target.addClass(ACMS.Config.countupMarkOver)}else if(targetnum[1]>=thislength&&$(this).hasClass(ACMS.Config.countupMarkOver)==true){$(this).removeClass(ACMS.Config.countupMarkOver);target.removeClass(ACMS.Config.countupMarkOver)}});$(elm).trigger("change")};
ACMS.Dispatch.fieldgroupSortable=function(elm){var Config=ACMS.Config;var $sortable=$(elm);var $insert=$sortable.find(Config.fieldgroupSortableItemInsertMark);var $anchor=$sortable.find(Config.fieldgroupSortableItemTemplateMark);var $maxSize=$sortable.find(Config.fieldgroupSortableItemMaxMark).val();if($insert.size()&&$anchor.size()){var $template=$anchor.clone();$anchor.find(":input").attr("disabled","disabled");$anchor.hide();number($sortable);$insert.click(function(){if($maxSize==parseInt($maxSize)){var count=
$sortable.find(Config.fieldgroupSortableItemMark).size();if(count>$maxSize){alert(Config.fieldgroupSortableItemOverflowMessage1+$maxSize+Config.fieldgroupSortableItemOverflowMessage2);return false}}var $clone=$template.clone();var $map=$(".js-map-editable",$clone);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",$clone);if($yolp.size())ACMS.Library.yahooLoadProxy({callback:function(){$map.each(function(){ACMS.Dispatch.Edit.yolp(this)})}});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":$block.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(){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++})}};
