text: /*
  * Exposure (http://http://exposure.blogocracy.org/)
  * Copyright (c) 2010 Kristoffer Jelbring
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  * copies of the Software, and to permit persons to whom the Software is
  * furnished to do so, subject to the following conditions:
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
  *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
  (function($){var $$=$.fn.exposure=function($args){var v="0.9.1";var i;var $defaults={target:'#exposure',showThumbs:true,showControls:true,imageControls:false,controls:{prevNext:true,firstLast:true,pageNumbers:true},carouselControls:false,enableSlideshow:true,slideshowControlsTarget:null,autostartSlideshow:false,slideshowDelay:3000,onSlideshowPlayed:function(){},onSlideshowPaused:function(){},showCaptions:true,showExtraData:true,dataTarget:null,controlsTarget:null,onThumb:function(thumb){},onImage:function(image,imageData,thumb){$('.exposureWrapper > .exposureLastImage').remove()},onCarousel:function(firstImage,lastImage){},onNext:function(){},onPrev:function(){},onPageChanged:function(){$('.exposureThumbs li.current').show().each(function(i){var imageHeight=$(this).find('img').height();if(imageHeight>0){$(this).height(imageHeight)}})},onPagingLink:function(link){return link},separatePageBrowsing:false,loop:true,onEndOfLoop:function(){},pageSize:5,viewFirstImage:true,visiblePages:5,preloadBuffer:3,keyboardNavigation:true,clickingNavigation:true,fixedContainerSize:false,maxWidth:null,maxHeight:null,stretchToMaxSize:false,fullScreen:false,onEnterFullScreen:function(mask){mask.show()},onExitFullScreen:function(target,mask){target.hide();mask.hide()},showThumbToolTip:true,onEmpty:function(){$('.exposureThumbs').hide();$($.exposure.target).remove();if($.exposure.showControls){$($.exposure.controlsTarget).remove()}if($.exposure.slideshowControlsTarget){$($.exposure.slideshowControlsTarget).remove()}},onInit:function(){},allowDuplicates:true,jsonSource:null};var opts=$.extend($defaults,$args);for(i in opts){if($$.defined($defaults[i])){$.exposure[i]=opts[i]}}if(!$($.exposure.target).length){$('<div id="exposure"></div>').insertBefore($(this))}var wrapper=$('<div class="exposureWrapper"></div>');var target=$($.exposure.target).addClass('exposureTarget').append(wrapper);if($.exposure.showCaption||$.exposure.showExtraData){var dataElementsHtml='';if($.exposure.showCaptions){dataElementsHtml+='<div class="caption"></div>'}if($.exposure.showExtraData){dataElementsHtml+='<div class="extra"></div>'}var dataElements=$(dataElementsHtml);if(dataElements.length){if($.exposure.dataTarget&&$($.exposure.dataTarget).length){$($.exposure.dataTarget).addClass('exposureData').append(dataElements)}else{$.exposure.dataTarget=null;target.append($('<div class="exposureData"></div>').append(dataElements))}}}if(!$.exposure.showThumbs){$.exposure.carouselControls=false}if($.exposure.carouselControls||!$.exposure.controlsTarget||(!$.exposure.controls.prevNext&&!$.exposure.controls.firstLast&&!$.exposure.controls.pageNumbers)){$.exposure.showControls=false}if($.exposure.showControls){$($.exposure.controlsTarget).addClass('exposureControls').each(function(){if($.exposure.controls.firstLast){$(this).append($('<a class="exposureFirstPage" href="javascript:void(0);">'+$.exposure.texts.first+'</a>').click($.exposure.first))}if($.exposure.controls.prevNext){$(this).append($('<a class="exposurePrevPage" href="javascript:void(0);">'+$.exposure.texts.previous+'</a>').click($.exposure.prev))}if($.exposure.controls.pageNumbers){$(this).append($('<div class="exposurePaging"></div>'))}if($.exposure.controls.prevNext){$(this).append($('<a class="exposureNextPage" href="javascript:void(0);">'+$.exposure.texts.next+'</a>').click($.exposure.next))}if($.exposure.controls.firstLast){$(this).append($('<a class="exposureLastPage" href="javascript:void(0);">'+$.exposure.texts.last+'</a>').click($.exposure.last))}})}if($.exposure.enableSlideshow&&$.exposure.slideshowControlsTarget){$($.exposure.slideshowControlsTarget).addClass('exposureSlideshowControls').each(function(){$(this).append($('<a class="exposurePlaySlideshow" href="javascript:void(0);">'+$.exposure.texts.play+'</a>').click($.exposure.playSlideshow));$(this).append($('<a class="exposurePauseSlideshow" href="javascript:void(0);">'+$.exposure.texts.pause+'</a>').hide().click($.exposure.pauseSlideshow))})}if($.exposure.keyboardNavigation){$(document).bind('keyup','left',$.exposure.prevImage);$(document).bind('keyup','right',$.exposure.nextImage);$(document).bind('keyup','ctrl+left',$.exposure.prevPage);$(document).bind('keyup','ctrl+right',$.exposure.nextPage);$(document).bind('keyup','up',$.exposure.lastImage);$(document).bind('keyup','down',$.exposure.firstImage);$(document).bind('keyup','ctrl+up',$.exposure.lastPage);$(document).bind('keyup','ctrl+down',$.exposure.firstPage);if($.exposure.enableSlideshow){$(document).bind('keyup','space',$.exposure.toggleSlideshow)}}if($.exposure.fullScreen){$(window).resize($.exposure.fitToWindow);$('<div class="exposureMask"></div>').click($.exposure.exitFullScreen).insertAfter(target);if($.exposure.keyboardNavigation){$(document).bind('keyup','esc',$.exposure.exitFullScreen)}}var jsonImages=null;if($.exposure.jsonSource){if($$.object($.exposure.jsonSource)){jsonImages=$.exposure.jsonSource}else if($.exposure.jsonSource.length){if($$.startsWith($.exposure.jsonSource,"http://")||$$.startsWith($.exposure.jsonSource,"https://")){jsonImages=$.ajax({url:$.exposure.jsonSource,type:'GET',async:false}).responseText}else{jsonImages=$.exposure.jsonSource}}}return this.addClass('exposureThumbs').each(function(){var i;if(jsonImages){var images=$$.object(jsonImages)?jsonImages:$.parseJSON(jsonImages);if(images&&images.data){for(i in images.data){var photo=images.data[i];if(photo.source&&photo.source.length){var item=$('<li></li>');var link=$('<a></a>').attr('href',photo.source);if(photo.thumb_source&&photo.thumb_source.length){var thumb=$('<img />').attr('src',photo.thumb_source);if(photo.caption&&photo.caption.length){thumb.attr('title',photo.caption)}link.append(thumb)}else if(photo.caption&&photo.caption.length){link.attr('title',photo.caption)}item.append(link);if(photo.extra_data&&photo.extra_data.length){item.append($(photo.extra_data))}$(this).append(item)}}}}var foundImage=false;var foundThumb=false;if($(this).children('li').length){var selectedIndex=null;$(this).show().children('li').each(function(){foundImage=true;var a=$(this).find('a');if(a.length){a=$(a[0]);var src=a.attr('href');var img=a.find('img');var thumbSrc=img.length?img.attr('src'):a.attr('rel');var caption=img.length?img.attr('title'):a.attr('title');var isSelected=a.hasClass('selected')&&!selectedIndex;a.remove();var thumbData=$(this).html();if(thumbSrc){foundThumb=true}$(this).remove();var imageIndex=$$.newImage(src,thumbSrc,caption,thumbData);if(imageIndex>-1){if(isSelected){selectedIndex=imageIndex}if($$.loadQueue.length<$.exposure.preloadBuffer){$$.addToLoadQueue(imageIndex)}}}else{$(this).remove()}});if(!$.exposure.showThumbs){$.exposure.pageSize=1;$('.exposureThumbs').remove()}if(foundImage){$$.preloadNextInQueue();$$.createPaging();if(selectedIndex){$.exposure.goToPage($.exposure.pageNumberForImage(selectedIndex));$.exposure.viewImage(selectedIndex)}else{$.exposure.goToPage(1)}if($.exposure.enableSlideshow&&$.exposure.autostartSlideshow){$.exposure.playSlideshow()}}else{$.exposure.onEmpty()}}else{$.exposure.onEmpty()}$.exposure.onInit();$$.initialized=true})};$$.defined=function(v){return typeof v!=='undefined'};$$.object=function(v){return typeof v==='object'};$$.startsWith=function(s1,s2){if(s1&&s2){return s1.match("^"+s2)===s2}return false};$$.widthDiff=function(el){return el?el.outerWidth(true)-el.width():0};$$.heightDiff=function(el){return el?el.outerHeight(true)-el.height():0};$$.Image=function(src,thumb,caption,data){this.src=src;this.thumb=thumb;this.caption=caption;this.data=data;this.loaded=false};$$.images=[];$$.sources={};$$.newImage=function(src,thumb,caption,data){var alreadyAdded=$$.defined($$.sources[src]);if(alreadyAdded&&!$.exposure.allowDuplicates){return-1}var image=new $$.Image(src,thumb,caption,data);var imageIndex=$$.images.push(image)-1;if(!alreadyAdded){$$.sources[src]=imageIndex}return imageIndex};$$.initialized=false;$$.current=-1;$$.deselectCurrentImage=function(){$$.current=-1;$('.exposureThumbs li.active').removeClass('active')};$$.loadQueue=[];$$.addToLoadQueue=function(index){if(!$$.loaded(index)&&!$$.queued(index)){$$.loadQueue.push(index)}};$$.queued=function(index){return $.inArray(index,$$.loadQueue)>-1};$$.loaded=function(index){var image=$.exposure.getImage(index);if(image!==null){return image.loaded}return false};$$.nextInLoadQueue=function(){var i;if($$.loadQueue.length>0){var next=$$.loadQueue.shift();if($$.loaded(next)){i=$.inArray(index,$$.loadQueue);$$.loadQueue.splice(i,1);return $$.nextInLoadQueue()}return next}return null};$$.preloadNextInQueue=function(){if($$.loadQueue.length>0){var nextIndex=$$.nextInLoadQueue();if(nextIndex!==null){$$.loadImage(nextIndex,$$.preloadNextInQueue)}}};$$.loadPage=function(page,imageToView){if($$.validPage(page)){var last=page*$.exposure.pageSize;var first=last-$.exposure.pageSize;if(last>$$.images.length){last=$$.images.length}$$.pageTransition=true;$$.viewThumbs(first,last-1);if(!$.exposure.separatePageBrowsing){if(imageToView){$.exposure.viewImage(imageToView)}else{if(page>1||((page===1&&$.exposure.viewFirstImage)||$$.initialized)){$.exposure.viewImage(first)}}}$$.pageTransition=false}};$$.viewThumbs=function(first,last){var i;if($.exposure.showThumbs){for(i=first;i<=last;i++){$$.viewThumb(i,i===first,i===last,true)}if(!$.exposure.carouselControls&&$$.currentPage<$.exposure.numberOfPages()){var firstNext=last+1;var lastNext=last+$.exposure.pageSize;if(lastNext>=$$.images.length){lastNext=$$.images.length-1}for(i=firstNext;i<=lastNext;i++){var container=$$.viewThumb(i,i===firstNext,i===lastNext,false);if(container&&container.length){container.hide()}}}}};$$.viewThumb=function(index,first,last,currentPage){if(index<0){index=$$.images.length+index}else if(index>=$$.images.length){index=index-$$.images.length}var image=$$.images[index];var container=$.exposure.getThumb(index).parent();if(!container.length){container=$$.createThumbForImage(image,index);container.attr('rel',$.exposure.pageNumberForImage(index))}if(container.length){container.parent().append(container);if(first){container.addClass('first')}else{container.removeClass('first')}if(last){container.addClass('last')}else{container.removeClass('last')}if(currentPage){if($.exposure.carouselControls){container.show()}else{container.addClass('current')}}}return container};$$.loadImage=function(index,onload){var image=$.exposure.getImage(index);var img=$('<img />').addClass('exposureImage');var i;if(image!==null){image.loaded=true;if($$.queued(index)){i=$.inArray(index,$$.loadQueue);$$.loadQueue.splice(i,1)}if(typeof onload==='function'){img.load(onload)}img.attr('src',image.src)}return img};$$.createThumbForImage=function(image,index){if($.exposure.showThumbs){var thumb=$.exposure.getThumb(index);if(thumb===null||!thumb.length){var container=$('<li></li>');$('.exposureThumbs').append(container);thumb=$('<img />');if(image.thumb){thumb.attr('src',image.thumb)}else{thumb.attr('src',image.src);var imageWidth=Math.ceil(thumb.width()/thumb.height()*container.height());var imageHeight=Math.ceil(thumb.height()/thumb.width()*container.width());if(imageWidth<imageHeight){thumb.css({height:'auto',maxWidth:container.width()})}else{thumb.css({width:'auto',maxHeight:container.height()})}}container.append(thumb.css('display','block'));thumb.attr('rel',index);if(image.caption&&$.exposure.showThumbToolTip){thumb.attr('title',image.caption)}thumb.data('data',image.data);thumb.click(function(){$.exposure.viewImage(Number($(this).attr('rel')))});thumb.load(function(){var imageHeight=$(this).height();if(imageHeight>0){$(this).parent().height(imageHeight)}});$.exposure.onThumb(thumb);return container}}return null};$$.currentPage=1;$$.validPage=function(page){return page>0&&page<=$.exposure.numberOfPages()};$$.createPaging=function(){var i;if($.exposure.showControls&&$.exposure.controls.pageNumbers){var stop=$.exposure.imageControls?$.exposure.numberOfImages():$.exposure.numberOfPages();$('.exposurePaging').each(function(){for(i=1;i<=stop;i++){$(this).append($$.newPagingLink(i))}})}};$$.updatePaging=function(newActivePage){if($.exposure.showControls&&$.exposure.controls.pageNumbers){var current=$.exposure.imageControls?$$.current+1:$$.currentPage;$('.exposurePaging span.active').each(function(){$(this).replaceWith($$.newPagingLink(current))});$('.exposurePaging a[rel="'+newActivePage+'"]').each(function(){$(this).replaceWith($('<span>'+newActivePage+'</span>').addClass('active'))});var pageCount=$.exposure.imageControls?$.exposure.numberOfImages():$.exposure.numberOfPages();if($.exposure.visiblePages>0&&pageCount>$.exposure.visiblePages){var firstVisiblePage=newActivePage;var lastVisiblePage=$.exposure.visiblePages;var flooredVisiblePages=Math.floor($.exposure.visiblePages/2);if(newActivePage<=flooredVisiblePages){firstVisiblePage=1}else if(newActivePage>(pageCount-flooredVisiblePages)){lastVisiblePage=pageCount;firstVisiblePage=lastVisiblePage-$.exposure.visiblePages+1}else{firstVisiblePage-=flooredVisiblePages;lastVisiblePage=firstVisiblePage+$.exposure.visiblePages-1}$('.exposurePaging').each(function(){$(this).children().each(function(i){var currentPage=i+1;if(currentPage>=firstVisiblePage&&currentPage<=lastVisiblePage){$(this).show()}else{$(this).hide()}})})}}};$$.newPagingLink=function(index){return $.exposure.onPagingLink($('<a href="javascript:void(0);" rel="'+index+'">'+index+'</a>').click(function(){var rel=Number($(this).attr('rel'));if($.exposure.imageControls){$.exposure.viewImage(rel-1)}else{$.exposure.goToPage(rel)}}))};$$.pageTransition=false;$$.playingSlideshow=false;$$.slideshowTimer=null;$$.slideshowTransition=false;$$.slideshow=function(){$$.slideshowTimer=setTimeout(function(){$$.slideshowTransition=true;$.exposure.nextImage();$$.slideshowTransition=false;$$.slideshow()},$.exposure.slideshowDelay)};$$.infullScreen=false;$$.actualMaxWidth=function(image,target){return $.exposure.maxWidth?$.exposure.maxWidth-($$.widthDiff(image)+$$.widthDiff(target)):0};$$.actualMaxHeight=function(image,target){return $.exposure.maxHeight?$.exposure.maxHeight-($$.heightDiff(image)+$$.heightDiff(target)):0};$$.fitToMaxSize=function(image){var target=$('.exposureTarget');if($.exposure.stretchToMaxSize){if($.exposure.maxWidth){image.width($$.actualMaxWidth(image,target))}if($.exposure.maxHeight){image.height($$.actualMaxHeight(image,target))}}else{if(image.width()>image.height()){$$.fitToMaxWidth(image,target);$$.fitToMaxHeight(image,target)}else if(image.height()>image.width()){$$.fitToMaxHeight(image,target);$$.fitToMaxWidth(image,target)}else{var actualMaxHeight=$$.actualMaxHeight(image,target);var smallest=$$.actualMaxWidth(image,target);if(!smallest||(actualMaxHeight&&smallest&&actualMaxHeight<smallest)){smallest=actualMaxHeight}if(smallest&&image.width()>smallest){image.width(smallest);image.height(smallest)}}}};$$.centerImageInWindow=function(image){var target=$('.exposureTarget');target.width(image.width()).height(image.height());target.css({'top':($(window).height()-target.outerHeight(true))/2,'left':($(window).width()-target.outerWidth(true))/2});$('.exposureLastImage').each(function(){$(this).css({'top':(target.height()-$(this).height())/2,'left':(target.width()-$(this).width())/2})})};$$.fitToMaxWidth=function(image,target){var actualMaxWidth=$$.actualMaxWidth(image,target);if(actualMaxWidth&&image.width()>actualMaxWidth){var newHeight=Math.round(actualMaxWidth*image.height()/image.width());image.height(newHeight);image.width(actualMaxWidth)}};$$.fitToMaxHeight=function(image,target){var actualMaxHeight=$$.actualMaxHeight(image,target);if(actualMaxHeight&&image.height()>actualMaxHeight){var newWidth=Math.round(actualMaxHeight*image.width()/image.height());image.width(newWidth);image.height(actualMaxHeight)}};$$.resizeContainer=function(img){$$.fitToMaxSize(img);if(!$.exposure.fixedContainerSize){$('.exposureTarget').show().width(img.width()).height(img.height())}};$.extend({exposure:{pageNumberForImage:function(index){return Math.ceil((index+1)/$.exposure.pageSize)},numberOfPages:function(){return $.exposure.pageNumberForImage($$.images.length-1)},atFirstPage:function(){return $$.currentPage===1},atLastPage:function(){return $$.currentPage===$.exposure.numberOfPages()},firstImageOnPage:function(index){if(!index){index=$$.current}return $.exposure.pageSize===1||(index%$.exposure.pageSize===0)},lastImageOnPage:function(index){if(!index){index=$$.current}var imageCount=$$.images.length;if($.exposure.pageSize===1||imageCount===1){return true}if(index>0){var currentPageSize=$.exposure.pageSize;var currentPage=$.exposure.pageNumberForImage(index);if(currentPage===$.exposure.numberOfPages()){var newPageSize=imageCount%$.exposure.pageSize;if(newPageSize>0){currentPageSize=newPageSize}}var imageIndex=index;if(currentPage>1){imageIndex-=(currentPage-1)*$.exposure.pageSize}return(imageIndex+1)%currentPageSize===0}return false},currentPage:function(){return $$.currentPage},numberOfImages:function(){return $$.images.length},atFirstImage:function(){return $$.current===0},atLastImage:function(){return $$.current===$.exposure.numberOfImages()-1},getImage:function(index){if(index!==null&&index>-1&&index<$$.images.length){return $$.images[index]}return null},indexOfImage:function(src){if(src&&$$.defined($$.sources[src])){return $$.sources[src]}return-1},currentImage:function(){return $$.current},addImage:function(src,thumb,caption,data){var pageCount=$.exposure.numberOfPages();var index=$$.newImage(src,thumb,caption,data);if(index>-1){var pageNumber=$.exposure.pageNumberForImage(index);var containers=$('.exposureThumbs li[rel="'+pageNumber+'"]');if(containers.length){containers.removeClass('last')}var newPageAdded=pageNumber>pageCount;if(newPageAdded){$('.exposurePaging').empty();$$.createPaging()}if(newPageAdded||pageNumber===$$.currentPage){$.exposure.goToPage($$.currentPage)}}},removeImage:function(index){if($$.images.length===1){$.exposure.removeAllImages()}else{if($.exposure.enableSlideshow){$.exposure.pauseSlideshow()}var oldPageCount=$.exposure.numberOfPages();$$.images.splice(index,1);var queueIndex=$.inArray(index,$$.loadQueue);if(queueIndex>-1){$$.loadQueue.splice(queueIndex,1)}var container=$.exposure.getThumb(index).parent();container.remove();$('.exposureThumbs > li').each(function(i){if(i>=index){var newRel=$.exposure.pageNumberForImage(i);$(this).attr('rel',newRel);$(this).find('img').attr('rel',i);if($.exposure.firstImageOnPage(i)){$(this).addClass('first')}else{$(this).removeClass('first')}if($.exposure.lastImageOnPage(i)){$(this).addClass('last')}else{$(this).removeClass('last')}if($$.currentPage===newRel){$(this).show()}else{$(this).hide()}}});var pageRemoved=$.exposure.numberOfPages<oldPageCount;if(pageRemoved){$('.exposurePaging').empty();$$.createPaging()}if($$.current===index){$$.current=-1;var nextIndex=index;if(index===$.exposure.numberOfImages()){nextIndex=0}$.exposure.viewImage(nextIndex)}}},removeAllImages:function(){$$.images=[];$$.sources={};$$.loadQueue=[];if($.exposure.enableSlideshow){$.exposure.pauseSlideshow()}$('.exposureThumbs').empty();$('.exposurePaging').empty();$.exposure.viewImage(0)},getThumb:function(index){return $('.exposureThumbs img[rel="'+index+'"]')},getNextImage:function(){if($$.current===$$.images.length-1){if($.exposure.loop){return 0}else{$.exposure.onEndOfLoop()}}else{return $$.current+1}return null},getPrevImage:function(){if($$.current===0){if($.exposure.loop){return $$.images.length-1}}else{return $$.current-1}return null},goToPage:function(page,imageToView){if($$.validPage(page)){$('.exposureThumbs li').removeClass('current').hide();$$.loadPage(page,imageToView);if(!$.exposure.imageControls){$$.updatePaging(page)}$$.currentPage=page;if($.exposure.showControls){if($.exposure.atFirstPage()){if($.exposure.controls.firstLast){$('.exposureFirstPage').addClass('disabled')}if(!$.exposure.loop&&$.exposure.controls.prevNext){$('.exposurePrevPage').hide()}}else{if($.exposure.controls.firstLast){$('.exposureFirstPage').removeClass('disabled')}if(!$.exposure.loop&&$.exposure.controls.prevNext){$('.exposurePrevPage').show()}}if($.exposure.atLastPage()){if($.exposure.controls.firstLast){$('.exposureLastPage').addClass('disabled')}if(!$.exposure.loop&&$.exposure.controls.prevNext){$('.exposureNextPage').hide()}}else{if($.exposure.controls.firstLast){$('.exposureLastPage').removeClass('disabled')}if(!$.exposure.loop&&$.exposure.controls.prevNext){$('.exposureNextPage').show()}}}if(!$.exposure.carouselControls){$.exposure.onPageChanged()}}},firstPage:function(){if(!$.exposure.atFirstPage()){$.exposure.goToPage(1)}},lastPage:function(){if(!$.exposure.atLastPage()){$.exposure.goToPage($.exposure.numberOfPages())}},prevPage:function(){if(!$.exposure.atFirstPage()){$.exposure.goToPage($$.currentPage-1)}else if($.exposure.loop){$.exposure.goToPage($.exposure.numberOfPages())}},nextPage:function(){if(!$.exposure.atLastPage()){$.exposure.goToPage($$.currentPage+1)}else if($.exposure.loop){$.exposure.goToPage(1)}},viewImage:function(index){if($$.current!==index){if($.exposure.enableSlideshow&&!$$.slideshowTransition){$.exposure.pauseSlideshow()}var wrapper=$('.exposureWrapper');var validImage=false;var image=$$.images[index];if(image){var src=image.src;var caption=image.caption;var extraImageData=image.data;if(src){validImage=true;var hasThumb=$.exposure.showThumbs;var thumb=null;if($.exposure.showThumbs){thumb=$('.exposureThumbs img[rel="'+index+'"]');hasThumb=thumb&&thumb.length;if(hasThumb){thumb.parent().siblings().removeClass('active');thumb.parent().addClass('active')}else{$('.exposureThumbs li.active').removeClass('active')}}wrapper.parent().removeClass('exposureLoaded');if($$.loaded(index)){wrapper.parent().addClass('exposureLoaded')}var img=$$.loadImage(index,function(){var lastImage=wrapper.find('.exposureImage');if(lastImage.length){lastImage.removeClass('exposureCurrentImage');lastImage.addClass('exposureLastImage')}$(this).addClass('exposureCurrentImage');wrapper.append($(this));if($.exposure.clickingNavigation){$(this).click($.exposure.nextImage)}if(!$(this).width()||!$(this).height()){var i=$(this);var delay=setInterval(function(){$$.resizeContainer(i);clearTimeout(delay)},2)}else{$$.resizeContainer($(this))}if($.exposure.fullScreen&&!$$.infullScreen){$.exposure.onEnterFullScreen($('.exposureMask'));$$.infullScreen=true}var imageDataContainer=$.exposure.dataTarget?$($.exposure.dataTarget):wrapper.siblings('.exposureData');if(imageDataContainer.length){if($.exposure.showCaptions){var captionContainer=imageDataContainer.find('.caption');if(captionContainer.length){captionContainer.empty();if(!caption&&hasThumb){caption=thumb.attr('title')}}captionContainer.html(caption)}if($.exposure.showExtraData){var extraImageDataContainer=imageDataContainer.find('.extra');if(extraImageDataContainer.length){extraImageDataContainer.empty();if(!extraImageData&&hasThumb){extraImageData=thumb.data('data')}extraImageDataContainer.html(extraImageData)}}}$.exposure.onImage($(this),imageDataContainer,thumb);$$.preloadNextInQueue()})}}if(!validImage){wrapper.siblings().andSelf().empty();$('.exposureThumbs li.active').removeClass('active')}if($.exposure.imageControls){var page=$.exposure.pageNumberForImage(index);if($$.currentPage!==page&&!$$.pageTransition){$.exposure.goToPage(page,index)}$$.updatePaging(index+1)}$$.current=index;if($.exposure.carouselControls&&$$.images.length>$.exposure.pageSize){var firstVisibleImage=index;var lastVisibleImage=$.exposure.pageSize-1;var flooredVisibleImages=Math.floor($.exposure.pageSize/2);if(!$.exposure.loop&&index<flooredVisibleImages){firstVisibleImage=0}else if(!$.exposure.loop&&index>=($$.images.length-flooredVisibleImages)){lastVisibleImage=$$.images.length-1;firstVisibleImage=lastVisibleImage-$.exposure.pageSize}else{firstVisibleImage-=flooredVisibleImages;lastVisibleImage=firstVisibleImage+$.exposure.pageSize-1}$.exposure.onCarousel(firstVisibleImage,lastVisibleImage);$('.exposureThumbs li').removeClass('current').hide();$$.viewThumbs(firstVisibleImage,lastVisibleImage);$$.currentPage=$.exposure.pageNumberForImage(index)}}},firstImage:function(){if(!$.exposure.atFirstImage()){if($.exposure.separatePageBrowsing||$.exposure.atFirstPage()){$.exposure.viewImage(0)}else{$.exposure.goToPage(1)}}},nextImage:function(){if(!$.exposure.separatePageBrowsing&&$.exposure.lastImageOnPage()){if($.exposure.atLastPage()&&$.exposure.loop){$.exposure.goToPage(1)}else{$.exposure.goToPage($$.currentPage+1)}$.exposure.onNext()}else{var next=$.exposure.getNextImage();if(next!==null){$.exposure.viewImage(next);$.exposure.onNext()}}var nextNext=$.exposure.getNextImage();if(nextNext!==null){$$.addToLoadQueue(nextNext)}},prevImage:function(){if(!$.exposure.separatePageBrowsing&&$.exposure.firstImageOnPage()){if($.exposure.atFirstPage()&&$.exposure.loop){$.exposure.goToPage($.exposure.numberOfPages(),$.exposure.numberOfImages()-1)}else{var page=$$.currentPage-1;$.exposure.goToPage(page,page*$.exposure.pageSize-1)}$.exposure.onPrev()}else{var prev=$.exposure.getPrevImage();if(prev!==null){$.exposure.viewImage(prev);$.exposure.onPrev()}}var prevPrev=$.exposure.getPrevImage();if(prevPrev!==null){$$.addToLoadQueue(prevPrev)}},lastImage:function(){if(!$.exposure.atLastImage()){if($.exposure.separatePageBrowsing||$.exposure.atLastPage()){$.exposure.viewImage($.exposure.numberOfImages()-1)}else{$.exposure.goToPage($.exposure.numberOfPages(),$.exposure.numberOfImages()-1)}}},playSlideshow:function(){if(!$$.playingSlideshow){if($.exposure.slideshowControlsTarget){$('.exposurePlaySlideshow').hide();$('.exposurePauseSlideshow').show()}$$.slideshow();$$.playingSlideshow=true}$.exposure.onSlideshowPlayed()},pauseSlideshow:function(){if($$.playingSlideshow){if($.exposure.slideshowControlsTarget){$('.exposurePlaySlideshow').show();$('.exposurePauseSlideshow').hide()}$$.playingSlideshow=false;if($$.slideshowTimer){clearTimeout($$.slideshowTimer)}$.exposure.onSlideshowPaused()}},toggleSlideshow:function(){if($$.playingSlideshow){$.exposure.pauseSlideshow()}else{$.exposure.playSlideshow()}},first:function(){if($.exposure.imageControls){$.exposure.firstImage()}else{$.exposure.firstPage()}},prev:function(){if($.exposure.imageControls){$.exposure.prevImage()}else{$.exposure.prevPage()}},next:function(){if($.exposure.imageControls){$.exposure.nextImage()}else{$.exposure.nextPage()}},last:function(){if($.exposure.imageControls){$.exposure.lastImage()}else{$.exposure.lastPage()}},exitFullScreen:function(){if($$.infullScreen){$.exposure.pauseSlideshow();$$.deselectCurrentImage();$.exposure.onExitFullScreen($('.exposureTarget'),$('.exposureMask'));$$.infullScreen=false}},fitToWindow:function(){$.exposure.maxWidth=$(window).width();$.exposure.maxHeight=$(window).height();var image=$('.exposureCurrentImage').width('auto').height('auto');$$.fitToMaxSize(image);if(!image.width()||!image.height()){var delay=setInterval(function(){$$.centerImageInWindow(image);clearTimeout(delay)},2)}else{$$.centerImageInWindow(image)}},texts:{first:'First',previous:'Prev',next:'Next',last:'Last',play:'Play slideshow',pause:'Pause slideshow'}}})})(jQuery);
  /*
  * jQuery Hotkeys Plugin
  * Copyright 2010, John Resig
  * Dual licensed under the MIT or GPL Version 2 licenses.
  *
  * Based upon the plugin by Tzury Bar Yochay:
  * http://github.com/tzuryby/hotkeys
  *
  * Original idea by:
  * Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/
  */
  (function(jQuery){jQuery.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta"},shiftNums:{"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":": ","'":"\"",",":"<",".":">","/":"?","\\":"|"}};function keyHandler(handleObj){if(typeof handleObj.data!=="string"){return}var origHandler=handleObj.handler,keys=handleObj.data.toLowerCase().split(" ");handleObj.handler=function(event){if(this!==event.target&&(/textarea|select/i.test(event.target.nodeName)||event.target.type==="text")){return}var special=event.type!=="keypress"&&jQuery.hotkeys.specialKeys[event.which],character=String.fromCharCode(event.which).toLowerCase(),key,modif="",possible={};if(event.altKey&&special!=="alt"){modif+="alt+"}if(event.ctrlKey&&special!=="ctrl"){modif+="ctrl+"}if(event.metaKey&&!event.ctrlKey&&special!=="meta"){modif+="meta+"}if(event.shiftKey&&special!=="shift"){modif+="shift+"}if(special){possible[modif+special]=true}else{possible[modif+character]=true;possible[modif+jQuery.hotkeys.shiftNums[character]]=true;if(modif==="shift+"){possible[jQuery.hotkeys.shiftNums[character]]=true}}for(var i=0,l=keys.length;i<l;i++){if(possible[keys[i]]){return origHandler.apply(this,arguments)}}}}jQuery.each(["keydown","keyup","keypress"],function(){jQuery.event.special[this]={add:keyHandler}})})(jQuery);