(function(){
    
    var special = jQuery.event.special,
        uid1 = 'D' + (+new Date()),
        uid2 = 'D' + (+new Date() + 1);
        
    special.scrollstart = {
        setup: function() {
            
            var timer,
                handler =  function(evt) {
                    
                    var _self = this,
                        _args = arguments;
                    
                    if (timer) {
                        clearTimeout(timer);
                    } else {
                        evt.type = 'scrollstart';
                        jQuery.event.handle.apply(_self, _args);
                    }
                    
                    timer = setTimeout( function(){
                        timer = null;
                    }, special.scrollstop.latency);
                    
                };
            
            jQuery(this).bind('scroll', handler).data(uid1, handler);
            
        },
        teardown: function(){
            jQuery(this).unbind( 'scroll', jQuery(this).data(uid1) );
        }
    };
    
    special.scrollstop = {
        latency: 300,
        setup: function() {
            
            var timer,
                    handler = function(evt) {
                    
                    var _self = this,
                        _args = arguments;
                    
                    if (timer) {
                        clearTimeout(timer);
                    }
                    
                    timer = setTimeout( function(){
                        
                        timer = null;
                        evt.type = 'scrollstop';
                        jQuery.event.handle.apply(_self, _args);
                        
                    }, special.scrollstop.latency);
                    
                };
            
            jQuery(this).bind('scroll', handler).data(uid2, handler);
            
        },
        teardown: function() {
            jQuery(this).unbind( 'scroll', jQuery(this).data(uid2) );
        }
    };
    
})();

$(function() {
				$('#top0').click(
					function (e) {
						$('html, body').animate({scrollTop: '0px'}, 5000);
					}
				);
				$('#top1').click(
					function (e) {
						$('html, body').animate({scrollTop: '0px'}, 5000);
					}
				);
				$('#top2').click(
					function (e) {
						$('html, body').animate({scrollTop: '0px'}, 5000);
					}
				);
				$('#top3').click(
					function (e) {
						$('html, body').animate({scrollTop: '0px'}, 5000);
					}
				);
				$('#top4').click(
					function (e) {
						$('html, body').animate({scrollTop: '0px'}, 5000);
					}
				);
				$('#top5').click(
					function (e) {
						$('html, body').animate({scrollTop: '0px'}, 5000);
					}
				);
				$('#top6').click(
					function (e) {
						$('html, body').animate({scrollTop: '0px'}, 5000);
					}
				);
				$('#top7').click(
					function (e) {
						$('html, body').animate({scrollTop: '0px'}, 5000);
					}
				);
				$('#nav_classic').click(
					function (e) {
						$('html, body').animate({scrollTop: $("#secondTarget").offset().top}, 4000);
					}
				);
				$('#nav_corporate').click(
					function (e) {
						$('html, body').animate({scrollTop: $("#thirdTarget").offset().top}, 4000);
					}
				);
				$('#ebay_car').click(
					function (e) {
						$('html, body').animate({scrollTop: $("#zeroTarget").offset().top}, 4000);
					}
				);
				
				$('#nav_enclosed').click(
					function (e) {
						$('html, body').animate({scrollTop: $("#fourthTarget").offset().top}, 4000);
					}
				);
				
				
				$('#nav_international').click(
					function (e) {
						$('html, body').animate({scrollTop: $("#fifthTarget").offset().top}, 4000);
					}
				);
				
				$('#nav_motorcycle').click(
					function (e) {
						$('html, body').animate({scrollTop: $("#sixthTarget").offset().top}, 4000);
					}
				);
				
				$('#nav_rv').click(
					function (e) {
						$('html, body').animate({scrollTop: $("#seventhTarget").offset().top}, 4000);
					}
				);
				
				
				$('#nav_snowbirds').click(
					function (e) {
						$('html, body').animate({scrollTop: $("#eightTarget").offset().top}, 4000);
					}
				);
				
            });
