/*1357580216,178142507*/

if (self.CavalryLogger) { CavalryLogger.start_js(["qSYVB"]); }

__d("PlacesDataSource",["Class","DataSource","copyProperties"],function(a,b,c,d,e,f){var g=b('Class'),h=b('DataSource'),i=b('copyProperties');function j(k){this.parent.construct(this,k);this._origBootstrapEndpoint=this.bootstrapEndpoint;}g.extend(j,h);i(j.prototype,{shouldFetchMoreResults:function(k){if(this.queryData.new_js_ranking){return true;}else return this.parent.shouldFetchMoreResults(k);},mergeUids:function(k,l,m,n){if(this.queryData.new_js_ranking){this._checkExtendedMatch(n,k);return this.deduplicateByKey(m.concat(l,k));}else return this.parent.mergeUids(k,l,m,n);},resetBootstrapEndpoint:function(k){this.setBootstrapEndpoint(this._origBootstrapEndpoint,k);return this;},setBootstrapEndpoint:function(k,l){if(this.bootstrapEndpoint!==k){this.bootstrapEndpoint=k;if(this._bootstrapped||this._bootstrapping)l=true;}if(l)this.dirty().bootstrap();return this;},getQueryEndpoint:function(){return this.queryEndpoint;},getBootstrapData:function(){return this.bootstrapData;}});e.exports=j;});
__d("PlacesTypeaheadCore",["Arbiter","Class","CSS","Focus","Run","StickyPlaceholderInput","Style","TypeaheadCore","UserAgent","copyProperties"],function(a,b,c,d,e,f){var g=b('Arbiter'),h=b('Class'),i=b('CSS'),j=b('Focus'),k=b('Run'),l=b('StickyPlaceholderInput'),m=b('Style'),n=b('TypeaheadCore'),o=b('UserAgent'),p=b('copyProperties');function q(r){this.parent.construct(this,r);}h.extend(q,n);p(q.prototype,{resetOnKeyup:false,init:function(r,s,t){this.parent.init(r,s,t);if(o.ie()<7)r.setMaxResults(5);this.arbiterTokens=[g.subscribe('Places/PlaceCreationCancel'+this.callbackID,function(u,v){this.view.allowPlaceCreation=false;this.view.allowFreeformOption=true;this.view.reset();this.focusElement();}.bind(this))];k.onLeave(function(){this.arbiterTokens.forEach(g.unsubscribe);}.bind(this));this._typeaheadID=t.id;this._citySet=false;this.data.subscribe('fetchComplete',this.update.bind(this));},initToggle:function(){var r=this.root.parentNode,s=m.get(r,'position')!='static'?r:this.root,t=this.view,u='PlacesTypeaheadFocused';this.subscribe('focus',function(){t.show();i.addClass(s,u);});this.subscribe('blur',function(){t.hide();i.removeClass(s,u);});},focusElement:function(){j.set(this.element);this.value='';this.checkValue();},setValue:function(r){this.parent.setValue(r);l.update(this.element);},updateDataSource:function(r){this.data.setQueryData({city_id:this._cityId,city_set:this._citySet});this.data.setBootstrapData({city_id:this._cityId});if(r){this.data.dirty();this.data.bootstrap();}},setCity:function(r,s,t){this._citySet=t;if(this._cityId!==r){this._cityId=r;this.updateDataSource(t);}},update:function(r,s){var t=s.response;if(!t)return;var u=t.getPayload();if(u.cityId)if(!this._citySet)this.setCity(u.cityId,u.cityName,false);}});e.exports=q;});
var PlacesTypeaheadBehavior={init:function(a,b){a.subscribe(['reset','select','highlight'],function(c,d){if(c==='highlight'&&d.index!==-1&&d.selected.type!='freeform'&&d.selected.map&&!d.selected.changeCity){DOM.setContent(b,d.selected.map);CSS.show(b);}else CSS.hide(b);});}};
var PlaceTypeaheadButton={toggleButton:function(a,b){CSS.addClass(a,'uiButtonDisabled');b.getView().subscribe('select',CSS.removeClass.curry(a,'uiButtonDisabled'));b.getView().subscribe('select',CSS.removeClass.curry(a,'hidden_elem'));b.getCore().subscribe('unselect',CSS.addClass.curry(a,'uiButtonDisabled'));}};
__d("PlacesTypeaheadView",["Arbiter","Class","copyProperties","CSS","Dialog","DOM","Parent","Run","ScrollableArea","tx","TypeaheadView","AsyncRequest"],function(a,b,c,d,e,f){var g=b('Arbiter'),h=b('Class'),i=b('copyProperties'),j=b('CSS'),k=b('Dialog'),l=b('DOM'),m=b('Parent'),n=b('Run'),o=b('ScrollableArea'),p=b('tx'),q=b('TypeaheadView'),r=b('AsyncRequest');function s(t,u){this.parent.construct(this,t,u);}h.extend(s,q);i(s.prototype,{ignoreNextMouseover:false,init:function(){this.content=l.find(this.element,'div.PlacesTypeaheadViewList');this.parent.init();this.subscribe(['render','reset'],this.renderBorders.bind(this));this.arbiterTokens=[g.subscribe('Places/PlaceCreated'+this.callbackID,function(t,u){var v={text:u.name,rawtext:u.name,uid:u.fbid,city_id:u.city_id,city_name:u.city_name,city_page_id:u.city_page_id};this.inform('select',{index:-1,clicked:true,selected:v});this.inform('afterSelect');}.bind(this))];if(this.allowHomeCreation)this.arbiterTokens.push(g.subscribe('Places/UpdateResidenceName'+this.callbackID,function(t,u){this.inform('select',{index:-1,clicked:true,selected:u.selected});this.inform('afterSelect');}.bind(this)));this.arbiterTokens.push(g.subscribe('Events/autoSuggestionSelected',function(t,u){this.inform('select',{index:-1,clicked:true,selected:{text:u.event_name,rawtext:u.event_name,uid:u.event_fbid}});this.inform('afterSelect');}.bind(this)));n.onLeave(function(){this.arbiterTokens.forEach(g.unsubscribe);}.bind(this));},renderBorders:function(){j.conditionClass(this.element,'PlacesTypeaheadViewPopulated',this.items.length);},render:function(t,u,v){u.forEach(function(z){z.value=t;});if(this.allowFreeformOption&&t&&(!u||u.length===0||u[u.length-1].type!='freeform')){var w=p._("Just use \"{custom_location}\"",{custom_location:t});u.push({uid:'0',rawtext:t,text:w,type:'freeform'});}if(this.allowPlaceCreation&&t&&(!u||u.length===0||u[u.length-1].type!='placecreate')){var x=p._("Add place \"{custom_location}\"",{custom_location:t});u.push({uid:'0',rawtext:t,text:x,type:'placecreate'});}this.parent.render(t,u,v);var y=o.getInstance(this.content);y&&y.adjustGripper();},select:function(t){var u=this.index,v=this.results[u];if(v){if(v.type==='placecreate'){k.bootstrap('/ajax/places/create/dialog.php',{name:v.rawtext,callback_id:this.callbackID});return;}if(v.type==='freeform')v.text=v.rawtext;if(v.place_type=='unconfirmed_residence'&&this.allowHomeCreation)new r().setURI('/ajax/places/create/residence_dialog.php').setData({selected:v,callbackid:this.callbackID,page_id:v.uid}).send();this.parent.select(t);}},next:function(){this.parent.next();this._scrollIntoView(this.selected);},prev:function(){this.parent.prev();this._scrollIntoView(this.selected);},_scrollIntoView:function(t){if(!m.byClass(t,'uiScrollableArea'))return;this.ignoreNextMouseover=true;var u=m.byClass(t,'uiScrollableAreaWrap'),v=t.offsetTop-u.offsetTop;if(v<u.scrollTop){u.scrollTop=v;return;}var w=v+t.offsetHeight;if(w>u.scrollTop+u.offsetHeight)u.scrollTop=w-u.offsetHeight;},mouseover:function(event){this.ignoreNextMouseover||this.parent.mouseover(event);this.ignoreNextMouseover=false;},highlight:function(t){this.parent.highlight(t,true);}});e.exports=s;});
__d("SummaryAddCityDialogController",["DOMEventListener","Arbiter","copyProperties","CSS"],function(a,b,c,d,e,f){var g=b('DOMEventListener'),h=b('Arbiter'),i=b('copyProperties'),j=b('CSS');function k(l,m,n,o){this.icon=l;this.typeahead=n;g.add(this.icon,'click',function(){m.show();});if(o)m.show();h.subscribe(k.SUBMIT,this.submitted.bind(this));}i(k.prototype,{submitted:function(){if(this.typeahead.getCore().getHiddenValue()!=='')j.hide(this.icon);}});k.SUBMIT='AddCitySubmitted';e.exports=k;});
function SearchAdvancedFilters(a,b,c){this._selectors=a;this._fieldsets=b;this._submit_on_remove=c;}copyProperties(SearchAdvancedFilters.prototype,{_form:null,init:function(){var a={},b=this._selectors,c=this._fieldsets,d=[],e;for(var f in b){var g=DOM.find($(f),'.fbSearchAdvancedFiltersRemoveButton');a[f]={remove_button:g};e=b[f];Selector.getOptions(e).forEach(function(l){var m=c[Selector.getOptionValue(l)];m.options.push(l);if(Selector.isOptionSelected(l))a[f].fieldset=m;});Selector.listen(e,'change',this.onSelect.bind(this));Selector.setEnabled(e,true);}var h=Parent.byTag(e,'table'),i=DOM.find(h,'.fbSearchAdvancedFiltersAddButton'),j=this._visible_table=DOM.find(h,'tbody.fbSearchAdvancedFiltersVisible');this._hidden_table=DOM.find(h,'tbody.fbSearchAdvancedFiltersHidden');for(var k in c)c[k].id=k;$A(j.childNodes).forEach(function(l){a[l.id].fieldset.disableOptions();});this._row_info=a;this._add_button_container=Parent.byTag(i,'tr');if(this._submit_on_remove)this._form=Parent.byTag(j,'form');Event.listen(i,'click',this.addRow.bind(this));Event.listen(j,'click',this.removeRow.bind(this));this.updateButtons();},updateButtons:function(){var a=this._visible_table;CSS.conditionShow(this._row_info[a.firstChild.id].remove_button,a.childNodes.length>1);CSS.conditionShow(this._add_button_container,this._hidden_table.childNodes.length>0);},getRowInfo:function(a){return this._row_info[Parent.byTag(a,'tr').id];},onSelect:function(a){var b=a.selector,c=this.getRowInfo(b),d=c.fieldset,e=$(d.id),f=this._fieldsets[Selector.getValue(b)],g=$(f.id),h=this._selectors[Parent.byTag(g,'tr').id],i=e.parentNode;c.fieldset=f;this.getRowInfo(h).fieldset=d;Selector.setSelected(h,d.id,true);d._typeaheads.forEach(function(j){j.getCore().reset();});g.parentNode.appendChild(e);i.appendChild(g);},addRow:function(){var a=this._hidden_table.lastChild;if(a){this._row_info[a.id].fieldset.disableOptions();this._visible_table.appendChild(a);this.updateButtons();}},removeRow:function(event){var a=Parent.byClass(event.getTarget(),'fbSearchAdvancedFiltersRemoveButton');if(a&&this._visible_table.childNodes.length>1){var b=Parent.byTag(a,'tr');this._row_info[b.id].fieldset.resetAndEnable(this._form);this._hidden_table.appendChild(b);this.updateButtons();}}});function SearchAdvancedFiltersFieldset(a,b,c){this._typeaheads=a;this._inputs=b;this._selects=c;this.options=[];if(this._typeaheads)this._typeaheads.forEach(function(d){DOM.scry(d.getElement(),'input').forEach(function(e){e.disabled=false;});});}copyProperties(SearchAdvancedFiltersFieldset.prototype,{resetAndEnable:function(a){var b=!!a;this._typeaheads.forEach(function(c){var d=c.getCore();b=b&&!d.getValue();d.reset();});this._inputs.forEach(function(c){b=b&&Input.isEmpty(c);Input.reset(c);});this._selects.forEach(function(c){b=b&&!c.selectedIndex;c.selectedIndex=0;});this.options.forEach(function(c){Selector.setOptionEnabled(c,true);});if(a&&!b)if(a.getAttribute('rel')=='async'){Form.bootstrap(a);}else a.submit();},disableOptions:function(){this.options.forEach(function(a){if(!Selector.isOptionSelected(a))Selector.setOptionEnabled(a,false);});}});
__d("ProgressiveDatepicker",["Event","Arbiter","ArbiterMixin","CSS","DataStore","DOM","Parent","copyProperties"],function(a,b,c,d,e,f){var g=b('Event'),h=b('Arbiter'),i=b('ArbiterMixin'),j=b('CSS'),k=b('DataStore'),l=b('DOM'),m=b('Parent'),n=b('copyProperties');function o(r){return new Date(r[0],r[1],r[2],r[3],r[4]);}function p(r,s){while(r.length)l.insertAfter(s,r.pop());}function q(r,s){this._root=r;this._savedLabels={};this._savedPeriodsBack=[];this._savedPeriodsFront=[];this._menus={};this._mintime=s.mintime&&new Date(1000*s.mintime);this._maxtime=s.maxtime&&new Date(1000*s.maxtime);k.set(r,'datepicker',this);l.scry(r,'select').forEach(function(t){g.listen(t,'change',this._handleChange.shield(this,t));var u=m.byClass(t,'period');g.listen(t,'focus',j.addClass.curry(u,'periodFocus'));g.listen(t,'blur',j.removeClass.curry(u,'periodFocus'));this._setMenuSelectionState(t);if(t.getAttribute('data-name')==='month')this._filterInvalidDates();}.bind(this));l.scry(r,'a.periodLabel').forEach(function(t){var u=m.byClass(t,'period');g.listen(t,'click',function(){j.addClass(u,'periodSelected');j.addClass(u,'periodFocus');});});this._filterInvalidDates();this.inform('initialized',this,h.BEHAVIOR_STATE);}n(q,{PERIODS:['year','month','day','hour','minute'],getInstance:function(r){return k.get(r,'datepicker');}});n(q.prototype,i,{setDate:function(r,s,t,u,v){this._addSavedPeriods();var w=q.PERIODS;for(var x=0;x<w.length;x++)this._setValueForPeriod(w[x],arguments[x]);this._filterInvalidDates();this.inform('changed');},setDateWithTimestamp:function(r){var s=new Date(r);this.setDate(s.getFullYear(),s.getMonth()+1,s.getDate(),s.getHours(),s.getMinutes());},isSet:function(){var r=q.PERIODS;for(var s=0;s<r.length;s++)if(this._getValueForPeriod(r[s]))return true;return false;},getRoot:function(){return this._root;},getValues:function(){var r=q.PERIODS,s={};for(var t=0;t<r.length;t++){var u=this._getValueForPeriod(r[t]);if(u)s[r[t]]=u;}return s;},getDate:function(){var r=this.getValues();return new Date(r.year||0,(r.month||1)-1,r.day||1,r.hour||0,r.minute||0);},getTimestamp:function(){return Math.round(this.getDate().getTime()/1000);},_setValueForPeriod:function(r,s){var t=this._menuForPeriodName(r);if(!t)return;if(s===undefined)s='';var u=t.options;for(var v=0,w=u.length;v<w;v++)if(u[v].value==s){t.selectedIndex=v;break;}this._setMenuSelectionState(t);},_getValueForPeriod:function(r){var s=this._menuForPeriodName(r);return (s&&s.options[s.selectedIndex].value);},_handleChange:function(r){this._setMenuSelectionState(r);this._filterInvalidDates();this.inform('changed');},_setMenuSelectionState:function(r){var s=m.byClass(r,'period');if(!s)return;if(j.hasClass(s,'periodRequired')){if(r.selectedIndex===0)r.selectedIndex=1;}else this._updateLabel(r);var t=r.getAttribute('data-name'),u=r.options[r.selectedIndex].value;j.conditionClass(s,'periodSelected',u);j.conditionClass(this._root,this._selectedClass(t),u);if(!u)this._resetMenu(q.PERIODS.indexOf(t)+1);},_updateLabel:function(r){var s=r.getAttribute('data-name'),t=r.options[0];if(!this._savedLabels[s])this._savedLabels[s]=l.getText(t);if(r.selectedIndex===0){l.setContent(t,this._savedLabels[s]);}else l.setContent(t,'--');},_daysInMonth:function(r,s){return new Date(r||1999,s+1||1,0).getDate();},_daysInCurrentMonth:function(){return this._daysInMonth(this._getValueForPeriod('year'),this._getValueForPeriod('month')-1);},_menuForPeriodName:function(r){if(!this._menus[r])this._menus[r]=l.scry(this._root,'.'+r+'Menu')[0];return this._menus[r];},_selectedClass:function(r){return 'uiProgressiveDatepickerSelected-'+r;},_resetMenu:function(r){var s=q.PERIODS;for(;r<s.length;r++){var t=s[r],u=this._menuForPeriodName(t);if(!u)return;if(m.byClass(u,'periodRequired')){u.selectedIndex=1;}else{j.removeClass(m.byClass(u,'period'),'periodSelected');j.removeClass(this._root,this._selectedClass(t));u.selectedIndex=0;this._updateLabel(u);}}},_addSavedPeriods:function(){var r=q.PERIODS;for(var s=0;s<r.length;s++){var t=this._menuForPeriodName(r[s]);if(!t)return;this._savedPeriodsFront[s]||(this._savedPeriodsFront[s]=[]);this._savedPeriodsBack[s]||(this._savedPeriodsBack[s]=[]);var u=t.options[0],v=t.options[t.options.length-1];if(s===q.PERIODS.indexOf('year')){p(this._savedPeriodsBack[s],u);p(this._savedPeriodsFront[s],v);}else{p(this._savedPeriodsFront[s],u);p(this._savedPeriodsBack[s],v);}}},_filterInvalidDates:function(){this._addSavedPeriods();var r=q.PERIODS,s=this.getValues();for(var t=0;t<r.length;t++){var u=this._menuForPeriodName(r[t]);if(!u)return;this._savedPeriodsFront[t]||(this._savedPeriodsFront[t]=[]);this._savedPeriodsBack[t]||(this._savedPeriodsBack[t]=[]);for(var v=1;v<u.options.length;){var w=u.options[v],x=[((t-1>=0)?s[r[0]]:0),((t-1>=1)?s[r[1]]-1:0),((t-1>=2)?s[r[2]]:1),((t-1>=3)?s[r[3]]:0),((t-1>=4)?s[r[4]]:0)];x[t]=w.value;if(t===q.PERIODS.indexOf('month'))x[t]=x[t]-1;var y=o(x),z=[((t-1>=0)?s[r[0]]:9001),((t-1>=1)?s[r[1]]-1:11),((t-1>=2)?s[r[2]]:this._daysInCurrentMonth()),((t-1>=3)?s[r[3]]:23),((t-1>=4)?s[r[4]]:59)];z[t]=w.value;if(t===q.PERIODS.indexOf('month')){z[t]--;z[t+1]=this._daysInMonth(z[0],z[1]);}var aa=o(z),ba=(y>this._maxtime),ca=(aa<this._mintime),da=(t===q.PERIODS.indexOf('day')&&w.value>this._daysInCurrentMonth());if(ca||ba||da){if(w.selected){w.selected=false;this._resetMenu(t);}l.remove(w);if(ba||da){this._savedPeriodsBack[t].push(w);}else this._savedPeriodsFront[t].push(w);}else v++;}}}});e.exports=q;});
__d("TypeaheadDefaultToText",["Event","copyProperties"],function(a,b,c,d,e,f){var g=b('Event'),h=b('copyProperties');function i(j){this._typeahead=j;}h(i.prototype,{_blurSubscription:null,_submitListener:null,enable:function(){var j=this._typeahead.getCore(),k=j.getElement().form;function l(){j.getHiddenValue()||j.setHiddenValue(j.getValue());}this._blurSubscription=j.subscribe('blur',l);if(k)this._submitListener=g.listen(k,'submit',l);},disable:function(){this._typeahead.getCore().unsubscribe(this._blurSubscription);this._blurSubscription=null;if(this._submitListener){this._submitListener.remove();this._submitListener=null;}}});e.exports=i;});
__d("legacy:DefaultToTextTypeaheadBehavior",["TypeaheadDefaultToText"],function(a,b,c,d){var e=b('TypeaheadDefaultToText');if(!a.TypeaheadBehaviors)a.TypeaheadBehaviors={};a.TypeaheadBehaviors.defaultToText=function(f){f.enableBehavior(e);};},3);
__d("TypeaheadRequireSelection",["Event","copyProperties"],function(a,b,c,d,e,f){var g=b('Event'),h=b('copyProperties');function i(j){this._typeahead=j;}h(i.prototype,{_subscription:null,_eventListener:null,enable:function(){var j=this._typeahead.getCore(),k=j.getElement().form;function l(){!j.getHiddenValue()&&j.reset();}l();this._subscription=j.subscribe('blur',l);if(k)this._eventListener=g.listen(k,'submit',l);},disable:function(){this._typeahead.getCore().unsubscribe(this._subscription);this._subscription=null;if(this._eventListener){this._eventListener.remove();this._eventListener=null;}}});e.exports=i;});
__d("legacy:RequireSelectionTypeaheadBehavior",["TypeaheadRequireSelection"],function(a,b,c,d){var e=b('TypeaheadRequireSelection');if(!a.TypeaheadBehaviors)a.TypeaheadBehaviors={};a.TypeaheadBehaviors.requireSelection=function(f){f.enableBehavior(e);};},3);
__d("TypeaheadShowResultsOnFocus",["Event","copyProperties","Keys"],function(a,b,c,d,e,f){var g=b('Event'),h=b('copyProperties'),i=b('Keys');function j(k){this._typeahead=k;}h(j.prototype,{_subscription:null,_keyUpListener:null,_focusListener:null,enable:function(){var k=this._typeahead.getCore(),l=this._typeahead.getData();k.resetOnKeyup=false;var m=function(){if(!k.getValue()){var n=this.getUidsFromData(l);k.setValue('');var o=l.buildUids(' ',n);l.respond('',o);}}.bind(this);this._subscription=this._typeahead.subscribe('bootstrap',function(n,o){!o.bootstrapping&&m();});this._keyUpListener=g.listen(k.getElement(),'keyup',function(event){if(g.getKeyCode(event)==i.BACKSPACE)m();});this._focusListener=g.listen(k.getElement(),'focus',function(event){m();});},disable:function(){this._typeahead.unsubscribe(this._subscription);this._subscription=null;this._keyUpListener.remove();this._keyUpListener=null;this._focusListener.remove();this._focusListener=null;},getUidsFromData:function(k){return Object.keys(k.getAllEntries());}});e.exports=j;});
__d("legacy:ShowResultsOnFocusTypeaheadBehavior",["TypeaheadShowResultsOnFocus"],function(a,b,c,d){var e=b('TypeaheadShowResultsOnFocus');if(!a.TypeaheadBehaviors)a.TypeaheadBehaviors={};a.TypeaheadBehaviors.showResultsOnFocus=function(f){f.enableBehavior(e);};},3);
__d("TypeaheadSubmitOnChange",["copyProperties","Form"],function(a,b,c,d,e,f){var g=b('copyProperties'),h=b('Form');function i(j){this._typeahead=j;}g(i.prototype,{_subscription:null,enable:function(){var j=this._typeahead.getCore(),k=j.getValue(),l=j.getElement().form;function m(){if(k!=j.getValue()){k=j.getValue();if(l.getAttribute('rel')=='async'){h.bootstrap(l);}else l.submit();}}this._subscription=this._typeahead.subscribe(['blur','select'],m);},disable:function(){this._typeahead.unsubscribe(this._subscription);this._subscription=null;}});e.exports=i;});
__d("legacy:SubmitOnChangeTypeaheadBehavior",["TypeaheadSubmitOnChange"],function(a,b,c,d){var e=b('TypeaheadSubmitOnChange');if(!a.TypeaheadBehaviors)a.TypeaheadBehaviors={};a.TypeaheadBehaviors.submitOnChange=function(f){f.enableBehavior(e);};},3);