/*  Brooklyn Greenway Initiative
    Thaddeus Diamond
    Copyright 2009

    Implementation of Google Maps API project.
    Source files include gmaps.html, initialization.js, and default.css
*/

function initialize() {
      if (GBrowserIsCompatible()) {
	//initialize and center map, set controls, disable dragging
	var GBarOptions = {
		googleBarOptions : {
			style : "new",
			suppressZoomToBounds : true } }
        var map = new GMap2(document.getElementById("map_space"), GBarOptions);
	//Creates the appropriate zoom and boundaries
	var allowedBounds = new GLatLngBounds(new GLatLng(40.63700560443392, -74.09523010), new GLatLng(40.765, -73.91));
	//var zoomlevel = (map.getBoundsZoomLevel(allowedBounds));
	var mapcenter = new GLatLng(40.69386422389826, -74.00135151977539);
	map.setCenter(mapcenter, 13);
	
	/*Checking to see if the Greenway has capabilities for Street View
	streetview = new GStreetviewOverlay();
	map.addOverlay(streetview);
	Reveals that the attractions/parts of the greenway are not covered
	However, after the greenway path is overlayed perhaps clicking on it can create a
	street view at the given point.
	See http://code.google.com/apis/maps/documentation/services.html#Streetview for documentation. */

	//Create title
	function Welcome() {
	}
	Welcome.prototype = new GOverlay();

	/*
	* The following are the initialize, remove, copy and redraw functions needed for each custom overlay
	*/
	Welcome.prototype.initialize = function(map) {
	  //Create DIV holding welcome
	  var welcome = document.createElement("div");
	  welcome.setAttribute("id", "welcome");
	  welcome.innerHTML = "<h1 align='center'><font color='#ffffff' face='verdana'>The Brooklyn Waterfront Greenway</font></h1>";
	  welcome.style.position = "absolute";
  	  welcome.style.width = "600px";
	  welcome.style.height = "500px";
	  welcome.style.border = "0px";

	  // Set the z-index of the welcome text
	  var layer = G_MAP_MAP_PANE;
	  map.getPane(layer).appendChild(welcome);

	  // Set the map and DIV properties of the Route object
	  this.map_ = map;
	  this.div_ = welcome;

	  // Turn SW and NE bounds from LatLng to DIV pixels to align that DIV on the map
	  var c1 = this.map_.fromLatLngToDivPixel(new GLatLng(40.63675, -74.09576));
	  var c2 = this.map_.fromLatLngToDivPixel(new GLatLng(40.75025, -73.90949));
	  this.div_.style.left = c1.x + "px";
	  this.div_.style.top = c2.y + "px";
	}

	Welcome.prototype.remove = function() {
	  this.div_.parentNode.removeChild(this.div_);
	}

	Welcome.prototype.copy = function() {
	  return new Welcome();
	}

	Welcome.prototype.redraw = function (force) {
	  if (!force) return;

	  // Reposition the DIV the same as we did in the initialization function
	  // the only difference being this time the height and width are resized
	  var c1 = this.map_.fromLatLngToDivPixel(new GLatLng(40.63675, -74.09576));
	  var c2 = this.map_.fromLatLngToDivPixel(new GLatLng(40.75025, -73.90949));

	  this.div_.style.width = Math.abs(c2.x - c1.x) + "px";
	  this.div_.style.height = Math.abs(c2.y - c1.y) + "px";
	  this.div_.style.left = c1.x + "px";
	  this.div_.style.top = c2.y + "px";

	  if (this.map_.getZoom()!=12)
		this.div_.style.display='none';
	  else
		this.div_.style.display='';
	
	}
	
	//Empty constructor function
	function Route() {
	}
	Route.prototype = new GOverlay();

	/*
	* The following are the initialize, remove, copy and redraw functions needed for each custom overlay
	*/
	Route.prototype.initialize = function(map) {
	  // Create the DIV that holds the route
	  var route = document.createElement("div");
	  route.setAttribute("id", "route");
	  route.innerHTML = "<img src='route.png' width='100%' height='100%' />";
	  route.style.position = "absolute";
	  route.style.border = "0px";

	  // This places the route flat against the mapat the same z-index as the map itself
	  // (below the marker shadows)
	  map.getPane(G_MAP_MAP_PANE).appendChild(route);

	  // Set the map and DIV properties of the Route object
	  this.map_ = map;
	  this.div_ = route;

	  // Turn SW and NE bounds from LatLng to DIV pixels to align that DIV on the map
	  var c1 = this.map_.fromLatLngToDivPixel(new GLatLng(40.63675, -74.09576));
	  var c2 = this.map_.fromLatLngToDivPixel(new GLatLng(40.75025, -73.90949));
	  this.div_.style.left = c1.x + "px";
	  this.div_.style.top = c2.y + "px";
	}

	Route.prototype.remove = function() {
	  this.div_.parentNode.removeChild(this.div_);
	}

	Route.prototype.copy = function() {
	  return new Route();
	}

	Route.prototype.redraw = function(force) {
	  // We only need to redraw if the coordinate system has changed
	  if (!force) return;

	  if (this.map_.getZoom() <= 15)
		this.div_.innerHTML= "<img src='routethick.png' width='100%' height='100%' />";
	  else
		this.div_.innerHTML= "<img src='routemedium.png' width='100%' height='100%' />";
	  /*else
		this.div_.innerHTML= "<img src='routethin.png' width='100%' height='100%' />";*/


	  // Reposition the DIV the same as we did in the initialization function
	  // the only difference being this time the height and width are resized
	  var c1 = this.map_.fromLatLngToDivPixel(new GLatLng(40.63675, -74.09576));
	  var c2 = this.map_.fromLatLngToDivPixel(new GLatLng(40.75025, -73.90949));

	  this.div_.style.width = Math.abs(c2.x - c1.x) + "px";
	  this.div_.style.height = Math.abs(c2.y - c1.y) + "px";
	  this.div_.style.left = c1.x + "px";
	  this.div_.style.top = c2.y + "px";
	}

	var greenway = new Route();
	map.addOverlay(greenway);

	var header = new Welcome();
	map.addOverlay(header);


	/*Following code to create custom zoom taken from
	http://econym.org.uk/gmap/example_range.htm*/
	
	// Get the list of map types      
      	var mt = map.getMapTypes();
      	// Overwrite the getMinimumResolution() and getMaximumResolution() methods
        for (var i=0; i<mt.length; i++) {
          mt[i].getMinimumResolution = function() {return 12;}
          mt[i].getMaximumResolution = function() {return 20;}
        }
	
	/*Following code to keep map in bounds taken from
	http://econym.org.uk/gmap/example_range.htm*/

	GEvent.addListener(map, "move", function() {
        checkBounds();
	});

	// If the map position is out of range, move it back
      	function checkBounds() {
        // Perform the check and return if OK
        if (allowedBounds.contains(map.getCenter())) {
          return;
        } else {
        // It`s not OK, so find the nearest allowed point and move there
        var C = map.getCenter();
        var X = C.lng();
        var Y = C.lat();

        var AmaxX = allowedBounds.getNorthEast().lng();
        var AmaxY = allowedBounds.getNorthEast().lat();
        var AminX = allowedBounds.getSouthWest().lng();
        var AminY = allowedBounds.getSouthWest().lat();

        if (X < AminX) {X = AminX;}
        if (X > AmaxX) {X = AmaxX;}
        if (Y < AminY) {Y = AminY;}
        if (Y > AmaxY) {Y = AmaxY;}
        //alert ("Restricting "+Y+" "+X);
        map.setCenter(new GLatLng(Y,X));
	}
	}

	/*  The following code taken and modified from the Google Developer's Guide for the Google Maps API
	*/
	// A Rectangle is a simple overlay that outlines a lat/lng bounds on the
	// map. It has a border of the given weight and color and can optionally
	// have a semi-transparent background color.
	function Rectangle() {
	  this.bounds_ = new GLatLngBounds(new GLatLng(40.63675, -74.09576), new GLatLng(40.75025, -73.90949));
	  this.weight_ = 7;
	  this.color_ = "#0000cc";
	}

	Rectangle.prototype = new GOverlay();

	// Creates the DIV representing this rectangle.
	Rectangle.prototype.initialize = function(map) {
	  // Create the DIV representing our rectangle
	  var div = document.createElement("div");
	  div.style.border = this.weight_ + "px dashed " + this.color_;
	  div.style.position = "absolute";

	  // Our rectangle is flat against the map, so we add our selves to the
	  // MAP_PANE pane, which is at the same z-index as the map itself (i.e.,
	  // below the marker shadows)
	  map.getPane(G_MAP_MAP_PANE).appendChild(div);

	  this.map_ = map;
	  this.div_ = div;
	}

	// Remove the main DIV from the map pane
	Rectangle.prototype.remove = function() {
	  this.div_.parentNode.removeChild(this.div_);
	}

	// Copy our data to a new Rectangle
	Rectangle.prototype.copy = function() {
	  return new Rectangle();
	}

	// Redraw the rectangle based on the current projection and zoom level
	Rectangle.prototype.redraw = function(force) {
	  // We only need to redraw if the coordinate system has changed
	  if (!force) return;

	  // Calculate the DIV coordinates of two opposite corners of our bounds to
	  // get the size and position of our rectangle
	  var c1 = this.map_.fromLatLngToDivPixel(this.bounds_.getSouthWest());
	  var c2 = this.map_.fromLatLngToDivPixel(this.bounds_.getNorthEast());

	  // Now position our DIV based on the DIV coordinates of our bounds
	  this.div_.style.width = Math.abs(c2.x - c1.x) + "px";
	  this.div_.style.height = Math.abs(c2.y - c1.y) + "px";
	  this.div_.style.left = (Math.min(c2.x, c1.x) - this.weight_) + "px";
	  this.div_.style.top = (Math.min(c2.y, c1.y) - this.weight_) + "px";
	}

	// Display a rectangle in the center of the map at about a quarter of
	// the size of the main map
	map.addOverlay(new Rectangle());
	

	/*My control to limit zooming, unnecessary w/Econym code
	GEvent.addListener(map, "zoomend", function()   {
		var newZoomLevel = map.getZoom();
		if(newZoomLevel < 12) {
  			map.setZoom(12);
		}
	});*/

	//Add controls
	var bottomRight = new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(10,10));
        map.addControl(new GLargeMapControl3D());
  	map.addControl(new GScaleControl(), bottomRight);
	map.addControl(new GMapTypeControl());
	map.enableGoogleBar();
	//map.disableDragging();

	//This sets the Google Map to satellite mode
	map.setMapType(G_SATELLITE_MAP);

	//Bubble for load and click on BGI office.
	var opening = "<div id='mainframe'><p><h3 align='center'>Brooklyn Waterfront Greenway Initiative Office</h3></p><p>Brooklyn Greenway Initiative, Inc. (BGI) is a non-profit organization formed in 2004 to plan and implement the Brooklyn Waterfront Greenway.  BGI staff members and volunteers have worked since 1998 to build and sustain the political, public, civic, and government partnerships necessary to create a continuous 14-mile waterfront greenway from Greenpoint to Bay Ridge, Brooklyn.</div></p>"
	var openLoc = new GLatLng(40.63186422389826, -74.01325151977539);
	//map.openInfoWindowHtml(openLoc, opening);

	//Create the BGI office logo
	var logo = new GIcon();
	logo.image ="bgi_logo.png";
	logo.iconSize = new GSize(50, 50);
	logo.iconAnchor = new GPoint(30, 30);
	logo.infoWindowAnchor = new GPoint(18, 0);
	var markerLogo = { icon:logo };

	//The first point is the BGI office (STAR ICON)  
	var BGIpoint = new GLatLng(40.6869024,-74.0017932); 
	var BGI = new GMarker(BGIpoint, markerLogo);
	map.addOverlay(BGI);

	//Open an info window on BGI when clicked
	GEvent.addListener(BGI, "click", function() {
	if (map.getZoom()==12) {
		map.setCenter(mapcenter);
		map.openInfoWindowHtml(openLoc, opening);
	} else
		BGI.openInfoWindowHtml(opening);
	});

	//GREENWAY COMPONENT ICONS
	
	//Component icon
	//Create the array of component markers (includes BGI office)
	var components = [];
	
	var component = new GIcon();
	
	component.image ="component.png";
	component.iconSize = new GSize(35, 35);
	component.iconAnchor = new GPoint(0, 30);
	component.infoWindowAnchor = new GPoint(9, 2);
	var markerComponent = { icon:component };

	//The next point is Red Hook park
	var RHPpoint = new GLatLng(40.6715756, -74.0040447);
	var RHP = new GMarker(RHPpoint, markerComponent);
	components.push(RHP);

	//Open an info window on RHP when clicked
	GEvent.addListener(RHP, "click", function() {
	var string = "<div id='markerstringsmall'><p align='center'></p><p><h3 align='center'>Red Hook Park</h3></p><p><img src='redhookpark.png' alt='Red Hook Park' align ='left' />The 58-acre Red Hook Park is a center of community life. Unique in the diversity of facilities it offers, the park includes handball courts, soccer, baseball, and football fields, a running track, the Red Hook Pool, Red Hook Community Farm, picnic areas and some of New York’s best Latin-American food vendors.</p>"
	RHP.openInfoWindowHtml(string);
	});
	
	//The next point is Bush Terminal Piers and Park
	var BTPpoint = new GLatLng(40.6530637, -74.0198096);
	var BTP = new GMarker(BTPpoint, markerComponent);
	components.push(BTP);

	//Open an info window on Bush Terminal when clicked
	GEvent.addListener(BTP, "click", function() {
	var string = "<div id='markerstringlarge'><p><h3 align='center'>Bush Terminal Piers and Park</h3></p><p><img src='bushterminals.png' alt='Bush Terminal Piers and Park' align ='right' />Constructed in 1902, Bush Terminal was a thriving industrial complex which included port facilities and a 21-mile rail system. Today, the city, state and federal government are funding an environmental cleanup and construction of the planned Bush Terminal Park, which will included ballfields, a wetland wildlife area and an environmental education center. This 23-acre park will be served by the Sunset Park Greenway-Blueway.</p></div>"
	BTP.openInfoWindowHtml(string);
	});

	//The next point is Brooklyn Bridge Park
	var BBPpoint = new GLatLng(40.6979898723535, -73.99970054626465);
	var BBP = new GMarker(BBPpoint, markerComponent);
	components.push(BBP);

	//Open an info window on Brooklyn Bridge Park when clicked
	GEvent.addListener(BBP, "click", function() {
	var string = "<div id='markerstringlarge'><p><h3 align='center'>Brooklyn Bridge Park</h3></p><p><img src='brooklynbridge.png' alt='Brooklyn Bridge Park' align ='left' />Brooklyn Bridge Park is an 85-acre project that will transform 1.3 miles of industrial waterfront into ball fields, lawns, recreational areas, beaches, coves, restored habitats and playgrounds stretching from the Manhattan Bridge to Atlantic Avenue.  Three sections are already in place: Fulton Ferry Landing, Empire-Fulton Ferry State Park, and Main Street City Park.</p>"
	BBP.openInfoWindowHtml(string);
	});

	//The next point is Bushwick Inlet
	var BIpoint = new GLatLng(40.72385142965586, -73.96056175231934);
	var BI = new GMarker(BIpoint, markerComponent);
	components.push(BI);

	//Open an info window on Bushwick Inlet when clicked
	GEvent.addListener(BI, "click", function() {
	var string = "<div id='markerstringlarge'><p><h3 align='center'>Bushwick Inlet</h3></p><p><img src='bushwickinlet.png' alt='Bushwick Inlet' align ='right' />Bushwick Inlet was the launch site for the ironclad Civil War warship <i>USS Monitor</i>.  In 2005, the Greenpoint and Williamsburg waterfront was rezoned from industrial to residential, paving the way for a new waterfront park.  This 28-acre open space will include a waterfront esplanade, ballfields, a boathouse, a performance area, a beach and other amenities.</p></div>"
	BI.openInfoWindowHtml(string);
	});

	//ATTRACTIONS ICONS
	//Create the array of attraction markers
	var attractions = [];
	
	//Attraction icon
	var attraction = new GIcon();
	attraction.image ="attraction.png";
	attraction.iconSize = new GSize(35, 35);
	attraction.iconAnchor = new GPoint(0, 30);
	attraction.infoWindowAnchor = new GPoint(9, 2);
	var markerAttraction = { icon:attraction };

	//The next point is Newtown Creek
	var NCpoint = new GLatLng(40.73929850976109, -73.9555835723877);
	var NC = new GMarker(NCpoint, markerAttraction);
	attractions.push(NC);

	//Open an info window on Newtown Creek when clicked
	GEvent.addListener(NC, "click", function() {
	var string = "<div id='markerstring'><p><h3 align='center'>Newtown Creek</h3></p><p><img src='newtowncreek.png' alt='Newtown Creek' align ='left' />From the time its shores were first settled, Newtown Creek has gone through a number of transformations, from farming and shipbuilding to oil refineries and storage tanks, which contributed to the nation's largest oil spill.  Today, cleanup efforts are underway and new life is springing up along its shores, including plans for a new waterfront park at the foot of Manhattan Avenue.</p></div>"
	NC.openInfoWindowHtml(string);
	});
	
	//The next point is Brooklyn Navy Yard
	var BNYpoint = new GLatLng(40.7000071096344, -73.96575450897217);
	var BNY = new GMarker(BNYpoint, markerAttraction);
	attractions.push(BNY);

	//Open an info window on Brooklyn Navy Yard when clicked
	GEvent.addListener(BNY, "click", function() {
	var string = "<div id='markerstringsmall'><p><h3 align='center'>Brooklyn Navy Yard</h3></p><p><img src='brooklynnavyyard.png' alt='Brooklyn Navy Yard' align ='right' />Founded in 1801, the Brooklyn Navy Yard was once America's premier shipbuilding facility, playing a crucial role in wars, including WWII when 75,000 people were employed at the yard's shipbuilding and repair facilities.  The Brooklyn Navy Yard Development Corporation now manages this thriving 300-acre industrial park.</p></div>"
	BNY.openInfoWindowHtml(string);
	});
	
	//The next point is Atlantic Basin
	var ABpoint = new GLatLng(40.6826758567492, -74.01160955429077);
	var AB = new GMarker(ABpoint, markerAttraction);
	attractions.push(AB);

	//Open an info window on Atlantic Basin when clicked
	GEvent.addListener(AB, "click", function() {
	var string = "<div id='markerstring'><p><h3 align='center'>Atlantic Basin</h3></p><p><img src='atlanticbasin.png' alt='Atlantic Basin' align ='left' />Atlantic Basin, completed in 1847, has been at the center of Brooklyn's working waterfront for over 150 years.  That tradition has continued with the opening of the Brooklyn Cruise Terminal, built to accomodate one of the world's largest cruise ships, <i>Queen Mary 2</i>. Redevelopment plans are underway to create vibrant, new public and cultural spaces, a ferry stop and better connections to the waterfront.</p></div>"
	AB.openInfoWindowHtml(string);
	});

	//The next point is The Waterfront Museum and Showboat Barge
	var WMSBpoint = new GLatLng(40.67556270253005, -74.01867985725403);
	var WMSB = new GMarker(WMSBpoint, markerAttraction);
	attractions.push(WMSB);

	//Open an info window on The Waterfront Museum when clicked
	GEvent.addListener(WMSB, "click", function() {
	var string = "<div id='markerstringlarge'><p><h3 align='center'>The Waterfront Museum and Showboat Barge</h3></p><p><img src='waterfrontmuseum.png' alt='The Waterfront Museum and Showboat Barge' align ='right' />Listed on the National Register of Historic Places, this unique wooden vessel, located on Pier 44 at the end of Conover Street, is a compelling destination that provides access to the waterfront while celebrating the historic preservation of Brooklyn's industrial past.  Open every Thursday 4 p.m. to 8 p.m. or by appointment.  For more information, call (718) 624-4719 or visit the <a href:'http://www.waterfrontmuseum.org'>Waterfront Museum Site</a>.</p></div>"
	WMSB.openInfoWindowHtml(string);
	});

	//The next point is Erie Basin
	var EBpoint = new GLatLng(40.667568821693976, -74.01463508605957);
	var EB = new GMarker(EBpoint, markerAttraction);
	attractions.push(EB);

	//Open an info window on Erie Basin when clicked
	GEvent.addListener(EB, "click", function() {
	var string = "<div id='markerstringlarge'><p><h3 align='center'>Erie Basin</h3></p><p><img src='eriebasin.jpg' alt='Erie Basin' align ='left' />Erie Basin was built as the New York City transfer point for imports and exports shipped via the Erie Canal.  In 1861, it became a strategic location for ship repairs with the construction of the first of two graving docks.  Working barges and tugboats can still be found in Erie Basin with the best view located at the end of the Beard Street Pier, off of Van Brunt.</p></div>" 
	EB.openInfoWindowHtml(string);
	});

	//The next point is Gowanus Canal
	var GCpoint = new GLatLng(40.67023798563383, -73.99935722351074);
	var GC = new GMarker(GCpoint, markerAttraction);
	attractions.push(GC);

	//Open an info window on Gowanus Canal when clicked
	GEvent.addListener(GC, "click", function() {
	var string = "<div id='markerstring'><p><h3 align='center'>Gowanus Canal</h3></p><p><img src='gowanuscanal.png' alt='Gowanus Canal' align ='right' />The Gowanus Canal was once considered the nation's busiest commercial canal, and also its most polluted.  Recent repairs to the canal's flushing tunnel and a nearby sewage treatment plant brought back the fish, birds and boaters.  Keep your eyes open for blue crabs, egrets and cormorants.  Local enthusiasts have also seeded the canal with oysters.</p></div>"
	GC.openInfoWindowHtml(string);
	});

	//UNDER CONSTRUCTION ICONS

	//Creates a street view object in the street view div
	var streetview = document.getElementById("streetview");
	var panorama = new GStreetviewPanorama(streetview);

	//Camera icon for street view
	var camera = new GIcon();
	camera.image ="camera.png";
	camera.iconSize = new GSize(35, 35);
	camera.iconAnchor = new GPoint(0, 30);
	//camera.infoWindowAnchor = new GPoint(9, 2);
	var markerOptions = { icon:camera };

	//Hide the street view when the map is clicked again
	GEvent.addListener(map, "click", function() {
	  panorama.hide();
	});

	//Function to handle an error code for street view when the browser doesn't support Flash
	function handleNoFlash(errorCode) {
	    if (errorCode == 603) {
	      if (confirm("Error: Flash doesn't appear to be supported by your browser\nClick OK to be taken to the Flash Player site (Please disable your pop-up blocker)"))
		window.open("http://get.adobe.com/flashplayer/");
	      return;
	    }
	}
	GEvent.addListener(panorama, "error", handleNoFlash);

	/*Listeners & places for street view
	* The first line creates an array for all of the street view markers
	*/

	var streetviews = [];

	var dupont = new GLatLng(40.73535632201996, -73.95957469940185);
	var dupontst = new GMarker(dupont, markerOptions);
	streetviews.push(dupontst);
	GEvent.addListener(dupontst,"click", function() {
	  panorama.setLocationAndPOV(dupont);
    	});

	var india = new GLatLng(40.7315190495212, -73.96133422851562);
	var indiast = new GMarker(india, markerOptions);
	streetviews.push(indiast);
	GEvent.addListener(indiast,"click", function() {
	  panorama.setLocationAndPOV(india);
    	});

	var java = new GLatLng(40.73093368341445, -73.96120548248291);
	var javast = new GMarker(java, markerOptions);
	streetviews.push(javast);
	GEvent.addListener(javast,"click", function() {
	  panorama.setLocationAndPOV(java);
    	});

	var franklin = new GLatLng(40.72468945785642, -73.95777225494385);
	var franklinst = new GMarker(franklin, markerOptions);
	streetviews.push(franklinst);
	GEvent.addListener(franklinst,"click", function() {
	  panorama.setLocationAndPOV(franklin);
    	});

	var east = new GLatLng(40.72127439918443, -73.96317958831787);
	var eastriver = new GMarker(east, markerOptions);
	streetviews.push(eastriver);
	GEvent.addListener(eastriver,"click", function() {
	  panorama.setLocationAndPOV(east);
    	});

	var cumberland = new GLatLng(40.69811242655147, -73.97472381591797);
	var cumberlandst = new GMarker(cumberland, markerOptions);
	streetviews.push(cumberlandst);
	GEvent.addListener(cumberlandst,"click", function() {
	  panorama.setLocationAndPOV(cumberland);
    	});

	var john = new GLatLng(40.70455434560177, -73.9883279800415);
	var johnst = new GMarker(john, markerOptions);
	streetviews.push(johnst);
	GEvent.addListener(johnst,"click", function() {
	  panorama.setLocationAndPOV(john);
    	});

	var empire = new GLatLng(40.70439167854597, -73.99364948272705);
	var empirefulton = new GMarker(empire, markerOptions);
	streetviews.push(empirefulton);
	GEvent.addListener(empirefulton,"click", function() {
	  panorama.setLocationAndPOV(empire);
    	});

	var fulton = new GLatLng(40.7030577937025, -73.99489402770996);
	var fultonferry = new GMarker(fulton, markerOptions);
	streetviews.push(fultonferry);
	GEvent.addListener(fultonferry,"click", function() {
	  panorama.setLocationAndPOV(fulton);
    	});

	var furman = new GLatLng(40.70061769132372, -73.99635314941406);
	var furmanst = new GMarker(furman, markerOptions);
	streetviews.push(furmanst);
	GEvent.addListener(furmanst,"click", function() {
	  panorama.setLocationAndPOV(furman);
    	});

	var montague = new GLatLng(40.69609513189581, -73.99927139282226);
	var montaguest = new GMarker(montague, markerOptions);
	streetviews.push(montaguest);
	GEvent.addListener(montaguest,"click", function() {
	  panorama.setLocationAndPOV(montague);
    	});

	var atlantic = new GLatLng(40.6920928987952, -74.00107383728027);
	var atlanticave = new GMarker(atlantic, markerOptions);
	streetviews.push(atlanticave);
	GEvent.addListener(atlanticave,"click", function() {
	  panorama.setLocationAndPOV(atlantic);
    	});

	var columbia = new GLatLng(40.66654452852815, -74.01090145111084);
	var columbiast = new GMarker(columbia, markerOptions);
	streetviews.push(columbiast);
	GEvent.addListener(columbiast,"click", function() {
	  panorama.setLocationAndPOV(columbia);
    	});

	var twentieth = new GLatLng(40.665665620595604, -73.99884223937988);
	var twentiethst = new GMarker(twentieth, markerOptions);
	streetviews.push(twentiethst);
	GEvent.addListener(twentiethst,"click", function() {
	  panorama.setLocationAndPOV(twentieth);
    	});

	var fiftysecond = new GLatLng(40.650820092517755, -74.02300357818603);
	var fiftysecondst = new GMarker(fiftysecond, markerOptions);
	streetviews.push(fiftysecondst);
	GEvent.addListener(fiftysecondst,"click", function() {
	  panorama.setLocationAndPOV(fiftysecond);
    	});

	//Create a marker manager
	mgrcomp = new GMarkerManager(map);
	mgrcomp.addMarkers(components, 13);
	mgrcomp.refresh();
	mgrattr = new GMarkerManager(map);
	mgrattr.addMarkers(attractions, 13);
	mgrattr.refresh();
	mgrstreet = new GMarkerManager(map);
	mgrstreet.addMarkers(streetviews, 13);
	mgrstreet.refresh();
	}
}