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