
// lazy load

			$(function() {          
				$("img").lazyload({
				   placeholder : "http://jonleverrier.com/assets/js/1px.gif",
				   effect      : "fadeIn"
				});
			});
			
			$(document).ready(function() {
				$("a.anchorLink").anchorAnimate()
			});
			
			
// scroll to top
			jQuery.fn.anchorAnimate = function(settings) {
			
				settings = jQuery.extend({
					speed : 700
				}, settings);	
				
				return this.each(function(){
					var caller = this
					$(caller).click(function (event) {	
						event.preventDefault()
						var locationHref = window.location.href
						var elementClick = $(caller).attr("href")
						
						var destination = $(elementClick).offset().top;
						$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, settings.speed, function() {
							window.location.hash = elementClick
						});
						return false;
					})
				})
			}
			
			
// floating nav
        $(function() {
            var offset = $("#sidebar").offset();
            var topPadding = 90;
            $(window).scroll(function() {
                if ($(window).scrollTop() > offset.top) {
                    $("#sidebar").stop().animate({
                        marginTop: $(window).scrollTop() - offset.top + topPadding
                    });
                } else {
                    $("#sidebar").stop().animate({
                        marginTop: 0
                    });
                };
            });
        });
