function changeDirection(id)
{
	var airport = "";
	var direction = "";
	
	if($(id).className == "abflug_tegel")
	{
		$(id).className = "ankunft_tegel";
		$('schoen').className = "ankunft_tegel";
		
		airport = "TXL";
		$('current_airport').style.background = 'url(' + absolute_portal_url + '/module/flights/gfx/ankunft_tegel.gif)';
		$('arrive_departed').src = absolute_portal_url + '/module/flights/gfx/abflug_btn.gif';
		
		direction = "A";
	}
	else if($(id).className == "ankunft_tegel")
	{
		$(id).className = "abflug_tegel";
		$('schoen').className = "abflug_tegel";
		
		airport = "TXL";
		$('current_airport').style.background = 'url(' + absolute_portal_url + '/module/flights/gfx/abflug_tegel.gif)';
		$('arrive_departed').src = absolute_portal_url + '/module/flights/gfx/ankunft_btn.gif';
		
		direction = "D";
	}
	else if($(id).className == "abflug_schoen")
	{
		$(id).className = "ankunft_schoen";
		$('schoen').className = "ankunft_schoen";
		
		airport = "SXF";
		$('current_airport').style.background = 'url(' + absolute_portal_url + '/module/flights/gfx/ankunft_schoen.gif)';
		$('arrive_departed').src = absolute_portal_url + '/module/flights/gfx/abflug_btn.gif';
		
		direction = "A";
	}
	else if($(id).className == "ankunft_schoen")
	{
		$(id).className = "abflug_schoen";
		$('schoen').className = "abflug_schoen";
		
		airport = "SXF";
		$('current_airport').style.background = 'url(' + absolute_portal_url + '/module/flights/gfx/abflug_schoen.gif)';
		$('arrive_departed').src = absolute_portal_url + '/module/flights/gfx/ankunft_btn.gif';
		
		direction = "D";
	}
	
	var url = 'module/flights/ajax/changedirection.php?flight_direction=' + direction + '&flight_airport=' + airport;

	new Ajax.Request( url, {
		method: 'get',
		onComplete: showResponse,
		onFailure: reportError }
		);

}

function changeAirport(id)
{
	var airport = "";
	var directions = "";
	
	if($(id).className == "abflug_schoen")
	{
		$(id).className = "abflug_tegel";
		$('ankunft').className = "abflug_tegel";
		
		airport = "TXL";
		$('current_airport').style.background = 'url(' + absolute_portal_url + '/module/flights/gfx/abflug_tegel.gif)';
		$('future_airport').src = absolute_portal_url + '/module/flights/gfx/schoen_btn.gif';
		
		directions = "D";
	}
	else if($(id).className == "abflug_tegel")
	{
		$(id).className = "abflug_schoen";
		$('ankunft').className = "abflug_schoen";
		
		airport = "SXF";
		$('current_airport').style.background = 'url(' + absolute_portal_url + '/module/flights/gfx/abflug_schoen.gif)';
		$('future_airport').src = absolute_portal_url + '/module/flights/gfx/tegel_btn.gif';
		
		directions = "D";
	}
	else if($(id).className == "ankunft_tegel")
	{
		$(id).className = "ankunft_schoen";
		$('ankunft').className = "ankunft_schoen";
		
		airport = "SXF";
		$('current_airport').style.background = 'url(' + absolute_portal_url + '/module/flights/gfx/ankunft_schoen.gif)';
		$('future_airport').src = absolute_portal_url + '/module/flights/gfx/tegel_btn.gif';
		
		directions = "A";
	}
	else if($(id).className == "ankunft_schoen")
	{
		$(id).className = "ankunft_tegel";
		$('ankunft').className = "ankunft_tegel";
		
		airport = "TXL";
		$('current_airport').style.background = 'url(' + absolute_portal_url + '/module/flights/gfx/ankunft_tegel.gif)';
		$('future_airport').src = absolute_portal_url + '/module/flights/gfx/schoen_btn.gif';
		
		directions = "A";
	}
	

	var url = 'module/flights/ajax/changeairport.php?flight_airport=' + airport + '&flight_direction=' + directions;

	new Ajax.Request( url, {
		method: 'get',
		onComplete: showResponse,
		onFailure: reportError }
		);

}

function showResponse(originalRequest)
{
	var res = originalRequest.responseText;
	$('flights_list').update(res);
}

function reportError(originalRequest)
{
	$('flights_list').update(originalRequest.responseText);
}
