
		//<![CDATA[
		var map;
		var icon0;
		var newpoints = new Array();
		 
		function addLoadEvent(func) { 
			var oldonload = window.onload; 
			if (typeof window.onload != 'function'){ 
				window.onload = func
			} else { 
				window.onload = function() {
					oldonload();
					func();
				}
			}
		}
		 
		addLoadEvent(loadMap);
		addLoadEvent(addPoints);
		 
		function loadMap() {
			map = new GMap2(document.getElementById("map"));
			map.addControl(new GLargeMapControl());
			map.addControl(new GMapTypeControl());
		
			map.setCenter(new GLatLng(34.43409789359469, -112.1484375), 7, G_PHYSICAL_MAP);
		 
			icon0 = new GIcon();
			icon0.image = "http://www.trailstv.com/wp-content/themes/revolution_news-30/images/icons/biking.png";
			icon0.iconSize = new GSize(32, 32);
			icon0.iconAnchor = new GPoint(9, 34);
			icon0.infoWindowAnchor = new GPoint(9, 2);
			icon0.infoShadowAnchor = new GPoint(18, 25);
			
			icon1 = new GIcon();
			icon1.image = "http://www.trailstv.com/wp-content/themes/revolution_news-30/images/icons/hiking.png";
			icon1.iconSize = new GSize(32, 32);
			icon1.iconAnchor = new GPoint(9, 34);
			icon1.infoWindowAnchor = new GPoint(9, 2);
			icon1.infoShadowAnchor = new GPoint(18, 25);
			
			icon2 = new GIcon();
			icon2.image = "http://www.trailstv.com/wp-content/themes/revolution_news-30/images/icons/water.png";
			icon2.iconSize = new GSize(32, 32);
			icon2.iconAnchor = new GPoint(9, 34);
			icon2.infoWindowAnchor = new GPoint(9, 2);
			icon2.infoShadowAnchor = new GPoint(18, 25);
			
			icon3 = new GIcon();
			icon3.image = "http://www.trailstv.com/wp-content/themes/revolution_news-30/images/icons/sailing.png";
			icon3.iconSize = new GSize(32, 32);
			icon3.iconAnchor = new GPoint(9, 34);
			icon3.infoWindowAnchor = new GPoint(9, 2);
			icon3.infoShadowAnchor = new GPoint(18, 25);

			icon4 = new GIcon();
			icon4.image = "http://www.trailstv.com/wp-content/themes/revolution_news-30/images/icons/skiing.png";
			icon4.iconSize = new GSize(32, 32);
			icon4.iconAnchor = new GPoint(9, 34);
			icon4.infoWindowAnchor = new GPoint(9, 2);
			icon4.infoShadowAnchor = new GPoint(18, 25);

			icon5 = new GIcon();
			icon5.image = "http://www.trailstv.com/wp-content/themes/revolution_news-30/images/icons/climbing.png";
			icon5.iconSize = new GSize(32, 32);
			icon5.iconAnchor = new GPoint(9, 34);
			icon5.infoWindowAnchor = new GPoint(9, 2);
			icon5.infoShadowAnchor = new GPoint(18, 25);

			icon6 = new GIcon();
			icon6.image = "http://www.trailstv.com/wp-content/themes/revolution_news-30/images/icons/kayaking.png";
			icon6.iconSize = new GSize(32, 32);
			icon6.iconAnchor = new GPoint(9, 34);
			icon6.infoWindowAnchor = new GPoint(9, 2);
			icon6.infoShadowAnchor = new GPoint(18, 25);

		}
		 
		function addPoints() {
		 
		newpoints[0] = new Array(-112.0602035522461, 33.331532222486274, icon0, '1', '<div id="popup" style="width:320px; height:100px;"><a href="http://www.trailstv.com/south-mountain-phoenix/">South Mountain, Phoenix</a><br/>South Mountain Park in Phoenix, Arizona is the largest municipal park in the world. Located in the south end of the valley, it is one of the citys favorite recreational areas. At over 16,000 acres, it boasts 51 miles of primary trails for horseback riding, hiking and mountain biking.<br/><br/></div>');
		newpoints[1] = new Array(-112.02484130859375, 36.2265501474709, icon0, '2', '<div id="popup" style="width:320px; height:100px;"><a href="http://www.trailstv.com/rainbow-rim-trail-grand-canyon/">Rainbow Rim Trail, Grand Canyon</a><br/>The Rainbow Rim Trail is an 18 mile stretch of single track that connects 5 view points along the north rim of the Grand Canyon. Overall, the ride is very enjoyable and some of the views are breath taking, which shouldn not come as a surprise.<br/><br/></div>');
		newpoints[2] = new Array(-111.766663, 34.862797, icon0, '3', '<div id="popup" style="width:320px; height:100px;"><a href="http://www.trailstv.com/mountain-biking-cathedral-rock-loop/">Cathedral Rock, Sedona</a><br/>Great trail with awesome scenery. The singletrack is quick and twisting. Lots of up and down with some technical sections to it. Halfway through you can take a dip into Oak Creek, and if you want you can swing on the rope and jump into Oak Creek.<br/><br/></div>');

		for(var i = 0; i < newpoints.length; i++) {
		 
				var point = new GPoint(newpoints[i][0],newpoints[i][1]);
		 
				//Add overlay to map 
				var popuphtml = newpoints[i][4] ;
				var marker = createMarker(point,newpoints[i][2],popuphtml);
				map.addOverlay(marker);
			}
		}
		 
		function createMarker(point, icon, popuphtml) {
			var marker = new GMarker(point, icon);
			GEvent.addListener(marker, "click", function() {
				marker.openInfoWindowHtml(popuphtml);
			});
			return marker;
		}
		 
		//]]>
