var Lobibox=Lobibox||{};!function(){Lobibox.counter=0,Lobibox.prompt=function(o,t){return new i(o,t)},Lobibox.confirm=function(o){return new t(o)},Lobibox.progress=function(o){return new e(o)},Lobibox.error={},Lobibox.success={},Lobibox.warning={},Lobibox.info={},Lobibox.alert=function(o,t){if(-1<["success","error","warning","info"].indexOf(o))return new s(o,t)},Lobibox.window=function(o){return new a("window",o)};var n={$type:null,$el:null,$options:null,debug:function(){this.$options.debug&&window.console.debug.apply(window.console,arguments)},_processInput:function(o){if($.isArray(o.buttons)){for(var t={},i=0;i").addClass(o.class).attr("data-type",i).html(o.text);return n.$options.callback&&"function"==typeof n.$options.callback&&t.on("click.lobibox",function(o){var t=$(this);n._onButtonClick(n.$options.buttons[i],i),n.$options.callback(n,t.data("type"),o)}),t.click(function(){n._onButtonClick(n.$options.buttons[i],i)}),t},_onButtonClick:function(o,t){var i=this;("ok"===t&&"prompt"===i.$type&&i.isValid()||"prompt"!==i.$type||"ok"!==t)&&o&&o.closeOnClick&&i.destroy()},_generateButtons:function(){var o=this,t=[];for(var i in o.$options.buttons)if(o.$options.buttons.hasOwnProperty(i)){var n=o.$options.buttons[i],s=o._createButton(i,n);t.push(s)}return t},_createMarkup:function(){var o=this,t=$('
');t.attr("data-is-modal",o.$options.modal);var i=$('
').append(''),n=$('
');if(t.append(i),t.append(n),o.$options.buttons&&!$.isEmptyObject(o.$options.buttons)){var s=$('');s.append(o._generateButtons()),t.append(s),-1')},_triggerEvent:function(o){var t=this;t.$options[o]&&"function"==typeof t.$options[o]&&t.$options[o](t)},_calculateWidth:function(o){return(o=Math.min(Math.max(o,this.$options.width),$(window).outerWidth()))===$(window).outerWidth()&&(o-=2*this.$options.horizontalOffset),o},_calculateHeight:function(o){var t=this;return console.log(t.$options.height),(o=Math.min(Math.max(o,t.$options.height),$(window).outerHeight()))===$(window).outerHeight()&&(o-=2*t.$options.verticalOffset),o},_addCloseButton:function(){var o=this,t=$('×');o.$el.find(".lobibox-header").append(t),t.on("mousedown",function(o){o.stopPropagation()}),t.on("click.lobibox",function(){o.destroy()})},_position:function(){this._setSize();var o=this._calculatePosition();this.setPosition(o.left,o.top)},_isMobileScreen:function(){return $(window).outerWidth()<768},_enableDrag:function(){var n=this.$el;n.find(".lobibox-header").on("mousedown.lobibox",function(o){n.attr("offset-left",o.offsetX),n.attr("offset-top",o.offsetY),n.attr("allow-drag","true")}),$(document).on("mouseup.lobibox",function(){n.attr("allow-drag","false")}),$(document).on("mousemove.lobibox",function(o){if("true"===n.attr("allow-drag")){var t=o.clientX-parseInt(n.attr("offset-left"),10)-parseInt(n.css("border-left-width"),10),i=o.clientY-parseInt(n.attr("offset-top"),10)-parseInt(n.css("border-top-width"),10);n.css({left:t,top:i})}})},_setContent:function(o){return this.$el.find(".lobibox-body").html(o),this},_beforeShow:function(){this._triggerEvent("onShow")},_afterShow:function(){var o=this;Lobibox.counter++,o.$el.attr("data-nth",Lobibox.counter),o.$options.draggable||$(window).on("resize.lobibox-"+o.$el.attr("data-nth"),function(){o.refreshWidth(),o.refreshHeight(),o.$el.css("left","50%").css("margin-left","-"+o.$el.width()/2+"px"),o.$el.css("top","50%").css("margin-top","-"+o.$el.height()/2+"px")}),o._triggerEvent("shown")},_beforeClose:function(){this._triggerEvent("beforeClose")},_afterClose:function(){this.$options.draggable||$(window).off("resize.lobibox-"+this.$el.attr("data-nth")),this._triggerEvent("closed")},hide:function(){var o=this;function t(){o.$el.addClass("lobibox-hidden"),0===$(".lobibox[data-is-modal=true]:not(.lobibox-hidden)").length&&($(".lobibox-backdrop").remove(),$("body").removeClass(Lobibox.base.OPTIONS.bodyClass))}return o.$options.hideClass?(o.$el.removeClass(o.$options.showClass),o.$el.addClass(o.$options.hideClass),setTimeout(function(){t()},o.$options.delayToRemove)):t(),this},destroy:function(){var o=this;function t(){o.$el.remove(),0===$(".lobibox[data-is-modal=true]").length&&($(".lobibox-backdrop").remove(),$("body").removeClass(Lobibox.base.OPTIONS.bodyClass)),o._afterClose()}return o._beforeClose(),o.$options.hideClass?(o.$el.removeClass(o.$options.showClass).addClass(o.$options.hideClass),setTimeout(function(){t()},o.$options.delayToRemove)):t(),this},setWidth:function(o){return this.$el.css("width",this._calculateWidth(o)),this},refreshWidth:function(){this.setWidth(this.$el.width())},refreshHeight:function(){this.setHeight(this.$el.height())},setHeight:function(o){var t=this;return t.$el.css("height",t._calculateHeight(o)).find(".lobibox-body").css("height",t._calculateBodyHeight(t.$el.innerHeight())),t},setSize:function(o,t){return this.setWidth(o),this.setHeight(t),this},setPosition:function(o,t){var i;return"number"==typeof o&&"number"==typeof t?i={left:o,top:t}:"string"==typeof o&&(i=this._calculatePosition(o)),this.$el.css(i),this},setTitle:function(o){return this.$el.find(".lobibox-title").html(o)},getTitle:function(){return this.$el.find(".lobibox-title").html()},show:function(){var o=this,t=$("body");o._beforeShow(),o.$el.removeClass("lobibox-hidden"),t.append(o.$el),o.$options.buttons&&o.$el.find(".lobibox-footer").children()[0].focus();return o.$options.modal&&(t.addClass(Lobibox.base.OPTIONS.bodyClass),o._addBackdrop()),!1!==o.$options.delay&&setTimeout(function(){o.destroy()},o.$options.delay),o._afterShow(),o}};function i(o,t){this.$input=null,this.$type="prompt",this.$promptType=o,t=$.extend({},Lobibox.prompt.DEFAULT_OPTIONS,t),this.$options=this._processInput(t),this._init(),this.debug(this)}function t(o){this.$type="confirm",this.$options=this._processInput(o),this._init(),this.debug(this)}function s(o,t){this.$type=o,this.$options=this._processInput(t),this._init(),this.debug(this)}function e(o){this.$type="progress",this.$progressBarElement=null,this.$options=this._processInput(o),this.$progress=0,this._init(),this.debug(this)}function a(o,t){this.$type=o,this.$options=this._processInput(t),this._init(),this.debug(this)}Lobibox.base={},Lobibox.base.OPTIONS={bodyClass:"lobibox-open",modalClasses:{error:"lobibox-error",success:"lobibox-success",info:"lobibox-info",warning:"lobibox-warning",confirm:"lobibox-confirm",progress:"lobibox-progress",prompt:"lobibox-prompt",default:"lobibox-default",window:"lobibox-window"},buttonsAlign:["left","center","right"],buttons:{ok:{class:"lobibox-btn lobibox-btn-default",text:"OK",closeOnClick:!0},cancel:{class:"lobibox-btn lobibox-btn-cancel",text:"Cancel",closeOnClick:!0},yes:{class:"lobibox-btn lobibox-btn-yes",text:"Yes",closeOnClick:!0},no:{class:"lobibox-btn lobibox-btn-no",text:"No",closeOnClick:!0}},icons:{bootstrap:{confirm:"glyphicon glyphicon-question-sign",success:"glyphicon glyphicon-ok-sign",error:"glyphicon glyphicon-remove-sign",warning:"glyphicon glyphicon-exclamation-sign",info:"glyphicon glyphicon-info-sign"},fontAwesome:{confirm:"fa fa-question-circle",success:"fa fa-check-circle",error:"fa fa-times-circle",warning:"fa fa-exclamation-circle",info:"fa fa-info-circle"}}},Lobibox.base.DEFAULTS={horizontalOffset:5,verticalOffset:5,width:600,height:"auto",closeButton:!0,draggable:!1,customBtnClass:"lobibox-btn lobibox-btn-default",modal:!0,debug:!1,buttonsAlign:"center",closeOnEsc:!0,delayToRemove:200,delay:!1,baseClass:"animated-super-fast",showClass:"zoomIn",hideClass:"zoomOut",iconSource:"bootstrap",onShow:null,shown:null,beforeClose:null,closed:null},i.prototype=$.extend({},n,{constructor:i,_processInput:function(o){var t=n._processInput.call(this,o);return t.buttons={ok:Lobibox.base.OPTIONS.buttons.ok,cancel:Lobibox.base.OPTIONS.buttons.cancel},o=$.extend({},t,i.DEFAULT_OPTIONS,o)},_init:function(){n._init.call(this),this.show()},_afterShow:function(){this._setContent(this._createInput())._position(),this.$input.focus(),n._afterShow.call(this)},_createInput:function(){var o,t=this;return t.$options.multiline?t.$input=$("").attr("rows",t.$options.lines):t.$input=$(''),t.$input.addClass("lobibox-input").attr(t.$options.attrs),t.$options.value&&t.setValue(t.$options.value),t.$options.label&&(o=$("")),$("
").append(o,t.$input)},setValue:function(o){return this.$input.val(o),this},getValue:function(){return this.$input.val()},isValid:function(){var o=this,t=o.$el.find(".lobibox-input-error-message");return o.$options.required&&!o.getValue()?(o.$input.addClass("invalid"),0===t.length&&(o.$el.find(".lobibox-body").append('

'+o.$options.errorMessage+"

"),o._position(),o.$input.focus()),!1):(o.$input.removeClass("invalid"),t.remove(),o._position(),o.$input.focus(),!0)}}),i.DEFAULT_OPTIONS={width:400,attrs:{},value:"",multiline:!1,lines:3,type:"text",label:"",required:!0,errorMessage:"The field is required"},t.prototype=$.extend({},n,{constructor:t,_processInput:function(o){var t=n._processInput.call(this,o);return t.buttons={yes:Lobibox.base.OPTIONS.buttons.yes,no:Lobibox.base.OPTIONS.buttons.no},o=$.extend({},t,Lobibox.confirm.DEFAULTS,o)},_init:function(){n._init.call(this),this.show()},_afterShow:function(){var o=this,t=$("
");o.$options.iconClass&&t.append($('
').append('')),t.append('
'+o.$options.msg+"
"),o._setContent(t.html()),o._position(),n._afterShow.call(o)}}),Lobibox.confirm.DEFAULTS={title:"Question",width:500},s.prototype=$.extend({},n,{constructor:s,_processInput:function(o){var t=n._processInput.call(this,o);return t.buttons={ok:Lobibox.base.OPTIONS.buttons.ok},o=$.extend({},t,Lobibox.alert.OPTIONS[this.$type],Lobibox.alert.DEFAULTS,o)},_init:function(){n._init.call(this),this.show()},_afterShow:function(){var o=this,t=$("
");o.$options.iconClass&&t.append($('
').append('')),t.append('
'+o.$options.msg+"
"),o._setContent(t.html()),o._position(),n._afterShow.call(o)}}),Lobibox.alert.OPTIONS={warning:{title:"Warning"},info:{title:"Information"},success:{title:"Success"},error:{title:"Error"}},Lobibox.alert.DEFAULTS={},e.prototype=$.extend({},n,{constructor:e,_processInput:function(o){var t=n._processInput.call(this,o);return o=$.extend({},t,Lobibox.progress.DEFAULTS,o)},_init:function(){n._init.call(this),this.show()},_afterShow:function(){var o,t=this;t.$options.progressTpl?t.$progressBarElement=$(t.$options.progressTpl):t.$progressBarElement=t._createProgressbar(),t.$options.label&&(o=$(""));var i=$("
").append(o,t.$progressBarElement);t._setContent(i),t._position(),n._afterShow.call(t)},_createProgressbar:function(){var o=$('
').append('
');return this.$options.showProgressLabel&&o.append(''),o},setProgress:function(o){var t=this;if(100!==t.$progress)return o=Math.min(100,Math.max(0,o)),t.$progress=o,t._triggerEvent("progressUpdated"),100===t.$progress&&t._triggerEvent("progressCompleted"),t.$el.find(".lobibox-progress-element").css("width",o.toFixed(1)+"%"),t.$el.find('[data-role="progress-text"]').html(o.toFixed(1)+"%"),t},getProgress:function(){return this.$progress}}),Lobibox.progress.DEFAULTS={width:500,showProgressLabel:!0,label:"",progressTpl:!1,progressUpdated:null,progressCompleted:null},a.prototype=$.extend({},n,{constructor:a,_processInput:function(o){var t=n._processInput.call(this,o);return o.content&&"function"==typeof o.content&&(o.content=o.content()),o.content instanceof jQuery&&(o.content=o.content.clone()),o=$.extend({},t,Lobibox.window.DEFAULTS,o)},_init:function(){var o=this;n._init.call(o),o.setContent(o.$options.content),o.$options.url&&o.$options.autoload?(o.$options.showAfterLoad||o.show(),o.load(function(){o.$options.showAfterLoad&&o.show()})):o.show()},_afterShow:function(){this._position(),n._afterShow.call(this)},setParams:function(o){return this.$options.params=o,this},getParams:function(){return this.$options.params},setLoadMethod:function(o){return this.$options.loadMethod=o,this},getLoadMethod:function(){return this.$options.loadMethod},setContent:function(o){return this.$options.content=o,this.$el.find(".lobibox-body").html("").append(o),this},getContent:function(){return this.$options.content},setUrl:function(o){return this.$options.url=o,this},getUrl:function(){return this.$options.url},load:function(t){var i=this;return i.$options.url&&$.ajax(i.$options.url,{method:i.$options.loadMethod,data:i.$options.params}).done(function(o){i.setContent(o),t&&"function"==typeof t&&t(o)}),i}}),Lobibox.window.DEFAULTS={width:480,height:600,content:"",url:"",draggable:!0,autoload:!0,loadMethod:"GET",showAfterLoad:!0,params:{}}}(),Math.randomString=function(o){for(var t="",i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=0;nli").removeClass("active"),o.addClass("active");var t=$(o.find(">a").attr("href"));t.closest(".lb-notify-wrapper").find(">.lb-tab-pane").removeClass("active"),t.addClass("active")},s=function(o){var t=$("
  • ",{class:Lobibox.notify.OPTIONS[l.$type].class});return $("",{href:"#"+o}).append('').appendTo(t),t},e=function(){return $("
    ",{class:"lb-tab-pane",id:Math.randomString(10)})},r=function(o){l.$options.closable&&$('×').click(function(){l.remove()}).appendTo(o)},c=function(o){l.$options.closeOnClick&&o.click(function(){l.remove()})},p=function(o){if(l.$options.delay){if(l.$options.delayIndicator){var t=$('
    ');o.append(t)}var i=0,n=1e3/30,s=(new Date).getTime(),e=setInterval(function(){l.$options.continueDelayOnInactiveTab?i=(new Date).getTime()-s:i+=n;var o=100*i/l.$options.delay;100<=o&&(o=100,l.remove(),e=clearInterval(e)),l.$options.delayIndicator&&t.find("div").css("width",o+"%")},n);l.$options.pauseDelayOnHover&&o.on("mouseenter.lobibox",function(){n=0}).on("mouseleave.lobibox",function(){n=1e3/30})}},b=function(o){return o=Math.min($(window).outerWidth(),o)};this.remove=function(){l.$el.removeClass(l.$options.showClass).addClass(l.$options.hideClass);var s=l.$el.parent(),o=s.closest(".lobibox-notify-wrapper-large"),t="#"+s.attr("id"),e=o.find('>.lb-notify-tabs>li:has(a[href="'+t+'"])');return e.addClass(Lobibox.notify.OPTIONS.class).addClass(l.$options.hideClass),setTimeout(function(){if("normal"===l.$options.size||"mini"===l.$options.size)l.$el.remove();else if("large"===l.$options.size){var o=function(o){var t=o.prev();return 0===t.length&&(t=o.next()),0===t.length?null:t}(e);o&&a(o),e.remove(),s.remove()}var t=Lobibox.notify.list,i=t.indexOf(l);t.splice(i,1);var n=t[i];n&&n.$options.showAfterPrevious&&n._init()},500),l},l._init=function(){var o=function(){var o,t,i,n,s,e=Lobibox.notify.OPTIONS,a=$("
    ",{class:"lobibox-notify "+e[l.$type].class+" "+e.class+" "+l.$options.showClass});return i=$('
    ').appendTo(a),o=$('
    ').appendTo(i),t=$("
    ").appendTo(o),l.$options.img?t.append(''):l.$options.icon?t.append('
    '):a.addClass("without-icon"),s=$('
    '+l.$options.msg+"
    "),!1!==l.$options.messageHeight&&s.css("max-height",l.$options.messageHeight),n=$("
    ",{class:"lobibox-notify-body"}).append(s).appendTo(a),l.$options.title&&n.prepend('
    '+l.$options.title+"
    "),r(a),"normal"!==l.$options.size&&"mini"!==l.$options.size||(c(a),p(a)),l.$options.width&&a.css("width",b(l.$options.width)),a}();if("mini"===l.$options.size&&o.addClass("notify-mini"),"string"==typeof l.$options.position){var t=function(){var o,t=("large"===l.$options.size?".lobibox-notify-wrapper-large":".lobibox-notify-wrapper")+"."+l.$options.position.replace(/\s/gi,".");return 0===(o=$(t)).length&&(o=$("
    ").addClass(t.replace(/\./g," ").trim()).appendTo($("body")),"large"===l.$options.size&&o.append($('
      ')).append($('
      '))),o}();!function(o,t){if("normal"===l.$options.size)t.hasClass("bottom")?t.prepend(o):t.append(o);else if("mini"===l.$options.size)t.hasClass("bottom")?t.prepend(o):t.append(o);else if("large"===l.$options.size){var i=e().append(o),n=s(i.attr("id"));t.find(".lb-notify-wrapper").append(i),t.find(".lb-notify-tabs").append(n),a(n),n.find(">a").click(function(){a(n)})}}(o,t),t.hasClass("center")&&t.css("margin-left","-"+t.width()/2+"px")}else $("body").append(o),o.css({position:"fixed",left:l.$options.position.left,top:l.$options.position.top});l.$el=o,l.$options.sound&&new Audio(l.$options.sound).play();l.$options.rounded&&l.$el.addClass("rounded"),l.$el.on("click.lobibox",function(o){l.$options.onClickUrl&&(window.location.href=l.$options.onClickUrl),l.$options.onClick&&"function"==typeof l.$options.onClick&&l.$options.onClick.call(l,o)}),l.$el.data("lobibox",l)},this.$type=o,this.$options=("mini"!==(i=t).size&&"large"!==i.size||(i=$.extend({},Lobibox.notify.OPTIONS[i.size],i)),"mini"!==(i=$.extend({},Lobibox.notify.OPTIONS[l.$type],Lobibox.notify.DEFAULTS,i)).size&&!0===i.title?i.title=Lobibox.notify.OPTIONS[l.$type].title:"mini"===i.size&&!0===i.title&&(i.title=!1),!0===i.icon&&(i.icon=Lobibox.notify.OPTIONS.icons[i.iconSource][l.$type]),!0===i.sound&&(i.sound=Lobibox.notify.OPTIONS[l.$type].sound),i.sound&&(i.sound=i.soundPath+i.sound+i.soundExt),i),l.$options.showAfterPrevious&&0!==Lobibox.notify.list.length||this._init()}Lobibox.notify=function(o,t){if(-1<["default","info","warning","error","success"].indexOf(o)){var i=new n(o,t);return Lobibox.notify.list.push(i),i}},Lobibox.notify.list=[],Lobibox.notify.closeAll=function(){var o=Lobibox.notify.list;for(var t in o)o[t].remove()},Lobibox.notify.DEFAULTS={title:!0,size:"normal",soundExt:".ogg",showClass:"fadeInDown",hideClass:"zoomOut",icon:!0,msg:"",img:null,closable:!0,hideCloseButton:!1,delay:5e3,delayIndicator:!0,closeOnClick:!0,width:400,sound:!0,position:"bottom right",iconSource:"bootstrap",rounded:!1,messageHeight:60,pauseDelayOnHover:!0,onClickUrl:null,showAfterPrevious:!1,continueDelayOnInactiveTab:!0,onClick:null},Lobibox.notify.OPTIONS={class:"animated-fast",large:{width:500,messageHeight:96},mini:{class:"notify-mini",messageHeight:32},default:{class:"lobibox-notify-default",title:"Default",sound:!1},success:{class:"lobibox-notify-success",title:"Success",sound:"sound2"},error:{class:"lobibox-notify-error",title:"Error",sound:"sound4"},warning:{class:"lobibox-notify-warning",title:"Warning",sound:"sound5"},info:{class:"lobibox-notify-info",title:"Information",sound:"sound6"},icons:{bootstrap:{success:"glyphicon glyphicon-ok-sign",error:"glyphicon glyphicon-remove-sign",warning:"glyphicon glyphicon-exclamation-sign",info:"glyphicon glyphicon-info-sign"},fontAwesome:{success:"fa fa-check-circle",error:"fa fa-times-circle",warning:"fa fa-exclamation-circle",info:"fa fa-info-circle"}}}}();