(function($){
		/**
	 *	Activates the google map
	 *	@example $('#map').jmap({mapType: 'hybrid'});
	 *	@desc Activates a Google map with the Hybrid graphics settings
	 *	@example $('#map').jmap({mapType: 'hybrid'}, function(){ alert('Map Loaded'); });
	 *	@desc Activates a Google map with the Hybrid graphics settings and fires a callback
	 *	@param Object options (optional) An object containing options
	 *	@param Function callback (optional) An optional callback
	 *	@type jQuery
	 *	@name jmap
	 */
	$.fn.jmap = function(options, callback) {
		return this.each(function(){
			new $.jmap.init(this, options, callback);
		});
	}

	/**
	 *	Adds a KML or GeoRSS feed to the map
	 *	@example $('#map').addFeed({feed: 'http://digitalspaghetti.me.uk/my.kml', mapCenter:[55.958858,-3.162302]});
	 *	@desc Adds the KML feed to the map and displays the points.  Also centers the map on a new location.
	 *	@param Object options (optional) An object containing options
	 *	@param Function callback (optional) An optional callback
	 *	@type jQuery
	 *	@name addFeed
	 */
	 $.fn.addFeed = function(options, callback) {
	 	return this.each(function(){
	 		new $.jmap.addFeed(options, callback);
	 	});
	 }
	 
	 /**
	 *	Adds a ground overlay (bitmap image) over the map
	 *	@example $('#map').addGroundOverlay({sw: [55.958858,-3.162302], ne: [56.958858,-3.262302], image: "http://digitalspaghetti.me.uk/overlay.gif"});
	 *	@desc Adds a ground overlay image within the bounding box set by the the South West and North East points
	 *	@param Object options (optional) An object containing options
	 *	@param Function callback (optional) An optional callback
	 *	@type jQuery
	 *	@name addGroundOverlay
	 */
	 $.fn.addGroundOverlay = function(options, callback) {
	 	return this.each(function(){
	 		new $.jmap.addGroundOverlay(options, callback);
	 	});
	 }
	
	/**
	 *	Adds a marker to the map
	 *	@example $('#map').addMarker({pointLat: 55.958858, pointLng: -3.162302});
	 *	@desc Add's a basic marker to the map
	 *	@example $('#map').addMarker({pointLat: 55.958858, pointLng: -3.162302, pointHTML: "Point 1"});
	 *	@desc Add's a marker to the map with a HTML bubble (activates on click)
	 *	@example $('#map').addMarker({pointLat: 55.958858, pointLng: -3.162302, pointHTML: "Point 1", openHTMLEvent: "mouseover"});
	 *	@desc Add's a marker to the map that activates the HTML bubble with a mouseover event
	 *	@param Object options (optional) An object containing options
	 *	@param Function callback (optional) An optional callback
	 *	@type jQuery
	 *	@name addMarker
	 */
	$.fn.addMarker = function(options, callback) {
		return this.each(function(){
			new $.jmap.addMarker(options, callback);
		});
	}
	
	/**
	 *	Adds a polygon to the map from an array of GLatLng points
	 *	@example $('#map').addPolygon({points: [new GLatLng(55.958858,-3.162302), new GLatLng(55.968858,-3.162302), new GLatLng(55.968858,-3.152302), new GLatLng(55.958858,-3.152302), new GLatLng(55.958858,-3.162302)]});
	 *	@desc Adds a basic polygon to the map.
	 *	@example $('#map').addPolygon({points: [new GLatLng(55.958858,-3.162302), new GLatLng(55.968858,-3.162302), new GLatLng(55.968858,-3.152302), new GLatLng(55.958858,-3.152302), new GLatLng(55.958858,-3.162302)], strokeColor "#f00"});
	 *	@desc Adds a basic polygon to the map with a red stroke line.
	 *	@param Object options (optional) An object containing options
	 *	@param Function callback (optional) An optional callback
	 *	@type jQuery
	 *	@name addPolygon
	 */
	 $.fn.addPolygon = function(options, callback) {
	 	return this.each(function(){
	 		new $.jmap.addPolygon(options, callback);
	 	});
	 }
	
	/**
	 *	Adds a polyline to the map
	 *	@example $('#map').addPolyline({points: [new GLatLng(55.958858,-3.162302), new GLatLng(55.968858,-3.162302), new GLatLng(55.988858,-3.262302)]});
	 *	@desc Adds a polyline to the map
	 *	@example $('#map').addPolyline({points: [new GLatLng(55.958858,-3.162302), new GLatLng(55.968858,-3.162302), new GLatLng(55.988858,-3.262302)], strokeColor "#f00"});
	 *	@desc Adds a red polyline to the map	 
	 *	@param Object options (optional) An object containing options
	 *	@param Function callback (optional) An optional callback
	 *	@type jQuery
	 *	@name addPolyline
	 */
	$.fn.addPolyline = function(options, callback) {
	 	return this.each(function(){
	 		new $.jmap.addPolyline(options, callback);
	 	});
	 }
	
	/**
	 *	Adds a traffic info layer to the map.  There can only be one layer on the map, and this service is
	 *  not available in all localities.
	 *	@example $('#map').addTrafficInfo();
	 *	@desc Creates a traffic information layer on the map
	 *	@example $('#map').addTrafficInfo({mapCenter[55.958858,-3.162302]});
	 *	@desc Adds a layer of traffic info and centers the map
	 *	@example $('#map').addTrafficInfo({method: "destory"});
	 *	@desc Destroys the traffic layer from the map
	 *	@param Object options (optional) An object containing options
	 *	@param Function callback (optional) An optional callback
	 *	@type jQuery
	 *	@name addTrafficInfo
	 */
	 $.fn.addTrafficInfo = function(options, callback) {
	 	return this.each(function(){
	 		new $.jmap.addTrafficInfo(options, callback);
	 	});
	 }
	 
	/**
	 *	Hides the taffic layer without destroying it
	 *	@example $('#map').hideTraffic();
	 *	@type none
	 *	@name hideTraffic
	 */
	 $.fn.hideTraffic = function() {
	 	return this.each(function(){
	 		new $.jmap.disableTraffic();
	 	});
	 }
	 
	 /**
	 *	Shows the taffic layer thats been hidden
	 *	@example $('#map').showTraffic();
	 *	@type none
	 *	@name showTraffic
	 */
	 $.fn.showTraffic = function() {
	 	return this.each(function(){
	 		new $.jmap.enableTraffic();
	 	});
	 }
	 
	 /**
	 *	Creates a Google AdSense layer on the map
	 *  not available in all localities.
	 *	@example $('#map').createAdsManager({publisherId: "YourAdsenseKey"});
	 *	@desc Creates a ad layer on the map using your AdSense key
	 *	@param Object options (optional) An object containing options
	 *	@param Function callback (optional) An optional callback
	 *	@type jQuery
	 *	@name createAdsManager
	 */
	 $.fn.createAdsManager = function(options, callback) {
		return this.each(function(){
			new $.jmap.createAdsManager(options, callback);
		});
	}

	/**
	 *	Hides the ad layer
	 *	@example $('#map').hideAds();
	 *	@param Function callback (optional) An optional callback
	 *	@type none
	 *	@name hideAds
	 */
	$.fn.hideAds = function(callback) {
		return this.each(function(){
			new $.jmap.hideAds(callback);
		});
	}
	
	/**
	 *	Shows the ad layer
	 *	@example $('#map').showAds();
	 *	@param Function callback (optional) An optional callback
	 *	@type none
	 *	@name showAds
	 */
	$.fn.showAds = function(callback) {
		return this.each(function(){
			new $.jmap.showAds(callback);
		});
	}
	
	/**
	 *	Creates a Google Geocode cache to store geocoding request
	 *	@example $('#map').createGeoCache();
	 *	@desc Creates a cache to store geocode requests
	 *	@param Function callback (optional) An optional callback
	 *	@type jQuery
	 *	@name createGeoCache
	 */
	$.fn.createGeoCache = function(callback) {
		return this.each(function(){
			new $.jmap.createGeoCache(callback);
		});
	}
	
	/**
	 *	Creates a Google Geocoding object
	 *	@example $('#map').createGeoCoder();
	 *	@desc Creates a geocoder to return Lat/Lng co-ordinates from an address.
 	 *	@param Object cache (optional) An object geocache to store the geocode request
	 *	@param Function callback (optional) An optional callback
	 *	@type jQuery
	 *	@name createGeoCoder
	 */
	$.fn.createGeoCoder = function(cache, callback) {
		return this.each(function(){
			new $.jmap.createGeoCoder(cache);
		});
	}
	
	/**
	 *	Creates a Google marker manager
	 *	@example $('#map').createMarkerManager();
	 *	@desc Creates a marker manager to store markers
	 *	@param Object options (optional) An object containing options
	 *	@param Function callback (optional) An optional callback
	 *	@type jQuery
	 *	@name createMarkerManager
	 */
	$.fn.createMarkerManager = function(options, callback) {
		return this.each(function(){
			new $.jmap.createMarkerManager(options, callback);
		});
	}
	
	/**
	 *	Searches for an address and returns is as co-ordinates or as a marker
	 *	@example $('#map').searchAddress({address: "123 Test St, Edinburgh"});
	 *	@desc Passes the address to the Geocoder object and returns the Lat/Lng
	 *	@example $('#map').searchAddress({address: "123 Test St, Edinburgh", addMarker: true, showAddress: true});
	 *	@desc Passes the address to the Geocoder object and returns a marker with address in the info window
	 *	@param Object options (optional) An object containing options
	 *	@param Object pass (optional) Options to overide the marker
	 *	@param Function callback (optional) An optional callback
	 *	@type jQuery
	 *	@name searchAddress
	 */
	$.fn.searchAddress = function(options, pass, callback) {
		return this.each(function() {
			new $.jmap.searchAddress(options, pass, callback);
		});
	}
	
	/**
	 *	Searches for directions between two or more points, and displays on the map
	 *	and within directions text area
	 *	@example $('#map').searchDirections({fromAddress: "123 Test St, Edinburgh", toAddress:"15 jQuery Rd, Edinburgh", directionsPanel:"directions"});
	 *	@desc Searches the directions between the two addresses, returns to the map and to a div with the ID of 'directions'
	 *	@param Object options (optional) An object containing options
	 *	@param Function callback (optional) An optional callback
	 *	@type jQuery
	 *	@name searchDirections
	 */
	$.fn.searchDirections = function(options, callback) {
		return this.each(function(){
			new $.jmap.searchDirections(options, callback);
		});
	}
	
	/**
	 *	Move to co-ordinates on the map
	 *	@example $('#map').moveTo({mapCenter: [55.958858,-3.162302]});
	 *	@desc Centers the map on the selected co-ordinates
	 *	@example $('#map').moveTo({mapCenter: [55.958858,-3.162302], centerMethod: "pan"});
	 *	@desc Pans from the current position to the selected co-ordinates
	 *	@example $('#map').moveTo({mapCenter: [55.958858,-3.162302], mapType: "map"});
	 *	@desc Centers the map on the selected co-ordinates and changes maptype to Map
	 *	@param Object options (optional) An object containing options
	 *	@param Function callback (optional) An optional callback
	 *	@type jQuery
	 *	@name moveTo
	 */
	$.fn.moveTo = function(options, callback) {
		return this.each(function(){
			new $.jmap.moveTo(options, callback)
		});
	}
	
	/**
	 *	Saves the current position or retrives the save position
	 *	@example $('#map').savePosition();
	 *	@desc Saves the current position
	 *	@example $('#map').savePosition({recall:true});
	 *	@desc Recalls the saved position and centers the map on it
	 *	@param Object options (optional) An object containing options
	 *	@param Function callback (optional) An optional callback
	 *	@type jQuery
	 *	@name savePosition
	 */
	$.fn.savePosition = function(options, callback) {
		return this.each(function(){
			new $.jmap.savePosition(options, callback)
		});
	}
	
	/**
	 *	Enables the map keyboard handler, which allows the map to capture keyboard events.
	 *	@example $('#map').createKeyboardHandler();
	 *	@desc Creates the keyboard handler
	 *	@param Function callback (optional) An optional callback
	 *	@type none
	 *	@name createKeyboardHandler
	 */
	$.fn.createKeyboardHandler = function(callback){
		return this.each(function(){
			new $.jmap.createKeyboardHandler(callback);
		});
	}
	
})(jQuery);
