/*

    ABS Jets     custom JavaScript functions
    ------------------------------------------------------------------------
    Author       Ondrej Valka (ondrej@valka.info)
    Created      10 Feb 10
    Last edit    -

*/

$(document).ready( function()
{
	// open link in a new window
	$('a.external').click( function() {
		window.open( $(this).attr('href') );
		return false;
	});
	
	// disable form submit button
	$('input.submit').click( function() {
		$('.submit-active').removeClass('hide');
	});

	// show input when Other selected
	$("select#airport").change( function() {
		$("select#airport option:selected").each(function () {
			
			if ( $(this).attr('class') == 'option-other' )
			{
				$("select#airport").addClass('select-other');
				$("input#airportother").removeClass('hide');
			} else
			{
				$("select#airport").removeClass('select-other');
				$("input#airportother").addClass('hide');
			}

		});
	});
	$("select#aircraft").change( function() {
		$("select#aircraft option:selected").each(function () {
			
			if ( $(this).attr('class') == 'option-other' )
			{
				$("select#aircraft").addClass('select-other');
				$("input#aircraftother").removeClass('hide');
			} else
			{
				$("select#aircraft").removeClass('select-other');
				$("input#aircraftother").addClass('hide');
			}

		});
	});
});