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)}
	}
	
	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);
		
		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.bindTo = function(element)
	{	
		$(element).bind("change",{gmapObj:this},function(e){			
			e.data.gmapObj.showPoints($(this).val());	
		});
	}
	
	this._createInfoWindow = function(name,address)
	{	
		return "<div><b>"+name+"</b></div><div>"+address+"</div>";		
	}
	
		
	this._createMarkerIcon = function(image) 
	{	
		var marker;
		
		if(image.icon){
			marker   		  = new GIcon();
			marker.image      = image.icon;
			marker.iconSize   = new GSize(image.icon_width,image.icon_height);			
			marker.iconAnchor = new GPoint(image.icon_width,image.icon_height);
			marker.infoWindowAnchor = new GPoint(0,0);
		}else{
			marker 			  = new GIcon(G_DEFAULT_ICON)
		}
		
		return marker;
	}
}