﻿$(function() {
	/* The beforeDelete event is triggerd just before the page content is deleted.
	 * We recover our coordinates there before they're deleted */
	$('#NetvolutionPageContent').bind("beforeDelete", function() {
		var coordbox = document.getElementById("airportcoordinates"),
			mapbox = document.getElementById("smallairportmapbox");
		if (coordbox == null) {
			return;
		}
		
		var coords = coordbox.innerHTML.split(new RegExp(' *,? +'));

		var map = new GMap2(mapbox),
				airport = new GLatLng(coords[0],coords[1]);
		map.setCenter(airport, 12);
		map.addControl(new GSmallMapControl());
		map.addOverlay(new GMarker(airport));
	});
});

$(window).load(function () {
	/* Makes the two last boxes of the left column to end in the same place */
	$('#terminalsbox div.boxcontent').add('#servicesbox div.boxcontent').alignbottom();

	/* Make left and right columns end in the same place */
	$('#tb_rightcolumn .small_middle').
		add('#tb_leftcolumn .twothirds_middle:last').
		alignbottom();
});