| Current Path : /home/balossw/www/temp/media/js/ |
| Current File : /home/balossw/www/temp/media/js/gmaps.js |
/**
* @constructor
*/
Map = function (lat, lng, zoom) {
this._SHADOW = new google.maps.MarkerImage(
'http://labs.google.com/ridefinder/images/mm_20_shadow.png',
// Size
new google.maps.Size(22,20),
// Origine
new google.maps.Point(0,0),
// The anchor for this image is the base of the flagpole at 0,32.
new google.maps.Point(5,21)
);
this.map = new google.maps.Map(
document.getElementById('map'),
{
zoom: zoom,
center: new google.maps.LatLng(lat, lng),
mapTypeId: google.maps.MapTypeId.ROADMAP
}
);
this.infowindow = null;
}
Map.prototype = {
createMarker: function (lng, lat, title, text, icon_color) {
var owner = this;
var content = "<div class='marker-infos'><h3>"+title+"</h3>"+text+"</div>";
var icon = new google.maps.MarkerImage(
'http://labs.google.com/ridefinder/images/mm_20_'+(icon_color==null ? 'red' : icon_color)+'.png',
// Size
new google.maps.Size(12,20),
// Origine
new google.maps.Point(0,0),
// Anchor
new google.maps.Point(6,20)
);
var marker = new google.maps.Marker({
position: new google.maps.LatLng(lng,lat),
map: this.map,
shadow: this._SHADOW,
icon: icon,
title: title,
zIndex: 1
});
var infowindow = new google.maps.InfoWindow({
content: content
});
google.maps.event.addListener(marker,'click',function() {
if (owner.infowindow!=null) owner.infowindow.close();
infowindow.open(owner.map,marker);
owner.infowindow = infowindow;
});
},
}