// JavaScript Document

  var map = null;
    var geocoder = null;
    function initialize(address) {

      if (GBrowserIsCompatible()) {

        map = new GMap2(document.getElementById("map"));
        geocoder = new GClientGeocoder();

      }
      if(address) { showAddress(address); }

    }

  function showAddress(address) {

      if (geocoder) {

         geocoder.getLatLng(
           address,
           function(point) {
             if (!point) {
               alert(address + " not found");
             } else {
               map.addControl(new GLargeMapControl());
               var mapControl = new GMapTypeControl();
               map.addControl(mapControl);
               map.setCenter(point, 11);
               var marker = new GMarker(point);
               map.addOverlay(marker);
               marker.openInfoWindowHtml(address);
             }
          }
        );
      }

  }

 









function inial_all()
{
 if (GBrowserIsCompatible()) {







	var count_mark=0;







	var gicons = [];







	gicons["yellow"] = new GIcon(G_DEFAULT_ICON, baseHref + "/images/colour086.png");







	gicons["purple"] = new GIcon(G_DEFAULT_ICON, baseHref + "/images/colour108.png");







	geocoder = new GClientGeocoder();







	 







function createMarker(point,html,icon) {







	var marker = new GMarker(point,gicons[icon]);







	GEvent.addListener(marker, "click", function() {







	  marker.openInfoWindowHtml(html);







	});







	return marker;







}







function showAddress_icon(address,icon) {







      if (geocoder) {







         geocoder.getLatLng(







           address,







           function(point) {







             if (!point) {







               alert(address + " not found");







             } else {







              if(count_mark==0)







			  {







				map1.setCenter(point, 11);







				}







               var marker = createMarker(point,address,icon);







               map1.addOverlay(marker);







			   count_mark++;







             }







          }







        );







      }







  }







      // Display the map, with some controls and set the initial location 







      var map1 = new GMap2(document.getElementById("map_all"));







      map1.addControl(new GLargeMapControl());







      map1.addControl(new GMapTypeControl());







     //map1.setCenter(new GLatLng(43.907787,-79.359741),8);







    // map.setCenter(point, 11);







      // Set up three markers with info windows 







//showAddress('431 Parkview Drive, Blue Eye, MO');







var data=document.page_map.op_all_address.value;







var data1=document.page_map.h_all_address.value;







var arr_data=data.split('|||');







var arr_data1=data1.split('|||');















for(var i=0;i<arr_data.length;i++)







{







	if(arr_data[i]!='')







	{







		showAddress_icon(arr_data[i],'yellow');







	}







}







for(var i=0;i<arr_data1.length;i++)







{







	if(arr_data1[i]!='')







	{







		showAddress_icon(arr_data1[i],'purple');







	}







}







    }







    // display a warning if the browser was not compatible







    else {







      alert("Sorry, the Google Maps API is not compatible with this browser");







    }







}



 
	// Create a directions object and register a map and DIV to hold the 
 
 
 
 
 
 
 
    // resulting computed directions
 
 
 
 
 
 
 
    var map1;
 
 
 
 
 
 
 
    var directionsPanel1;
 
 
 
 
 
 
 
    var directions1;
 
 
 
 
 
 
 
    function initialize1() {
 
 
 
 
 
 
 
	document.getElementById("get_Direction").style.display="none";
 
 
 
 
 
 
 
	//document.getElementById("map_canvas").style.display="block";
 
 
 
 
 
 
 
      map1 = new GMap2(document.getElementById("map"));
 
 
 
 
 
 
 
     // map.setCenter(new GLatLng(42.351505,-71.094455), 15);
 
 
 
 
 
 
 
	  map1.addControl(new GLargeMapControl());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
               var mapControl1 = new GMapTypeControl();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
               map1.addControl(mapControl1);
 
 
 
 
 
 
 
		document.getElementById('route').innerHTML='';
 
 
 
 
 
 
 
      directionsPanel1 = document.getElementById("route");
 
 
 
 
 
 
 
      directions1 = new GDirections(map1,directionsPanel1);
 
 
 
 
 
 
 
	  var from=document.getElementById("from_lo").value;
 
 
 
 
 
 
 
	    var to=document.getElementById("to_lo").value;
 
 
 
 
 
 
 
		
 
 
 
 
 
 
 
      directions1.load("from: "+from+" to:"+to);
 
 
 
 
 
 
 
    }
 
 
 
 
 
	// Create a directions object and register a map and DIV to hold the 
 
 
 
 
 
 
 
    // resulting computed directions
 
 
 
 
 
 
 
    var map_r;
 
 
 
 
 
 
 
    var directionsPanel_r;
 
 
 
 
 
 
 
    var directions_r;
 
 
 
 
 
 
 
    function initialize_routeall() {
 
 
 
 
 
 
 
	//document.getElementById("get_Direction").style.display="none";
 
 
 
 
 
 
 
	//document.getElementById("map_canvas").style.display="block";
 
 
 
 
 
 
 
      map_r = new GMap2(document.getElementById("map_all"));
 
 
 
 
 
 
 
     // map.setCenter(new GLatLng(42.351505,-71.094455), 15);
 
 
 
 
 
 
 
	  map_r.addControl(new GLargeMapControl());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
               var mapControl_r = new GMapTypeControl();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
               map_r.addControl(mapControl_r);
 
 
 
 
 
 
 
		document.getElementById('route').innerHTML='';
 
 
 
 
 
 
 
      directionsPanel_r = document.getElementById("route");
 
 
 
 
 
 
 
      directions_r = new GDirections(map_r,directionsPanel_r);
 
 
 
var add=document.page_map.op_all_address.value.split('|||');
 
 
 
var add1=document.page_map.h_all_address.value.split('|||');
 
 
 
var from='';
 
 
 
var to='';
 
 
 
	//  var from=document.getElementById("from_lo").value;
 
 
 
 
 
 
 
	//    var to=document.getElementById("to_lo").value;
 
 
 
 
 
 
 
		for(var i=0;i<add.length;i++)
 
 
 
		{
 
 
 
			if(add[i]!='')
 
 
 
			{
 
 
 
				if(from=='')
 
 
 
				{
 
 
 
				from="from: "+add[i];
 
 
 
				}
 
 
 
				else
 
 
 
				{
 
 
 
				to=to+" to:"+add[i];
 
 
 
				}
 
 
 
			}
 
 
 
		}
 
 
 
		for(var i=0;i<add1.length;i++)
 
 
 
		{
 
 
 
			if(add1[i]!='')
 
 
 
			{
 
 
 
				if(from=='')
 
 
 
				{
 
 
 
				from="from: "+add1[i];
 
 
 
				}
 
 
 
				else
 
 
 
				{
 
 
 
				to=to+" to:"+add1[i];
 
 
 
				}
 
 
 
			}
 
 
 
		}
 
 
 
 
 
	if(to=='')
 
	{
 
	var arr_to=from.split(':');
 
	to=" to:"+arr_to[1];
 
	}
 
 
 
	directions_r.load(from+to);
 
	document.getElementById("id_hide_route").style.display="block";
 
	document.getElementById("route").style.display="block";
 
	document.getElementById("id_show_route").style.display="none";
 
	    // directions1.load("from: "+from+" to:"+to);
 
    }
