//- DirtyTool2 -// function DirtyTool2(cTool) { var oTool = document.getElementById('Tool' + cTool); if (oTool != null) { oTool.IsDirty = true; var c = new String(oTool.onerror); oTool.src = c.match(/.*\"(.*)\".*/)[1]; oTool.onmouseover = null; oTool.onmouseout = null; } } //- DirtyTool -// function DirtyTool(cTool) { var oTool = document.getElementById('Tool' + cTool); if (oTool != null) { oTool.IsDirty = true; var c = new String(oTool.onerror); oTool.src = c.match(/.*\"(.*)\".*/)[1]; oTool.onmouseover = null; oTool.onmouseout = null; oTool.enabled = false; } } //- CopyBillingToShipping -// function CopyBillingToShipping(oForm) { oForm['ShippingName'].value = oForm.BillingName.value; oForm['ShippingAttention'].value = oForm.BillingAttention.value; oForm['ShippingStreet'].value = oForm.BillingStreet.value; oForm['ShippingStreet2'].value = oForm.BillingStreet2.value; oForm['ShippingCity'].value = oForm.BillingCity.value; var cState = oForm.BillingState.value; var o = oForm['ShippingState']; for (var h = 0; h < o.options.length; h++) { if (o.options[h].value == cState) { oForm['ShippingState'].selectedIndex = h; } } oForm['ShippingZip'].value = oForm.BillingZip.value; // oForm['ShippingPhone'].value = null; } //- CopyShippingToBilling -// function CopyShippingToBilling(oForm) { oForm['BillingStreet'].value = oForm.ShippingStreet.value; oForm['BillingStreet2'].value = oForm.ShippingStreet2.value; oForm['BillingCity'].value = oForm.ShippingCity.value; var cState = oForm.ShippingState.value; var o = oForm['BillingState']; for (var h = 0; h < o.options.length; h++) { if (o.options[h].value == cState) { oForm['BillingState'].selectedIndex = h; } } oForm['BillingZip'].value = ExportZip(oForm.ShippingZip.value); // oForm['BillingEmail'].value = null; } //- IfEnterAction -// function IfEnterAction(oEvent, oForm, cAction, cSelId){ if ((EventKeyCode(oEvent) == 13) || (EventKeyCode(oEvent) == 3)) { oForm.Action.value = cAction; oForm.SelId.value = cSelId; oForm.submit(); return false; } return true; } //- IfEnterScript -// function IfEnterScript(oEvent, cScript) { if ((EventKeyCode(oEvent) == 13) || (EventKeyCode(oEvent) == 3)) { eval(cScript); return false; } return true; } //- EventKeyCode -// function EventKeyCode(oEvent) { return ((oEvent != null) && (oEvent.which != null) ? oEvent.which : event.keyCode); } //- ExportZip -// function ExportZip(cStream) { var cZip = cStream.replace(/\?/g, ''); return cZip; } //- ExportFon -// function ExportFon(cStream) { var cFon = ''; if (cStream.length >= 10) { cFon = cStream.substr(0, 3) + '-' + cStream.substr(3, 3) + '-' + cStream.substr(6, 4) if ((cStream.length == 15) && (cStream.substr(10, 5) != '?????')) { cFon += ' x' + cStream.substr(10, 5).replace('?', '') } } return cFon; } //- Console_AddRemove -// function Console_AddRemove(oFromSet, oToSet, bIsAll) { //+ unselect for (var hOption = 0; hOption < oToSet.length; hOption++) { oToSet.options[hOption].selected = false; } //+ move for (hOption = oFromSet.length; hOption != 0; hOption--) { if ((bIsAll == true) || (oFromSet.options[hOption - 1].selected == true)) { oToSet.options[oToSet.length] = new Option(oFromSet.options[hOption - 1].text, oFromSet.options[hOption - 1].value, false, true); oFromSet.options[hOption - 1] = null; } } } //- Console_Pack -// function Console_Pack(oSet, oField) { var cPack = ''; for (var hOption = 0; hOption < oSet.length; hOption++) { cPack += ',' + oSet.options[hOption].value; } oField.value = cPack.substring(1); } //- ToggleView -// function ToggleView(cBlock) { var oElement = document.getElementById(cBlock); if (oElement.style.display == 'none') { oElement.style.display = 'block'; } else { oElement.style.display = 'none'; } } //- ToggleGoogleAndStatic -// function ToggleGoogleAndStatic(googleDivId, staticDivId) { var googleDiv = document.getElementById(googleDivId); var staticDiv = document.getElementById(staticDivId); if (googleDiv.style.display == '') { googleDiv.style.display = 'none'; staticDiv.style.display = ''; } else { googleDiv.style.display = ''; staticDiv.style.display = 'none'; } } //- SwitchDirections -// function SwitchDirections(locationDivList, selectId) { var locationArray = locationDivList.split('|'); for(i = 0; i < locationArray.length; i++) { var location = document.getElementById(locationArray[i]).style.display = 'none'; } var select = document.getElementById(selectId); for(i = 0; i < select.length; i++) { if (select.options[i].selected == true) { document.getElementById(select.options[i].value).style.display = ''; var indexOn = document.getElementById('locationIndex' + select.options[i].value.replace('direction', '')) indexOn.style.display = ''; } else { document.getElementById(select.options[i].value).style.display = 'none'; var indexOff = document.getElementById('locationIndex' + select.options[i].value.replace('direction', '')) indexOff.style.display = 'none'; } } } //- ShowLocation -// function ShowLocation(locationDivList, locationId, directionDivList, directionId) { var locationArray = locationDivList.split('|'); for(i = 0; i < locationArray.length; i++) { var location = document.getElementById(locationArray[i]).style.display = 'none'; } var directionArray = directionDivList.split('|'); for(i = 0; i < directionArray.length; i++) { var direction = document.getElementById(directionArray[i]).style.display = 'none'; } var direction = document.getElementById(directionId); direction.style.display = 'none'; var location = document.getElementById(locationId); location.style.display = ''; } //- ToggleCriteriaView -// function ToggleCriteriaView(cBlock, cFieldName, cCriteria) { var oElement = document.getElementById(cBlock); var oField = document.getElementById(cFieldName); var cValue = ((oField.type == 'checkbox') ? oField.checked.toString() : oField.value); var bIsTrue = false; if (cCriteria.indexOf('|') >= 0) { var cArray = cCriteria.split('|'); for (i = 0; i < cArray.length; i++) { if ((cArray[i].length > 0) && (cArray[i].indexOf('!') >= 0)) { if (cValue != cArray[i].substr(1, cArray[i].length)) { bIsTrue = true; break; } } else if (cValue == cArray[i]) { bIsTrue = true; break; } } } else if (cCriteria.indexOf('&') >= 0) { var cArray = cCriteria.split('&'); for (i = 0; i < cArray.length; i++) { if ((cArray[i].length > 0) && (cArray[i].indexOf('!') >= 0)) { if (cValue != cArray[i].substr(1, cArray[i].length)) { bIsTrue = true; } else { bIsTrue = false; break; } } else if (cValue != cArray[i]) { bIsTrue = true; } else { bIsTrue = false; break; } } } else { if (cCriteria.indexOf('!') >= 0) { if (cValue != cCriteria.substr(1, cCriteria.length)) { bIsTrue = true; } else { bIsTrue = false; } } else if (cValue == cCriteria) { bIsTrue = true; } else { bIsTrue = false; } } if (bIsTrue == true) { oElement.style.display = 'block'; } else { oElement.style.display = 'none'; } } function BookAFlightPopup(oForm) { var cUrl = null; var cMessage = ''; //+ if ((oForm.DepartureDate.value + '' == '') || (oForm.DepartureDate.value == 'MM/DD/YY')) { cMessage = cMessage + 'Departure day '; bIsRequestedError = true; } if ((oForm.ReturnDate.value + '' == '') || (oForm.ReturnDate.value == 'MM/DD/YY')) { if (cMessage != '') { cMessage = cMessage + ', '; } cMessage = cMessage + 'Return day '; bIsRequestedError = true; } if (cMessage != '') { alert(cMessage + 'are required.\n'); return false; } //+ var dDepartureDate = ParseDate(oForm.DepartureDate.value); var dReturnDate = ParseDate(oForm.ReturnDate.value); if (dDepartureDate == null) { alert('Invalid Departure date.\n'); return false; } else if (dReturnDate == null) { alert('Invalid Retrun date.\n'); return false; } else if (dDepartureDate > dReturnDate) { alert('Departure Date cannot come after Return Date'); return false; } //+ cUrl = 'LinkWithSouthWest.asp?Url=' + escape('http://www.innovataw3svc.com/booking/Bookaflight.aspx?selDepCity=' + oForm.Departure.value + '&selArvCity=' + oForm.Return.value + '&selReturnDate=' + oForm.ReturnDate.value + '&selDepartDate=' + oForm.DepartureDate.value + '&custcode=MCI&prodcode=External&carriercode=&fltnumber=&siteLang=en'); window.open(cUrl, null, 'width=800,height=600,scrollbars,resizable'); return true; } function ParseDate(cText) { var oDate = cText.match(/^(\d{1,2})\/(\d{1,2})\/(\d{2,4})$/); if (oDate == null) { return null; } var dDate = (oDate != null ? new Date(cText) : null); if ((dDate == null) || ((dDate.getMonth() + 1) != oDate[1]) || (dDate.getDate() != oDate[2]) || (dDate.getFullYear() != oDate[3])) { return null; } else { return dDate; } }