1twttr.geo={LOG_VERSION:2,LOCATION_CACHE_INTERVAL:30000,BROWSER_GEO_BANNER_APPEAR_DELAY:500,BROWSER_GEO_BANNER_DISAPPEAR_INTERVAL:100,PLACE_SEARCH_AUTOCOMPLETE_DELAY:250,MAX_NEARBY_PLACES:12,MAX_PLACE_SEARCH_RESULTS:50,MAX_PLACE_AUTOCOMPLETE_RESULTS:8,PLACE_SEARCH_RESULTS_PER_PAGE:5,PLACE_CREATION_ACCURACY_THRESHOLD:500,ACCEPTABLE_LOCATION_ACCURACY:1000,ACCEPTABLE_LOCATION_TIMEOUT:5000,LOCATION_TIMEOUT:25000,LOCATION_MAXIMUM_AGE:60000,MAX_SIMILAR_PLACES:5,GENERIC_PLACE_TYPES:{city:null,neighborhood:null,admin:null,country:null},TARGET_POI_NAME_LENGTH:40,TARGET_PLACE_NAME_LENGTH:50,templates:{dropdownItem:{container:'<li id="place_{{id}}"><span class="place_item_icon">&nbsp;</span><span class="place_noicon">{{formatted_name}}</span></li>',poi:'<li id="place_{{id}}"><span class="place_item_icon">&nbsp;</span><span class="place_icon">&nbsp;</span> {{formatted_name}} <span class="place_details">{{details}}</span></li>'},searchResultItem:{container:'<li id="result_place_{{id}}"><span class="place_noicon"><a href="#">{{formatted_name}}</a></span></li>',poi:'<li id="result_place_{{id}}"><span class="place_icon">&nbsp;</span> <a href="#">{{formatted_name}}</a> <span class="place_details">{{details}}</span></li>'},autocompleteItem:{container:'<li><span class="place_noicon">{{formatted_name}}</span></li>',poi:'<li><span class="place_icon">&nbsp;</span> {{formatted_name}} <span class="place_details">{{details}}</span></li>'},nearbyActivityHeader:{container:'<span><a href="#">{{formatted_name}}</a></span>',poi:'<span><a href="#">{{full_name}} <span class="place_icon">&nbsp;</span></a></span>'},nearbyActivityItem:{container:'<li id="result_place_{{id}}"><a href="#"><span class="place_noicon">{{formatted_name}}</span></a><div class="geo_address">{{details}}</div></li>',poi:'<li id="result_place_{{id}}"><a href="#">{{formatted_name}}&nbsp;<span class="place_icon">&nbsp;</span></a><div class="geo_address">{{details}}</div></li>'}},options:{more_places:false,autocomplete:false,autocomplete_zero_delay:false,place_creation:false,place_creation_needs_high_accuracy:false,allow_set_location_manually:false,show_place_details_in_map:false}};twttr.geo.getBestContainer=function(A){if(!A){return{name:"",full_name:"",contained_within:[],place_type:"city",bounding_box:{type:"Polygon",coordinates:[[[-122.51368188,37.70813196],[-122.35845384,37.70813196],[-122.35845384,37.83245301],[-122.51368188,37.83245301]]]}}}var B={name:A.part_of_name||"",full_name:A.part_of_name||"",contained_within:[],place_type:"city"};if(A.contained_within){A.contained_within.every(function(C){B=C;return C.place_type!="city"})}return B};twttr.geo.getBestCity=function(A){return(A&&A.place_type=="city")?A:twttr.geo.getBestContainer(A)};twttr.geo.getLocationFromPlace=function(A){if(!A||!A.bounding_box||A.bounding_box.type!="Polygon"||!A.bounding_box.coordinates){return null}var B=A.bounding_box.coordinates[0];if(!B||B.length!=4){return null}return{accuracy:500*twttr.geo.greatCircleDistanceInKm(B[0][1],B[0][0],B[2][1],B[2][0]),latitude:(B[0][1]+B[2][1])*0.5,longitude:(B[0][0]+B[2][0])*0.5}};twttr.geo.getPlacePageLinkFromPlace=function(A){return"/search?"+$.param({q:"place:"+A.id,format:"html"})};twttr.geo.getPlacePageLinkAttrsFromPlace=function(A){var C=[A.attributes?A.attributes.street_address:null,A.contained_within&&A.contained_within.length>0?A.contained_within[0].full_name:null].filter(function(D){return D}).join(", ");var B=A.place_type=="poi"?C:A.name+", "+C;return{title:A.full_name,_query:"place:"+A.id,_place_details:C,_place_map_link:"httpdisabled://maps.google.com/maps?"+$.param({q:B})}};twttr.geo.getPlaceDetails=function(A){if(A.attributes&&A.attributes.street_address){return A.attributes.street_address}switch(A.place_type){case"city":return _("a city");case"neighborhood":return _("a neighborhood");case"country":return _("a country");case"admin":return _("a state or province");default:return _("a place")}return twttr.geo.getBestContainer(A).name};twttr.geo.formatPlaceName=function(A,B){if(A.length<=B){return A}A=A.replace(/ [(].*[)]/g,"");if(A.length<=B){return A}var C="...";return A.substr(0,B-C.length)+C};twttr.geo.renderPlace=function(B,A){if(A.place_type in twttr.geo.GENERIC_PLACE_TYPES){B=B.container;A.formatted_name=twttr.geo.formatPlaceName(A.full_name,twttr.geo.TARGET_PLACE_NAME_LENGTH)}else{B=B.poi;A.formatted_name=twttr.geo.formatPlaceName(A.name,twttr.geo.TARGET_POI_NAME_LENGTH)}A.details=twttr.geo.getPlaceDetails(A);return $(Mustache.to_html(B,A))};twttr.geo.geoScribe=function(A,B){scribe($.extend({event_name:A,ui_version:1,log_version:twttr.geo.LOG_VERSION},B),"geo_checkins")};twttr.geo.Exceptions={GeoSupportException:function(){this.msg=_("This browser does not support GeoLocation")}};twttr.geo.Errors={PermissionDeniedError:function(){this.allowRetry=false;this.fatal=true;this.msg=_("Please grant your web browser permission to tell Twitter where you are.")},LocationDetectionError:function(){this.allowRetry=true;this.fatal=false;this.msg=_("We were unable to detect your location.")}};twttr.geo.greatCircleDistanceInKm=function(H,F,G,E){var C=Math.PI/180;var A=Math.sin((G-H)*C*0.5);var B=Math.sin((E-F)*C*0.5);var D=A*A+Math.cos(H*C)*Math.cos(G*C)*B*B;return 12742*Math.atan2(Math.sqrt(D),Math.sqrt(1-D))};twttr.klass("twttr.geo.Map",function(B){if(!twttr.geo.mapsUI.mapsAvailable()){return }var A={mapTypeId:google.maps.MapTypeId.ROADMAP,disableDefaultUI:true,scrollwheel:false,navigationControl:true,navigationControlOptions:{position:google.maps.ControlPosition.TOP_LEFT,style:google.maps.NavigationControlStyle.SMALL}};this.map=new google.maps.Map(B,A);this.bounds=null}).method("createMapOverlay",function(){function A(B){this.setMap(B)}A.prototype=new google.maps.OverlayView();A.prototype.onAdd=function(){};A.prototype.onRemove=function(){};A.prototype.draw=function(){};this.mapOverlay=new A(this.map)}).method("extendBounds",function(A){if(!this.bounds){this.bounds=new google.maps.LatLngBounds()}this.bounds.extend(A)}).method("addPoint",function(A,C){var E=this;var F=new google.maps.LatLng(A[1],A[0]);E.extendBounds(F);var D=new google.maps.MarkerImage("httpdisabled://s.twimg.com/a/1302214109/images/pin.png",new google.maps.Size(43,32),null,new google.maps.Point(14,33));E.marker=new google.maps.Marker({flat:true,icon:D,map:E.map,position:F,clickable:false,zIndex:2});if(C){var B=new google.maps.MarkerImage(C,new google.maps.Size(24,24),null,new google.maps.Point(13,32));E.avatar=new google.maps.Marker({flat:true,icon:B,map:E.map,position:F,zIndex:3})}}).method("addPoi",function(B,D){var F=this;var A=typeof (D)=="function";var G=new google.maps.LatLng(B[1],B[0]);F.extendBounds(G);var E=new google.maps.MarkerImage("httpdisabled://s.twimg.com/a/1302214109/images/poi-pin.png",new google.maps.Size(43,32),null,new google.maps.Point(14,33));var C=new google.maps.Marker({flat:true,icon:E,map:F.map,position:G,draggable:A,clickable:A,zIndex:2});if(A){google.maps.event.addListener(C,"dragend",function(H){D(H.latLng.lat(),H.latLng.lng())})}}).method("addFocusablePoint",function(A,F){var D=this;var G=new google.maps.LatLng(A[1],A[0]);D.extendBounds(G);var E=new google.maps.MarkerImage("httpdisabled://s.twimg.com/a/1302214109/images/place-minor10x.png",new google.maps.Size(10,10),new google.maps.Point(10,0),new google.maps.Point(5,5));var C=new google.maps.MarkerImage("httpdisabled://s.twimg.com/a/1302214109/images/place-minor10x.png",new google.maps.Size(10,10),null,new google.maps.Point(5,5));var B=new google.maps.Marker({flat:true,icon:C,map:D.map,position:G,clickable:F!==undefined,zIndex:2});if(F){if(D.mapOverlay===undefined){D.createMapOverlay()}google.maps.event.addListener(B,"mouseover",function(H){F(true,D.mapOverlay.getProjection().fromLatLngToContainerPixel(G))});google.maps.event.addListener(B,"mouseout",function(H){F(false,D.mapOverlay.getProjection().fromLatLngToContainerPixel(G))})}return function(H){if(H){B.setIcon(E);B.setZIndex(3)}else{B.setIcon(C);B.setZIndex(2)}}}).method("addAccuracyRing",function(B,A,F){var E=new google.maps.LatLng(B[1],B[0]);var D=new google.maps.Circle({map:F?this.map:null,center:E,radius:A,clickable:false,fillColor:"#0040FF",fillOpacity:0.08,strokeColor:"#2929D4",strokeOpacity:0.7,strokeWeight:0.5,zIndex:1});var C=D.getBounds();if(A>200){this.extendBounds(C.getNorthEast());this.extendBounds(C.getSouthWest())}}).method("addPlacePolygon",function(B){if(B[0][0] instanceof Array){B=B[0]}var D=[];for(var C=0;C<B.length;C++){var A=new google.maps.LatLng(B[C][1],B[C][0]);D.push(A);this.extendBounds(A)}var E=new google.maps.Polygon({path:D,strokeColor:"#FF0000",strokeOpacity:0.5,strokeWeight:0.5,fillColor:"#FF0000",fillOpacity:0.2});E.setMap(this.map)}).method("isEmpty",function(){return !this.bounds}).method("adjustBounds",function(B){var A=this.bounds.getSouthWest();var D=this.bounds.getNorthEast();if(D.equals(A)){this.map.setZoom(B||13);this.map.setCenter(D)}else{var F=this.bounds.getCenter();var C=0.7;function E(H,G){return H*C+G*(1-C)}this.map.fitBounds(new google.maps.LatLngBounds(new google.maps.LatLng(E(A.lat(),F.lat()),E(A.lng(),F.lng())),new google.maps.LatLng(E(D.lat(),F.lat()),E(D.lng(),F.lng()))))}}).method("resize",function(){google.maps.event.trigger(this.map,"resize")});twttr.geo.mapsUI={templates:{mapProgress:'<div id="geo_map_progress" class="hoverer"><div class="hovercard-divot"></div><div class="hoverer-inner"><div id="geo_map_spinner">&nbsp;</div></div></div>',mapWithPlace:'<div id="geo_modal" class="hoverer"><div class="hovercard-divot"></div><div class="hoverer-inner geo_map_with_place"><div id="map_canvas"></div><div class="geo_map_place_details"><div class="geo_map_place_name"></div><div class="geo_map_place_address"></div><div class="geo_map_place_container"></div><div class="geo_map_place_phone"></div><div class="geo_map_place_tweets"><a href="javascript:undefined">{{_i}}Tweets at this place &rarr;{{/i}}</a></div></div><a href="#" class="map_close">&times;</a></div></div>',mapWithoutPlace:'<div id="geo_modal" class="hoverer"><div class="hovercard-divot"></div><div class="hoverer-inner"><div id="map_canvas"></div><a href="#" class="map_close">&times;</a></div></div>'},googleApiAvailable:function(){return typeof google!="undefined"},loaddisabledMaps:function(C){if(this.googleApiAvailable()&&google.loaddisabled!==undefined){var B=window.location.hostname.match(/^(.+\.)?twitter\.com$/);var A=google.loaddisabled("maps","3",{callback:C,other_params:B?"client=free-twitter&sensor=false":"sensor=false"})}else{C()}},mapsAvailable:function(){return this.googleApiAvailable()&&google.maps!==undefined},initialize:function(){var A=this;if(A.googleApiAvailable()){A.liveClickHandler=function(C){C.preventDefault();var B=$(this).closest("span.entry-meta");voidMapModal(B.meta(),B.find("a.geocoded_google_link"))};$(".geo-pin, a.geocoded_google_link").live("click",A.liveClickHandler)}},closeMapModal:function(){$(".geo-pin.selected").removeClass("selected");$("#geo_modal").remove();$("#geo_map_progress").remove();this.geoMap=null}voidMapModal:function(G,B){var D=this;D.closeMapModal();var C=$(B);C.addClass("selected");C.after(Mustache.to_html(D.templates.mapProgress));D.showHover($("#geo_map_progress"),C,150);var F=G.place_id;var E=F&&twttr.geo.options.show_place_details_in_map?D.templates.mapWithPlace:D.templates.mapWithoutPlace;C.after(Mustache.to_html(E));$("html").one("click",function(H){D.closeMapModal()});$(".map_close").click(function(H){H.preventDefault();D.closeMapModal()});var A=$("#map_canvas").get(0);twttr.geo.mapsUI.loaddisabledMaps(function(){D.geoMap=new twttr.geo.Map(A);var H=D.geoMap;var I=false;var J=function(){if(!I&&G.latlng){D.geoMap.addPoint(G.latlng.slice().reverse(),G.avatar_url)}if(D.geoMap.isEmpty()){D.closeMapModal();return }D.geoMap.adjustBounds();$("#geo_map_progress").remove();D.showHover($("#geo_modal"),C,0)};if(F){twttr.api.getPlaceDetails({place_id:G.place_id,success:function(L,N){if(H!=D.geoMap){return }var M=L.geometry.coordinates;if(L.geometry.type=="Polygon"){D.geoMap.addPlacePolygon(M)}else{if(L.geometry.type=="MultiPolygon"){M.forEach(function(O){D.geoMap.addPlacePolygon(O)})}else{if(L.geometry.type=="Point"){D.geoMap.addPoint(M,G.avatar_url);I=true}}}$(".geo_map_place_name").text(L.name);$(".geo_map_place_address").text((L.attributes&&L.attributes.street_address)||"");var K=twttr.geo.getBestContainer(L);$(".geo_map_place_container").text(K.full_name||"");$(".geo_map_place_phone").text((L.attributes&&L.attributes.phone)||"");$(".geo_map_place_tweets a").attr("href",twttr.geo.getPlacePageLinkFromPlace(L));if(window.location.pathname=="/"){$(".geo_map_place_tweets a").attr(twttr.geo.getPlacePageLinkAttrsFromPlace(L)).isSearchLink().click(function(){D.closeMapModal()})}J()}})}else{J()}})},showHover:function(A,B,C){A.visible(false);twttr.SimplePositioner.setPosition(A,B,{itemHeight:180,offsets:{above:{top:-10,left:-40},below:{top:10,left:-40}},direction:"prefer below",hasContainer:true});A.click(function(D){D.stopPropagation()});setTimeout(function(){A.visible(true)},C)}};$(function(){twttr.geo.mapsUI.initialize()});twttr.klass("twttr.geo.PlacesDropdown",function(B,D){var C=this;C.placer=B;C.opts=D;var A="<a id='place_link' href='#'><span id='place_name'></span> ▾</a><ul class='round places_list'/>";$("#place_content").html(A).bind("tweet",function(){var E=C.placer.getState();C.placer.determinePlaces(function(){C.rebuildPlacesDropdown()},function(){$(".geo_disable_webclient:first").click()});if($("#place_id").val()!=""){twttr.geo.geoScribe("geotweet",E)}});C.$placesList=$("#place_content ul.places_list");C.rebuildPlacesDropdown();$("#place_link").click(function(E){E.preventDefault();if($("#place_content ul.places_list:visible").length>0){C.closeMenu()}else{voidMenu();E.stopPropagation()}})}).method("rebuildPlacesDropdown",function(){var A=this;A.$placesList.empty();A.appendPoiPlaces(A.placer.places);A.appendNonPoiPlaces(A.placer.places);A.appendMorePlaces();$(".geo_more_places").click(function(B){B.preventDefault();new twttr.geo.PlaceSearchDialog(A.placer,A.opts,function(){A.rebuildPlacesDropdown();A.showSelectedPlace()});twttr.geo.geoScribe("click_search_places")});A.showSelectedPlace()}).method("appendPoiPlaces",function(A){var B=false;A.forEach(function(C){if(C.place_type=="poi"){this.$placesList.append(this.createPlaceItem(C));B=true}},this);return B}).method("appendNonPoiPlaces",function(A){A.forEach(function(B){if(B.place_type!="poi"){this.$placesList.append(this.createPlaceItem(B))}},this)}).method("createPlaceItem",function(A){var C=this;var B=twttr.geo.renderPlace(twttr.geo.templates.dropdownItem,A);B.click(function(D){D.preventDefault();C.placer.selectPlace(A);C.rebuildPlacesDropdown();C.closeMenu();twttr.geo.geoScribe("click_place_item",C.placer.getState())});return B}).method("appendMorePlaces",function(){if(this.opts.more_places){this.$placesList.append('<li class="geo_more_places"><span class="place_item_icon more_places">&nbsp;</span>'+_("Search places...")+"</li>")}}).method("showSelectedPlace",function(){var A=this.placer.selectedPlace;var B;if(A.place_type!="poi"){B=_("in {{full_name}}")}else{B='<span class="place_icon">&nbsp;</span>'+_("at {{full_name}}")}$("#place_id").val(A.id);$("#place_name").html(Mustache.to_html(B,A));this.$placesList.children("li.selected").removeClass("selected");$("#place_"+A.id).addClass("selected")}).method(voidMenu",function(){var B=this;var A=$("#place_link");var C=$("#place_link").position();B.$placesList.css({left:C.left,top:C.top+A.outerHeight()}).show();$("html").one("click",function(){B.closeMenu()});twttr.geo.geoScribe(void_places_dropdown",B.placer.getState())}).method("closeMenu",function(){this.$placesList.hide()});twttr.klass("twttr.geo.PlaceSearchDialog",function(E,B,H){var F=this;F.opts=B;F.onPlaceAccepted=H;F.place=E.selectedPlace;F.placer=E;F.city=twttr.geo.getBestCity(F.place);F.originalCity=F.city;F.placeHeading="{{_i}}Where are you?{{/i}}";F.placeString=(F.place&&F.place.place_type!="city")?F.place.name:"";F.originalPlaceString=F.placeString;F.placeHtml='<form id="place_search_form"><table class="geo_place_search_table"><tr><td class="geo_place_search_col1 geo_place_search_city">{{_i}}City{{/i}}</td><td class="geo_place_search_city">{{city}}&#32;&nbsp;<a href="#" id="change_city">{{_i}}Change{{/i}}</a></td></tr><tr><td class="geo_place_search_col1 geo_place_search_place">{{_i}}Place Name{{/i}}</td><td class="geo_place_search_place"><input id="place_search_query" type="text" autocomplete="off" class="round-left help-focusable" title="{{_i}}Type the name of a place{{/i}}"/><span class="place_search_submit round-right" title="{{_i}}Search{{/i}}">&nbsp;</span><ul class="round places_list place_search_dropdown"></ul></td></tr><tr><td></td><td class="geo_place_search_hint">{{_i}}Optional{{/i}}</td></tr><tr><td></td><td><div id="place_search_results"></div><button type="button" class="btn" id="place_search_done">{{_i}}Done{{/i}}</button><button type="button" class="btn hidden" id="place_search_cancel">{{_i}}Cancel{{/i}}</button></td></tr></table></form>';F.cityHeading="{{_i}}Change City{{/i}}</a>";F.cityHtml='<form id="place_search_form"><table class="geo_place_search_table"><tr><td class="geo_place_search_col1 geo_place_search_place">{{_i}}City{{/i}}</td><td class="geo_place_search_place"><input id="place_search_query" type="text" autocomplete="off" class="round-left help-focusable" title="{{_i}}Enter a city, state{{/i}}"/><span class="place_search_submit round-right" title="{{_i}}Search{{/i}}">&nbsp;</span><ul class="round places_list place_search_dropdown"></ul></td></tr><tr><td></td><td><div id="place_search_results"></div></td></tr></table></form>';F.noCityHeading="{{_i}}Where are you?{{/i}}</a>";$(".place_search_dialog").remove();F.dialog=new twttr.dialog({content:$("<div/>").appendTo("body"),heading:$('<div><span id="geo_search_places_title"></span></div>'),footer:null,cssClass:"place_search_dialog",closeButton:true,renderInline:true,modal:true,fixed:false});var D=E.opts.geoParams;F.searchParams={max_results:twttr.geo.MAX_PLACE_SEARCH_RESULTS,granularity:D.granularity};if(E.detectedPlace&&F.city.id==twttr.geo.getBestCity(E.detectedPlace).id&&D.lat!==undefined&&D.lon!==undefined&&D.accuracy!==undefined){twttr.merge(F.searchParams,{lat:D.lat,lon:D.lon,accuracy:D.accuracy})}else{F.setSearchParamsFromCity()}F.setCityMode(false);var G=$("#place_search_results");G.append("<ul/>");for(var C=0,A=G.find("ul");C<twttr.geo.MAX_PLACE_SEARCH_RESULTS;C++){A.append("<li>&nbsp;</li>")}F.void();G.empty();$("#place_search_query").focus().select()}).method("setHeadingAndContent",function(A,B){$("#geo_search_places_title").html(Mustache.to_html(A));$(".place_search_dialog .modal-content").html(Mustache.to_html(B,{city:this.city.full_name}))}).method("scribeSearch",function(B,C,A){var D=this;twttr.geo.geoScribe(B,$.extend({query:$("#place_search_query").helpVal(),mode:C?"city":"place",container_id:D.city.id,place_creation_allowed:D.shouldAllowPlaceCreation(C)},D.searchParams,A))}).method("setCityMode",function(B){var C=this;if(C.city.full_name==""){C.setHeadingAndContent(C.noCityHeading,C.cityHtml);B=true}else{if(B){C.setHeadingAndContent(C.cityHeading,C.cityHtml)}else{C.setHeadingAndContent(C.placeHeading,C.placeHtml)}}var A=$("#place_search_query");if(B){A.val(C.city.full_name)}else{A.val(C.placeString)}A.helpText().selectOnClick();if(twttr.geo.options.autocomplete){C.placeAutocomplete=new twttr.autocomplete({$input:A,$dropdown:$(".place_search_dropdown"),getInputVal:function(){return A.helpVal()},fetchMatches:function(E,G,F){twttr.api.search({data:twttr.merge({},C.searchParams,{query:E,autocomplete:"true",max_results:twttr.geo.MAX_PLACE_AUTOCOMPLETE_RESULTS,granularity:B?"city":C.searchParams.granularity}),success:function(H,I){G(H.result.places)},error:function(){F()}})},renderMatch:function(F,E,G){return twttr.geo.renderPlace(twttr.geo.templates.autocompleteItem,F).click(function(I){var H=[];G.forEach(function(J){H.push(J.id)});C.placeAccepted(F,B);C.scribeSearch("place_search_dialog_select_autocomplete",B,{selected_id:F.id,selected_index:E,place_ids:H})})},delay:twttr.geo.options.autocomplete_zero_delay?0:twttr.geo.PLACE_SEARCH_AUTOCOMPLETE_DELAY})}var D=$("#place_search_form");D.submit(function(E){E.preventDefault();var F=A.helpVal();if(C.placeAutocomplete){C.placeAutocomplete.hide()}if(!F){C.placeAccepted(C.city,B);return }if(B&&F==C.city.full_name){C.setCityMode(false);return }C.setWaitCursor(true);$("#place_search_done").hide();$("#place_search_cancel").show();$("#place_search_results").html(Mustache.to_html('<div class="geo_search_message">{{_i}}Searching for "{{query}}"...{{/i}}</div>',{query:F})).show();twttr.api.search({data:twttr.merge({},C.searchParams,{query:F,granularity:B?"city":C.searchParams.granularity}),success:function(G){C.setWaitCursor(false);C.searchResultPlaces=G.result.places;twttr.geo.mapsUI.loaddisabledMaps(function(){C.displayResults(0,B)})},error:function(G,I,H){C.setWaitCursor(false);C.displaySearchError(G,B)}})});$(".place_search_submit").click(function(){C.searchTrigger="click_icon";D.submit()});A.keydown(function(E){if(E.keyCode==13){C.searchTrigger="enter_key";E.preventDefault();D.submit()}});$("#place_search_done").click(function(){C.searchTrigger="click_done";var E=A.helpVal();if(C.place&&C.place.name==E&&C.city==C.originalCity){C.placeAccepted(C.place,B);C.scribeSearch("place_search_dialog_done_no_changes",B)}else{D.submit()}});$("#place_search_cancel").click(function(){C.dialog.close();C.scribeSearch("place_search_dialog_close",B,{triggered_by:"click_cancel"})});$("#change_city").click(function(E){E.preventDefault();C.placeString=A.helpVal();C.setCityMode(true);C.scribeSearch("place_search_dialog_change_city")});A.focus().select()}).method("setWaitCursor",function(A){$(".place_search_submit").toggleClass("loaddisableding",A)}).method("shouldAllowPlaceCreation",function(A){return !A&&this.opts.place_creation&&twttr.geo.mapsUI.mapsAvailable()&&(!this.opts.place_creation_needs_high_accuracy||this.searchParams.accuracy!==undefined&&this.searchParams.accuracy<=twttr.geo.PLACE_CREATION_ACCURACY_THRESHOLD)&&this.city.country_code=="US"}).method("displayResults",function(I,G){var E=this;var B=I*twttr.geo.PLACE_SEARCH_RESULTS_PER_PAGE;var F=B+twttr.geo.PLACE_SEARCH_RESULTS_PER_PAGE;var A=E.searchResultPlaces.slice(B,F);var J=$("#place_search_results").empty();var H=$("#place_search_query").helpVal();if(A.length==0){J.html(Mustache.to_html('<div class="geo_search_message">{{_i}}We couldn\'t find "{{query}}."{{/i}}</div>',{query:H}))}var C=[];var D=$("<ul/>").appendTo(J);A.forEach(function(K,L){C.push(K.id);var M=twttr.geo.renderPlace(twttr.geo.templates.searchResultItem,K);M.find("a").click(function(N){N.preventDefault();E.scribeSearch("place_search_dialog_select_result",G,{place_ids:C,selected_id:K.id,selected_index:L});E.placeAccepted(K,G)}).attr("title",twttr.geo.getPlaceDetails(K));D.append(M)});if(E.searchResultPlaces.length>twttr.geo.PLACE_SEARCH_RESULTS_PER_PAGE){J.append(Mustache.to_html('<div class="geo_next_prev"><a href="#" id="geo_prev_result">&laquo;&nbsp;{{_i}}Prev{{/i}}</a><a href="#" id="geo_next_result">{{_i}}Next{{/i}}&nbsp;&raquo;</a></div>'));E.setNextPrev($("#geo_prev_result"),I>0,I-1,G);E.setNextPrev($("#geo_next_result"),F<E.searchResultPlaces.length,I+1,G)}if(E.shouldAllowPlaceCreation(G)){J.append(Mustache.to_html("<div class='geo_add_place'>{{#found}}{{_i}}Not what you're looking for?{{/i}}&#32;{{/found}}<a href='#'>{{_i}}Add this place!{{/i}}</a></div>",{found:A.length>0}));$(".geo_add_place a").click(function(K){K.preventDefault();E.dialog.close();new twttr.geo.PlaceCreationDialog(E.city,H,E.searchParams,function(L){E.placeAccepted(L,false)},E.opts.queryParams.accuracyring!==undefined);E.scribeSearch("place_search_dialog_add",G,{place_ids:C})})}E.scribeSearch("place_search_dialog_show_results",G,{place_ids:C,triggered_by:E.searchTrigger})}).method("setNextPrev",function(A,D,C,B){var E=this;A.click(function(F){F.preventDefault();if(D){E.displayResults(C,B)}});if(!D){A.addClass("link-disabled")}}).method("placeAccepted",function(A,B){var C=this;if(B){if(!A.id){C.dialog.close()}else{if(C.city.id!=A.id){C.city=A;if(C.placeString!=C.originalPlaceString){C.placeString=""}C.setSearchParamsFromCity()}}C.setCityMode(false)}else{C.dialog.close();if(C.originalCity!=C.city){C.placer.selectPlace(C.city)}C.placer.selectPlace(A);C.onPlaceAccepted()}}).method("setSearchParamsFromCity",function(){var A=this;if(A.city&&A.city.id){delete A.searchParams.lat;delete A.searchParams.lon;delete A.searchParams.accuracy;A.searchParams.contained_within=A.city.id}}).method("displaySearchError",function(B,A){$("#place_search_results").text(_("Sorry, search is temporarily unavailable, please try again later."));this.scribeSearch("place_search_dialog_error",A)});twttr.klass("twttr.geo.PlaceCreationDialog",function(C,F,D,E,B){var G=this;G.container=C;if(D.contained_within!==undefined){var A=twttr.geo.getLocationFromPlace(C);if(A){G.lat=A.latitude;G.lon=A.longitude;G.accuracy=A.accuracy}}else{G.lat=D.lat;G.lon=D.lon;G.accuracy=D.accuracy}G.originalGeoParams=D;G.placeName=F;G.onPlaceCreated=E;G.showAccuracyRing=B;G.draggedPin=false;G.streetAddress="";G.createHtml='<div class="geo_map"><div class="geo_map_canvas"></div><div class="geo_map_hint"><span></span><div class="round">{{_i}}Click and move the pin to edit this location.{{/i}}</div></div></div><div class="geo_place_create"><table cellspacing="0" cellpadding="0"><tr><td class="geo_place_creation_row1 geo_place_search_col1">{{_i}}Name{{/i}}</td><td class="geo_place_creation_row1"><input id="geo_place_name" class="geo_form_input round help-focusable" type="text"title="{{_i}}Type the name of a place{{/i}}"/></td></tr><tr><td class="geo_place_search_col1 geo_place_creation_row2">{{_i}}Address{{/i}}</td><td class="geo_place_creation_row2"><input id="geo_place_address" class="geo_form_input round help-focusable" type="text"title="{{_i}}Optional{{/i}}"/></td></tr><tr><td></td><td><div class="geo_place_creation_hint">{{_i}}"795 Folsom St" or "19th and Urban"{{/i}}</div><div class="geo_place_city">{{_i}}In {{city_name}}{{/i}}</div><div><button type="button" class="btn" id="geo_create_place">{{_i}}Add this Place{{/i}}</button><span id="geo_creating_place">&nbsp;</span></div><div class="error" id="geo_creation_error"></div></td></tr></table></div>';G.similarHtml='<div class="geo_map"><div class="geo_map_canvas" /><div class="geo_map_place_bubble"><span/><div class="round"><div class="geo_place_title" /><div class="geo_place_details" /></div></div></div><div class="geo_place_create"><div>{{_i}}This place may already exist. Did you mean:{{/i}}</div><ul/><div><button type="button" class="btn" id="geo_create_place">{{_i}}No, Just Add this Place{{/i}}</button><a href="#" class="geo_go_back">{{_i}}Go Back{{/i}}</a><span id="geo_creating_place">&nbsp;</span></div><div class="error" id="geo_creation_error"></div></div>';$(".place_creation_dialog").remove();G.dialog=new twttr.dialog({content:$("<div/>").appendTo("body"),heading:$(Mustache.to_html("<div>{{_i}}Add this place.{{/i}}</div>")),footer:null,cssClass:"place_creation_dialog",closeButton:true,renderInline:true,modal:true,fixed:false});G.showCreatePlace()}).method("showCreatePlace",function(){var B=this;$(".place_creation_dialog .modal-content").html(Mustache.to_html(B.createHtml,{city_name:B.container.full_name}));B.inProgress=false;$("#geo_place_name").val(B.placeName).helpText().change(function(C){B.updateState()}).keydown(function(C){setTimeout(function(){B.updateState()},0)});$("#geo_create_place").click(function(){B.placeName=$("#geo_place_name").helpVal();B.streetAddress=$("#geo_place_address").helpVal();B.callSimilarPlaces()});B.void();B.updateMapHeight();B.geoMap=new twttr.geo.Map($(".geo_map_canvas").get(0));B.geoMap.addPoi([B.lon,B.lat],function(C,D){B.lat=C;B.lon=D;B.draggedPin=true});B.geoMap.addAccuracyRing([B.lon,B.lat],B.accuracy,B.showAccuracyRing);B.geoMap.adjustBounds(15);B.updateState();$("#geo_place_address").val(B.streetAddress).helpText().focus();var A=true;setTimeout(function(){if(A){$(".geo_map_hint").fadeTo(700,0.8)}},700);$(".geo_map").mousedown(function(C){A=false;$(".geo_map_hint").fadeOut(200)})}).method("showSimilarPlaces",function(){var B=this;$(".place_creation_dialog .modal-content").html(Mustache.to_html(B.similarHtml));B.inProgress=false;$("#geo_create_place").click(function(){B.callCreatePlace()});$("a.geo_go_back").click(function(D){D.preventDefault();B.showCreatePlace()});var C=$(".geo_place_create ul");B.similarPlaces.forEach(function(D){$placeItem=twttr.geo.renderPlace(twttr.geo.templates.searchResultItem,D);$placeItem.find("a").click(function(E){E.preventDefault();B.dialog.close();B.onPlaceCreated(D)}).attr("title",twttr.geo.getPlaceDetails(D));C.append($placeItem)});B.updateMapHeight();B.geoMap=new twttr.geo.Map($(".geo_map_canvas").get(0));B.geoMap.addPoi([B.lon,B.lat]);$geoMapPlaceBubble=$(".geo_map_place_bubble");var A=$(".geo_map_canvas").position();B.similarPlaces.slice().reverse().forEach(function(E){var D=E.bounding_box.coordinates[0][0];var F=B.geoMap.addFocusablePoint(D,function(H,G){if(H){$geoMapPlaceBubble.find(".geo_place_title").text(E.name);$geoMapPlaceBubble.find(".geo_place_details").text(twttr.geo.getPlaceDetails((E)));$geoMapPlaceBubble.show().css({left:A.left+G.x-$geoMapPlaceBubble.width()/2,top:A.top+G.y,opacity:0.8})}else{$geoMapPlaceBubble.hide()}});$("#result_place_"+E.id).hover(function(){F(true)},function(){F(false)})});B.geoMap.adjustBounds(15);B.updateState()}).method("getPlaceCreationParams",function(){var B=this;var A={lat:B.lat,lon:B.lon,name:B.placeName,contained_within:B.container.id,accuracy:B.draggedPin?0:B.originalGeoParams.accuracy};if(B.token){A.token=B.token}if(B.streetAddress){A["attribute:street_address"]=B.streetAddress}return A}).method("callSimilarPlaces",function(){var A=this;if(!A.inProgress){A.inProgress=true;A.updateState();twttr.api.similarPlaces({data:A.getPlaceCreationParams(),success:function(B){A.token=B.result.token;A.inProgress=false;A.similarPlaces=B.result.places.slice(0,twttr.geo.MAX_SIMILAR_PLACES);if(A.similarPlaces.length>0&&twttr.geo.options&&twttr.geo.options.show_similar_places){A.showSimilarPlaces()}else{A.callCreatePlace()}},error:function(){A.onCreationError();A.scribeCreatePlace("similar_places_error")}})}}).method("callCreatePlace",function(){var A=this;if(!A.inProgress){A.inProgress=true;A.updateState();twttr.api.createPlace({data:A.getPlaceCreationParams(),success:function(B){A.inProgress=false;A.updateState();A.dialog.close();A.onPlaceCreated(B);A.scribeCreatePlace("success")},error:function(){A.onCreationError();A.scribeCreatePlace("create_place_error")}})}}).method("scribeCreatePlace",function(A){var B=this;twttr.geo.geoScribe("create_place",$.extend({status:A,original_lat:B.originalGeoParams.lat,original_lon:B.originalGeoParams.lon,original_accuracy:B.originalGeoParams.accuracy,dragged_pin:B.draggedPin},B.getPlaceCreationParams()))}).method("onCreationError",function(){this.inProgress=false;$("#geo_creation_error").text(_("We couldn't add this place.  Please try again."));this.updateState();this.updateMapHeight();this.geoMap.resize()}).method("updateState",function(){$("#geo_creating_place").toggleClass("geo_spinner",this.inProgress)}).method("updateMapHeight",function(){var D=$(".geo_map_canvas");var A=Math.max(210,$(".geo_place_create").outerHeight());D.height(A);var B=$(".geo_map_hint");var C=D.position();B.css({left:C.left+(D.width()-B.width())/2-1,top:C.top+A/2})});twttr.klass("twttr.geo.Locator",function(B){var A=this;A.position=null;A.locator=null;A.locatorType="none";if(B&&B.lat!==undefined&&B.lon!==undefined){A.locatorType="manual";A.locator={watchPosition:function(C){C({coords:{latitude:B.lat,longitude:B.lon,accuracy:parseInt(B.accuracy)||200}});return 0},clearWatch:function(){}}}else{if(navigator&&navigator.geolocation){A.locatorType="html5";A.locator=navigator.geolocation;if(navigator.userAgent.indexOf("Firefox")!=-1){A.browserGeoPermissionsHelpBannerTemplate=A.templates.firefoxGeoPermissionsHelpBanner}else{if(navigator.userAgent.indexOf("Chrome")!=-1){A.browserGeoPermissionsHelpBannerTemplate=A.templates.chromeGeoPermissionsHelpBanner}else{if(navigator.userAgent.indexOf("MSIE")!=-1&&navigator.userAgent.indexOf("GTB")!=-1){A.browserGeoPermissionsHelpBannerTemplate=A.templates.ieGoogleToolbarGeoPermissionsHelpBanner}}}}else{if(typeof google!="undefined"&&typeof google.gears!="undefined"){A.locatorType="gears";A.locator=google.gears.factory.create("beta.geolocation")}}}}).augmentProto({templates:{firefoxGeoPermissionsHelpBanner:'<div id="geo_browser_help_banner" class="geo_firefox"><div>{{_i}}Before Twitter can get your location...{{/i}}</div><div><img src="httpdisabled://s.twimg.com/a/1302214109/images/geo_browser_help_banner_1.png" />{{_i}}Check "Remember for this site"{{/i}}</div><div><img src="httpdisabled://s.twimg.com/a/1302214109/images/geo_browser_help_banner_2.png" />{{_i}}Click "Share Location"{{/i}}</div></div>',chromeGeoPermissionsHelpBanner:'<div id="geo_browser_help_banner" class="geo_chrome"><div>{{_i}}Click "Allow" to let Twitter get your location.{{/i}}</div></div>',ieGoogleToolbarGeoPermissionsHelpBanner:'<div id="geo_browser_help_banner" class="geo_ie_gtb"><div>{{_i}}Before Twitter can get your location...{{/i}}</div><div><img src="httpdisabled://s.twimg.com/a/1302214109/images/geo_browser_help_banner_1.png" />{{_i}}Check "Remember for this site"{{/i}}</div><div><img src="httpdisabled://s.twimg.com/a/1302214109/images/geo_browser_help_banner_2.png" />{{_i}}Click "Share my location"{{/i}}</div></div>'}}).method("isLocatable",function(){return !!(this.locator)}).method("getLocation",function(A){var C=this;if(!C.isLocatable()){throw new twttr.geo.Exceptions.GeoSupportException()}var B=$.extend({onSuccess:function(D){},onFailure:function(D){},options:{timeout:twttr.geo.LOCATION_TIMEOUT,enableHighAcuracy:true,maximumAge:twttr.geo.LOCATION_MAXIMUM_AGE}},A);if(!C.getBrowserGeoPermissionsHelpBannerSeen()){C.detectBrowserGeoPermissionsBanner()}C.position=null;C.waitForAcceptableId=setTimeout(function(){C.waitForAcceptableId=null;if(C.watchId!=null){C.watchPositionAcceptable(B.onSuccess)}},twttr.geo.ACCEPTABLE_LOCATION_TIMEOUT);C.watchId=null;C.watchId=C.locator.watchPosition(function(D){setTimeout(function(){if(C.watchId!=null){C.watchPositionSuccess(D,B.onSuccess)}},0)},function(D){setTimeout(function(){if(C.watchId!=null){C.watchPositionError(D,B.onFailure)}},0)},B.options)}).method("watchPositionSuccess",function(A,C){var B=this;B.setBrowserGeoPermissionsHelpBannerSeen();B.position={latitude:A.coords.latitude,longitude:A.coords.longitude,accuracy:A.coords.accuracy};if(B.waitForAcceptableId==null||(B.position.accuracy!=undefined&&B.position.accuracy<twttr.geo.ACCEPTABLE_LOCATION_ACCURACY)){B.watchPositionAcceptable(C)}}).method("watchPositionError",function(B,C){var D=this;D.setBrowserGeoPermissionsHelpBannerSeen();var A;if(B.code==B.PERMISSION_DENIED){A=new twttr.geo.Errors.PermissionDeniedError()}else{A=new twttr.geo.Errors.LocationDetectionError()}if(A.fatal){var E=new ShortNotification();E.setMessage(A.msg);E.show()}D.watchPositionCleanup();C(A)}).method("watchPositionAcceptable",function(B){var A=this;if(A.position){A.watchPositionCleanup();B(A.position)}}).method("watchPositionCleanup",function(){var A=this;clearTimeout(A.waitForAcceptableId);A.locator.clearWatch(A.watchId);A.watchId=null}).method("getWindowHeight",function(){return $(window).height()}).method("getBrowserGeoPermissionsHelpBannerSeen",function(){return $.cookie("geo_browser_help_banner")}).method("setBrowserGeoPermissionsHelpBannerSeen",function(){var A=this;if(A.showBrowserGeoPermissionsHelpBanner){A.clearDetectBrowserGeoPermissionsBanner();if(!A.getBrowserGeoPermissionsHelpBannerSeen()){$.cookie("geo_browser_help_banner","1",{expires:3650})}}}).method("showBrowserGeoPermissionsHelpBanner",function(){$("body").append(Mustache.to_html(this.browserGeoPermissionsHelpBannerTemplate))}).method("detectBrowserGeoPermissionsBanner",function(){var B=this;if(B.browserGeoPermissionsHelpBannerTemplate){var A=B.getWindowHeight();this.browserGeoPermissionsHelpTimer=setTimeout(function(){if(B.getWindowHeight()<A){B.showBrowserGeoPermissionsHelpBanner();B.browserGeoPermissionsHelpInterval=setInterval(function(){if(B.getWindowHeight()==A){B.clearDetectBrowserGeoPermissionsBanner()}},twttr.geo.BROWSER_GEO_BANNER_DISAPPEAR_INTERVAL)}},twttr.geo.BROWSER_GEO_BANNER_APPEAR_DELAY)}}).method("clearDetectBrowserGeoPermissionsBanner",function(){clearTimeout(this.browserGeoPermissionsHelpTimer);clearInterval(this.browserGeoPermissionsHelpInterval);$("#geo_browser_help_banner").remove()});twttr.klass("twttr.geo.Placer",function(A){var C=this;C.opts=A;C.places=[];C.detectedParams={};var B=C.opts.geoParams;if(B.lat!==undefined&&B.lon!==undefined){C.detectedParams.lat=parseFloat(B.lat).toFixed(4);C.detectedParams.lon=parseFloat(B.lon).toFixed(4)}if(B.ip!==undefined){C.detectedParams.ip=B.ip}}).augmentProto({PLACE_OVERRIDES_COOKIE:"place_overrides",RECENT_PLACE_COOKIE:"recent_place",MAX_PLACE_OVERRIDES:8,STICKY_RADIUS_IN_KM:0.1}).method("search",function(E,C,B){var A=this;try{twttr.api.search({data:A.opts.geoParams,success:function(F){A.places=F.result.places;A.determinePlaces(E,C)},error:function(F){if(F.status==503){B()}else{C()}}})}catch(D){C()}}).method("determinePlaces",function(C,B){var A=this;if(A.places.every(function(D){if(D.place_type!="poi"){A.detectedPlace=D;return false}return true})){B();return }if(A.getOverrides().every(function(D){if(A.isOverrideCloseToDetected(D)){A.selectPlaceById(D.id,C,B);return false}return true})){A.selectPlace(A.detectedPlace);C()}}).method("selectPlaceById",function(E,D,B){var A=this;if(A.places.every(function(F){if(F.id==E){A.selectPlace(F);D();return false}return true})){try{twttr.api.getPlaceDetails({place_id:E,success:function(F){A.selectPlace(F);D()},error:function(){B()}})}catch(C){B()}}}).method("setOverrides",function(A){if(A!=this.getOverrides()){if(A.length>0){$.cookie(this.PLACE_OVERRIDES_COOKIE,A.map(function(B){return $.param(B)}).join(","),{expires:3650})}else{$.cookie(this.PLACE_OVERRIDES_COOKIE,null)}}}).method("getOverrides",function(){return($.cookie(this.PLACE_OVERRIDES_COOKIE)||"").split(",").filter(function(A){return A!=""}).map(function(A){return twttr.unparam(A)})}).method("selectPlace",function(A){var B=this;if(B.places.every(function(C){if(A.id==C.id){B.selectedPlace=C;return false}return true})){B.places.unshift(A);B.selectedPlace=A}if(B.selectedPlace.place_type!="poi"){B.setOverride();B.setRecentPlaceId(B.selectedPlace.id)}}).method("setOverride",function(){var A=this;var B=A.getOverrides().filter(function(C){return !A.isOverrideCloseToDetected(C)});if(A.detectedPlace&&A.selectedPlace.id!=A.detectedPlace.id){B.unshift(twttr.merge({id:A.selectedPlace.id},A.detectedParams))}A.setOverrides(B.slice(0,A.MAX_PLACE_OVERRIDES))}).method("getRecentPlaceId",function(){return $.cookie(this.RECENT_PLACE_COOKIE)}).method("setRecentPlaceId",function(A){$.cookie(this.RECENT_PLACE_COOKIE,A,{expires:3650})}).method("isOverrideCloseToDetected",function(A){var B=this.detectedParams;if(!B){return false}if(A.lat!==undefined&&A.lon!==undefined&&B.lat!==undefined&&B.lon!==undefined&&twttr.geo.greatCircleDistanceInKm(A.lat,A.lon,B.lat,B.lon)<this.STICKY_RADIUS_IN_KM){return true}return B.ip&&B.ip==A.ip}).method("getState",function(){var A=this;var B={geo_params:A.opts.geoParams,place_ids:[]};var C=[];A.places.forEach(function(D,E){B.place_ids.push(D.id);if(A.selectedPlace&&A.selectedPlace.id==D.id){B.selected_place_index=E}});if(A.selectedPlace){B.selected_place_id=A.selectedPlace.id}if(A.detectedPlace){B.detected_place_id=A.detectedPlace.id}return B});twttr.klass("twttr.geo.NearbyPlacer",function(A){var B=this;B.opts=A;B.places=[]}).method("search",function(D,B){var A=this;try{twttr.api.search({data:twttr.merge({require_activity:true},A.opts.geoParams),success:function(E){A.places=E.result.places;A.determinePlaces(D,B)},error:function(E){B()}})}catch(C){B()}}).method("determinePlaces",function(C,B){var A=this;if(!A.detectedPlace){A.places.every(function(D){if(D.place_type!="poi"){A.detectedPlace=D;return false}return true})}if(!A.selectedPlace){A.selectPlace(A.detectedPlace)}if(A.selectedPlace){A.places.every(function(D,E){if(D.id==A.selectedPlace.id){A.places.splice(E,1);return false}return true});A.fudgePlaceRanking(A.places);C()}else{B()}}).method("fudgePlaceRanking",function(C){var A=C.length;var B=0;for(var D=0;D<A;D++){if(C[D].place_type!="poi"){C.splice(B,0,C.splice(D,1)[0]);B+=1;if(B==2){break}}}}).method("selectPlace",function(B){var C=this;C.selectedPlace=B;if(B!=C.detectedPlace){var A=twttr.geo.getLocationFromPlace(B);C.opts.geoParams.lat=A.latitude;C.opts.geoParams.lon=A.longitude;C.opts.geoParams.accuracy=A.accuracy;delete C.opts.geoParams.contained_by;delete C.opts.geoParams.ip}});twttr.klass("twttr.geo.NearbyActivity",function(A){var B=this;B.$nearbyActivity=$("#side_geo_nearby_activity .sidebar-menu");B.placer=new twttr.geo.NearbyPlacer({geoParams:{granularity:"poi",max_results:30}});if(A){twttr.merge(B.placer.opts.geoParams,A.opts.geoParams,{granularity:"poi",max_results:30});B.placer.detectedPlace=A.detectedPlace;B.placer.selectPlace(A.selectedPlace);B.search()}else{if(twttr.geo.IP){B.placer.opts.geoParams.ip=twttr.geo.IP;B.search()}else{B.showError()}}}).augmentProto({templates:{choose:'<p class="geo_nearby_activity"><small>{{_i}}Find interesting places nearby and see what people are saying there! To get started, tell us where you\'d like to explore:{{/i}}</small></p><p class="geo_nearby_activity"><a href="#" class="geo_nearby_activity_change">{{_i}}Search places...{{/i}}</a></p>',finding:'<p class="geo_nearby_activity geo_find_in_progress"><small>{{_i}}Finding places nearby...{{/i}}</small></p>',places:'<div class="geo_nearby_activity"><small><span class="geo_nearby_activity_header"></span>&#32;<a href="#" class="geo_nearby_activity_change geo_minorlink">{{_i}}Change{{/i}}</a></small><ul/></div>',error:'<p class="geo_nearby_activity"><small>{{_i}}Location service is currently unavailable.{{/i}}&#32;<a href="#" class="geo_nearby_activity_retry">{{_i}}Try again{{/i}}</a></small></p>',nextPrev:'<p class="geo_nearby_activity"><a href="#" class="geo_prev">{{_i}}Prev{{/i}}</a><span class="geo_prev_next_separator">&nbsp;|&nbsp;</span><a href="#" class="geo_next">{{_i}}Next{{/i}}</a></p>',noPlaces:'<p class="geo_nearby_activity"><small>{{_i}}No active places nearby.{{/i}}</small></p>'}}).method("show",function(B,A){var C=this;C.$nearbyActivity.html(Mustache.to_html(B));C.$nearbyActivity.find(".geo_nearby_activity_change").click(function(D){D.preventDefault();new twttr.geo.PlaceSearchDialog(C.placer,{},function(){C.search()})});C.$nearbyActivity.find(".geo_nearby_activity_retry").click(function(D){D.preventDefault();C.search()});$("#na_menu span").hide().filter(A?".with-place":".without-place").show()}).method("search",function(){var A=this;A.show(A.templates.finding);A.placer.search(function(){A.showPlaces(0)},function(){A.showError()})}).method("showError",function(){var A=this;A.show(A.placer.selectedPlace?A.templates.error:A.templates.choose)}).method("showPlaces",function(C){var F=this;F.show(F.templates.places,true);F.$nearbyActivity.find(".geo_nearby_activity_header").append(F.renderPlace(twttr.geo.templates.nearbyActivityHeader,F.placer.selectedPlace));var E=F.placer.places.length;if(E==0){F.$nearbyActivity.append(Mustache.to_html(F.templates.noPlaces));return }var B=C*twttr.geo.PLACE_SEARCH_RESULTS_PER_PAGE;var A=B+twttr.geo.PLACE_SEARCH_RESULTS_PER_PAGE;var D=F.placer.places.slice(B,A);D.forEach(function(G){F.$nearbyActivity.find("ul").append(F.renderPlace(twttr.geo.templates.nearbyActivityItem,G))});if(E>twttr.geo.PLACE_SEARCH_RESULTS_PER_PAGE){F.$nearbyActivity.append(Mustache.to_html(F.templates.nextPrev));F.setNextPrev(F.$nearbyActivity.find(".geo_prev"),C>0,C-1);F.setNextPrev(F.$nearbyActivity.find(".geo_next"),A<E,C+1)}}).method("renderPlace",function(B,A){var C=this;var D=twttr.geo.renderPlace(B,A);D.find("a").attr(twttr.geo.getPlacePageLinkAttrsFromPlace(A)).isSearchLink().click(function(){C.placer.selectPlace(A);C.search()});return D}).method("setNextPrev",function(A,C,B){var D=this;A.click(function(E){E.preventDefault();if(C){D.showPlaces(B)}});if(!C){A.addClass("link-disabled")}});twttr.klass("twttr.geo.UpdateUi",function(B){var A=this;A.opts=twttr.merge({geo_enabled:false,has_dismissed_geo_promo:false,current_user_path:null,granularity:"neighborhood",queryParams:twttr.unparam(window.location.search.substr(1))},twttr.geo.options,B);if(A.opts.queryParams.ip){twttr.geo.IP=A.opts.queryParams.ip}A.locator=new twttr.geo.Locator(A.opts.queryParams);$(".geo_enable_webclient").live("click",function(C){C.preventDefault();A.enableGeoForWebClient()});$(".geo_disable_webclient").live("click",function(C){C.preventDefault();A.disableGeoForWebClient()});if(A.opts.geo_enabled){if($.cookie("geo_webclient")){A.detectLocation(false)}else{A.disableGeoForWebClient();A.initNearbyActivity()}}else{if(!$.cookie("geo_promo_hidden")&&!$("#latest_status.first-tweet").length){A.setGeoStatus('<span class="geo_new">'+_("New!")+"</span> "+_("Add a location to your tweets.")+' <a id="show_geo_dialog" href="#">'+_("Turn it on")+'</a> - <a id="hide_geo_promo" href="#">'+_("No thanks")+"</a>");$("#hide_geo_promo").click(function(C){C.preventDefault();if(!$(this).hasClass("link-disabled")){A.hidePromoDialog();$.cookie("geo_promo_hidden","1",{expires:3650});$("#geo_status").slideUp();twttr.geo.geoScribe("promo_bar_no_thanks")}});$("#show_geo_dialog").click(function(C){C.preventDefault();C.stopPropagation();if(!$(this).hasClass("link-disabled")){A.showPromoDialog();twttr.geo.geoScribe("void")}});if(!A.opts.has_dismissed_geo_promo){A.showPromoDialog();twttr.geo.geoScribe("promo_bar_dialog_pop")}twttr.geo.geoScribe("promo_bar_shown")}A.initNearbyActivity()}}).augmentProto({templates:{disable_geo:' <a href="#" class="geo_disable_webclient"><span>&nbsp;</span></a>'}}).method("initNearbyActivity",function(A){if(twttr.geo.options.nearby_activity&&!this.nearbyActivity){this.nearbyActivity=new twttr.geo.NearbyActivity(A)}}).method("setGeoStatus",function(A){$("#geo_status").html(A)}).method("scribeLocationDetection",function(A,B){twttr.geo.geoScribe("location_detection_complete",$.extend({status:A,locator_type:this.locator.locatorType},B))}).method("lookupPlacesAndShowDropdown",function(B,D){var C=this;var A=new twttr.geo.Placer({geoParams:B});A.search(function(){C.scribeLocationDetection("place_lookup_succeeded",A.getState());C.setGeoStatus('<span id="place_content"></span>'+C.templates.disable_geo);new twttr.geo.PlacesDropdown(A,C.opts);C.initNearbyActivity(A)},function(){C.cannotDetectLocation(D);C.scribeLocationDetection("place_lookup_failed",A.getState())},function(){C.setGeoStatus(_("Location service is currently unavailable.")+' <a href="#" class="geo_enable_webclient">'+_("Try again")+"</a>"+C.templates.disable_geo);C.initNearbyActivity()})}).method("detectLocationByIp",function(B){var A=this;if(twttr.geo.IP){$("#lat").val();$("#lon").val();A.lookupPlacesAndShowDropdown({ip:twttr.geo.IP,accuracy:16000,granularity:A.opts.granularity,max_results:twttr.geo.MAX_NEARBY_PLACES},B)}else{A.scribeLocationDetection("place_lookup_no_ip");A.cannotDetectLocation(B)}}).method("cannotDetectLocation",function(B){var A=this;if(A.opts.allow_set_location_manually){if(B){A.setLocationManually()}else{A.setGeoStatus(_("We couldn't find you!")+' <a href="#" class="geo_add_manual">'+_("Add Location")+"</a>"+A.templates.disable_geo);$(".geo_add_manual").click(function(C){C.preventDefault();A.setLocationManually()})}}else{A.setGeoStatus(_("Unable to associate your coordinates with a place.")+' <a href="#" class="geo_enable_webclient">'+_("Try again")+"</a>"+A.templates.disable_geo)}A.initNearbyActivity()}).method("setLocationManually",function(){var D=this;var C=new twttr.geo.Placer({geoParams:{granularity:D.opts.granularity}});var A=function(){D.setGeoStatusAddYourLocation();new twttr.geo.PlaceSearchDialog(C,D.opts,function(){D.setGeoStatus('<span id="place_content"></span>'+D.templates.disable_geo);new twttr.geo.PlacesDropdown(C,D.opts)});twttr.geo.geoScribe("set_location_manually")};var B=C.getRecentPlaceId();if(B){D.setGeoStatus('<span class="crosshairs">&nbsp;</span><span class="geo_progress">'+_("Getting recent location...")+"</span>"+D.templates.disable_geo);C.selectPlaceById(B,function(){A()},function(){A()})}else{A()}}).method("detectLocation",function(B){$("#lat").val("");$("#lon").val("");$("#place_id").val("");this.setGeoStatus('<span class="crosshairs">&nbsp;</span><span class="geo_progress">'+_("Getting your location...")+"</span>"+this.templates.disable_geo);var A=this;if(!A.locator.isLocatable()||A.opts.queryParams.nodetect!==undefined){A.detectLocationByIp(B)}else{A.locator.getLocation({onSuccess:function(C){$("#lat").val(C.latitude);$("#lon").val(C.longitude);A.lookupPlacesAndShowDropdown({lat:C.latitude,lon:C.longitude,accuracy:C.accuracy,granularity:A.opts.granularity,max_results:twttr.geo.MAX_NEARBY_PLACES},false)},onFailure:function(C){if(!C.fatal){A.detectLocationByIp(B)}else{A.disableGeoForWebClient();A.scribeLocationDetection("denied_by_user")}}})}}).method("showPromoDialog",function(){var B=this;var C=$("#show_geo_dialog");var A=$('<div class="hoverer" id="geo-promo-hoverer">         <div class="hoverer-inner">          <div class="tiny-map"><img src="httpdisabled://s.twimg.com/a/1302214109/images/tiny-map.gif"></div>          <h3>'+_("Add a location to your tweets")+'</h3>          <div id="geo_dialog_descr">'+_('Ever had something you wanted to share ("fireworks!", "party!", "ice cream truck!", or "quicksand...") that would be better with a location?')+" "+_("By turning on this feature, you can include location information like neighborhood, town, or exact point when you tweet.")+"<br><br>"+_("When you tweet with a location, Twitter stores that location.")+" "+_("You can switch location on/off before each tweet and always have the option to delete your location history.")+' <a id="geo_learn_more" href="httpdisabled://twitter.zendesk.com/forums/26810/entries/78525" target="_blank">'+_("Learn more")+'</a>          </div>          <div>            <button id="geo_turn_location_on" class="btn">'+_("Turn location on")+'</button>            <a href="#" id="geo_not_now" class="geo_dialog_close">'+_("Not now")+'</a>          </div>        </div>        <div class="hovercard-divot"></div>      </div>').insertAfter(C);twttr.SimplePositioner.setPosition(A,C,{direction:"below",offsets:{below:{top:10,left:-50}},hasContainer:true});$("#show_geo_dialog,#hide_geo_promo").addClass("link-disabled");$("#geo_turn_location_on").click(function(){B.turnLocationOn();twttr.geo.geoScribe("promo_dialog_turn_location_on")});$(".geo_dialog_close").click(function(D){D.preventDefault();B.hidePromoDialog();twttr.geo.geoScribe("promo_dialog_not_now")});$("#geo-promo-hoverer").click(function(D){D.stopPropagation()});$("html").one("click",function(){if($("#geo-promo-hoverer:visible").length>0){B.hidePromoDialog();twttr.geo.geoScribe("promo_dialog_click_outside")}});A.css("visibility","visible")}).method("hidePromoDialog",function(){if(!this.opts.has_dismissed_geo_promo){this.setUserFlag("has_dismissed_geo_promo");this.opts.has_dismissed_geo_promo=true}$("#geo-promo-hoverer").remove();$("#show_geo_dialog,#hide_geo_promo").removeClass("link-disabled")}).method("turnLocationOn",function(){this.setUserFlag("geo_enabled");this.opts.geo_enabled=true;this.hidePromoDialog();this.enableGeoForWebClient()}).method("setUserFlag",function(A){data={authenticity_token:twttr.form_authenticity_token,_method:"put"};data["user["+A+"]"]="1";$.ajax({type:"POST",url:this.opts.current_user_path,data:data})}).method("enableGeoForWebClient",function(){if(!$.cookie("geo_webclient")){$.cookie("geo_webclient","1",{expires:3650})}this.detectLocation(true)}).method("setGeoStatusAddYourLocation",function(){this.setGeoStatus('<span class="crosshairs">&nbsp;</span><a href="#" class="geo_enable_webclient">'+_("Add your location")+"</a>")}).method("disableGeoForWebClient",function(){$("#lat").val("");$("#lon").val("");$("#place_id").val("");if($.cookie("geo_webclient")){$.cookie("geo_webclient",null)}this.setGeoStatusAddYourLocation()});
2