			$(document).ready(function(){
			
				    $('.slideshow').each(function() {
					var p = this.parentNode,
					numb = $('.counter', p);
					
						$(this).cycle({
				        	fx: 'fade',
				        	speed: 400,
				        	timeout:   0,
						 	next: $('.prev, .slideshow', p),
						    prev: $('.next', p),
				        	after:    onAfter,
				    });
				

				function onAfter(curr,next,opts) {
					var caption = (opts.currSlide + 1) + '&nbsp; of &nbsp;' + opts.slideCount;
					numb.html(caption);
				}
				});
			});
			
			$(document).ready(function(){
			
				// hide #back-top first
				$("#back-top").hide();
				
				// fade in #back-top
				$(function () {
					$(window).scroll(function () {
						if ($(this).scrollTop() > 100) {
							$('#back-top').fadeIn();
						} else {
							$('#back-top').fadeOut();
						}
					});
			
					// scroll body to 0px on click
					$('#back-top a').click(function () {
						$('body,html').animate({
							scrollTop: 0
						}, 800);
						return false;
					});
				});
			
			});
