$('document').ready(function () {
	jQuery.each($('.location .map'), function () {
			var address = $(this).text();
			var name = "Tikka";
			var link = $(this).children('a').attr('href');
			$(this).empty()
		    var map = new GMap2(this);
		    var geocoder = new GClientGeocoder();
		    
//		    GEvent.addListener(map, "click", function(){
//		    	 var url = $(this).children()[0];
//		    	  document.location.href = $(this).children("a").eq(0).href;
//		    	});
		    
		    //map.addControl(new GSmallMapControl());
	
		    geocoder.getLatLng(
		        address,
		        function(point) {
		            map.setCenter(point, 15);

//		            var tikkaIcon = new GIcon(G_DEFAULT_ICON);
//		            tikkaIcon.image = "/images/logos/logo.png";
//		            tikkaIcon.iconSize = new GSize(80, 40);
//		            tikkaIcon.shadowSize = new GSize(22, 20);
//		            tikkaIcon.iconAnchor = new GPoint(6, 20);
//		            tikkaIcon.infoWindowAnchor = new GPoint(5, 1);
//		            
//	                var markerOptions = { icon:tikkaIcon };
//	                var marker = new GMarker(point, markerOptions);
	                var marker = new GMarker(point);
	                GEvent.addListener(marker, "click", function() {
	                	window.open(link);
		            });
		            map.addOverlay(marker);
		        }
		      );
	});
});

