ACMS.Dispatch=function(context){var Config=ACMS.Config;var Dispatch=arguments.callee;new ACMS.Dispatch.ModuleDialog("index");Dispatch.Utility(context);if(ACMS.Config.layout&&!ACMS.Dispatch.Layout.load)ACMS.Dispatch.Layout();$(Config.swfoMark,context).each(function(){Dispatch.swfobject(this)});if(ACMS.Config.eid){Dispatch.revisionIndex();Dispatch._revision()}$(ACMS.Config.resizeImageTargetMarkCF,context).each(function(){ACMS.Dispatch._imgresize(this)});$("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:"/"})})});$(".acms-admin-modal-show",context).each(function(){var target=$(this).data("target");var $target=$(context).find(target);if(!!$target.length){$target.addClass("out");$(this).click(function(){Dispatch.modal($target);return true})}});var $images=$(Config.ppMark,context),$caption;if($images.size()&&$(window).width()>Config.ppMinWindowSize&&
(!Config.ppDisableMobile||!ACMS.Dispatch.Utility.browser().mobile)&&(!Config.ppDisableTablet||!ACMS.Dispatch.Utility.browser().tablet)){if(Config.ppCaption2Title)$images.each(function(){$caption=$(this).parent().find("p.caption");if($caption.size())$(this).attr("title",$caption.text())});$images.prettyPhoto(Config.ppConfig)}else if(Config.ppWindowTarget)$images.attr("target",Config.ppWindowTarget);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-admin-module-edit").show().parent().addClass("acms-admin-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})});$(Config.moduleManagementMark,context).each(function(){$(this).parent(".acms-admin-module-edit").parent().addClass("acms-admin-module-edit-wrapper");$(this).bind("click",function(){var mid=$(this).data("mid"),bid=$(this).data("bid"),edit=isFinite(mid)?"update":"insert";var Dialog=new ACMS.Dispatch.ModuleDialog(edit);Dialog.show(mid,"",bid);return false})});var $moduleForm=$("#js-module_form");$(".js-module_form_trigger").unbind().bind("click",function(){$moduleForm.submit();return false});
$moduleForm.bind("submit",function(){var $form=$(this),$modalBody=$form.closest(".acms-admin-modal-body"),$modal=$modalBody.closest("#js-module_management"),$iframe=$('iframe[name="js-ajaxPostData"]');$iframe.unbind().bind("load",function(){var res=$iframe.contents(),$res=$(".acms-admin-modal-body",res);$modalBody.html($res.html());Dispatch($modal);$form[0].reset();if(!$(".acms-admin-alert.acms-admin-alert-danger").length&&!Config.layout)if(confirm(Config.moduleManagementReloadMsg))window.location.reload()})});
$(".js-acms-tooltip",context).click(function(){Dispatch._tooltip(this);return false});$(".js-acms-tooltip-hover",context).hover(function(){Dispatch._tooltip(this,true);return false},function(){Dispatch._tooltip(this,false);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.autoHeightRArray.concat({mark:Config.autoHeightRMark,
config:Config.autoHeightRConf}),function(){this.config.mark=this.mark;Config.autoHeightRConf=this.config;Dispatch.autoheightR()});$.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(1&&ACMS.Config.webStorage==="on"&&typeof localStorage!=="undefined"){var key=ACMS.Config.delStorage;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()}}}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.incrementalSearchMark,context).each(function(){Dispatch.incrementalSearch(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(Config.viewingNonTarget.some(function(v){return v===display}))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(1&&"https:"==document.location.protocol&&!location.href.match(/admin\/(.*)$/))$(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(ACMS.Config.resizeImage!=="on")$(Config.observeFileSizeMark,context).each(function(){Dispatch._observefilesize(this)});
if(Config.admin||$("#js-module_management").length)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.dispatchEvent("acmsDispatch")};
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);$(elm).show()})(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.autoheightR=function(){(function(conf){var timer=false,offset=conf.offset,style=conf.style==="height"?"height":"min-height",parent=conf.parent,element=conf.element,list=conf.list,mark=conf.mark;$(window).resize(function(){if(timer!==false)clearTimeout(timer);timer=setTimeout(function(){var $boxAry=$(mark),currentWidth=0,maxHeight=0,rowAry=[];if(element.length>0)$(element).css(style,"auto");else $boxAry.css(style,"auto");_.each($boxAry,function(v){var $box=$(v),$next=$box.next(),boxWidth=
$box.outerWidth(true),tmpHeight=$box.outerHeight(true),containerWidth=parent==="parent"?$box.parent().width():$box.closest(parent).width();if(!!list)$next=$box.parent(list).next().find(mark);if(1&&rowAry.length>0&&containerWidth-(currentWidth+boxWidth)<-5){_.each(rowAry,function(box){if(element.length>0)$(element,box).css(style,maxHeight+offset);else $(box).css(style,maxHeight+offset)});currentWidth=0;maxHeight=0;rowAry=[]}rowAry.push($box);currentWidth+=boxWidth;if(tmpHeight>maxHeight)maxHeight=
tmpHeight;if(!$next.hasClass(mark.substring(1))){_.each(rowAry,function(box){if(element.length>0)$(element,box).css(style,maxHeight+offset);else $(box).css(style,maxHeight+offset)});currentWidth=0;maxHeight=0;rowAry=[]}})},200)}).trigger("resize")})(ACMS.Config.autoHeightRConf)};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 $backdrop=$(".acms-admin-modal-backdrop");var eid=ACMS.Config.eid;if(!$backdrop.length)$backdrop=$($.parseHTML('<div class="acms-admin-modal-backdrop"></div>')).hide().appendTo("body");var code='            <div id="js-edit_inplace-detail" class="acms-admin-modal out">                <div class="acms-admin-modal-dialog large">                    <div class="acms-admin-modal-content">                        <div class="acms-admin-modal-header">                            <i class="acms-admin-modal-hide acms-admin-icon-delete"></i>                            <h3>\u30d0\u30fc\u30b8\u30e7\u30f3\u4e00\u89a7</h3>                        </div>                        <div class="acms-admin-modal-body">                            <div class="acms-admin-padding-small"></div>                        </div>                    </div>                </div>            </div>';if(!$revisionBox.length)$revisionBox=
$($.parseHTML(code)).appendTo("body");else{$revisionBox.empty().remove();$revisionBox=$($.parseHTML(code)).appendTo("body")}$.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));if($revisionBox.length){$("body").css("overflow","hidden");$revisionBox.find(".acms-admin-modal-body > .acms-admin-padding-small").append($raw);$revisionBox.show();$backdrop.show();setTimeout(function(){$revisionBox.removeClass("out").delay(200).queue(function(){$(this).addClass("in").delay(500).queue(function(){$(this).addClass("display").removeClass("in")}).dequeue()})},
1)}ACMS.Config.postIncludeEffect="fade";ACMS.Dispatch($revisionBox);var closeFn=function(){$("body").css("overflow","");$backdrop.fadeOut();$revisionBox.removeClass("display").addClass("out");setTimeout(function(){$revisionBox.hide()},500);return false};$(".acms-admin-modal-hide").bind("click",closeFn);$revisionBox.click(function(event){var click=event.target;if($(click).hasClass("acms-admin-modal"))closeFn()})}})})};
ACMS.Dispatch.modal=function($modal){var $backdrop=$(".acms-admin-modal-backdrop");var $hideBtn=$(".acms-admin-modal-hide");if(!$backdrop.length)$backdrop=$($.parseHTML('<div class="acms-admin-modal-backdrop"></div>')).hide().appendTo("body");$("body").css("overflow","hidden");$modal.show();$backdrop.show();setTimeout(function(){$modal.removeClass("out").delay(200).queue(function(){$(this).addClass("in").delay(500).queue(function(){$(this).addClass("display").removeClass("in")}).dequeue()})},1);var closeFn=
function(){$("body").css("overflow","");$modal.removeClass("display").addClass("out");$backdrop.fadeOut();setTimeout(function(){$modal.hide()},500)};$hideBtn.click(closeFn);$modal.click(function(event){var click=event.target;if($(click).hasClass("acms-admin-modal"))closeFn()})};
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()});window.setTimeout(function(){if(elm.getAttribute("width")>ACMS.Config.s2dMaxSize)s2dMap()},300)};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.incrementalSearch=function(elm){var $target=$(elm);var $input=$(Config.incrementalSearchBoxMark);var $item=$(Config.incrementalSearchElementMark,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.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){$(elm).bind("keydown change",function(){var $self=$(this),length=$self.val().length,max=$self.data("max"),target=$self.data("label-target");$target=$(target),active=ACMS.Config.countupMarkOver;$target.html(length);if(length>max){$target.addClass(active);$self.addClass(active)}else{$target.removeClass(active);$self.removeClass(active)}}).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);ACMS.dispatchEvent("acmsAddCustomFieldGroup",{item:$clone.get(0)},elm);return false});var n=0;$sortable.find(Config.fieldgroupSortableItemMark).each(function(){if("none"==$(this).css("display"))return true;n++;ACMS.dispatchEvent("acmsAddCustomFieldGroup",
{item:this},elm)});if(!n)for(var i=0;i<1;i++){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++})}};
ACMS.Dispatch.acmsAdminTabs=function(elm){var $self=$(elm),$tabs=$(),$panels=$(),$expr=$("a[href^=#]",elm);if($self.hasClass("js-acms_admin_tabs_already"))return false;$self.addClass("js-acms_admin_tabs_already");$("a",elm).each(function(){var href=$(this).attr("href");href=href.replace(/https:.*\//,"");$(this).attr("href",href)});function buildTab(panel){var $panel=$(panel);var hash=panel.replace(/^#/,"");$panels.hide();$panel.show();$("#js-tooltip").remove();if(location.hash!=panel&&!_.contains(["entry-edit",
"entry_editor"],ACMS.Config.admin)){$panel.attr("id","");location.hash=panel;$panel.attr("id",hash)}$panel.find('textarea[name^="text_text_"]').trigger("focus");$('textarea[name^="text_text_"]').trigger("keyup");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();
var panel=$expr.filter(":first").addClass("js-acms_tab-active").attr("href");if(_.contains(["blog_edit","user_edit","category_edit","module_edit"],ACMS.Config.admin)){setTimeout(function(){$(window).scrollTop(0)},200);if(!location.hash){$(panel).show();$expr.filter("a[href=js-ready-acms_tabs]").click();$expr.filter(".js-ready-acms_tabs").click()}else{buildTab(location.hash);$tabs.removeClass("js-acms_tab-active");$expr.filter("a[href="+location.hash+"]").addClass("js-acms_tab-active")}}else{$(panel).show();
$expr.filter("a[href=js-ready-acms_tabs]").click();$expr.filter(".js-ready-acms_tabs").click()}};
