function gMap(mapObj) 
{
	this.mapObj     = mapObj;	
	this.bounds     = new GLatLngBounds;
	this.points     = new Array();
	this.categories = new Array();
	
	this.addCategory   = function(category){		
		this.categories[category.name] = {icon:this._createMarkerIcon(category.icon)}
	}
	
	this.addPoint = function(point){
		var location    = new GLatLng(point.lat,point.long);
		var icon        = this.categories[point.category].icon;
		var show 		= point.always_show || 'false';
		var marker      = new GMarker(location,icon);
		var info		= this._createInfoWindow(point.name,point.address,point.website);
		
		this.points.push({category:point.category,marker:marker,info:info,show:show});
	}
	
	this.showPoints = function(category) 
	{
		category = category||"All";		
				
		this.mapObj.clearOverlays();
		this.bounds = new GLatLngBounds
		
		for(var i = 0; i < this.points.length; i++){			
			if(category == "All" || category == this.points[i].category || category.toString().indexOf(this.points[i].category)!=-1 || this.points[i].show == 'true'){
				this.mapObj.addOverlay(this.points[i].marker);				
				this.bounds.extend(this.points[i].marker.getPoint());
				this.points[i].marker.bindInfoWindowHtml(this.points[i].info);
			}
		}
		
		//this.mapObj.setZoom(this.mapObj.getBoundsZoomLevel(this.bounds));
		//this.mapObj.setCenter(this.bounds.getCenter());
		this.mapObj.setZoom(13);
		this.mapObj.setCenter(new GLatLng("37.784871","-122.408991"));
	}			
	
	this.bindTo = function(element)
	{	
		$(element).bind("change",{gmapObj:this},function(e){			
			e.data.gmapObj.showPoints($(this).val());	
		});
	}
	
	this._createInfoWindow = function(name,address,website)
	{	
		var string = "<div><b>"+name+"</b></div>";
		if(address) string = string+"<div>"+address+"</div>";
		if(website) string = string+"<div><a href='"+website+"' target='_blank'>"+website+"</a></div>";	
		
		return string;
	}	
		
	this._createMarkerIcon = function(opts) 
	{	
		var iconOptions 		 = {};
		iconOptions.width 		 = opts.width;
		iconOptions.height 		 = opts.height;
		iconOptions.primaryColor = opts.primaryColor;
		iconOptions.cornerColor  = opts.cornerColor;
		iconOptions.strokeColor  = opts.strokeColor;
		var marker 				 = MapIconMaker.createMarkerIcon(iconOptions);
		
		return marker;
	}
}