﻿$(function() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById('mapa'));
map.addControl(new GSmallMapControl());
map.setCenter(new GLatLng(54.354892,18.596198), 15);
$.ajax({
url: '/catalog/template/default/js/markers.xml',
type: 'GET',
dataType: 'xml',
success:function(data) {
$('marker',data).each(function() {
var point = new GLatLng(parseFloat($(this).attr('lat')),parseFloat($(this).attr('lng')));
var html = $('html',this).text();
var  ikonka;
var icon = $(this).attr('icon');
if(icon != undefined) {
ikonka = new GIcon(G_DEFAULT_ICON);
ikonka.image = icon;
} else {
ikonka = new GIcon();
ikonka.image= 'http://labs.google.com/ridefinder/images/mm_20_yellow.png';
ikonka.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
ikonka.iconSize = new GSize(12,20);
ikonka.shadowSize = new GSize(22,20);
ikonka.iconAnchor = new GPoint(6,20);
ikonka.infoWindowAnchor = new GPoint(5,1);
}
var marker = new GMarker(point,{icon:ikonka});
map.addOverlay(marker);
GEvent.addListener(marker,'click',function() {
marker.openInfoWindowHtml(html);
});
});
},
error:function() {
alert("błąd: nie można pobrać danych!");
}
});
$(window).unload(GUnload);
} 
/*else
$('#mapa').text('Przeglądarka niekompatybilna z Google Maps.');*/
});
