Get directions on google map with jquery

Get directions on google map with jquery


Hi guys,
I am using a google maps implementation in an asp.net page.
Essentially i have a business with its location shown on a google map
on the page. On the asp.net side i just return instructions based on
the locations properties. let me show you my script
foreach(GoogleMapLocation g in profileElement.GetGoogleMapLocations())
{
%>
    <script type="text/javascript">
        $(document).ready(function() {
            if(GBrowserIsCompatible()) {
                var map = new GMap2(document.getElementById('map_canvas'));
                map.addControl(new GSmallMapControl());
                map.setCenter(new GLatLng(<%=g.GetLatitude()%>, <%=g.GetLongtitude
()%>), <%=g.GetZoomLevel()%>);
                var point = new GLatLng(<%=g.GetLatitude()%>, <%=g.GetLongtitude()
%>);
                var freeIcon = new GIcon();
                zIcon.image = "http://www.mysite.com/images/map/zpointer.png";
                zIcon.shadow = "http://www.mysite.com/images/map/zshadow.png";
                zIcon.iconSize = new GSize(20, 32);
                zIcon.shadowSize = new GSize(25, 32);
                zIcon.iconAnchor = new GPoint(10, 31);
                zIcon.infoWindowAnchor = new GPoint(9, 2);
                zIcon.infoShadowAnchor = new GPoint(18, 25);
                var premiumIcon = new GIcon();
                FirstIcon.image = "http://www.mysite.com/images/map/
Firstpointer.png";
                FirstIcon.shadow = "http://www.mysite.com/images/map/
Firstshadow.png";
                FirstIcon.iconSize = new GSize(20, 32);
                FirstIcon.shadowSize = new GSize(25, 32);
                FirstIcon.iconAnchor = new GPoint(10, 31);
                FirstIcon.infoWindowAnchor = new GPoint(9, 2);
                FirstIcon.infoShadowAnchor = new GPoint(18, 25);
                map.addOverlay(new GMarker(point, { title: '<
%=profileElement.GetTitle().Replace("'", "\\'")%>', icon: <%=
(profileElement.GetStatus() == ProfileStatus.Premium) ? "FirstIcon" :
"zIcon"%> }));
            }
        });
    </script>
        <div class="rightBoxInside">
            <div id="map_canvas" style="width: 250px; height: 250px"></div>
        </div><%
    }
%>
so <%=g.GetLatitude()%>, <%=g.GetLongtitude()%> gives me the lat long
for the business. Now i want to add the ability for a user to get
directions (gdir) but im not sure how to do that, can anyone help?
know i need a form entry to collec the users startlocation and a
submit to postback to this page but im not sure how to implement.
thanks,
ind1g3n