// This javascript file is used in conjunction with dogTag.jsp. The javascript was separted out into it's own // file since the dogTag.jsp is included twice on the same page (Top and Bottom). We don't want to have duplicate // javascript names so this file is only included once. function AwardDogTag(numOfPassengers){ this.dogTagLocation = new Array(); this.dogTagLocation[0] = 'Top'; this.dogTagLocation[1] = 'Bottom'; // Set these values before calling redraw. this.availMiles = 0; this.aadvantageNumber = ""; this.numOfPassengers = numOfPassengers; this.selectedMiles = 0; // Check if the dogTag should be displayed. this.isVisible = false; } AwardDogTag.prototype.redraw = function() { var totalMilesUsed = this.selectedMiles * this.numOfPassengers; for(var i=0; i < this.dogTagLocation.size(); i++){ $('aadvantageNumberId' + this.dogTagLocation[i]).innerHTML = this.aadvantageNumber; $('availMilesId' + this.dogTagLocation[i]).innerHTML = addCommas(this.availMiles); if(totalMilesUsed < this.availMiles){ // There are more than enough available Miles. Postive pending balance. $('pendingBalanceDiv' + this.dogTagLocation[i]).innerHTML = addCommas(this.availMiles - totalMilesUsed); $('pendingBalanceDiv' + this.dogTagLocation[i]).removeClassName("important"); $('need_more_miles_div' + this.dogTagLocation[i]).hide(); }else{ // There is not enough available miles to support the selected Miles. Negative pending balance. $('pendingBalanceDiv' + this.dogTagLocation[i]).innerHTML = '(' + (addCommas(totalMilesUsed - this.availMiles)) + ')'; $('pendingBalanceDiv' + this.dogTagLocation[i]).addClassName("important"); var a = makePopupLink('javascript:void(0);','/i18n/disclaimers/buyAAmiles.jsp',650, 380); var span = document.createElement('span'); span.appendChild(document.createTextNode(messages.needMoreMiles)); a.appendChild(span); $('need_more_miles_div' + this.dogTagLocation[i]).update(a); $('need_more_miles_div' + this.dogTagLocation[i]).show(); } // Peak Awards - now showing dogTag with 0 mileage, need to blank out if (this.selectedMiles > 0) { $('totalMilesUsed' + this.dogTagLocation[i]).innerHTML = addCommas(totalMilesUsed); $('milesRequired' + this.dogTagLocation[i]).innerHTML = addCommas(this.selectedMiles) + ' x ' + this.numOfPassengers; } else { $('totalMilesUsed' + this.dogTagLocation[i]).innerHTML = ''; $('milesRequired' + this.dogTagLocation[i]).innerHTML = ''; } } } AwardDogTag.prototype.hideDogTag = function() { if($('lineUnderDogTag')) $('lineUnderDogTag').hide(); // Hide the line under the dogTag (in selectAwardFlights.jsp) for(var i=0; i < this.dogTagLocation.size(); i++){ $('awardDogTag' + this.dogTagLocation[i]).hide(); } if($('blankBoxForOnlineOpinion')) $('blankBoxForOnlineOpinion').show(); if($('combawardsad1')){ $('combawardsad1').removeClassName("adContainer"); $('combawardsad1').addClassName("adContainerNodogtag"); } } AwardDogTag.prototype.showDogTag = function() { // Peak Awards - removed check for this.selectedMiles != 0, now showing dogTag if miles are zero if($('lineUnderDogTag')) $('lineUnderDogTag').show(); // Hide the line under the dogTag (in selectAwardFlights.jsp) for(var i=0; i < this.dogTagLocation.size(); i++){ $('awardDogTag' + this.dogTagLocation[i]).show(); } if($('blankBoxForOnlineOpinion')) $('blankBoxForOnlineOpinion').hide(); if($('combawardsad1')){ $('combawardsad1').removeClassName("adContainerNodogtag"); $('combawardsad1').addClassName("adContainer"); } }