var map; var map_center; function initialize() { map_center = new google.maps.LatLng(37.4419,-122.1419) var mapDiv = document.getElementById('location_map'); map = new google.maps.Map(mapDiv, { center: map_center,zoom: 13,mapTypeControl:false,navigationControl:false,mapTypeId: google.maps.MapTypeId.ROADMAP }); var marker = new google.maps.Marker({map: map, position: map_center}); } google.maps.event.addDomListener(window, 'load', initialize); $(function() { $(".map_env").hover(function() { var $this = $(this); $('.map_env #location_map').animate({width: 755, height:318}, function() { google.maps.event.trigger(map, 'resize'); map.setCenter(map_center); }); $this.css({'position': 'absolute', 'background': 'url(imgs/map_hover_bg.png) no-repeat right top'}).stop().animate({'width': 749, 'height': 352}); },function() { var $this = $(this); $this.stop().animate({ 'width': 274, 'height': 109}, 500, function() { $this.css({'background': 'url(imgs/map_bgshadow.png) no-repeat right top', 'position': 'relative'}); }); var map_el = $this.find('#location_map'); map_el.stop().animate({width: 277, height:110}, function() { initialize(); }); }); });