
Service=Class.create();Service.prototype={send:function(method,params,onresponse,httpMethod,bumpPropVersion,multiReqAction,showLoading){if(!httpMethod)httpMethod='GET';if(!multiReqAction)multiReqAction=wak.http.MULTIPLE_REQ;if(!wak.isDefined(showLoading))showLoading=true;var callback=function(res){if(bumpPropVersion)bumpPropVersion.version++;if(onresponse)onresponse(res);}.bind(this);var client=null;switch(multiReqAction){case wak.http.MULTIPLE_REQ:client=wak.httpMulti;break;case wak.http.CANCEL_PENDING_REQ:client=wak.httpSingle;break;case wak.http.QUEUE_LAST_REQ:client=wak.httpQueueLast;break;case wak.http.QUEUE_ALL_REQ:client=wak.httpQueueAll;break;}
client.send('/'+this.rpcName+'/'+method,params,callback,httpMethod,{showLoading:showLoading});},preprocessResponse:function(fn,callback){return function(res){fn(res);callback(res);}},serializeArray:function(arr){var str=null;if(!arr||arr.length==0)return str;var params=[];var keyCount=0;arr.each(function(obj){var objKey=''+keyCount++;for(var k in obj){if(k.indexOf('__')==0)continue;var val=obj[k];if(val instanceof Date)val=val.formatServer();params.push(objKey+'.'+k+'='+val+'\t');}});str=params.join('');return str;},serializeHash:function(hash,formatter){var arr=[];for(var key in hash){var val=hash[key];arr.push(formatter?formatter(key,val):key);}
return arr.join(',')}};PropertyServicePicker=Class.create();PropertyServicePicker.prototype={rpcName:'Picker/PropertyService',unpublishProperty:function(prop,onresponse){var params={};params['property.id']=prop.id;params['property.version']=prop.version;this.send('unpublishPropertyPicker',params,onresponse,'POST',prop);},markPropertyAsReviewed:function(prop,onresponse){var params={};params['property.id']=prop.id;params['property.version']=prop.version;this.send('markPropertyAsReviewedPicker',params,onresponse,'POST',prop);},setSourceAutoBid:function(autoBid,onresponse){var params={autoBid:autoBid};this.send('setSourceAutoBid',params,onresponse,'POST');}};Object.extend(PropertyServicePicker.prototype,Service.prototype);PropertyServicePicker.instance=new PropertyServicePicker();PropertyService=Class.create();PropertyService.BEDROOM_COLS=['kingCount','queenCount','fullCount','twinCount','sofaCount','cribCount','otherCount'];PropertyService.BATHROOM_COLS=['toilet','shower','tub','jettedTub','accessible','other'];PropertyService.ESCAPE_ATTRS={'listingTitle':80,'description':5000,'shortDescription':0,'ratesComment':1000,'feeComment':1000,'bedroomComment':500,'bathroomComment':500,'locationComment':1000,'addrLine1':0,'addrLine2':0,'addrCity':0};PropertyService.prototype={rpcName:'PropertyService',createProperty:function(clientParams,propId,propImages,doValidation,ignoreAddressErrors,onresponse){var serverParams=Service.serverFormatParams('property',clientParams);serverParams.propId=propId;serverParams.doValidation=doValidation;serverParams.ignoreAddressErrors=ignoreAddressErrors;if(propImages&&propImages.length>0)serverParams.images=this.serializeArray(propImages);this.send('createOrUpdateProperty',serverParams,onresponse,'POST');},getPropertyDetail:function(property,onresponse){var serverParams={};serverParams['property.id']=property.id;serverParams['property.version']=property.version;this.send('getPropertyDetail',serverParams,onresponse,'POST');},updateProperty:function(prop,clientParams,addlParams,onresponse){var serverParams=Service.serverFormatParams('property',clientParams);serverParams['property.id']=prop.id;serverParams['property.version']=prop.version;serverParams.ignoreAddressErrors=addlParams.ignoreAddressErrors;if(addlParams.bedrooms)serverParams['addlParams.bedrooms']=this.serializeArray(addlParams.bedrooms);if(addlParams.bathrooms)serverParams['addlParams.bathrooms']=this.serializeArray(addlParams.bathrooms);if(addlParams.seasonalRates)serverParams['addlParams.seasonalRates']=this.serializeArray(addlParams.seasonalRates);if(addlParams.bidPeriods)serverParams['addlParams.bidPeriods']=this.serializeArray(addlParams.bidPeriods);if(addlParams.amenities)serverParams['addlParams.amenities']=this.serializeHash(addlParams.amenities);if(addlParams.themes)serverParams['addlParams.themes']=this.serializeHash(addlParams.themes);if(addlParams.suitability)serverParams['addlParams.suitability']=this.serializeHash(addlParams.suitability,function(k,v){return k+':'+v});if(addlParams.images)serverParams['addlParams.images']=this.serializeArray(addlParams.images);if(wak.isDefined(addlParams.globalMonthlySpendLimit)){serverParams['addlParams.globalMonthlySpendLimit']=addlParams.globalMonthlySpendLimit;}
if(addlParams.availSpans){serverParams['addlParams.availableSpans']=addlParams.availSpans.join(',');serverParams['addlParams.spansStart']=addlParams.calStartDate.formatServer();serverParams['addlParams.spansEnd']=addlParams.calEndDate.formatServer();}
this.send('updateProperty',serverParams,onresponse,'POST',prop);},publishProperty:function(prop,validate,onresponse){var params={};params['property.id']=prop.id;params['property.version']=prop.version;params.shouldValidate=validate;this.send('publishProperty',params,onresponse,'POST',prop);},unpublishProperty:function(prop,onresponse){var params={};params['property.id']=prop.id;params['property.version']=prop.version;this.send('unpublishProperty',params,onresponse,'POST',prop);},deleteProperty:function(prop,onresponse){var params={};params['property.id']=prop.id;params['property.version']=prop.version;this.send('deleteProperty',params,onresponse,'POST',prop);},markPropertyAsDuplicate:function(prop,onresponse){var params={};params['property.id']=prop.id;params['property.version']=prop.version;this.send('markPropertyAsDuplicate',params,onresponse,'POST',prop);},savePropertyAddress:function(prop,clientParams,onresponse){var serverParams=Service.serverFormatParams('property',clientParams);serverParams['property.id']=prop.id;serverParams['property.version']=prop.version;this.send('savePropertyAddress',serverParams,onresponse,'POST',prop,wak.http.QUEUE_LAST_REQ);},submitInquiry:function(clientParams,onresponse){var serverParams=Service.serverFormatParams('hash',clientParams);this.send('submitInquiry',serverParams,onresponse,'POST');},getInquiryPanelPrefill:function(propId,startDate,endDate,onresponse){var params={};params.propId=propId;params.startDate=startDate;params.endDate=endDate;var preprocess=function(res){if(res.data){AvailabilityService.instance.normalizeSpans(res.data.availability,startDate,endDate);onresponse(res);}else{wak.log.error("no inquirydata returned from server");}}
this.send('getInquiryPanelPrefill',params,preprocess,'POST');},calculateRentalFees:function(propId,startDate,endDate,numAdults,numChildren,onresponse){var params={};params.propId=propId;if(startDate)params.startDate=startDate;if(endDate)params.endDate=endDate;if(numAdults)params.numAdults=numAdults;if(numChildren)params.numChildren=numChildren;this.send('calculateRentalFees',params,onresponse,'POST',null,wak.http.CANCEL_PENDING_REQ,false);},calculateRentalFeesNew:function(propId,startDate,endDate,numAdults,numChildren,onresponse){var params={};params.propId=propId;if(startDate)params.startDate=startDate;if(endDate)params.endDate=endDate;if(numAdults)params.numAdults=numAdults;if(numChildren)params.numChildren=numChildren;this.send('calculateRentalFeesNew',params,onresponse,'POST',null,wak.http.CANCEL_PENDING_REQ,false);},createOrUpdateBooking:function(bookingId,propId,clientParams,onresponse){var serverParams=Service.serverFormatParams('bookingInfo',clientParams);serverParams.bookingId=bookingId?bookingId:0;serverParams.propId=propId;this.send('createOrUpdateBooking',serverParams,onresponse,'POST');},finalizeBooking:function(bookingId,onresponse){var params={};params.bookingId=bookingId;this.send('finalizeBooking',params,onresponse,'POST');},purchaseInsurance:function(bookingId,wantsTravelIns,wantsDamageWaiver,onresponse){var params={};params.bookingId=bookingId;params.wantsTravelIns=wantsTravelIns;params.wantsDamageWaiver=wantsDamageWaiver
this.send('purchaseInsurance',params,onresponse,'POST',null,null,false);},normalizeResponse:function(res){this.normalize(res.data);},normalize:function(propOrArrProps){var arr=propOrArrProps;if(!wak.isArray(arr))arr=[propOrArrProps];arr.each(function(prop){prop.__longitude=prop.longitude||(prop.location&&prop.location.longitude);prop.__latitude=prop.latitude||(prop.location&&prop.location.latitude);if(prop.propertyType){prop.__propertyType=prop.propertyType.toLowerCase();}
prop.__propertySqFt=prop.squareFootage||strings.NA;$H(PropertyService.ESCAPE_ATTRS).keys().each(function(attr){if(!prop[attr])prop[attr]='';var maxLen=PropertyService.ESCAPE_ATTRS[attr];if(maxLen>0&&prop[attr].length>maxLen){prop[attr]=prop[attr].substr(0,maxLen);}
prop['__'+attr+'Raw']=prop[attr];prop[attr]=prop[attr].escapeHTML(attr!='listingTitle');});prop._compositeDisplayablePropId=this.getCompositeDisplayablePropId(prop);this.normalizeAmenities(prop);this.normalizeFav(prop);this.normalizeImages(prop);this.normalizeRooms(prop);this.normalizeRates(prop);this.normalizeBids(prop);}.bind(this));return propOrArrProps;},normalizeAmenities:function(prop){var hash;hash={};if(!prop.amenityStrings)prop.amenityStrings=[];prop.amenityStrings.each(function(am){hash[am]=true;});prop.amenities=hash;hash={};if(!prop.themeStrings)prop.themeStrings=[];prop.themeStrings.each(function(am){hash[am]=true;});prop.themes=hash;hash={};if(prop.suitability){var suitabilities=$A(prop.suitability);suitabilities.each(function(am){hash[am.name]=am.suitable;});}
prop.suitability=hash;if((mira.pageId=='PropertyDetail')&&!(prop.__amenitiesString)){var str=[];if(!mira.__PRIMARY_AMENITIES){mira.__PRIMARY_AMENITIES=$H($H(mira.AMENITIES['Primary Amenities']).values()).values().pluck('amenities').joinArrays();}
mira.__PRIMARY_AMENITIES.each(function(am){if(prop.amenities[am.id])str.push(am.displayName);});prop.__amenitiesString=str.length>0?str.join(strings.DOT):strings.NA;}},normalizeAmenitiesToDisplayString:function(prop){if(!(prop.__amenitiesStringAll)){var str=[];var allAmenities=this.getAmenitiesList();$H(prop.amenities).each(function(propAmenity){var amenityName=propAmenity[1].name;var displayName=allAmenities[amenityName];str.push(displayName);});prop.__amenitiesStringAll=str.length>0?str.join(strings.DOT):strings.NA;}},getAmenitiesList:function(){if(mira.__FLAT_AMENITIES)return mira.__FLAT_AMENITIES;mira.__FLAT_AMENITIES={};var arr=$H(mira.AMENITIES).values().collect(function(v){return $H(v);}).invoke('values').joinArrays().pluck('amenities').joinArrays().each(function(a){mira.__FLAT_AMENITIES[a.id]=a.displayName;});return mira.__FLAT_AMENITIES;},normalizeFav:function(prop){var id=prop.id;if(mira.user&&wak.isDefined(mira.user.favoriteIds[id])){prop.__isFav=mira.user.favoriteIds[id];prop.__isVisited=!mira.user.favoriteIds[id];}else{prop.__isFav=false;prop.__isVisited=false;}},normalizeImages:function(prop){prop.images.each(function(img,index){img.__index=index;if(!img.caption||img.caption=='&nbsp;')img.caption='';img.__captionRaw=img.caption;img.caption=img.caption.escapeHTML();if(!img.__id)img.__id='propImgId'+wak.idGenerator++;});},normalizeRooms:function(prop){prop.__bedBathString=strings.NA;if(prop.bedroomCount!=null||prop.bathroomCount!=null){prop.__bedBathString='';if(prop.bedroomCount!=null)prop.__bedBathString+=prop.bedroomCount+' bd';if(prop.bedroomCount!=null&&prop.bathroomCount!=null)prop.__bedBathString+=', ';if(prop.bathroomCount!=null)prop.__bedBathString+=prop.bathroomCount+' ba';}
if(!prop.bedrooms)prop.bedrooms=[];prop.bedrooms.each(function(room,index){if(!room.__id)room.__id=wak.idGenerator++;if(!room.__total){room.__total=0;PropertyService.BEDROOM_COLS.each(function(k){if(room[k])room.__total+=room[k];});}});if(!prop.bathrooms)prop.bathrooms=[];prop.bathrooms.each(function(room,index){if(!room.__id)room.__id=wak.idGenerator++;});},normalizeRates:function(prop){var RATE_NOT_SPECIFIED="no rates";var leftCurrencyIndicator='$';var rightCurrencyIndicator=null;var amountMin=null;var amountMax=null;prop.__ratesLabel="Rate";prop.__ratesString=null;prop.__ratesPerPeriodString="";prop.__ratesSlidePerPeriodString="";prop.__ratesMinNightsWarning="";if(prop.totalStayCost>0){amountMin=prop.totalStayCost;prop.__ratesLabel="Total price";prop.__ratesSlidePerPeriodString="/stay";prop.__ratesPerPeriodString=prop.__ratesSlidePerPeriodString;}else if(prop.minRate>0){amountMin=prop.minRate;amountMax=prop.maxRate;prop.__ratesLabel="Rate";var lowerRatePeriodFull=prop.minRatePeriod.toLowerCase();var lowerRatePeriodAbbrev=null;prop.__ratesPerPeriodString=" per "+lowerRatePeriodFull;if(lowerRatePeriodFull=='night')lowerRatePeriodAbbrev='nt';if(lowerRatePeriodFull=='week')lowerRatePeriodAbbrev='wk';if(lowerRatePeriodFull=='month')lowerRatePeriodAbbrev='mo';prop.__ratesSlidePerPeriodString="/"+lowerRatePeriodAbbrev;}
if(prop.ratesCurrency!="UNKNOWN"&&prop.ratesCurrency!='USD'){leftCurrencyIndicator=null;rightCurrencyIndicator=prop.ratesCurrencySymbol;}
if(amountMax==amountMin){amountMax=null;}
if(amountMax){amountMax=formatNumber(Math.round(amountMax),0,",",null,leftCurrencyIndicator,rightCurrencyIndicator,"-",null);}
prop.__ratesPerPeriodString+="*";amountMin=formatNumber(Math.round(amountMin),0,",",null,leftCurrencyIndicator,rightCurrencyIndicator,"-",null);if(amountMin)prop.__ratesString=amountMin+(amountMax?"&ndash;"+amountMax:"");if(!prop.__ratesString){prop.__ratesString=RATE_NOT_SPECIFIED;prop.__ratesPerPeriodString="";prop.__ratesSlidePerPeriodString="";}
if(prop.minNightsWarning){prop.__ratesMinNightsWarning=' ('+prop.minNightsWarning+' day '+'min)';}
if(!prop.seasonalRates)prop.seasonalRates=[];prop.seasonalRates.each(function(rate,index){if(!rate.__id)rate.__id=wak.idGenerator++;if(rate.startDate&&rate.startDate.getFullYear()==1000)rate.startDate=null;if(rate.endDate&&rate.endDate.getFullYear()==9999)rate.endDate=null;if(!rate.weeknightPrice)rate.weeknightPrice=0;if(!rate.weekendPrice)rate.weekendPrice=0;if(!rate.weeklyPrice)rate.weeklyPrice=0;if(!rate.monthlyPrice)rate.monthlyPrice=0;if(!rate.name)rate.name='Season '+seasonIndex++;});prop.seasonalRates.each(function(rate){if(rate.startDate)rate.startDate=Date.getLocalDateFromUTCDate(rate.startDate);if(rate.endDate)rate.endDate=Date.getLocalDateFromUTCDate(rate.endDate);});},normalizeBids:function(prop){if(!prop.bidPeriods)prop.bidPeriods=[];prop.bidPeriods.each(function(bid,index){if(!bid.__id)bid.__id=wak.idGenerator++;if(bid.startDate&&bid.startDate.getFullYear()==1000)bid.startDate=null;if(bid.endDate&&bid.endDate.getFullYear()==9999)bid.endDate=null;if(bid.startDate)bid.startDate=Date.getLocalDateFromUTCDate(bid.startDate);if(bid.endDate)bid.endDate=Date.getLocalDateFromUTCDate(bid.endDate);})},getCompositeDisplayablePropId:function(property){var compositeDisplayablePropId="";var ppgID="P"+property.id.toString();var coid=property.userSourceId?"M"+property.userSourceId:null;var sourceId=property.sourceId;if(mira.pageData.doDebug&&wak.isDefinedNonNull(property.source))compositeDisplayablePropId+=property.source+" - ";if(sourceId)compositeDisplayablePropId+=sourceId;if(coid)compositeDisplayablePropId+=(compositeDisplayablePropId.length>0)?"-"+coid:coid;if(ppgID)compositeDisplayablePropId+=(compositeDisplayablePropId.length>0)?" ("+ppgID+")":ppgID;return compositeDisplayablePropId;}};Object.extend(PropertyService.prototype,Service.prototype);PropertyService.instance=new PropertyService();SearchService=Class.create();SearchService.prototype={rpcName:'SearchService',autoCompleteLocation:function(locationStr,onresponse){this.send('autoCompleteUsingIndex',{location:locationStr},onresponse,null,null,wak.http.CANCEL_PENDING_REQ,false);},search:function(q,wantsHistogram,onresponse){var qc=Object.clone(q);if(qc['q.locationPath'])qc['q.locationPath']=encodeURIComponent(qc['q.locationPath']);for(var k in qc)if(qc[k]==null)delete qc[k];var size=wak.map.sizeNonNulls(qc);if((size==1)&&(qc['q.count']!=null))size=0;if(size>0){qc.wantsHistogram=wantsHistogram;var onpreprocess=function(res){if(res.ok){PropertyService.instance.normalize(res.data.properties);if(res.data.properties2)PropertyService.instance.normalize(res.data.properties2);res.data.q=q;onresponse(res);}};this.send('search',qc,onpreprocess);}},runQuery:function(params,onresponse){this.send('runQuery',params,this.preprocessResponse(PropertyService.instance.normalizeResponse.bind(PropertyService.instance),onresponse));},propMiniDetailView:function(propId,queryId,onresponse){var params={};params.propertyId=propId;params.queryId=queryId;this.send('propMiniDetailView',params,onresponse,'POST');}};Object.extend(SearchService.prototype,Service.prototype);SearchService.instance=new SearchService();AuthService=Class.create();AuthService.prototype={rpcName:'AuthService',signup:function(params,onresponse){params.isSignup=true;params.rememberMe=false;this.send('login',params,onresponse,'POST');},login:function(params,onresponse){params.isSignup=false;this.send('login',params,onresponse,'POST');},signupWithProperty:function(params,propId,onresponse){params.propId=propId;params.isSignup=true;this.send('loginWithProperty',params,onresponse,'POST');},loginWithProperty:function(params,propId,onresponse){params.propId=propId;params.isSignup=false;this.send('loginWithProperty',params,onresponse,'POST');},resetCodeToPassword:function(params,propId,onresponse){this.send('resetCodeToPassword',params,onresponse,'POST');},authenticate:function(params,onresponse){this.send('authenticate',params,onresponse,'POST');},forgotPassword:function(emailAddr,onresponse){this.send('forgotPassword',{email:emailAddr},onresponse,'POST');},resetPassword:function(params,onresponse){this.send('resetPassword',params,onresponse,'POST');},unsubscribeEmail:function(email,code,onresponse){this.send('unsubscribeEmail',{email:email,code:code},onresponse);},sendFeedback:function(type,name,email,msg,onresponse){var params={type:type,name:name,email:email,msg:msg,userAgent:wak.USER_AGENT}
this.send('sendFeedback',params,onresponse,'POST');},changeEmail:function(email,onresponse){var params={email:email};this.send('changeEmail',params,onresponse,'POST');},changePassword:function(password,onresponse){var params={password:password}
this.send('changePassword',params,onresponse,'POST');}};Object.extend(AuthService.prototype,Service.prototype);AuthService.instance=new AuthService();AvailabilityService=Class.create();AvailabilityService.prototype={rpcName:'AvailabilityService',get:function(propertyId,startDate,endDate,onresponse){var params={propertyId:propertyId,startDate:startDate.formatServer(),endDate:endDate.formatServer()};var preprocess=function(res){AvailabilityService.instance.normalizeSpans(res.data,startDate,endDate);onresponse(res);}
this.send('getAvailability',params,preprocess);},normalizeSpans:function(spans,earliestDate,latestDate){if(spans&&wak.isArray(spans)){spans.each(function(span){if(span.startDate<earliestDate)span.startDate=earliestDate;if(span.startDate>latestDate)span.startDate=latestDate;if(span.endDate<earliestDate)span.endDate=earliestDate;if(span.endDate>latestDate)span.endDate=latestDate;});}}};Object.extend(AvailabilityService.prototype,Service.prototype);AvailabilityService.instance=new AvailabilityService();UserService=Class.create();UserService.prototype={rpcName:'UserService',getCurrentUserFavsState:function(clientParams,onresponse){var serverParams=Service.serverFormatParams('clientParams',clientParams);this.send('getCurrentUserFavsState',serverParams,onresponse);},addFavorite:function(prop,userAdded,fromContext){if(userAdded==null)userAdded=true;var id=prop.id;var updateFavsList=function(result){if(result)mira.user=result.data;if(mira.user){if(!mira.user.favoriteIds)mira.user.favoriteIds={};mira.user.favoriteIds[id]=userAdded;}
PropertyService.instance.normalizeFav(prop);CMFavsTarget.instance.update();}
if(mira.user){updateFavsList();updateFavsList=null;}
mira.setFromContext(fromContext);this.send('addFavorite',{propertyId:id,userAdded:userAdded},updateFavsList,null,null,null,false);},removeFavorite:function(prop,index,fromContext){var id=prop.id;var updateFavsList=function(result){if(result)mira.user=result.data;if(mira.user){if(!mira.user.favoriteIds)mira.user.favoriteIds={};if(wak.isDefined(index)&&mira.user.favoriteProps&&(mira.user.favoriteProps.length>=index-1)){mira.user.favoriteProps.removeAt(index);}
delete mira.user.favoriteIds[id];}
PropertyService.instance.normalizeFav(prop);CMFavsTarget.instance.update();}
if(mira.user){updateFavsList();updateFavsList=null;}
mira.setFromContext(fromContext);this.send('removeFavorite',{propertyId:id},updateFavsList);},removeAllFavorites:function(){mira.user.favoriteIds={};mira.user.favoriteProps=[];this.send('removeAllFavorites',null,null);},shareProperty:function(clientParams,onresponse){var serverParams=Service.serverFormatParams('clientParams',clientParams);this.send('shareProperty',serverParams,onresponse,'POST');},shareSearchResults:function(clientParams,onresponse){var serverParams=Service.serverFormatParams('clientParams',clientParams);this.send('shareSearchResults',serverParams,onresponse,'POST');},shareFavorites:function(clientParams,onresponse){var serverParams=Service.serverFormatParams('clientParams',clientParams);this.send('shareFavorites',serverParams,onresponse,'POST');},hideBanner:function(){mira.user.showbanner=false;this.send('hideBanner',null,null);},optOut:function(){this.send('setEmailOptOut',{'optOut':true},null);},clearTags:function(){this.send('clearTags',null,null);$('lowestDivTagsId').title='none';wak.browserRefresh(500);}};Service.serverFormatParams=function(serverParamsMapName,clientParamsMap){var serverParams={};if(wak.isDefinedNonNull(clientParamsMap)){for(var key in clientParamsMap){serverParams[serverParamsMapName+'.'+key]=clientParamsMap[key];}}
return serverParams;};Object.extend(UserService.prototype,Service.prototype);UserService.instance=new UserService();LocationService=Class.create();LocationService.prototype={rpcName:'LocationService',getMapInfo:function(params,onresponse){this.send('getMapInfo',params,onresponse,'POST',null,wak.http.CANCEL_PENDING_REQ);},submitCityHostInquiry:function(clientParams,onresponse){var serverParams=Service.serverFormatParams('clientParams',clientParams);this.send('submitCityHostInquiry',serverParams,onresponse,'POST');}};Object.extend(LocationService.prototype,Service.prototype);LocationService.instance=new LocationService();LogEventService=Class.create();LogEventService.prototype={externalBeaconSent:function(affiliateName,propertyId,conversionEventType,revenueValue,rawUrl){this.sendBeacon('externalBeaconSent',{affiliateName:affiliateName,propertyId:propertyId,conversionEventType:conversionEventType,revenueValue:revenueValue,rawUrl:rawUrl});},propImpressionsServed:function(startIndex,props){this.sendBeacon('propImpressionsServed',{startIndex:startIndex,propIds:props.pluck('id')});},clientEnvironmentInfo:function(){if(wak.cookie.enabled()){this.sendBeacon('clientEnvironmentInfo',{visibleWidth:wak.geometry.visibleBounds().width,visibleHeight:wak.geometry.visibleBounds().height,screenWidth:wak.geometry.screenBounds().width,screenHeight:wak.geometry.screenBounds().height});}},dateCollectionPanel:function(source,startDate,endDate,dismissAction){if(wak.cookie.enabled()){this.sendBeacon('dateCollectionPanel',{source:source,startDate:startDate,endDate:endDate,dismissAction:dismissAction});}},clientEventString:function(eventName,params){if(wak.cookie.enabled()){var SEPARATOR="|";var BASE_DETAIL_STRING=mira.pageId+"."+eventName;var detailString=BASE_DETAIL_STRING;if(params){if(wak.isString(params)){detailString+=SEPARATOR+params;}else{if(wak.isDefined(params.length)){for(var i=0;i<params.length;i++){detailString+=SEPARATOR;detailString+=params[i];}}else{for(key in params){detailString+=SEPARATOR;detailString+=params[key];}}
if(detailString==BASE_DETAIL_STRING){detailString=params.toString();}}
if(detailString==null)detailString="null";}
if(!eventName){wak.log.error('null eventName passed to clientEventString()')}
this.sendBeacon('clientEventString',{detail:detailString});}},clientEvent:function(path){var url=mira.URL.rpc+'/ClientEvent/'+mira.pageId+'/'+path;wak.html.resetBeaconImgSource('lmBeaconImg',url);},sendBeacon:function(fnName,params){var url=mira.URL.rpc+'/LogEventService/'+fnName;url=wak.url.build(params,url);wak.html.resetBeaconImgSource('lmBeaconImg',url);},sendExternalBeacon:function(url,affiliateName,propertyId,conversionEventType,revenueValue){if(!affiliateName)affiliateName="unknown";if(!conversionEventType)conversionEventType=mira.constants.CONVERSION_EVENT_TYPE_UNKNOWN;if(!revenueValue)revenueValue="1";if(!mira.prodMode){var devUrl=mira.URL['Home']+mira.URL.rpc+"/devmodeIgnore-RealExternalBeaconWouldBeHere/"+affiliateName;var devParams={}
devParams.urlWhenInProdMode='"'+url+'"';url=wak.url.build(devParams,devUrl);affiliateName='devmodeIgnore-'+affiliateName;}
wak.html.resetBeaconImgSource('lmBeaconImg',url);LogEventService.instance.externalBeaconSent(affiliateName,propertyId,conversionEventType,revenueValue,url);}};LogEventService.instance=new LogEventService();BillingService=Class.create();BillingService.prototype={rpcName:'BillingService',getLedger:function(accountId,onresponse){var sendParams={};sendParams['account.id']=accountId;this.send('getLedger',sendParams,onresponse,'POST');},createOrUpdateCreditCard:function(clientParams,onresponse){var serverParams=Service.serverFormatParams('ccInfo',clientParams);this.send('createOrUpdateCreditCard',serverParams,onresponse,'POST');},updateGlobalMonthlySpendLimit:function(amount,onresponse){this.send('updateGlobalMonthlySpendLimit',{amount:amount},onresponse,'POST',null,null,false);},saveLedgerEntryBookedValues:function(leId,params,onresponse){var serverParams={leId:leId,bookedValue:params.bookedValue,renterEmail:params.renterEmail,renterPhone:params.renterPhone};this.send('saveLedgerEntryBookedValues',serverParams,onresponse)}};Object.extend(BillingService.prototype,Service.prototype);BillingService.instance=new BillingService();MiscService=Class.create();MiscService.prototype={rpcName:'MiscService',newsletterSignup:function(emailAddress,onresponse){this.send('newsletterSignup',{emailAddress:emailAddress},onresponse,'POST',null,null,false);},giveawaySignup:function(clientParams,onresponse){var serverParams=Service.serverFormatParams('values',clientParams);this.send('giveawaySignup',serverParams,onresponse,'POST',null,null,false);}};Object.extend(MiscService.prototype,Service.prototype);MiscService.instance=new MiscService();