	//check if the SWZ object exists
	if(Object.isUndefined(SWZ)){
		var SWZ = {};
	}

	
	
	SWZ.GoogleMaps = Class.create({
	
		//initialize(options);
		initialize:function(options){

			this.options = {			
				id		: '',	//the id of the div to hold the map
				lat 	: 0,	//the latitude of the centre of the map
				lng 	: 0,	//the longitude of the centre of the map
				zoom	: 13,	//the zoom level to start at
				controls: [new GLargeMapControl3D(),new GMapTypeControl()],	//array of controls to add to the map
				marker	: false,
				maptype : ''
			}
			
			//extend the object
			Object.extend(this.options,options || '');

		},
				
		create:function(){
		
			//create the map object
			thisMap = new GMap2($(this.options.id));
			
			
			//add the controls to the map
			for(i=0;i<this.options.controls.length;i++){
				thisMap.addControl(this.options.controls[i]);
			}
			
			//set the center
			thisMap.setCenter(new GLatLng(this.options.lat,this.options.lng),this.options.zoom);
			
			//check for maptype
			if(this.options.maptype != ''){
				switch(String(this.options.maptype).toUpperCase()){
					
					case 'SATELLITE':
						thisMap.setMapType(G_SATELLITE_MAP);
						break;
					
				}
			}


			if(this.options.marker==true){
				this.marker = new GMarker(new GLatLng(this.options.lat,this.options.lng), {});			
				thisMap.addOverlay(this.marker);
			}

		}
		
	});
	
	
	
	SWZ.GoogleMaps.LatLngUpdater = Class.create(SWZ.GoogleMaps,{
	
		initialize:function($super,options){
		
			this.options = {
				onUpdate : ''			
			}
			
			//extend the object
			Object.extend(this.options,options || '');
		
			//create the default options
			$super(this.options);		
		},
		
		create:function($super){
		
			//call the super class
			$super();
			
			//add the draggable marker to the map
			this.marker = new GMarker(new GLatLng(this.options.lat,this.options.lng), {draggable: true});			
			thisMap.addOverlay(this.marker);
			
			
			//add the event for onUpdate
			GEvent.addListener(this.marker, "dragend", this.update.bindAsEventListener(this.marker,this));
			GEvent.addListener(this.marker, "click", this.update.bindAsEventListener(this.marker,this));
						
		},
		
		update:function(m,obj){
			//get the lat and lng of the marker
			thisLat = m.lat();
			thisLng = m.lng();
			
			transport = {
				oLat 	: obj.options.lat,
				oLng 	: obj.options.lng,
				lat 	: thisLat,
				lng 	: thisLng,
				marker 	: obj.marker
			};
			
			obj.options.onUpdate(transport);
		},
		
		setMarkerLatLng:function(lat,lng){
			this.marker.setLatLng(new GLatLng(lat,lng));
			thisMap.setCenter(new GLatLng(lat,lng));
		}
	
	
	});
