$(function(){
	var headerHidden = false;
	var mapOn = false;
	var mapShow = false;
	var mapHeight, listHeight;
	var mapContainer = $("#mapContainer");
	var list = $("#list");
	var mapToggle = $(".mapToggle");
	var search = $("#search");

	function toggleMap (){
		if (mapShow) {
			mapToggle.html("Map View");
			//animate
			scrollUp(mapContainer, function(){scrollDown(list, listHeight);});
		}else{
			mapToggle.html("List View");
			//animate
			scrollUp(list, function(){scrollDown(mapContainer, mapHeight, doInit);});
		}
		mapShow = !mapShow;
	}

	function scrollDown(object, height, callback){
		object.show();
		object.animate({height: height}, 1000, function(){
			if (callback) {
				callback();
			}
		});
	}

	function scrollUp(object, callback){
		object.animate({height: 0}, 1000, function(){
			object.hide();
			if (callback) {
				callback();
			}
		})
	}

	function doInit(){
		//initialize the map if it wasn't already on
		if (!mapOn && mapContainer.data('latitude') && mapContainer.data('longitude')) {
			initMap(mapContainer.data('latitude'), mapContainer.data('longitude'));

			//get a list of points from the server based on the searched location
			$.get( '/restrooms' + window.location.search , {}, function( data ) {
			  for(var i = 0; i < data.length; i++){
				//for each point in the data, put a point on the map
				setPoint(data[i], i + 1);
			  }
			}, 'json');
			mapOn = true;
		}
	}


	if (mapContainer.length > 0 && list.length > 0 && mapToggle.length > 0) {
		if (!mapContainer.data('latitude') || !mapContainer.data('longitude')) {
			//catch bad URL
			searchLocation(search.val());
		}
		//get default height for animation later
		mapHeight = mapContainer.height();
		listHeight = list.height();

		//hide the map
		mapContainer.hide();
		mapContainer.height(0);

		mapToggle.click(function(){
			//toggle which display is open
			toggleMap();
		});
	}
});
@@ -7,16 +7,45 @@
 tion()%7B%0A
+%09var ANIMATE_DURATION = 250;%0A
 %09var hea
@@ -109,36 +109,8 @@
 se;%0A
-%09var mapHeight, listHeight;%0A
 %09var
@@ -255,340 +255,129 @@
 eMap
- 
 ()
+ 
 %7B%0A%09%09
-if (
 mapShow
-) %7B%0A%09%09%09mapToggle.html(%22Map View%22)
+ = !mapShow
 ;%0A%09%09
-%09//animate%0A%09%09%09scrollUp(mapContainer, function()%7BscrollDown(list, listHeight);%7D);%0A%09%09%7Delse%7B%0A%09%09%09mapToggle.html(%22List View%22);%0A%09%09%09//animate%0A%09%09%09scrollUp(list, function()%7BscrollDown(mapContainer, mapHeight, doInit);%7D);%0A%09%09%7D%0A%09%09mapShow = !mapShow;%0A%09%7D%0A%0A%09function scrollDown(object, height
+var callback = mapShow ? doInit : $.noop;%0A%09%09mapContainer.stop().slideToggle(ANIMATE_DURATION
 , ca
@@ -387,278 +387,108 @@
 ack)
-%7B%0A%09%09object.show();%0A%09%09object.animate(%7Bheight: height%7D, 1000, function()%7B%0A%09%09%09if (callback) %7B%0A%09%09%09%09callback();%0A%09%09%09%7D%0A%09%09%7D);%0A%09%7D%0A%0A%09function scrollUp(object, callback)%7B%0A%09%09object.animate(%7Bheight: 0%7D, 1000, function()%7B%0A%09%09%09object.hide();%0A%09%09%09if (callback) %7B%0A%09%09%09%09callback();%0A%09%09%09%7D%0A%09%09%7D)
+;%0A%09%09list.stop().slideToggle(ANIMATE_DURATION);%0A%09%09mapToggle.text(mapShow ? 'List View' : 'Map View');
 %0A%09%7D%0A
@@ -1248,253 +1248,50 @@
 %09%09%7D%0A
-%09%09//get default height for animation later%0A%09%09mapHeight = mapContainer.height();%0A%09%09listHeight = list.height();%0A%0A%09%09//hide the map%0A%09%09mapContainer.hide();%0A%09%09mapContainer.height(0);%0A%0A%09%09mapToggle.click(function()%7B%0A%09%09%09//toggle which display is open%0A%09%09%09
+%0A%09%09mapContainer.hide();%0A%09%09mapToggle.click(
 togg
@@ -1299,15 +1299,8 @@
 eMap
-();%0A%09%09%7D
 );%0A%09
@@ -1304,8 +1304,9 @@
 ;%0A%09%7D%0A%7D);
+%0A

Use jQuery.slideToggle to simplify animation code