$.fn.DeseoMap = function(latitude, longitude, size)
{

	if($(this).attr('id'))
	id = $(this).attr('id')
	else
	{
		unique = Math.floor(Math.random()*110);
		$(this).attr('id', 'map_'+unique);
		id = 'map_'+unique;
	}


	var myLatlng = new google.maps.LatLng(latitude, longitude);
	var myOptions = {
	  zoom: size,
	  center: myLatlng,
	  mapTypeId: google.maps.MapTypeId.ROADMAP
	}
	var map = new google.maps.Map(document.getElementById(id), myOptions);
	
	var marker = new google.maps.Marker({
		  position: myLatlng, 
		  map: map
	  });  
}

function load_map(element, data)
{
	$(element).addClass('ui-platinum-map-container');
	$(element).append('<div class="ui-platinum-map"></div><a href="#" class="overlay_close ui-platinum-map-close">zamknij mapę</a>'); 
	$('.ui-platinum-map').DeseoMap(data[0], data[1], parseInt(data[2]));
}

$(function() {
	$('.btn_map').live('click', function() {
		data = $(this).attr('title').split(',');
		$container = overlay(load_map, data);
		return false;
	});
});
