
DC='District of Columbia';MARYLAND='Maryland';NEW_ENGLAND='New England';DEGREE_PER_RADIAN=57.2957795;RADIAN_PER_DEGREE=0.017453;function distance(latlong,latlong2){var lat1=latlong.latitude;var lon1=latlong.longitude;var lat2=latlong2.latitude;var lon2=latlong2.longitude;var earthRadius=6371;var factor=Math.PI/180;var dLat=(lat2-lat1)*factor;var dLon=(lon2-lon1)*factor;var a=Math.sin(dLat/2)*Math.sin(dLat/2)+Math.cos(lat1*factor)*Math.cos(lat2*factor)*Math.sin(dLon/2)*Math.sin(dLon/2);var c=2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a));var d=earthRadius*c;return d;}
Mapview={loaded:false,cache:{},subquery:'',stack:[''],infos:{},people:{},selected_property_sub_nav:'road',profiles:{},profileIds:[],searchGraphId:null,mapDivId:'result_map_content',streetViewDivId:'profile_streetview',navListeners:[],initialListen:null,doNotSlide:null,personName:'',init:function(query,searchGraphId,resultsData,possibleMatches,premium,state,street,campaign_redirect,trackingParams,uiSplitTests){if(campaign_redirect)return this.campaignRedirect();this.origHash=document.location.hash.substring(1).replace(/\+/g,' ');this.query=query;this.personName=this.query.split(',')[0];this.cache['']=resultsData;this.searchGraphId=searchGraphId;this.possibleMatches=possibleMatches;this.premium=premium;this.trackingParams=trackingParams;this.uiSplitTests=uiSplitTests;hide('result_profile');show('result_map');var hash=document.location.hash.substring(1).replace(/\+/g,' ');var selectedPersonId=null;if(hash&&(hash.match(':')||this.hasGroups(resultsData))){this.navigateTo(hash);}else{if(!hash){selectedPersonId=this.getSelectedPersonId(resultsData,state,query.split(',')[1],street);if(resultsData&&resultsData.r&&resultsData.r.length==1){this.goToProfile(selectedPersonId);hash=document.location.hash.substring(1).replace(/\+/g,' ');this.origHash=document.location.hash.substring(1).replace(/\+/g,' ');this.personId=selectedPersonId;}}
this.updateResults(resultsData,'result_names_existing');}
this.initDhtmlHistory(selectedPersonId);},initDhtmlHistory:function(selectedPersonId,afterLoad){if(window.dhtmlHistory){window.dhtmlHistory.changeTitle=function(){};window.dhtmlHistory.create({blankURL:'/rsh.html?',toJSON:function(o){return Object.toJSON(o);},fromJSON:function(s){return s.evalJSON();}});var f=function(){window.dhtmlHistory.initialize(Mapview.navigateTo.bind(Mapview));var hash=document.location.hash.substring(1).replace(/\+/g,' ')
if(hash&&hash!=Mapview.origHash)Mapview.navigateTo(hash);else if(selectedPersonId)Mapview.goToProfile(selectedPersonId);};afterLoad?f():add_onload(f);}else{add_onload(function(){Mapview.initDhtmlHistory(selectedPersonId,true);});}},campaignRedirect:function(){if(document.location.search.match(/g=/)&&document.location.search.match(/gr=/))
document.location.href=document.location.href.replace(/g=[^&#]+&?/,'').replace(/gr=[^&#]+&?/,'').replace(/\?&/,'?').replace(/&#/,'#').replace(/&$/,'');},getSelectedPersonId:function(resultsData,state,city,street){var selectedPersonId=null;if(resultsData&&resultsData.r&&resultsData.r.length>0){if(resultsData.r.length==1&&resultsData.r[0]instanceof Result.Person){selectedPersonId=resultsData.r[0].id;}else{var unitRegexp=/,? (unit|apt) [0-9a-z]+$/;if(state)state=state.strip().toLowerCase();if(city)city=city.strip().toLowerCase();if(street)street=street.strip().toLowerCase().replace(unitRegexp,'');var partialStreet=street?street.replace(/^[0-9 ]*((n(orth)?|s(outh)?|e(ast)?|w(est)?) +)?/,''):null;var cityAndExactStreetMatches=[];var cityAndPartialStreetMatches=[];var exactStreetMatches=[];var partialStreetMatches=[];var cityMatches=[];var stateMatches=[];for(var i=0;i<resultsData.r.length;i++){var result=resultsData.r[i];if(result instanceof Result.Person){var resultState=result.stateAbbreviation();if(resultState)resultState=resultState.toLowerCase();var resultCity=result.city();if(resultCity)resultCity=resultCity.toLowerCase();var resultStreet=result.street;if(resultStreet)resultStreet=resultStreet.toLowerCase().replace(unitRegexp,'');var stateMatched=(state&&state==resultState);var cityMatched=(city&&city==resultCity);var exactStreetMatched=(street&&street==resultStreet);var partialStreetMatched=(partialStreet&&resultStreet&&!exactStreetMatched&&resultStreet.match(partialStreet));if(cityMatched&&exactStreetMatched)cityAndExactStreetMatches.push(resultsData.r[i].id);else if(cityMatched&&partialStreetMatched)cityAndPartialStreetMatches.push(resultsData.r[i].id);else if(exactStreetMatched)exactStreetMatches.push(resultsData.r[i].id);else if(partialStreetMatched)partialStreetMatches.push(resultsData.r[i].id);else if(cityMatched)cityMatches.push(resultsData.r[i].id);else if(stateMatched)stateMatches.push(resultsData.r[i].id);}}
if(cityAndExactStreetMatches.length>0){selectedPersonId=cityAndExactStreetMatches[0];}
else if(cityAndPartialStreetMatches.length>0){if(cityAndPartialStreetMatches.length==1)selectedPersonId=cityAndPartialStreetMatches[0];}
else if(exactStreetMatches.length>0){selectedPersonId=exactStreetMatches[0];}
else if(partialStreetMatches.length>0){if(partialStreetMatches.length==1)selectedPersonId=partialStreetMatches[0];}
else if(cityMatches.length>0){if(cityMatches.length==1)selectedPersonId=cityMatches[0];}
else if(stateMatches.length>0){if(stateMatches.length==1)selectedPersonId=stateMatches[0];}}}
return selectedPersonId;},initSEO:function(query,searchGraphId,resultsData){this.query=query;this.searchGraphId=searchGraphId;this.isSEO=true;this.mapDivId='result_seo_map_content';add_class(z('name_result_page'),'seo_page');if(this.getCurrentLevel(resultsData)!='States'){BingMap.loadMap(this.mapDivId);}
this.updateResults(resultsData,'result_names_existing');},ajaxLoadNavigation:function(name,firstname){var req=new Ajax.Request('/seo/load_nav_and_map',{parameters:'name='+name,asynchronous:false,evalScripts:true});result=(req&&req.transport&&req.transport.responseText)?req.transport.responseText:'<br/>&nbsp;&nbsp;Could not load profile.';var json=eval('('+result+')');this.initSEO(json.name,json.graphID,json.resultsData);},goToHash:function(hash){document.location.hash=hash?hash.replace(/ |%20/g,'+'):'';if(mainScroll){mainScroll.scrollTo(0,0,0);mainScroll.refresh();}},goToMap:function(location){this.goToHash(location||this.subquery);return false;},goToProfile:function(personId,householdPersonId){if(personId)this.goToHash(this.subquery+':'+personId+(householdPersonId?':'+householdPersonId:''));return false;},hasGroups:function(resultsData){if(resultsData)
for(var i=0;i<resultsData.r.length;i++)
if(resultsData.r[i]instanceof Result.Group)
return true;return false;},hasPerson:function(resultsData){if(resultsData)
for(var i=0;i<resultsData.r.length;i++)
if(resultsData.r[i]instanceof Result.Person)
return true;return false;},hasPerson:function(resultsData){if(resultsData)
for(var i=0;i<resultsData.r.length;i++)
if(resultsData.r[i]instanceof Result.Person)
return true;return false;},hasStates:function(resultsData){if(resultsData)
for(var i=0;i<resultsData.r.length;i++)
if(resultsData.r[i].locationType=='State')
return true;return false;},allInSameState:function(resultsData){if(resultsData&&resultsData.r.length>0)
var first_state=resultsData.r[0].state;for(var i=1;i<resultsData.r.length;i++)
if(resultsData.r[i].state!=first_state)
return false;return true;},hasNearbyCities:function(resultsData){if(resultsData)
for(var i=0;i<resultsData.r.length;i++)
if(resultsData.r[i].type=='nearby_city_divider')
return true;return false;},hasMetros:function(resultsData){if(resultsData)
for(var i=0;i<resultsData.r.length;i++)
if(resultsData.r[i].locationType=='Metro')
return true;return false;},goToHouseholdPerson:function(personId){if(this.personId){if(this.personId==personId){this.goToProfile(this.personId);}else{var person=this.householdPeople[personId];if(person)this.goToProfile(this.personId,personId);}}
return false;},addNavigationListener:function(fxn){this.navListeners.push(fxn);},notifyNavigationListeners:function(){if(this.lastNotifiedURL==document.location.href)return;this.lastNotifiedURL=document.location.href;if(this.navListeners){for(var i=0;i<this.navListeners.length;i++){var fxn=this.navListeners[i];if(typeof fxn=='string')eval(fxn);else if(typeof fxn=='function')fxn.call();}}},getAndCachePerson:function(person_id){person=null;try{person=eval(new Ajax.Request('/mapview/person_js/'+this.personId+'?q='+(this.query||'').split(',')[0],{asynchronous:false}).transport.responseText);}catch(e){}
this.people[this.personId]=person;return person;},updateToNameSearchContent:function(person)
{if(person&&person.showNew)
{z("name_search_subheader").innerHTML="<span>"+person.name+"</span>";remove_class(z("name_search_subheader"),"toc_subheader");if(person.gender&&person.gender.toUpperCase()=="FEMALE"){remove_class(z("left_profile_pic"),"male_profile_pix");remove_class(z("left_profile_pic"),"female_profile_pix");add_class(z("left_profile_pic"),"female_profile_pix");}
setTextElement("user_profile_name",person.name);setTextElement("user_profile_gender",person.gender);setTextElement("user_profile_age",person.ageDisplay);if(!person.ageDisplay)
document.getElementById("divider_span").style.display='none';var ageStr=person.age?person.age+" years old":"Unknown";var addressStr=person.zip+"";if(addressStr.length==4)
addressStr="0"+addressStr;addressStr=person.location+" "+addressStr;var homeValueStr=person.homeValue;if(homeValueStr.toLowerCase()=="<i>unknown</i>"||homeValueStr.toLowerCase()=="~ home")
homeValueStr="Unknown";setTextElement("user_profile_real_age",ageStr);setTextElement("user_profile_current_address",person.display_profile_address());setTextElement("user_profile_city_state",addressStr);setAttrElement("user_profile_current_address","Title",person.display_profile_address());setAttrElement("user_profile_city_state","Title",addressStr);setTextElement("user_profile_phone_number",person.phoneNumber);if(person.isPremium)
{if(person.emailAddress=="Get Email Search"){setTextElement("user_profile_email_address","Unknown");}
else if(person.haveQuota)
{setTextElement("user_profile_email_address",person.emailAddress);}
else
{emailStr="Email "+person.name.substring(0,person.name.indexOf(' '));setTextElement("user_profile_email_address",emailStr);var emailElem=document.getElementsByName("user_profile_email_address")[0];emailElem.href="#";emailElem.onclick=function()
{Spokeo.getEmailAndUpdate(person.id,emailElem);return TableOfContents.navigateTo('basic_info');}}}
else
setTextElement("user_profile_email_address",person.emailAddress);setTextElement("user_profile_family_members",person.relativesCount);setTextElement("user_profile_home_value",homeValueStr);}},analyticsURL:function(){return'/analytics'+
document.location.pathname+
document.location.search.replace(/ |%20/g,'+')+
(this.trackingParams&&document.location.search.indexOf(this.trackingParams)==-1?(document.location.search?'&':'?')+this.trackingParams:'')+
document.location.hash.replace(/ |%20/g,'+');},navigateTo:function(hash){if(this.initialListen)
this.hideNoresults();this.notifyNavigationListeners();if(this.initialListen==null)
this.initialListen=true;var subquery=unescape(hash);if(subquery&&typeof(subquery)=='string')subquery=subquery.replace(/\+/,' ');this.personId=null;var m=subquery.match(/^(.*?):([0-9]+)(?::([0-9]+))?/);if(m){subquery=m[1];this.personId=m[2];this.householdPersonId=m[3];if(this.initialListen==true&&this.personId){try{z('header_search_input').value=this.query;z('input_underlay').value='';}catch(e){}
this.doNotSlide=true;this.showTableOfContents();}}
this.initialListen=false;if(!subquery||subquery=='USA'||subquery==1){subquery='';this.isNewEngland=false;}
if(this.query&&(($('result_names_existing').firstChild&&$('result_names_existing').firstChild.id=='table_of_contents_wrapper'&&!this.sliding)||(!this.loaded||subquery!=this.subquery))){if(this.cache[subquery]||subquery==NEW_ENGLAND){this.afterDrilldown(subquery);}else{var params='sg='+(this.searchGraphId||'')+'&d='+subquery.replace(/\+/g,' ')+'&q='+encodeURIComponent(this.query.replace(/\+/g,' '));new Ajax.Request('/mapview/results',{parameters:params,asynchronous:false,onComplete:function(r){Mapview.afterDrilldown(subquery,r.responseText);}});}}
if(this.personId){var person=this.people[this.personId];if(!person){person=this.getAndCachePerson(this.personId);}
if(person){if(this.householdPersonId){var householdPerson=this.householdPeople?this.householdPeople[this.householdPersonId]:null;this.showHouseHoldProfile(householdPerson,person);}else{this.showProfile(person);}}else{this.showNoResults();}}else{this.showMap();}},afterDrilldown:function(subquery,responseText){if(this.sliding)return setTimeout(function(){this.afterDrilldown(subquery,responseText);}.bind(this),40);this.subquery=subquery;var resultsData=null;if(responseText)try{resultsData=eval('('+responseText+')');}catch(e){}
else resultsData=this.cache[subquery];if(subquery==NEW_ENGLAND){resultsData=this.newEnglandResults();this.isNewEngland=true;}
if(resultsData){this.loaded=true;if(resultsData.r.length!=0)
this.cache[subquery]=resultsData;if((this.personId&&$('result_profile').visible())||((this.doNotSlide==true||size_of_associative_array(this.cache)==0)&&this.personId)){this.showTableOfContents();if(resultsData.r.length!=0)this.updateResults(resultsData,'result_names_existing',null,true);}else if(z('result_names_existing').firstChild)this.slideResults(resultsData);else this.updateResults(resultsData,'result_names_existing');}},newEnglandResults:function(){if(this.newEnglandResultsData)return this.newEnglandResultsData;if(!this.newEngland){var groups=[];var results=this.cache[''].r;for(var i=0;i<results.length;i++){if(results[i]instanceof Result.Group){var loc=Locations[results[i].location];if(loc&&loc[2])groups.push(results[i]);}}
this.newEngland=groups;}
var count=0;for(var i=0;i<this.newEngland.length;i++)
count+=this.newEngland[i].count;var ne={};ne.r=this.newEngland;ne.l=this.cache[''].l+'|-1:'+NEW_ENGLAND+':'+count;return(this.newEnglandResultsData=ne);},hideNoresults:function(){remove_class(z('result_names'),'hide_this');remove_class(z('result_map'),'hide_this');remove_class(z('result_profile'),'hide_this');remove_class(z('result_profile'),'hide_this');if(z('main_panel_expanded'))
hide('main_panel_expanded');},showNoResults:function(resultsData){add_class(z('result_names'),'hide_this');add_class(z('result_map'),'hide_this');add_class(z('result_profile'),'hide_this');add_class(z('result_profile'),'hide_this');z('no_results_search_term').innerHTML=this.query;show('main_panel_expanded');},usaMapResizer:function(){var map_img=$('usa_map_img');var map_area=$('usa_map_area');var panel=$('usa_map_outer');if(panel&&map_img&&map_area){var panel_width=panel.getWidth();var panel_height=panel.getHeight();var map_width=map_img.getWidth();if(map_width<10)return setTimeout(Mapview.usaMapResizer,50);var map_height=map_img.getHeight();var left_offset=(panel_width-map_width)/2;var top_offset=(panel_height-map_height)/2;if(panel_width/panel_height>1.25){var new_height=panel_height*.95;map_img.setStyle({'height':new_height+'px'});}
else{map_img.setStyle({'height':'auto'});}
map_img.setStyle({'left':left_offset+'px','top':top_offset+'px'});map_area.setStyle({'width':map_width+'px','height':map_height+'px','left':left_offset+'px','top':top_offset+'px'});}},showUSAMap:function(resultsData){if(z('usa_map_outer')){show('usa_map_outer');return false;}
var outer_div=document.createElement('div');outer_div.className='usa_map';outer_div.id='usa_map_outer';var div=document.createElement("div");div.id='usa_map_area';var img=document.createElement('img');img.id='usa_map_img';if(this.mapDivId=='result_seo_map_content')img.src='/images/v4/app/map/map-right-insets.png ';else img.src='/images/v4/app/map/usa_map_details.png';outer_div.appendChild(img);var isNewEngland=Mapview.newEnglandResultsData&&(results==Mapview.newEnglandResultsData.r);if(!isNewEngland)Mapview.newEngland=[];if(resultsData&&resultsData.r){for(var i=0;i<resultsData.r.length;i++){var temp_div=document.createElement('div');temp_div.className='map_marker';var a=document.createElement('a');var append=true;if(resultsData.r[i]instanceof Result.Person){this.constructMapMarkerForStaticMap(temp_div,a,resultsData.r[i]);}else if(resultsData.r[i]instanceof Result.Group){var group=resultsData.r[i];if(group.location==MARYLAND)this.hasMaryland=true;var g=Locations[group.location];if(g&&g[2]&&!isNewEngland){Mapview.newEngland.push(group);append=false;}
else{this.constructMapMarkerForStaticMap(temp_div,a,group);}}
if(append){temp_div.appendChild(a);div.appendChild(temp_div);}}
if(!Mapview.isNewEngland){var temp_div=document.createElement('div');temp_div.className='map_marker';var a=document.createElement('a');if(Mapview.newEngland.length==1){this.constructMapMarkerForStaticMap(temp_div,a,Mapview.newEngland[0]);}
else if(Mapview.newEngland.length>1){var count=0;for(var i=0;i<Mapview.newEngland.length;i++)count+=Mapview.newEngland[i].count;this.constructMapMarkerForStaticMap(temp_div,a,new Result.Group(-1,count,'Region',NEW_ENGLAND));}
if(Mapview.newEngland.length>0){temp_div.appendChild(a);div.appendChild(temp_div);}}}
outer_div.appendChild(div);if(z(this.mapDivId)){z(this.mapDivId).appendChild(outer_div);}},constructMapMarkerForStaticMap:function(outer_div,a_tag,node){a_tag.id='marker_'+node.nodeId;if(node.location==NEW_ENGLAND)outer_div.id="new_england";else outer_div.id=node.state.toLowerCase().gsub(/\s+/,'_').gsub(/\,/,'');if(node instanceof Result.Group){outer_div.onclick=function(){return Mapview.groupClicked(this);}.bind(node);outer_div.onmouseover=function(){return Mapview.groupMarkerOver(this);}.bind(node);outer_div.onmouseout=function(){return Mapview.groupMarkerOut(this);}.bind(node);a_tag.className='group_marker';a_tag.innerHTML=node.count;}else{outer_div.onclick=function(){return Mapview.personClicked(this);}.bind(node);outer_div.onmouseover=function(){return Mapview.personMarkerOver(this);}.bind(node);outer_div.onmouseout=function(){return Mapview.personMarkerOut(this);}.bind(node);a_tag.title=node.street;a_tag.className='person_marker';}},updateResults:function(resultsData,divId,skipMap,skipSideBar){this.loaded=true;if(!this.personId)this.constructLocationNav(resultsData.l);this.locations=resultsData.l;var current_level=this.getCurrentLevel(resultsData);if((current_level=="States"&&resultsData.r.length>1)||!skipMap){if(current_level=="States"&&resultsData.r.length>1){this.showUSAMap(resultsData);Event.observe(window,'load',Mapview.usaMapResizer);Event.observe(window,'resize',Mapview.usaMapResizer);if(window.orientation!=undefined)
window.onorientationchange=function(){setTimeout(Mapview.usaMapResizer,500);}
else
Mapview.usaMapResizer();setTimeout(Mapview.usaMapResizer,500);}else if(resultsData.r.length==1){this.showProfile(resultsData.r[0]);}else{hide('usa_map_outer');BingMap.loadMap(this.mapDivId);this.showMap();BingMap.constructMapMarkers(resultsData.r);}}
if(resultsData.r.length==0){this.showNoResults(resultsData);var nor=document.createElement('div');nor.id='no_results';if(this.possibleMatches&&this.possibleMatches[0]){nor.innerHTML+='<br/><br/>Perhaps you meant one of these possible matches:<br/>';for(var i=0;i<this.possibleMatches.length;i++){if(this.possibleMatches[i]=='-'){if(i>0)nor.appendChild(document.createElement('br'));}else{var a=document.createElement('a');a.href='/search?q='+this.possibleMatches[i].replace(/,+USA/,'')+(this.trackingParams?'&'+this.trackingParams:'');a.innerHTML=this.possibleMatches[i];a.className='possible_match';nor.appendChild(a);}}}
removeChildren('did_you_mean');z('did_you_mean').appendChild(nor);current_level='';}else{var s=document.createElement('div');for(var i=0;i<resultsData.r.length;i++){s.appendChild(resultsData.r[i].element(current_level));if(resultsData.r[i]instanceof Result.Person)
this.people[resultsData.r[i].id]=resultsData.r[i];}
if(!skipSideBar)
removeChildren(divId).appendChild(s);if(subScroll){setTimeout(function(){subScroll.refresh();},1000);}}},navigateToSubNav:function(tab_id,sub_nav_id){sub_nav_items=SUB_NAV[tab_id];for(i=0;i<sub_nav_items.length;i++){hide(sub_nav_items[i]);remove_class(document.getElementById(sub_nav_items[i]+'_sub_nav'),'selected');}
show(sub_nav_id);add_class(document.getElementById(sub_nav_id+'_sub_nav'),'selected');return false;},slideResults:function(resultsData){this.sliding=true;var n=z('result_names_new');var e=z('result_names_existing');if(resultsData){var idx=this.stack.indexOf(this.subquery);if(idx==-1){this.stack.push(this.subquery);this.slideDir=1;}else{this.stack=this.stack.splice(0,idx+1);this.slideDir=-1;}
this.slideAmount=0;n.scrollTop=0;this.updateResults(resultsData,n,true);n.style.left=(this.slideDir*100)+'%';e.style.left='0';e.style.overflow='hidden';show(n);}else{this.slideAmount+=10;n.style.left=(this.slideDir*100-this.slideDir*this.slideAmount)+'%';e.style.left=(0-this.slideDir*this.slideAmount)+'%';}
if(this.slideAmount<100){setTimeout(function(){this.slideResults();}.bind(this),30);}else{if(this.slideAmount<=100)removeChildren(e).appendChild(n.removeChild(n.firstChild));e.style.left='0';e.scrollTop=0;e.style.overflow='';hide(n);this.sliding=false;if(!this.personId)
setTimeout(function(){if(this.getCurrentLevel(this.cache[this.subquery])=='States'){if(BingMap.map)BingMap.map.setView({width:1,height:1});this.showUSAMap(this.cache[this.subquery].r);this.usaMapResizer();add_class(z('usa_map_outer'),'high_zindex');}else{hide('usa_map_outer');if(BingMap.map)BingMap.map.setView({width:null,height:null});remove_class(z('usa_map_outer'),'high_zindex');BingMap.loadMap(this.mapDivId);Mapview.showMap();BingMap.constructMapMarkers(this.cache[this.subquery].r);}}.bind(this),5);}},constructLocationNav:function(locations,person,profile){if(!person)person=null;if(locations&&(this.locations!=locations||this.locPerson!=person||profile)){this.locations=locations;this.locPerson=person;var crumbs=[];this.subtitle=null;var navs=(this.subquery!=NEW_ENGLAND&&this.isNewEngland?locations.sub(/^[^|]+/,this.newEnglandResultsData.l):locations).split('|');var isUSA=navs[0].match(/^1:USA/)?true:false;var city=this.query.split(',')[1];var back_nav_title='';var length=navs.length;var name=this.parseNameFromURL(document.location);if(city){crumbs.push(new BreadCrumb.Crumb('USA',null,'/search?q='+this.query.split(',')[0]+'&global=true'));}else{for(var i=0;i<length;i++){var nav=navs[i].split(':');var loc=nav[1].sub(/\(.+\) Area$/,'Area');if(isUSA){loc=loc.sub(/, [A-Z]{2}$/,'');}
var h='#'+nav[1].sub(/^Near /,'').sub(/ Area$/,'');if(city)h=h.sub(new RegExp('^'+city.strip()+'(, ..)?$'),'');crumbs.push(new BreadCrumb.Crumb(loc,nav[2],h));if(i==navs.length-(person?0:1)&&navs.length>1)this.subtitle=nav[1].sub(/ \(.+\)$/,'');}}
var isPersonProfile=false;if(person){this.subtitle=person.display_breadcrumb_address();var street=person.display_breadcrumb_address();crumbs.push(new BreadCrumb.Crumb(street));isPersonProfile=true;}
BreadCrumb.update(crumbs);this.updateBackNav(crumbs,isPersonProfile);}
this.updateTitle();},parseNameFromURL:function(location){var params=location.search.split('&');var result=false;for(var i=0;i<params.length;i++){if(params[i].match(/^\?q=/)){result=params[i].split(',')[0].split('=')[1];}}
return result;},updateBackNav:function(crumbs,isPersonProfile){var eb=document.getElementById('subheader_nav_back_button');if(eb){var l=crumbs.length;if(l==1||(crumbs[1].text.match(/^Near/)&&!isPersonProfile)){add_class(eb,'hidden');}else{if(l>1&&isPersonProfile){var num_down=2;eb.onclick=crumbs[l-num_down].onclick||null;eb.href=crumbs[l-num_down].href||null;remove_class(eb,'hidden');}else{eb.onclick=crumbs[l-2].onclick||null;eb.href=crumbs[l-2].href||null;remove_class(eb,'hidden');}}}},getCurrentLevel:function(resultsData){var current_level='';if(resultsData&&resultsData.r&&resultsData.r.length>0&&resultsData.l){var locations=resultsData.l.split('|');if(resultsData.r[0].type=='no_results_divider'||this.hasNearbyCities(resultsData))
return'Cities';if(locations[locations.length-1].match(/:USA:/)&&!Mapview.allInSameState(resultsData))
current_level='States';else if(this.hasMetros(resultsData))
current_level='Metro Areas + Cities';else
current_level='Cities';}
return current_level;},updateTitle:function(){if(!this.isSEO){var title='Spokeo - '+this.query+(this.subtitle?' - '+this.subtitle:'');if(document.title==title)return;document.title=title;if(window.dhtmlHistory!=null&&window.dhtmlHistory.isIE){}else{var h=document.location.hash.substring(1);if(h)document.location.hash=h;}}},groupMarkerOver:function(group){try{add_class(z('ga_'+group.nodeId),'hovered');add_class(z('marker_'+group.nodeId).parentNode.parentNode.parentNode,'high_zindex');}catch(e){}},groupMarkerOut:function(group){try{remove_class(z('ga_'+group.nodeId),'hovered');remove_class(z('marker_'+group.nodeId).parentNode.parentNode.parentNode,'high_zindex');}catch(e){}},personMarkerOver:function(person){try{add_class(z('pa_'+person.nodeId),'hovered');add_class(z('marker_'+person.nodeId).parentNode.parentNode.parentNode,'high_zindex');}catch(e){}},personMarkerOut:function(person){try{remove_class(z('pa_'+person.nodeId),'hovered');remove_class(z('marker_'+person.nodeId).parentNode.parentNode.parentNode,'high_zindex');}catch(e){}},resultOver:function(result){if(z('marker_'+result.nodeId)){try{add_class(z('marker_'+result.nodeId),'hovered');add_class(z('marker_'+result.nodeId).parentNode,'hovered');add_class(z('marker_'+result.nodeId).parentNode.parentNode.parentNode,'high_zindex');}catch(e){}}else{try{if(Locations[result.location][2])add_class(z('marker_-1'),'hovered');add_class(z('marker_-1').parentNode,'hovered');add_class(z('marker_-1').parentNode.parentNode.parentNode,'high_zindex');}catch(e){}}},resultOut:function(result){try{remove_class(z('marker_'+result.nodeId),'hovered');remove_class(z('marker_'+result.nodeId).parentNode,'hovered');remove_class(z('marker_'+result.nodeId).parentNode.parentNode.parentNode,'high_zindex');}catch(e){}try{if(Locations[result.location][2])remove_class(z('marker_-1'),'hovered');remove_class(z('marker_-1').parentNode,'hovered');remove_class(z('marker_-1').parentNode.parentNode.parentNode,'high_zindex');}catch(e){}},groupClicked:function(group){if(group&&group.location){if(this.isSEO){document.location.href='/search?q='+encodeURIComponent(this.query.replace(/\+/g,' ')).replace(/ |%20/g,'+')+(this.trackingParams?'&'+this.trackingParams:'')+'#'+group.location.replace(/ |%20/g,'+');}else{this.goToHash(group.location);}}
return false;},personClicked:function(person){if(person&&person.id){if(this.isSEO)
document.location.href='/search?q='+encodeURIComponent(person.name).replace(/%20/,'+')+(this.trackingParams?'&'+this.trackingParams:'')+'#'+this.subquery.replace(/ |%20/g,'+')+':'+person.id;else this.goToProfile(person.id);}
return false;},replaceHeaderWithName:function(person){var sub_header_object=z('name_search_subheader');if(sub_header_object){var sub_header_name=sub_header_object.innerHTML;}
if(sub_header_name=="Table of Contents"||sub_header_name=="<span>Table of Contents</span>"){remove_class(sub_header_object,"toc_subheader");if(person){sub_header_object.innerHTML='<span>'+person.name+'</span>';}
else if(this.personId){if(this.personId){var person=this.getAndCachePerson(this.personId);if(person){sub_header_object.innerHTML='<span>'+person.name+'</span>';}}}else{sub_header_object.innerHTML="<span>"+Mapview.query.replace(/[^a-z]+$/i,'')+"</span>";}}else if(sub_header_object){sub_header_object.innerHTML="<span>"+Mapview.query.replace(/[^a-z]+$/i,'')+"</span>";}},showMap:function(person){this.replaceHeaderWithName(person);if(z('result_map')&&z('result_map').style.visibility=='hidden'&&!z('result_seo_map_content')){hide('result_profile','profile_table_of_contents');show('result_map','result_names_existing','subheader_location','subheader_nav_back');remove_class(z('content'),'profile_view');}
if(!this.personId)this.constructLocationNav(this.locations,person,false);this.focusResult(person);},showHouseHoldProfile:function(householdPerson,person){if(!householdPerson){this.updateProfile(person);householdPerson=this.householdPeople[this.householdPersonId];}
if(householdPerson){this.showProfile(householdPerson);}
else{this.goToProfile(this.personId);}},showTableOfContents:function(){removeChildren($('result_names_existing'));$('result_names_existing').appendChild($('profile_table_of_contents').firstChild.cloneNode(true));},showProfile:function(person){if(person&&person.id){if(this.doNotSlide==true){this.doNotSlide=false;}else if(!(/table_of_contents/.test(z('result_names_existing').innerHTML))){this.slideAmount=0;this.slideDir=1;e=z('result_names_existing');n=z('result_names_new');e.style.overflow='hidden';n.style.left=(this.slideDir*100)+'%';e.style.left='0';e.style.overflow='hidden';show(n);removeChildren($('result_names_new'));$('result_names_new').appendChild($('profile_table_of_contents').firstChild.cloneNode(true));this.slideResults();}
show('result_profile');z('result_map').style.visibility='hidden';hide('usa_map_outer');hide('subheader_location','subheader_nav_back');add_class(z('content'),'profile_view');z('result_profile_content').scrollTop=0;z('name_search_subheader').innerHTML='Table of Contents';this.updateProfile(person);z('mobile_layout_link').setAttribute('href','/profile?dp='+person.id+'&q='+this.query+'&layout=mobile'+(this.trackingParams?'&'+this.trackingParams:''));add_class(z('name_search_subheader'),'toc_subheader');if(is_MSIE)
touchIE(z('result_profile_content'));setTimeout(this.fixProfileImages.bind(this),4000);this.focusResult(person);person=eval(z("profile_person_side_bar").innerHTML);this.constructLocationNav(this.locations,person,true);this.updateToNameSearchContent(person);showsubmenutrigger();if(mainScroll){mainScroll.refresh();}}},focusResult:function(person){if(person){var r=z('result_names_existing');var p=person.element();var maxScroll=p.offsetTop>r.scrollHeight-r.offsetHeight?r.scrollHeight-r.offsetHeight:p.offsetTop;if(r.scrollTop>p.offsetTop)
r.scrollTop=maxScroll;else if(r.scrollTop<p.offsetTop+p.offsetHeight-r.offsetHeight)
r.scrollTop=(r.scrollTop>p.offsetTop-r.offsetHeight)?p.offsetTop+p.offsetHeight-r.offsetHeight:maxScroll;}
try{remove_class(z('pa_'+this.people[this.currentPersonId].nodeId),'selected');}catch(e){}
try{add_class(z('pa_'+person.nodeId),'selected');}catch(e){}
this.currentPersonId=person?person.id:null;},updateProfile:function(person){if(person&&person.id){var profile=this.profiles[person.id];if(profile){this.profileIds=this.profileIds.without(person.id);this.profileIds.push(person.id);}else{var req=new Ajax.Request('/mapview/profile',{parameters:'dp='+person.id+'&q='+(this.query||'').split(',')[0],asynchronous:false,evalScripts:true});profile=(req&&req.transport&&req.transport.responseText)?req.transport.responseText:'<br/>&nbsp;&nbsp;Could not load profile.';if(profile=='-')return false;this.profiles[person.id]=profile;this.profileIds.push(person.id);if(this.profileIds.length>5)
this.profiles[this.profileIds.shift()]=null;}
z('result_profile_content').innerHTML=profile;person=eval(z("profile_person_side_bar").innerHTML);if(person.hasEmail){var pi=z('profile_email_images');if(pi&&!pi.innerHTML)this.emailSearch(person.id);}
this.loadHouseHoldPeopleFromDOM();this.initializeFuzzyMap(person,this.premium,null,null,(person?person.city+', '+person.state:null),'name');NeighborsMap.init();var neighbor_js=z('neighbors_js');if(neighbor_js){var neighbors=eval(neighbor_js.innerHTML);NeighborsMap.showNeighborsMap('profile_neighbors',neighbors[0],neighbors[1],neighbors[2],neighbors[3],neighbors[4]);}}
return true;},loadHouseHoldPeopleFromDOM:function(){this.householdPeople={};try{var householdPeople=eval(z('profile_household_people_js').innerHTML);if(householdPeople&&householdPeople instanceof Array)
for(var i=0;i<householdPeople.length;i++)
this.householdPeople[householdPeople[i].id]=householdPeople[i];}catch(e){}},emailSearch:function(personId){setTimeout(function(){new Ajax.Request('/mapview/email_profile_images',{parameters:'dp='+personId+'&q='+(this.query||'').split(',')[0],asynchronous:true,onComplete:function(req){Mapview.emailSearchComplete(req,personId);}});},5000);},emailSearchComplete:function(req,personId){if(personId==this.currentPersonId){var pi=z('profile_email_images');if(pi){var html=(req&&req.transport)?req.transport.responseText:null;if(html){pi.innerHTML=html;show('profile_photos',pi);}else{pi.parentNode.removeChild(pi);}
this.profiles[personId]=z('result_profile_content').innerHTML;}}},fixProfileImages:function(){var pi=z('profile_images');if(pi){var images=pi.getElementsByTagName('img');for(var i=0;i<images.length;i++)
if(images[i].complete==false||images[i].clientHeight==0||images[i].clientWidth==0||images[i].naturalHeight==0||images[i].naturalWidth==0)
images[i].src='/images/single/blank_pic.gif';}},initializeFuzzyMap:function(person,premium,latitude,longitude,location,type){var loc=(person?person.street+', ':'')+(person?person.location+' ':(location?location+' ':''))+(person?person.zip:'');if(loc)
loc=loc.replace(/^\s+|\s+$/g,'');var street=(person?(person.streetNum?person.streetNum+' ':'')+person.street:' ');var citystate=(person?person.location:(location?location:''));var zip=(person?person.zip:'');if(street=="<i>unknown address</i>")
street='';if(zip.length==4)
zip="0"+zip;var lat=((person&&person.latitude)?person.latitude:(latitude?latitude:0));var lng=((person&&person.longitude)?person.longitude:(longitude?longitude:0));TripleMap.init(z('profile_streetview'),loc,street,citystate,zip,lat,lng,premium,type);},getEmail:function(personId){Spokeo.getEmail(personId);this.profiles[personId]=z('result_profile_content').innerHTML;return false;},fcra:function(personId,element,mapview){var agree=confirm("I understand and agree that: This section is intended for entertainment purposes only.  All data is derived from public sources. Spokeo does not verify or evaluate each piece of information offered, or make any guarantees about its accuracy, authenticity, legality, or the time frame in which it may have been collected or updated.  Spokeo is not a credit reporting agency and does not offer consumer reports. Spokeo does not possess or have access to secure or private financial information, such as Social-Security numbers, driver’s license numbers, bank accounts, or credit scores. None of the information offered by Spokeo is to be considered for purposes of determining a consumer's eligibility for credit, insurance, employment, or for any other purpose authorized under the FCRA. Spokeo makes no warranties or guarantees whatsoever regarding the information provided. Any reliance upon the information is at my own risk. I further acknowledge that I have read, understand, and agree to all of the provisions specified in Spokeo’s Terms of Use, Privacy Policy and plan specifications.")
if(agree){var params='dp='+personId+'&q='+(this.query||'').split(',')[0];if(mapview)
var req=new Ajax.Request("/mapview/acknowledge_wealth_fcra_map_view",{asynchronous:false,evalScripts:false,parameters:params});else{var req=new Ajax.Request("/mapview/acknowledge_wealth_fcra",{asynchronous:false,evalScripts:false,parameters:params});}
if(req.transport.responseText)z(element).innerHTML=req.transport.responseText;}
return false;}};Result={};Result.Group=Class.create();Result.Group.prototype={initialize:function(nodeId,count,locationType,location,latitude,longitude,is_nearby_city,state,is_mobile){this.nodeId=nodeId;this.count=count;this.locationType=locationType;this.location=location;this.latitude=latitude;this.longitude=longitude;this.is_nearby_city=is_nearby_city;this.display_location=this.location?this.location.sub(/ \(.+\)$/,'').sub(/District of Columbia/,'Washington, DC'):this.location;this.state=state;this.is_mobile=is_mobile;},element:function(current_level){var e=z('node_'+this.nodeId);if(e)return e;var div=document.createElement('div');div.className='result_group';div.id='node_'+this.nodeId;var a=document.createElement('a');a.title=this.display_location;a.id='ga_'+this.nodeId;a.className='list_result';if(this.is_nearby_city){a.href='/search?q='+Mapview.personName+(Mapview.trackingParams?'&'+Mapview.trackingParams:'')+'#'+(this.location?this.location.replace(/ |%20/g,'+'):'');}else{a.href='#'+(this.location?this.location.replace(/ |%20/g,'+'):'');}
if(!this.is_mobile){a.onclick=function(){return Mapview.groupClicked(this);}.bind(this);a.onmouseover=function(){return Mapview.resultOver(this);}.bind(this);a.onmouseout=function(){return Mapview.resultOut(this);}.bind(this);}else{a.href="/search?d="+this.location+"&q="+Mapview.query+(Mapview.trackingParams?'&'+Mapview.trackingParams:'')+'&layout=mobile';}
var icon=document.createElement('div');icon.className='result_icon group_icon';var matches=document.createElement('div');matches.className='result_desc';matches.innerHTML=this.count+' Found';var location=document.createElement('div');location.className='result_title';if(current_level=='Metro Areas + Cities')
location.innerHTML=this.display_location.replace(/, \S{2}$/,'')+' Area';else
location.innerHTML=this.display_location;var drilldown=document.createElement('div');drilldown.className='result_icon drilldown';a.appendChild(icon);a.appendChild(matches);a.appendChild(location);a.appendChild(drilldown);div.appendChild(a);return div;}};Result.Divider=Class.create();Result.Divider.prototype={initialize:function(type,main_text,right_text){this.type=type;this.main_text=main_text;this.right_text=right_text;},element:function(current_level){var div=document.createElement('div');if(this.type=='nearby_city_divider')
div.className='result_divider nearby_city_divider';else if(this.type=='all_results_divider')
div.className='result_divider all_results_divider';else if(this.type=='no_results_divider')
div.className='result_divider no_results_divider';var icon=document.createElement('div');icon.className='icon';var h2=document.createElement('h2');h2.innerHTML=this.main_text;var h3=document.createElement('h3');h3.innerHTML=this.right_text;div.appendChild(icon);div.appendChild(h2);div.appendChild(h3);return div;}};Result.Famous=Class.create();Result.Famous.prototype={initialize:function(name,occ,count,url){this.name=name;this.occ=occ;this.count=count;this.url=url;},element:function(){var div=document.createElement('div');div.className='result_person famous_person';var a=document.createElement('a');a.title='Famous '+(this.count==1?'Person':'People')+' named '+this.name;a.href=this.url;a.className='list_result';div.appendChild(a);var icon=document.createElement('div');icon.className='result_icon person_icon';var citystate=document.createElement('div');citystate.className='result_title with_subtitle';var street=document.createElement('div');street.className='result_subtitle';citystate.innerHTML=this.name;street.innerHTML=this.occ;var matches=document.createElement('div');matches.className='result_desc';matches.innerHTML='';var drilldown=document.createElement('div');drilldown.className='result_icon drilldown';a.appendChild(icon);a.appendChild(citystate);a.appendChild(street);a.appendChild(matches);a.appendChild(drilldown);return div;}};Result.Person=Class.create();Result.Person.prototype={initialize:function(nodeId,id,name,locationType,location,street,zip,latitude,longitude,age,hasEmail,streetNum,state,is_mobile,phoneNumber,emailAddress,homeValue,gender,relativesCount,ageDisplay,addressHistoryCount,isPremium,showNew,haveQuota){this.nodeId=nodeId;this.id=id;this.name=name;this.age=age;this.locationType=locationType;this.location=location;this.street=street;this.zip=zip;this.latitude=latitude;this.longitude=longitude;this.hasEmail=hasEmail;this.streetNum=streetNum;this.state=state?state.sub(/District of Columbia/,'Washington, DC'):state;this.is_mobile=is_mobile;this.phoneNumber=phoneNumber;this.emailAddress=emailAddress;this.homeValue=homeValue;this.gender=gender;this.relativesCount=relativesCount;this.ageDisplay=ageDisplay;this.addressHistoryCount=addressHistoryCount;this.isPremium=isPremium;this.showNew=showNew;this.haveQuota=haveQuota;},city:function(){if(this._city==undefined&&this.location)
this._city=this.location.split(',')[0];return this._city;},stateAbbreviation:function(){if(this._stateAbbreviation==undefined&&this.location)
this._stateAbbreviation=this.location.split(',')[1].strip();return this._stateAbbreviation;},display_street:function(){if(this.street)
this._display_street=this.street.replace(/^(\d|\*)+ /,'').replace(/,? (unit|apt) [0-9a-z]+$/i,'');else
this._display_street='<i>unknown address</i>';return this._display_street;},display_profile_address:function(){if(Spokeo.runSplitTest(Mapview.uiSplitTests,'hideAddress')&&(this.isPremium<=0))
return'Get Full Address';if((this.street)&&(this.street!="")&&(this.isPremium<=0))
if(/PO\sBox/.test(this.street)){this._display_profile_street="PO Box *****"}else{this._display_profile_street="**** "+this.street.replace(/^\s+/,'').replace(/^(\d|\*)+ /,'').replace(/,? (unit|apt) [0-9a-z]+$/i,'');}
else if((this.street)&&(this.street!="")&&(this.isPremium>0))
this._display_profile_street=this.street;else
this._display_profile_street='Unknown Street';return this._display_profile_street;},display_breadcrumb_address:function(){if(Spokeo.runSplitTest(Mapview.uiSplitTests,'hideAddress'))
return this.name;else
return this.display_profile_address();},element:function(current_level){var e=z('node_'+this.nodeId);if(e)return e;var div=document.createElement('div');div.className='';div.id='node_'+this.nodeId;var a=document.createElement('a');a.title=this.location;a.id='pa_'+this.nodeId;if(!this.is_mobile){a.href='#'+(Mapview.subquery||'')+':'+this.id;a.onclick=function(){return Mapview.personClicked(this);}.bind(this);a.onmouseover=function(){return Mapview.resultOver(this);}.bind(this);a.onmouseout=function(){return Mapview.resultOut(this);}.bind(this);}else{a.href='/profile?dp='+this.id+'&q='+Mapview.query+'&layout=mobile'+(this.trackingParams?'&'+this.trackingParams:'');}
a.className='list_result';div.appendChild(a);var icon=document.createElement('div');icon.className='result_icon person_icon';var citystate=document.createElement('div');citystate.className='result_title with_subtitle';if(current_level=='States'||Spokeo.runSplitTest(Mapview.uiSplitTests,'hideAddress'))
citystate.className='result_title';var street=document.createElement('div');street.className='result_subtitle';if(current_level=='States'){citystate.innerHTML=this.state;}else{citystate.innerHTML=this.city()+', '+this.stateAbbreviation();street.innerHTML=this.display_street();}
var matches=document.createElement('div');matches.className='result_desc';matches.innerHTML=this.name;var drilldown=document.createElement('div');drilldown.className='result_icon drilldown';a.appendChild(icon);a.appendChild(citystate);a.appendChild(street);a.appendChild(matches);a.appendChild(drilldown);return div;}};Result.Place=Class.create();Result.Place.prototype={initialize:function(id,lat,lng,tweeter,tweet,time,arrow){this.id=id;this.lat=lat;this.lng=lng;this.tweeter=tweeter;this.tweet=tweet;this.time=time;this.arrow=arrow;},element:function(){var a=document.createElement('a');a.id='pm_'+this.id;a.className='marker';var d1=document.createElement('div');d1.className='place_marker arrow_'+this.arrow;a.appendChild(d1);return a;},navElement:function(){var a=document.createElement('a');a.id='pn_'+this.id;a.className='place';a.onclick=function(){PlacesMap.selectAndPan(this.id);return false;}.bind(this)
a.onmouseover=function(){PlacesMap.displayAndPan(this.id);return false;}.bind(this)
var s1=document.createElement('span');s1.className='time';s1.innerHTML=this.time;var s2=document.createElement('span');s2.className='tweet';s2.innerHTML=this.tweet;var d=document.createElement('div');d.className='zoom-container';var s3=document.createElement('span');s3.className='zoom';d.appendChild(s3);a.appendChild(s1);a.appendChild(s2);a.appendChild(d);return a;},infoWindowHTML:function(){var d=document.createElement('div');var d1=document.createElement('div');d1.className='marker_info_wrapper';var d2=document.createElement('div');d2.className='marker_content';var d3=document.createElement('div');d3.className='marker_tweet';d3.innerHTML=this.tweet;var d4=document.createElement('div');d4.className='marker_whowhen';d4.innerHTML=this.time+' by '+'<b>'+this.tweeter+'</b>';var d5=document.createElement('div');d5.className='marker_zoom';var d6=document.createElement('div');d6.className='info_arrow';d2.appendChild(d3);d2.appendChild(d4);d2.appendChild(d5);d1.appendChild(d2);d1.appendChild(d6);d.appendChild(d1);return d.innerHTML;}};function RG(nodeId,count,locationType,location,latitude,longitude,is_nearby_city,state,is_mobile){return new Result.Group(nodeId,count,locationType,location,latitude,longitude,is_nearby_city,state,is_mobile);}
function RP(nodeId,id,name,locationType,location,street,zip,latitude,longitude,age,hasEmail,streetNum,state,is_mobile,phoneNumber,emailAddress,homeValue,gender,relativesCount,ageDisplay,addressHistoryCount,isPremium,showNew,haveQuota){return new Result.Person(nodeId,id,name,locationType,location,street,zip,latitude,longitude,age,hasEmail,streetNum,state,is_mobile,phoneNumber,emailAddress,homeValue,gender,relativesCount,ageDisplay,addressHistoryCount,isPremium,showNew,haveQuota);}
function RD(type,main_text,right_text){return new Result.Divider(type,main_text,right_text);}
function RF(name,occ,count,url){return new Result.Famous(name,occ,count,url);}
function Place(id,lat,lng,tweeter,tweet,time,arrow){return new Result.Place(id,lat,lng,tweeter,tweet,time,arrow);}
BingMap={map:null,defaultBounds:null,zoomedBounds:null,loadMap:function(divId){if(!this.map){var div=z(divId);if(div){if(window.Microsoft&&window.Microsoft.Maps){this.defaultBounds=this.defaultBounds||new Microsoft.Maps.LocationRect.fromCorners(new Microsoft.Maps.Location(48.69,-129.02),new Microsoft.Maps.Location(28.52,-62.40));var mapOptions={credentials:bing_key,disableKeyboardInput:true,showScalebar:false,showMapTypeSelector:false,showDashboard:false,showBreadcrumb:false,mapTypeId:Microsoft.Maps.MapTypeId.road,bounds:this.defaultBounds,disableKeyboardInput:true,enableClickableLogo:false,enableSearchLogo:false}
var map=new Microsoft.Maps.Map(div,mapOptions);this.map=map;this.reCenter();map.nodeMarkers={};}else{div.innerHTML='<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%"><tr><td valign="middle" align="center">'+'<i>Oops, your browser cannot<br/>display Bing Maps!<br/><br/>'+'<img src="/images/icons/firefox.gif" style="position:relative;top:4px;" /> '+'<a href="http://www.mozilla.com/firefox/" target="spokeo_external">Get Firefox &raquo;</a></i>'+'</td></tr></table>';}}}},reCenter:function(){var map=this.map;if(map){if(this.normalBounds){var n=map.entities?map.entities.getLength():0;if(n==1){var lat=map.entities.get(0).getLocation().latitude;var lon=map.entities.get(0).getLocation().longitude;this.zoomedBounds=Microsoft.Maps.LocationRect.fromCorners(new Microsoft.Maps.Location(lat-1,lon-1),new Microsoft.Maps.Location(lat+1,lon+1));}
else if(!this.zoomedBounds&&n>20&&Mapview.subquery){var lats=[];var lngs=[];for(var i=0;i<n;i++){lats.push(map.entities.get(i).getLocation().latitude);lngs.push(map.entities.get(i).getLocation().longitude);}
map.medianCenter=new Microsoft.Maps.Location(lats.median(),lngs.median());map.allMarkers=map.allMarkers.sort(this.distanceSort);var percent=n>75?0.5:n>50?0.6:n>35?0.7:0.8;var locations=[]
for(var i=0;i<=parseInt(n*percent);i++)
locations.push(this.map.entities.get(i).getLocation());this.zoomedBounds=Microsoft.Maps.LocationRect.fromLocations(locations);}else{var locations=[]
for(var i=0;i<this.inBounds.length;i++){locations.push(this.inBounds[i].getLocation());}
this.normalBounds=Microsoft.Maps.LocationRect.fromLocations(locations);}
map.setView({bounds:(this.zoomedBounds||this.normalBounds)});}}},distanceSort:function(m1,m2){var d1=distance(m1.getLocation(),this.map.getCenter());var d2=distance(m2.getLocation(),this.map.getCenter());if(d1==d2)return 0;return d1>d2?1:-1;},constructMapMarkers:function(results){var map=this.map;if(map){this.removeMapMarkers();this.normalBounds=results.length>0?Microsoft.Maps.LocationRect.fromLocations([new Microsoft.Maps.Location()]):this.defaultBounds;this.zoomedBounds=null;map.allMarkers=[];this.inBounds=[];this.outOfBounds=[];this.hasMaryland=false;this.dcGroup=null;var isNewEngland=Mapview.newEnglandResultsData&&(results==Mapview.newEnglandResultsData.r);if(!isNewEngland)Mapview.newEngland=[];for(var i=0;i<results.length;i++){if(results[i]instanceof Result.Person)
this.addPersonMarker(map,results[i]);else if(results[i]instanceof Result.Group)
this.addGroupMarker(map,results[i],isNewEngland);}
if(this.outOfBounds.length>0&&this.inBounds.length<5)
for(var i=0;i<this.outOfBounds.length;i++)
this.inBounds.push(this.outOfBounds[i]);if(!Mapview.isNewEngland){if(Mapview.newEngland.length==1)
this.addGroupMarker(map,Mapview.newEngland[0],true);else if(Mapview.newEngland.length>1)
this.addNewEnglandMarker(map,Mapview.newEngland);}
if(this.dcGroup&&!this.hasMaryland)
this.addGroupMarker(map,this.dcGroup,true);this.reCenter();}},removeMapMarkers:function(){if(this.map&&this.map.entities)
this.map.entities.clear();},addPersonMarker:function(map,person){if(person.latitude&&person.longitude)
this.addMarker(map,new PersonMarker(person),person.nodeId);},addGroupMarker:function(map,group,forceAdd){if(group.location==DC&&!forceAdd)return this.dcGroup=group;if(group.location==MARYLAND)this.hasMaryland=true;var g=Locations[group.location];if(g&&g[2]&&!forceAdd)Mapview.newEngland.push(group);else if(g)this.addGroupMarkerAtPoint(map,group,new Microsoft.Maps.Location(g[0],g[1]));else if(group.latitude&&group.longitude)this.addGroupMarkerAtPoint(map,group);},addGroupMarkerAtPoint:function(map,group,latlng){var marker=new GroupMarker(group,latlng);this.addMarker(map,marker,group.nodeId);if(group.location==NEW_ENGLAND)
for(var i=0;i<Mapview.newEngland.length;i++)
map.nodeMarkers[Mapview.newEngland[i].nodeId]=marker;},addNewEnglandMarker:function(map,groups){var count=0;for(var i=0;i<groups.length;i++)count+=groups[i].count;this.addGroupMarker(map,new Result.Group(-1,count,'Region',NEW_ENGLAND));},addMarker:function(map,marker,nodeId,ignoreBoundsCheck){var latlng=marker.getLocation();marker.draw(map);map.nodeMarkers[nodeId]=marker;if(ignoreBoundsCheck||this.defaultBounds.contains(latlng)){this.inBounds.push(marker);}else{this.outOfBounds.push(marker);}}};SeoMap={bounds:null,map:null,setupDefaultOptions:function(){return{credentials:bing_key,disableKeyboardInput:true,showScalebar:false,disableKeyboardInput:true,showMapTypeSelector:false,showDashboard:false,showBreadcrumb:false,mapTypeId:Microsoft.Maps.MapTypeId.road,bounds:this.defaultBounds,enableClickableLogo:false,enableSearchLogo:false}},showAreaCodeTopCitiesMap:function(mapDiv,locations,state){var div=z(mapDiv);if(locations.length>0){var options=this.setupDefaultOptions();options.width=921;options.height=360;this.map=new Microsoft.Maps.Map(div,options);var map_locations=[];for(var i=0;i<locations.length;i++){var psm=new PhoneSeoMarker(locations[i][3],locations[i][2],locations[i][4],'/'+locations[i][3].substring(0,3)+'-'+locations[i][3].substring(3,6)+'-phone-lookup',new Microsoft.Maps.Location(locations[i][0],locations[i][1]),'group_marker');psm.draw(this.map);map_locations.push(psm.getLocation());}
options.bounds=Microsoft.Maps.LocationRect.fromLocations(map_locations);this.map.setView(options);}else{}},showStateSeoMap:function(mapDiv,locations){var div=z(mapDiv);this.map=new Microsoft.Maps.Map(div,this.setupDefaultOptions());var map_locations=[];for(var i=0;i<locations.length;i++){if(!locations[i])break
var psm=new PhoneSeoMarker(locations[i][3],locations[i][2],locations[i][3]+" Area Code",'/'+locations[i][3]+'-area-code',new Microsoft.Maps.Location(locations[i][0],locations[i][1]),'phone_marker');psm.draw(this.map);map_locations.push(psm.getLocation());}
var options=this.map.getOptions();options.bounds=Microsoft.Maps.LocationRect.fromLocations(map_locations);this.map.setView(options);},directoryNavMarkerOver:function(id){if(z(id+"_area_code"))
add_class(z(id+"_area_code"),'active');if(z('marker_'+id))
add_class(z('marker_'+id).parentNode,'hovered');},directoryNavMarkerOut:function(id){if(z(id+"_area_code"))
remove_class(z(id+"_area_code"),'active');if(z('marker_'+id))
remove_class(z('marker_'+id).parentNode,'hovered');}};if(window.Microsoft){TripleMap={map:null,latitude:null,longitude:null,lat_lng:null,div:null,full_address:null,birds_eye:false,selected_map_type:null,search_type:null,mapOptions:{credentials:bing_key,showScalebar:false,disableKeyboardInput:true,showMapTypeSelector:false,showDashboard:false,showBreadcrumb:false,mapTypeId:Microsoft.Maps.MapTypeId.road,zoom:15,disableZooming:true,center:this.lat_lng,enableClickableLogo:false,enableSearchLogo:false},init:function(div,full_address,street,citystate,zip,latitude,longitude,premium,type){this.latitude=latitude;this.full_address=full_address;this.longitude=longitude;this.premium=premium;this.div=div;this.geoCode();this.birds_eye_link=z('birdseye_map_link');this.road_map_link=z('road_map_link');this.satellite_map_link=z('satellite_map_link');this.search_type=type;},showMap:function(){if(this.div){this.mapOptions.center=this.lat_lng;if(!this.premium){this.mapOptions.disableMouseInput=true;this.mapOptions.showDashboard=false;add_class(this.satellite_map_link,'disabled');}
var map=new Microsoft.Maps.Map(this.div,this.mapOptions);this.map=map;this.road_map_link.onclick=function(){TripleMap.showRoadView();}
if(this.premium)
this.satellite_map_link.onclick=function(){TripleMap.showSatelliteView();}
if(this.birds_eye){this.birds_eye_link.onclick=function(){TripleMap.showBirdsEyeView();}
if(this.search_type=='name')
this.showRoadView();else
this.showBirdsEyeView();}else{hide('birdseye_map_link');this.showRoadView();}}
this.tryShowSideProfileMap();},tryShowSideProfileMap:function(){var profile_side_view=z('profile_side_view');if(profile_side_view){var k={credentials:bing_key,showScalebar:false,disableKeyboardInput:true,showMapTypeSelector:false,showDashboard:false,showBreadcrumb:false,mapTypeId:Microsoft.Maps.MapTypeId.road,zoom:15,center:this.lat_lng,enableClickableLogo:false,enableSearchLogo:false}
k.disableMouseInput=true;k.showDashboard=false;k.showCopyright=false;k.zoom=(this.birds_eye?20:15);k.mapTypeId=(this.birds_eye?Microsoft.Maps.MapTypeId.birdseye:Microsoft.Maps.MapTypeId.aerial);new Microsoft.Maps.Map(profile_side_view,k);}},showBirdsEyeView:function(){this.resetSelectedMapTypeLink();this.map.entities.clear();this.map.setView({center:this.lat_lng,zoom:19,mapTypeId:Microsoft.Maps.MapTypeId.birdseye});add_class(this.birds_eye_link,'selected');this.selected_map_type='birdseye';},showSatelliteView:function(){this.drawMarker();this.resetSelectedMapTypeLink();var options={mapTypeId:Microsoft.Maps.MapTypeId.aerial};options.zoom=(this.premium?19:15);this.map.setView(options);add_class(this.satellite_map_link,'selected');this.selected_map_type='satellite';},showRoadView:function(){this.drawMarker();this.resetSelectedMapTypeLink();var options={mapTypeId:Microsoft.Maps.MapTypeId.road};options.zoom=15;this.map.setView(options);add_class(this.road_map_link,'selected');this.selected_map_type='road';},resetSelectedMapTypeLink:function(){switch(this.selected_map_type)
{case'road':remove_class(this.road_map_link,'selected');break;case'satellite':remove_class(this.satellite_map_link,'selected');break;case'birdseye':remove_class(this.birds_eye_link,'selected');break;}},drawMarker:function(){if(this.map.entities.getLength()==0){var marker=(this.premium?new PersonMarkerLight(this.lat_lng,this.full_address):new AreaMarker(this.lat_lng));marker.draw(this.map);}},checkBirdsEyeAvailability:function(){var geocodeRequest="http://dev.virtualearth.net/REST/V1/Imagery/Metadata/Birdseye/"+this.lat_lng.latitude+','+this.lat_lng.longitude+"?output=json&suppressStatus=true&jsonp=TripleMap.birdsEyeAvailabilityCallBack&key="+bing_key;var script=document.createElement("script");script.setAttribute("type","text/javascript");script.setAttribute("src",geocodeRequest);document.body.appendChild(script);},birdsEyeAvailabilityCallBack:function(result){this.result=result;if(result&&result.resourceSets&&result.resourceSets.length>0&&result.resourceSets[0].resources&&result.resourceSets[0].resources.length>0){this.birds_eye=true;}
this.showMap();},geoCode:function(){if(this.full_address){var geocodeRequest="http://dev.virtualearth.net/REST/v1/Locations/?addressLine="+this.full_address+"&output=json&suppressStatus=true&jsonp=TripleMap.geoCodeCallBack&key="+bing_key;var script=document.createElement("script");script.setAttribute("type","text/javascript");script.setAttribute("src",geocodeRequest);document.body.appendChild(script);}else
this.geoCodeCallBack(null);},geoCodeCallBack:function(result){if(result&&result.resourceSets&&result.resourceSets.length>0&&result.resourceSets[0].resources&&result.resourceSets[0].resources.length>0){this.lat_lng=new Microsoft.Maps.Location(result.resourceSets[0].resources[0].point.coordinates[0],result.resourceSets[0].resources[0].point.coordinates[1]);}else{this.lat_lng=new Microsoft.Maps.Location(this.latitude,this.longitude);}
this.checkBirdsEyeAvailability();}}}
Neighbor=Class.create();Neighbor.prototype={initialize:function(id,lat,lng,addr,short_addr,addr_num,number_of_people,home_value,url,onclick,peeps){this.id=id;this.neighbor_id=id;this.latitude=lat;this.url=url;this.onclick=onclick;this.longitude=lng;this.microsoft_location=new Microsoft.Maps.Location(lat,lng);this.address=addr;this.short_addr=short_addr;this.addr_num=addr_num;this.people=peeps;this.number_of_people=number_of_people;this.home_value=home_value;this.selected_neighbor=false;this.multiple_unit=false;this.seo=false;this.browse=false;this.mobile=false;},neighborType:function(){if(this.selected_neighbor&&this.number_of_people>1)
return'selected_group';else if(this.selected_neighbor)
return'selected_person';else if(this.number_of_people>1)
return'group';else
return'person';},markerHTML:function(){var div=document.createElement('div');div.className='neighbor_wrapper';var foo=this.id;var addr_num=this.addr_num;var neighbor=this;if(this.seo){div.onclick=function(){NeighborsMap.selectNeighbor(addr_num,foo);return false;}}
if(this.mobile){div.onclick=function(){if(NeighborsMap.infoWindow){NeighborsMap.removeInfoWindow(foo)}
NeighborsMap.selectMarker(foo);}}else{div.onmouseover=function(){neighbor.removeFlag=false;NeighborsMap.selectMarker(foo);}
div.onmouseout=function(){neighbor.removeFlag=true;setTimeout(function(){NeighborsMap.removeInfoWindow(foo)},500);}}
var html="<a id='"+this.id+"_link' class=";if(this.number_of_people>1){html=html+"'group_marker "+(this.home_value?'':'group_no_home_value')+"'><span class='number_of_people'>"+this.number_of_people+"</span>";}else{html=html+"'person_marker "+(this.home_value?'':'person_no_home_value')+"'>";}
if(this.home_value)
html=html+"<span class='home_value'>"+this.home_value+"</span></a>"
div.innerHTML=html;return div;},infoWindowHTML:function(){var div=document.createElement('div');div.className='info_window_wrapper';var foo=this.id;var neighbor=this;div.onmouseover=function(){neighbor.removeFlag=false;NeighborsMap.selectMarker(foo);}
div.onmouseout=function(){neighbor.removeFlag=true;setTimeout(function(){NeighborsMap.removeInfoWindow(foo)},500);}
var html="<div class='neighbor_header'>"+((Spokeo.runSplitTest(Mapview.uiSplitTests,'hideAddress')||Spokeo.runSplitTest(NeighborsMap.uiSplitTests,'hideNeighbors'))?'View Neighbors':this.short_addr)+"</div>";if(this.people.length==0){html+="<div class='data_unavailable'>Data Unavailable</div>";}
for(var i=0;i<this.people.length;i++){var neighbor_class='';var name_of_person=this.people[i][0];if(name_of_person.replace(/[\s-]+$/,'').split(/[\s-]/).pop()=="Family"||name_of_person.replace(/[\s-]+$/,'').split(/[\s-]/).pop()=="People")
neighbor_class='group_icon';else
neighbor_class='person_icon';var url='/address/find_by_id?id='+this.id+"&dp="+this.people[i][1];html=html+"<a href='"+url+"' onClick=\"window.location.href='"+url+"'; return true;\" class='neighbor_entry'><span class='neighbor_entry_wrapper'><span class='result_icon "+neighbor_class+"'></span>"+this.people[i][0]+"</span><span class='result_icon drilldown'></span></a>";}
div.innerHTML=html;return div;}};NeighborsMap={init:function(){this.mapMarkers=[]
this.neighborsMap=null;this.selectedPoint=null;this.streetViewMap=null;this.infoWindow=null;this.neighbors=null;this.seo=false;this.browse=false;this.isMobile=false;this.cache_ids=[];this.cache={};},setSeoMode:function(bool){this.seo=bool;},setBrowseMode:function(bool){this.browse=bool;},setIsMobile:function(bool){this.isMobile=bool;},selectMarker:function(neighbor_id){var neighbor=this.findNeighbor(neighbor_id);if(neighbor)
this.showInfoWindow(neighbor);},findNeighbor:function(neighbor_id){if(this.neighbors){for(var i=0;i<this.neighbors.length;i++){if(this.neighbors[i].id==parseInt(neighbor_id)){return this.neighbors[i];break;}}}},showInfoWindow:function(neighbor){if(this.infoWindow&&this.infoWindow.neighbor_id==neighbor.id){return false;}
if(this.infoWindow){for(var i=0;i<this.neighbors.length;i++){this.neighbors[i].removeFlag=false;}
this.neighborsMap.entities.pop();this.infoWindow=null;}
this.infoWindow=new ReverseAddressInfoWindow(neighbor);this.infoWindow.neighbor_id=neighbor.id;this.infoWindow.neighbor_type=neighbor.neighbor_type;this.infoWindow.draw(this.neighborsMap);},removeInfoWindow:function(neighbor_id){var neighbor=this.findNeighbor(neighbor_id);if(neighbor&&neighbor.removeFlag==true&&this.infoWindow){this.neighborsMap.entities.pop();this.infoWindow=null;}},showNeighborsMap:function(div,lat,lng,address,neighbors,selected_neighbor,uiSplitTests){var latlng=new Microsoft.Maps.Location(lat,lng);var mapOptions={credentials:bing_key,disableKeyboardInput:true,showScalebar:false,showMapTypeSelector:false,showDashboard:false,showBreadcrumb:false,mapTypeId:Microsoft.Maps.MapTypeId.aerial,zoom:18,disableZooming:true,center:this.lat_lng,height:909,enableClickableLogo:false,enableSearchLogo:false};this.selectedPoint=latlng;this.neighbors=neighbors;this.uiSplitTests=uiSplitTests;var map=new Microsoft.Maps.Map(z(div),mapOptions);var locations=[];for(var i=0;i<neighbors.length;i++){if(neighbors[i]){if(this.seo)
neighbors[i].seo=true
if(this.browse)
neighbors[i].browse=true
if(this.isMobile)
neighbors[i].mobile=true
var nm=new NeighborMarker(neighbors[i],false);locations.push(this.neighbors[i].microsoft_location);nm.draw(map);}}
if(selected_neighbor){if(this.seo)
selected_neighbor.seo=true
if(this.browse)
selected_neighbor.browse=true
if(this.isMobile)
selected_neighbor.mobile=true
this.neighbors.push(selected_neighbor);selected_neighbor.selected_neighbor=true;locations.push(selected_neighbor.microsoft_location);var nm=new NeighborMarker(selected_neighbor,true);nm.draw(map);map.setView({center:selected_neighbor.microsoft_location});}else{map.setView({bounds:Microsoft.Maps.LocationRect.fromLocations(locations)});}
this.neighborsMap=map;},initializeMultipleUnitMap:function(div,loc,neighbor){this.multiple_unit_div=div;if(neighbor)this.multiple_unit_neighbor=neighbor;this.geoCode(loc);},geoCode:function(full_address){var geocodeRequest="http://dev.virtualearth.net/REST/v1/Locations?addressLine="+full_address+"&output=json&suppressStatus=true&jsonp=NeighborsMap.geoCodeCallBack&key="+bing_key;var script=document.createElement("script");script.setAttribute("type","text/javascript");script.setAttribute("src",geocodeRequest);document.body.appendChild(script);},geoCodeCallBack:function(result){if(result&&result.resourceSets&&result.resourceSets.length>0&&result.resourceSets[0].resources&&result.resourceSets[0].resources.length>0){this.multiple_unit_location=new Microsoft.Maps.Location(result.resourceSets[0].resources[0].point.coordinates[0],result.resourceSets[0].resources[0].point.coordinates[1]);}else if(this.multiple_unit_neighbor){this.multiple_unit_location=this.multiple_unit_neighbor.microsoft_location;}else{this.multiple_unit_location=this.neighbors[this.neighbors.length-1].microsoft_location;}
this.checkBirdsEyeAvailability();},checkBirdsEyeAvailability:function(){var geocodeRequest="http://dev.virtualearth.net/REST/V1/Imagery/Metadata/Birdseye/"+this.multiple_unit_location.latitude+','+this.multiple_unit_location.longitude+"?output=json&jsonp=NeighborsMap.birdsEyeAvailabilityCallBack&key="+bing_key;var script=document.createElement("script");script.setAttribute("type","text/javascript");script.setAttribute("src",geocodeRequest);document.body.appendChild(script);},birdsEyeAvailabilityCallBack:function(result){this.result=result;if(result&&result.resourceSets&&result.resourceSets.length>0&&result.resourceSets[0].resources&&result.resourceSets[0].resources.length>0){this.multiple_unit_birds_eye=true;}
this.showMultipleUnitMap();},showMultipleUnitMap:function(){var mapOptions={credentials:bing_key,disableKeyboardInput:true,showScalebar:false,showMapTypeSelector:false,showDashboard:true,showBreadcrumb:false,mapTypeId:Microsoft.Maps.MapTypeId.aerial,zoom:15,center:this.multiple_unit_location,enableClickableLogo:false,enableSearchLogo:false}
if(this.multiple_unit_birds_eye){mapOptions.mapTypeId=Microsoft.Maps.MapTypeId.birdseye;mapOptions.zoom=20;}
if(this.multiple_unit_map){this.multiple_unit_map.setView(mapOptions);}else{var map=new Microsoft.Maps.Map(z(this.multiple_unit_div),mapOptions);this.multiple_unit_map=map;}
if(this.multiple_unit_neighbor){this.multiple_unit_neighbor.microsoft_location=this.multiple_unit_location;nm=new NeighborMarker(this.multiple_unit_neighbor,true);var infoWindow=new ReverseAddressInfoWindow(this.multiple_unit_neighbor);infoWindow.neighbor_id=this.multiple_unit_neighbor.id;infoWindow.neighbor_type=this.multiple_unit_neighbor.neighbor_type;infoWindow.draw(map);nm.draw(map);}},showCountyMap:function(div,counties,hide_markers){var mapOptions={credentials:bing_key,disableKeyboardInput:true,showScalebar:false,showMapTypeSelector:false,showDashboard:true,showBreadcrumb:false,mapTypeId:Microsoft.Maps.MapTypeId.road,zoom:15,enableClickableLogo:false,enableSearchLogo:false}
var map=new Microsoft.Maps.Map(z(div),mapOptions);var locations=[];for(var i=0;i<(counties.length);i++){if(counties[i]){var county_location=new Microsoft.Maps.Location(counties[i][3],counties[i][4])
var psm=new ReverseAddressSeoMarker(counties[i][0],counties[i][2],counties[i][1],county_location);if(!hide_markers)
psm.draw(map);locations.push(county_location)}}
map.setView({bounds:Microsoft.Maps.LocationRect.fromLocations(locations)});},browseClickNeighbor:function(address_number){document.location.hash=address_number;return false;},browseNeighbor:function(address_number){var full_selected_address=address_number+' '+z('browse_address').innerHTML;var post_ajax_function=this.post_select.bind(this);document.location.hash=address_number;if(this.cache_ids.indexOf(full_selected_address)=='-1'){this.cache_ids.unshift(full_selected_address);}
if(this.cache_ids.length>5)
this.cache[this.cache_ids.shift()]=null;if(this.cache[full_selected_address]){post_ajax_function(this.cache[full_selected_address],address_number);}else{var parameters="address="+full_selected_address+"&address_number="+address_number;if(z('tokenized_query_state'))
parameters=parameters+'&state='+z('tokenized_query_state').innerHTML;if(z('tokenized_query_city'))
parameters=parameters+'&city='+z('tokenized_query_city').innerHTML;if(z('tokenized_query_fename'))
parameters=parameters+'&fename='+z('tokenized_query_fename').innerHTML;if(z('tokenized_query_fetype'))
parameters=parameters+'&fetype='+z('tokenized_query_fetype').innerHTML;if(z('tokenized_query_zip'))
parameters=parameters+'&zip='+z('tokenized_query_zip').innerHTML;new Ajax.Request('/reverse-address-search/browse_by_address',{asynchronous:true,evalScripts:true,parameters:parameters,onComplete:function(request){NeighborsMap.cache[full_selected_address]=request;post_ajax_function(request,address_number);}});}
return false;},selectNeighbor:function(address_number){if(z(address_number+"_address")){var neighbor_id=z(address_number+'_hidden_marker').innerHTML;var full_selected_address=address_number+' '+z('browse_address').innerHTML;var post_ajax_function=this.post_selectNeighbor.bind(this);document.location.hash=address_number;var active=$$('.active');remove_class(active[0],'active');add_class(z(address_number+"_address"),'active');if(this.cache_ids.indexOf(address_number)=='-1'){this.cache_ids.unshift(address_number);}
if(this.cache_ids.length>5)
this.cache[this.cache_ids.shift()]=null;if(this.cache[address_number]){post_ajax_function(this.cache[address_number],neighbor_id,address_number);}else{new Ajax.Request('/reverse-address-search/select_address',{asynchronous:true,evalScripts:true,parameters:"id="+neighbor_id,onComplete:function(request){NeighborsMap.cache[address_number]=request;post_ajax_function(request,neighbor_id,address_number)}});}}
return false;},post_selectNeighbor:function(request,neighbor_id,address_number){for(var i=0;i<this.neighborsMap.entities.getLength();i++){var neighbor_marker=this.neighborsMap.entities.get(i);if(neighbor_marker.neighbor_id==parseInt(neighbor_id)){this.neighborsMap.setView({center:neighbor_marker.getLocation()});var selected_marker=$$('.selected_marker');if(selected_marker.length>0)
remove_class(selected_marker[0],'selected_marker');add_class(z(neighbor_id+'_marker'),'selected_marker');break;}}
this.scroll_to_address(address_number);var stats=eval(request.responseText);this.initializeMultipleUnitMap("browse_streetview",stats[11]);this.pushStatsData(stats);},pushStatsData:function(stats){z('browse_residents').innerHTML=unescape(stats[0]);z('property_value').innerHTML=stats[5];z('lot_size').innerHTML=stats[6];z('home_size').innerHTML=stats[8];z('bedrooms_size').innerHTML=stats[7];z('bathrooms_size').innerHTML=stats[9];z('number_of_males').innerHTML=stats[1];z('number_of_females').innerHTML=stats[2];z('number_of_children').innerHTML=stats[3];z('pets').innerHTML=stats[4];z('address_number').innerHTML=stats[10];},post_select:function(request,address_number){var active=$$('.active');remove_class(active[0],'active');if(request.status==404){z('no_results_address_number').innerHTML=address_number;show('no_results_browse_wrapper');hide('reverse_address_browse','browse_neighborhood_section');return false;}else{hide('no_results_browse_wrapper');show('reverse_address_browse');}
var r=eval(request.responseText);var neighbors=r[0];var selected=r[1];add_class($('neighbors_browse_body'),'neighbors_browse_body');add_class(z(address_number+"_address"),'active');z('browse_neighborhood_section').innerHTML=unescape(r[3]);this.newMarkers(neighbors,selected);this.neighborsMap.setView({center:selected.microsoft_location});this.pushStatsData(r[2]);this.initializeMultipleUnitMap("browse_streetview",selected.address);},newMarkers:function(neighbors,selected_neighbor){this.neighborsMap.entities.clear();this.mapMarkers=[];this.neighbors=[];for(var i=0;i<neighbors.length;i++){var nm=new NeighborMarker(neighbors[i],false);this.mapMarkers.push(nm);this.neighbors.push(neighbors[i]);nm.draw(this.neighborsMap);}
if(selected_neighbor){var nm=new NeighborMarker(selected_neighbor,true);this.selectedPoint=nm.microsoft_location;nm.draw(this.neighborsMap);this.mapMarkers.push(nm);this.neighbors.push(selected_neighbor);}else{this.selectedPoint=this.neighborsMap.getCenter();}},scroll_to_address:function(address_number){if(address_number+"_address"){if(!this.isMobile){z('sub_panel_content').scrollTop=z(address_number+"_address").offsetTop;}}},initializeListeners:function(){Microsoft.Maps.Events.addHandler(this.neighborsMap,'viewchangeend',function(e){var center=NeighborsMap.neighborsMap.getCenter();if(center){if(NeighborsMap.neighborsMap&&NeighborsMap.selectedPoint&&distance(NeighborsMap.neighborsMap.getCenter(),NeighborsMap.selectedPoint,3963.19)>0.15){new Ajax.Request('/reverse-address-search/browse_by_coordinates',{asynchronous:true,evalScripts:true,parameters:"latitude="+NeighborsMap.neighborsMap.getCenter().latitude+"&longitude="+NeighborsMap.neighborsMap.getCenter().longitude,onComplete:function(request){var neighbors=eval(request.responseText);NeighborsMap.newMarkers(neighbors);}});}}});}}
PlacesMap={bounds:null,map:null,isZoomedOut:true,init:function(divId,fpid,places){this.div=$(divId);this.fpid=fpid;this.places=places.p;this.hoveredPlace=null;this.prev_page=places.prev_page;this.next_page=places.next_page;this.loadMap();this.loadPaths(this.places);this.loadMarkers(this.places);this.selectAndPan(this.places[0].id);},loadMap:function(){var latlng=new Microsoft.Maps.Location(39.977,-95.713);var mapOptions={credentials:bing_key,disableKeyboardInput:true,showScalebar:false,showMapTypeSelector:false,showDashboard:false,showBreadcrumb:false,mapTypeId:Microsoft.Maps.MapTypeId.road,zoom:3,center:latlng,height:574,enableClickableLogo:false,enableSearchLogo:false};var map=new Microsoft.Maps.Map(this.div,mapOptions);this.map=map;Microsoft.Maps.Events.addHandler(this.map,'click',function(e){PlacesMap.removeInfoWindow();});},loadMarkers:function(places){var displayPlaces=places.reverse(false);var locations=[];for(var i=0;i<displayPlaces.length;i++){var pm=new PlaceMarker(displayPlaces[i]);locations.push(pm.getLocation());pm.draw(this.map);}
if(displayPlaces.length==1){this.map.setView({center:locations[0]});}else{var location_rect=Microsoft.Maps.LocationRect.fromLocations(locations);this.map.setView({bounds:location_rect});}},loadPaths:function(places){var coordinates=[];this.map.path=null;var displayPlaces=places.reverse(false);for(var i=0;i<displayPlaces.length;i++){var latlng=new Microsoft.Maps.Location(displayPlaces[i].lat,displayPlaces[i].lng);coordinates.push(latlng);}
var color=new Microsoft.Maps.Color.fromHex("#f55d94");color.a=153;var polyline=new Microsoft.Maps.Polyline(coordinates,{strokeColor:color,visible:true,strokeThickness:1,strokeDashArray:"5 3"});this.map.entities.push(polyline);},loadListNav:function(places){var div=$$('.places_nav')[0];div.innerHTML='';for(var i=0;i<places.length;i++){div.appendChild(places[i].navElement());}},loadNextPrev:function(prev_page,next_page){var prev=$$('.places .older_newer .newer')[0];var next=$$('.places .older_newer .older')[0];prev.className='newer disabled';next.className='older disabled';if(prev_page)
prev.className='newer';if(next_page)
next.className='older';prev.onclick=function(){if(prev_page)
this.getPlacesFromAjax(this.fpid,prev_page);return false;}.bind(this);next.onclick=function(){if(next_page)
this.getPlacesFromAjax(this.fpid,next_page);return false;}.bind(this);},getPlacesFromAjax:function(fpid,page){var params='fpid='+fpid+'&page='+page;new Ajax.Request('/famous_person/get_places_by_page',{parameters:params,asynchronous:false,onComplete:function(r){if(r.responseText){var resultsData=eval('('+r.responseText+')');this.places=resultsData.p;this.prev_page=resultsData.prev_page;this.next_page=resultsData.next_page;this.clearMap();this.loadPaths(this.places);this.loadMarkers(this.places);this.loadListNav(this.places);this.loadNextPrev(this.prev_page,this.next_page);this.selectAndPan(this.places[0].id);}}.bind(this)});},getPlaceById:function(id){var result=null;for(var i=0;i<this.places.length;i++){if(this.places[i].id==id){result=this.places[i];break;}}
return[result,i];},selectAndPan:function(id){this.panToCenter(id);this.selectPlace(id);},displayAndPan:function(id){this.panToCenter(id);this.selectPlace(id);},panToCenter:function(id){var marker=this.getMarker(id);if(marker)
try{this.map.setView({center:marker.getLocation(),centerOffset:new Microsoft.Maps.Point(0,30)});}catch(e){}},getMarker:function(place_id){var displayMarkers=this.map.entities;for(var i=0;i<this.map.entities.getLength();i++){if(this.map.entities.get(i).place_id==place_id)
return this.map.entities.get(i);}},showInfoWindow:function(place){if(!this.infoWindow){this.infoWindow=new PlacesInfoWindow(place,place.infoWindowHTML());this.infoWindow.placeId=place.id;this.infoWindow.draw(this.map);}},removeInfoWindow:function(){if(this.infoWindow){this.map.entities.pop();this.infoWindow=null;}},selectPlace:function(id){var place=this.getPlaceById(id)[0];this.removeInfoWindow();this.showInfoWindow(place);this.deselectAllPlaces();Element.addClassName($('pn_'+id),'selected');},deselectAllPlaces:function(){$$('.marker').each(function(m){m.className='marker';});$$('.place').each(function(p){Element.removeClassName(p,'selected');});},clearMap:function(){this.map.entities.clear();}};Locations={'Alabama':[32.3182314,-86.6022980],'Alaska':[63.588753,-154.4930619],'Arizona':[34.0489281,-111.0937311],'Arkansas':[35.20105,-91.8318334],'California':[36.778261,-119.4179324],'Colorado':[39.5500507,-105.7820674],'Connecticut':[41.6032207,-73.0877490,1],'Delaware':[38.9108325,-75.5276699],'Florida':[27.6648274,-81.5157535],'Georgia':[31.5574351,-83.4071230],'Hawaii':[19.8986819,-155.6658568],'Idaho':[44.0682019,-114.7420408],'Illinois':[40.6331249,-89.3985283],'Indiana':[40.5512165,-85.6023643],'Iowa':[41.8780025,-93.0977020],'Kansas':[39.011902,-98.4842465],'Kentucky':[37.8393332,-84.2700179],'Louisiana':[31.2448234,-92.1450245],'Maine':[45.253783,-69.4454689,1],'Maryland':[39.6457549,-77.6412712],'Massachusetts':[42.4072107,-71.3824374,1],'Michigan':[44.3148443,-85.6023643],'Minnesota':[46.729553,-94.6858998],'Mississippi':[32.3546679,-89.3985283],'Missouri':[37.9642529,-91.8318334],'Montana':[46.8796822,-110.3625658],'Nebraska':[41.4925374,-99.9018131],'Nevada':[38.8026097,-116.4193890],'New Hampshire':[43.1938516,-71.5723953,1],'New Jersey':[40.8583238,-74.5056612],'New Mexico':[34.9727305,-105.0323635],'New York':[43.0142691,-75.6059729],'North Carolina':[35.3595731,-78.4192997],'North Dakota':[47.5514926,-101.0020119],'Ohio':[40.4172871,-82.9071230],'Oklahoma':[35.0077519,-97.0928770],'Oregon':[43.8041334,-120.5542012],'Pennsylvania':[41.2033216,-79.4945247],'Rhode Island':[41.5800945,-71.4774291,1],'South Carolina':[33.536081,-80.8637245],'South Dakota':[44.2695148,-99.9018131],'Tennessee':[35.5174913,-86.5804473],'Texas':[31.9685988,-99.9018131],'Utah':[39.3209801,-111.0937311],'Vermont':[44.5588028,-72.5778415,1],'Virginia':[37.4315734,-78.6568942],'Washington':[47.4953976,-120.9392490],'West Virginia':[38.2976262,-80.9949026],'Wisconsin':[43.7844397,-88.7878678],'Wyoming':[43.0759678,-107.2902839],'American Somoa':[-14.270972,-170.1322170],'District of Columbia':[38.9059849,-77.0334179],'Guam':[13.444304,144.7937310],'New England':[43.000000,-71.0000000],'Northern Mariana Islands':[17.33083,145.3846900],'Puerto Rico':[18.220833,-66.5901490],'Virgin Islands':[18.335765,-64.8963350]};Array.prototype.median=function(){var sorted=this.sort();if(sorted.length%2==0){var i=parseInt(sorted.length/2);return(sorted[i]+sorted[i-1])/2.0;}else{return sorted[(sorted.length-1)/2];}};if(window.Microsoft){function FastMarker(latlng,options){this.setLocation(latlng);this.options=options}
FastMarker.prototype=new Microsoft.Maps.Infobox();FastMarker.prototype.draw=function(map){var float=false;var div=document.createElement('div');if(this.options.htmlContent)div.innerHTML=this.options.htmlContent;if(this.options.dom)div.appendChild(this.options.dom);if(this.options.className)div.className=this.options.className;if(this.options.id)div.id=this.options.id;if(this.options.float)float=true;var outer_div=document.createElement('div');outer_div.appendChild(div);this.div=outer_div;this.map=map;this.setHtmlContent(outer_div.innerHTML);this.setOptions({width:this.options.width,height:this.options.height,offset:this.options.offset,zIndex:this.options.zIndex});if(float){var layer2=new Microsoft.Maps.EntityCollection({zIndex:900000000000000});layer2.push(this);map.entities.push(layer2);}else
map.entities.push(this);}
function PersonMarker(person){this.person=person;var a=document.createElement('a');a.id='marker_'+person.nodeId;if(Spokeo.runSplitTest(Mapview.uiSplitTests,'hideAddress'))
a.title=person.location;else
a.title=(person.street?person.street+', ':'')+person.location;a.className='person_marker';Microsoft.Maps.Events.addHandler(this,'click',function(e){return Mapview.personClicked(e.target.person);});Microsoft.Maps.Events.addHandler(this,'mouseenter',function(e){return Mapview.personMarkerOver(e.target.person);});Microsoft.Maps.Events.addHandler(this,'mouseleave',function(e){return Mapview.personMarkerOut(e.target.person);});latlng=new Microsoft.Maps.Location(person.latitude,person.longitude);FastMarker.apply(this,[latlng,{dom:a,width:28,height:29,offset:new Microsoft.Maps.Point(-8,0),className:'map_marker'}]);}
function GroupMarker(group,latlng){var a=document.createElement('a');a.id='marker_'+group.nodeId;a.innerHTML=group.count;a.title=group.location+' - '+group.count+' people';a.className='group_marker';this.group=group;Microsoft.Maps.Events.addHandler(this,'click',function(e){return Mapview.groupClicked(e.target.group);});Microsoft.Maps.Events.addHandler(this,'mouseenter',function(e){return Mapview.groupMarkerOver(e.target.group);});Microsoft.Maps.Events.addHandler(this,'mouseleave',function(e){return Mapview.groupMarkerOut(e.target.group);});latlng=latlng||new Microsoft.Maps.Location(group.latitude,group.longitude);FastMarker.apply(this,[latlng,{dom:a,width:27,height:32,offset:new Microsoft.Maps.Point(-20,-10),className:'map_marker'}]);}
function PlacesInfoWindow(place,html){latlng=new Microsoft.Maps.Location(place.lat,place.lng);FastMarker.apply(this,[latlng,{htmlContent:html,id:'info_window',zIndex:1000000,float:true,width:233,height:106,offset:new Microsoft.Maps.Point(-120,45)}]);}
function PersonMarkerLight(latlng,title){var a=document.createElement('a');a.title=title;a.className='person_marker'
a.onclick=function(){return false;};FastMarker.apply(this,[latlng,{dom:a,className:'map_marker',width:27,height:32,offset:new Microsoft.Maps.Point(-8,0)}]);}
function AreaMarker(latlng){var d=document.createElement('div');FastMarker.apply(this,[latlng,{dom:d,className:'area_marker',width:267,height:267,offset:new Microsoft.Maps.Point(-130,-130)}]);}
function ReverseAddressSeoMarker(id,title,link,latlng){var a=document.createElement('a');a.className='group_marker'
a.href=link;Microsoft.Maps.Events.addHandler(this,'click',function(e){window.location.href=link;return true;});Microsoft.Maps.Events.addHandler(this,'mouseenter',function(e){add_class(z(id+'_selector'),"active");});Microsoft.Maps.Events.addHandler(this,'mouseleave',function(e){remove_class(z(id+'_selector'),"active");});FastMarker.apply(this,[latlng,{dom:a,className:'map_marker',id:'marker_'+id}]);}
function PhoneSeoMarker(id,content,title,link,latlng,class_name){var a=document.createElement('a');a.id='marker_'+id;a.innerHTML=content;a.title=title;a.className=class_name;a.href=link;Microsoft.Maps.Events.addHandler(this,'click',function(e){window.location.href=link;return true;});Microsoft.Maps.Events.addHandler(this,'mouseenter',function(e){add_class(z(id+'_selector'),"active");});Microsoft.Maps.Events.addHandler(this,'mouseleave',function(e){remove_class(z(id+'_selector'),"active");});FastMarker.apply(this,[latlng,{dom:a,className:'map_marker',width:27,height:32,offset:new Microsoft.Maps.Point(-8,0)}]);}
function PlaceMarker(place){var a=place.element();Microsoft.Maps.Events.addHandler(this,'click',function(e){PlacesMap.selectAndPan(place.id);return false;});this.place_id=place.id;var latlng=new Microsoft.Maps.Location(place.lat,place.lng);FastMarker.apply(this,[latlng,{dom:a,width:12,height:15,offset:new Microsoft.Maps.Point(0,-15)}]);}
function ReverseAddressInfoWindow(neighbor){Microsoft.Maps.Events.addHandler(this,'mouseenter',function(e){neighbor.removeFlag=false;NeighborsMap.selectMarker(neighbor.id);});Microsoft.Maps.Events.addHandler(this,'mouseleave',function(e){neighbor.removeFlag=true;setTimeout(function(){NeighborsMap.removeInfoWindow(neighbor.id)},500);});var default_point=new Microsoft.Maps.Point(0,0);if(neighbor.neighborType()=='selected_group')
default_point=new Microsoft.Maps.Point(-102,58);else if(neighbor.neighborType()=='person')
default_point=new Microsoft.Maps.Point(-102,38);else if(neighbor.neighborType()=='selected_person')
default_point=new Microsoft.Maps.Point(-102,45);else
default_point=new Microsoft.Maps.Point(-102,50);FastMarker.apply(this,[neighbor.microsoft_location,{dom:neighbor.infoWindowHTML(),className:(Spokeo.runSplitTest(Mapview.uiSplitTests,'hideAddress')||Spokeo.runSplitTest(NeighborsMap.uiSplitTests,'hideNeighbors')?"neighbor_hidden":"")+" neighbor_info_box neighbor_type_"+neighbor.neighborType(),id:neighbor.id+'_neighbor_info_box',width:176,height:93,offset:default_point,float:true}]);}
function NeighborMarker(neighbor,selected){if(neighbor.seo){Microsoft.Maps.Events.addHandler(this,'click',function(e){NeighborsMap.selectNeighbor(neighbor.addr_num,neighbor.id);return false;});}else{Microsoft.Maps.Events.addHandler(this,'click',function(e){if(neighbor.onclick!='')
try{eval(neighbor.onclick);return true;}catch(e){}
if(neighbor.url&&neighbor.url!=''&&neighbor.url!='#'&&Spokeo.runSplitTest(Mapview.uiSplitTests,'hideAddress')&&Spokeo.runSplitTest(NeighborsMap.uiSplitTests,'hideNeighbors'))
window.location.href=neighbor.url;return true;});Microsoft.Maps.Events.addHandler(this,'mouseenter',function(e){neighbor.removeFlag=false;NeighborsMap.selectMarker(neighbor.id);});Microsoft.Maps.Events.addHandler(this,'mouseleave',function(e){neighbor.removeFlag=true;setTimeout(function(){NeighborsMap.removeInfoWindow(neighbor.id)},500);});}
if(neighbor)
this.neighbor_id=neighbor.id;FastMarker.apply(this,[neighbor.microsoft_location,{dom:neighbor.markerHTML(),className:'map_marker neighbors_marker '+(selected?'selected_marker':'')+" neighbor_type_"+neighbor.neighborType(),id:neighbor.id+'_marker',width:27,height:32,offset:new Microsoft.Maps.Point(-35,-10)}]);}
PersonMarker.prototype=new FastMarker();AreaMarker.prototype=new FastMarker();GroupMarker.prototype=new FastMarker();PlacesInfoWindow.prototype=new FastMarker();PersonMarkerLight.prototype=new FastMarker();PhoneSeoMarker.prototype=new FastMarker();PlaceMarker.prototype=new FastMarker();NeighborMarker.prototype=new FastMarker();ReverseAddressSeoMarker.prototype=new FastMarker();ReverseAddressInfoWindow.prototype=new FastMarker();}
