$(document).ready(function(){
	
	// http://www.appelsiini.net/projects/lazyload
	$("img:not(.slides img)").lazyload({
		placeholder : "images/blank.gif",
		effect : "fadeIn"
	});
	
	// http://flesler.blogspot.com/2007/10/jquerylocalscroll-10.html
	$.localScroll({
		offset : {left: 0, top:-50 },
		hash : true
	});
	
	// 
	$('#navigation a:not(.active)').css('opacity', 0.4);
	$('#navigation a').css('background-position', 'bottom');
	$('#navigation a:not(.active)').hover(function(){
		$(this).fadeTo(500, 1);
	}, function(){
		$(this).fadeTo(500, 0.4);
	});
	
	
	// http://greg-j.com/static-content/hover-fade-redux.html
	$('.fadeThis').append('<span class="hover"></span>').each(function(){
		var $span = $('> span.hover', this).css('opacity', 0);
		$(this).hover(function(){
			$span.stop().fadeTo(500, 1);
		}, function () {
			$span.stop().fadeTo(500, 0);
		});
	});
	
	// http://malsup.com/jquery/cycle/int2.html
	$('#slideshow').after('<p id="slideshow-caption"><div id="pager">').cycle({
		fx: 'fade',
		speed: 1000,
		timeout: 0,
		pager: '#pager',
		next:   '#slideshow',
		before:  onBefore, 
		after:   onAfter
	});
	
	$('#map').after('<p id="slideshow-caption"><div id="pager">').cycle({
		fx: 'fade',
		speed: 1000,
		timeout: 5000,
		pager: '#pager',
		next:   '#map', 
		pause:   1,
		before:  onBefore, 
		after:   onAfter
	});
	
	function onBefore() { 
	    //$('#slideshow-caption').html("n");
	}
	
	function onAfter() { 
		$('#slideshow-caption').html("" + this.alt + "");
	}
	
});

