var List = {
					bounds:null,
					listings:null,
					init:function(map_id){
						List.listings = new Array();
						List.map = new GMap2(document.getElementById(map_id));
						List.map.addControl(new GSmallMapControl());
						
						
						//List.map.addControl(new GMapTypeControl());
						List.map.setCenter(new GLatLng(44.40, -73.2), 15);
						//List.construct();
						List.bounds = new GLatLngBounds();
						
						List.map.addMapType(G_PHYSICAL_MAP);
			
						var mapControl = new GHierarchicalMapTypeControl();
						
						// Set up map type menu relationships
						//mapControl.clearRelationships();
						mapControl.addRelationship(G_SATELLITE_MAP, G_HYBRID_MAP, "Labels", false);
						//mapControl.addRelationship(G_PHYSICAL_MAP, mtTerCross, "Crosshairs");
						
						// Add control after you've specified the relationships
						List.map.addControl(mapControl);
				
					},
					construct:function(Points,type){
						for(var p = 0; p < Points.length; p++){
							if(Points[p].lat == 0 || Points[p].lng == 0) continue;
						
							var li = new ListingInfo(Points[p], type);
							List.bounds.extend(li.geopoint);	
							List.listings.push(li);
						}
						List.map.setZoom(List.map.getBoundsZoomLevel(List.bounds));
						List.map.setCenter(List.bounds.getCenter());
					},
					onData:function(data){
						
					},
					filter:function(){
						var frm = document.forms['maptypeopts'];
						for(var m=0; m < List.listings.length; m++){
							
							if(List.listings[m].type == "campground"){
								if(frm.campgrounds.checked)
									List.listings[m].marker.show();
								else
									List.listings[m].marker.hide();
							}
							
							if(List.listings[m].type == "attraction"){
								if(frm.attractions.checked)
									List.listings[m].marker.show();
								else
									List.listings[m].marker.hide();
								
							}
						}
						
					}
					
				}
				
				
				function ListingInfo(listing, type){
					var This = this;
					this.listing = listing;
					this.type = type;
					//alert(listing.building.location.lat);
					this.geopoint = new GLatLng(listing.lat, listing.lng);
					
					this.icon = new GIcon();
					this.icon.image = "http://sites.legitify.com/campmass.com/images/marker_"+type+".png";
					this.icon.iconSize = new GSize(13, 13);
					this.icon.shadowSize = new GSize(13, 13);
					this.icon.iconAnchor = new GPoint(9, 9);
					this.icon.infoWindowAnchor = new GPoint(9, 9);

					this.marker = new GMarker(this.geopoint, this.icon);
					this.openInfo = function(){
						var html = "<div style='width:250px;height:20px'><h3 style='position:relative;margin:0';>"+This.listing.name+"</h3>";
						if(this.type == "campground") html += '<a href="'+WEB_HOME+'/campgrounds/detail/'+this.listing.linked+'" style="color:#0000cc;">View details</a>';
						html += "</div>";
						//alert(this.marker.openInfoWindowHtml);
						this.marker.openInfoWindowHtml(html);
					}
					GEvent.addListener(this.marker, "click", function(){
							This.openInfo(); 
					});
 				

					List.map.addOverlay(this.marker);										
				}	
				
