",{class:this._namespace+"-overlay"}).appendTo(t(this.elem).find("."+this._namespace+"-wrapper")),this.props.img.$overlay=t(this.elem).find("."+this._namespace+"-overlay"),a=parseInt(this.props.img.$overlay.css("padding-top"),10),p=parseInt(this.props.img.$overlay.css("padding-bottom"),10),h=parseInt(this.props.img.$overlay.css("padding-left"),10),l=parseInt(this.props.img.$overlay.css("padding-right"),10),f=parseInt(this.props.img.$overlay.css("height"),10)-(h+l),f=parseInt(n,10)-f-(a+p),s=e.top+f+2*o,i=e.left,this.props.img.$overlay.css({left:i+"px",top:s+"px",width:r+"px",borderBottomLeftRadius:this.props.img.$elem.css("border-radius"),borderBottomRightRadius:this.props.img.$elem.css("border-radius")}),"always"===this.options.overlay&&this.props.img.$overlay.animate({opacity:.7},!0===this._hasEffect()?500:0),this._caption(),!0===this.options.controls.show&&this.props.thumbs.length>1&&this._controls()}},_hideOverlay:function(){null!==this.props.img.$overlay&&this.props.img.$overlay.animate({opacity:0},!0===this._hasEffect()?500:0)},_controls:function(){var e,s,i,o,r;t(this.elem).find("."+this._namespace+"-controls-wrapper").remove(),e='
",{class:this._namespace+"-controls-wrapper"}).append(e+s+i+o),this.props.img.$overlay.find("a:first").length>0?r.appendTo(this.props.img.$overlay.find("a:first")):r.appendTo(this.props.img.$overlay),this.props.controls.$wrapper=t(this.elem).find("."+this._namespace+"-controls-wrapper"),this.props.controls.$wrapper.length&&(!0===this.options.auto.start?this.props.controls.$wrapper.find('a[href="#play"]').hide().parent().find('a[href="#pause"]').show():this.props.controls.$wrapper.find('a[href="#pause"]').hide().parent().find('a[href="#play"]').show())},_caption:function(){if(null!==this.props.thumbs[this.props.img.to_show].caption_title){var e,s,i,o,r,n;this.props.img.$overlay.html('
'+this.props.thumbs[this.props.img.to_show].caption_title+""),s=this.props.img.$overlay.find("a:first").length>0,i=null!==this.props.thumbs[this.props.img.to_show].caption_link,e='
',!0===s&&!0===i?this.props.img.$overlay.find("a:first").attr("href",this.props.thumbs[this.props.img.to_show].caption_link):!0===s&&!1===i?(r=(o=this.props.img.$overlay.find("a:first")).children().clone(),n=o.parent(),o.remove(),r.appendTo(n),this.props.img.$overlay.find("span:first").empty()):!1===s&&!0===i&&t(this.elem).find("."+this._namespace+"-overlay span:first").wrap(e)}},_stopAnimation:function(){t(this.elem).stop()},_triggerEvent:function(e){t(this.elem).triggerHandler(e+"."+this._namespace);var s=e.charAt(0).toUpperCase()+e.slice(1);this.options.events["on"+s]&&this.options.events["on"+s](this.props.img.$elem)},_events:function(){var i=this;-1!==["click","mouseover"].indexOf(this.options.thumbEvent)&&(t(this.options.thumbs).on("click",function(e){e.preventDefault(),"click"===i.options.thumbEvent&&(i.goTo(t(this).data(i._namespace+"-index")),i._triggerEvent("thumbClick"))}),t(this.options.thumbs).on("mouseover",function(e){e.preventDefault(),"mouseover"===i.options.thumbEvent&&(i.goTo(t(this).data(i._namespace+"-index")),i._triggerEvent("thumbMouseOver"))})),this.props.img.$elem.on("click",function(t){t.preventDefault(),i._triggerEvent("imageClick")}),t(this.elem).on("click","."+this._namespace+"-controls-wrapper a",t(this.elem),function(e){switch(e.preventDefault(),t(this).attr("href")){case"#prev":i.goPrev();break;case"#pause":i.pause();break;case"#play":i.play();break;case"#next":i.goNext()}}),t(this.elem).find("."+this._namespace+"-wrapper").on({mouseover:function(){"hover"===i.options.overlay&&null!==i.props.img.$overlay&&i.props.img.$overlay.stop().animate({opacity:.7},400)},mouseleave:function(){"hover"===i.options.overlay&&null!==i.props.img.$overlay&&i.props.img.$overlay.stop().animate({opacity:0},400)}}),!0===this.options.controls.keys&&t(s).on("keydown",function(t){switch(t.which){case 37:i.goPrev();break;case 39:i.goNext();break;case 32:t.preventDefault(),!0===i.options.auto.start?i.pause():i.play()}});var o=function(){var t=0;return function(e,s){clearTimeout(t),t=setTimeout(e,s)}}();"none"!==this.options.overlay&&t(e).bind("resize",function(){o(function(){i._overlay()},100)})},_errorHandler:function(t,e){switch(t){case"error":void 0!==console&&console.error(this._name+": "+e+" Check out the documentation."),this._triggerEvent("error"),this.props.plugin_status=t;break;case"warning":void 0!==console&&console.warn(this._name+": "+e),this._triggerEvent("warning"),this.props.plugin_status=t;break;default:this._triggerEvent("success"),this.props.plugin_status=t}}},t.fn[r]=function(e){var s,i,n=arguments;return void 0===e||"object"==typeof e?i=this.each(function(){t.data(this,"plugin_"+r)||t.data(this,"plugin_"+r,new o(this,e))}):"string"==typeof e&&"_"!==e[0]?void 0!==(s=t.data(this[0],"plugin_"+r))[e]&&(i=s[e].apply(s,Array.prototype.slice.call(n,1))):i=this.each(function(){(s=t.data(this,"plugin_"+r))instanceof o&&"function"==typeof s[e]&&s[e].apply(s,Array.prototype.slice.call(n,1))}),i}}(jQuery,window,document);