$(function() {
	$(window).scroll(function(){
		var distanceTop = $('#last').offset().top + 105 - $(window).height();
		var distanceBtm = $('#footer-links').offset().top - $(window).height();
                var scrollTop = $(window).scrollTop();
		if  (scrollTop > distanceTop && distanceBtm > scrollTop ){
			$('#slidebox').animate({'right':'0px'},300);}
		else{
			$('#slidebox').stop(true).animate({'right':'-430px'},100);}
	});

	$('#slidebox .close').bind('click',function(){
		$(this).parent().remove();
	});
});
