<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v = "urn:schemas-microsoft-com:vml">
    <head>
        <title>Fun With Bing Maps</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
        <script type="text/javascript" src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2"></script>
        <script type="text/javascript" >
            //Create a couple page level variables
            var map = null;
            var accountname = '';
            function GetMap() {
                //Get the Account data from the Account Form
                var controls = parent.Xrm.Page.ui.controls;
                accountname = controls.get("name").getAttribute().getValue();
                var street1 = controls.get("address1_line1").getAttribute().getValue();
                var state = controls.get("address1_stateorprovince").getAttribute().getValue();
                var city = controls.get("address1_city").getAttribute().getValue();
                var postcode = controls.get("address1_postalcode").getAttribute().getValue();
                var country = controls.get("address1_country").getAttribute().getValue();
                //If we have the City field populated, let's try and get a map.  Otherwise, let's exit.
                if (city != null) {
                    //Place into the map variable a NEW instance of the object VEMap and tie it to the myMap div section in our page body
                    map = new VEMap('myMap');
                    //Initialize the map
                    map.LoadMap();
                    var fulladdress = street1 + ', ' + city + ', ' + state + ', ' + postcode + ', ' + country;
                    //Search for the address and create the map
                    map.Find(accountname, fulladdress, VEFindType.Businesses, null, 0, 1, true, true, true, true, onfound);
                }
                else {
                    //If you don't have a city populated, you're likely in the process of creating the record
                    exit;
                }
            }
            function onfound(layer, resultsArray, places, hasMore, veErrorMessage) {
                if (places) {
                    //Create a PushPin object and place it at the Latitude/Longitude calculated from the map.Find
                    var shape = new VEShape(VEShapeType.Pushpin, places[0].LatLong);
                    //Give the PushPin a title
                    shape.SetTitle(accountname);
                    //Add the PushPin to the map
                    map.AddShape(shape);
                }
            }     Â
          </script>
          <link id="mapcontrolcss" rel="stylesheet" type="text/css" href="http://ecn.dev.virtualearth.net/mapcontrol/v6.3/css/bin/6.3.20091207154938.04/en/mapcontrol.css" rev="Stylesheet" />
    </head>
    <body onload="GetMap(); contentEditable=true">
        <div style="position: relative; width: 100%; height: 100%" id="myMap"></div>
    </body>
</html>