Issue on Using One Switch Botton to Toggle Functions in jQuery

Issue on Using One Switch Botton to Toggle Functions in jQuery

I am using two buttons to slide up and down the page at  this sample  as:
  1. <div id="map"><button type="button" class="btn btn-default green goinfo">Go Info</button></div>
  2. <div id="info"> <button type="button" class="btn btn-default green gomap">Go Map</button></div>

can you please let me know how I can reduce the buttons to do do the same job? something like :
  1. <button type="button" class="btn btn-default slider">Switch View</button>
and this is the jQuery that I have

  1. jQuery('body').css('overflow','hidden'); 
  2.      var viewheight = $('#map').height();

  3.  $('.goinfo').fadeIn();
  4.     $(window).scroll(function () {
  5.         if ($(this).scrollTop() < 100) {
  6.             $('.goinfo').fadeIn();
  7.         } else {
  8.             $('.goinfo').fadeOut();
  9.         }
  10.     });

  11.      $(window).scroll(function () {
  12.         if ($(this).scrollTop() > 100) {
  13.             $('.gomap').fadeIn();
  14.         } else {
  15.             $('.gomap').fadeOut();
  16.         }
  17.     });

  18.     $('.gomap').click(function () {
  19.         $("html, body").animate({
  20.             scrollTop: 0
  21.         }, 600);
  22.         return false;
  23.     });

  24.      $('.goinfo').click(function () {

  25.         $("html, body").animate({
  26.             scrollTop: viewheight
  27.         }, 600);
  28.         return false;
  29.     });

  30.     $( window ).resize(function() {
  31.     var mapheight = $('#mapview').height();

  32. });
Thanks