$(document).ready(function() {
	$("a.anchorLink").anchorAnimate()
});
$(document).ready(function() {
	var el = $("#anchor1");
	el.css('display','none'); //in case the user forgot 
	$(window).scroll(function() {
		//stupid IE hack
		if(!jQuery.support.hrefNormalized) {
			el.css({
				'position': 'absolute',
				'top': $(window).scrollTop() + $(window).height() - 50
			});
		}
		if($(window).scrollTop() >= 1){
			el.fadeIn("slow");
		}else{
			el.fadeOut("slow");
		}
	});
});

jQuery.fn.anchorAnimate = function(settings) {
	settings = jQuery.extend({
		speed : 1100
	}, 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;
		})
	})
}