/**
* Featherlight - ultra slim jQuery lightbox
* Version 0.2.0 - http://noelboss.github.io/featherlight/
*
* Copyright 2014, Noël Raoul Bossart (http://www.noelboss.com)
* MIT Licensed.
**/
!function(a){"use strict";if("undefined"!==a){var b={id:0,defaults:{selector:"[data-featherlight]",context:"body",type:{image:!1,ajax:!1},targetAttr:"data-featherlight",openTrigger:"click",closeTrigger:"click",openSpeed:250,closeSpeed:250,namespace:"featherlight",resetCss:!1,variant:null,closeOnBg:!0,closeOnEsc:!0,background:null,autostart:!0,open:function(b){a.proxy(a.featherlight.methods.open,this,b)()},close:function(b){a.proxy(a.featherlight.methods.close,this,b)()}},methods:{setup:function(c,d){c=a.extend({},b.defaults,c);var e=a(this)||a(),f=e.attr("data-"+c.namespace+"-variant")||c.variant,g=c.resetCss?c.namespace+"-reset":c.namespace,h=a(c.background||'
'),i={id:b.id++,config:c,content:d,$elm:e,$instance:h.clone().addClass(f)};i.$instance.on(c.closeTrigger+"."+c.namespace,a.proxy(c.close,i)),e.length>0&&this.tagName?e.on(c.openTrigger+"."+c.namespace,a.proxy(c.open,i)):a.proxy(c.open,i)()},getContent:function(){var b=this,c=b.content,d=b.$elm.attr(b.config.targetAttr)||"",e="";if("string"==typeof c)b.content=a(c);else if(c instanceof a==!1)if(b.config.type.image===!0||"image"===d||d.match(/\.(png|jpg|jpeg|gif|tiff|bmp)$/i))e=d.match(/\.(png|jpg|jpeg|gif|tiff|bmp)$/i)?d:b.$elm.attr("href"),b.content=a('');else{if(b.config.type.ajax===!0||"ajax"===d||d.match(/(http|htm|php)/i))return e=d.match(/(http|htm|php)/i)?d:b.$elm.attr("href"),c=e?a("").load(e,function(b,d){"error"!==d&&a.featherlight(c.html())}):null,!1;if(!d)return!1;b.content=a(a(d),b.config.context)}(b.content.is("iframe")||a("iframe",b.content).length>0)&&b.$instance.addClass(b.config.namespace+"-iframe"),b.content.addClass(b.config.namespace+"-inner")},open:function(c){c&&c.preventDefault();var d=this;a.proxy(b.methods.getContent,d)()!==!1&&(d.config.closeOnEsc&&a(document).bind("keyup."+d.config.namespace+d.id,function(a){27===a.keyCode&&d.$instance.find("."+d.config.namespace+"-close").click()}),d.$instance.prependTo("body").fadeIn(d.config.openSpeed).find("."+d.config.namespace+"-close").after(d.content))},close:function(b){var c=this,d=c.config,e=a(b.target);(d.closeOnBg&&e.is("."+d.namespace)||e.is("."+d.namespace+"-close"))&&(b&&b.preventDefault(),c.config.closeOnEsc&&a(document).unbind("keyup."+c.config.namespace+c.id),c.$instance.fadeOut(c.config.closeSpeed,function(){c.$instance.detach()}))}}};a.featherlight=function(c,d){a.proxy(b.methods.setup,null,d,c)()},a.fn.featherlight=function(c,d){a(this).each(function(){a.proxy(b.methods.setup,this,c,d)()})},a.extend(a.featherlight,b),a(document).ready(function(){var b=a.featherlight.defaults;b.autostart&&a(b.selector,b.context).featherlight()})}}("function"==typeof jQuery?jQuery:alert("Too much lightness, Featherlight needs jQuery."));