function TTDare2CompareComp(){TTDare2CompareComp.superclass.constructor.call(this);}YAHOO.lang.extend(TTDare2CompareComp,Dare2CompareAbstractComp);TTDare2CompareComp.OMNITURE_MODULE="omnitureModule";TTDare2CompareComp.CODE_TO_VERTICAL={A:"Air",H:"Hotel",C:"Car",P:"Package"};TTDare2CompareComp.COUNTRY_NAME_TO_COUNTRY_CODE={Andorra:"AD","United Arab Emirates":"AE",Afghanistan:"AF","Antigua and Barbuda":"AG",Anguilla:"AI",Albania:"AL",Armenia:"AM","Netherlands Antilles":"AN",Angola:"AO",Antarctica:"AQ",Argentina:"AR","American Samoa":"AS",Austria:"AT",Australia:"AU",Aruba:"AW",Azerbaijan:"AZ","Bosnia and Herzegovina":"BA",Barbados:"BB",Bangladesh:"BD",Belgium:"BE","Burkina Faso":"BF",Bulgaria:"BG",Bahrain:"BH",Burundi:"BI",Benin:"BJ",Bermuda:"BM","Brunei Darussalam":"BN",Bolivia:"BO",Brazil:"BR","The Bahamas":"BS",Bhutan:"BT","Bouvet Island":"BV",Botswana:"BW",Belarus:"BY",Belize:"BZ",Canada:"CA","Cocos (Keeling) Islands":"CC","The Democratic Republic of the Congo":"CD","Central African Republic":"CF","Republic of the Congo":"CG",Switzerland:"CH","Cook Islands":"CK",Chile:"CL",Cameroon:"CM",China:"CN",Colombia:"CO","Costa Rica":"CR",Cuba:"CU","Cape Verde":"CV","Christmas Island":"CX",Cyprus:"CY","Czech Republic":"CZ",Germany:"DE",Djibouti:"DJ",Denmark:"DK",Dominica:"DM","Dominican Republic":"DO",Algeria:"DZ",Ecuador:"EC",Estonia:"EE",Egypt:"EG","Western Sahara":"EH",Eritrea:"ER",Spain:"ES",Ethiopia:"ET",Finland:"FI",Fiji:"FJ","Falkland Islands (Malvinas)":"FK","Federated States of Micronesia":"FM","Faroe Islands":"FO",France:"FR",Gabon:"GA","United Kingdom":"GB",Grenada:"GD",Georgia:"GE","French Guiana":"GF",Ghana:"GH",Gibraltar:"GI",Greenland:"GL","The Gambia":"GM",Guinea:"GN",Guadeloupe:"GP","Equatorial Guinea":"GQ",Greece:"GR","South Georgia and the South Sandwich Islands":"GS",Guatemala:"GT",Guam:"GU","Guinea-Bissau":"GW",Guyana:"GY","Hong Kong":"HK","Heard Island and McDonald Islands":"HM",Honduras:"HN",Croatia:"HR",Haiti:"HT",Hungary:"HU",Indonesia:"ID",Ireland:"IE",Israel:"IL",India:"IN","British Indian Ocean Territory":"IO",Iraq:"IQ",Iran:"IR",Iceland:"IS",Italy:"IT",Jamaica:"JM",Jordan:"JO",Japan:"JP",Kenya:"KE",Kyrgyzstan:"KG",Cambodia:"KH",Kiribati:"KI",Comoros:"KM","Saint Kitts and Nevis":"KN","Democratic People's Republic of Korea (North)":"KP","Republic of Korea (South)":"KR",Kuwait:"KW","Cayman Islands":"KY",Kazakhstan:"KZ",Laos:"LA",Lebanon:"LB","Saint Lucia":"LC",Liechtenstein:"LI","Sri Lanka":"LK",Liberia:"LR",Lesotho:"LS",Lithuania:"LT",Luxembourg:"LU",Latvia:"LV","Libyan Arab Jamahiriya (Libya)":"LY",Morocco:"MA",Monaco:"MC","Republic of Moldova":"MD",Madagascar:"MG","Marshall Islands":"MH","The Former Yugoslav Republic of Macedonia":"MK",Mali:"ML",Myanmar:"MM",Mongolia:"MN","Macao Special Administrative Region of China":"MO","Northern Mariana Islands":"MP",Martinique:"MQ",Mauritania:"MR",Montserrat:"MS",Malta:"MT",Mauritius:"MU",Maldives:"MV",Malawi:"MW",Mexico:"MX",Malaysia:"MY",Mozambique:"MZ",Namibia:"NA","New Caledonia":"NC",Niger:"NE","Norfolk Island":"NF",Nigeria:"NG",Nicaragua:"NI","The Netherlands":"NL",Norway:"NO",Nepal:"NP",Nauru:"NR",Niue:"NU","New Zealand":"NZ",Oman:"OM",Panama:"PA",Peru:"PE","French Polynesia":"PF","Papua New Guinea":"PG",Philippines:"PH",Pakistan:"PK",Poland:"PL","Saint Pierre and Miquelon":"PM",Pitcairn:"PN","Puerto Rico":"PR","Occupied Palestinian Territory":"PS",Portugal:"PT",Palau:"PW",Paraguay:"PY",Qatar:"QA","Department of R?union":"RE",Romania:"RO","Russian Federation":"RU",Rwanda:"RW","Saudi Arabia":"SA","Solomon Islands":"SB",Seychelles:"SC",Sudan:"SD",Sweden:"SE",Singapore:"SG","Saint Helena":"SH",Slovenia:"SI","Svalbard and Jan Mayen":"SJ","Slovak Republic":"SK","Sierra Leone":"SL","San Marino":"SM",Senegal:"SN",Somalia:"SO",Suriname:"SR","Sao Tome and Principe":"ST","El Salvador":"SV",Syria:"SY",Swaziland:"SZ","Turks and Caicos Islands":"TC",Chad:"TD","French Southern Territories":"TF",Togo:"TG",Thailand:"TH",Tajikistan:"TJ",Tokelau:"TK","East Timor":"TL",Turkmenistan:"TM",Tunisia:"TN",Tonga:"TO",Turkey:"TR","Trinidad and Tobago":"TT",Tuvalu:"TV",Taiwan:"TW",Tanzania:"TZ",Ukraine:"UA",Uganda:"UG","United States Minor Outlying Islands":"UM","United States":"US",Uruguay:"UY",Uzbekistan:"UZ","Holy See (Vatican City State)":"VA","Saint Vincent and the Grenadines":"VC",Venezuela:"VE","Virgin Islands, British":"VG","Virgin Islands US":"VI","Viet Nam":"VN",Vanuatu:"VU","Wallis and Futuna Islands":"WF","Independent State of Samoa":"WS",Yemen:"YE",Mayotte:"YT",Yugoslavia:"YU","South Africa":"ZA",Zambia:"ZM",Zimbabwe:"ZW"};TTDare2CompareComp.ORIG_AIRPORT_CODE_INDEX=0;TTDare2CompareComp.DEST_AIRPORT_CODE_INDEX=1;TTDare2CompareComp.START_DATE_INDEX=2;TTDare2CompareComp.END_DATE_INDEX=3;TTDare2CompareComp.NO_OF_ADULTS_INDEX=4;TTDare2CompareComp.NO_OF_ROOMS_INDEX=5;TTDare2CompareComp.NO_OF_CHILD_INDEX=6;TTDare2CompareComp.START_TIME_INDEX=7;TTDare2CompareComp.END_TIME_INDEX=8;TTDare2CompareComp.CITY_NAME_INDEX=9;TTDare2CompareComp.STATE_CODE_INDEX=10;TTDare2CompareComp.COUNTRY_CODE_INDEX=11;TTDare2CompareComp.CITY_STATE_INDEX=12;TTDare2CompareComp.AIRPORT_CODE_OR_CITY_STATE_INDEX=13;TTDare2CompareComp.ORIG_CITY_NAME_INDEX=21;TTDare2CompareComp.DEST_CITY_NAME_INDEX=22;TTDare2CompareComp.ORIG_STATE_CODE_INDEX=23;TTDare2CompareComp.DEST_STATE_CODE_INDEX=24;TTDare2CompareComp.RANDOM=25;TTDare2CompareComp.UNBLOCKED_PARTNER_OMNI_PREFIX="unblockedPartners=";TTDare2CompareComp.prototype.handleTilesReplacedWhileSearchClickWaiting=function(a,b){if(this.tilesReplacedEventTimeoutTimer){this.tilesReplacedEventTimeoutTimer.cancel();delete this.tilesReplacedEventTimeoutTimer;}YAHOO.lang.later(1,this,this.onSearchSubmit,b.evtId);};TTDare2CompareComp.prototype.seeMoreSites=function(){var b=YAHOO.util.Dom;var a=document.getElementById("partners");var d=document.getElementById("ttFareFinder").getElementsByTagName("form");for(var c=0;c<d.length;c++){if(!YAHOO.util.Dom.hasClass(d[c],"hidden")){this.setCurrentForm(d[c]);this.setCurrentVertical(TTDare2CompareComp.CODE_TO_VERTICAL[this.getCurrentForm().d2cPgoodCode.value]);}}if(b.hasClass(a,"expanded")){b.removeClass(a,"expanded");AnalyticsSupport.logOmnitureLinkEvent({moduleName:this[TTDare2CompareComp.OMNITURE_MODULE],link:"seeLess"+this.getCurrentVertical()},{});}else{b.addClass(a,"expanded");AnalyticsSupport.logOmnitureLinkEvent({moduleName:this[TTDare2CompareComp.OMNITURE_MODULE],link:"seeMore"+this.getCurrentVertical()},{});}};TTDare2CompareComp.prototype.urlPrepare=function(a,b){return YAHOO.lang.substitute(a,b,function(d,c,f){if(!f){return c;}else{if(f==="MM0"){var e=(DateSupport.getStringFromDate(DateSupport.getDateFromString(c),"MM")-1);return(e>9)?e:("0"+e);}else{return DateSupport.getStringFromDate(DateSupport.getDateFromString(c),f);}}});};TTDare2CompareComp.prototype.refreshCheckbox=function(a){if(a.checked){YAHOO.util.Dom.addClass(YAHOO.util.Dom.getAncestorByClassName(a,"partner"),"checked");}else{YAHOO.util.Dom.removeClass(YAHOO.util.Dom.getAncestorByClassName(a,"partner"),"checked");}};TTDare2CompareComp.prototype.onSearchSubmit=function(c){AjaxSupport.tilesReplacedEvent.unsubscribeAll(this.handleTilesReplacedWhileSearchClickWaiting,this);if(this.tilesReplacedEventTimeoutTimer){this.tilesReplacedEventTimeoutTimer.cancel();delete this.tilesReplacedEventTimeoutTimer;}if(AjaxSupport.connections.length>0){AjaxSupport.tilesReplacedEvent.subscribe(this.handleTilesReplacedWhileSearchClickWaiting,{evtId:c},this);if(!this.tilesReplacedEventTimeoutTimer){this.tilesReplacedEventTimeoutTimer=YAHOO.lang.later(2000,this,this.onSearchSubmit,c);}return;}var b=true;var a=this.resetOmniObj();b=this.validateMinPartnersSelection();a.products=";"+this.getCurrentVertical().toLowerCase();if(!b){a.eVar4=ValidatorSupport[ValidatorSupport.PROP_LAST_ERROR_CODES];a.prop7=ValidatorSupport[ValidatorSupport.PROP_LAST_ERROR_CODES];a.events="event5";AnalyticsSupport.logOmnitureLinkEvent({moduleName:this[TTDare2CompareComp.OMNITURE_MODULE],link:"submit"+c+this.getCurrentVertical()},a);return false;}else{this.openSearchWindows();}AnalyticsSupport.logOmnitureLinkEvent({moduleName:this[TTDare2CompareComp.OMNITURE_MODULE],link:"submit"+c+this.getCurrentVertical()},a);YAHOO.util.Cookie.set("SavingsSearcherSearch","true");return false;};TTDare2CompareComp.prototype.openSearchWindows=function(){var d=CompSupport.callJsObj("ttFareFinder","getMappingObject",this.getCurrentForm());var b=this.getOmniObj();var l=document.getElementById("partners").getElementsByTagName("input");var h,g;var e;var r=[];var m=[];var q=[0,0,0];var o=false;var c=[];var n=[];var f=TTDare2CompareComp.UNBLOCKED_PARTNER_OMNI_PREFIX;for(h=0;h<l.length;h++){if(this.order=="straight"){g=h;}else{g=l.length-h-1;}var a=l[g];if(a.type=="checkbox"&&a.checked){e=true;r.push(a);m.push(a.value);var k=a.getAttribute("tier");var p=k-1;q[p]++;}}b.eVar8=r.length;b.prop8=r.length;b.prop17=q.join(",");b.eVar13=m.join(",");this.setPopupParams(r.length);for(h=0;h<r.length;h++){o=window.open("about:blank","","height="+this.popupHeight+", width="+this.popupWidth+', location=yes, toolbar="yes" menubar="yes", scrollbars=yes ,resizable=yes, statusbar=yes, top='+(this.popupTop+c.length*this.popupHorizontalStep)+"px,left="+(this.popupLeft+c.length*this.popupVerticalStep)+"px");if(o){c[c.length]=o;n.push(r[h].value+":"+r[h].getAttribute("tier")+":"+(r.length-h));}}if(r.length!=c.length){this.showPopupFailure(c,r,d);}else{for(h=0;h<c.length;h++){c[h].location.href=encodeURI(this.urlPrepare(r[h].getAttribute("pUrl"),d));}b.events="event8";b.products=";"+this.getCurrentVertical().toLowerCase();f+=n.join(",");this.postAnalytics(f);}};TTDare2CompareComp.prototype.postAnalytics=function(a){YAHOO.util.Connect.setForm(this.getCurrentForm());YAHOO.util.Connect.asyncRequest("POST","/TT_D2C_Servlet",{},a);};TTDare2CompareComp.prototype.validateMinPartnersSelection=function(){var c=document.getElementById("ttFareFinder").getElementsByTagName("form");var b=false;b=validatePartnersListForm(document.partnersListForm);for(var a=0;a<c.length;a++){if(!YAHOO.util.Dom.hasClass(c[a],"hidden")){this.setCurrentForm(c[a]);if(b&&!window["validate"+c[a].name.substr(0,1).toUpperCase()+c[a].name.substr(1)](c[a])){b=false;}this.setCurrentVertical(TTDare2CompareComp.CODE_TO_VERTICAL[this.getCurrentForm().d2cPgoodCode.value]);}}if(b){ValidatorSupport.clearErrors(this.getCurrentForm());}return b;};TTDare2CompareComp.prototype.showPopupFailure=function(d,g,a){var c=this.getOmniObj();var b=TTDare2CompareComp.UNBLOCKED_PARTNER_OMNI_PREFIX;var h={};if(d.length>0&&d.length!=1){for(f=1;f<d.length;f++){d[f].close();}}for(var f=0;f<g.length;f++){h[g[f].value]={state:f==(g.length-1),pUrl:encodeURI(this.urlPrepare(g[f].getAttribute("pUrl"),a)),omniture:"submit"+this.getCurrentVertical()+(g.length-f),toSend:g[f].value+":"+g[f].getAttribute("tier")+":"+(g.length-f)};}try{d[0].location.href=encodeURI(this.urlPrepare(g[g.length-1].getAttribute("pUrl"),a));}catch(e){h[g[g.length-1].value].state=false;}CompSupport.callJsObj("popupErrorHelperPopup","show",[h,d[0],this.domId,this.getCurrentForm()]);c.events="event8,event6";c.products=";"+this.getCurrentVertical().toLowerCase();c.pageName="SearcherBlocker";b+=g[g.length-1].value+":"+g[g.length-1].getAttribute("tier")+":1";this.postAnalytics(b);};TTDare2CompareComp.prototype.getOmniObj=function(){if(!this._omnitureObject){this._omnitureObject={};}return this._omnitureObject;};TTDare2CompareComp.prototype.resetOmniObj=function(){this._omnitureObject={};return this._omnitureObject;};TTDare2CompareComp.prototype.getCurrentVertical=function(){return this._currentVertical;};TTDare2CompareComp.prototype.setCurrentVertical=function(a){this._currentVertical=a;};TTDare2CompareComp.prototype.getCurrentForm=function(){return this._currentForm;};TTDare2CompareComp.prototype.setCurrentForm=function(a){this._currentForm=a;};