;(function($) {
$.fn.getLocations = function(options){
	this.each(
		function(){
			options = $.extend({
				element: $(this)
			},options);
			$.getLocations(options);
		}
	);
	return this;
};
$.getLocations = function(options) {
	if (typeof google == 'undefined' || typeof google.maps == 'undefined') throw new Error('Google Maps API is not loaded!');
	options = $.extend({
		element: null,
		point: null,
		resultCallback: null
	},options);
	var geocoder = new google.maps.ClientGeocoder();
	function parseAddresses(response){
		var matches = new Array();
 		if(response && response.Status.code == 200){
			matches = response.Placemark;
		}
		return (typeof options.resultCallback == 'function' ? options.resultCallback(matches,options.point) : matches);
	};
	var data = (options.point != null && typeof options.point != 'undefined' ? options.point : options.element.val());
	return geocoder.getLocations(data, parseAddresses);;
};
})(jQuery);