<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>MSN Map</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/jscript" src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=5"
mce_src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=5"></script>
<script type="text/javascript">
var vMap = null;
function initialize()
{
var crmAddress = GetCRMAddress();
if(crmAddress != '')
{
LocateAddress(crmAddress);
}
else
{
DisplayMessage();
}
}
function LocateAddress(address)
{
vMap = new VEMap('MapHolder');
vMap.LoadMap();
vMap.Find(null,address,null,null,0,10,true,true,true,true,MapAddress);
}
function MapAddress(shapeLayer, results, positions, moreResults, e)
{
if(positions != null && positions.length > 0)
{
addressLatLong = new VELatLong(positions[0].LatLong.Latitude,positions[0].LatLong.Longitude);
addressPushPin = new VEShape(VEShapeType.Pushpin,addressLatLong);
vMap.AddShape(addressPushPin);
vMap.SetCenterAndZoom(addressLatLong,15);
}
else
{
DisplayMessage();
}
}
function GetCRMAddress()
{
var address = '';
var addressLine1 = parent.document.forms[0].all.address1_line1.DataValue;
var postalCode = parent.document.forms[0].all.address1_postalcode.DataValue;
var city = parent.document.forms[0].all.address1_city.DataValue;
var stateOrProvince = parent.document.forms[0].all.address1_stateorprovince.DataValue;
var country = parent.document.forms[0].all.address1_country.DataValue;
if(addressLine1 == null && postalCode == null && city == null && stateOrProvince == null && country == null)
{
address = '';
}
else
{
address = addressLine1+", "+postalCode+" "+city+" ("+stateOrProvince+"), "+country;
}
return address;
}
function DisplayMessage()
{
var lbl = document.getElementById('lblMessage');
lbl.style.display = "inline";
var div = document.getElementById('MapHolder');
div.style.display = "none";
}
</script>
</head>
<body onload="initialize()">
<form>
<div id="MapHolder" style="width: 700px; height: 350px">
</div>
<label id="lblMessage" style="display: none; font-family: @Arial Unicode MS; font-size: small; font-weight: bold; color: #15428b;">
Unable to locate the selected address in Live Map - Add required Street, City and State information and then save the record.</label>
</form>
</body>
</html>