// Only run if jQuery exists
if ( typeof jQuery == 'function' ) {
jQuery(document).ready(function($){
	
/* = INPUT PLACEHOLDER SUPPORT FOR IE
------------------------------------------------------------- */
	if (! $.support.placeholder ) {
		// Make placeholder work unobtrusively in ID
		var active = document.activeElement;
		$(':text').focus(function(){
			if ( typeof( $(this).attr('placeholder') ) != 'undefined' && $(this).attr('placeholder') != '' && $(this).val() == $(this).attr('placeholder') ) {
				$(this).val('').removeClass('hasPlaceholder');
			}
		}).blur(function(){
			if ( typeof( $(this).attr('placeholder') ) != 'undefined' && $(this).attr('placeholder') != '' && ($(this).val() == '' || $(this).val() == $(this).attr('placeholder')) ) {
				$(this).val($(this).attr('placeholder')).addClass('hasPlaceholder');
			}
		}).blur();
		$(active).focus();
		
		// Empty placeholder on submit
		$('form').submit(function(){
			$(this).find('.hasPlaceholder').each(function(){
				$(this).val('');
			});
		});
	}
	
/* = SEARCH CTA
------------------------------------------------------------- */
	$('#search-cta form').submit(function(){
		if ( $('input#query', this).val() == "" ) {
			alert("Please enter an airline name, code, or region to search for.");
			return false;
		} else {
			$('input[type=submit]', this).attr('disabled', 'disabled').css("opacity", .25).after('<p class="submitted">Searching&hellip;</p>');
			return true;
		}
	});
	
});
};
