ACMS.Dispatch.Postinclude._postinclude=function(elm,method,effect,effectSpeed){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]}var data=ACMS.Library.getPostData(form);var reset="function"==typeof form.onreset?form.onreset:new Function;var url=form.action?form.action:window.location.href;function fin(){$(".js-post-include-disabled",form).removeAttr("disabled").removeClass("js-post-include-disabled");
reset.apply(form)}$(":input",form).attr("disabled","disabled").addClass("js-post-include-disabled");$.ajax({type:"POST",url:url,data:data,dataType:"html",error:function(XMLHttpRequest,textStatus,errorThrown){form.isLastAjaxSuccess=false;fin()},success:function(html,status){form.isLastAjaxSuccess=true;if("replace"==method)switch(effect){case "fade":var $wrapper=$("<div>"+html+"</div>");$(target).fadeOut(effectSpeed,function(){$wrapper.hide();$(target).replaceWith($wrapper);ACMS.Dispatch($wrapper);
$wrapper.fadeIn(effectSpeed,function(){$wrapper.children().first().unwrap();fin()})});break;case "slide":var $wrapper=$("<div>"+html+"</div>");$(target).slideUp(effectSpeed,function(){$wrapper.hide();$(target).replaceWith($wrapper);ACMS.Dispatch($wrapper);$wrapper.slideDown(effectSpeed,function(){$wrapper.children().first().unwrap();fin()})});break;default:var $wrapper=$("<div>"+html+"</div>");$(target).replaceWith($wrapper);ACMS.Dispatch($wrapper);$wrapper.children().first().unwrap();fin()}else switch(effect){case "fade":$(target).fadeOut(effectSpeed,
function(){$(this).empty();$(this).append(html);ACMS.Dispatch(this);$(this).fadeIn(effectSpeed,fin)});break;case "slide":$(target).slideUp(effectSpeed,function(){$(this).empty();$(this).append(html);ACMS.Dispatch(this);$(this).slideDown(effectSpeed,fin)});break;default:$(target).empty();$(target).append(html);ACMS.Dispatch(target);fin()}}})};
