/*
* jQuery Edbox plugin v.2.5.0
* @author Eduardo Moreno - eduardocmoreno[at]gmail[dot]com
* Code under MIT License - http://en.wikipedia.org/wiki/MIT_License
*/
!function(e,o,t){function a(a,n){t=this,t.opt=e.extend({},o,a),t.$el=e(n);var r=t.$el.attr("href");r=/^(#.*)/.test(r)?null:r,t.target=t.$el.attr("data-box-target")||t.opt.target,t.copy=!0===e.parseJSON(t.$el.attr("data-box-copy")||t.opt.copy),t.html=t.$el.attr("data-box-html")||t.opt.html,t.image=t.$el.attr("data-box-image")||t.opt.image,t.url=t.$el.attr("data-box-url")||t.opt.url||r,t.success=t.$el.attr("data-box-success")||t.opt.success,t.info=t.$el.attr("data-box-info")||t.opt.info,t.warning=t.$el.attr("data-box-warning")||t.opt.warning,t.danger=t.$el.attr("data-box-danger")||t.opt.danger,t.header=t.$el.attr("data-box-header")||t.opt.header,t.footer=t.$el.attr("data-box-footer")||t.opt.footer,t.width=t.$el.attr("data-box-width")||t.opt.width,t.height=t.$el.attr("data-box-height")||t.opt.height,t.addClass=t.$el.attr("data-box-add-class")||t.opt.addClass,t.animateOpen=t.$el.attr("data-box-animate-open")||t.opt.animateOpen,t.animateClose=t.$el.attr("data-box-animate-close")||t.opt.animateClose,t.beforeOpen=t.$el.attr("data-box-before-open")?new Function(t.$el.attr("data-box-before-open")):t.opt.beforeOpen,t.afterOpen=t.$el.attr("data-box-after-open")?new Function(t.$el.attr("data-box-after-open")):t.opt.afterOpen,t.beforeClose=t.$el.attr("data-box-before-close")?new Function(t.$el.attr("data-box-before-close")):t.opt.beforeClose,t.afterClose=t.$el.attr("data-box-after-close")?new Function(t.$el.attr("data-box-after-close")):t.opt.afterClose,t.close=t.$el.attr("data-box-close")?JSON.parse(t.$el.attr("data-box-close")):t.opt.close,t.animation=t.$el.attr("data-box-animation")?JSON.parse(t.$el.attr("data-box-animation")):t.opt.animation,t.$box=e('
'),t.$boxError=e(''),t.$boxLoad=e(''),t.$boxBody=e(''),t.$boxClose=e(''),t.$boxContent=e(''),t.$boxHeader=e(''),t.$boxFooter=e(''),t.$boxTemp=e(''),t.animateEvents="webkitAnimationEnd oanimationend msAnimationEnd animationend",t.init()}a.prototype={init:function(){t.base();var o=t.target||t.html||t.image||t.url,a=t.success&&"success"||t.info&&"info"||t.warning&&"warning"||t.danger&&"danger";if(!o&&!a)return void t.error("Undefined");if(t.beforeOpen(),t.target){var n=e(t.target);return void(n.length?(t.copy?n=n.clone():n.after(t.$boxTemp).addClass("edbox-target"),t.insert(n)):t.error('Unable to find element: "'+t.target+'"'))}return t.html?void t.insert(t.html):t.image?(t.imageObj=new Image,t.imageObj.src=t.image,void(t.imageObj.complete?t.insert(t.imageObj):t.load.start(t.image))):t.url?void t.load.start(t.url):a?void t.alert(a,t[a]):void 0},base:function(){t.$box.addClass(t.addClass).addClass(!t.close&&"edbox-close-false").add(t.$boxClose).on("click",t.events.click),e("body").prepend(t.$box),e(window).on("keydown",t.events.keydown)},error:function(e){t.$box.removeClass(t.opt.addClass),t.opt=o,t.responseError=!0,t.alert("danger",e)},alert:function(o,a){t.$box.addClass("edbox-alert edbox-alert-"+o).append(e("").addClass("edbox-alert-container").append(""+a+"
",t.$boxClose)),t.toggle("open")},insert:function(o){t.$box.append(t.$boxBody.css({width:t.width,height:t.height}).append(t.header?t.$boxHeader.append(t.$boxClose,t.header):t.$boxClose,t.$boxContent.append(o),t.footer&&t.$boxFooter.append(t.footer))),t.boxCloseCssRight=t.$boxClose.css("right"),t.toggle("open"),e(window).on("resize",t.events.resize).resize()},toggle:function(e,o){"close"==e&&!t.loading&&!t.responseError&&t.beforeClose(),t.animation?t.$box.children().removeClass(t.animateOpen,t.animateClose).addClass("open"==e?t.animateOpen:t.animateClose).one(t.animateEvents,function(){"function"==typeof o?o():t.callback[e]()}):"function"==typeof o?o():t.callback[e]()},load:{start:function(o){t.loading=!0,t.$box.append(t.$boxLoad),t.toggle("open",function(){t.urlLoad=e.ajax({url:o,cache:!t.image}).fail(function(e){t.load.complete("error",(t.image||t.url)+" "+e.statusText.toLowerCase())}).done(function(e){t.load.complete("insert",null,t.imageObj||e)})})},complete:function(e,o,a){t.toggle("close",function(){t.loading=!1,t.$boxLoad.remove(),t[e](o||a)})}},events:{click:function(e){t.close&&e.target==e.currentTarget&&t.toggle("close")},keydown:function(e){t.close&&27==e.which&&t.toggle("close")},resize:function(){var e=t.$boxBody.outerHeight(),o=t.$boxHeader.outerHeight(),a=t.$boxFooter.outerHeight(),n=t.$boxContent.get(0).scrollHeight,r=Math.ceil(e-(o+a))