label-boxtwttr.geo={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,CHROME_RETRY_ACCURACY:1000,CHROME_RETRY_INTERVAL:250,CHROME_RETRY_MAX:10,GENERIC_PLACE_TYPES:{city:null,neighborhood:null,admin:null,country:null},TARGET_POI_NAME_LENGTH:40,TARGET_PLACE_NAME_LENGTH:50,templates:{dropdownItem:'<li id="place_{{id}}"><span class="place_item_icon">&nbsp;</span>{{{content}}}</li>',searchResultItem:'<li id="place_{{id}}">{{{content}}}</li>',autocompleteItem:'<li id="place_{{id}}">{{{content}}}</li>',placeContent:'<span class="place_noicon">{{{pre}}}{{formatted_name}}{{{post}}}</span>',pointContent:'<span class="place_icon">&nbsp;</span> {{{pre}}}{{formatted_name}}{{{post}}} <span class="place_details">{{details}}</span>'},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.getPlaceDetails=function(A){if(A.attributes&&A.attributes.street_address){return A.attributes.street_address}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){var C;if(A.place_type in twttr.geo.GENERIC_PLACE_TYPES){C=twttr.geo.templates.placeContent;A.formatted_name=twttr.geo.formatPlaceName(A.full_name,twttr.geo.TARGET_PLACE_NAME_LENGTH)}else{C=twttr.geo.templates.pointContent;A.formatted_name=twttr.geo.formatPlaceName(A.name,twttr.geo.TARGET_POI_NAME_LENGTH);A.details=twttr.geo.getPlaceDetails(A)}A.content=Mustache.to_html(C,A);return $(Mustache.to_html(B,A))};twttr.geo.geoScribe=function(A,B){scribe($.extend({event_name:A,ui_version:1,log_version:1},B),"geo_checkins")};twttr.geo.Exceptions={GeoSupportException:function(){this.msg=_("This browser does not support GeoLocation")}};twttr.geo.Errors={UnknownError:function(){this.allowRetry=true;this.fatal=true;this.msg=_("We're sorry. Something went wrong.")},PermissionDeniedError:function(){this.allowRetry=false;this.fatal=true;this.msg=_("Please grant your web browser permission to tell Twitter where you are.")},LocationAvailabilityError:function(){this.allowRetry=true;this.fatal=false;this.msg=_("We were unable to lookup your location.")},TimeoutError:function(){this.allowRetry=true;this.fatal=true;this.msg=_("The location service is currently unavailable. Try again later.")}};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("extendBounds",function(A){if(!this.bounds){this.bounds=new google.maps.LatLngBounds()}this.bounds.extend(A)}).method("addPoint",function(B,E,D){var G=this;var A=D?true:false;var H=new google.maps.LatLng(B[1],B[0]);G.extendBounds(H);var F=new google.maps.MarkerImage("http://s.twimg.com/a/1276197224/images/pin.png",new google.maps.Size(43,32),null,new google.maps.Point(14,33));G.marker=new google.maps.Marker({flat:true,icon:F,map:G.map,position:H,clickable:false,zIndex:2});if(E){var C=new google.maps.MarkerImage(E,new google.maps.Size(24,24),null,new google.maps.Point(13,32));G.avatar=new google.maps.Marker({flat:true,icon:C,map:G.map,position:H,draggable:A,zIndex:3});if(A){google.maps.event.addListener(G.avatar,"drag",function(I){G.marker.setPosition(I.latLng)});google.maps.event.addListener(G.avatar,"dragend",function(I){D(I.latLng.lat(),I.latLng.lng())})}}}).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:{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 about 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>'},mapsAvailable:function(){return typeof google!="undefined"&&typeof google.maps!="undefined"},initialize:function(){var A=this;$(".geo-pin, a.geocoded_google_link").live("click",function(C){C.preventDefault();var B=$(this).closest("span.entry-meta");A.openMapModal(B.meta(),B.find("a.geocoded_google_link"))})},closeMapModal:function(){$(".geo-pin.selected").removeClass("selected");$("#geo_modal").remove();this.geoMap=null},openMapModal:function(H,A){var E=this;E.closeMapModal();var C=H.place_id;var D=C&&twttr.geo.options.show_place_details_in_map?E.templates.mapWithPlace:E.templates.mapWithoutPlace;$(A).after(Mustache.to_html(D));var B=$("#map_canvas").get(0);E.geoMap=new twttr.geo.Map(B);var I=E.geoMap;$(".map_close").click(function(J){J.preventDefault();E.closeMapModal()});var F=false;var G=function(){if(!F&&H.latlng){E.geoMap.addPoint(H.latlng.slice().reverse(),H.avatar_url)}E.showMap(A)};if(C){twttr.api.getPlaceDetails({place_id:H.place_id,success:function(K,M){if(I!=E.geoMap){return }var L=K.geometry.coordinates;if(K.geometry.type=="Polygon"){E.geoMap.addPlacePolygon(L)}else{if(K.geometry.type=="MultiPolygon"){L.forEach(function(N){E.geoMap.addPlacePolygon(N)})}else{if(K.geometry.type=="Point"){E.geoMap.addPoint(L,H.avatar_url);F=true}}}$(".geo_map_place_name").text(K.name);$(".geo_map_place_address").text(K.street_address||"");var J=twttr.geo.getBestContainer(K);$(".geo_map_place_container").text(J.full_name||"");$(".geo_map_place_phone").text(K.phone||"");$(".geo_map_place_tweets a").attr("href","/search?"+$.param({q:"place:"+K.id,authenticity_token:twttr.form_authenticity_token}));G()}})}else{G()}},showMap:function(C){if(this.geoMap.isEmpty()){return }this.geoMap.adjustBounds();var A=$("#geo_modal");A.visible(false);var B=$(C);B.addClass("selected");twttr.SimplePositioner.setPosition(A,B,{itemHeight:180,offsets:{above:{top:-10,left:-40},below:{top:10,left:-40}},direction:"prefer below",hasContainer:true});$("#geo_modal").click(function(E){E.stopPropagation()});var D=this;$("html").one("click",function(E){D.closeMapModal()});A.visible(true)}};$(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(){C.placer.determinePlaces(function(){C.rebuildPlacesDropdown()},function(){$(".geo_disable_webclient:first").click()});if($("#place_id").val()!=""){twttr.geo.geoScribe("geotweet",C.placer.getState())}});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{C.openMenu();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()});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("openMenu",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("open_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">Optional</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.dialog.open();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(C.opts.autocomplete){C.placeAutocomplete=new twttr.autocomplete({$input:A,$dropdown:$(".place_search_dropdown"),getInputVal:function(){return A.helpVal()},fetchMatches:function(E,G,F){twttr.api.lookupNearbyPlaces({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:C.opts.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.lookupNearbyPlaces({data:twttr.merge({},C.searchParams,{query:F,granularity:B?"city":C.searchParams.granularity}),success:function(G){C.setWaitCursor(false);C.searchResultPlaces=G.result.places;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("loading",A)}).method("shouldAllowPlaceCreation",function(A){return !A&&this.opts.place_creation&&this.searchParams.accuracy&&twttr.geo.mapsUI.mapsAvailable()&&(!this.opts.place_creation_needs_high_accuracy||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,twttr.merge({pre:'<a href="#">',post:"</a>"},K));M.find("a").attr("href","#").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",(K.attributes&&K.attributes.street_address)||"");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; {{_i}}Prev{{/i}}</a><a href="#" id="geo_next_result">{{_i}}Next{{/i}} &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.avatarUrl,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=twttr.geo.getLocationFromPlace(this.city);if(A){twttr.merge(this.searchParams,{lat:A.latitude,lon:A.longitude,accuracy:A.accuracy})}}).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(B,G,E,F,C,A){var H=this;H.lat=E.lat;H.lon=E.lon;H.accuracy=E.accuracy;H.originalGeoParams=E;H.draggedPin=false;H.formHtml='<form><table cellspacing="0" cellpadding="0" class="geo_place_search_table"><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 rowspan="3" 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 your location.{{/i}}</div></div></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 class="geo_place_info"><div class="geo_place_creation_hint">{{_i}}"795 Folsom Street" 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></form>';$(".place_creation_dialog").remove();H.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});$(".place_creation_dialog .modal-content").html(Mustache.to_html(H.formHtml,{city_name:B.full_name}));H.inProgress=false;$("#geo_place_name").val(G).helpText().change(function(I){H.updateState()}).keydown(function(I){setTimeout(function(){H.updateState()},0)});$("#geo_create_place").click(function(){if(H.inProgress){return }var I={lat:H.lat,lon:H.lon,name:$("#geo_place_name").helpVal(),"attribute:street_address":$("#geo_place_address").helpVal(),contained_within:B.id,accuracy:H.draggedPin?0:H.originalGeoParams.accuracy};H.inProgress=true;H.updateState();twttr.api.similarPlaces({data:I,success:function(J){I.token=J.result.token;twttr.api.createPlace({data:I,success:function(K){H.inProgress=false;H.updateState();H.dialog.close();F(K);H.scribeCreatePlace("success",I)},error:function(){H.onCreationError();H.scribeCreatePlace("create_place_error",I)}})},error:function(){H.onCreationError();H.scribeCreatePlace("similar_places_error",I)}})});H.dialog.open();H.updateMapHeight();H.geoMap=new twttr.geo.Map($(".geo_map_canvas").get(0));H.geoMap.addPoint([H.lon,H.lat],C,function(I,J){H.lat=I;H.lon=J;H.draggedPin=true});H.geoMap.addAccuracyRing([H.lon,H.lat],H.accuracy,A);H.geoMap.adjustBounds(15);H.updateState();$("#geo_place_address").helpText().focus();var D=true;setTimeout(function(){if(D){$(".geo_map_hint").fadeTo(700,0.8)}},700);$(".geo_map").mousedown(function(I){D=false;$(".geo_map_hint").fadeOut(200)})}).method("scribeCreatePlace",function(A,B){var C=this;twttr.geo.geoScribe("create_place",$.extend({status:A,original_lat:C.originalGeoParams.lat,original_lon:C.originalGeoParams.lon,original_accuracy:C.originalGeoParams.accuracy,dragged_pin:C.draggedPin},B))}).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=$(".geo_map").height();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.Position",function(C,A,B){this.latitude=C;this.longitude=A;this.accuracy=B;this.timestamp=(new Date()).getTime()});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={getCurrentPosition:function(C){C({coords:{latitude:B.lat,longitude:B.lon,accuracy:parseInt(B.accuracy)||200}})}}}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="http://s.twimg.com/a/1276197224/images/geo_browser_help_banner_1.png" />{{_i}}Check "Remember for this site"{{/i}}</div><div><img src="http://s.twimg.com/a/1276197224/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="http://s.twimg.com/a/1276197224/images/geo_browser_help_banner_1.png" />{{_i}}Check "Remember for this site"{{/i}}</div><div><img src="http://s.twimg.com/a/1276197224/images/geo_browser_help_banner_2.png" />{{_i}}Click "Share my location"{{/i}}</div></div>'}}).method("_getPositionSuccessCallback",function(C,B){var A=this;var D=function(E){if(D._calls==0){A.setBrowserGeoPermissionsHelpBannerSeen();A.position=new twttr.geo.Position(E.coords.latitude,E.coords.longitude,E.coords.accuracy);B.call(A);C.call(A,A.position)}D._calls++};D._calls=0;return D}).method("_getPositionErrorCallback",function(A,C){var B=this;var D=function(F){B.setBrowserGeoPermissionsHelpBannerSeen();var E;switch(F.code){case F.PERMISSION_DENIED:E=new twttr.geo.Errors.PermissionDeniedError();break;case F.POSITION_UNAVAILABLE:E=new twttr.geo.Errors.LocationAvailabilityError();break;case F.TIMEOUT:E=new twttr.geo.Errors.TimeoutError();break;default:E=new twttr.geo.Errors.UnknownError();break}if(E.fatal){var G=new ShortNotification();G.setMessage(E.msg);G.show()}C.call(B);A.call(B,E)};return D}).method("_getLocation",function(E){var D=this;if(!D.isLocatable()){throw new twttr.geo.Exceptions.GeoSupportException()}else{var G=D._getPositionSuccessCallback(E.onSuccess,E.onComplete);var C=D._getPositionErrorCallback(E.onFailure,E.onComplete);var A=twttr.geo.CHROME_RETRY_MAX;var F=navigator.userAgent.indexOf("Chrome")!=-1;var B=function(H){if(F&&H.coords.accuracy>twttr.geo.CHROME_RETRY_ACCURACY&&A>0){A-=1;setTimeout(function(){D.locator.getCurrentPosition(B,C)},twttr.geo.CHROME_RETRY_INTERVAL)}else{G(H)}};D.locator.getCurrentPosition(B,C)}}).method("hasCachedLocation",function(){return !!this.position}).method("isStaleLocation",function(){var A=((new Date()).getTime()-this.position.timestamp);return A>twttr.geo.LOCATION_CACHE_INTERVAL}).method("isLocatable",function(){return !!(this.locator)}).method("getLocation",function(A){var B=$.extend({refresh:false,onSuccess:function(C){},onFailure:function(C){},onComplete:function(){}},A);if(this.hasCachedLocation()&&!this.isStaleLocation()&&!B.refresh){B.onComplete();B.onSuccess.call(this,this.position)}else{if(!this.getBrowserGeoPermissionsHelpBannerSeen()){this.detectBrowserGeoPermissionsBanner()}this._getLocation(B)}}).method("getWindowHeight",function(){return $(window).height()}).method("getBrowserGeoPermissionsHelpBannerSeen",function(){return $.cookie("geo_ff_banner_seen")||$.cookie("geo_browser_help_banner")}).method("setBrowserGeoPermissionsHelpBannerSeen",function(){if(this.showBrowserGeoPermissionsHelpBanner){this.clearDetectBrowserGeoPermissionsBanner();if(!this.getBrowserGeoPermissionsHelpBannerSeen()){$.cookie("geo_browser_help_banner","1",{expires:3650});$.cookie("geo_ff_banner_seen",null)}}}).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("nearbyPlaces",function(D,B){var A=this;try{twttr.api.lookupNearbyPlaces({data:A.opts.geoParams,success:function(E){A.places=E.result.places;A.determinePlaces(D,B)},error:function(){B()}})}catch(C){B()}}).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 B=[];this.places.forEach(function(C){B.push(C.id)});var A={place_ids:B,geo_params:this.opts.geoParams};if(this.selectedPlace){A.selected_place_id=this.selectedPlace.id}if(this.detectedPlace){A.detected_place_id=this.detectedPlace.id}return A});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()}}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("promo_bar_dialog_open")}});if(!A.opts.has_dismissed_geo_promo&&$("#convergence_notice:visible").length==0){A.showPromoDialog();twttr.geo.geoScribe("promo_bar_dialog_pop")}twttr.geo.geoScribe("promo_bar_shown")}}}).augmentProto({templates:{disable_geo:' <a href="#" class="geo_disable_webclient"><span>&nbsp;</span></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.nearbyPlaces(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)},function(){C.cannotDetectLocation(D);C.scribeLocationDetection("place_lookup_failed",A.getState())})}).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 later")+"</a>"+A.templates.disable_geo)}}).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")}},options:{timeout:10000,enableHighAccuracy:true}})}}).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="http://s.twimg.com/a/1276197224/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="http://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()});

