function MarkerLogo (id,state)
{
if ((eval ('document.id'+id))==undefined) return;
eval ('document.id'+id+'.className="marker'+state+'";');
}
function Marker(i) {
var icon = new GIcon(G_DEFAULT_ICON, "common/gfx/egs_mapka.png");
//      var icon = new GIcon(G_DEFAULT_ICON, "common/gfx/favicon.ico");
//icon.iconSize = new GSize(15, 23);
//icon.iconSize = new GSize(25, 32);
icon.iconSize = new GSize(15, 23);
icon.iconAnchor = new GPoint(15, 23);
icon.shadow = "";
icon.shadowSize = new GSize(0, 0);
this.marker = new GMarker(new GLatLng(points[i][0],points[i][1]), icon);
this.title = points[i][2];
this.img = points[i][3];
GEvent.bind(this.marker, "click", this, this.clickEventHandler);
//      GEvent.bind(this.marker, "infowindowclose", this, this.infoWindowCloseEventHandler);
map.addOverlay(this.marker);
}
Marker.prototype.highlight = function() {
this.marker.setImage("common/gfx/marker2.png");
if (this.img) MarkerLogo(this.id,'Over');
}
Marker.prototype.unhighlight = function() {
this.marker.setImage("common/gfx/marker1.png");
if (this.img) MarkerLogo(this.id,'Out');
}
Marker.prototype.openWindow = function() {
var content='';
//      content='<b>'+this.title+'</b><br>';
content='<h2>'+this.title+'</h2><br>';
if (this.img.length) content+='<img src="'+this.img+'"><br>';
var opt = new Object();
opt.maxWidth = maxInfoWindowWidth;
this.marker.openInfoWindowHtml(content, opt);
}
Marker.prototype.closeWindow = function() {
//      this.marker.closeInfoWindow();
}
Marker.prototype.infoWindowCloseEventHandler = function() {
map.panTo(centralPoint);
}
Marker.prototype.clickEventHandler = function() {
this.openWindow();
}
function setMarkers() {
for(var i = 0; i < points.length; i++) {
var m = new Marker(i);
if (i==1) m.marker.setImage("common/gfx/parking.png");
allMarkers.push( m );
} 
}
function load() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
map.setCenter(centralPoint, 16);
map.addControl(new GLargeMapControl()); //<- kontrolka powiekszania
map.addControl(new GMapTypeControl()); //<- kontrolka rodzaju mapki
//	map.disableDragging(); //<- wylacza mozliwosc przesuwania mapki mysza
setMarkers();
ShowMarkerInfo(0);
}
}
function ShowMarkerInfo (id)
{
var result;
for(var i = 0; i < allMarkers.length; i++) {
if (allMarkers[i].id==id) result=i;
}
// allMarkers[result].openWindow();
allMarkers[0].openWindow();
}
function SwitchMarker (id,on)
{
exit;
//exit;
var result;
for(var i = 0; i < allMarkers.length; i++) {
if (allMarkers[i].id==id) result=i;
}
if (on) allMarkers[result].highlight(); else allMarkers[result].unhighlight();
} 

