
var _origin="";var _destination="";var _incNearby=false;var _departDate="mm/dd/yy";var _returnDate="mm/dd/yy";var _departTime=0;var _returnTime=0;var _cabin="Economy";var _compSrch1=true;var _compSrch2=false;var _compSrch3=false;var _rooms=1;var _adults=1;var _guests=1;var _cabinValue;var _children=0;var _infantLap=0;var _infantSeat=0;var _prefNS=false;var _carType=0;var _carPUTime=10;var _carDOTime=10;var _carDOLoc="Same as pick-up";var _driverAge=0;var _cruiseDestIdx=0;var _cruiseLineIdx=0;var _cruiseMonthIdx=0;var _cruiseLengthIdx=0;var _searchPartners;var _roundTrip=true;var _farecastUrl="";var _lastOption="";var _cookieDuration=180;var _dblclick="http://ad.doubleclick.net/clk;";var _atlas="http://clk.atdmt.com/TC2/go/116701425/direct/01/?href=";var _dblclickImpUrl="http://ad.doubleclick.net/ad/site170.tmus/sponsor-button/MSN_Travel_Checkbox/";var _dblclickImpImageProp=";tile=1;sz=1x1;ord=123466789?";var doc=document;initPath();function bcm_verifydate(dt)
{if(dt==null||dt=='null')return false;var currdate=new Date()
var userdate=new Date(dt)
var year=userdate.getFullYear();if(year<2000)
{year+=100;userdate.setFullYear(year);}
userdate.setHours(23,59,59);if(userdate<currdate)
{return false;}
return true;}
function bcm_ReadCookieData()
{_origin=getCookie('origin');_destination=getCookie('dest');_departDate=getCookie('departDate');if(!bcm_verifydate(_departDate))
{_departDate="";}
_returnDate=getCookie('returnDate');if(!bcm_verifydate(_returnDate))
{_returnDate="";}
_departTime=getCookie('departTime');_returnTime=getCookie('returnTime');_cabin=getCookie('cabin');_compSrch1=getCookie('compSrch1');_compSrch2=getCookie('compSrch2');_compSrch3=getCookie('compSrch3');_rooms=getCookie('rooms');_adults=getCookie('adults');_guests=getCookie('guests');_children=getCookie('children');_infantLap=getCookie('infantLap');_infantSeat=getCookie('infantSeat');_prefNS=getCookie('prefNS');_carType=getCookie('carType');_carPUTime=getCookie('carPUTime');_carDOTime=getCookie('carDOTime');_carDOLoc=getCookie('carDOLoc');_driverAge=getCookie('carAge');_cruiseDestIdx=getCookie('cruiseDestIdx');_cruiseLineIdx=getCookie('cruiseLineIdx');_cruiseMonthIdx=getCookie('cruiseMonthIdx');_cruiseLengthIdx=getCookie('cruiseLengthIdx');var partnerString=getCookie('searchpartners');if(null!=partnerString&&partnerString.length>0)
{_searchPartners=partnerString.split(",");for(var i=0;(i<_searchPartners.length);i++)
_searchPartners[i]=(_searchPartners[i]=="true");}}
function bcm_WriteCookieData()
{setCookie('origin',_origin,_cookieDuration);setCookie('dest',_destination,_cookieDuration);setCookie('departDate',_departDate,_cookieDuration);setCookie('returnDate',_returnDate,_cookieDuration);setCookie('departTime',_departTime,_cookieDuration);setCookie('returnTime',_returnTime,_cookieDuration);setCookie('cabin',_cabin,_cookieDuration);setCookie('compSrch1',_compSrch1,_cookieDuration);setCookie('compSrch1',_compSrch1,_cookieDuration);setCookie('compSrch1',_compSrch1,_cookieDuration);setCookie('rooms',_rooms,_cookieDuration);setCookie('adults',_adults,_cookieDuration);setCookie('guests',_guests,_cookieDuration);setCookie('children',_children,_cookieDuration);setCookie('infantLap',_infantLap,_cookieDuration);setCookie('infantSeat',_infantSeat,_cookieDuration);setCookie('prefNS',_prefNS,_cookieDuration);setCookie('carType',_carType,_cookieDuration);setCookie('carPUTime',_carPUTime,_cookieDuration);setCookie('carDOTime',_carDOTime,_cookieDuration);setCookie('carDOLoc',_carDOLoc,_cookieDuration);setCookie('carAge',_driverAge,_cookieDuration);setCookie('cruiseDestIdx',_cruiseDestIdx,_cookieDuration);setCookie('cruiseLineIdx',_cruiseLineIdx,_cookieDuration);setCookie('cruiseMonthIdx',_cruiseMonthIdx,_cookieDuration);setCookie('cruiseLengthIdx',_cruiseLengthIdx,_cookieDuration);if(null!=_searchPartners)
setCookie('searchpartners',_searchPartners.join(),_cookieDuration);}
function bcm_VerifyField(de,d,def)
{if(d!=null&&d.length>0&&d!='null')
{de.value=d;return true;}
else if(def!=null&&def.length>0&&def!='null')
{de.value=def;return true;}
return false;}
function bcm_AssignDateTime(de,d,te,t)
{if(bcm_VerifyField(de,d))
{if(te!=null)
{te.selectedIndex=t;}}}
function bcm_SetIndex(e,i)
{if(i>=e.length)
{i=e.length-1;}
e.selectedIndex=i;}
function bcm_SetAdult(e,v)
{var idx=0;if(e.value!=v)
{var l=e.length;if(v>=e[l-1].value)
{idx=l-1;}
else
{for(var i=0;i<l;i++)
{if(v==e[i].value)
{idx=i;break;}}}
e.selectedIndex=idx;}}
function bcm_GetState(v)
{switch(v)
{case"farecast_flight_search":var form=doc.farecast;bcm_VerifyField(form.elements['slice1:departCity'],_origin);bcm_VerifyField(form.elements['slice1:arriveCity'],_destination);bcm_AssignDateTime(form.elements['slice1:dateTime:date'],_departDate,form.elements['slice1:time'],_departTime);bcm_AssignDateTime(form.elements['slice2:dateTime:date'],_returnDate,form.elements['slice1:time'],_returnTime);bcm_SetAdult(form.adult,_adults);form.fccabin.selectedIndex=_cabin;if(_roundTrip)
doc.getElementById("fc_flight_mode_round").checked=true;else
doc.getElementById("fc_flight_mode_one").checked=true;if(null!=_searchPartners)
{for(var ndx=0,len=Math.min(_searchPartners.length,form['fcpartners'].length);ndx<len;ndx++)
{form['fcpartners'][ndx].checked=_searchPartners[ndx];}}
break;case"orbot_hotel_search":var form=doc.hotelonly;bcm_VerifyField(form.city,_destination);bcm_VerifyField(form.elements['startDate:date'],_departDate);bcm_VerifyField(form.elements['endDate:date'],_returnDate);bcm_SetIndex(form.adults,_guests);form.numberOfRooms.selectedIndex=_rooms;break;case"orbot_car_search":var form=doc.caronly;bcm_VerifyField(form.pickupLocation,_destination);bcm_VerifyField(form.dropoffLocation,_carDOLoc,'Same as pick-up');bcm_AssignDateTime(form.elements['startDate:date'],_departDate,form.elements['startDate:time'],_carPUTime);bcm_AssignDateTime(form.elements['endDate:date'],_returnDate,form.elements['endDate:time'],_carDOTime);form.driverAge.selectedIndex=_driverAge;break;case"orbot_flighthotel_search":var form=doc.fhotel;bcm_VerifyField(form.origin,_origin);bcm_VerifyField(form.dest,_destination);form.rooms.selectedIndex=_rooms;bcm_SetAdult(form.adult,_adults);form.fakechildren.selectedIndex=_children;form.fakeinlap.selectedIndex=_infantLap;form.fakeinseat.selectedIndex=_infantSeat;form.nonstop.checked=_prefNS;bcm_VerifyField(form.elements['slice1:dateTime:date'],_departDate);bcm_VerifyField(form.elements['slice2:dateTime:date'],_returnDate);break;case"orbot_hotelcar_search":var form=doc.hotelcar;bcm_VerifyField(form.destination,_destination);bcm_AssignDateTime(form.elements['startDate:date'],_departDate,form.elements['startDate:time'],_carPUTime);bcm_AssignDateTime(form.elements['endDate:date'],_returnDate,form.elements['endDate:time'],_carDOTime);bcm_SetIndex(form.numTravelers,_guests);form.numRooms.selectedIndex=_rooms;break;case"orbot_flighthotelcar_search":var form=doc.fhc;bcm_VerifyField(form.origin,_origin);bcm_VerifyField(form.dest,_destination);bcm_VerifyField(form.elements['slice1:dateTime:date'],_departDate);bcm_VerifyField(form.elements['slice2:dateTime:date'],_returnDate);form.rooms.selectedIndex=_rooms;bcm_SetAdult(form.adult,_adults);form.fakechildren.selectedIndex=_children;form.fakeinlap.selectedIndex=_infantLap;form.fakeinseat.selectedIndex=_infantSeat;form.nonstop.checked=_prefNS;break;case"orbot_flightcar_search":var form=doc.fcar;bcm_VerifyField(form.origin,_origin);bcm_VerifyField(form.dest,_destination);bcm_VerifyField(form.elements['slice1:dateTime:date'],_departDate);bcm_VerifyField(form.elements['slice2:dateTime:date'],_returnDate);form.desiredCarType.selectedIndex=_carType;bcm_SetAdult(form.adult,_adults);form.fakechildren.selectedIndex=_children;form.fakeinlap.selectedIndex=_infantLap;form.fakeinseat.selectedIndex=_infantSeat;form.nonstop.checked=_prefNS;break;case"orbot_cruise_search":var form=doc.cruise;form.places.selectedIndex=_cruiseDestIdx;form.operator.selectedIndex=_cruiseLineIdx;form.Month.selectedIndex=_cruiseMonthIdx;form.days.selectedIndex=_cruiseLengthIdx;break;default:break;}}
function bcm_SaveState(v)
{switch(_lastOption)
{case"farecast_flight_search":var form=doc.farecast;_origin=form.elements['slice1:departCity'].value;_destination=form.elements['slice1:arriveCity'].value;_departDate=form.elements['slice1:dateTime:date'].value;_returnDate=form.elements['slice2:dateTime:date'].value;_adults=form.adult.value;_cabin=form.fccabin.selectedIndex;_cabinValue=form.fccabin.value;_incNearby=form.nearairports.checked;_roundTrip=doc.getElementById("fc_flight_mode_round").checked;if(null==_searchPartners)
_searchPartners=new Array(3);for(var ndx=0,len=form['fcpartners'].length;ndx<len;ndx++)
{_searchPartners[ndx]=form['fcpartners'][ndx].checked;}
break;case"orbot_hotel_search":var form=doc.hotelonly;_destination=form.city.value;_departDate=form.elements['startDate:date'].value;_returnDate=form.elements['endDate:date'].value;_guests=form.adults.selectedIndex;_rooms=form.numberOfRooms.selectedIndex;break;case"orbot_car_search":var form=doc.caronly;_destination=form.pickupLocation.value;_carDOLoc=form.dropoffLocation.value;_departDate=form.elements['startDate:date'].value;_carPUTime=form.elements['startDate:time'].selectedIndex;_returnDate=form.elements['endDate:date'].value;_carDOTime=form.elements['endDate:time'].selectedIndex;_driverAge=form.driverAge.selectedIndex;break;case"orbot_flighthotel_search":var form=doc.fhotel;_origin=form.origin.value;_destination=form.dest.value;_rooms=form.rooms.selectedIndex;_adults=form.adult.value;_children=form.fakechildren.selectedIndex;_infantLap=form.fakeinlap.selectedIndex;_infantSeat=form.fakeinseat.selectedIndex;_prefNS=form.nonstop.checked;_departDate=form.elements['slice1:dateTime:date'].value;_returnDate=form.elements['slice2:dateTime:date'].value;break;case"orbot_hotelcar_search":var form=doc.hotelcar;_destination=form.destination.value;_departDate=form.elements['startDate:date'].value;_carPUTime=form.elements['startDate:time'].selectedIndex;_returnDate=form.elements['endDate:date'].value;_carDOTime=form.elements['endDate:time'].selectedIndex;_guests=form.numTravelers.selectedIndex;_rooms=form.numRooms.selectedIndex;break;case"orbot_flighthotelcar_search":var form=doc.fhc;_origin=form.origin.value;_destination=form.dest.value;_departDate=form.elements['slice1:dateTime:date'].value;_returnDate=form.elements['slice2:dateTime:date'].value;_rooms=form.rooms.selectedIndex;_adults=form.adult.value;_children=form.fakechildren.selectedIndex;_infantLap=form.fakeinlap.selectedIndex;_infantSeat=form.fakeinseat.selectedIndex;_prefNS=form.nonstop.checked;break;case"orbot_flightcar_search":var form=doc.fcar;_origin=form.origin.value;_destination=form.dest.value;_departDate=form.elements['slice1:dateTime:date'].value;_returnDate=form.elements['slice2:dateTime:date'].value;_carType=form.desiredCarType.selectedIndex;_adults=form.adult.value;_children=form.fakechildren.selectedIndex;_infantLap=form.fakeinlap.selectedIndex;_infantSeat=form.fakeinseat.selectedIndex;_prefNS=form.nonstop.checked;break;case"orbot_cruise_search":var form=doc.cruise;_cruiseDestIdx=form.places.selectedIndex;_cruiseLineIdx=form.operator.selectedIndex;_cruiseMonthIdx=form.Month.selectedIndex;_cruiseLengthIdx=form.days.selectedIndex;break;default:break;}
bcm_WriteCookieData();_lastOption=v;}
function bcm_UpdateState(v)
{bcm_SaveState(v);bcm_GetState(v);}
function bcm_bkmark(tab,select)
{bcm_selecttab(tab,'true');if((tab=="hotels")&&(select=='orbot_flighthotel_search'))
doc.hotelsnavform.rad[2].checked=true;}
function bcm_setProp7(v)
{if(typeof s!='undefined'&&s!=null)
{s.linkTrackVars='prop1,prop2,prop3,prop5,prop7,prop8,prop14,prop17,prop22,prop29';s.linkTrackEvents='None';if(v=="flights")
{s.prop7="Flights";}
else if(v=="vacations")
{s.prop7="Vacations";}
else if(v=="hotels")
{s.prop7="Hotels";}
else if(v=="cars")
{s.prop7="Cars";}
else if(v=="cruises")
{s.prop7="Cruises";}}}
function bcm_selecttab(v,expanded){bcm_setProp7(v);orbot_swapto("orbot_"+v+"_"+expanded);if(expanded=="true"){if(v=="flights"){doc.flightsnavform.fc_flight_mode[0].checked=true;bcm_searchoption("farecast_flight_search",true);orbot_boxon("farecast_flight_search");}
else{orbot_boxoff("farecast_flight_search");if(v=="vacations"){document.vacationsnavform.rad[0].checked=true;bcm_searchoption("orbot_flighthotel_search",true);}
else if(v=="hotels"){document.hotelsnavform.rad[0].checked=true;bcm_searchoption("orbot_hotel_search",true);}
else if(v=="cars"){document.carsnavform.rad[0].checked=true;bcm_searchoption("orbot_car_search",true);}
else if(v=="cruises")
{bcm_searchoption("orbot_cruise_search",true);}}}
else bcm_searchoption("",true);}
function bcm_searchoption(v,d)
{bcm_UpdateState(v);if(typeof s!='undefined'&&s!=null)
{switch(v)
{case"farecast_flight_search":s.prop8="Search for Flight";break;case"orbot_hotel_search":s.prop8="Search for Hotel";break;case"orbot_car_search":s.prop8="Search for Car";break;case"orbot_flighthotel_search":s.prop8="Search for Flight and Hotel";break;case"orbot_hotelcar_search":s.prop8="Search for Hotel and Car";break;case"orbot_flighthotelcar_search":s.prop8="Search for Flight and Hotel and Car";break;case"orbot_flightcar_search":s.prop8="Search for Flight and Car";break;case"orbot_cruise_search":s.prop8="Search for Cruise";break;}}
if("farecast_flight_search"==v)
{farecastSearchMode(v);}
if(d)
{orbotsearch(v);}}
function bcm_getdblclickurl()
{var dblclick=_dblclick;var url=doc.URL;if(null!=url)
{url=url.toLowerCase();url=unescape(url);if(url==g_SiteBaseURL||url==g_SiteBaseURLNoSlash||url.indexOf('default.aspx')!=-1||url.indexOf('showreview.aspx')!=-1)
{dblclick=dblclick+"201900355;26579405;c?";}
else if(url.indexOf("entitylist.aspx")!=-1)
{if(url.indexOf("attractions")!=-1)
{dblclick=dblclick+"201900433;26579612;z?";}
else if(url.indexOf("hotels")!=-1)
{dblclick=dblclick+"201900398;26579545;o?";}
else if(url.indexOf("restaurants")!=-1)
{dblclick=dblclick+"201900419;26579605;f?";}
else if(url.indexOf("nightlife")!=-1)
{dblclick=dblclick+"201900377;26579439;n?";}
else if(url.indexOf("shopping")!=-1)
{dblclick=dblclick+"201900377;26579439;n?";}}
else if(url.indexOf("entityprofile.aspx")!=-1)
{if(url.indexOf("hotels")!=-1)
{dblclick=dblclick+"201900407;26579579;m?";}
else
{dblclick=dblclick+"201900377;26579439;n?";}}
else if(url.indexOf('tier1')!=-1||url.indexOf('guidemaincontent.aspx')!=-1||url.indexOf('entityprofile.aspx')!=-1||url.indexOf('guidesindex.aspx')!=-1||url.indexOf('guidessubindex.aspx')!=-1||url.indexOf('tier2.aspx')!=-1||url.indexOf('usguidessubindex.aspx')!=-1||url.indexOf('usguideschildsubindex.aspx')!=-1)
{dblclick=dblclick+"201900377;26579439;n?";}
else if(url.indexOf("messageboardindex.aspx")!=-1)
{dblclick=dblclick+"201900299;26579358;q?";}
else if(url.indexOf("sitemap.aspx")!=-1||url.indexOf("searchresults.aspx")!=-1)
{dblclick=dblclick+"201900256;26579320;y?";}
else if(url.indexOf("preferences.aspx")!=-1)
{dblclick=dblclick+"201900446;26579629;l?";}
else if(url.indexOf("activity.aspx")!=-1||url.indexOf('vacation.aspx')!=-1||url.indexOf('car.aspx')!=-1||url.indexOf('cruise.aspx')!=-1||url.indexOf('flight.aspx')!=-1||url.indexOf('hotel.aspx')!=-1)
{dblclick=dblclick+"201900680;26580464;a?";}
else
{dblclick=dblclick+"201900386;26579502;e?";}}
return dblclick;}
function bcm_appendparams(frm)
{var params="";var bcmform=doc.forms[frm];if(null!=bcmform)
{var i=0;var len=bcmform.length;for(i=0;i<len;i++)
{var item=bcmform[i];if(""!=params)
{params+="&";}
if("departDate"==item.name)
{item.name="slice1:dateTime:date";}
params+=item.name+"="+item.value;}}
return params;}
function bcm_OnLoad()
{bcm_ReadCookieData();var url=doc.URL;if(null==url)
{bcm_selecttab("vacations","true");return;}
url=url.toLowerCase();url=unescape(url);if(url==g_SiteBaseURL||url==g_SiteBaseURLNoSlash||url.indexOf('default.aspx')!=-1||url.indexOf('flight.aspx')!=-1)
{bcm_selecttab("flights","true");}
else if(url.indexOf("preferences.aspx")!=-1)
{bcm_selecttab("flights","false");}
else if(url.indexOf('tier1')!=-1||url.indexOf('tier2.aspx')!=-1||url.indexOf('guidessubindex.aspx')!=-1||url.indexOf('guidemaincontent.aspx')!=-1||url.indexOf('usguidessubindex.aspx')!=-1||url.indexOf('usguideschildsubindex.aspx')!=-1)
{bcm_selecttab("vacations","false");}
else if(url.indexOf("hotel.aspx")!=-1||url.indexOf('entity=hotels')!=-1)
{bcm_selecttab("hotels","true");}
else if(url.indexOf("road trip guide.aspx")!=-1)
{bcm_selecttab("hotels","false");}
else if(url.indexOf("activity.aspx")!=-1||url.indexOf('vacation.aspx')!=-1||url.indexOf('articleindex')!=-1||url.indexOf('guidesindex')!=-1||url.indexOf('messageboardindex')!=-1||url.indexOf('traveldeals')!=-1)
{bcm_selecttab("vacations","true");}
else if(url.indexOf("cruise.aspx")!=-1)
{bcm_selecttab("cruises","true");}
else if(url.indexOf("cruises.aspx")!=-1||url.indexOf('cruiseslideshow.aspx')!=-1||url.indexOf('category=cruise')!=-1||url.indexOf('documentid=430462')!=-1)
{bcm_selecttab("cruises","false");}
else if(url.indexOf("car.aspx")!=-1)
{bcm_selecttab("cars","true");}
else
{bcm_selecttab("vacations","false");}}
function bcm_setTrackingFromUrl(url)
{var urls={"PerformDisplayMyTrips":"Orbitz Itineraries","aboutMSNTravel":"Learn More","ViewOneWaySearch":"One-Way","ViewMultiSearch":"Multi-City","ViewFlexSearch":"Flexible Dates","ViewHotelSearch":"Expanded Search Options","days=2":"Cruise 3-5","days=3":"Cruise 6-8","days=4":"Cruise 9-11","days=6":"Cruise 12-14","days=7":"Cruise 15","t=r":"Round Trip","t=o":"One Way","t=m":"Multi-City"};for(var u in urls)
{if(url.indexOf(u)!=-1)
{s.prop8=urls[u];break;}}}
function bcm_nonsearchlink(frm,url)
{bcm_SaveState('');if(null!=url)
{var urlLower=url.toLowerCase();var dblclick="";if(urlLower.indexOf("performdisplaymytrips")!=-1)
{dblclick="http://ad.doubleclick.net/clk;201900480;26579683;j?";}
else if(urlLower.indexOf("aboutmsntravel")!=-1)
{dblclick="";}
else
{dblclick=bcm_getdblclickurl();}
dblclick=dblclick+url;bcm_setTrackingFromUrl(url)
s.tl(frm,'e',frm);doc.location=dblclick;}}
function bcm_performsearch(frm)
{bcm_SaveState('');orbot_figurechildren(frm);var bcmform=doc.forms[frm];if(null!=bcmform)
{var action=bcmform.action;var dblclick=bcm_getdblclickurl();dblclick=dblclick+action;dblclick=dblclick+bcm_appendparams(frm);bcm_searchoption(frm,false)
s.tl(frm,'e',frm);doc.location=dblclick;}}
var _fareCastStyleSheet="farecast";var _destinationStyle;var _partnerActions={fcPriceline:{Name:"Priceline",UrlCompletion:pricelineSearch,DoubleClick:"207000546;29284825;d?",DoubleClickImpression:"136687652",Constants:"http://www.priceline.com/qp.asp?productid=1&refid=PLFARECAST",Classes:{Economy:"ECO",Business:"BUS",FirstClass:"FST"},Options:{Origin:"depcity",Destination:"arrcity",TicketCount:"numtickets",CabinClass:"CabinClass",DepartDate:"departuredate",ReturnDate:"returndate"}},fcExpedia:{Name:"Expedia",UrlCompletion:expediaSearch,UrlPrefix:expediaUrl,Constants:"GOTO=EXPFLTWIZ&NumSenior=0&NumChild=0&FromTime=anytime&ToTime=anytime&olacid=button.frcst.msntravel_flight_checkbox.pixel.1x1",Classes:{Economy:"3",Business:"2",FirstClass:"1"},Options:{Origin:"FrAirport",Destination:"ToAirport",TicketCount:"NumAdult",CabinClass:"Class",DepartDate:"FromDate",ReturnDate:"ToDate"}},fcHotwire:{Name:"Hotwire",UrlCompletion:hotwireSearch,Conditions:hotwireConditions,DoubleClick:"207000759;29284827;l?",DoubleClickImpression:"143345360",Constants:"http://www.hotwire.com/air/search-options.jsp?sid=S279&bid=B290807&inputId=Index",Options:{Origin:"origCity",Destination:"destinationCity",TicketCount:"noOfTickets"}}};function fireAndForget(url)
{var img=new Image();img.onload=img.onerror=function()
{img.onload=img.onerror=null;};img.src=url;}
function fireFarecastDoubleClickImages(form)
{forEachPartner(form,function(partnerElement,partner,enabled)
{if(enabled)
{var url="";if(partner.DoubleClickImpression&&partner.DoubleClickImpression.length>0)
url="http://view.atdmt.com/MOP/view/"+partner.DoubleClickImpression+"/direct/01/";fireAndForget(url);}});}
var _timer;var _farecastWaitTimeout=500;function fireFarecastOmniture()
{s.tl(doc.farecast,'e',doc.farecast);}
function farecastSearch()
{bcm_SaveState("farecast_flight_search");fireFarecastDoubleClickImages(doc.farecast);_farecastUrl=buildFarecastUrl(doc.farecast);bcm_setTrackingFromUrl(_farecastUrl);fc_setTrackingData(doc.farecast);var aPopupBlocked=searchPartners(doc.farecast);if(!aPopupBlocked)
{fireFarecastOmniture();_timer=window.setTimeout(function()
{doc.location=_farecastUrl;},_farecastWaitTimeout);}
window.focus();}
function buildFarecastUrl(form)
{var url=form["fcsearchurl"].value;var defaultLocation="City or Airport";url+="?cid=air_searchmsn";url+="&vo1="+(_origin==defaultLocation?"":encodeURIComponent(_origin));url+="&no1="+(_incNearby?"y":"n");url+="&df=us";url+="&dm1="+encodeURIComponent(_departDate);url+="&ve1="+((_destination==defaultLocation)?"":encodeURIComponent(_destination));url+="&ne1="+(_incNearby?"y":"n");url+="&p="+(_adults);if(doc.flightsnavform["fc_flight_mode_round"].checked)
{url+="&dm2="+encodeURIComponent(_returnDate);url+="&t=r";}
else
{url+="&t=o";}
url+="&b="+cabinAbbr(_cabinValue);return url;}
function cabinAbbr(cabin)
{switch(cabin)
{case"Business":return"b";break;case"FirstClass":return"f";break;default:return"c";}}
function farecastSearchMode(element)
{if(_roundTrip)
setfcdisplay("");else
setfcdisplay("none");}
function setfcdisplay(display)
{forEachPartner(doc.farecast,function(partnerElement,partner,enabled)
{partnerElement.parentElement.style.display=enabled?"":"none";});var el=doc.getElementById("fcdestination_Cal");if(el)
el.style.display=display;}
function searchPartners(form)
{var aPopupBlocked=false;forEachPartner(form,function(partnerElement)
{if(partnerElement.checked)
{var partner=_partnerActions[partnerElement.id];if(!partner.Conditions||partner.Conditions())
{var url="";switch(partner.Name){case"Priceline":url+="http://clk.atdmt.com/MOP/go/136687652/direct/01/?href=";break;case"Hotwire":url+="http://clk.atdmt.com/MOP/go/143345360/direct/01/?href=";break;case"Expedia":url+="http://clk.atdmt.com/TC2/go/116701425/direct/01/?href=http://www.expedia.com/pubspec/scripts/eap.asp?";break;}
url+=partner.Constants;url+=partnerOption(partner.Options.Origin,_origin);url+=partnerOption(partner.Options.Destination,_destination);url+=partnerOption(partner.Options.TicketCount,_adults);url+=partnerOption(partner.Options.DepartDate,fullDate(_departDate));if(null!=partner.Classes)
url+=partnerOption(partner.Options.CabinClass,partner.Classes[_cabinValue]);if(_roundTrip)
url+=partnerOption(partner.Options.ReturnDate,fullDate(_returnDate));if(partner.UrlCompletion)
url+=partner.UrlCompletion();var win=Msn.Util.Open(url,partner.Name,"location=yes,resizable=yes,status=yes,toolbar=yes,menubar=yes,scrollbars=yes");if(null!=win)
{win.blur();}
else
{if(!aPopupBlocked)
{showPopupBlockedAlert();aPopupBlocked=true;}}}}});return aPopupBlocked;}
function showPopupBlockedAlert()
{initPopup();var of=document.getElementById("overlayFrame");if(of)
{of.style.display="block";}
var nt=document.getElementById("noThanks");if(nt)
{nt.href=_farecastUrl;}
resizeFrame();}
function viewableTop()
{if(typeof window.pageYOffset!="undefined")
{return window.pageYOffset;}
else if(document.documentElement&&document.documentElement.scrollTop)
{return document.documentElement.scrollTop;}
else if(document.body.scrollTop)
{return document.body.scrollTop;}
else
{return 0;}}
function pageWidth()
{if(window.innerWidth!=null)
{return window.innerWidth;}
else if(document.documentElement&&document.documentElement.clientWidth)
{return document.documentElement.clientWidth;}
else if(document.body!=null)
{return document.body.clientWidth;}
else
{return 0;;}}
function pageHeight()
{if(window.innerHeight!=null)
{return window.innerHeight;}
else if(document.documentElement&&document.documentElement.clientHeight)
{return document.documentElement.clientHeight;}
else if(document.body!=null)
{return document.body.clientHeight;}
else
{return 0;}}
function pageScrollWidth()
{if(document.documentElement&&document.documentElement.scrollWidth)
{return document.documentElement.scrollWidth;}
else if(document.body!=null)
{return document.body.scrollWidth;}
else
{return 0;;}}
function pageScrollHeight()
{if(document.documentElement&&document.documentElement.scrollHeight)
{return document.documentElement.scrollHeight;}
else if(document.body!=null)
{return document.body.scrollHeight;}
else
{return 0;}}
function resizeFrame()
{var of=document.getElementById("overlayFrame");if(of&&of.style.display!="none")
{var ob=document.getElementById("overlayBackground");if(ob)
{ob.style.width=pageScrollWidth()+"px";ob.style.height=pageScrollHeight()+"px";}}
scrollFrame();}
function scrollFrame()
{var of=document.getElementById("overlayFrame");if(of&&of.style.display!="none")
{var oc=document.getElementById("overlayContent");if(oc)
{oc.style.left=((pageWidth()-700)/2)+"px";oc.style.top=(viewableTop()+25)+"px";}}}
function hidePopupBlockedAlert()
{var of=document.getElementById("overlayFrame");if(of)
{of.style.display="none";}}
function initPopup()
{var body=document.getElementsByTagName("body")[0];var frag=document.createDocumentFragment();var frameDiv=document.getElementById("overlayFrame");frag.appendChild(frameDiv);body.insertBefore(frag,body.firstChild);}
if(window.addEventListener)
{window.addEventListener("resize",resizeFrame,false);window.addEventListener("scroll",scrollFrame,false);}
else
{window.attachEvent("onresize",resizeFrame);window.attachEvent("onscroll",scrollFrame);}
function partnerOption(field,value)
{if(null!=field)
return"&"+field+"="+encodeURIComponent(value);else
return"";}
function expediaUrl()
{var url="";var pos=url.search(/\?/);if(pos<0)
url+="?"
else if((pos<url.length-1)&&url[url.length-1]!='&')
url+="&";return _atlas+url;}
function expediaSearch()
{var url="";if(_roundTrip)
url+="&TripType="+"RoundTrip";else
url+="&TripType="+"OneWay";return url;}
function pricelineSearch()
{var url="";if(_roundTrip)
{url+="&refclickid="+"FDC_AIRSEARCHMSN";}
else
{url+="&TripType="+"OW";url+="&refclickid="+"OW_AIRSEARCHMSN";}
return url;}
function hotwireSearch()
{var url="";url+="&startDay="+padNum(orbot_getcalday(_departDate),2);url+="&startMonth="+padNum(orbot_getcalmonth(_departDate),2);if(_roundTrip)
{url+="&endDay="+padNum(orbot_getcalday(_returnDate),2);url+="&endMonth="+padNum(orbot_getcalmonth(_returnDate),2);}
return url;}
function fullDate(date)
{var dates=date.split("/");dates[0]=padNum(dates[0],2);dates[1]=padNum(dates[1],2);dates[2]=Number(dates[2]);if(dates[2]<2000)
{dates[2]+=2000;}
return dates.join("/");}
function padNum(numStr,padLength)
{while(numStr.length<padLength)
numStr="0"+numStr;return numStr;}
function hotwireConditions()
{return _roundTrip;}
function fc_setTrackingData(form)
{var prop14="";forEachPartner(form,function(partnerElement,partner,enabled)
{if(enabled)
{if((partnerElement.checked))
prop14+=partner.Name;else
prop14+="none";prop14+="|";}});if((prop14.length>0)&&(prop14.charAt(prop14.length-1)=='|'))
prop14=prop14.slice(0,-1);if(typeof s!='undefined'&&s!=null)
{s.prop8=_roundTrip?"Round Trip":"One Way";s.prop14=prop14;}}
function forEachPartner(form,action)
{if(null!=_searchPartners&&_searchPartners.length>0)
{for(var ndx=0,len=_searchPartners.length;ndx<len;ndx++)
{var partnerElement=form['fcpartners'][ndx];var partner=_partnerActions[partnerElement.id];action(partnerElement,partner,!partner.Conditions||partner.Conditions());}}}