function getAddDirectionsJS(){
		$_output = ""; 
		 
		foreach($this->_directions as $directions){
			$dom_id = $directions["dom_id"];			
			$travelModeParams = array();
			$directionsParams = "";         
			if($this->walking_directions==TRUE)
				$directionsParams .= ", \n travelMode:google.maps.DirectionsTravelMode.WALKING";
			else if($this->biking_directions==TRUE)
				$directionsParams .= ", \n travelMode:google.maps.DirectionsTravelMode.BICYCLING";
			else
				$directionsParams .= ", \n travelMode:google.maps.DirectionsTravelMode.DRIVING";
		   
			if($this->avoid_highways==TRUE)
			   $directionsParams .= ", \n avoidHighways: true";
			if($this->avoid_tollways==TRUE)
			   $directionsParams .= ", \n avoidTolls: true";

			if($this->directions_unit_system!=''){
			    if($this->directions_unit_system == 'METRIC'){
			        $directionsParams .= ", \n unitSystem: google.maps.DirectionsUnitSystem.METRIC";
			    }else{
			        $directionsParams .= ", \n unitSystem: google.maps.DirectionsUnitSystem.IMPERIAL";
			    }
			}
			
			$_output .= "
			    directions".$this->map_id."['$dom_id'] = {
					displayRenderer:new google.maps.DirectionsRenderer(),
					directionService:new google.maps.DirectionsService(),
					request:{
            					waypoints: [{$this->_waypoints_string}],
						origin: '".$directions["start"]."',
						destination: '".$directions["dest"]."'
						$directionsParams
					}
					".(($this->elevation_directions)?",		
					   selector: '".$directions["elevation_dom_id"]."',
					   chart: new google.visualization.ColumnChart(document.getElementById('".$directions["elevation_dom_id"]."')),
					   service: new google.maps.ElevationService(),
					   width:".$directions["width"].",
					   height:".$directions["height"].",
					   focusColor:'#00FF00',
					   marker:null
				   ":"")."
				};
				directions".$this->map_id."['$dom_id'].displayRenderer.setMap(map".$this->map_id.");
				directions".$this->map_id."['$dom_id'].displayRenderer.setPanel(document.getElementById('$dom_id'));
				directions".$this->map_id."['$dom_id'].directionService.route(directions".$this->map_id."['$dom_id'].request, function(response, status) {
					if (status == google.maps.DirectionsStatus.OK) {
					   directions".$this->map_id."['$dom_id'].displayRenderer.setDirections(response);
					   ".(($this->elevation_directions)?"
						   directions".$this->map_id."['$dom_id'].service.getElevationAlongPath({
							   path: response.routes[0].overview_path,
							   samples: ".$directions["elevation_samples"]."
						   }, function(results,status){plotElevation(results,status, directions".$this->map_id."['$dom_id'], map".$this->map_id.", elevationCharts".$this->map_id.");});
					   ":"")."
					}
				});
			 ";
		 }
		 
		 return $_output;
	 }
function getAddDirectionsJS(){
		$_output = ""; 
		 
		foreach($this->_directions as $directions){
			$dom_id = $directions["dom_id"];			
			$travelModeParams = array();
			$directionsParams = "";         
			if($this->walking_directions==TRUE)
				$directionsParams .= ", \n travelMode:google.maps.DirectionsTravelMode.WALKING";
			else if($this->biking_directions==TRUE)
				$directionsParams .= ", \n travelMode:google.maps.DirectionsTravelMode.BICYCLING";
			else
				$directionsParams .= ", \n travelMode:google.maps.DirectionsTravelMode.DRIVING";
		   
			if($this->avoid_highways==TRUE)
			   $directionsParams .= ", \n avoidHighways: true";
			if($this->avoid_tollways==TRUE)
			   $directionsParams .= ", \n avoidTolls: true";

			if($this->directions_unit_system!=''){
			    if($this->directions_unit_system == 'METRIC'){
			        $directionsParams .= ", \n unitSystem: google.maps.DirectionsUnitSystem.METRIC";
			    }else{
			        $directionsParams .= ", \n unitSystem: google.maps.DirectionsUnitSystem.IMPERIAL";
			    }
			}
			
			$_output .= "
			    directions".$this->map_id."['$dom_id'] = {
					displayRenderer:new google.maps.DirectionsRenderer(),
					directionService:new google.maps.DirectionsService(),
					request:{
            					waypoints: [{$this->_waypoints_string}],
						origin: '".$directions["start"]."',
						destination: '".$directions["dest"]."'
						$directionsParams
					}
					".(($this->elevation_directions)?",		
					   selector: '".$directions["elevation_dom_id"]."',
					   chart: new google.visualization.ColumnChart(document.getElementById('".$directions["elevation_dom_id"]."')),
					   service: new google.maps.ElevationService(),
					   width:".$directions["width"].",
					   height:".$directions["height"].",
					   focusColor:'#00FF00',
					   marker:null
				   ":"")."
				};
				directions".$this->map_id."['$dom_id'].displayRenderer.setMap(map".$this->map_id.");
				directions".$this->map_id."['$dom_id'].displayRenderer.setPanel(document.getElementById('$dom_id'));
				directions".$this->map_id."['$dom_id'].directionService.route(directions".$this->map_id."['$dom_id'].request, function(response, status) {
					if (status == google.maps.DirectionsStatus.OK) {
					   directions".$this->map_id."['$dom_id'].displayRenderer.setDirections(response);
					   ".(($this->elevation_directions)?"
						   directions".$this->map_id."['$dom_id'].service.getElevationAlongPath({
							   path: response.routes[0].overview_path,
							   samples: ".$directions["elevation_samples"]."
						   }, function(results,status){plotElevation(results,status, directions".$this->map_id."['$dom_id'], map".$this->map_id.", elevationCharts".$this->map_id.");});
					   ":"")."
					}
				});
			 ";
		 }
		 
		 return $_output;
	 }
function getAddDirectionsJS ( ) { $ _output = "" ; foreach ( $ this -> _directions as $ directions ) { $ dom_id = $ directions [ "dom_id" ] ; $ travelModeParams = array ( ) ; $ directionsParams = "" ; if ( $ this -> walking_directions == TRUE ) $ directionsParams .= ", \n travelMode:google.maps.DirectionsTravelMode.WALKING" ; else if ( $ this -> biking_directions == TRUE ) $ directionsParams .= ", \n travelMode:google.maps.DirectionsTravelMode.BICYCLING" ; else $ directionsParams .= ", \n travelMode:google.maps.DirectionsTravelMode.DRIVING" ; if ( $ this -> avoid_highways == TRUE ) $ directionsParams .= ", \n avoidHighways: true" ; if ( $ this -> avoid_tollways == TRUE ) $ directionsParams .= ", \n avoidTolls: true" ; if ( $ this -> directions_unit_system != '' ) { if ( $ this -> directions_unit_system == 'METRIC' ) { $ directionsParams .= ", \n unitSystem: google.maps.DirectionsUnitSystem.METRIC" ; } else { $ directionsParams .= ", \n unitSystem: google.maps.DirectionsUnitSystem.IMPERIAL" ; } } $ _output .= "
			    directions" . $ this -> map_id . "['$dom_id'] = {
					displayRenderer:new google.maps.DirectionsRenderer(),
					directionService:new google.maps.DirectionsService(),
					request:{
            					waypoints: [{$this->_waypoints_string}],
						origin: '" . $ directions [ "start" ] . "',
						destination: '" . $ directions [ "dest" ] . "'
						$directionsParams
					}
					" . ( ( $ this -> elevation_directions ) ? ",		
					   selector: '" . $ directions [ "elevation_dom_id" ] . "',
					   chart: new google.visualization.ColumnChart(document.getElementById('" . $ directions [ "elevation_dom_id" ] . "')),
					   service: new google.maps.ElevationService(),
					   width:" . $ directions [ "width" ] . ",
					   height:" . $ directions [ "height" ] . ",
					   focusColor:'#00FF00',
					   marker:null
				   " : "" ) . "
				};
				directions" . $ this -> map_id . "['$dom_id'].displayRenderer.setMap(map" . $ this -> map_id . ");
				directions" . $ this -> map_id . "['$dom_id'].displayRenderer.setPanel(document.getElementById('$dom_id'));
				directions" . $ this -> map_id . "['$dom_id'].directionService.route(directions" . $ this -> map_id . "['$dom_id'].request, function(response, status) {
					if (status == google.maps.DirectionsStatus.OK) {
					   directions" . $ this -> map_id . "['$dom_id'].displayRenderer.setDirections(response);
					   " . ( ( $ this -> elevation_directions ) ? "
						   directions" . $ this -> map_id . "['$dom_id'].service.getElevationAlongPath({
							   path: response.routes[0].overview_path,
							   samples: " . $ directions [ "elevation_samples" ] . "
						   }, function(results,status){plotElevation(results,status, directions" . $ this -> map_id . "['$dom_id'], map" . $ this -> map_id . ", elevationCharts" . $ this -> map_id . ");});
					   " : "" ) . "
					}
				});
			 " ; } return $ _output ; }
function to render proper calls for directions - for now can only be used on a map, not a streetview
function to render proper calls for directions - for now can only be used on a map not a streetview