=0&&d.left>=0&&d.bottom<=b(window).height()+this.opts.tolerance&&d.right<=b(window).width())}};b(window).on("load.tools.infinity-scroll",function(){b('[data-tools="infinity-scroll"]').infinityScroll()});a.prototype.init.prototype=a.prototype})(jQuery);(function(b){b.fn.livesearch=function(c){return this.each(function(){b.data(this,"livesearch",{});b.data(this,"livesearch",a(this,c))})};function a(d,c){return new a.prototype.init(d,c)}b.Livesearch=a;b.Livesearch.NAME="livesearch";b.Livesearch.VERSION="1.0";b.Livesearch.opts={url:false,target:false,min:2,params:false,appendForms:false};a.fn=b.Livesearch.prototype={init:function(d,c){this.$element=d!==false?b(d):false;this.loadOptions(c);this.build()},loadOptions:function(c){this.opts=b.extend({},b.extend(true,{},b.Livesearch.opts),this.$element.data(),c)},setCallback:function(j,h,d){var m=b._data(this.$element[0],"events");if(m&&typeof m[j]!="undefined"){var k=[];var g=m[j].length;for(var f=0;f');this.$element.after(this.$box);this.$box.append(this.$element);this.$element.off("keyup.tools.livesearch");this.$element.on("keyup.tools.livesearch",b.proxy(this.load,this));this.$icon=b('');this.$box.append(this.$icon);this.$close=b('').hide();this.$box.append(this.$close);this.$close.off("click.tools.livesearch");this.$close.on("click.tools.livesearch",b.proxy(function(){this.search();this.$element.val("").focus();this.$close.hide()},this))},toggleClose:function(c){if(c===0){this.$close.hide()}else{this.$close.show()}},load:function(){var f=this.$element.val();var e="";if(f.length>this.opts.min){var c="q";if(typeof this.$element.attr("name")!="undefined"){c=this.$element.attr("name")}e+="&"+c+"="+f;e=this.appendForms(e);var h="";if(this.opts.params){this.opts.params=b.trim(this.opts.params.replace("{","").replace("}",""));var d=this.opts.params.split(",");var g={};b.each(d,function(j,i){var l=i.split(":");g[b.trim(l[0])]=b.trim(l[1])});h=[];b.each(g,b.proxy(function(j,i){h.push(j+"="+i)},this));h=h.join("&");e+="&"+h}}this.toggleClose(f.length);this.search(e)},appendForms:function(c){if(!this.opts.appendForms){return c}b.each(this.opts.appendForms,function(d,e){c+="&"+b(e).serialize()});return c},search:function(c){b.ajax({url:this.opts.url,type:"post",data:c,success:b.proxy(function(d){b(this.opts.target).html(d);this.setCallback("result",d)},this)})}};b(window).on("load.tools.livesearch",function(){b('[data-tools="livesearch"]').livesearch()});a.prototype.init.prototype=a.prototype})(jQuery);(function(b){b.fn.message=function(d){var e=[];var c=Array.prototype.slice.call(arguments,1);if(typeof d==="string"){this.each(function(){var g=b.data(this,"message");if(typeof g!=="undefined"&&b.isFunction(g[d])){var f=g[d].apply(g,c);if(f!==undefined&&f!==g){e.push(f)}}else{return b.error('No such method "'+d+'" for Message')}})}else{this.each(function(){b.data(this,"message",{});b.data(this,"message",a(this,d))})}if(e.length===0){return this}else{if(e.length===1){return e[0]}else{return e}}};function a(d,c){return new a.prototype.init(d,c)}b.Message=a;b.Message.NAME="message";b.Message.VERSION="1.0";b.Message.opts={target:false,delay:10};a.fn=b.Message.prototype={init:function(d,c){this.$element=d!==false?b(d):false;this.loadOptions(c);this.build()},loadOptions:function(c){this.opts=b.extend({},b.extend(true,{},b.Message.opts),this.$element.data(),c)},setCallback:function(j,h,d){var m=b._data(this.$message[0],"events");if(m&&typeof m[j]!="undefined"){var k=[];var g=m[j].length;for(var f=0;f').hide();this.$modal=b('');this.$modalHeader=b("");this.$modalClose=b('').html("×");this.$modalBody=b("");this.$modalFooter=b("");this.$modal.append(this.$modalHeader);this.$modal.append(this.$modalClose);this.$modal.append(this.$modalBody);this.$modal.append(this.$modalFooter);this.$modalBox.append(this.$modal);this.$modalBox.appendTo(document.body)},buildOverlay:function(){this.$modalOverlay=b('').hide();b("body").prepend(this.$modalOverlay);if(this.opts.blur){this.blurredElements=b("body").children("div, section, header, article, pre, aside, table").not(".modal, .modal-box, #modal-overlay");this.blurredElements.addClass("modal-blur")}},show:function(){this.setCallback("loading",this.$modal);this.bodyOveflow=b(document.body).css("overflow");b(document.body).css("overflow","hidden");if(this.isMobile()){this.showOnMobile()}else{this.showOnDesktop()}this.$modalOverlay.show();this.$modalBox.show();this.setButtonsWidth();if(!this.isMobile()){setTimeout(b.proxy(this.showOnDesktop,this),0);b(window).on("resize.tools.modal",b.proxy(this.resize,this))}this.setCallback("opened",this.$modal);b(document).off("focusin.modal")},showOnDesktop:function(){var c=this.$modal.outerHeight();var e=b(window).height();var d=b(window).width();if(this.opts.width>d){this.$modal.css({width:"96%",marginTop:(e/2-c/2)+"px"});return}if(c>e){this.$modal.css({width:this.opts.width+"px",marginTop:"20px"})}else{this.$modal.css({width:this.opts.width+"px",marginTop:(e/2-c/2)+"px"})}},showOnMobile:function(){this.$modal.css({width:"96%",marginTop:"2%"})},resize:function(){if(this.isMobile()){this.showOnMobile()}else{this.showOnDesktop()}},setTitle:function(){this.$modalHeader.html(this.opts.title)},setContent:function(){if(typeof this.opts.content=="object"||this.opts.content.search("#")===0){this.type="html";this.$modalBody.html(b(this.opts.content).html());this.show()}else{b.ajax({url:this.opts.content,cache:false,success:b.proxy(function(c){this.$modalBody.html(c);this.show()},this)})}},setDraggable:function(){if(typeof b.fn.draggable==="undefined"){return}this.$modal.draggable({handle:this.$modalHeader});this.$modalHeader.css("cursor","move")},createCancelButton:function(c){if(typeof c=="undefined"){c="Cancel"}var d=b("
').hide();a(document.body).append(b);a("#tools-progress").fadeIn()}},update:function(b){this.show();a("#tools-progress").find("span").css("width",b+"%")},hide:function(){a("#tools-progress").fadeOut(1500)}}})(jQuery);(function(b){b.fn.tabs=function(d){var e=[];var c=Array.prototype.slice.call(arguments,1);if(typeof d==="string"){this.each(function(){var g=b.data(this,"tabs");if(typeof g!=="undefined"&&b.isFunction(g[d])){var f=g[d].apply(g,c);if(f!==undefined&&f!==g){e.push(f)}}else{return b.error('No such method "'+d+'" for Tabs')}})}else{this.each(function(){b.data(this,"tabs",{});b.data(this,"tabs",a(this,d))})}if(e.length===0){return this}else{if(e.length===1){return e[0]}else{return e}}};function a(d,c){return new a.prototype.init(d,c)}b.Tabs=a;b.Tabs.NAME="tabs";b.Tabs.VERSION="1.0";b.Tabs.opts={equals:false,active:false};a.fn=b.Tabs.prototype={init:function(d,c){this.$element=d!==false?b(d):false;this.loadOptions(c);this.links=this.$element.find("a");this.tabs=[];this.links.each(b.proxy(this.load,this));this.setEquals();this.setCallback("init")},loadOptions:function(c){this.opts=b.extend({},b.extend(true,{},b.Tabs.opts),this.$element.data(),c)},setCallback:function(j,h,d){var m=b._data(this.$element[0],"events");if(m&&typeof m[j]!="undefined"){var k=[];var g=m[j].length;for(var f=0;fc?d:c});return c}};b(window).on("load.tools.tabs",function(){b('[data-tools="tabs"]').tabs()});a.prototype.init.prototype=a.prototype})(jQuery);(function(a){a.fn.textfit=function(c){return this.each(function(){a.data(this,"textfit",{});a.data(this,"textfit",b(this,c))})};function b(d,c){return new b.prototype.init(d,c)}a.Textfit=b;a.Textfit.NAME="textfit";a.Textfit.VERSION="1.0";a.Textfit.opts={min:"10px",max:"100px",compressor:1};b.fn=a.Textfit.prototype={init:function(d,c){this.$element=d!==false?a(d):false;this.loadOptions(c);this.$element.css("font-size",Math.max(Math.min(this.$element.width()/(this.opts.compressor*10),parseFloat(this.opts.max)),parseFloat(this.opts.min)))},loadOptions:function(c){this.opts=a.extend({},a.extend(true,{},a.Textfit.opts),this.$element.data(),c)}};a(window).on("load.tools.textfit",function(){a('[data-tools="textfit"]').textfit()});b.prototype.init.prototype=b.prototype})(jQuery);(function(b){b.fn.tooltip=function(c){return this.each(function(){b.data(this,"tooltip",{});b.data(this,"tooltip",a(this,c))})};function a(d,c){return new a.prototype.init(d,c)}b.Tooltip=a;b.Tooltip.NAME="tooltip";b.Tooltip.VERSION="1.0";b.Tooltip.opts={theme:false};a.fn=b.Tooltip.prototype={init:function(d,c){this.$element=d!==false?b(d):false;this.loadOptions(c);this.$element.on("mouseover",b.proxy(this.show,this));this.$element.on("mouseout",b.proxy(this.hide,this))},loadOptions:function(c){this.opts=b.extend({},b.extend(true,{},b.Tooltip.opts),this.$element.data(),c)},show:function(){b(".tooltip").hide();var c=this.$element.attr("title");this.$element.data("cached-title",c);this.$element.attr("title","");this.tooltip=b('').html(c).hide();if(this.opts.theme!==false){this.tooltip.addClass("tooltip-theme-"+this.opts.theme)}this.tooltip.css({top:(this.$element.offset().top+this.$element.innerHeight())+"px",left:this.$element.offset().left+"px"});b("body").append(this.tooltip);this.tooltip.show()},hide:function(){this.tooltip.fadeOut("fast",b.proxy(function(){this.tooltip.remove()},this));this.$element.attr("title",this.$element.data("cached-title"));this.$element.data("cached-title","")}};a.prototype.init.prototype=a.prototype;b(function(){b('[data-tools="tooltip"]').tooltip()})})(jQuery);(function(b){b.fn.upload=function(c){return this.each(function(){b.data(this,"upload",{});b.data(this,"upload",a(this,c))})};function a(d,c){return new a.prototype.init(d,c)}b.Upload=a;b.Upload.NAME="upload";b.Upload.VERSION="1.0";b.Upload.opts={url:false,placeholder:"Drop file here or ",param:"file"};a.fn=b.Upload.prototype={init:function(d,c){this.$element=d!==false?b(d):false;this.loadOptions(c);this.load()},loadOptions:function(c){this.opts=b.extend({},b.extend(true,{},b.Upload.opts),this.$element.data(),c)},setCallback:function(j,h,d){var m=b._data(this.$element[0],"events");if(m&&typeof m[j]!="undefined"){var k=[];var g=m[j].length;for(var f=0;f');this.$placeholdler=b('').text(this.opts.placeholder);this.$droparea.append(this.$placeholdler);this.$element.after(this.$droparea);this.$placeholdler.append(this.$element);this.$droparea.off(".tools.upload");this.$element.off(".tools.upload");this.$droparea.on("dragover.tools.upload",b.proxy(this.onDrag,this));this.$droparea.on("dragleave.tools.upload",b.proxy(this.onDragLeave,this));this.$element.on("change.tools.upload",b.proxy(function(c){c=c.originalEvent||c;this.traverseFile(this.$element[0].files[0],c)},this));this.$droparea.on("drop.tools.upload",b.proxy(function(c){c.preventDefault();this.$droparea.removeClass("drag-hover").addClass("drag-drop");this.onDrop(c)},this))},onDrop:function(d){d=d.originalEvent||d;var c=d.dataTransfer.files;this.traverseFile(c[0],d)},traverseFile:function(c,f){var d=!!window.FormData?new FormData():null;if(window.FormData){d.append(this.opts.param,c)}if(b.progress){b.progress.show()}this.sendData(d,f)},sendData:function(d,c){var f=new XMLHttpRequest();f.open("POST",this.opts.url);f.onreadystatechange=b.proxy(function(){if(f.readyState==4){var g=f.responseText;g=g.replace(/^\[/,"");g=g.replace(/\]$/,"");var e=(typeof g==="string"?b.parseJSON(g):g);if(b.progress){b.progress.hide()}this.$droparea.removeClass("drag-drop");this.setCallback("success",e)}},this);f.send(d)},onDrag:function(c){c.preventDefault();this.$droparea.addClass("drag-hover")},onDragLeave:function(c){c.preventDefault();this.$droparea.removeClass("drag-hover")}};a.prototype.init.prototype=a.prototype;b(function(){b('[data-tools="upload"]').upload()})})(jQuery);