';
google.maps.event.addListener(propertyMarker, 'spider_click', function () {
if (infoWindow != undefined) {
infoWindow.close();
}
infoWindow = new google.maps.InfoWindow({ content: content });
infoWindow.open(mapFullWidth, propertyMarker);
$('.neighborhood-widget__marker').parent().parent().parent().prev().find('> div').eq(7).css('border-top', '3px solid #ba5915;');
});
var center;
function calculateCenter() {
center = mapFullWidth.getCenter();
}
google.maps.event.addDomListener(mapFullWidth, 'idle', function () {
calculateCenter();
});
google.maps.event.addListener(mapFullWidth, 'spider_click', function (event) {
infoWindow.close();
clicked = false;
if ($(window).width() ' +
'
' +
'
' + v.Address + '
' + v.City + ', ' + v.State + ' ' + v.Zip + '
' +
'
Get Directions
';
google.maps.event.addListener(customMarker, 'spider_click', function () {
if (infoWindow != undefined) {
infoWindow.close();
}
infoWindow = new google.maps.InfoWindow({ content: customPin });
infoWindow.open(mapFullWidth, customMarker);
$('.neighborhood-widget__marker').parent().parent().parent().prev().find('> div').eq(7).css('border-top', '3px solid #ba5915;');
});
}
});
}
function circleDrawHandler(radius) {
while (overlays[0]) {
overlays.pop().setMap(null);
}
var circle = new google.maps.Circle({
center: origin,
clickable: true,
draggable: false,
editable: false,
fillColor: '#004de8',
fillOpacity: 0.27,
map: mapFullWidth,
radius: radius,
strokeColor: '#004de8',
strokeOpacity: 0.62,
strokeWeight: 1
});
overlays.push(circle);
google.maps.event.addListener(circle, 'rightclick', polygonDestructionHandler);
};
polygonDestructionHandler = function () {
return this.setMap(null);
};
function boundsUpdated(event) {
var z = mapFullWidth.getZoom();
var bounds = mapFullWidth.getBounds();
var center = mapFullWidth.getCenter();
var ne = bounds.getNorthEast();
var sw = bounds.getSouthWest();
var nw = new google.maps.LatLng(ne.lat(), sw.lng());
var se = new google.maps.LatLng(sw.lat(), ne.lng());
if (bounds && center) {
var b = google.maps.geometry.spherical.computeDistanceBetween(nw, ne) / 2;
var h = google.maps.geometry.spherical.computeDistanceBetween(center, ne);
var radius = ((h - b) / 400);
//currentRadius = (radius / 3963.1676) * 6378100;
}
if (currentKeyword != '' && currentIcon != '') {
//findByKeyword(currentKeyword, currentIcon);
}
//circleDrawHandler(currentRadius);
}
function createMarker(placeResult, icon) {
var iconList = ["entertainment", "schools", "food", "nightlife", "recreation", "professional", "residences", "shopping", "travel"];
if (iconList.indexOf(icon) 0) {
photoUrl = details.photos[0].getUrl({ 'maxWidth': 300, 'maxHeight': 300 });
}
}
var addr = details.address_components;
var content = '
';
infoWindow = new google.maps.InfoWindow({ content: content });
infoWindow.open(mapFullWidth, marker);
});
}
function getAddressComponent(components, type, length){
var str;
$(components).each(function(){
if (this.types[0] == type){
str = (length == 'short') ? this.short_name : this.long_name;
return;
}
});
return str;
}
function findByKeyword(keyword, icon) {
currentKeyword = keyword;
currentIcon = icon;
var excludedKeywords = $.parseJSON('[]');
var excludedBusinesses = $.parseJSON('[]');
var filteredWords = "sex,strip club,adult entertainment,strip bar,XXX,porn,escort,adult video,gentlemen's club,adult bookstore,adult club";
if (excludedKeywords.length > 0) {
filteredWords += ',' + excludedKeywords.join(',');
}
if (excludedBusinesses.length > 0) {
filteredWords += ',' + excludedBusinesses.join(',');
}
var fwordsArray = filteredWords.split(",");
var request = {
keyword: keyword,
location: origin,
radius: currentRadius
};
$('.neighborhood-widget__loader').show();
mapService.nearbySearch(request, function (results, status) {
deleteOverlays();
if (status == google.maps.places.PlacesServiceStatus.OK) {
$(results).each(function () {
var temp = 0;
for (var i = 0; i ' +
'
' +
'
' + v.Address + '
' + v.City + ', ' + v.State + ' ' + v.Zip + '
' +
'
Get Directions
';
google.maps.event.addListener(customMarker, 'spider_click', function () {
if (infoWindow != undefined) {
infoWindow.close();
}
infoWindow = new google.maps.InfoWindow({ content: customPin });
infoWindow.open(mapFullWidth, customMarker);
$('.neighborhood-widget__marker').parent().parent().parent().prev().find('> div').eq(7).css('border-top', '3px solid #ba5915;');
});
}
});
});
if (status == "ZERO_RESULTS" && !customPinExists) {
$('.search-no-results').addClass('show-message');
}
else { $('.search-no-results').removeClass('show-message'); }
$('.neighborhood-widget__loader').hide('slow');
});
}
function deleteOverlays() {
if (markersArray) {
while (markersArray[0]) {
markersArray.pop().setMap(null);
}
}
}
var categoriesHidden = false;
$(function () {
var mainKeywords = 'residences';
$.each(mainKeywords.split('|'), function (idx, val) {
if (val != '') {
$('.neighborhood-widget__categories ul li[data-icon=' + val + ']').hide();
}
});
var customKeywords = $.parseJSON('[]');
$.each(customKeywords, function (idx, val) {
keywordItem = '
';
$('.neighborhood-widget__categories ul').append(keywordItem);
});
$('.neighborhood-widget__categories li').click(function () {
$(this).addClass('active');
$(this).siblings().removeClass('active');
findByKeyword($(this).text(), $(this).data('icon'));
$('.neighborhood-widget__search input').val($(this).text());
if ($(window).width() 0) ? $('.neighborhood-widget__walkscore').height() + 30 : 0;
$('.neighborhood-widget__categories').css('max-height', $('.neighborhood-widget__categories').parent().parent().height() - (90 + navPosition.top) - walkScoreHeight);
function hideCategories() {
$('.neighborhood-widget__categories').css({ 'margin-top': -$('.neighborhood-widget__categories').innerHeight(), 'opacity': 0 })
$('.neighborhood-widget__nav').removeClass('expanded');
categoriesHidden = true;
}
function showCategories() {
$('.neighborhood-widget__categories').css({ 'margin-top': 0, 'opacity': 1 });
$('.neighborhood-widget__nav').addClass('expanded');
categoriesHidden = false;
}
$(window).resize(function () {
var navPosition = $('.neighborhood-widget__nav').position();
var walkScoreHeight = ($('.walk-score-container').length > 0) ? $('.neighborhood-widget__walkscore').height() + 30 : 0;
$('.neighborhood-widget__categories').css('max-height', $('.neighborhood-widget__categories').parent().parent().height() - (90 + navPosition.top) - walkScoreHeight);
});
});
}