/*
 * 
 * 
 * 
 */
function ws_Getting() {
	var me = this;

	me.currentKmlObject = null;
	
	me.displayPlanes = null;
	me.displayTrains = null;
	me.displayFerries = null;
	me.displayCars = null;
	me.displayBus = null;
	
	me.ghelpers = new GEHelpers(ge);
	
	me.divContainerHeader = ".Right-Panel-Header";
	me.divContainer = ".Right-Panel-Container";
	me.divContainerNews = "#Right-Panel-News";
	me.divContainerFooter = ".Right-Panel-Footer";
	
	me.getNews("http://sports.yahoo.com/oly/rss.xml");
	
	$(me.divContainerFooter).hide();
	me.loadCrossingStations();
}

ws_Getting.prototype.getPlanes = function() {
	$(this.divContainerHeader).html('<div id="header-text">Planes</div>');
	$(this.divContainer).hide();
	$(this.divContainerFooter).show();
	
	var icon = BASE_URL + 'images/getting-there-icons/plane-icon.png';
	
	if(!this.displayPlanes) {
		var latlng = new google.maps.LatLng(49.194579, -123.191472);
		var opts = {name: 'Vancouver International Airport', snippet: 'airports', icon: icon};
		this.ghelpers.createPointPlacemark(latlng, opts);
	
		latlng = new google.maps.LatLng(47.444430, -122.300497);
		opts = {name: 'Seattle-Tacoma International Airport', snippet: 'airports', icon: icon};
		this.ghelpers.createPointPlacemark(latlng, opts);
	}
};

ws_Getting.prototype.getTrains = function() {
	$(this.divContainer).show();
	$(this.divContainerFooter).hide();
	$(this.divContainerHeader).html('<div id="header-text">Trains</div>');
	var info = "The two trains a day run from each city at approximately 7:30 am and 7pm. (check Amtrak for exact times).  The evening train out of Seattle is a continuation of the train from Portland, and therefore does not always leave on time. The other trains are usually on time leaving and within about 10 minutes of on-time arriving.";
	$(this.divContainer).html(info);
	
	if(!this.displayTrains) {
		this.loadTrainStations();
			
		google.earth.fetchKml(ge, LIB_URL + 'kml/train_route.kml', function(kmlObject) {
			control.kmlLoaded(kmlObject);
			control.displayTrains = kmlObject;
		});
	}
};

ws_Getting.prototype.getFerries = function() {
	$(this.divContainer).show();
	$(this.divContainerFooter).hide();
	$(this.divContainerHeader).html('<div id="header-text">Ferries</div>');
	$(this.divContainer).html('<a href="http://www.clippervacations.com/ferry/ferryschedule" target="_blank">Ferries</a> The easiest way to get to Victoria is by Victoria Clipper . They also offer trips to the San Juan Islands. This is a passenger-only ferry. While that might sound like an obstacle, it\'s not really.  Nearly everything that is of interest to a tourist is in Victoria\'s downtown core. A convenient strategy is to take the Clipper to Victoria and then take a double decker city tour.  They offer this in conjunction with a trip to the wonderful Butchart Gardens. It is recommended that you visit the Gardens later in the afternoon when the crowds have thinned out.');
	
	if(!this.displayFerries) {
		this.loadFerryStations();
		
		google.earth.fetchKml(ge, LIB_URL + 'kml/ferry_route.kml', function(kmlObject) {
			control.kmlLoaded(kmlObject);
			control.displayFerries = kmlObject;
		});
	}
};

ws_Getting.prototype.getCars = function() {
	$(this.divContainer).show();
	$(this.divContainerFooter).hide();
	$(this.divContainerHeader).html('<div id="header-text">Cars</div>');
	$(this.divContainer).html('If you have to take the car be prepared for long waits at the border. Waits of 60 minutes are not uncommon.  Here are a few hints to help you plan around these delays. First of all tune your radio to 1130 am. That is a Canadian radio station that gives border crossing times every 9 minutes.  Alternatively, there\'s an electronic readerboard that shows the wait times at the various crossing points as you go through Bellingham on I-5 north (note that the Pacific Hwy crossing is referred to as SR 243) that shows all 4 crossings, and then another one as you approach Blaine that shows the main Peace Arch and truck crossing wait times.');

	if(!this.displayCars) {
		google.earth.fetchKml(ge, LIB_URL + 'kml/car_route.kml', function(kmlObject) {
			control.kmlLoaded(kmlObject);
			control.displayCars = kmlObject;
		});
	}
};

ws_Getting.prototype.getBus = function() {
	$(this.divContainer).show();
	$(this.divContainerFooter).hide();
	$(this.divContainerHeader).html('<div id="header-text">Bus</div>');
	var info = "<a href='http://www.quickcoach.com/schedule.htm' target='_blank'>Quick Shuttle</a> offers a bus service from Seatac Airport, downtown Seattle, and Bellingham Airport to Vancouver Airport, downtown Vancouver and Vancouver's cruise ship terminals.  You should be aware that Quick Shuttle makes several stop in downtown Vancouver and once across the border makes a few more making the one way trip to Seatac about 5 hrs  While not always the fastest option it is logistically well situated if your leaving a Vancouver cruise and leaving via Seatac airport.";
	$(this.divContainer).html(info);
	
	if(!this.displayBus) {
		this.loadBusStations();
		
		google.earth.fetchKml(ge, LIB_URL + 'kml/bus_route.kml', function(kmlObject) {
			control.kmlLoaded(kmlObject);
			control.displayBus = kmlObject;
		});
	}
};

ws_Getting.prototype.getNews = function(result) {
	$(this.divContainer).show();
	$(this.divContainerFooter).hide();
	$(this.divContainerHeader).html('<div id="header-text"> News </div>');
	$(this.divContainer).append('<div id="Right-Panel-News"></div>');

	if(typeof result == 'string') {
	} else {
		if (result.error || result.entries.length <= 0) {
			$(this.divContainerNews).html('No Results Found');
			return;
		}
	}

	var feed = new google.feeds.Feed(result);
	feed.load(function(result) {
		if (!result.error) {
			var container = document.getElementById("Right-Panel-News");
			
			for (var i = 0; i < result.feed.entries.length; i++) {
				var entry = result.feed.entries[i];
				
				var newsContent = '<div class="news-title"> <a href="'+entry['link']+'" target="_blank">'+entry['title']+'</a> </div>'
								+ '<div class="news-publish">'+entry['publishedDate']+'</div>'
								+ '<div class="news-content">'+entry['contentSnippet']+'</div>';
				
				$(control.divContainerNews).append(newsContent);				
			}
		}
	});
};


ws_Getting.prototype.kmlLoaded = function(kmlObject) {
	if(!kmlObject) {
		setTimeout(function() {
			alert('Bad or null KML.');
		}, 0);
		return;
	}

	ge.getFeatures().appendChild(kmlObject);
	control.currentKmlObject = kmlObject;
};

ws_Getting.prototype.clearPlacemarks = function(snippet) {
	if(ge) {
		var c = ge.getFeatures().getFirstChild();
		while (c) {
			var s = c.getNextSibling();
			if(c.getSnippet() == snippet) {
				ge.getFeatures().removeChild(c);
			}
			c = s;
		}
	}
};

ws_Getting.prototype.loadTrainStations = function() {
	var icon = BASE_URL + 'images/getting-there-icons/train-icon.png';
	
	var balloon;
	balloon = this.formatTrainBalloon("Pacific Central Station", "1150 Station Street Vancouver, BC V6A 4C7", "Monday to Sunday 5:00 am to 1:00 am", "888-842-7245");
	var latlng = new google.maps.LatLng(49.27416300034493, -123.0985420000737);
	var opts = {name: 'Pacific Central Station', snippet: 'train_stations', icon: icon, balloon: balloon};
	this.ghelpers.createPointPlacemark(latlng, opts);

	balloon = this.formatTrainBalloon("Fairhaven Station", "401 Harris Avenue Bellingham, WA 98225", "Monday to Sunday 8:00 am to 9:05 pm", "360-734-8851");
	latlng = new google.maps.LatLng(48.72032599995309, -122.5112110000389);
	opts = {name: 'Fairhaven Station', snippet: 'train_stations', icon: icon, balloon: balloon};
	this.ghelpers.createPointPlacemark(latlng, opts);

	balloon = this.formatTrainBalloon("Skagit Station" ,"105 E. Kincaid st Mt Vernon, WA 98273", "Monday to Friday 8:30 am to 9:15 pm Saturday 8:30 am to 6:00 pm Sunday 8:30 am to 2:30 pm","Skagit Transit Customer Service Skagit County (360) 757-4433 Toll-free (877) 584-7528");
	latlng = new google.maps.LatLng(48.41798000069385, -122.3349309999215);
	opts = {name: 'Skagit Station', snippet: 'train_stations', icon: icon, balloon: balloon};
	this.ghelpers.createPointPlacemark(latlng, opts);
	
	balloon = this.formatTrainBalloon("Everett Station", "3201 Smith Ave. Everett, WA 98201", "Monday to Sunday 6:00 am to 10:00 pm", "425-257-7777");
	latlng = new google.maps.LatLng(47.97551300011054, -122.1978540024853);
	opts = {name: 'Everett Station', snippet: 'train_stations', icon: icon, balloon: balloon};
	this.ghelpers.createPointPlacemark(latlng, opts);
	
	balloon = this.formatTrainBalloon("Edmonds Station", "210 Railroad Avenue Edmonds, WA 98020","Monday to Sunday 7:15 am to 12:30 pm 1:00 pm to  9:45 pm", "425-778-3213");
	latlng = new google.maps.LatLng(47.81108999847591, -122.384293998498);
	opts = {name: 'Edmonds Station', snippet: 'train_stations', icon: icon, balloon: balloon};
	this.ghelpers.createPointPlacemark(latlng, opts);
	
	balloon = this.formatTrainBalloon("Seattle Station", "303 South Jackson Street, Seattle, King, WA 98104", "Monday to Sunday 6:00 am to 10:30 pm", "206-382-4125");
	latlng = new google.maps.LatLng(47.59918400058962, -122.3302630007217);
	opts = {name: 'Seattle Station', snippet: 'train_stations', icon: icon, balloon: balloon};
	this.ghelpers.createPointPlacemark(latlng, opts);
};

ws_Getting.prototype.formatTrainBalloon = function(station, address, hours, phone) {
	var html 	= '<div class="train-balloon">'
				+ '<div class="train-station"> <span>' + station + '<span></div>'
				+ '<div class="train-address"> <span>Address:</span> ' + address + '</div>'
				+ '<div class="train-hours"> <span>Hours:</span> ' + hours + '</div>'
				+ '<div class="train-phone"> <span>Phone:</span> ' + phone + '</div>'
				+ '</div>';
	return html;
};

ws_Getting.prototype.loadFerryStations = function() {
	var icon = BASE_URL + 'images/getting-there-icons/ferry-icon.png';

	var balloon;
	balloon = this.formatFerryBalloon("Clipper Vacations", "2701 Alaskan Way, Pier 69, Seattle, WA 98121", "(206) 448-5000");
	var latlng = new google.maps.LatLng(47.61413311093495, -122.3532123762983);
	var opts = {name: 'Clipper Vacations', snippet: 'ferry_stations', icon: icon, balloon: balloon};
	this.ghelpers.createPointPlacemark(latlng, opts);

	balloon = this.formatFerryBalloon("Victoria Clipper", "254 Belleville Street, Victoria, BC V8V 1W9", "(250) 382-8100");
	latlng = new google.maps.LatLng(48.42214999892052, -123.3751930002147);
	opts = {name: 'Victoria Clipper', snippet: 'ferry_stations', icon: icon, balloon: balloon};
	this.ghelpers.createPointPlacemark(latlng, opts);

	balloon = this.formatFerryBalloon("Swartz Bay", "11300 Patricia Bay Highway, North Saanich, BC", "(250) 656-5571");
	latlng = new google.maps.LatLng(48.68892406761466, -123.4105675036106);
	opts = {name: 'Swartz Bay', snippet: 'ferry_stations', icon: icon, balloon: balloon};
	this.ghelpers.createPointPlacemark(latlng, opts);

	balloon = this.formatFerryBalloon("Tsawwassen", "#1 Ferry Causeway Delta, BC V4M 4G6", "(604) 943-9331");
	latlng = new google.maps.LatLng(49.00528220594212, -123.134479337768);
	opts = {name: 'Tsawwassen', snippet: 'ferry_stations', icon: icon, balloon: balloon};
	this.ghelpers.createPointPlacemark(latlng, opts);
};

ws_Getting.prototype.formatFerryBalloon = function(station, address, phone) {
	var html 	= '<div class="ferry-balloon">'
				+ '<div class="ferry-station"><span>' + station + '</span></div>'
				+ '<div class="ferry-address"> <span>Address:</span> ' + address + '</div>'
				+ '<div class="ferry-phone"> <span>Phone:</span> ' + phone + '</div>'
				+ '</div>';
	return html;
};

ws_Getting.prototype.loadCrossingStations = function() {	
	var me = this;
	
	$.get(LIB_URL+'php/'+'borderN.php', {}, function(data) {
		var borderData = JSON.parse(data);
	
		var balloon = '<div> <span>Peace Arch-Blaine Border Station </span>'
					+ '<div> <span>Estimated wait time:</span> '+borderData.PeaceArch_Blaine+'</div>'
					+ '<div> <span>Update Time:</span> '+borderData.update_time+'</div>'
					+ '</div>';

		var balloon1 = '<div> <span>Pacific Hwy-Truck Border Station</span>'
					+ '<div> <span>Estimated wait time:</span> '+borderData.PacificHwy_Truck+'</div>'
					+ '<div> <span>Update Time:</span> '+borderData.update_time+'</div>'
					+ '</div>';

		var balloon2 = '<div> <span>Sumas-Huntingdon Border Station</span>'
					+ '<div> <span>Estimated wait time:</span> '+borderData.Sumas_Huntingdon+'</div>'
					+ '<div> <span>Update Time:</span> '+borderData.update_time+'</div>'
					+ '</div>';

		var balloon3 = '<div> <span>Lynden-Aldergrove Border Station</span>'
					+ '<div> <span>Estimated wait time:</span> '+borderData.Lynden_Aldergrove+'</div>'
					+ '<div> <span>Update Time:</span> '+borderData.update_time+'</div>'
					+ '</div>';

		var latlng = new google.maps.LatLng(49.00478532060981, -122.7571017202975);
		var opts = {name: 'Peace Arch-Blaine Border Station', snippet: 'crossing_stations', balloon: balloon};
		me.ghelpers.createPointPlacemark(latlng, opts);

		latlng = new google.maps.LatLng(49.00296052398247, -122.7346865838637);
		opts = {name: 'Pacific Hwy-Truck Border Station', snippet: 'crossing_stations', balloon: balloon1};
		me.ghelpers.createPointPlacemark(latlng, opts);

		latlng = new google.maps.LatLng(49.00258939981465, -122.2651273940995);
		opts = {name: 'Sumas-Huntingdon Border Station', snippet: 'crossing_stations', balloon: balloon2};
		me.ghelpers.createPointPlacemark(latlng, opts);

		latlng = new google.maps.LatLng(49.00279887601723, -122.4848910643718);
		opts = {name: 'Lynden-Aldergrove Border Station', snippet: 'crossing_stations', balloon: balloon3};
		me.ghelpers.createPointPlacemark(latlng, opts);
	});
};

ws_Getting.prototype.loadBusStations = function() {
	var icon = BASE_URL + 'images/getting-there-icons/bus-icon.png';

	var balloon;
	balloon = this.formatBusBalloon("SeaTac Airport", "Main Terminal Building 17801 Pacific Highway S. Seattle, WA 98158", "09:30 12:30 15:30 17:45 20:15", "09:35 12:05 14:10 18:10 22:15");
	var latlng = new google.maps.LatLng(47.443483, -122.296225);
	var opts = {name: 'SeaTac Airport Bus Station', snippet: 'bus_stations', icon: icon, balloon: balloon};
	this.ghelpers.createPointPlacemark(latlng, opts);

	balloon = this.formatBusBalloon("Downtown Seattle", "Best Western Executive Inn 200 Taylor Avenue North Seattle, WA 98109", "10:10 13:10 16:10 18:25 20:50", "09:00 11:30 13:30 17:35 21:40");
	latlng = new google.maps.LatLng(47.619974, -122.346239);
	opts = {name: 'Seattle Downtown Bus Station', snippet: 'bus_stations', icon: icon, balloon: balloon};
	this.ghelpers.createPointPlacemark(latlng, opts);

	balloon = this.formatBusBalloon("Tulalip", "Seattle Premium Outlets 10600 Quil Ceda Blvd. Tulalip, WA 98271", "10:50 13:50 16:50 19:05 21:30", "08:20 10:50 12:50 16:55 21:00");
	latlng = new google.maps.LatLng(48.093531, -122.188182);
	opts = {name: 'Tulalip Bus Station', snippet: 'bus_stations', icon: icon, balloon: balloon};
	this.ghelpers.createPointPlacemark(latlng, opts);

	balloon = this.formatBusBalloon("Bellingham Airport", "4255 Mitchell Way Bellingham, WA 98226", "11:55 14:55 17:55 20:10 22:35", "07:15 09:45 11:45 15:50 19:55");
	latlng = new google.maps.LatLng(48.791714, -122.532216);
	opts = {name: 'Bellingham Airport Bus Station', snippet: 'bus_stations', icon: icon, balloon: balloon};
	this.ghelpers.createPointPlacemark(latlng, opts);

	balloon = this.formatBusBalloon("South Surrey", "Campbell River Store  790 176 StreetSurrey, BC V3S9S6", "06:10 08:35 10:40 14:40 18:50", "13:00 16:00 19:00 21:15 23:40");
	latlng = new google.maps.LatLng(49.013490, -122.737955);
	opts = {name: 'South Surrey Bus Station', snippet: 'bus_stations', icon: icon, balloon: balloon};
	this.ghelpers.createPointPlacemark(latlng, opts);

	balloon = this.formatBusBalloon("River Rock Resort", "8811 River Road Resort Richmond, BC V6X3P8", "05:35 08:00 10:05 14:05 18:15", "13:35 16:35 19:35 21:50 00:15");
	latlng = new google.maps.LatLng(49.195962, -123.127190);
	opts = {name: 'River Rock Resort Bus Station', snippet: 'bus_stations', icon: icon, balloon: balloon};
	this.ghelpers.createPointPlacemark(latlng, opts);

	balloon = this.formatBusBalloon("Vancouver Airport", "3211 Grant McConachie Way Richmond, BC V7B1Y7", "05:30 07:55 10:00 14:00 18:10", "13:40 16:40 19:40 21:55 00:20");
	latlng = new google.maps.LatLng(49.194755, -123.178773);
	opts = {name: 'Vancouver Airport Bus Station', snippet: 'bus_stations', icon: icon, balloon: balloon};
	this.ghelpers.createPointPlacemark(latlng, opts);

	balloon = this.formatBusBalloon("Cambie & 42nd", "42nd Ave & Cambie Street", "05:10 07:35 09:40 13:40 17:40", "14:05 17:05 20:05 22:20 00:45");
	latlng = new google.maps.LatLng(49.232534, -123.116070);
	opts = {name: 'Cambie & 42nd Bus Station', snippet: 'bus_stations', icon: icon, balloon: balloon};
	this.ghelpers.createPointPlacemark(latlng, opts);

	balloon = this.formatBusBalloon("Cambie & 12th", "12th Ave & Cambie Street", "05:05 07:30 09:35 13:35 17:35", "14:10 17:10 20:10 22:25 00:50");
	latlng = new google.maps.LatLng(49.260398, -123.115033);
	opts = {name: 'Cambie & 12th Bus Station', snippet: 'bus_stations', icon: icon, balloon: balloon};
	this.ghelpers.createPointPlacemark(latlng, opts);

	balloon = this.formatBusBalloon("Vancouver Downtown", "Holiday Inn on Howe 1110 Howe Street Vancouver, BC V6Z1R2", "05:00 07:25 09:30 13:30 17:30", "14:15 17:15 20:15 22:30 00:55");
	latlng = new google.maps.LatLng(49.278720, -123.125780);
	opts = {name: 'Vancouver Downtown Bus Station', snippet: 'bus_stations', icon: icon, balloon: balloon};
	this.ghelpers.createPointPlacemark(latlng, opts);
};

ws_Getting.prototype.formatBusBalloon = function(station, address, depTimes, arrTimes) {
	var html 	= '<div class="bus-balloon">'
				+ '<div class="bus-station"> <span>' + station + '</span> </div>'
				+ '<div class="bus-address"> <span>Address:</span> ' + address + '</div>'
				+ '<div class="bus-address"> <span>Departure Times:</span> ' + depTimes + '</div>'
				+ '<div class="bus-address"> <span>Arrival Times:</span> ' + arrTimes + '</div>'
				+ '</div>';
	return html;
};

ws_Getting.prototype.displayOff = function(data) {
	switch(data) {
		case 'planes':
			this.clearPlacemarks('airports');
			this.displayPlanes = null;
			break;
		case 'trains':
			ge.getFeatures().removeChild(this.displayTrains);
			this.clearPlacemarks('train_stations');
			this.displayTrains = null;
			break;
		case 'ferries':
			ge.getFeatures().removeChild(this.displayFerries);
			this.clearPlacemarks('ferry_stations');
			this.displayFerries = null;
			break;
		case 'cars':
			ge.getFeatures().removeChild(this.displayCars);
			this.displayCars = null;
			break;
		case 'buses':
			ge.getFeatures().removeChild(this.displayBus);
			this.clearPlacemarks('bus_stations');
			this.displayBus = null;
			break;
	}	
	
	if(this.displayPlanes || this.displayTrains || this.displayFerries || this.displayCars || this.displayBus) {
		if(this.displayPlanes) {
			this.getPlanes();
		} else if(this.displayTrains) {
			this.getTrains();
		} else if(this.displayFerries) {
			this.getFerries();
		} else if(this.displayCars) {
			this.getCars();
		} else if(this.displayBus) {
			this.getBus();
		}
	}
	
	if(!this.displayPlanes && !this.displayTrains && !this.displayFerries && !this.displayCars && !this.displayBus) {
		$(this.divContainerHeader).html('<div id="header-text">News</div>');
		$(this.divContainer).html('');
		this.getNews("http://sports.yahoo.com/oly/rss.xml");
	}
};


$(document).ready(function() {
	$("#planes").hover(
			function() {
				if(!control.displayPlanes)
					$(this).attr("src", "images/navigation/left-GettingThere/planes_hov.jpg");
			},
			function() {
				if(!control.displayPlanes)
					$(this).attr("src", "images/navigation/left-GettingThere/planes.jpg");
			}
		).toggle(
			function() {
				$(this).attr("src", "images/navigation/left-GettingThere/planes_ov.jpg");
				
				control.getPlanes();
				control.displayPlanes = 1;
			},
			function() {
				$(this).attr("src", "images/navigation/left-GettingThere/planes_hov.jpg");

				control.displayOff('planes');
			}
	);
	$("#trains").hover(
			function() {
				if(!control.displayTrains)
					$(this).attr("src", "images/navigation/left-GettingThere/trains_hov.jpg");
			},
			function() {
				if(!control.displayTrains)
					$(this).attr("src", "images/navigation/left-GettingThere/trains.jpg");
			}
		).toggle(
				function() {
					$(this).attr("src", "images/navigation/left-GettingThere/trains_ov.jpg");

					control.getTrains();
				},
				function() {
					$(this).attr("src", "images/navigation/left-GettingThere/trains_hov.jpg");

					control.displayOff('trains');
				}
	);
	$("#ferries").hover(
			function() {
				if(!control.displayFerries)
					$(this).attr("src", "images/navigation/left-GettingThere/ferries_hov.jpg");
			},
			function() {
				if(!control.displayFerries)
					$(this).attr("src", "images/navigation/left-GettingThere/ferries.jpg");
			}
		).toggle(
			function() {
				$(this).attr("src", "images/navigation/left-GettingThere/ferries_ov.jpg");

				control.getFerries();
			},
			function() {
				$(this).attr("src", "images/navigation/left-GettingThere/ferries_hov.jpg");

				control.displayOff('ferries');
			}
	);
	$("#car").hover(
			function() {
				if(!control.displayCars)
					$(this).attr("src", "images/navigation/left-GettingThere/car_hov.jpg");
			},
			function() {
				if(!control.displayCars)
					$(this).attr("src", "images/navigation/left-GettingThere/car.jpg");
			}
		).toggle(
			function() {
				$(this).attr("src", "images/navigation/left-GettingThere/car_ov.jpg");

				control.getCars();
			},
			function() {
				$(this).attr("src", "images/navigation/left-GettingThere/car_hov.jpg");

				control.displayOff('cars');
			}
	);
	$("#bus").hover(
			function() {
				if(!control.displayBus)
					$(this).attr("src", "images/navigation/left-GettingThere/bus_hov.jpg");
			},
			function() {
				if(!control.displayBus)
					$(this).attr("src", "images/navigation/left-GettingThere/bus.jpg");
			}
		).toggle(
			function() {
				$(this).attr("src", "images/navigation/left-GettingThere/bus_ov.jpg");

				control.getBus();
			},
			function() {
				$(this).attr("src", "images/navigation/left-GettingThere/bus_hov.jpg");
				
				control.displayOff('buses');
			}
	);
});




