(function($) { 
 		
	$.fn.gmapsurl = function(settings) {
		var options = {
			link: "view in google map",
			type: "maps", // type mappati: maps, earth, streetview, hybrid, satellite, terrain
			lang: "en",
			zoom: '16',
			coords : "0,0",
			appender: function(a) {
				$(this).html(a);
			}
		};
		if (settings) $.extend(options, settings);
		var types = {'earth': 'e', 'hybrid': 'h', 'satellite': 'k', 'terrain': 'p', 'maps': 'm' };
		
		var geo = (options.coords).split(',');
		var params = { q: geo[0]+","+geo[1]+"("+options.text+")", hl: options.lang };
		
		if (options.type == 'streetview') $.extend(params, { layer: 'c', cbll: geo[0].replace(" ","")+","+geo[1].replace(" ",""), cbp: "5"+","+"0"+","+"0"+","+"0"+","+"0" });
		else { $.extend(params, { t: types[options.type], z: options.zoom }) }
				
		$(this).each(function() {			
			$(this).attr("target","_blank");
			$(this).attr("href", "http://maps.google.com/maps?" + $.param(params));
		});
		
		return $(this);
	}; 

})(jQuery);

