createGoogleMaps=function(id) { if($('#'+id).length) { var coordinate=new google.maps.LatLng(32.204188, -95.854027); var mapOptions= { zoom : 13, center : coordinate, scrollwheel : true, mapTypeControl : true, streetViewControl : false, }; var googleMap=new google.maps.Map(document.getElementById(id),mapOptions); var bounds = new google.maps.LatLngBounds(); var icons = new Array( { map : googleMap, position : new google.maps.LatLng(32.204188, -95.854027), title : 'Title', icon: { path: fontawesome.markers.MAP_MARKER, scale: 0.5, strokeWeight: 0.2, strokeColor: '#e03a44', strokeOpacity: 0, fillColor: '#e03a44', fillOpacity: 1 }, } , { map : googleMap, position : new google.maps.LatLng(32.205310, -95.834927), title : 'Title', icon: { path: fontawesome.markers.MAP_MARKER, scale: 0.5, strokeWeight: 0.2, strokeColor: '#e03a44', strokeOpacity: 0, fillColor: '#e03a44', fillOpacity: 1 }, } , { map : googleMap, position : new google.maps.LatLng(32.0890148,-96.4828899), title : 'Title', icon: { path: fontawesome.markers.MAP_MARKER, scale: 0.5, strokeWeight: 0.2, strokeColor: '#e03a44', strokeOpacity: 0, fillColor: '#e03a44', fillOpacity: 1 }, } , { map : googleMap, position : new google.maps.LatLng(32.739163, -96.449254), title : 'Title', icon: { path: fontawesome.markers.MAP_MARKER, scale: 0.5, strokeWeight: 0.2, strokeColor: '#e03a44', strokeOpacity: 0, fillColor: '#e03a44', fillOpacity: 1 }, } , { map : googleMap, position : new google.maps.LatLng(32.331301, -96.114213), title : 'Title', icon: { path: fontawesome.markers.MAP_MARKER, scale: 0.5, strokeWeight: 0.2, strokeColor: '#e03a44', strokeOpacity: 0, fillColor: '#e03a44', fillOpacity: 1 }, } , { map : googleMap, position : new google.maps.LatLng(32.364998, -96.100737), title : 'Title', icon: { path: fontawesome.markers.MAP_MARKER, scale: 0.5, strokeWeight: 0.2, strokeColor: '#e03a44', strokeOpacity: 0, fillColor: '#e03a44', fillOpacity: 1 }, } , { map : googleMap, position : new google.maps.LatLng(32.170634, -96.014543), title : 'Title', icon: { path: fontawesome.markers.MAP_MARKER, scale: 0.5, strokeWeight: 0.2, strokeColor: '#e03a44', strokeOpacity: 0, fillColor: '#e03a44', fillOpacity: 1 }, } ); var content = new Array( '

Athens - Downtown

130 E Corsicana Street,
P.O. Box 471,
Athens,
TX 75751

Get directions
' , '

Athens - Tyler Street

1114 E. Tyler Street,
Athens,
TX 75751

Get directions
' , '

Corsicana

1600 W 2nd Ave,
Corsicana,
TX 75110

Get directions
' , '

Forney

119 S. FM 548,
Forney,
TX 75126

Get directions
' , '

Gun Barrel City

118 W. Main Street,
Gun Barrel City,
TX 75156

Get directions
' , '

Mabank

201 S. Third,
Mabank,
TX 75147

Get directions
' , '

Malakoff

200 W. Royall Blvd,
Malakoff,
TX 75148

Get directions
' ); var marker = new Array(); var info = new Array(); $.each(icons, function(k,v){ marker[k] = new google.maps.Marker(v); info[k] = new google.maps.InfoWindow({ content: content[k] }); bounds.extend(marker[k].position); marker[k].addListener('click', function() { for (var i = 0; i < icons.length; i++ ) { info[i].close(); } info[k].open(googleMap, marker[k]); }); }); googleMap.fitBounds(bounds); } $('#accordion .panel-title a').click(function(){ var ct = $(this).attr('data-marker'); googleMap.panTo(marker[ct].position); if(googleMap.getZoom() != 14){ googleMap.setZoom(14); } google.maps.event.trigger(marker[ct], 'click'); setTimeout(function(){ $(window).trigger('resize').trigger('scroll'); },200) }); $('#filters a').click(function() { googleMap.fitBounds(bounds); $.each(info, function(k,v){ info[k].close(); }); }); }; createGoogleMaps('map');