function changeTypeCityCode(){if(isAlpha(document.getElementById("cityCode").value)&&trim(document.getElementById("cityCode").value.toUpperCase())!="X"){document.getElementById("typeCityCode").value=document.getElementById("cityCode").value}else{document.getElementById("typeCityCode").value=""}}function changeCityCode(){if(isAlpha(document.getElementById("typeCityCode").value)&&trim(document.getElementById("typeCityCode").value).length==3){document.getElementById("cityCode").value=document.getElementById("typeCityCode").value.toUpperCase()}else{document.getElementById("cityCode").value="X"}}var previousChar="";var typeAheadInfo={last:0,accumString:"",delay:500,timeout:null,reset:function(){this.last=0;this.accumString=""}};function typeAhead(I){if(window.event){var H=I.keyCode}else{if(I.which){var H=I.which}}if(H==9){return false}if(window.event&&!window.event.ctrlKey){var B=new Date();if(typeAheadInfo.accumString==""||B-typeAheadInfo.last<typeAheadInfo.delay){var J=window.event;var D=J.srcElement;var K=J.keyCode;var G=String.fromCharCode(K).toUpperCase();typeAheadInfo.accumString+=G;var A=D.options;var F,C;if(typeAheadInfo.accumString.length<=2){if(previousChar==G){typeAheadInfo.accumString=G;return true}}previousChar=G;for(var E=1;E<A.length;E++){F=A[E].text.toUpperCase();C=(typeAheadInfo.accumString>F.substr(0,typeAheadInfo.accumString.length))?E:C;if(F.indexOf(typeAheadInfo.accumString)==0){clearTimeout(typeAheadInfo.timeout);typeAheadInfo.last=B;typeAheadInfo.timeout=setTimeout("typeAheadInfo.reset()",typeAheadInfo.delay);D.selectedIndex=E;J.cancelBubble=true;J.returnValue=false;return false}}if(C!=null){clearTimeout(typeAheadInfo.timeout);typeAheadInfo.last=B;typeAheadInfo.timeout=setTimeout("typeAheadInfo.reset()",typeAheadInfo.delay);D.selectedIndex=C;J.cancelBubble=true;J.returnValue=false;return false}}else{clearTimeout(typeAheadInfo.timeout)}typeAheadInfo.reset()}return true}function isAlpha(D){var B;var C=/^[A-Za-z ]+$/;var A=D.match(C);if(A){return true}else{return false}return true}function ltrim(A){while(A.substring(0,1)==" "){A=A.substring(1,A.length)}return(A)}function rtrim(A){while(A.substring(A.length-1,A.length)==" "){A=A.substring(0,A.length-1)}return(A)}function trim(A){A=rtrim(ltrim(A));return(A)}function processAirportStatus(B){if((B!=undefined)&&(B.length==3)){var A=B}else{var A=document.getElementById("typeCityCode").value}var C="/merger/airports/airport_files/"+A.toLowerCase()+".html";if(A==""){$("#airportStatusResults").html('<p class="BodyCopy12Bold" style="color:#CC0000;">Please select a departure city.</p>')}else{$.ajax({url:C,cache:false,beforeSend:function(D){$("#airportStatusResults").hide();$("#airportStatusResultsLoading").show()},success:function(D){$("#airportStatusResultsLoading").hide();$("#airportStatusResults").show();$("#airportStatusResults").html(D)},error:displayError})}}function displayError(A,B,D){$("#airportStatusResultsLoading").hide();try{if(A.status=="404"){$("#airportStatusResults").show();$("#airportStatusResults").html('<p class="BodyCopy12Bold" style="color:#CC0000;">Error 404: Document not found. <br /><br /> If you typed in the city code, please check that it is a valid city code and one that Northwest or Delta provides service to.</p>')}}catch(C){}};