              var gmarkers = [];
              var htmls = [];
              var i = 0;
		var route16 = 1 ;
		var route27 = 1 ;
		var route50 = 1 ;
    function myclick(i) {
                                gmarkers[i].openInfoWindowHtml(htmls[i]);
                //      .setZoom(14);
    }                
    function clearroute() {

                map.removeOverlay(route72);
        //map.clearOverlays();
      }
    function showroute72() {
	map.removeOverlay(route72);
        map.removeOverlay(route27);
	map.removeOverlay(route16);
        map.removeOverlay(route50);
      //  map.setCenter(new GLatLng(30.0774 , -97.1357), 11);
	pttp72(map);
    }
    function showroute27() {
	map.removeOverlay(route27);
        map.removeOverlay(route72);
        map.removeOverlay(route16);
        map.removeOverlay(route50);
//	map.setCenter(new GLatLng(30.0774 , -97.1357), 11);
        pttp27(map);
     }
    function showroute16() {
	map.removeOverlay(route16);
        map.removeOverlay(route72);
        map.removeOverlay(route27);
        map.removeOverlay(route50);
  //      map.setCenter(new GLatLng(30.1005 , -97.2650), 11);
        pttp16(map);
     }
    function showroute50() {
	map.removeOverlay(route50);
        map.removeOverlay(route72);
        map.removeOverlay(route16);
        map.removeOverlay(route27);
    //    map.setCenter(new GLatLng(30.0702 , -97.1472), 11);
        pttp50(map);
     }

       //var map = 0 ;         

    function load() {
      if (GBrowserIsCompatible()) {
         map = new GMap2(document.getElementById("mapo"));
        map.setCenter(new GLatLng(30.0774 , -97.1357), 11);

        map.addControl(new GSmallZoomControl());
        map.addControl(new GScaleControl());
        map.addControl(new GMapTypeControl());
        map.enableDoubleClickZoom();
        map.addMapType(G_PHYSICAL_MAP);
        map.removeMapType(G_SATELLITE_MAP);

        // get string of glatlng
        GEvent.addListener(map, "moveend", function() {
                        var center = map.getCenter();
                        var reg = /\((.*\.\d\d\d\d).*,(.*\.\d\d\d\d).*/g;
                        var centeradj = center.toString();
                        var centeradja = centeradj.replace(reg,"$1 , $2");
        
                        //document.getElementById("message").innerHTML = centeradja;
                        // center marker
                        //
         });
 
        //* Create our "tiny" marker icon
        //
        var greenicon = new GIcon();
	greenicon.image = "images/icon_green.gif";
        greenicon.iconSize = new GSize(12, 20);
        greenicon.shadowSize = new GSize(22, 20);
        greenicon.iconAnchor = new GPoint(6, 20);
        greenicon.infoWindowAnchor = new GPoint(5, 1);

        var icon = new GIcon();
        icon.image = "images/mm_20_red.png";
        //icon.image = "http://texasunicycle.com/maps/images/centerblue.png";
        icon.shadow = "images/mm_20_shadow.png";
        //icon.shadow = "http://texasunicycle.com/maps/images/centerblue.png";
        icon.iconSize = new GSize(12, 20);
        icon.shadowSize = new GSize(22, 20);
        icon.iconAnchor = new GPoint(6, 20);
        icon.infoWindowAnchor = new GPoint(5, 1);

        // load route

        pttp72(map);
// map.removeOverlay(route72);
//map.clearOverlays();
        wayp = new Array(
                   Array(30.1178 , -97.3109,'Bastrop High School','1700 Chambers St'),
                   Array(30.0485 , -97.1627,'Buesher State Park Rest Stop ','This is the 1st Rest Stop for all routes except for the 16 mile route'),
                   Array(30.0836 , -97.0863,'St. Mary’s Church Rest Stop','This is second rest stop on longest route'),
                   Array(30.1162 , -96.9871,'Serbin - Wendish Museum Rest Stop','This is Third rest stop on longest route'),
                   Array(30.0102 , -97.0161,'Winchester Rest Stop','fourth rest stop on longest route and 2nd rest stop on 50 mile route'),
                   Array(30.0714 , -97.2294,'Just Past Alum Creek Road/Hwy 71 Rest Stop','First rest stop on shortest route, second rest stop on 27 miler, 3rd reststop on 50 miler and 5th reststop on longest route')
         );

        var html;
        var side_bar_html = '<h3>Choose the route length:</h3><p>'; 
	side_bar_html += '<a href="javascript:showroute16()">show 16 mile route</a><br>';
        side_bar_html += '<a href="javascript:showroute27()">show 27 mile route</a><br>';
	side_bar_html += '<a href="javascript:showroute50()">show 50 mile route</a><br>';
	side_bar_html += '<a href="javascript:showroute72()">show 63 mile route</a><br></p>';
	side_bar_html += '<h3>Rest Stops and Start Line:</h3><p>';
        function createMarker(x,y,name,desc) {
                var point = new GLatLng(x,y);
                var marker = new GMarker(point,icon);
                gmarkers[i] = marker;
                html = '<div style="width: 200px; padding: 0px; margin: 0px; font-size: 9px ;"><b>' + name + '</b></div>';
                htmls[i] = html;
                // add a line to the side_bar html
                side_bar_html += '<a href="javascript:myclick(' + i + ')">' + name + '</a><br>';
                i++;
                //GEvent.addListener(marker, "click", function() {
                     //    marker.openInfoWindowHtml('<div style="width: 150px; padding: 0px; margin: 0px; font-size: 9px ;"><b>' + name + '</b>' + "<br>" + desc + '</div>');
                GEvent.addListener(marker, "click", function() {
                         marker.openInfoWindowHtml('<div style="width: 200px; padding: 0px; margin: 0px; font-size: 9px ;"><b>' + name + '</b></div>');
	//		marker.openInfoWindowHtml('<div><b>' + name + '</b>' + "<br>" + desc + '</div>',{ maxWidth : '200px'  });
                   //    marker.openInfoWindow( name + ' ' + desc );

                         });
                map.addOverlay(marker);

         }

         var Ericway;
         for (Ericway in wayp) {
               createMarker(wayp[Ericway][0],wayp[Ericway][1],wayp[Ericway][2],wayp[Ericway][3]);
         }
	side_bar_html += '</p>';
         document.getElementById("side_bar").innerHTML = side_bar_html;
	//
	//testing
	//GInfoWindowOptions options = new GInfoWindowOptions("Max Title", "Max Content");
	//GInfoWindow window2 = new GInfoWindow(marker3, "infoWindow example", options);
	//GMap1.addInfoWindow(window2); 

      }
    }


