(function(jQuery){jQuery.fn.reverse=[].reverse;jQuery.fn.rsSlideShow=function(o){o=jQuery.extend({showWidth:803,itemClass:'item',pointerClass:'pointer',animationDuration:500,sleepDuration:10000,animationType:'fade'},o||{});var show=jQuery(this);var items=show.find('.'+o.itemClass);var showSize=items.size();var pointer=show.find('.'+o.pointerClass).first();var locked=false;pointer.find('a.point').click(function(){changeImage(jQuery(this).attr('href').substring(1));return false;});if(showSize<=1){pointer.remove();}else{pointer.show();}
if(o.animationType=='slide')
{show.append(jQuery('<div class="slider"></div>'));var slider=jQuery('.slider');slider.width(showSize*o.showWidth);show.find('.'+o.itemClass).each(function(){var elem=jQuery(this);elem.detach();slider.append(elem);elem.show();});}else{show.find('.'+o.itemClass+':visible').each(function(){if(items.first().attr('id')!=jQuery(this).attr('id'))
jQuery(this).hide();});}
if(showSize>1){startTimer();}
function changeImage(id)
{if(locked)return;locked=true;stopTimer();pointer.find('a.point').removeClass('active');pointer.find('a.point[href="#'+id+'"]').addClass('active');if(o.animationType=='slide')
{slider.stop(true,true).animate({left:'-'+slider.find('.'+id).position().left+'px'},o.animationDuration,'easeInOutCubic',function(){startTimer();locked=false;});}else{show.find('.'+o.itemClass+':visible').each(function(){if(jQuery(this).attr('id')!=id)
jQuery(this).fadeOut(o.animationDuration);});jQuery('#'+id+':hidden').fadeIn(o.animationDuration,function(){startTimer();locked=false;});}}
function nextImage()
{if(o.animationType=='slide'){var current=Math.round(Math.abs(slider.position().left/o.showWidth));if(current>=showSize-1)
{resetSlider();}
else{changeImage(pointer.find('a.point').reverse().slice(current+1,current+2).attr('href').substring(1));}}else{var next=show.find('.'+o.itemClass+':visible').first().next();if(next.hasClass(o.itemClass))
{changeImage(next.attr('id'));}else{changeImage(items.first().attr('id'));}}}
function resetSlider()
{if(locked)return;locked=true;stopTimer();pointer.find('a.point').removeClass('active');pointer.find('a.point:last').addClass('active');var firstclone=slider.children().first().clone();firstclone.css('left',o.showWidth+'px');firstclone.css('position','absolute');slider.after(firstclone);slider.stop(true,true).animate({left:(slider.position().left-o.showWidth)+'px'},o.animationDuration,'easeInOutCubic');firstclone.animate({left:'0px'},o.animationDuration,'easeInOutCubic',function(){slider.stop(true,true).css('left','0px');startTimer();locked=false;jQuery(this).remove();});}
function startTimer()
{jQuery(document).oneTime(o.sleepDuration,'rsShow',function(){nextImage();});}
function stopTimer()
{jQuery(document).stopTime('rsShow');}
return this;}})(jQuery);
