/*
    @plugin jquery-image-viewer
    @description A simple jQuery slideshow plugin that supports autoplay, next/previous buttons, image links, thumbnails and more. This plugin aims to be unobtrusive and loosely coupled so making changes to the structure and style of the slideshow without having to mess with the JavaScript.
    @autors Dana Woodman and Reavis Stuphin-Gray.
    @note Compressed with http://javascriptcompressor.com/ (with "Shrink variables" option)
*/
(function($){$.fn.image_viewer=function(f){var f=$.extend({},$.fn.image_viewer.options,f);var g=this.selector;return this.each(function(){var e=$(this);e.options=$.meta?$.extend({},f,e.data()):f;e.slideshow=$(e.options.slideshow_images_selector);e.slides=e.slideshow.children();e.thumbnail_containers=$(e.options.thumbnails_selector);e.next=$(e.options.next_selector);e.previous=$(e.options.previous_selector);e.thumbnail_containers.each(function(){e.thumbnails=$(this).children();if(e.thumbnails.length>0&&e.thumbnails.length!=e.slides.length){$.fn.image_viewer.debug('Can\'t match thumbnails to slides!');return}});if(e.options.start<0||e.options.start>=e.slides.length){$.fn.image_viewer.debug("Start index out of range!");return};e.slideshow.data('current_slide',e.options.start);if(e.options.delay<0){$.fn.image_viewer.debug('Delay out of range!');return};e.slides.each(function(i,n){$(this).hide()});e.slideshow.show_slide=function(a){var b=e.slideshow.data('current_slide');var c=$(e.slides[b]);var d=$(e.slides[a]);c.hide();d.show();e.slideshow.data('current_slide',a);e.thumbnail_containers.each(function(){e.thumbnails=$(this).children();$(e.thumbnails[b]).removeClass(e.options.active_thumbnail_class);$(e.thumbnails[a]).addClass(e.options.active_thumbnail_class)})};e.slideshow.show_next=function(){var a=e.slideshow.data('current_slide')+1;if(a>=e.slideshow.children().length)a=0;e.slideshow.show_slide(a)};e.slideshow.show_previous=function(){var a=e.slideshow.data('current_slide')-1;if(a<0)a=e.slideshow.children().length-1;e.slideshow.show_slide(a)};e.slideshow.start_timer=function(){if(e.options.delay>0){e.slideshow.timer=setInterval(e.slideshow.show_next,e.options.delay)}};e.slideshow.stop_timer=function(){clearInterval(e.slideshow.timer)};e.slideshow.reset_timer=function(){e.slideshow.stop_timer();e.slideshow.start_timer()};e.slideshow.show_slide(f.start);if(e.options.delay>0){e.slideshow.start_timer();e.slideshow.bind('mouseover',function(){e.slideshow.stop_timer()});e.slideshow.bind('mouseout',function(){e.slideshow.start_timer()})};e.thumbnail_containers.each(function(){e.thumbnails=$(this).children();e.thumbnails.each(function(a){$(this).bind('click',function(){e.slideshow.show_slide(a);e.slideshow.reset_timer();return false})})});e.next.bind('click',function(){e.slideshow.show_next();e.slideshow.reset_timer();return false});e.previous.bind('click',function(){e.slideshow.show_previous();e.slideshow.reset_timer();return false})})};$.fn.image_viewer.debug=function(a){if($.fn.image_viewer.debug){if(window.console&&window.console.log){console.log(a)}else{alert(a)}}};$.fn.image_viewer.options={autoplay:true,debug:false,delay:5000,start:0,slideshow_images_selector:'#slideshow-slides',previous_selector:'#slideshow-previous',next_selector:'#slideshow-next',thumbnails_selector:'#slideshow-thumbnails',active_thumbnail_class:'active-thumbnail'}})(jQuery);