$(document).ready(function()
{
	$(".googleMapCanvas").each(function(){ LoadGoogleMap(this, $(this).attr('title')); });
	
	$("ul.images li a").click(function()
	{
		src = $(this).attr('href');
		$.fn.colorbox({href: src, scalePhotos: true, maxWidth: '950px', maxHeight: '100%', close: 'Zamknij'});
		return false;
	});
	
	$('#head .imagesBrowser .images').cycle({ 
		fx:     'fade', 
		speed:  'fast', 
		timeout: 3000, 
		next:   '#imagesBrowserEnd',
		prev:   '#imagesBrowserStart' 
	});
	
});

function LoadGoogleMap(obj, latLong)
{
	var lat = latLong.substring(0,latLong.indexOf(','));
	var lng = latLong.substring(latLong.indexOf(',')+2,latLong.lastIndexOf(','));
	var zoom = parseInt(latLong.substring(latLong.lastIndexOf(',')+1));

      if (GBrowserIsCompatible()) {
        var map = new GMap2(obj);
        map.setCenter(new GLatLng(lat, lng), zoom);

        var bounds = map.getBounds();
        var southWest = bounds.getSouthWest();
        var northEast = bounds.getNorthEast();
        var lngSpan = northEast.lng() - southWest.lng();
        var latSpan = northEast.lat() - southWest.lat();
        var point = new GLatLng(lat, lng);
        map.addOverlay(new GMarker(point));
      }
}
