"
}
function sb() {
B()
}
function B() {
if (f == Msn.VE.DashboardStates.MapStyle.Road && d == Msn.VE.DashboardStates.MapView.Ortho) return;
f = Msn.VE.DashboardStates.MapStyle.Road;
d = Msn.VE.DashboardStates.MapView.Ortho;
m(h + d + f)
}
function mb() {
if (b[a.ShowLabels]) {
i(a.ShowLabels, true);
if (k) Y();
else X()
} else X()
}
function X() {
if (f == Msn.VE.DashboardStates.MapStyle.Aerial && d == Msn.VE.DashboardStates.MapView.Ortho) return;
f = Msn.VE.DashboardStates.MapStyle.Aerial;
d = Msn.VE.DashboardStates.MapView.Ortho;
m(h + d + f)
}
function nb() {
Y()
}
function Y() {
if (f == Msn.VE.DashboardStates.MapStyle.Hybrid && d == Msn.VE.DashboardStates.MapView.Ortho) return;
f = Msn.VE.DashboardStates.MapStyle.Hybrid;
d = Msn.VE.DashboardStates.MapView.Ortho;
m(h + d + f)
}
function u() {
if (d == Msn.VE.DashboardStates.MapView.Ortho && h == Msn.VE.DashboardStates.MapMode.Flatland) return;
d = Msn.VE.DashboardStates.MapView.Ortho;
if (h == Msn.VE.DashboardStates.MapMode.Flatland) switch (f) {
case Msn.VE.DashboardStates.MapStyle.Aerial:
if ($MVEM.IsEnabled(MapControl.Features.MapStyle.Aerial)) m(h + d + f);
else B();
break;
case Msn.VE.DashboardStates.MapStyle.Hybrid:
if ($MVEM.IsEnabled(MapControl.Features.MapStyle.Hybrid)) m(h + d + f);
else B();
break;
default:
m(h + d + f)
} else m(h + d);
o()
}
function P(c) {
if (h == Msn.VE.DashboardStates.MapMode.View3D && g(b[a.Oblique]).hasClass("MSVE_selected")) {
p();
c.cancelBubble = true;
return
}
G()
}
function G() {
if (typeof b[a.ObliqueNotification] != "undefined" && b[a.ObliqueNotification]) p();
if (h == Msn.VE.DashboardStates.MapMode.View3D) e.Oblique3DFunctionality.ObliqueClickFunction();
else tb()
}
var L = null;
function fb() {
var e = new Date;
if (L != null) if (e.getTime() - L.getTime() < 1000) return;
L = e;
var d = !g(b[a.Oblique]).hasClass("MSVE_selected");
c.Show3DBirdseye(d, f == Msn.VE.DashboardStates.MapStyle.Road || k);
var h = d ? "RequestLayerBirdsEyeOn" : "RequestLayerBirdsEyeOff"
}
var n;
function tb() {
if (d === Msn.VE.DashboardStates.MapView.Oblique) return;
d = Msn.VE.DashboardStates.MapView.Oblique;
y();
if (k) f = Msn.VE.DashboardStates.MapStyle.Hybrid;
else f = Msn.VE.DashboardStates.MapStyle.Aerial;
if (typeof Msn.VE.API == "undefined") ob();
else F()
}
function ob() {
if (!n) {
var a = $ID("msve_mapContainer");
n = document.createElement("div");
n.id = "animator";
a.appendChild(n)
}
n.style.display = "block";
n.className = "zoom_animation";
window.setTimeout(F, 2000)
}
function F() {
if (n) {
n.parentNode.removeChild(n);
n = null
}
if (c.IsDragging() || c.IsZooming()) {
window.setTimeout(F, 250);
return
}
m(h + d + f)
}
function lb() {
Gb(Msn.VE.DashboardStates.MapMode.View3D + Msn.VE.DashboardStates.MapView.Oblique)
}
function hb() {
if (d == Msn.VE.DashboardStates.MapView.StreetSide && h == Msn.VE.DashboardStates.MapMode.Flatland) return;
d = Msn.VE.DashboardStates.MapView.StreetSide;
m(h + d);
jb()
}
function vb() {
if (f == Msn.VE.DashboardStates.MapStyle.Aerial) {
k = true;
f = Msn.VE.DashboardStates.MapStyle.Hybrid
} else if (f == Msn.VE.DashboardStates.MapStyle.Hybrid) {
k = false;
f = Msn.VE.DashboardStates.MapStyle.Aerial
}
m(h + d + f)
}
function kb() {
c.EnableMode(Msn.VE.MapActionMode.Mode2D)
}
function qb() {
if (typeof b[a.ThreeDUpdatedNotification] != "undefined" && b[a.ThreeDUpdatedNotification]) E();
if (!c.IsModeEnabled(Msn.VE.MapActionMode.Mode3D)) if (typeof ShowMessage != "undefined") {
ShowMessage(L_3DLoading_Text);
window.setTimeout(View3DSwitch, 200)
} else c.EnableMode(Msn.VE.MapActionMode.Mode3D)
}
function A() {
if (VE_TrafficManager.turnedOn) {
g(b[a.Traffic]).addClass("MSVE_selected");
b[a.Traffic].title = L_NavActionHideTrafficToolTip_Text
} else {
g(b[a.Traffic]).removeClass("MSVE_selected");
b[a.Traffic].title = L_NavActionShowTrafficToolTip_Text
}
}
function Ab() {
if (VE_TrafficManager.turnedOn) VE_TrafficManager.ClearTraffic();
else {
for (var a in Msn.VE.API.Globals.vemapinstances) if (Msn.VE.API.Globals.vemapinstances[a] instanceof VEMap && Msn.VE.API.Globals.vemapinstances[a].vemapcontrol) {
VE_TrafficManager.m_vemap = Msn.VE.API.Globals.vemapinstances[a];
break
}
VE_TrafficManager.turnedOn = true;
VE_TrafficManager.showTrafficFlow = true;
VE_TrafficManager.showIncidents = true;
VE_TrafficManager.showConstructionIncidents = true;
VE_TrafficManager.markets = [];
VE_TrafficManager.incidents = [];
VE_TrafficManager.m_vemap.ShowTrafficLegend();
VE_TrafficManager.m_vemap.SetTrafficLegendText(L_MapLegendAndPopupLink_Text);
window.setTimeout(VE_TrafficManager.GetMarkets, 100)
}
A()
}
function rb(c) {
if (c.enabled == "1") {
g(b[a.Oblique]).addClass("MSVE_selected");
b[a.Oblique].title = L_NavActionHideObliqueToolTip_Text
} else {
g(b[a.Oblique]).removeClass("MSVE_selected");
b[a.Oblique].title = L_NavActionShowObliqueToolTip_Text
}
}
function t(a) {
W(a.view.mapStyle)
}
function Z(a) {
if (a == Msn.VE.MapActionMode.Mode3D) U();
else T()
}
function U() {
if (h == Msn.VE.DashboardStates.MapMode.View3D) return;
h = Msn.VE.DashboardStates.MapMode.View3D;
if (typeof b[a.View] != "undefined" && b[a.View] != null) g(b[a.View].classRecipients).removeClass("MSVE_FlatlandMapMode").addClass("MSVE_View3DMapMode");
i(a.StreetSide, true);
i(a.Road, true);
i(a.Aerial, true);
i(a.Hybrid, true);
if (!e.Oblique3DFunctionality.DependsOnObliqueAvailability) i(a.Oblique, true);
else {
if (b[a.ObliqueNotification] != null && b[a.ObliqueNotification].enabled && !g(b[a.Oblique]).hasClass("MSVE_selected")) x();
o()
}
if (typeof b[a.Ortho] != "undefined" && b[a.Ortho] != null) b[a.Ortho].title = L_NavAction3DOrthoToolTip_Text;
if (typeof b[a.Oblique] != "undefined" && b[a.Oblique] != null) {
b[a.Oblique].title = e.Oblique3DFunctionality.Title;
if (b[a.Oblique].enabled && !g(b[a.Oblique]).hasClass("MSVE_selected")) x()
}
if (typeof b[a.StreetSide] != "undefined" && b[a.StreetSide] != null) b[a.StreetSide].title = L_NavAction3DStreetSideToolTip_Text;
var f = c.GetDashboard().GetShimmedElements(),
d;
for (d = 0; d < f.length; d++) mvcViewFacade.UpdateShimIfSupported(f[d])
}
function T() {
h = Msn.VE.DashboardStates.MapMode.Flatland;
if (typeof b[a.View] != "undefined" && b[a.View] != null) g(b[a.View].classRecipients).removeClass("MSVE_View3DMapMode").addClass("MSVE_FlatlandMapMode");
if (typeof b[a.Ortho] != "undefined" && b[a.Ortho] != null) b[a.Ortho].title = L_NavActionOrthoToolTip_Text;
if (typeof b[a.Oblique] != "undefined" && b[a.Oblique] != null) b[a.Oblique].title = L_NavActionObliqueToolTip_Text;
g(b[a.Oblique]).removeClass("MSVE_selected");
photoState = 0;
if ($MVEM.IsEnabled(MapControl.Features.MapStyle.Road)) i(a.Road, true);
else i(a.Road, false);
if ($MVEM.IsEnabled(MapControl.Features.MapStyle.Aerial)) i(a.Aerial, true);
else i(a.Aerial, false);
if ($MVEM.IsEnabled(MapControl.Features.MapStyle.Hybrid)) i(a.Hybrid, true);
else i(a.Hybrid, false);
if ($MVEM.IsEnabled(MapControl.Features.MapStyle.BirdsEye)) {
c.GetObliqueAvailability("OnFlatlandModeUpdateUIObliqueReturned", O);
return
} else O(false)
}
function O(b) {
if (b) {
i(a.Oblique, true);
if (e.obliqueZoom != null) e.obliqueZoom.UpdateFromMap()
} else {
i(a.Oblique, false);
d = Msn.VE.DashboardStates.MapView.Ortho;
o()
}
switch (d) {
case Msn.VE.DashboardStates.MapView.Oblique:
if (b && $MVEM.IsEnabled(MapControl.Features.MapStyle.BirdsEye)) m(h + d);
else u();
break;
case Msn.VE.DashboardStates.MapView.StreetSide:
u();
break;
case Msn.VE.DashboardStates.MapView.Ortho:
switch (f) {
case Msn.VE.DashboardStates.MapStyle.Aerial:
if ($MVEM.IsEnabled(MapControl.Features.MapStyle.Aerial)) m(h + d + f);
else B();
break;
case Msn.VE.DashboardStates.MapStyle.Hybrid:
if ($MVEM.IsEnabled(MapControl.Features.MapStyle.Hybrid)) m(h + d + f);
else B();
break;
default:
m(h + d + f)
}
break;
default:
u()
}
}
function w() {
if (e.orthoZoom) e.orthoZoom.UpdateFromMap();
if (e.obliqueZoom) e.obliqueZoom.UpdateFromMap();
var b = null,
a = null;
if (l) {
var f = l.GetPlus();
if (f) b = g([f]);
var d = l.GetMinus();
if (d) a = g([d])
}
if (c.IsMapViewOrtho() && c.GetZoomLevel() == S || c.IsMapViewOblique() && c.GetZoomLevel() == 2) {
if (b) b.addClass("MSVE_ZoomBar_plus_disabled");
if (l) l.UnhookPlusEvents()
} else if (c.GetZoomLevel() == Q) {
if (a) a.addClass("MSVE_ZoomBar_minus_disabled");
if (l) l.UnhookMinusEvents()
}
if (c.IsMapViewOrtho() && c.GetZoomLevel() != S || c.IsMapViewOblique() && c.GetZoomLevel() != 2) if (b && b.hasClass("MSVE_ZoomBar_plus_disabled")) {
b.removeClass("MSVE_ZoomBar_plus_disabled");
if (l) l.HookupPlusEvents()
}
if (c.GetZoomLevel() != Q) if (a && a.hasClass("MSVE_ZoomBar_minus_disabled")) {
a.removeClass("MSVE_ZoomBar_minus_disabled");
if (l) l.HookupMinusEvents()
}
}
function zb() {
if (c.IsMapViewOblique()) d = Msn.VE.DashboardStates.MapView.Oblique;
if (h == Msn.VE.DashboardStates.MapMode.Flatland || h == Msn.VE.DashboardStates.MapMode.View3D && e.Oblique3DFunctionality.DependsOnObliqueAvailability) {
i(a.Oblique, true);
if (b[a.ObliqueNotification] && !c.IsMapViewOblique() && !g(b[a.Oblique]).hasClass("MSVE_selected")) x()
}
}
function K() {
d = Msn.VE.DashboardStates.MapView.Ortho;
o();
if (h == Msn.VE.DashboardStates.MapMode.Flatland || h == Msn.VE.DashboardStates.MapMode.View3D && e.Oblique3DFunctionality.DependsOnObliqueAvailability) {
i(a.Oblique, false);
p()
}
}
function eb() {
if (c.IsObliqueAvailable()) e.obliqueCompass.UpdateFromMap(r, true);
else K()
}
function pb() {
if (c.IsObliqueAvailable()) {
d = Msn.VE.DashboardStates.MapView.Ortho;
o()
} else K()
}
function wb() {
if ($MVEM.IsEnabled(MapControl.Features.MapStyle.BirdsEye)) {
if (d != Msn.VE.DashboardStates.MapView.Oblique) {
d = Msn.VE.DashboardStates.MapView.Oblique;
i(a.Oblique, true);
y()
}
} else {
d = Msn.VE.DashboardStates.MapView.Oblique;
u()
}
if (b[a.ObliqueNotification]) p();
if (typeof e.obliqueCompass != "undefined" && e.obliqueCompass != null) {
e.obliqueCompass.UpdateFromMap(r);
r = Msn.VE.BirdsEyeSearchSpinDirection.NoSpin
}
}
function W(e) {
if (!e) e = c.GetMapStyle();
switch (e) {
case Msn.VE.MapStyle.Shaded:
case Msn.VE.MapStyle.Road:
d = Msn.VE.DashboardStates.MapView.Ortho;
o();
f = Msn.VE.DashboardStates.MapStyle.Road;
ub();
if (b[a.ShowLabels]) {
i(a.ShowLabels, false);
g(b[a.ShowLabels]).addClass("MSVE_selected")
}
break;
case Msn.VE.MapStyle.Aerial:
d = Msn.VE.DashboardStates.MapView.Ortho;
o();
f = Msn.VE.DashboardStates.MapStyle.Aerial;
H();
k = false;
if (b[a.ShowLabels]) {
i(a.ShowLabels, true);
g(b[a.ShowLabels]).removeClass("MSVE_selected")
}
break;
case Msn.VE.MapStyle.Hybrid:
d = Msn.VE.DashboardStates.MapView.Ortho;
o();
f = Msn.VE.DashboardStates.MapStyle.Hybrid;
if (b[a.ShowLabels]) {
k = true;
H();
i(a.ShowLabels, true);
g(b[a.ShowLabels]).addClass("MSVE_selected")
} else V();
break;
case Msn.VE.MapStyle.Oblique:
d = Msn.VE.DashboardStates.MapView.Oblique;
y();
f = Msn.VE.DashboardStates.MapStyle.Aerial;
if (b[a.ShowLabels]) {
H();
k = false;
i(a.ShowLabels, true);
g(b[a.ShowLabels]).removeClass("MSVE_selected")
}
i(a.Oblique, true);
break;
case Msn.VE.MapStyle.ObliqueHybrid:
d = Msn.VE.DashboardStates.MapView.Oblique;
y();
f = Msn.VE.DashboardStates.MapStyle.Hybrid;
if (b[a.ShowLabels]) {
V();
k = true;
i(a.ShowLabels, true);
g(b[a.ShowLabels]).addClass("MSVE_selected")
}
i(a.Oblique, true)
}
if (h == Msn.VE.DashboardStates.MapMode.View3D && g(b[a.Oblique]).hasClass("MSVE_selected")) if (f == Msn.VE.DashboardStates.MapStyle.Road) c.Show3DBirdseye(true, true);
else c.Show3DBirdseye(true, k);
if (b[a.ShowLabels]) if (k || f == Msn.VE.DashboardStates.MapStyle.Road) b[a.ShowLabels].title = L_NavActionHideLabels_Text;
else b[a.ShowLabels].title = L_NavActionShowLabels_Text
}
function ub() {
if (typeof b[a.Style] != "undefined" && b[a.Style] != null) {
var c;
for (c = 0; c < b[a.Style].classRecipients.length; c++) b[a.Style].classRecipients[c].className = "MSVE_RoadMapStyle"
}
}
function H() {
if (typeof b[a.Style] != "undefined" && b[a.Style] != null) {
var c;
for (c = 0; c < b[a.Style].classRecipients.length; c++) b[a.Style].classRecipients[c].className = "MSVE_AerialMapStyle"
}
}
function V() {
if (typeof b[a.Style] != "undefined" && b[a.Style] != null) {
var c;
for (c = 0; c < b[a.Style].classRecipients.length; c++) b[a.Style].classRecipients[c].className = "MSVE_HybridMapStyle"
}
}
function o() {
if (typeof b[a.View] != "undefined" && b[a.View] != null) {
var c = g(b[a.View].classRecipients);
c.removeClass("MSVE_StreetSideView");
c.removeClass("MSVE_ObliqueView");
c.addClass("MSVE_OrthoView")
}
if (b[a.Traffic] != null) {
i(a.Traffic, true);
A()
}
r = Msn.VE.BirdsEyeSearchSpinDirection.NoSpin
}
function y() {
if (typeof b[a.View] != "undefined" && b[a.View] != null) {
var c = g(b[a.View].classRecipients);
c.removeClass("MSVE_StreetSideView");
c.removeClass("MSVE_OrthoView");
c.addClass("MSVE_ObliqueView")
}
if (I) {
if (e.obliqueCompass == null) {
e.obliqueCompass = new xb(b[a.ObliqueCompass]);
if (b[a.ObliqueCompass].radius) e.obliqueCompass.SetRadius(b[a.ObliqueCompass].radius);
e.obliqueCompass.onclick = function () {
r = Msn.VE.BirdsEyeSearchSpinDirection.NoSpin
}
}
e.obliqueCompass.UpdateFromMap()
}
if (ab) {
if (e.obliqueZoom == null) {
e.obliqueZoom = new yb(b[a.ObliqueZoom]);
e.obliqueZoom.Init()
}
e.obliqueZoom.UpdateFromMap()
}
if (b[a.Traffic] != null && h == Msn.VE.DashboardStates.MapMode.Flatland) i(a.Traffic, false)
}
function jb() {
if (typeof b[a.View] != "undefined" && b[a.View] != null) {
var c = g(b[a.View].classRecipients);
c.removeClass("MSVE_OrthoView");
c.removeClass("MSVE_ObliqueView");
c.addClass("MSVE_StreetSideView")
}
}
function x() {
if (!b[a.ObliqueNotification]) return;
if (R) return;
R = true;
if (!e.displaying3DNotification) if (d != Msn.VE.DashboardStates.MapView.Oblique) {
if (!z) {
var o = g(b[a.ObliqueNotification]),
k = o.select("img");
for (var i = 0; i < k.length && !z; i++) {
var j = k.element(i);
if (j.id == "MSVE_obliqueNotifyImg") z = j
}
}
if (z) z.src = c.GetObliqueMode().GetMiddleTileFilename();
var f = b[a.Oblique];
b[a.ObliqueNotification].style.display = "block";
var m = f.offsetLeft + f.offsetWidth / 2 - b[a.ObliqueNotification].offsetWidth / 2,
n = f.offsetTop + f.offsetHeight + 4;
g(b[a.ObliqueNotification]).setStyle("top", n + "px").setStyle("left", m + "px");
var l = D(),
h;
for (h = 0; h < l.length; ++h) mvcViewFacade.UpdateShimIfSupported(l[h]);
m = n = f = null;
window.setTimeout(p, 6000)
}
}
function bb() {
if (!b[a.ThreeDUpdatedNotification]) return;
p();
if (!e.displaying3DNotification) {
e.displaying3DNotification = true;
var c = b[a.Mode3D];
b[a.ThreeDUpdatedNotification].style.display = "block";
var d = c.offsetLeft - 6,
f = c.offsetTop + c.offsetHeight + 4;
g(b[a.ThreeDUpdatedNotification]).setStyle("top", f + "px").setStyle("left", d + "px");
mvcViewFacade.UpdateShimIfSupported(b[a.ThreeDUpdatedNotification]);
c = null;
window.setTimeout(E, 6000)
}
}
function p() {
b[a.ObliqueNotification].style.display = "none";
var d = D(),
c;
for (c = 0; c < d.length; ++c) mvcViewFacade.UpdateShimIfSupported(d[c])
}
function E() {
e.displaying3DNotification = false;
b[a.ThreeDUpdatedNotification].style.display = "none";
mvcViewFacade.UpdateShimIfSupported(b[a.ThreeDUpdatedNotification])
}
function i(c, d) {
if (b[c] == null) return;
if (b[c].enabled == d) return;
b[c].enabled = d;
var a = j[c];
if (a.InitialClass) if (d) g(b[c]).swapClass(a.InitialClass + "_disabled", a.InitialClass);
else g(b[c]).swapClass(a.InitialClass, a.InitialClass + "_disabled");
if (a.Title) b[c].title = a.Title;
if (a.OnClickFunction) if (d) b[c].attachEvent("onclick", a.OnClickFunction);
else b[c].detachEvent("onclick", a.OnClickFunction)
}
function m(d) {
if (d & Msn.VE.DashboardStates.MapView.Ortho || d & Msn.VE.DashboardStates.MapMode.View3D) if (d & Msn.VE.DashboardStates.MapStyle.Road) c.SetMapStyle("r");
else if (d & Msn.VE.DashboardStates.MapStyle.Aerial) c.SetMapStyle("a");
else if (d & Msn.VE.DashboardStates.MapStyle.Hybrid) c.SetMapStyle("h");
if (d & Msn.VE.DashboardStates.MapMode.Flatland && d & Msn.VE.DashboardStates.MapView.Oblique) if (d & Msn.VE.DashboardStates.MapStyle.Aerial && c.GetMapStyle() != Msn.VE.MapStyle.Oblique) {
k = false;
if (b[a.ShowLabels]) {
i(a.ShowLabels, true);
g(b[a.ShowLabels]).removeClass("MSVE_selected")
}
c.SetMapStyle(Msn.VE.MapStyle.Oblique)
} else if (d & Msn.VE.DashboardStates.MapStyle.Hybrid && c.GetMapStyle() != Msn.VE.MapStyle.ObliqueHybrid) {
k = true;
if (b[a.ShowLabels]) {
i(a.ShowLabels, true);
g(b[a.ShowLabels]).addClass("MSVE_selected")
}
c.SetMapStyle(Msn.VE.MapStyle.ObliqueHybrid)
}
}
function Gb(a) {
if (a & Msn.VE.DashboardStates.MapMode.View3D) if (a & Msn.VE.DashboardStates.MapView.Ortho) c.SetTilt(-90);
else if (a & Msn.VE.DashboardStates.MapView.Oblique) c.SetTilt(-45);
else if (a & Msn.VE.DashboardStates.MapView.StreetSide) c.SetTilt(-25)
}
function D() {
return [b[a.ObliqueNotification]]
}
function Fb(a) {
return b[a]
}
function Cb() {
return b
}
function Db() {
return l
}
function gb() {
return r
}
function ib(a) {
r = a
}
this.SetMapViewState = function (a) {
d = a
};
this.GetMapViewState = function () {
return d
};
this.SetMapModeState = function (a) {
h = a
};
this.GetMapModeState = function () {
return h
};
this.SetLabelsState = function (a) {
k = a
};
this.GetLabelsState = function () {
return k
};
this.GetLastRotationDirection = gb;
this.SetLastRotationDirection = ib;
this.GetObliqueNotifierShimmedElements = D;
this.Init = Ib;
this.Create = M;
this.Destroy = Hb;
this.DestroyControl = J;
this.GetControl = Fb;
this.GetControls = Cb;
this.GetTinyZoom = Db;
this.OnOrthoMapViewClick = u;
this.OnObliqueMapViewClick = G;
this.UpdateZoom = w;
this.SelectObliqueMapView = y;
this.SelectOrthoMapView = o;
this.DisplayObliqueNotification = x;
this.HideObliqueNotification = p;
this.DisplayThreeDUpdatedNotification = bb;
this.HideThreeDUpdatedNotification = E
};
var c = document.createElement("div");
c.id = C;
z.appendChild(c);
c.attachEvent("onmousedown", IgnoreEvent);
c.attachEvent("onmouseup", IgnoreEvent);
c.attachEvent("onmousemove", DashboardContainerMouseMoveEvent);
c.attachEvent("onmousewheel", IgnoreEvent);
c.attachEvent("ondblclick", IgnoreEvent);
c.attachEvent("oncontextmenu", IgnoreEvent);
c.attachEvent("onkeydown", IgnoreEvent);
c.attachEvent("onkeyup", IgnoreEvent);
c.className = "MSVE_Dashboard MSVE_Dashboard_V5 MSVE_FlatlandMapMode";
if (i == Msn.VE.DashboardSize.Normal) c.className += " MSVE_Dashboard_Normal";
else if (i == Msn.VE.DashboardSize.Small) c.className += " MSVE_Dashboard_Small";
else if (i == Msn.VE.DashboardSize.Tiny) c.className += " MSVE_Dashboard_Tiny";
var h = null,
f = document.createElement("div");
f.className = "MSVE_header";
f.id = "MSVE_navAction_header";
var e, d, b = s,
o = document.createElement("div");
o.id = "MSVE_dashboardContainer";
var q = document.createElement("div");
q.id = "MSVE_mapViewRow";
o.appendChild(q);
var m = document.createElement("div");
m.id = "MSVE_zoomDiv";
var p = document.createElement("div");
p.id = "MSVE_navAction_mapViewCell";
p.className = "MSVE_dashboardMapModeContainer";
q.appendChild(m);
q.appendChild(p);
var l = document.createElement("div");
l.id = "MSVE_mapStyleRow";
o.appendChild(l);
var j = document.createElement("div");
j.id = "MSVE_threeDNotification";
var n = document.createElement("div");
n.id = "MSVE_lowerContainer";
n.appendChild(o);
c.className += " expanded";
c.appendChild(f);
c.appendChild(n);
var k = false;
function E() {
if (i == Msn.VE.DashboardSize.Normal) {
controlsNeeded = [b.Mode, b.View, b.Style, b.OrthoZoom, b.ObliqueCompass, b.ObliqueZoom];
e = new Msn.VE.CommonControls(a, controlsNeeded);
d = e.GetControls();
e.displaying3DNotification = false;
d[b.View].classRecipients = [o];
d[b.Mode].classRecipients = [c];
e.Oblique3DFunctionality = e.ObliqueFunctions.ObliqueTiltIn3D;
e.Init();
B(x);
this.HideToggleGlyph();
p.appendChild(d[b.View]);
l.appendChild(d[b.Style]);
l.appendChild(d[b.ObliqueCompass]);
m.appendChild(d[b.OrthoZoom]);
m.appendChild(d[b.ObliqueZoom]);
if (A && $MVEM.IsEnabled(MapControl.Features.MapStyle.BirdsEye)) {
e.Create(b.ObliqueNotification);
n.appendChild(d[b.ObliqueNotification])
}
if (Msn.VE.Animation) t()
}
if (i == Msn.VE.DashboardSize.Small) {
controlsNeeded = [b.Style];
e = new Msn.VE.CommonControls(a, controlsNeeded);
d = e.GetControls();
l.appendChild(d[b.Style]);
e.Init()
}
if (i == Msn.VE.DashboardSize.Small || i == Msn.VE.DashboardSize.Tiny) {
controlsNeeded = [b.TinyZoom];
e = new Msn.VE.CommonControls(a, controlsNeeded);
d = e.GetControls();
m.appendChild(d[b.TinyZoom]);
var f = e.GetTinyZoom(),
h = f.GetPlus(),
g = f.GetMinus();
if (h && g) f.HookupPlusMinusEvents(h, g)
}
}
function D() {
if (i == Msn.VE.DashboardSize.Normal) {
e.DestroyControl(d[b.OrthoZoom]);
e.DestroyControl(d[b.ObliqueZoom]);
e.DestroyControl(d[b.ObliqueCompass]);
y();
if (a) {
try {
a.DetachEvent("onobliquechange", OnObliqueChange);
if ($MVEM.IsEnabled(MapControl.Features.MapStyle.BirdsEye)) {
a.DetachEvent("onobliqueenter", OnObliqueEnter);
a.DetachEvent("onobliqueleave", OnObliqueLeave)
}
} catch (c) {}
a = null
}
}
if (i == Msn.VE.DashboardSize.Normal || i == Msn.VE.DashboardSize.Small) {
e.DestroyControl(d[b.Style]);
l.removeChild(d[b.Style])
}
if (i == Msn.VE.DashboardSize.Small || i == Msn.VE.DashboardSize.Tiny) {
e.DestroyControl(d[b.TinyZoom]);
m.removeChild(d[b.TinyZoom])
}
l = e.obliqueCompass = null;
p = q = null;
n = null;
j = null;
d[b.ObliqueNotification] = m = d[b.ObliqueCompass] = null
}
function v() {
if (!a.IsModeEnabled(Msn.VE.MapActionMode.Mode3D) && !a.IsMapViewOblique()) {
n.appendChild(j);
j.style.top = -(f.offsetHeight / 2 + 6) + "px";
j.innerHTML += '
' + L_Dashboard3DText_Text + "
";
j.attachEvent("onclick", u);
window.setTimeout(w, 6000);
e.displaying3DNotification = true
} else j.style.display = "none"
}
function B(a) {
r(a);
h = document.createElement("a");
h.className = "MSVE_toggleGlyph";
h.title = L_NavActionHideToolTip_Text;
f.appendChild(h)
}
function r(a) {
if ($MVEM.IsEnabled(MapControl.Features.MapStyle.View3D) && a != false) {
if (!k) {
e.Create(b.Mode);
f.appendChild(d[b.Mode]);
v();
k = true
}
f.className = "MSVE_header MSVE_with3D"
} else {
f.className = "MSVE_header MSVE_no3D";
k = false
}
}
function y() {
if (k) {
e.DestroyControl(b.Mode);
if (d[b.Mode] != null) f.removeChild(d[b.Mode]);
k = false
}
f.removeChild(h);
c.removeChild(f);
h = f = null
}
function u() {
j.style.display = "none";
e.displaying3DNotification = false;
if (!a.IsModeEnabled(Msn.VE.MapActionMode.Mode3D)) if (typeof ShowMessage != "undefined") {
ShowMessage(L_3DLoading_Text);
window.setTimeout(View3DSwitch, 200)
} else a.EnableMode(Msn.VE.MapActionMode.Mode3D)
}
function w() {
if (j) {
j.style.display = "none";
e.displaying3DNotification = false
}
if (a != null && !a.IsModeEnabled(Msn.VE.MapActionMode.Mode3D)) if (a.IsObliqueAvailable() && $MVEM.IsEnabled(MapControl.Features.MapStyle.BirdsEye)) e.DisplayObliqueNotification()
}
this.SetX = function (a) {
c.style.left = a + "px"
};
this.GetElement = function () {
return c
};
this.GetShimmedElements = function () {
return [c]
};
this.GetHeader = function () {
return f
};
this.GetY = function () {
return g(c).getScreenPosition().y
};
this.GetHeight = function () {
return c.offsetHeight
};
this.ShowToggleGlyph = function () {
if (h != null && h != "undefined") h.style.display = "block"
};
this.HideToggleGlyph = function () {
if (h != null && h != "undefined") h.style.display = "none"
};
this.SetShowMapModeSwitch = function (a) {
if (a != k) {
if (!a) {
e.DestroyControl(b.Mode);
f.removeChild(d[b.Mode]);
k = false
}
r(a)
}
};
function t() {
var b = a.GetDashboard().GetHeader().lastChild;
a.GetDashboard().ShowToggleGlyph();
window.dbRoller = new Msn.VE.Animation.Roller(a.GetDashboard().GetElement());
dbRoller.setAccelerationFunction(AccelerationFunctions.CrazyElevator);
dbRoller.setYLeave(32);
dbRoller.hookEvent("beforerollin", function () {
dbRoller.setYLeave(a.GetDashboard().GetHeader().offsetHeight);
if (a.GetMinimap()) {
a.GetMinimap().Hide();
if (a.GetMinimap().IsInitialized()) a.GetMinimap().SetDoUpdates(false)
}
});
dbRoller.hookEvent("afterrollin", function () {
a.GetDashboard().GetElement().className = a.GetDashboard().GetElement().className.replace(/\s*expanded/g, "");
a.GetDashboard().GetElement().className += " collapsed";
a.GetDashboard().GetHeader().lastChild.title = L_NavActionShowToolTip_Text
});
dbRoller.hookEvent("beforerollout", function () {
a.GetDashboard().GetElement().className = a.GetDashboard().GetElement().className.replace(/\s*collapsed/g, "");
a.GetDashboard().GetElement().className += " expanded"
});
dbRoller.hookEvent("afterrollout", function () {
if (a.GetMinimap()) {
a.GetMinimap().Show();
if (minimapRoller && minimapRoller.isExpanded() && a.GetMinimap().IsInitialized()) a.GetMinimap().SetDoUpdates(true)
}
a.GetDashboard().GetHeader().lastChild.title = L_NavActionHideToolTip_Text
});
dbRoller.hookEvent("roll", RollShim);
b.onclick = function () {
if (dbRoller.isExpanded()) dbRoller.rollIn(Msn.VE.Animation.RollDirection.BottomUp);
else dbRoller.rollOut(Msn.VE.Animation.RollDirection.TopDown);
return false
};
b = null
}
this.Hide = function () {
if (c) c.style.display = "none"
};
this.Show = function () {
if (c) c.style.display = "block"
};
this.Init = E;
this.Destroy = D;
this.createRoller = t
};
function DashboardContainerMouseMoveEvent(a) {
a = GetEvent(a);
return false
}
Msn.VE.V6Control = function (L, e, mb, jb, D, ab, W, E) {
Msn.VE.DashboardStates = new function () {
this.MapMode = new function () {
this.Flatland = 1;
this.View3D = 2
};
this.MapView = new function () {
this.Ortho = 4;
this.Oblique = 8;
this.StreetSide = 16
};
this.MapStyle = new function () {
this.Road = 32;
this.Shaded = 64;
this.Aerial = 128;
this.Hybrid = 256
}
};
var H = {
Style: "MSVE_navAction_mapStyleCell",
Road: "MSVE_navAction_RoadMapStyle",
Aerial: "MSVE_navAction_AerialMapStyle",
Hybrid: "MSVE_navAction_HybridMapStyle",
Mode: "MSVE_navAction_modeCell",
Mode2D: "MSVE_navAction_FlatlandMapMode",
Mode3D: "MSVE_navAction_View3DMapMode",
View: "MSVE_navAction_mapViewCellInner",
Ortho: "MSVE_navAction_OrthoMapView",
Oblique: "MSVE_navAction_ObliqueMapView",
StreetSide: "MSVE_navAction_StreetSideMapView",
ShowLabels: "MSVE_navAction_showLabels",
Pan: "MSVE_navAction_panContainer",
PanUp: "MSVE_navAction_panUp",
PanDown: "MSVE_navAction_panDown",
PanLeft: "MSVE_navAction_panLeft",
PanRight: "MSVE_navAction_panRight",
TinyZoom: "MSVE_TinyZoomBar",
OrthoZoom: "MSVE_OrthoZoomBar",
ObliqueZoom: "MSVE_ObliqueZoomBar",
ObliqueCompass: "MSVE_compassDiv",
ObliqueNotification: "MSVE_obliqueNotification",
ThreeDUpdatedNotification: "MSVE_threeDUpdatedNotification",
Traffic: "MSVE_navAction_traffic"
},
kb = "Nav Bar";
Msn.VE.CommonControls = function (c, u) {
function yb(b) {
var f = document.createElement("div"),
e = document.createElement("div"),
a = document.createElement("div"),
d = document.createElement("div"),
w = 0,
s = 0,
j = false;
this.Init = function () {
d.className = "MSVE_ZoomBar_minus";
d.id = "MSVE_navAction_obliqueZoomBar_minus";
d.unselectable = "on";
d.title = L_ZoomBarMinusToolTip_Text;
d.attachEvent("onclick", l);
pseudoHover(d);
a.className = "MSVE_ZoomBar_slider";
a.id = "MSVE_navAction_obliqueZoomBar_slider";
a.unselectable = "on";
a.attachEvent("onmousedown", o);
a.attachEvent("onmousemove", p);
a.attachEvent("onmouseup", q);
a.attachEvent("onclick", IgnoreEvent);
pseudoHover(a);
e.className = "MSVE_ObliqueZoomBar_bar";
e.unselectable = "on";
e.appendChild(a);
e.attachEvent("onclick", r);
f.className = "MSVE_ZoomBar_plus";
f.id = "MSVE_navAction_obliqueZoomBar_plus";
f.title = L_ZoomBarPlusToolTip_Text;
f.unselectable = "on";
f.attachEvent("onclick", m);
pseudoHover(f);
b.className = "MSVE_ZoomBar";
b.id = "MSVE_ObliqueZoomBar";
b.appendChild(d);
b.appendChild(e);
b.appendChild(f);
b.attachEvent("onmousedown", IgnoreEvent);
b.attachEvent("onmouseup", IgnoreEvent);
b.attachEvent("onclick", IgnoreEvent);
b.attachEvent("ondblclick", IgnoreEvent);
i()
};
function v() {
b.style.display = "block"
}
function u() {
b.style.display = "none"
}
function r(a) {
a = GetEvent(a);
CancelEvent(a);
k();
n(h(Gimme.Screen.getMousePosition(a).y));
return false
}
function h(b) {
b -= s + d.offsetHeight + a.offsetHeight;
var c = e.offsetHeight - a.offsetHeight;
if (b < 0) b = 0;
else if (b > c) b = c;
return b
}
function l() {
c.ZoomOut()
}
function m() {
c.ZoomIn()
}
function t() {
d.detachEvent("onclick", l);
a.detachEvent("onmousedown", o);
a.detachEvent("onmousemove", p);
a.detachEvent("onmouseup", q);
a.detachEvent("onclick", IgnoreEvent);
e.detachEvent("onclick", r);
f.detachEvent("onclick", m);
b.detachEvent("onmousedown", IgnoreEvent);
b.detachEvent("onmousedown", IgnoreEvent);
b.detachEvent("onclick", IgnoreEvent);
b.detachEvent("ondblclick", IgnoreEvent);
d = a = e = f = null
}
function o(b) {
b = GetEvent(b);
CancelEvent(b);
k();
if (a.setCapture) a.setCapture();
j = true;
return false
}
function p(b) {
b = GetEvent(b);
CancelEvent(b);
if (j) a.style.top = h(Gimme.Screen.getMousePosition(b).y) + "px";
return false
}
function q(b) {
b = GetEvent(b);
CancelEvent(b);
if (a.releaseCapture) a.releaseCapture();
j = false;
n(h(Gimme.Screen.getMousePosition(b).y));
i();
return false
}
function k() {
var a = g(b).getScreenPosition();
w = a.x;
s = a.y
}
function n(f) {
var b = e.offsetHeight - a.offsetHeight,
d = 1 + MathRound((b - f) / b * 1);
c.SetZoom(d)
}
function i() {
if (c.GetZoomLevel() == 1) a.style.top = e.offsetHeight - a.offsetHeight + "px";
else a.style.top = "0px"
}
this.Destroy = t;
this.Show = v;
this.Hide = u;
this.UpdateFromMap = i
}
function B(z, x, y) {
var a = document.createElement("div");
a.setAttribute("id", z);
a.innerHTML = x;
var c = "MSVE_obliqueCompassPointOff",
g = y;
a.attachEvent("onmouseover", f);
a.attachEvent("onmouseout", h);
a.attachEvent("onclick", i);
this.onclick = null;
this.onmouseover = null;
this.onmouseout = null;
var e = 25,
b = this,
d = false,
j = new v(a, 17, 17);
function f(e) {
if (d) return;
c = a.className;
a.className = "MSVE_obliqueCompassPointHover";
if (b.onmouseover) b.onmouseover(e)
}
function i(a) {
if (d) return;
f(a);
c = "MSVE_obliqueCompassPointOn";
if (b.onclick) b.onclick(a)
}
function h(e) {
if (d) return;
a.className = c;
if (b.onmouseout) b.onmouseout(e)
}
function m() {
c = "MSVE_obliqueCompassPointOn";
a.className = "MSVE_obliqueCompassPointOn"
}
function l() {
c = "MSVE_obliqueCompassPointOff";
a.className = "MSVE_obliqueCompassPointOff"
}
function u() {
d = true;
l()
}
function k() {
d = false;
m()
}
function q() {
return a
}
function n() {
return g
}
function o(a) {
g = a
}
function w() {
j.Reset();
k()
}
function p(b) {
a.style.left = b.left;
a.style.top = b.top
}
function v(r, n, o) {
var g = r,
a = 0,
b = .3,
c = 0,
l = 40,
k = Math.PI / 2,
h = true,
p = b + .1;
function m(a, b, c) {
if (b >= c - a && b <= c + a) return true;
return false
}
function i() {
a += b;
if (a > Math.PI * 2) a -= Math.PI * 2;
else if (a < 0) a += Math.PI * 2;
if (m(p, a, c)) {
b = .3;
a = c;
d(a);
return
}
d(a);
window.setTimeout(i, l)
}
function d(a) {
var b = n + e * Math.sin(a),
c = o + e * Math.cos(a);
g.style.left = b + "px";
g.style.top = c + "px"
}
function f(a) {
c = a;
i()
}
function j(a, c) {
h = c;
if (!h) b *= -1;
f(k * a)
}
function q() {
a = 0
}
this.RotateTo = f;
this.RotateToIndex = j;
this.Reset = q
}
function t() {
a.detachEvent("onmouseover", f);
a.detachEvent("onmouseout", h);
a.detachEvent("onclick", i);
a = null
}
function s(a) {
e = a
}
function r() {
return e
}
this.SetRadius = s;
this.GetRadius = r;
this.GetElement = q;
this.GetCurrentPositionIndex = n;
this.SetCurrentPositionIndex = o;
this.SetCurrentPosition = p;
this.On = m;
this.Off = l;
this.RotateToIndex = j.RotateToIndex;
this.Reset = w;
this.Disable = u;
this.Enable = k;
this.Destroy = t
}
function xb(D) {
var o = [];
o.push({
"top": "-8px",
"left": "17px"
});
o.push({
"top": "17px",
"left": "42px"
});
o.push({
"top": "42px",
"left": "17px"
});
o.push({
"top": "17px",
"left": "-8px"
});
var f = document.createElement("div");
f.setAttribute("id", "MSVE_obliqueCompassContainer");
f.title = L_ObliqueCompassSelectDirection_Text;
var a = new B("MSVE_obliqueCompassPointN", "N", 0),
i = a.GetElement();
i.attachEvent("onclick", r);
i.attachEvent("onmouseover", u);
i.attachEvent("onmouseout", h);
var d = new B("MSVE_obliqueCompassPointE", "E", 1),
k = d.GetElement();
k.attachEvent("onclick", t);
k.attachEvent("onmouseover", x);
k.attachEvent("onmouseout", h);
var b = new B("MSVE_obliqueCompassPointS", "S", 2),
j = b.GetElement();
j.attachEvent("onclick", s);
j.attachEvent("onmouseover", v);
j.attachEvent("onmouseout", h);
var e = new B("MSVE_obliqueCompassPointW", "W", 3),
l = e.GetElement();
l.attachEvent("onclick", w);
l.attachEvent("onmouseover", y);
l.attachEvent("onmouseout", h);
var m = document.createElement("div");
m.id = "MSVE_navAction_obliqueCompassArrow";
f.appendChild(i);
f.appendChild(k);
f.appendChild(j);
f.appendChild(l);
f.appendChild(m);
D.appendChild(f);
q();
function p(a) {
if (a < 0) a = 4 - Math.abs(a);
return a
}
function n(l, i, k) {
var c = l.GetCurrentPositionIndex(),
h, f = [];
f[a.GetCurrentPositionIndex()] = L_North_Text;
f[b.GetCurrentPositionIndex()] = L_South_Text;
f[d.GetCurrentPositionIndex()] = L_East_Text;
f[e.GetCurrentPositionIndex()] = L_West_Text;
if (i) {
h = i == Msn.VE.BirdsEyeSearchSpinDirection.CounterclockwiseSpin;
if (c + i != 2) {
var g;
switch (i) {
case -1:
switch (c) {
case 0:
case 2:
g = [3];
break;
case 1:
g = [3, 2]
}
break;
case 1:
switch (c) {
case 0:
case 2:
g = [1];
break;
case 3:
g = [1, 2]
}
}
if (g) {
var j = L_ObliqueSkippingOneDirection_Text;
if (c == 0) j = L_ObliqueNoImageryInRequestedDirection_Text;
if (g.length == 2) j = L_ObliqueSkippingTwoDirections_Text;
if (typeof ShowMessage != "undefined") ShowMessage(j.replace("%1", f[c]).replace("%2", f[g[0]]).replace("%3", f[g[1]]))
}
}
} else {
h = c != 3;
if (k) if (c == 0) {
if (typeof ShowMessage != "undefined") ShowMessage(L_ObliqueModeImageNotAvailable_Text)
} else if (typeof ShowMessage != "undefined") ShowMessage(L_ObliqueNoImageryInRequestedDirection_Text.replace("%1", f[c]).replace("%2", f[0]))
}
d.SetCurrentPositionIndex(p(d.GetCurrentPositionIndex() - c));
e.SetCurrentPositionIndex(p(e.GetCurrentPositionIndex() - c));
a.SetCurrentPositionIndex(p(a.GetCurrentPositionIndex() - c));
b.SetCurrentPositionIndex(p(b.GetCurrentPositionIndex() - c));
a.RotateToIndex(2 - a.GetCurrentPositionIndex() < 0 ? a.GetCurrentPositionIndex() : 2 - a.GetCurrentPositionIndex(), h);
d.RotateToIndex(2 - d.GetCurrentPositionIndex() < 0 ? d.GetCurrentPositionIndex() : 2 - d.GetCurrentPositionIndex(), h);
b.RotateToIndex(2 - b.GetCurrentPositionIndex() < 0 ? b.GetCurrentPositionIndex() : 2 - b.GetCurrentPositionIndex(), h);
e.RotateToIndex(2 - e.GetCurrentPositionIndex() < 0 ? e.GetCurrentPositionIndex() : 2 - e.GetCurrentPositionIndex(), h)
}
function g(a) {
switch (a) {
case 0:
h();
break;
case 1:
z();
break;
case 2:
A();
break;
case 3:
C()
}
}
function h() {
m.className = "MSVE_obliqueCompassArrowU"
}
function A() {
m.className = "MSVE_obliqueCompassArrowD"
}
function z() {
m.className = "MSVE_obliqueCompassArrowR"
}
function C() {
m.className = "MSVE_obliqueCompassArrowL"
}
function s() {
if (c.GetDashboard() && c.GetDashboard().SetLastRotationDirection) c.GetDashboard().SetLastRotationDirection(Msn.VE.BirdsEyeSearchSpinDirection.NoSpin);
n(b);
g(0);
var a = c.GetObliqueScene();
if (a) if (a.GetOrientation() != Msn.VE.Orientation.South) c.SetObliqueOrientation("South", null, true)
}
function r() {
if (c.GetDashboard() && c.GetDashboard().SetLastRotationDirection) c.GetDashboard().SetLastRotationDirection(Msn.VE.BirdsEyeSearchSpinDirection.NoSpin);
n(a);
g(0);
var b = c.GetObliqueScene();
if (b) if (b.GetOrientation() != Msn.VE.Orientation.North) c.SetObliqueOrientation("North", null, true)
}
function t() {
if (c.GetDashboard() && c.GetDashboard().SetLastRotationDirection) c.GetDashboard().SetLastRotationDirection(Msn.VE.BirdsEyeSearchSpinDirection.NoSpin);
n(d);
g(0);
var a = c.GetObliqueScene();
if (a) if (a.GetOrientation() != Msn.VE.Orientation.East) c.SetObliqueOrientation("East", null, true)
}
function w() {
if (c.GetDashboard() && c.GetDashboard().SetLastRotationDirection) c.GetDashboard().SetLastRotationDirection(Msn.VE.BirdsEyeSearchSpinDirection.NoSpin);
n(e);
g(0);
var a = c.GetObliqueScene();
if (a) if (a.GetOrientation() != Msn.VE.Orientation.West) c.SetObliqueOrientation("West", null, true)
}
function v() {
g(b.GetCurrentPositionIndex())
}
function x() {
g(d.GetCurrentPositionIndex())
}
function y() {
g(e.GetCurrentPositionIndex())
}
function u() {
g(a.GetCurrentPositionIndex())
}
function H() {
f.style.display = "none"
}
function I() {
f.style.display = "block"
}
function q(k, j) {
var i = c.GetObliqueScene();
if (!i) return;
var f = i.GetOrientation(),
h;
switch (f) {
case "North":
h = a;
break;
case "South":
h = b;
break;
case "East":
h = d;
break;
case "West":
h = e
}
n(h, k, j);
g(0);
if (f != Msn.VE.Orientation.North) a.Enable();
else a.Disable();
if (f != Msn.VE.Orientation.South) b.Enable();
else b.Disable();
if (f != Msn.VE.Orientation.East) d.Enable();
else d.Disable();
if (f != Msn.VE.Orientation.West) e.Enable();
else e.Disable()
}
function G() {
a.Destroy();
d.Destroy();
b.Destroy();
e.Destroy();
i.detachEvent("onclick", r);
i.detachEvent("onmouseover", u);
i.detachEvent("onmouseout", h);
k.detachEvent("onclick", t);
k.detachEvent("onmouseover", x);
k.detachEvent("onmouseout", h);
j.detachEvent("onclick", s);
j.detachEvent("onmouseover", v);
j.detachEvent("onmouseout", h);
l.detachEvent("onclick", w);
l.detachEvent("onmouseover", y);
l.detachEvent("onmouseout", h);
f = null
}
function F(c) {
a.SetRadius(c);
b.SetRadius(c);
d.SetRadius(c);
e.SetRadius(c)
}
function E() {
return a.GetRadius()
}
this.Hide = H;
this.Show = I;
this.UpdateFromMap = q;
this.SetRadius = F;
this.GetRadius = E;
this.Destroy = G
}
function Bb(b) {
var f = document.createElement("div"),
e = document.createElement("div"),
a = document.createElement("div"),
d = document.createElement("div"),
v = 0,
s = 0,
j = false;
this.Init = function () {
d.className = "MSVE_ZoomBar_minus";
d.id = "MSVE_navAction_orthoZoomBar_minus";
d.title = L_ZoomBarMinusToolTip_Text;
d.unselectable = "on";
d.attachEvent("onclick", l);
pseudoHover(d);
a.className = "MSVE_ZoomBar_slider";
a.id = "MSVE_navAction_orthoZoomBar_slider";
a.title = L_ZoomBarSliderToolTip_Text;
a.unselectable = "on";
a.attachEvent("onmousedown", o);
a.attachEvent("onmousemove", p);
a.attachEvent("onmouseup", q);
a.attachEvent("onclick", IgnoreEvent);
pseudoHover(a);
e.className = "MSVE_OrthoZoomBar_bar";
e.unselectable = "on";
e.appendChild(a);
e.attachEvent("onclick", r);
f.className = "MSVE_ZoomBar_plus";
f.id = "MSVE_navAction_orthoZoomBar_plus";
f.title = L_ZoomBarPlusToolTip_Text;
f.unselectable = "on";
f.attachEvent("onclick", m);
pseudoHover(f);
b.className = "MSVE_ZoomBar";
b.id = "MSVE_OrthoZoomBar";
b.appendChild(d);
b.appendChild(e);
b.appendChild(f);
b.attachEvent("onmousedown", IgnoreEvent);
b.attachEvent("onmouseup", IgnoreEvent);
b.attachEvent("onclick", IgnoreEvent);
b.attachEvent("ondblclick", IgnoreEvent);
i()
};
this.Destroy = function () {
d.detachEvent("onclick", l);
a.detachEvent("onmousedown", o);
a.detachEvent("onmousemove", p);
a.detachEvent("onmouseup", q);
a.detachEvent("onclick", IgnoreEvent);
e.detachEvent("onclick", r);
f.detachEvent("onclick", m);
b.detachEvent("onmousedown", IgnoreEvent);
b.detachEvent("onmousedown", IgnoreEvent);
b.detachEvent("onclick", IgnoreEvent);
b.detachEvent("ondblclick", IgnoreEvent);
d = a = e = f = null
};
function u() {
b.style.display = "block"
}
function t() {
b.style.display = "none"
}
function k() {
var a = g(b).getScreenPosition();
v = a.x;
s = a.y
}
function o(b) {
b = GetEvent(b);
CancelEvent(b);
k();
if (a.setCapture) a.setCapture();
j = true;
return false
}
function p(b) {
b = GetEvent(b);
CancelEvent(b);
if (j) a.style.top = h(Gimme.Screen.getMousePosition(b).y) + "px";
return false
}
function q(b) {
b = GetEvent(b);
CancelEvent(b);
if (a.releaseCapture) a.releaseCapture();
j = false;
n(h(Gimme.Screen.getMousePosition(b).y));
i();
return false
}
function m() {
c.ZoomIn()
}
function l() {
c.ZoomOut()
}
function r(a) {
a = GetEvent(a);
CancelEvent(a);
k();
n(h(Gimme.Screen.getMousePosition(a).y));
return false
}
function h(b) {
b -= s + d.offsetHeight + a.offsetHeight;
var c = e.offsetHeight - a.offsetHeight;
if (b < 0) b = 0;
else if (b > c) b = c;
return b
}
function n(f) {
var b = e.offsetHeight - a.offsetHeight,
d = 1 + MathRound((b - f) / b * 18);
c.SetZoom(d)
}
function i() {
var b = e.offsetHeight - a.offsetHeight,
d = b - (c.GetZoomLevel() - 1) / 18 * b;
a.style.top = d + "px"
}
this.UpdateFromMap = i;
this.Show = u;
this.Hide = t
}
function Eb() {
var h = document.createElement("div"),
g = document.createElement("div"),
f = document.createElement("div"),
a = false,
d = g,
b = f;
this.maxZoomLevel = 21;
this.minZoomLevel = 1;
this.Init = function () {
g.className = "MSVE_ZoomBar_plus";
g.id = "MSVE_navAction_tinyZoomBar_plus";
g.title = L_ZoomBarPlusToolTip_Text;
g.unselectable = "on";
f.className = "MSVE_ZoomBar_minus";
f.id = "MSVE_navAction_tinyZoomBar_minus";
f.title = L_ZoomBarMinusToolTip_Text;
f.unselectable = "on";
c.AttachEvent("onendzoom", i);
h.className = "MSVE_ZoomBar";
h.id = "MSVE_TinyZoomBar";
h.appendChild(g);
h.appendChild(f);
return h
};
this.HookupPlusMinusEvents = function (b, a) {
m(b);
j(a)
};
function m(a) {
if (a) d = a;
d.attachEvent("onmousedown", o);
d.attachEvent("onmouseup", e);
d.attachEvent("onmouseout", e)
}
this.HookupPlusEvents = m;
function j(a) {
if (a) b = a;
b.attachEvent("onmousedown", l);
b.attachEvent("onmouseup", e);
b.attachEvent("onmouseout", e)
}
this.HookupMinusEvents = j;
function n() {
if (d != null) {
d.detachEvent("onmousedown", o);
d.detachEvent("onmouseup", e);
d.detachEvent("onmouseout", e)
}
if (a == "in") a = false
}
this.UnhookPlusEvents = n;
function k() {
if (b != null) {
b.detachEvent("onmousedown", l);
b.detachEvent("onmouseup", e);
b.detachEvent("onmouseout", e)
}
if (a == "out") a = false
}
this.UnhookMinusEvents = k;
this.Destroy = function () {
n();
k();
c.DetachEvent("onendzoom", i);
g = f = d = b = null
};
function q() {
if (c.GetMapMode() == Msn.VE.MapActionMode.Mode3D) return true;
else return c.IsAnimationEnabled()
}
function o() {
a = "in";
c.ZoomIn()
}
function i() {
window.setTimeout(p, q() ? 1 : 500)
}
function p() {
if (a == "in" && c.GetZoomLevel() < 21) c.ZoomIn(false);
else if (a == "out" && c.GetZoomLevel() > 1) c.ZoomOut(false)
}
function l() {
a = "out";
c.ZoomOut()
}
function e() {
a = false
}
this.GetPlus = function () {
return g
};
this.GetMinus = function () {
return f
}
}
var a = H,
j = [];
j[a.Style] = {
Id: a.Style,
InitialClass: null,
OnClickFunction: null,
StyleUpdateEvent: null,
StyleUpdateFunction: null,
Enabled: true,
Title: null,
Children: [a.Road, a.Aerial, a.Hybrid],
Text: null
};
j[a.Road] = {
Id: a.Road,
InitialClass: "MSVE_MapStyle",
OnClickFunction: sb,
StyleUpdateEvent: "onchangemapstyle",
StyleUpdateFunction: s,
Enabled: MapControl.Features.MapStyle.Road,
Title: L_NavActionRoadToolTip_Text,
Children: null,
Text: L_NavActionRoad_Text
};
j[a.Aerial] = {
Id: a.Aerial,
InitialClass: "MSVE_MapStyle",
OnClickFunction: mb,
StyleUpdateEvent: "onchangemapstyle",
StyleUpdateFunction: s,
Enabled: MapControl.Features.MapStyle.Aerial,
Title: L_NavActionAerialToolTip_Text,
Children: null,
Text: L_NavActionAerial_Text
};
j[a.Hybrid] = {
Id: a.Hybrid,
InitialClass: "MSVE_MapStyle",
OnClickFunction: nb,
StyleUpdateEvent: "onchangemapstyle",
StyleUpdateFunction: s,
Enabled: MapControl.Features.MapStyle.Hybrid,
Title: L_NavActionHybridToolTip_Text,
Children: null,
Text: L_NavActionHybrid_Text
};
j[a.Mode] = {
Id: a.Mode,
InitialClass: "MSVE_modeCell",
OnClickFunction: null,
StyleUpdateEvent: null,
StyleUpdateFunction: null,
Enabled: true,
Title: null,
Children: [a.Mode2D, a.Mode3D],
Text: null
};
j[a.Mode2D] = {
Id: a.Mode2D,
InitialClass: "MSVE_MapMode",
OnClickFunction: kb,
StyleUpdateEvent: "oninitmode",
StyleUpdateFunction: Z,
Enabled: true,
Title: L_NavActionFlatlandToolTip_Text,
Children: null,
Text: L_NavActionFlatland_Text
};
j[a.Mode3D] = {
Id: a.Mode3D,
InitialClass: "MSVE_MapMode",
OnClickFunction: qb,
StyleUpdateEvent: "oninitmode",
StyleUpdateFunction: Z,
Enabled: MapControl.Features.MapStyle.View3D,
Title: L_NavActionView3DToolTip_Text,
Children: null,
Text: L_NavActionView3D_Text
};
j[a.View] = {
Id: a.View,
InitialClass: null,
OnClickFunction: null,
StyleUpdateEvent: null,
StyleUpdateFunction: null,
Enabled: true,
Title: null,
Children: [a.Ortho, a.Oblique, a.StreetSide],
Text: null
};
j[a.Ortho] = {
Id: a.Ortho,
InitialClass: "MSVE_MapStyle",
OnClickFunction: t,
StyleUpdateEvent: "onchangemapstyle",
StyleUpdateFunction: s,
Enabled: true,
Title: L_NavActionOrthoToolTip_Text,
Children: null,
Text: null
};
j[a.Oblique] = {
Id: a.Oblique,
InitialClass: "MSVE_MapStyle",
OnClickFunction: F,
StyleUpdateEvent: "onchangemapstyle",
StyleUpdateFunction: s,
Enabled: false,
Title: L_NavActionObliqueToolTip_Text,
Children: null,
Text: null
};
j[a.StreetSide] = {
Id: a.StreetSide,
InitialClass: "MSVE_MapStyle",
OnClickFunction: hb,
StyleUpdateEvent: "onchangemapstyle",
StyleUpdateFunction: s,
Enabled: false,
Title: L_NavActionStreetSideToolTip_Text,
Children: null,
Text: null
};
j[a.ShowLabels] = {
Id: a.ShowLabels,
InitialClass: "MSVE_MapStyle",
OnClickFunction: vb,
StyleUpdateEvent: "onchangemapstyle",
StyleUpdateFunction: s,
Enabled: true,
Title: L_NavActionShowLabels_Text,
Children: null,
Text: L_NavActionLabels_Text
};
j[a.Traffic] = {
Id: a.Traffic,
InitialClass: "MSVE_MapStyle",
OnClickFunction: Ab,
StyleUpdateEvent: null,
StyleUpdateFunction: null,
Enabled: true,
Title: L_NavActionShowTrafficToolTip_Text,
Children: null,
Text: L_NavActionTraffic_Text
};
this.ObliqueFunctions = [];
this.ObliqueFunctions.ObliqueImageryIn3D = {
ObliqueClickFunction: fb,
Title: L_NavActionShowObliqueToolTip_Text,
DependsOnObliqueAvailability: true
};
this.ObliqueFunctions.ObliqueTiltIn3D = {
ObliqueClickFunction: lb,
Title: L_NavAction3DObliqueToolTip_Text,
DependsOnObliqueAvailability: false
};
var e = this,
b = [],
h = Msn.VE.DashboardStates.MapMode.Flatland,
d = Msn.VE.DashboardStates.MapView.Ortho,
f = Msn.VE.DashboardStates.MapStyle.Road;
this.orthoZoom = null;
var l;
this.obliqueCompass = null;
this.obliqueZoom = null;
this.displaying3DNotification = false;
var y = null;
this.Oblique3DFunctionality = this.ObliqueFunctions.ObliqueImageryIn3D;
var q = document.createElement("div");
q.id = "MSVE_navAction_palette";
document.body.appendChild(q);
var I = false,
ab = false,
S = 19,
Q = 1,
k = true,
R = false,
r = Msn.VE.BirdsEyeSearchSpinDirection.NoSpin,
N;
for (N in u) if (u.hasOwnProperty(N)) M(u[N]);
function Ib() {
var d = $MVEM.IsEnabled(MapControl.Features.MapStyle.BirdsEye) && (c.IsObliqueAvailable() || c.IsMapViewOblique());
if (d) {
i(a.Oblique, true);
if (b[a.ObliqueNotification] && !c.IsMapViewOblique() && !g(b[a.Oblique]).hasClass("MSVE_selected")) w()
} else {
i(a.Oblique, false);
if (b[a.ObliqueNotification]) p()
}
W();
if (c.IsModeEnabled(Msn.VE.MapActionMode.Mode3D)) U();
else T()
}
function Hb() {
var a;
for (a in u) if (u.hasOwnProperty(a)) J(u[a]);
document.body.removeChild(q);
q = null
}
function M(f) {
switch (f) {
case a.OrthoZoom:
b[f] = document.createElement("div");
e.orthoZoom = new Bb(b[f]);
e.orthoZoom.Init();
c.AttachEvent("onendzoom", v);
q.appendChild(b[f]);
v();
return;
case a.ObliqueZoom:
b[f] = document.createElement("div");
ab = true;
b[f].id = f;
q.appendChild(b[f]);
return;
case a.TinyZoom:
l = new Eb;
b[f] = l.Init();
c.AttachEvent("onendzoom", v);
v();
return;
case a.ObliqueCompass:
b[f] = document.createElement("div");
b[f].id = f;
I = true;
return;
case a.ObliqueNotification:
db();
return;
case a.ThreeDUpdatedNotification:
cb();
return;
case a.Oblique:
c.AttachEvent("onve3dphotostatechanged", rb)
}
var d = j[f],
g = document.createElement("div");
b[d.Id] = g;
g.id = d.Id;
g.enabled = d.Enabled;
g.classRecipients = [g];
if (d.Text != null) g.innerText = d.Text;
if (d.OnClickFunction != null && d.Enabled == true) g.attachEvent("onclick", d.OnClickFunction);
if (d.StyleUpdateEvent != null && d.StyleUpdateFunction != null) c.AttachEvent(d.StyleUpdateEvent, d.StyleUpdateFunction);
if (d.InitialClass) {
g.className = d.InitialClass;
if (!g.enabled) g.className += "_disabled"
}
if (d.Children != null) {
var h;
for (h in d.Children) if (d.Children.hasOwnProperty(h)) g.appendChild(M(d.Children[h]))
} else pseudoHover(g);
switch (f) {
case a.Oblique:
case a.ObliqueCompass:
c.AttachEvent("onobliqueenter", zb);
c.AttachEvent("onobliqueleave", K);
c.AttachEvent("onendmapstyleoblique", pb);
c.AttachEvent("onobliquechange", wb);
c.AttachEvent("obliquerequestunavailable", eb);
break;
case a.Traffic:
c.AttachEvent("onchangetraffic", z);
z()
}
return g
}
function J(f) {
switch (f) {
case a.OrthoZoom:
e.orthoZoom.Destroy();
b[f] = null;
c.DetachEvent("onendzoom", v);
try {
q.removeChild(b[f])
} catch (k) {}
return;
case a.ObliqueZoom:
try {
q.removeChild(b[f])
} catch (k) {}
if (e.obliqueZoom) {
e.obliqueZoom.Destroy();
e.obliqueZoom = null
}
case a.TinyZoom:
l.Destroy();
b[f] = null;
return;
case a.ObliqueCompass:
if (I && e.obliqueCompass) {
e.obliqueCompass.onclick = null;
e.obliqueCompass.Destroy();
e.obliqueCompass = null
}
return;
case a.ObliqueNotification:
b[a.ObliqueNotification].detachEvent("onclick", P);
return;
case a.ThreeDUpdatedNotification:
b[a.ThreeDUpdatedNotification] = null;
return;
case a.Traffic:
c.DetachEvent("onchangetraffic", z)
}
var i = b[f];
if (i == null) return;
var d = j[f];
if (d.Children != null) {
var g, h;
for (h in d.Children) if (d.Children.hasOwnProperty(h)) {
g = d.Children[h];
try {
i.removeChild(b[g])
} catch (k) {}
J(g)
}
}
if (d.OnClickFunction != null) i.detachEvent("onclick", d.OnClickFunction);
try {
if (c && d.StyleUpdateEvent != null && d.StyleUpdateFunction != null) c.DetachEvent(d.StyleUpdateEvent, d.StyleUpdateFunction)
} catch (k) {}
b[d.Id] = null
}
function db() {
b[a.ObliqueNotification] = document.createElement("div");
b[a.ObliqueNotification].id = a.ObliqueNotification;
b[a.ObliqueNotification].attachEvent("onclick", P);
b[a.ObliqueNotification].innerHTML += ' ' + '
"
}
function sb() {
A()
}
function A() {
if (f == Msn.VE.DashboardStates.MapStyle.Road && d == Msn.VE.DashboardStates.MapView.Ortho) return;
f = Msn.VE.DashboardStates.MapStyle.Road;
d = Msn.VE.DashboardStates.MapView.Ortho;
m(h + d + f)
}
function mb() {
if (b[a.ShowLabels]) {
i(a.ShowLabels, true);
if (k) Y();
else X()
} else X()
}
function X() {
if (f == Msn.VE.DashboardStates.MapStyle.Aerial && d == Msn.VE.DashboardStates.MapView.Ortho) return;
f = Msn.VE.DashboardStates.MapStyle.Aerial;
d = Msn.VE.DashboardStates.MapView.Ortho;
m(h + d + f)
}
function nb() {
Y()
}
function Y() {
if (f == Msn.VE.DashboardStates.MapStyle.Hybrid && d == Msn.VE.DashboardStates.MapView.Ortho) return;
f = Msn.VE.DashboardStates.MapStyle.Hybrid;
d = Msn.VE.DashboardStates.MapView.Ortho;
m(h + d + f)
}
function t() {
if (d == Msn.VE.DashboardStates.MapView.Ortho && h == Msn.VE.DashboardStates.MapMode.Flatland) return;
d = Msn.VE.DashboardStates.MapView.Ortho;
if (h == Msn.VE.DashboardStates.MapMode.Flatland) switch (f) {
case Msn.VE.DashboardStates.MapStyle.Aerial:
if ($MVEM.IsEnabled(MapControl.Features.MapStyle.Aerial)) m(h + d + f);
else A();
break;
case Msn.VE.DashboardStates.MapStyle.Hybrid:
if ($MVEM.IsEnabled(MapControl.Features.MapStyle.Hybrid)) m(h + d + f);
else A();
break;
default:
m(h + d + f)
} else m(h + d);
o()
}
function P(c) {
if (h == Msn.VE.DashboardStates.MapMode.View3D && g(b[a.Oblique]).hasClass("MSVE_selected")) {
p();
c.cancelBubble = true;
return
}
F()
}
function F() {
if (typeof b[a.ObliqueNotification] != "undefined" && b[a.ObliqueNotification]) p();
if (h == Msn.VE.DashboardStates.MapMode.View3D) e.Oblique3DFunctionality.ObliqueClickFunction();
else tb()
}
var L = null;
function fb() {
var e = new Date;
if (L != null) if (e.getTime() - L.getTime() < 1000) return;
L = e;
var d = !g(b[a.Oblique]).hasClass("MSVE_selected");
c.Show3DBirdseye(d, f == Msn.VE.DashboardStates.MapStyle.Road || k);
var h = d ? "RequestLayerBirdsEyeOn" : "RequestLayerBirdsEyeOff"
}
var n;
function tb() {
if (d === Msn.VE.DashboardStates.MapView.Oblique) return;
d = Msn.VE.DashboardStates.MapView.Oblique;
x();
if (k) f = Msn.VE.DashboardStates.MapStyle.Hybrid;
else f = Msn.VE.DashboardStates.MapStyle.Aerial;
if (typeof Msn.VE.API == "undefined") ob();
else E()
}
function ob() {
if (!n) {
var a = $ID("msve_mapContainer");
n = document.createElement("div");
n.id = "animator";
a.appendChild(n)
}
n.style.display = "block";
n.className = "zoom_animation";
window.setTimeout(E, 2000)
}
function E() {
if (n) {
n.parentNode.removeChild(n);
n = null
}
if (c.IsDragging() || c.IsZooming()) {
window.setTimeout(E, 250);
return
}
m(h + d + f)
}
function lb() {
Gb(Msn.VE.DashboardStates.MapMode.View3D + Msn.VE.DashboardStates.MapView.Oblique)
}
function hb() {
if (d == Msn.VE.DashboardStates.MapView.StreetSide && h == Msn.VE.DashboardStates.MapMode.Flatland) return;
d = Msn.VE.DashboardStates.MapView.StreetSide;
m(h + d);
jb()
}
function vb() {
if (f == Msn.VE.DashboardStates.MapStyle.Aerial) {
k = true;
f = Msn.VE.DashboardStates.MapStyle.Hybrid
} else if (f == Msn.VE.DashboardStates.MapStyle.Hybrid) {
k = false;
f = Msn.VE.DashboardStates.MapStyle.Aerial
}
m(h + d + f)
}
function kb() {
c.EnableMode(Msn.VE.MapActionMode.Mode2D)
}
function qb() {
if (typeof b[a.ThreeDUpdatedNotification] != "undefined" && b[a.ThreeDUpdatedNotification]) D();
if (!c.IsModeEnabled(Msn.VE.MapActionMode.Mode3D)) if (typeof ShowMessage != "undefined") {
ShowMessage(L_3DLoading_Text);
window.setTimeout(View3DSwitch, 200)
} else c.EnableMode(Msn.VE.MapActionMode.Mode3D)
}
function z() {
if (VE_TrafficManager.turnedOn) {
g(b[a.Traffic]).addClass("MSVE_selected");
b[a.Traffic].title = L_NavActionHideTrafficToolTip_Text
} else {
g(b[a.Traffic]).removeClass("MSVE_selected");
b[a.Traffic].title = L_NavActionShowTrafficToolTip_Text
}
}
function Ab() {
if (VE_TrafficManager.turnedOn) VE_TrafficManager.ClearTraffic();
else {
for (var a in Msn.VE.API.Globals.vemapinstances) if (Msn.VE.API.Globals.vemapinstances[a] instanceof VEMap && Msn.VE.API.Globals.vemapinstances[a].vemapcontrol) {
VE_TrafficManager.m_vemap = Msn.VE.API.Globals.vemapinstances[a];
break
}
VE_TrafficManager.turnedOn = true;
VE_TrafficManager.showTrafficFlow = true;
VE_TrafficManager.showIncidents = true;
VE_TrafficManager.showConstructionIncidents = true;
VE_TrafficManager.markets = [];
VE_TrafficManager.incidents = [];
VE_TrafficManager.m_vemap.ShowTrafficLegend();
VE_TrafficManager.m_vemap.SetTrafficLegendText(L_MapLegendAndPopupLink_Text);
window.setTimeout(VE_TrafficManager.GetMarkets, 100)
}
z()
}
function rb(c) {
if (c.enabled == "1") {
g(b[a.Oblique]).addClass("MSVE_selected");
b[a.Oblique].title = L_NavActionHideObliqueToolTip_Text
} else {
g(b[a.Oblique]).removeClass("MSVE_selected");
b[a.Oblique].title = L_NavActionShowObliqueToolTip_Text
}
}
function s(a) {
W(a.view.mapStyle)
}
function Z(a) {
if (a == Msn.VE.MapActionMode.Mode3D) U();
else T()
}
function U() {
if (h == Msn.VE.DashboardStates.MapMode.View3D) return;
h = Msn.VE.DashboardStates.MapMode.View3D;
if (typeof b[a.View] != "undefined" && b[a.View] != null) g(b[a.View].classRecipients).removeClass("MSVE_FlatlandMapMode").addClass("MSVE_View3DMapMode");
i(a.StreetSide, true);
i(a.Road, true);
i(a.Aerial, true);
i(a.Hybrid, true);
if (!e.Oblique3DFunctionality.DependsOnObliqueAvailability) i(a.Oblique, true);
else {
if (b[a.ObliqueNotification] != null && b[a.ObliqueNotification].enabled && !g(b[a.Oblique]).hasClass("MSVE_selected")) w();
o()
}
if (typeof b[a.Ortho] != "undefined" && b[a.Ortho] != null) b[a.Ortho].title = L_NavAction3DOrthoToolTip_Text;
if (typeof b[a.Oblique] != "undefined" && b[a.Oblique] != null) {
b[a.Oblique].title = e.Oblique3DFunctionality.Title;
if (b[a.Oblique].enabled && !g(b[a.Oblique]).hasClass("MSVE_selected")) w()
}
if (typeof b[a.StreetSide] != "undefined" && b[a.StreetSide] != null) b[a.StreetSide].title = L_NavAction3DStreetSideToolTip_Text;
var f = c.GetDashboard().GetShimmedElements(),
d;
for (d = 0; d < f.length; d++) mvcViewFacade.UpdateShimIfSupported(f[d])
}
function T() {
h = Msn.VE.DashboardStates.MapMode.Flatland;
if (typeof b[a.View] != "undefined" && b[a.View] != null) g(b[a.View].classRecipients).removeClass("MSVE_View3DMapMode").addClass("MSVE_FlatlandMapMode");
if (typeof b[a.Ortho] != "undefined" && b[a.Ortho] != null) b[a.Ortho].title = L_NavActionOrthoToolTip_Text;
if (typeof b[a.Oblique] != "undefined" && b[a.Oblique] != null) b[a.Oblique].title = L_NavActionObliqueToolTip_Text;
g(b[a.Oblique]).removeClass("MSVE_selected");
photoState = 0;
if ($MVEM.IsEnabled(MapControl.Features.MapStyle.Road)) i(a.Road, true);
else i(a.Road, false);
if ($MVEM.IsEnabled(MapControl.Features.MapStyle.Aerial)) i(a.Aerial, true);
else i(a.Aerial, false);
if ($MVEM.IsEnabled(MapControl.Features.MapStyle.Hybrid)) i(a.Hybrid, true);
else i(a.Hybrid, false);
if ($MVEM.IsEnabled(MapControl.Features.MapStyle.BirdsEye)) {
c.GetObliqueAvailability("OnFlatlandModeUpdateUIObliqueReturned", O);
return
} else O(false)
}
function O(b) {
if (b) {
i(a.Oblique, true);
if (e.obliqueZoom != null) e.obliqueZoom.UpdateFromMap()
} else {
i(a.Oblique, false);
d = Msn.VE.DashboardStates.MapView.Ortho;
o()
}
switch (d) {
case Msn.VE.DashboardStates.MapView.Oblique:
if (b && $MVEM.IsEnabled(MapControl.Features.MapStyle.BirdsEye)) m(h + d);
else t();
break;
case Msn.VE.DashboardStates.MapView.StreetSide:
t();
break;
case Msn.VE.DashboardStates.MapView.Ortho:
switch (f) {
case Msn.VE.DashboardStates.MapStyle.Aerial:
if ($MVEM.IsEnabled(MapControl.Features.MapStyle.Aerial)) m(h + d + f);
else A();
break;
case Msn.VE.DashboardStates.MapStyle.Hybrid:
if ($MVEM.IsEnabled(MapControl.Features.MapStyle.Hybrid)) m(h + d + f);
else A();
break;
default:
m(h + d + f)
}
break;
default:
t()
}
}
function v() {
if (e.orthoZoom) e.orthoZoom.UpdateFromMap();
if (e.obliqueZoom) e.obliqueZoom.UpdateFromMap();
var b = null,
a = null;
if (l) {
var f = l.GetPlus();
if (f) b = g([f]);
var d = l.GetMinus();
if (d) a = g([d])
}
if (c.IsMapViewOrtho() && c.GetZoomLevel() == S || c.IsMapViewOblique() && c.GetZoomLevel() == 2) {
if (b) b.addClass("MSVE_ZoomBar_plus_disabled");
if (l) l.UnhookPlusEvents()
} else if (c.GetZoomLevel() == Q) {
if (a) a.addClass("MSVE_ZoomBar_minus_disabled");
if (l) l.UnhookMinusEvents()
}
if (c.IsMapViewOrtho() && c.GetZoomLevel() != S || c.IsMapViewOblique() && c.GetZoomLevel() != 2) if (b && b.hasClass("MSVE_ZoomBar_plus_disabled")) {
b.removeClass("MSVE_ZoomBar_plus_disabled");
if (l) l.HookupPlusEvents()
}
if (c.GetZoomLevel() != Q) if (a && a.hasClass("MSVE_ZoomBar_minus_disabled")) {
a.removeClass("MSVE_ZoomBar_minus_disabled");
if (l) l.HookupMinusEvents()
}
}
function zb() {
if (c.IsMapViewOblique()) d = Msn.VE.DashboardStates.MapView.Oblique;
if (h == Msn.VE.DashboardStates.MapMode.Flatland || h == Msn.VE.DashboardStates.MapMode.View3D && e.Oblique3DFunctionality.DependsOnObliqueAvailability) {
i(a.Oblique, true);
if (b[a.ObliqueNotification] && !c.IsMapViewOblique() && !g(b[a.Oblique]).hasClass("MSVE_selected")) w()
}
}
function K() {
d = Msn.VE.DashboardStates.MapView.Ortho;
o();
if (h == Msn.VE.DashboardStates.MapMode.Flatland || h == Msn.VE.DashboardStates.MapMode.View3D && e.Oblique3DFunctionality.DependsOnObliqueAvailability) {
i(a.Oblique, false);
p()
}
}
function eb() {
if (c.IsObliqueAvailable()) e.obliqueCompass.UpdateFromMap(r, true);
else K()
}
function pb() {
if (c.IsObliqueAvailable()) {
d = Msn.VE.DashboardStates.MapView.Ortho;
o()
} else K()
}
function wb() {
if ($MVEM.IsEnabled(MapControl.Features.MapStyle.BirdsEye)) {
if (d != Msn.VE.DashboardStates.MapView.Oblique) {
d = Msn.VE.DashboardStates.MapView.Oblique;
i(a.Oblique, true);
x()
}
} else {
d = Msn.VE.DashboardStates.MapView.Oblique;
t()
}
if (b[a.ObliqueNotification]) p();
if (typeof e.obliqueCompass != "undefined" && e.obliqueCompass != null) {
e.obliqueCompass.UpdateFromMap(r);
r = Msn.VE.BirdsEyeSearchSpinDirection.NoSpin
}
}
function W(e) {
if (!e) e = c.GetMapStyle();
switch (e) {
case Msn.VE.MapStyle.Shaded:
case Msn.VE.MapStyle.Road:
d = Msn.VE.DashboardStates.MapView.Ortho;
o();
f = Msn.VE.DashboardStates.MapStyle.Road;
ub();
if (b[a.ShowLabels]) {
i(a.ShowLabels, false);
g(b[a.ShowLabels]).addClass("MSVE_selected")
}
break;
case Msn.VE.MapStyle.Aerial:
d = Msn.VE.DashboardStates.MapView.Ortho;
o();
f = Msn.VE.DashboardStates.MapStyle.Aerial;
G();
k = false;
if (b[a.ShowLabels]) {
i(a.ShowLabels, true);
g(b[a.ShowLabels]).removeClass("MSVE_selected")
}
break;
case Msn.VE.MapStyle.Hybrid:
d = Msn.VE.DashboardStates.MapView.Ortho;
o();
f = Msn.VE.DashboardStates.MapStyle.Hybrid;
if (b[a.ShowLabels]) {
k = true;
G();
i(a.ShowLabels, true);
g(b[a.ShowLabels]).addClass("MSVE_selected")
} else V();
break;
case Msn.VE.MapStyle.Oblique:
d = Msn.VE.DashboardStates.MapView.Oblique;
x();
f = Msn.VE.DashboardStates.MapStyle.Aerial;
if (b[a.ShowLabels]) {
G();
k = false;
i(a.ShowLabels, true);
g(b[a.ShowLabels]).removeClass("MSVE_selected")
}
i(a.Oblique, true);
break;
case Msn.VE.MapStyle.ObliqueHybrid:
d = Msn.VE.DashboardStates.MapView.Oblique;
x();
f = Msn.VE.DashboardStates.MapStyle.Hybrid;
if (b[a.ShowLabels]) {
V();
k = true;
i(a.ShowLabels, true);
g(b[a.ShowLabels]).addClass("MSVE_selected")
}
i(a.Oblique, true)
}
if (h == Msn.VE.DashboardStates.MapMode.View3D && g(b[a.Oblique]).hasClass("MSVE_selected")) if (f == Msn.VE.DashboardStates.MapStyle.Road) c.Show3DBirdseye(true, true);
else c.Show3DBirdseye(true, k);
if (b[a.ShowLabels]) if (k || f == Msn.VE.DashboardStates.MapStyle.Road) b[a.ShowLabels].title = L_NavActionHideLabels_Text;
else b[a.ShowLabels].title = L_NavActionShowLabels_Text
}
function ub() {
if (typeof b[a.Style] != "undefined" && b[a.Style] != null) {
var c;
for (c = 0; c < b[a.Style].classRecipients.length; c++) b[a.Style].classRecipients[c].className = "MSVE_RoadMapStyle"
}
}
function G() {
if (typeof b[a.Style] != "undefined" && b[a.Style] != null) {
var c;
for (c = 0; c < b[a.Style].classRecipients.length; c++) b[a.Style].classRecipients[c].className = "MSVE_AerialMapStyle"
}
}
function V() {
if (typeof b[a.Style] != "undefined" && b[a.Style] != null) {
var c;
for (c = 0; c < b[a.Style].classRecipients.length; c++) b[a.Style].classRecipients[c].className = "MSVE_HybridMapStyle"
}
}
function o() {
if (typeof b[a.View] != "undefined" && b[a.View] != null) {
var c = g(b[a.View].classRecipients);
c.removeClass("MSVE_StreetSideView");
c.removeClass("MSVE_ObliqueView");
c.addClass("MSVE_OrthoView")
}
if (b[a.Traffic] != null) {
i(a.Traffic, true);
z()
}
r = Msn.VE.BirdsEyeSearchSpinDirection.NoSpin
}
function x() {
if (typeof b[a.View] != "undefined" && b[a.View] != null) {
var c = g(b[a.View].classRecipients);
c.removeClass("MSVE_StreetSideView");
c.removeClass("MSVE_OrthoView");
c.addClass("MSVE_ObliqueView")
}
if (I) {
if (e.obliqueCompass == null) {
e.obliqueCompass = new xb(b[a.ObliqueCompass]);
if (b[a.ObliqueCompass].radius) e.obliqueCompass.SetRadius(b[a.ObliqueCompass].radius);
e.obliqueCompass.onclick = function () {
r = Msn.VE.BirdsEyeSearchSpinDirection.NoSpin
}
}
e.obliqueCompass.UpdateFromMap()
}
if (ab) {
if (e.obliqueZoom == null) {
e.obliqueZoom = new yb(b[a.ObliqueZoom]);
e.obliqueZoom.Init()
}
e.obliqueZoom.UpdateFromMap()
}
if (b[a.Traffic] != null && h == Msn.VE.DashboardStates.MapMode.Flatland) i(a.Traffic, false)
}
function jb() {
if (typeof b[a.View] != "undefined" && b[a.View] != null) {
var c = g(b[a.View].classRecipients);
c.removeClass("MSVE_OrthoView");
c.removeClass("MSVE_ObliqueView");
c.addClass("MSVE_StreetSideView")
}
}
function w() {
if (!b[a.ObliqueNotification]) return;
if (R) return;
R = true;
if (!e.displaying3DNotification) if (d != Msn.VE.DashboardStates.MapView.Oblique) {
if (!y) {
var o = g(b[a.ObliqueNotification]),
k = o.select("img");
for (var i = 0; i < k.length && !y; i++) {
var j = k.element(i);
if (j.id == "MSVE_obliqueNotifyImg") y = j
}
}
if (y) y.src = c.GetObliqueMode().GetMiddleTileFilename();
var f = b[a.Oblique];
b[a.ObliqueNotification].style.display = "block";
var m = f.offsetLeft + f.offsetWidth / 2 - b[a.ObliqueNotification].offsetWidth / 2,
n = f.offsetTop + f.offsetHeight + 4;
g(b[a.ObliqueNotification]).setStyle("top", n + "px").setStyle("left", m + "px");
var l = C(),
h;
for (h = 0; h < l.length; ++h) mvcViewFacade.UpdateShimIfSupported(l[h]);
m = n = f = null;
window.setTimeout(p, 6000)
}
}
function bb() {
if (!b[a.ThreeDUpdatedNotification]) return;
p();
if (!e.displaying3DNotification) {
e.displaying3DNotification = true;
var c = b[a.Mode3D];
b[a.ThreeDUpdatedNotification].style.display = "block";
var d = c.offsetLeft - 6,
f = c.offsetTop + c.offsetHeight + 4;
g(b[a.ThreeDUpdatedNotification]).setStyle("top", f + "px").setStyle("left", d + "px");
mvcViewFacade.UpdateShimIfSupported(b[a.ThreeDUpdatedNotification]);
c = null;
window.setTimeout(D, 6000)
}
}
function p() {
b[a.ObliqueNotification].style.display = "none";
var d = C(),
c;
for (c = 0; c < d.length; ++c) mvcViewFacade.UpdateShimIfSupported(d[c])
}
function D() {
e.displaying3DNotification = false;
b[a.ThreeDUpdatedNotification].style.display = "none";
mvcViewFacade.UpdateShimIfSupported(b[a.ThreeDUpdatedNotification])
}
function i(c, d) {
if (b[c] == null) return;
if (b[c].enabled == d) return;
b[c].enabled = d;
var a = j[c];
if (a.InitialClass) if (d) g(b[c]).swapClass(a.InitialClass + "_disabled", a.InitialClass);
else g(b[c]).swapClass(a.InitialClass, a.InitialClass + "_disabled");
if (a.Title) b[c].title = a.Title;
if (a.OnClickFunction) if (d) b[c].attachEvent("onclick", a.OnClickFunction);
else b[c].detachEvent("onclick", a.OnClickFunction)
}
function m(d) {
if (d & Msn.VE.DashboardStates.MapView.Ortho || d & Msn.VE.DashboardStates.MapMode.View3D) if (d & Msn.VE.DashboardStates.MapStyle.Road) c.SetMapStyle("r");
else if (d & Msn.VE.DashboardStates.MapStyle.Aerial) c.SetMapStyle("a");
else if (d & Msn.VE.DashboardStates.MapStyle.Hybrid) c.SetMapStyle("h");
if (d & Msn.VE.DashboardStates.MapMode.Flatland && d & Msn.VE.DashboardStates.MapView.Oblique) if (d & Msn.VE.DashboardStates.MapStyle.Aerial && c.GetMapStyle() != Msn.VE.MapStyle.Oblique) {
k = false;
if (b[a.ShowLabels]) {
i(a.ShowLabels, true);
g(b[a.ShowLabels]).removeClass("MSVE_selected")
}
c.SetMapStyle(Msn.VE.MapStyle.Oblique)
} else if (d & Msn.VE.DashboardStates.MapStyle.Hybrid && c.GetMapStyle() != Msn.VE.MapStyle.ObliqueHybrid) {
k = true;
if (b[a.ShowLabels]) {
i(a.ShowLabels, true);
g(b[a.ShowLabels]).addClass("MSVE_selected")
}
c.SetMapStyle(Msn.VE.MapStyle.ObliqueHybrid)
}
}
function Gb(a) {
if (a & Msn.VE.DashboardStates.MapMode.View3D) if (a & Msn.VE.DashboardStates.MapView.Ortho) c.SetTilt(-90);
else if (a & Msn.VE.DashboardStates.MapView.Oblique) c.SetTilt(-45);
else if (a & Msn.VE.DashboardStates.MapView.StreetSide) c.SetTilt(-25)
}
function C() {
return [b[a.ObliqueNotification]]
}
function Fb(a) {
return b[a]
}
function Cb() {
return b
}
function Db() {
return l
}
function gb() {
return r
}
function ib(a) {
r = a
}
this.SetMapViewState = function (a) {
d = a
};
this.GetMapViewState = function () {
return d
};
this.SetMapModeState = function (a) {
h = a
};
this.GetMapModeState = function () {
return h
};
this.SetLabelsState = function (a) {
k = a
};
this.GetLabelsState = function () {
return k
};
this.GetLastRotationDirection = gb;
this.SetLastRotationDirection = ib;
this.GetObliqueNotifierShimmedElements = C;
this.Init = Ib;
this.Create = M;
this.Destroy = Hb;
this.DestroyControl = J;
this.GetControl = Fb;
this.GetControls = Cb;
this.GetTinyZoom = Db;
this.OnOrthoMapViewClick = t;
this.OnObliqueMapViewClick = F;
this.UpdateZoom = v;
this.SelectObliqueMapView = x;
this.SelectOrthoMapView = o;
this.DisplayObliqueNotification = w;
this.HideObliqueNotification = p;
this.DisplayThreeDUpdatedNotification = bb;
this.HideThreeDUpdatedNotification = D
};
function bb(o, c, d, b) {
var a = document.createElement("div"),
i = 0,
j = 0,
h = false,
f = 15;
this.Init = function () {
a.id = "Compass";
a.attachEvent("onmousedown", k);
a.attachEvent("onmouseup", m);
a.attachEvent("onmousemove", l);
a.attachEvent("ondblclick", IgnoreEvent);
a.title = L_NavActionCompassPan_Text;
o.appendChild(a);
if (isNaN(parseInt(c))) c = a.offsetWidth / 2;
if (isNaN(parseInt(d))) d = a.offsetHeight / 2;
if (isNaN(parseInt(b))) b = Math.min(c, d)
};
this.Destroy = function () {
a.detachEvent("onmousedown", k);
a.detachEvent("onmouseup", m);
a.detachEvent("onmousemove", l);
a.detachEvent("ondblclick", IgnoreEvent);
a = null
};
function k(m) {
m = GetEvent(m);
CancelEvent(m);
var n = g(a).getPagePosition();
i = n.x;
j = n.y;
if (a.setCapture) a.setCapture();
var k = Gimme.Screen.getMousePosition(m).x - i - c,
l = Gimme.Screen.getMousePosition(m).y - j - d,
o = Math.sqrt(k * k + l * l);
if (o < b) {
k = Math.floor(k / b * f);
l = Math.floor(l / b * f);
e.ContinuousPan(k, l, 0, true);
h = true
}
return false
}
function l(k) {
k = GetEvent(k);
CancelEvent(k);
if (h) {
var a = Gimme.Screen.getMousePosition(k).x - i - c,
g = Gimme.Screen.getMousePosition(k).y - j - d,
l = Math.sqrt(a * a + g * g);
if (l < b) {
a = Math.floor(a / b * f);
g = Math.floor(g / b * f);
e.ContinuousPan(a, g, 0, true)
}
}
return false
}
function m(b) {
b = GetEvent(b);
CancelEvent(b);
if (a.releaseCapture) a.releaseCapture();
e.StopContinuousPan();
h = false;
return false
}
function p() {
a.style.display = "none"
}
function q() {
a.style.display = "block"
}
function n() {
return a
}
this.Hide = p;
this.Show = q;
this.GetElement = n
}
var a = H,
b = null,
f = null,
A = null,
c = null,
t = null,
w = null,
x = null,
d = null,
m = null,
q = null,
r = null,
h = null,
i = null,
lb = null,
j = null,
o = null,
p = null,
n = null,
k = null,
l = null,
v = null,
u = null,
U = ["North", "East", "South", "West"],
R = {
"North": 0,
"East": 1,
"South": 2,
"West": 3
},
z, y, s, K = 150,
G = .7,
X = .9,
M = 1;
function fb() {
A = [a.Mode, a.View, a.Style, a.ShowLabels, a.TinyZoom, a.ObliqueNotification, a.ObliqueCompass, a.ThreeDUpdatedNotification];
if ($MVEM.IsEnabled(MapControl.Features.Traffic.ShowOnNavbar)) if (typeof VE_TrafficManager != "undefined") A.push(a.Traffic);
f = new Msn.VE.CommonControls(e, A);
b = f.GetControls();
b[a.Oblique].innerText = L_DashboardBirdsEye_Text;
c = document.createElement("div");
c.id = "MSVE_navAction_container";
c.className = "MSVE_Dashboard_V6";
if (Msn.VE.API) g(c).addClass("MSVE_API").addClass(typeof E === "string" ? "MSVE_Dashboard_V6_" + E.toLowerCase() : "");
i = document.createElement("div");
i.id = "MSVE_navAction_styleGroup";
d = document.createElement("div");
d.id = "MSVE_navAction_topBar";
b[a.View].classRecipients = [i, c, d];
b[a.Style].classRecipients = [i];
b[a.Mode].classRecipients = [d];
f.Oblique3DFunctionality = f.ObliqueFunctions.ObliqueImageryIn3D;
L.appendChild(c);
t = document.createElement("div");
t.id = "MSVE_navAction_topBackground";
t.className = "MSVE_navAction_background";
w = document.createElement("div");
w.id = "MSVE_navAction_compassBackground";
w.className = "MSVE_navAction_background";
x = document.createElement("div");
x.id = "MSVE_navAction_leftBackground";
x.className = "MSVE_navAction_background";
d.className = "MSVE_Dashboard MSVE_Dashboard_V6 MSVE_FlatlandMapMode";
m = document.createElement("div");
m.id = "MSVE_navAction_leftBar";
m.className = "MSVE_Dashboard MSVE_Dashboard_V6";
q = document.createElement("div");
q.id = "MSVE_navAction_compassContainer";
q.className = "MSVE_Dashboard MSVE_Dashboard_V6";
j = document.createElement("div");
j.id = "MSVE_navAction_toggleGlyphWrapper";
j.title = L_NavActionHideToolTip_Text;
pseudoHover(j);
c.appendChild(x);
c.appendChild(w);
c.appendChild(t);
c.appendChild(q);
c.appendChild(m);
c.appendChild(d);
c.appendChild(j);
if (!e.IsModeEnabled(Msn.VE.MapActionMode.Mode3D)) P();
var C = g(c),
B = C.select("> div");
B.addEvent("mousedown", IgnoreEvent);
B.addEvent("mouseup", IgnoreEvent);
B.addEvent("mousemove", DashboardContainerMouseMoveEvent);
B.addEvent("mousewheel", IgnoreEvent);
B.addEvent("dblclick", IgnoreEvent);
B.addEvent("contextmenu", IgnoreEvent);
B.addEvent("keydown", IgnoreEvent);
B.addEvent("keyup", IgnoreEvent);
B.addEvent("click", IgnoreEvent);
h = [];
for (s = 0; s < 5; s++) {
h[s] = document.createElement("div");
h[s].className = "MSVE_navAction_separator";
h[s].id = "MSVE_navAction_separator" + s
}
y = document.createElement("div");
y.id = "MSVE_navAction_toggleGlyphInner";
y.className = "MSVE_navAction_toggleGlyph";
j.appendChild(y);
b[a.Road].title = L_NavActionRoadToolTip_Text;
b[a.Aerial].title = L_NavActionAerialToolTip_Text;
b[a.Hybrid].title = L_NavActionHybridToolTip_Text;
b[a.Mode2D].title = L_NavActionFlatlandToolTip_Text;
b[a.Mode3D].title = L_NavActionView3DToolTip_Text;
i.appendChild(b[a.Road]);
i.appendChild(b[a.Aerial]);
i.appendChild(h[1]);
i.appendChild(b[a.Oblique]);
if (D) {
d.appendChild(b[a.Mode]);
d.appendChild(h[0])
}
d.appendChild(i);
d.appendChild(h[2]);
f.SetLabelsState(W != false);
d.appendChild(b[a.ShowLabels]);
d.appendChild(h[3]);
if (b[a.Traffic] != null) {
b[a.Traffic].title = L_NavActionShowTrafficToolTip_Text;
d.appendChild(b[a.Traffic]);
d.appendChild(h[4])
} else C.addClass("notraffic");
if (!ab) {
var G = parseInt(C.getStyle("width")) - parseInt(g(b[a.Oblique]).getStyle("width"));
c.style.width = G + "px";
b[a.Oblique].style.display = "none"
}
r = document.createElement("div");
r.id = "MSVE_navAction_compassWrapper";
q.appendChild(r);
z = new bb(r);
z.Init();
pseudoHover(z.GetElement());
b[a.ObliqueCompass].radius = 31;
r.appendChild(b[a.ObliqueCompass]);
var F = f.GetTinyZoom();
m.appendChild(b[a.TinyZoom]);
p = document.createElement("div");
p.id = "MSVE_navAction_zoomPlusWrapper";
pseudoHover(p);
p.appendChild(F.GetPlus());
b[a.TinyZoom].appendChild(p);
o = document.createElement("div");
o.id = "MSVE_navAction_zoomMinusWrapper";
pseudoHover(o);
o.appendChild(F.GetMinus());
b[a.TinyZoom].appendChild(o);
F.HookupPlusMinusEvents(p, o);
n = document.createElement("div");
n.id = "MSVE_navAction_rotatorContainer";
u = document.createElement("div");
u.id = "MSVE_navAction_ccw";
u.title = L_NavActionObliqueRotationToolTip_CCW_Text;
u.className = "MSVE_navAction_rotator";
v = document.createElement("div");
v.id = "MSVE_navAction_cw";
v.title = L_NavActionObliqueRotationToolTip_CW_Text;
v.className = "MSVE_navAction_rotator";
k = document.createElement("div");
k.id = "MSVE_navAction_ccwWrapper";
pseudoHover(k);
k.appendChild(u);
l = document.createElement("div");
l.id = "MSVE_navAction_cwWrapper";
pseudoHover(l);
l.appendChild(v);
g(k).addEvent("click", O);
g(l).addEvent("click", Q);
n.appendChild(k);
n.appendChild(l);
m.appendChild(n);
d.appendChild(b[a.ObliqueNotification]);
d.appendChild(b[a.ThreeDUpdatedNotification]);
f.Init();
e.AttachEvent("oninitmode", Y);
if (Msn.VE.Animation) J();
f.UpdateZoom()
}
function cb() {
d.removeChild(b[a.ObliqueNotification]);
d.removeChild(b[a.ThreeDUpdatedNotification]);
g(k).removeEvent("click", O);
g(l).removeEvent("click", Q);
k.removeChild(u);
l.removeChild(v);
n.removeChild(k);
n.removeChild(l);
m.removeChild(n);
var s = f.GetTinyZoom();
if (s) {
var A = s.GetMinus();
if (A) o.removeChild(A);
var E = s.GetPlus();
if (E) p.removeChild(E);
b[a.TinyZoom].removeChild(o);
b[a.TinyZoom].removeChild(p);
m.removeChild(b[a.TinyZoom])
}
z.Destroy();
q.removeChild(r);
r.removeChild(b[a.ObliqueCompass]);
if (b[a.Traffic] != null) {
d.removeChild(b[a.Traffic]);
d.removeChild(h[4])
}
d.removeChild(b[a.ShowLabels]);
d.removeChild(h[3]);
i.removeChild(b[a.Road]);
i.removeChild(b[a.Aerial]);
i.removeChild(h[1]);
i.removeChild(b[a.Oblique]);
if (D) {
d.removeChild(b[a.Mode]);
d.removeChild(h[0])
}
d.removeChild(i);
d.removeChild(h[2]);
j.removeChild(y);
var G = g(c),
e = G.select("> div");
e.removeEvent("mouseleave", B);
e.removeEvent("mouseenter", C);
e.removeEvent("mousedown", IgnoreEvent);
e.removeEvent("mouseup", IgnoreEvent);
e.removeEvent("mousemove", DashboardContainerMouseMoveEvent);
e.removeEvent("mousewheel", IgnoreEvent);
e.removeEvent("dblclick", IgnoreEvent);
e.removeEvent("contextmenu", IgnoreEvent);
e.removeEvent("keydown", IgnoreEvent);
e.removeEvent("keyup", IgnoreEvent);
e.removeEvent("click", IgnoreEvent);
c.removeChild(x);
c.removeChild(w);
c.removeChild(t);
c.removeChild(q);
c.removeChild(m);
c.removeChild(d);
c.removeChild(j);
L.removeChild(c);
f.Destroy();
if (Msn.VE.Animation) F().onclick = null
}
function B() {
Gimme.Animation.end("MSVE_NAVACTION_FADEIN");
g(c).select("div.MSVE_navAction_background").fadeTo(null, G, K, "MSVE_NAVACTION_FADEOUT")
}
function C() {
Gimme.Animation.end("MSVE_NAVACTION_FADEOUT");
g(c).select("div.MSVE_navAction_background").fadeTo(null, X, K, "MSVE_NAVACTION_FADEIN")
}
function Y(a) {
if (a == Msn.VE.MapActionMode.Mode3D) {
Z();
if (e.Get3DControl()) if (g(N()).hasClass("collapsed")) e.Get3DControl().ShowNavigationControl = false;
else e.Get3DControl().ShowNavigationControl = true
} else P()
}
function P() {
var a = g(c),
b = a.select("> div");
a.select("div.MSVE_navAction_background").setStyle("opacity", G);
b.addEvent("mouseleave", B);
b.addEvent("mouseenter", C)
}
function Z() {
var a = g(c),
b = a.select("> div");
b.removeEvent("mouseleave", B);
b.removeEvent("mouseenter", C);
a.select("div.MSVE_navAction_background").setStyle("opacity", M)
}
function O() {
I(Msn.VE.BirdsEyeSearchSpinDirection.CounterclockwiseSpin)
}
function Q() {
I(Msn.VE.BirdsEyeSearchSpinDirection.ClockwiseSpin)
}
function I(a) {
f.SetLastRotationDirection(a);
var b = e.GetObliqueScene();
if (b) {
var d = R[b.GetOrientation()],
c = U[(d + a + 4) % 4];
e.SetObliqueOrientation(c, a, true);
f.obliqueCompass.UpdateFromMap()
}
}
function N() {
return c
}
function T() {
return f.GetObliqueNotifierShimmedElements().concat([t])
}
function F() {
return j
}
function db() {
return f.GetMapModeState()
}
function gb() {
if (c) c.style.display = "block"
}
function eb() {
if (c) c.style.display = "none"
}
function J() {
if (!e.GetDashboard().GetToggleGlyph()) return;
e.GetDashboard().GetToggleGlyph().onclick = function () {
var a = e.GetDashboard();
if (g(a.GetElement()).hasClass("collapsed")) {
g(a.GetElement()).removeClass("collapsed");
a.GetToggleGlyph().title = L_NavActionHideToolTip_Text;
if (e.Get3DControl()) e.Get3DControl().ShowNavigationControl = true
} else {
g(a.GetElement()).addClass("collapsed");
a.GetToggleGlyph().title = L_NavActionShowToolTip_Text;
if (e.Get3DControl()) e.Get3DControl().ShowNavigationControl = false
}
var c = e.GetDashboard().GetShimmedElements(),
b;
for (b = 0; b < c.length; b++) mvcViewFacade.UpdateShimIfSupported(c[b]);
g("#MSVE_navAction_topBackground").setStyle("opacity", M)
}
}
function V() {
f.ObliqueFunctions.ObliqueImageryIn3D.ObliqueClickFunction()
}
this.DisplayThreeDUpdatedNotification = function hb() {
f.DisplayThreeDUpdatedNotification()
};
function S(a) {
f.SetLastRotationDirection(a)
}
this.Init = fb;
this.Destroy = cb;
this.GetElement = N;
this.GetToggleGlyph = F;
this.GetShimmedElements = T;
this.createRoller = J;
this.GetMode = db;
this.Show = gb;
this.Hide = eb;
this.Oblique3DToggle = V;
this.SetLastRotationDirection = S
};
Msn.VE.LatLong = function (b, a) {
this.latitude = b;
this.longitude = a
};
Msn.VE.LatLong.prototype.ToString = function () {
return "(" + this.latitude + ", " + this.longitude + ")"
};
Msn.VE.LatLong.prototype.Copy = function (a) {
if (!a) return;
this.latitude = a.latitude;
this.longitude = a.longitude
};
Msn.VE.LatLong.prototype.Equals = function (a) {
if (a instanceof Msn.VE.LatLong) return this.latitude == a.latitude && this.longitude == a.longitude;
else return false
};
Msn.VE.LatLongRectangle = function (a, b) {
this.northwest = a;
this.southeast = b;
this.ToString = function () {
return "(" + (this.northwest ? this.northwest.ToString() : "null") + ", " + (this.southeast ? this.southeast.ToString() : "null") + ")"
};
this.Copy = function (a) {
if (!a) return;
if (!this.northwest) this.northwest = new Msn.VE.LatLong;
if (!this.southeast) this.southeast = new Msn.VE.LatLong;
this.northwest.Copy(a.northwest);
this.southeast.Copy(a.southeast)
};
this.Center = function () {
var b = Math.sin(this.northwest.latitude * Math.PI / 180),
c = Math.sin(this.southeast.latitude * Math.PI / 180),
d = .25 * (Math.log((1 + b) / (1 - b)) + Math.log((1 + c) / (1 - c))),
a = new Msn.VE.LatLong;
a.latitude = Math.atan(Math.exp(d)) * 360 / Math.PI - 90;
a.longitude = .5 * (parseFloat(this.northwest.longitude) + parseFloat(this.southeast.longitude));
return a
};
this.Contains = function (c) {
return c.latitude <= a.latitude && c.longitude >= a.longitude && c.latitude >= b.latitude && c.longitude <= b.longitude
};
this.ContainsRectangle = function (a) {
return a.southeast.latitude >= this.southeast.latitude && a.southeast.longitude <= this.southeast.longitude && a.northwest.latitude <= this.northwest.latitude && a.northwest.longitude >= this.northwest.longitude
}
};
Msn.VE.MapStyle = new function () {
this.Road = "r";
this.Shaded = "s";
this.Aerial = "a";
this.Hybrid = "h";
this.Oblique = "o";
this.ObliqueHybrid = "b"
};
Msn.VE.MapStyle.IsViewOblique = function (a) {
return a == Msn.VE.MapStyle.ObliqueHybrid || a == Msn.VE.MapStyle.Oblique
};
Msn.VE.MapStyle.IsViewOrtho = function (a) {
return a == Msn.VE.MapStyle.Road || a == Msn.VE.MapStyle.Shaded || a == Msn.VE.MapStyle.Hybrid || a == Msn.VE.MapStyle.Aerial
};
Msn.VE.MapViewType = function () {};
Msn.VE.MapViewType.Pixel = "pixel";
Msn.VE.MapViewType.PixelRect = "pixelRect";
Msn.VE.MapViewType.LatLong = "latlong";
Msn.VE.MapViewType.LatLongAccurate = "latlongaccurate";
Msn.VE.MapViewType.LatLongRect = "latlongRect";
Msn.VE.MapView = function (map) {
this.zoomLevel = 0;
this.mapStyle = null;
this.doRoadShading = false;
this.tilt = -90;
this.direction = 0;
this.altitude = -1000;
this.center = new VEPixel;
this.latlong = new Msn.VE.LatLong;
this.cameraLatlong = null;
this.pixelRect = new Msn.VE.PixelRectangle;
this.latlongRect = new Msn.VE.LatLongRectangle;
this.sceneId = null;
this.sceneOrientation = null;
this.bySceneId = false;
this.callback = null;
this.photoX = null;
this.photoY = null;
this.photoScale = null;
this._supressFlyToCall = false;
this._needsPivotOperation = true;
var mapInstance = map,
p_this = this,
viewType = Msn.VE.MapViewType.Pixel;
this.Destroy = function () {
this.center = this.latlong = p_this = mapInstance = null
};
this.GetViewType = function () {
return viewType
};
this.GetMap = function () {
return mapInstance
};
this.SetMap = function (a) {
mapInstance = a
};
function MakeCopy() {
var a = new Msn.VE.MapView;
a.Copy(p_this);
return a
}
function Copy(a) {
p_this.zoomLevel = a.zoomLevel;
p_this.mapStyle = a.mapStyle;
p_this.doRoadShading = a.doRoadShading;
p_this.tilt = a.tilt;
p_this.direction = a.direction;
p_this.altitude = a.altitude;
p_this.center.Copy(a.center);
if (a.cameraLatlong != null) {
p_this.cameraLatlong = new Msn.VE.LatLong;
p_this.cameraLatlong.Copy(a.cameraLatlong)
}
p_this.latlong.Copy(a.latlong);
p_this.pixelRect.Copy(a.pixelRect);
p_this.latlongRect.Copy(a.latlongRect);
p_this.sceneId = a.sceneId;
p_this.sceneOrientation = a.sceneOrientation;
p_this.photoX = a.photoX;
p_this.photoY = a.photoY;
p_this.photoScale = a.photoScale;
p_this.SetMap(a.GetMap());
viewType = a.GetViewType()
}
function Equals(a) {
return a != null && p_this.zoomLevel == a.zoomLevel && p_this.mapStyle == a.mapStyle && MathAbs(p_this.tilt - a.tilt) < 1e-6 && MathAbs(p_this.direction - a.direction) < 1e-6 && MathAbs(p_this.altitude - a.altitude) < 1e-6 && MathAbs(p_this.center.x - a.center.x) < 1e-6 && MathAbs(p_this.center.y - a.center.y) < 1e-6 && p_this.sceneId == a.sceneId && p_this.GetMap() == a.GetMap() && p_this.sceneOrientation == a.sceneOrientation
}
function ToString() {
return "(" + p_this.latlong.ToString() + ", " + p_this.zoomLevel + ", " + p_this.mapStyle + ")"
}
function SetCenter(a) {
if (!a) return;
p_this.center = a;
viewType = Msn.VE.MapViewType.Pixel
}
function SetCenterLatLong(a) {
if (!a) return;
p_this.latlong = a;
p_this.cameraLatlong = null;
viewType = Msn.VE.MapViewType.LatLong
}
function SetCenterLatLongAccurate(a) {
if (a) {
p_this.latlong = a;
p_this.cameraLatlong = null;
if (Msn.VE.MapStyle.IsViewOblique(p_this.mapStyle)) viewType = Msn.VE.MapViewType.LatLongAccurate;
else viewType = Msn.VE.MapViewType.LatLong
}
}
function SetPixelRectangle(a) {
p_this.pixelRect = a;
p_this.cameraLatlong = null;
p_this.tilt = -90;
p_this.direction = 0;
viewType = Msn.VE.MapViewType.PixelRect
}
function SetLatLongRectangle(a) {
p_this.latlongRect = a;
p_this.cameraLatlong = null;
p_this.tilt = -90;
p_this.direction = 0;
viewType = Msn.VE.MapViewType.LatLongRect
}
function SetZoomLevel(a) {
if (a <= 0) a = 1;
var c = mapInstance.GetCenterOffset().x,
d = mapInstance.GetCenterOffset().y;
switch (viewType) {
case Msn.VE.MapViewType.Pixel:
var b = Math.pow(2, a - p_this.zoomLevel);
p_this.center.x = (p_this.center.x + c) * b - c;
p_this.center.y = (p_this.center.y + d) * b - d;
break;
case Msn.VE.MapViewType.PixelRect:
var b = Math.pow(2, a - p_this.zoomLevel);
p_this.pixelRect.topLeft.x = p_this.pixelRect.topLeft.x * b;
p_this.pixelRect.topLeft.y = p_this.pixelRect.topLeft.y * b;
p_this.pixelRect.bottomRight.x = p_this.pixelRect.bottomRight.x * b;
p_this.pixelRect.bottomRight.y = p_this.pixelRect.bottomRight.y * b
}
if (p_this.zoomLevel != a) {
p_this.altitude = -1000;
if (p_this.zoomLevel != 0) p_this.cameraLatlong = null
}
p_this.zoomLevel = a
}
function SetMapStyle(a, c, b, e, d) {
var f = p_this.mapStyle;
p_this.mapStyle = a;
if (viewType == Msn.VE.MapViewType.Pixel) viewType = Msn.VE.MapViewType.LatLong;
if (!Msn.VE.MapStyle.IsViewOblique(a)) {
p_this.sceneId = null;
p_this.sceneOrientation = null;
p_this.bySceneId = false
} else {
p_this.sceneId = c;
if (b) p_this.sceneOrientation = b;
p_this.spinDirection = f == a ? e : null;
p_this.preserveScene = d;
if (c) p_this.bySceneId = true;
else p_this.bySceneId = false
}
}
function SetTilt(a) {
if (a >= 269.99999) a = a - 360;
if (a < -90) a = -90;
if (a > 90) a = 90;
p_this.tilt = a;
p_this._needsPivotOperation = true
}
function SetDirection(a) {
if (a < 0 || a >= 360) {
a = a % 360;
if (a < 0) a = 360 + a
}
p_this.direction = a;
p_this._needsPivotOperation = true
}
function SetAltitude(a) {
if (a < -1000 || a > 15000000) a = -1000;
p_this.altitude = a
}
function GetTilt() {
return p_this.tilt
}
function GetDirection() {
return p_this.direction
}
function GetAltitude() {
return p_this.altitude
}
function ScaleCoord(a, b) {
if (b) a = a * Math.pow(2, b - p_this.zoomLevel);
return a
}
function GetX(a) {
return ScaleCoord(p_this.center.x, a)
}
function GetY(a) {
return ScaleCoord(p_this.center.y, a)
}
function GetCenter(a) {
var b = ScaleCoord(p_this.center.x + mapInstance.GetCenterOffset().x, a),
c = ScaleCoord(p_this.center.y + mapInstance.GetCenterOffset().y, a);
return new VEPixel(b, c)
}
function GetZoomLevel() {
return p_this.zoomLevel
}
function GetLatLongRectangle() {
return p_this.latlongRect
}
function GetPixelRectangle() {
return p_this.pixelRect
}
function GetCenterLatLong() {
var b = p_this.center.x + mapInstance.GetCenterOffset().x,
c = p_this.center.y + mapInstance.GetCenterOffset().y,
a = mapInstance.GetCurrentMode().PixelToLatLong(new VEPixel(b, c), p_this.zoomLevel);
return a == null ? p_this.latlong : a
}
function Resolve(b, d, c, a) {
if (viewType == Msn.VE.MapViewType.LatLongAccurate) ResolveAsync(b, d, c, a);
else ResolveSync(b, d, c, a)
}
function ResolveAsync(b, e, d, a) {
function c(c) {
if (c != null && typeof c != "undefined" && c.length == 1) p_this.center = c[0];
if (p_this.cameraLatlong == null) if (!p_this._UpdateCamera(b)) {
p_this.tilt = -90;
p_this.cameraLatlong = p_this.latlong
}
viewType = Msn.VE.MapViewType.Pixel;
if (a != null && typeof a == "function") a()
}
b.LatLongToPixelAsync([p_this.latlong], p_this.zoomLevel, c)
}
function ResolveSync(a, e, c, b) {
switch (viewType) {
case Msn.VE.MapViewType.Pixel:
p_this.latlong = a.PixelToLatLong(p_this.center, p_this.zoomLevel);
break;
case Msn.VE.MapViewType.LatLong:
p_this.center = a.LatLongToPixel(p_this.latlong, p_this.zoomLevel);
if (p_this.center != null) {
p_this.center.x -= mapInstance.GetCenterOffset().x;
p_this.center.y -= mapInstance.GetCenterOffset().y
}
break;
case Msn.VE.MapViewType.PixelRect:
ResolveRectangle(a, e, c);
break;
case Msn.VE.MapViewType.LatLongRect:
if (Msn.VE.MapStyle.IsViewOblique(p_this.mapStyle)) {
p_this.zoomLevel = 1;
var d = a.GetScene();
if (!d || !d.ContainsLatLong(p_this.latlongRect.northwest) || !d.ContainsLatLong(p_this.latlongRect.southeast)) {
p_this.latlong = p_this.latlongRect.Center();
p_this.center = a.LatLongToPixel(p_this.latlong, p_this.zoomLevel)
} else {
p_this.pixelRect.topLeft = a.LatLongToPixel(p_this.latlongRect.northwest, p_this.zoomLevel);
p_this.pixelRect.bottomRight = a.LatLongToPixel(p_this.latlongRect.southeast, p_this.zoomLevel);
ResolveRectangle(a, e, c)
}
} else {
p_this.zoomLevel = 12;
p_this.altitude = -1000;
p_this.pixelRect.topLeft = a.LatLongToPixel(p_this.latlongRect.northwest, p_this.zoomLevel);
p_this.pixelRect.bottomRight = a.LatLongToPixel(p_this.latlongRect.southeast, p_this.zoomLevel);
ResolveRectangle(a, e, c)
}
}
if (p_this.cameraLatlong == null) if (!p_this._UpdateCamera(a)) {
p_this.tilt = -90;
p_this.cameraLatlong = p_this.latlong
}
viewType = Msn.VE.MapViewType.Pixel;
if (b != null && typeof b == "function") b()
}
function ResolveRectangle(i, k, j) {
var c = 19,
a = Math.pow(2, c - p_this.zoomLevel),
g = MathMax(1, MathAbs(p_this.pixelRect.topLeft.x - p_this.pixelRect.bottomRight.x) * a),
f = MathMax(1, MathAbs(p_this.pixelRect.topLeft.y - p_this.pixelRect.bottomRight.y) * a),
d = Math.log(2),
e = c - Math.ceil(Math.log(g / k) / d),
h = c - Math.ceil(Math.log(f / j) / d),
b = MathMin(e, h);
if (b <= 0) b = 1;
a = Math.pow(2, b - p_this.zoomLevel);
p_this.center.x = .5 * (p_this.pixelRect.topLeft.x + p_this.pixelRect.bottomRight.x) * a - mapInstance.GetCenterOffset().x;
p_this.center.y = .5 * (p_this.pixelRect.topLeft.y + p_this.pixelRect.bottomRight.y) * a - mapInstance.GetCenterOffset().y;
p_this.zoomLevel = b;
p_this.altitude = -1000;
p_this.latlong = i.PixelToLatLong(p_this.center, p_this.zoomLevel)
}
function _UpdateCamera(viewMode) {
if (p_this.latlong == null) if (p_this.center != null && p_this.zoomLevel != null && typeof viewMode._InternalOrthoMode == "function") {
var orthoMode = viewMode._InternalOrthoMode();
p_this.latlong = orthoMode.PixelToLatLong(p_this.center, p_this.zoomLevel);
if (p_this.latlong != null) {
p_this.tilt = -90;
p_this.direction = 0
}
}
if (p_this.latlong == null) return false;
p_this._needsPivotOperation = false;
if (mapInstance.IsModeEnabled(Msn.VE.MapActionMode.Mode3D)) {
var control = mapInstance.Get3DControl();
if (control != null) {
var cam = control.CameraPositionGivenTarget(p_this.latlong.latitude, p_this.latlong.longitude, p_this.altitude, p_this.zoomLevel, p_this.tilt, p_this.direction);
if (cam != null) {
var lat, lon, alt;
eval(cam);
p_this.cameraLatlong = new Msn.VE.LatLong;
p_this.cameraLatlong.latitude = lat;
p_this.cameraLatlong.longitude = lon;
p_this.altitude = alt
} else return false
}
}
return true
}
this.MakeCopy = MakeCopy;
this.Copy = Copy;
this.Equals = Equals;
this.ToString = ToString;
this.SetCenter = SetCenter;
this.SetCenterLatLong = SetCenterLatLong;
this.SetCenterLatLongAccurate = SetCenterLatLongAccurate;
this.SetPixelRectangle = SetPixelRectangle;
this.SetLatLongRectangle = SetLatLongRectangle;
this.SetZoomLevel = SetZoomLevel;
this.SetMapStyle = SetMapStyle;
this.SetTilt = SetTilt;
this.SetDirection = SetDirection;
this.SetAltitude = SetAltitude;
this.GetTilt = GetTilt;
this.GetDirection = GetDirection;
this.GetAltitude = GetAltitude;
this.ScaleCoord = ScaleCoord;
this.GetX = GetX;
this.GetY = GetY;
this.GetCenter = GetCenter;
this.Resolve = Resolve;
this.SetZoomLevel = SetZoomLevel;
this.GetZoomLevel = GetZoomLevel;
this.GetLatLongRectangle = GetLatLongRectangle;
this.GetPixelRectangle = GetPixelRectangle;
this.GetCenterLatLong = GetCenterLatLong;
this._UpdateCamera = _UpdateCamera
};
Msn.VE.ViewChangeType = function () {};
Msn.VE.ViewChangeType.Zoom = 1;
Msn.VE.ViewChangeType.Pan = 2;
Msn.VE.ViewChangeType.Hybrid = 3;
Msn.VE.ViewChangeType.IsValid = function (a) {
return typeof a == "number" && a > 0 && a < 4
};
Msn.VE.ObliqueScene = function (e, J, C, F, H, O, b, d, v, u, I) {
var c = null,
a = "",
g = null,
h = null,
f = {};
f[Msn.VE.MapStyle.Oblique] = "886";
f[Msn.VE.MapStyle.ObliqueHybrid] = "886";
var i = {};
i[Msn.VE.MapStyle.Oblique] = "%0ecn.t%3.tiles.virtualearth.net/tiles/o%4-%5-%6-%7.jpeg?g=%8";
i[Msn.VE.MapStyle.ObliqueHybrid] = "%0ecn.t%3.tiles.virtualearth.net/tiles/cmd/ObliqueHybrid?a=%4-%5-%6-%7&g=%8";
var w = Msn.VE.MapStyle.Oblique,
j = null,
N = null,
o = null;
if (Msn.VE.API == null) j = "__obliqueCalcServiceUrl__";
else o = Msn.VE.API.Constants.imageryurl + "/ConvertLatLongToPixelInBirdsEye";
var r = new _xz1,
q = 256,
M = this,
K = new Msn.VE.Bounds(1, 2, 0, 0, b / 2, d / 2);
function B(d, e) {
var c = Math.pow(2, e - 2),
f = [
[d.x / c],
[d.y / c],
[1]
],
a = MatrixMultiply(v, f),
b = new Msn.VE.LatLong;
b.longitude = a[0][0] / a[2][0];
b.latitude = a[1][0] / a[2][0];
return b
}
function y(d, g, f) {
var b = [];
for (var a = 0; a < d.length; ++a) {
var c = this.PixelToLatLong(d[a], g);
if (Msn.VE.API != null) {
var e = new VELatLong;
e._reserved = r.Encode(c.latitude, c.longitude);
b[a] = e
} else b[a] = c
}
if (f) f(b)
}
function l(d, e) {
var c = Math.pow(2, e - 2),
f = [
[d.longitude],
[d.latitude],
[1]
],
a = MatrixMultiply(u, f),
b = new VEPixel;
b.x = a[0][0] / a[2][0] * c;
b.y = a[1][0] / a[2][0] * c;
return b
}
function x(f, k, l) {
var d = [];
for (var b = 0; b < f.length; ++b) d[b] = r.Encode(f[b].latitude, f[b].longitude);
var a = [];
if (Msn.VE.API == null) {
a.push(new VEParameter("a", "L2P"));
a.push(new VEParameter("b", d.join("")));
a.push(new VEParameter("s", e));
a.push(new VEParameter("f", "__LatLongToPixelAsyncResponse"))
} else {
if (c) a.push(new VEParameter(Msn.VE.API.Constants.clienttoken, c));
if (g) a.push(new VEParameter("mapguid", g));
a.push(new VEParameter("locations", '"' + d.join("") + '"'));
a.push(new VEParameter("sceneId", e));
a.push(new VEParameter("encodingLength", 6))
}
if (Msn.VE.API != null) {
var i = function (d) {
if (h) h.__HandleAuthentication(d);
var c = null;
if (d != null && d.Pixels != null) {
var e = Math.pow(2, k - 2);
c = [];
var b = d.Pixels;
for (var a = 0; a < b.length; ++a) if (b[a] != null && b[a].X != null && typeof b[a].X != "undefined" && b[a].Y != null && typeof b[a].Y != "undefined") c[a] = new VEPixel(b[a].X * e, b[a].Y * e);
else c[a] = null
}
l(c)
};
VEAPIRequestInvoke(o, a, i)
} else {
var i = function (a) {
var c = null;
if (a != null && (a.err == null || typeof a.err == "undefined")) {
var d = Math.pow(2, k - 2);
c = [];
for (var b = 0; b < a.length; ++b) if (a[b] != null && a[b].x != null && typeof a[b].x != "undefined" && a[b].y != null && typeof a[b].y != "undefined") c[b] = new VEPixel(a[b].x * d, a[b].y * d);
else c[b] = null
}
l(c)
},
m = new VENetwork;
m.ServiceUrl = j;
m.BeginInvoke("__LatLongToPixelAsyncResponse", a, i, M)
}
}
function E(a, c, e) {
if (a < 0 || c < 0) return false;
if (e == 1) return a < b / 2 && c < d / 2;
return a < b && c < d
}
function L() {
return e
}
function k(h, j, e, d) {
if (!Msn.VE.MapStyle.IsViewOblique(d)) d = w;
var g = j * (e == 1 ? b / 2 : b) + h,
c = i[d];
if (Msn.VE.API) {
if (d == Msn.VE.MapStyle.ObliqueHybrid) c = a ? Msn.VE.API.Constants.obliquehybridorigintileserver : Msn.VE.API.Constants.obliquehybridtileserver;
else c = a ? Msn.VE.API.Constants.obliqueorigintileserver : Msn.VE.API.Constants.obliquetileserver;
c = c + a
}
return c.replace(/%3/g, g % 8).replace(/%4/g, J).replace(/%5/g, C).replace(/%6/g, H + e - 2).replace(/%7/g, g).replace(/%8/g, f[d])
}
function s() {
return k(b / 4, d / 4, 1)
}
this.GetMiddleTileFilename = s;
function t() {
var b = Msn.VE.API ? (a ? Msn.VE.API.Constants.obliquethumbnailorigintileserver : Msn.VE.API.Constants.obliquethumbnailtileserver) + a : "%0ecn.t%1.tiles.virtualearth.net/tiles/ot%2.jpeg?g=%3";
return b.replace(/%1/g, e % 4).replace(/%2/g, e).replace(/%3/g, f)
}
function A() {
return F
}
function G() {
return K
}
function p() {
return b * q
}
function n() {
return d * q
}
function z(a) {
if (!a) return false;
var b = l(a, 2);
return m(b, 2)
}
function m(b, e) {
var a = Math.pow(2, 2 - e),
c = b.x * a,
d = b.y * a;
return c >= 0 && d >= 0 && c < p() && d < n()
}
this.SetClientToken = function (d, b) {
c = d;
if (c && b) a = "&" + Msn.VE.API.Constants.clienttoken + "=" + c;
else a = ""
};
this.SetGUID = function (a) {
g = a;
if (typeof VEMap != "undefined") h = VEMap._GetMapFromGUID(g)
};
function D() {
return I
}
this.PixelToLatLong = B;
this.PixelToLatLongAsync = y;
this.LatLongToPixel = l;
this.LatLongToPixelAsync = x;
this.IsValidTile = E;
this.GetID = L;
this.GetTileFilename = k;
this.GetThumbnailFilename = t;
this.GetOrientation = A;
this.GetBounds = G;
this.GetWidth = p;
this.GetHeight = n;
this.ContainsLatLong = z;
this.ContainsPixel = m;
this.GetMapStyle = D
};
Msn.VE.Orientation = new function () {
this.North = "North";
this.East = "East";
this.West = "West";
this.South = "South"
};
VEPixel = function (a, b) {
this.x = parseFloat(a);
this.y = parseFloat(b)
};
VEPixel.prototype.ToString = function () {
return "(" + this.x + ", " + this.y + ")"
};
VEPixel.prototype.Copy = function (a) {
if (!a) return;
this.x = a.x;
this.y = a.y
};
function VEPixelToQuadKey(a, f) {
var d = "";
if (a != null) {
var g = MathFloor(a.x / 256),
h = MathFloor(a.y / 256);
for (var c = f; c > 0; c--) {
var b = 0,
e = 1 << c - 1;
if ((g & e) != 0) b++;
if ((h & e) != 0) b += 2;
d += b + ""
}
}
return d
}
Msn.VE.PixelRectangle = function (b, a) {
this.topLeft = b;
this.bottomRight = a;
this.ToString = function () {
return "(" + (this.topLeft ? this.topLeft.ToString() : "null") + ", " + (this.bottomRight ? this.bottomRight.ToString() : "null") + ")"
};
this.Copy = function (a) {
if (!a) return;
if (!this.topLeft) this.topLeft = new VEPixel;
if (!this.bottomRight) this.bottomRight = new VEPixel;
this.topLeft.Copy(a.topLeft);
this.bottomRight.Copy(a.bottomRight)
};
this.Contains = function (a) {
if (a instanceof VEPixel) return a.x > this.topLeft.x && a.y > this.topLeft.y && a.x < this.bottomRight.x && a.y < this.bottomRight.y
}
};
Msn.VE.LineRegion = function (b, a, c) {
this.boundingRectangle = b;
this.indices = a;
this.childRegions = c;
function d() {
return "Bounding Rectangle: " + this.boundingRectangle[0].ToString() + " to " + this.boundingRectangle[1].ToString() + " | Indices: [" + a + "]"
}
this.ToString = d
};
var L_integerencodingoutofrange_text = "VEIntegerEncoding: The number encoded is out of supported range",
L_floatintegermapencodingoutofrange_text = "VEFloatIntegerMap: The number encoded is out of supported range",
L_integerencodinginvalidstringlength_text = "VEIntegerEncoding: Invalid string length",
L_integerencodingunknowndigit_text = "VEIntegerEncoding: The encoded string has an unknown digit";
function VEIntegerEncoding(g, j) {
var e = g,
d = g.length,
a = j,
h = 1;
for (var i = 0; i < a; ++i) h *= d;
var f = h - 1,
c = [];
for (var b = 0; b < e.length; ++b) c[e.substr(b, 1)] = b;
this.MaxValue = function () {
return f
};
this.ValueLength = function () {
return a
};
this.Encode = function (c) {
if (c <= f) {
var h = "",
g = [];
for (var b = 0; b < a; ++b) g[b] = 0;
var i = a - 1;
while (c > 0) {
g[i] = Math.floor(c % d);
c = Math.floor(c / d);
--i
}
for (var b = 0; b < g.length; ++b) h += e.substr(g[b], 1);
return h
} else throw L_integerencodingoutofrange_text
};
this.Decode = function (c) {
if (c.length == a) {
var b = 0;
for (var e = 0; e < c.length; ++e) {
b *= d;
b += this.DigitValue(c.substr(e, 1))
}
return b
} else throw L_integerencodinginvalidstringlength_text
};
this.DigitValue = function (a) {
if (c[a] != null && c[a] != "undefined") return c[a];
else throw L_integerencodingunknowndigit_text
}
}
function VEFloatIntegerMap(e, d, f) {
var a = e,
c = d,
b = f;
this.MinFloat = function () {
return a
};
this.MaxFloat = function () {
return c
};
this.MaxInt = function () {
return b
};
this.FloatToInt = function (d) {
if (d >= a && d <= c) {
var e = (d - a) / (c - a),
f = e * b + .5;
return Math.min(Math.floor(f), b)
} else throw L_floatintegermapencodingoutofrange_text
};
this.IntToFloat = function (d) {
if (d <= b) {
var f = d / b,
e = a + f * (c - a);
return e
} else throw L_floatintegermapencodingoutofrange_text
}
}
var L_velatlongencodinginvalidstringlength_text = "_xz1: Invalid string length";
function _xz1(b) {
var i = -90,
h = 90,
g = -180,
f = 180,
j = "0123456789bcdfghjkmnpqrstvwxyz",
e = 6;
if (b != null && typeof b != "undefined") e = b;
var a = new VEIntegerEncoding(j, e),
d = new VEFloatIntegerMap(i, h, a.MaxValue()),
c = new VEFloatIntegerMap(g, f, a.MaxValue());
this.Encode = function (e, b) {
var f = a.Encode(d.FloatToInt(e)) + a.Encode(c.FloatToInt(b));
return f
};
this.Decode = function (f) {
if (f.length == 2 * a.ValueLength()) {
var e = a.ValueLength(),
j = f.substr(0, e),
h = f.substr(e, e),
i = a.Decode(j),
g = a.Decode(h),
b = [];
b[0] = d.IntToFloat(i);
b[1] = c.IntToFloat(g);
return b
} else throw L_velatlongencodinginvalidstringlength_text
}
}
function _xz1ForMobile() {
_xz1.call(this, 5)
}
var Shims = ["help", "msve_ScratchPad", "VE_MessageControl", "contextMenu", "MSVE_dashboardId"],
vedomain = "http://ecn.dev.virtualearth.net/mapcontrol/v6.3",
_entityIdShapePostfix = "_Shape",
_hackUniqueLayerId = "UniqueLayer_Hack";
function GetManifestUrl(a) {
return a.indexOf("http") == 0 ? a : vedomain + a
}
function Get3dMarket() {
if (typeof Msn.VE.API == "undefined" || Msn.VE.API == null) return window.locale;
else return Msn.VE.API.Globals.locale
}
function Get3dInstallMarket() {
if (typeof Msn.VE.API == "undefined" || Msn.VE.API == null) return window.locale;
else return Msn.VE.API.Globals.resourcelocale
}
function Get3dInstallUrl(b, a) {
if (typeof a == "undefined" || a == null) a = Get3dInstallMarket();
if (typeof b == "undefined" || b == null) {
b = "Default.aspx?action=install";
if (a) b += "&mkt={0}"
}
var c = "http://www.bing.com/maps/Help/VE3DInstall/" + b;
c = c.replace("{0}", a);
return c
}
function Get3dHelpUrl(c, a) {
var b = "http://www.bing.com/maps/Help/{0}/" + c;
if (typeof a == "undefined" || a == null) a = Get3dMarket();
b = b.replace("{0}", a);
return b
}
function initShimElements() {
for (var a = 0; a < Shims.length; a++) UpdateIFrameShim(Shims[a])
}
function hookResizeEvent(a) {
if (a.onresize == null) a.onresize = function () {
var b = event.srcElement,
a = b.shimElement;
if (a) SetShimPosition(a, b)
}
}
function destroyShimElements() {
for (var a = 0; a < Shims.length; a++) destroyIFrameShim(Shims[a]);
var b = $ID("msve_ScratchPad");
if (b) b.onresize = null
}
function ConvertClipToSize(d, e) {
var a = e.style.clip.split(",");
if (a.length == 4) {
var c = parseInt(a[1]),
b = parseInt(a[2]);
if (!isNaN(b)) d.height = b;
if (!isNaN(c)) d.width = c
}
}
var UseClipToSize = window.navigator.userAgent.indexOf("Firefox") >= 0;
function SetShimPosition(a, b) {
var c = g(b).getRelativePosition(a.parentNode);
a.style.top = c.y + "px";
a.style.left = c.x + "px";
a.width = b.offsetWidth;
a.height = b.offsetHeight;
if (UseClipToSize) ConvertClipToSize(a, b);
else a.style.clip = b.style.clip
}
function UpdateIFrameShim(c, e, d) {
var a = typeof c == "object" ? c : $ID(c);
if (!a) return;
if (!a.shimElement) addIFrameShim(a, e, d);
var b = a.shimElement;
SetShimPosition(b, a);
if (Msn.VE.Css.Functions.getComputedStyle(a, "display") == "none" || Msn.VE.Css.Functions.getComputedStyle(a, "visibility") == "hidden") b.style.display = "none";
else b.style.display = "block"
}
function RepositionShims() {
if (!view3DMode) return;
for (var b = 0; b < Shims.length; b++) {
var a = $ID(Shims[b]);
if (a && a.shimElement && a.shimElement.style.display != "none") SetShimPosition(a.shimElement, a)
}
}
function addIFrameShim(b, f, e) {
var a = document.createElement("iframe");
a.frameBorder = "0";
a.scrolling = "no";
a.style.position = "absolute";
if (e >= 0) a.style.zIndex = e;
else a.style.zIndex = "1";
a.style.backgroundColor = "white";
b.shimElement = a;
HideShim(b);
var c = f;
if (c == null) c = b;
var d = c.parentNode;
if (d == null) d = document.body;
d.insertBefore(a, c);
if (b.id == "msve_ScratchPad" || b.id && b.id.indexOf("_vefindcontrolinput") > 0) hookResizeEvent(b);
return a
}
function destroyIFrameShim(b) {
var a = $ID(b);
DestroyShim(a)
}
function ShowShim(a, b) {
UpdateIFrameShim(a, b);
if (a != null && a.shimElement) a.shimElement.style.display = "block"
}
function HideShim(a) {
if (a != null && a.shimElement) a.shimElement.style.display = "none"
}
function DestroyShim(a) {
if (a != null && a.shimElement) {
a.shimElement.parentNode.removeChild(a.shimElement);
a.shimElement = null
}
}
function RollShim(b) {
var a = b.Recipient;
if (a.shimElement) if (UseClipToSize) ConvertClipToSize(a.shimElement, a);
else a.shimElement.style.clip = a.style.clip
}
function OnView3DKeyDown(d, c) {
var b = parseInt(d);
CloseContextMenu(b);
ero.hide();
var a = GetMapControlInstance(c);
if (a == null) return;
switch (b) {
case 65:
a.SetMapStyle("a");
break;
case 72:
a.SetMapStyle("h");
break;
case 82:
case 86:
a.SetMapStyle("r");
break;
case 50:
case 98:
window.setTimeout(function () {
a.EnableMode(Msn.VE.MapActionMode.Mode2D)
}, 10);
break;
case 66:
case 79:
a.GetDashboard().Oblique3DToggle()
}
}
function OnNavigationHelpFired() {
VE_Help.OpenLiveHelp("wl_local", "topic", "WL_LOCAL_PROC_3D_NavigateMap.htm")
}
function OnHardwareAccelHelpFired() {
VE_Help.OpenLiveHelp("wl_local", "topic", "WL_LOCAL_TROU_3D_VideoAcceleration.htm")
}
var __shapeIdBeingDragged = null;
function Deserialize3DMessage(message) {
var messageObject;
if (typeof Sys != "undefined" && Sys != null && Sys.Serialization != null) messageObject = Sys.Serialization.JavaScriptSerializer.deserialize(message);
else eval("messageObject = " + message + ";");
return messageObject
}
function OnView3DMouseDown(b) {
var a = Deserialize3DMessage(b);
if (a.button == "Left") {
__shapeIdBeingDragged = a.shapeId;
window.setTimeout(BeginDragPin3D, 300)
}
CloseContextMenu();
ero.hide();
if (typeof Msn.VE.API == "undefined" || Msn.VE.API == null) VE_MapDispatch.ClickedEntity = null
}
function BeginDragPin3D() {
if (__shapeIdBeingDragged != null) {
var d = true,
b = VE_MapManager.GetCollectionByAnId(__shapeIdBeingDragged);
if (b != null) {
var c = VE_MapManager.GetSelectedCollection();
if (c != null && c.GetId() != b.GetId()) return
} else return;
var a = VE_MapManager.GetAnnotationInCollectionById(b, __shapeIdBeingDragged);
if (typeof a != "undefined" && a != null && a.GetType() == MC_GEO_TYPE_POINT) {
VE_Annotations.EnterMovePushpinMode(__shapeIdBeingDragged, true);
View3DMovePin(__shapeIdBeingDragged)
}
}
}
function OnView3DDropGeometry(b) {
var a = Deserialize3DMessage(b);
if (!a.pushpinId) return;
var c = VE_MapManager.GetAnnotationById(a.pushpinId);
if (c) VE_Annotations.MovePushpin(null, new Msn.VE.LatLong(a.lat, a.lon))
}
function OnView3DLatLonAltClicked(b) {
var a = Deserialize3DMessage(b);
VE_MapUpdateView_AutoSaveEntity();
if (VE_EditControl.GetMode() == MC_DRAW_MODEL) VE_MapDispatch.OnCreateModel(a.lat, a.lon, a.alt);
else VE_EditControl.AddPoint(null, a.lat, a.lon, a.alt)
}
function OnBeginFlyTo(c, b) {
ero.hide();
var a = GetMapControlInstance(b);
if (a != null) a.OnBeginCameraUpdate()
}
function OnView3DUpdateViewpoint(k, l) {
var b = Deserialize3DMessage(k),
c = GetMapControlInstance(l);
if (c == null) return;
c.OnEndCameraUpdate();
var f = 1e-6,
e = .1,
j = .01,
a = c.GetCurrentMapView(),
h = Math.abs(b.heading - a.GetDirection()) < e && Math.abs(b.pitch - a.GetTilt()) < e,
i = a.cameraLatlong != null && Math.abs(b.lat - a.cameraLatlong.latitude) < f && Math.abs(b.lon - a.cameraLatlong.longitude) < f,
m = Math.abs(b.alt - a.GetAltitude()) < j && a.GetZoomLevel() == b.zoom,
g = i && h && (a.GetAltitude() <= -1000 && a.GetZoomLevel() == b.zoom);
if (!g) {
var d = c.GetOn3DAnimationInterruptedCallback();
if (d) d()
}
a = new Msn.VE.MapView(c);
a.latlong = new Msn.VE.LatLong(b.targetLat, b.targetLon);
a.cameraLatlong = new Msn.VE.LatLong(b.lat, b.lon);
a.SetZoomLevel(b.zoom);
a.SetMapStyle(c.GetMapStyle());
a.SetAltitude(b.alt);
a.SetDirection(b.heading);
a.SetTilt(b.pitch);
a._supressFlyToCall = true;
c.SetView(a);
c.Fire("onendpan");
c.Fire("onchangeview")
}
function ProcessQueuedRequest(c, b) {
var a = GetVEMapInstance(b);
if (a != null) a._ProcessQueuedRequest()
}
function OnView3DHoverEnd() {
ero.hide()
}
function CloseContextMenu(a) {
if (a != 16) {
VE_MapUpdateView_AutoSaveEntity();
VE_MapUpdateView_AutoSaveEntity()
}
if (VE_ContextMenu.MenuOpen) {
VE_ContextMenu.RemoveContextPin();
VE_ContextMenu.CloseMenu()
}
}
function DoShowNotification(b) {
var a = Deserialize3DMessage(b);
VE_MessageControl._AddMessage(a.message, a.milliseconds)
}
function OnSetupVE3DVIA() {
VE_Help.OpenSized(L_InstallVE3DVIATitle_Text, "Help/" + Get3dInstallMarket() + "/VE3DVIAInstall.htm", 700, 520)
}
function Refresh3DPassportCookie(a) {
if (document.all) return;
if (!a) a = map.Get3DControl();
a.RefreshCookiesFromMozilla()
}
function OnRefreshModel(a) {
if (typeof Msn.VE.API == "undefined" || Msn.VE.API == null) if (typeof a != "undefined" && a != null) {
var b = a.split(",");
VE_MapViewPreUpdate.RefreshCollectionList(b)
}
}
function OnSelectPhoto(a) {
var b = Deserialize3DMessage(a);
if (typeof state != "undefined" && state != null) state.SetScene(b.SceneId)
}
function OnPhotoCameraZoom(a) {
OnPhotoCameraPanOrZoom(a, "Zoom while In-Image")
}
function OnPhotoCameraPan(a) {
OnPhotoCameraPanOrZoom(a, "Pan BE Scene")
}
function OnPhotoCameraPanOrZoom(b) {
ero.hide();
var a = Deserialize3DMessage(b);
if (typeof state != "undefined" && state != null) state.SetXYScale(a.X, a.Y, a.Scale)
}
function OnActivate(a) {
var b = Deserialize3DMessage(a)
}
function IsModelVisibleInSpaceland(c) {
var a = false,
b = map.Get3DControl();
if (b) if (b.InvokePlugInMethod(VE_3DPlugin.GeoCommunityGuid, "QueryModel", 'msnid="' + c + '"') == "1") a = true;
return a
}
VE_ModelActionType = {
CreateModel: "CreateModel",
AddModel: "AssociateModel",
AddModelByReference: "LoadModelFile",
DeleteModel: "DissociateModel",
MoveModel: "MoveModel",
RotateModel: "RotateModel",
ElevateModel: "ElevateModel",
EditModel: "EditModel",
LoadModelFile: "LoadModelFile",
DeleteModelFile: "DeleteModelFile"
};
VE_ModelWhereType = {
Scratchpad: "scratchpad",
Taskbar: "taskbar",
ContextMenu: "contextmenu",
CV: "cv"
};
function UniqueModelViewSuccess() {}
function UniqueModelViewFailure() {}
function UniqueModelFullyDownloaded() {}
function OnView3DPushpinHover(b, c) {
if (typeof VE_Annotations != "undefined") if (VE_Annotations.PanelOpen) return;
var a = Deserialize3DMessage(b);
Process3DPushpinHover(a.layerId, a.pushpinId, a.rX1, a.rY1, a.rX2, a.rY2, c)
}
function Process3DPushpinHover(layerId, pushpinId, rX1, rY1, rX2, rY2, mapGuid) {
var result = null,
isInvalid = rX1 == null || rY1 == null || rX2 == null || rY2 == null ? true : false,
isEqual = rX1 === rX2 && rY1 === rY2 ? true : false,
vmap, mapcontrol, mapid;
try {
var isAPI = typeof Msn.VE.API != "undefined" && Msn.VE.API != null;
if (!isAPI) {
vmap = null;
mapcontrol = map;
mapid = "msve_mapContainer"
} else {
vmap = GetVEMapInstance(mapGuid);
if (vmap == null) return;
mapcontrol = vmap.vemapcontrol;
mapid = vmap.ID
}
} catch (a) {
return
}
var mapdiv = $ID(mapid);
if (mapdiv == null) return;
var mapPos = g(mapdiv).getScreenPosition(),
rect = null;
if (!isInvalid) rect = new Msn.VE.Geometry.Rectangle(new Msn.VE.Geometry.Point(rX1 + mapPos.x, rY1 + mapPos.y), new Msn.VE.Geometry.Point(rX2 + mapPos.x, rY2 + mapPos.y));
if (vmap != null) {
if (isInvalid || isEqual) return;
if (pushpinId.indexOf("msftve") == 0) {
VEShowVEShapeERO(pushpinId, mapGuid, rect);
return
} else {
var pushpins = vmap.pushpins;
if (pushpins != null) {
var len = pushpins.length;
for (var i = 0; i < len; i++) {
var p = pushpins[i];
if (p != null && p.ID == pushpinId) {
ero.hide();
VEPushpin.Show3D(rect, p.Title, p.Details, p.TitleStyle, p.DetailsStyle);
return
}
}
}
}
return
} else {
result = VE_MapManager.GetAnnotationById(pushpinId);
if (result) {
var entity = result;
try {
if (entity != "undefined" && entity != "" && entity) {
var content = null,
col = null;
col = VE_MapManager.GetCollectionByAnId(pushpinId);
var isCV = col.GetType() == MC_COL_TYPE_COLLECTION ? false : true,
primitive = entity.GetPrimitive(0);
if (primitive.type != VEShapeType.Pushpin && pushpinId.indexOf(_entityIdShapePostfix) > 0) {
VE_MapManager.SetHighlightEntity(entity, isCV);
return
}
if (!isCV) VE_MapViewPreUpdate.ShowEro(pushpinId, VE_Directions.EntryPoint.Scratchpad, rect);
else VE_MapViewPreUpdate.Viewer.ShowEroToItem(null, pushpinId, rect, null)
}
} catch (a) {}
return
}
}
var ddERO = $find(pushpinId + "_ero");
if (ddERO) {
CloseContextMenu();
var content = ddERO.get_Content();
ero.clearActions();
var ddActionNames = eval(ddERO.get_ActionNames()),
ddActionValues = eval(ddERO.get_ActionValues());
g(ddActionNames).forEach(function (a, b) {
ero.addAction('' + a + "")
});
ero.setContent(content);
ero.dockToRect(rect, null, -1);
return
}
result = pushpinId.match(/pin_traffic_market_(.*)/);
if (result != null && result.length >= 2) {
var entity = VE_TrafficManager.GetEntity(pushpinId);
if (entity != null) {
var content = VE_TrafficManager.CreateZoomPopupContent(entity);
if (content != null && content != "" && content != "undefined") {
CloseContextMenu();
ero.setContent(content);
ero.dockToRect(rect, null, -1);
return
}
}
}
result = pushpinId.match(/pin_traffic_incident_(.*)/);
if (result != null && result.length >= 2) {
var entity = VE_TrafficManager.GetEntity(pushpinId);
if (entity != null) {
var content = VE_TrafficManager.CreatePopupContent(entity, true);
if (content != null && content != "" && content != "undefined") {
CloseContextMenu();
ero.setContent(content);
ero.dockToRect(rect, null, -1);
return
}
}
}
if (pushpinId == "autolocate") {
var pushpins = mapcontrol.GetPushpins();
if (pushpins) for (var i = 0; i < pushpins.length; ++i) if (pushpins[i].pin.id == "autolocate") {
var pinDOM = pushpins[i].pin;
pinDOM.onmouseover(rect);
return
}
}
result = pushpinId.match(/pin_(.*)/);
if (result == null) result = pushpinId == "place_pin" ? [null, "place_ero"] : null;
if (result != null && result.length >= 2) {
var entityID = result[1],
r = VE_SearchManager.GetEntity(entityID);
if (r === null) {
entityID = result[0];
r = VE_SearchManager.GetEntity(entityID);
if (r === null) {
var correspondingItem = Gimme.id(entityID + "_number");
entityID = correspondingItem && correspondingItem.parentNode.id.replace(/_pin$/, "");
r = VE_SearchManager.GetEntity(entityID)
}
}
if (r !== null) {
CloseContextMenu();
VE_SearchManager.SetLatLong(r.latitude, r.longitude);
if (r.type != VE_SearchType.Collection) {
var content = VE_SearchManager.CreatePopupContent(r, true);
ero.setContent(content);
ero.dockToRect(rect, null, -1)
} else ShowCollectionPopup(new VE_CollectionSearchEroData(r), rect, null)
}
return
}
}
function OnHardwareCapabilitiesUpdate() {
if (typeof view3DMode != "undefined" && view3DMode) {
map.Setup3DManifests();
var b = "3D performance option ? ",
a = map.Get3DControl().HardwareClassificationLevel;
if (typeof a != "undefined" && a != null) {
switch (a) {
case 3:
b += "Quality";
break;
case 2:
b += "Balanced";
break;
case 1:
b += "Performance"
}
UpdateStreetLevelGeometryState(map.Get3DControl());
UpdateHiResModelsState(map.Get3DControl());
UpdateWeatherPluginState(map.Get3DControl())
}
}
}
function View3DMovePin(a) {
map.Get3DControl().PickupGeometry("UniqueLayer_Hack", a)
}
Msn.VE.FFSentinel = function (a) {
this.CurrentVersion = a
};
function BrowserSupports3D() {
var a = window.navigator.userAgent;
return a.indexOf("Windows") != -1 && (a.indexOf("MSIE") != -1 || a.indexOf("Firefox") != -1)
}
function GetSentinel() {
if (BrowserSupports3D()) {
if (window.navigator.userAgent.indexOf("MSIE") != -1) {
var b;
try {
b = new ActiveXObject("Microsoft.SentinelVirtualEarth3DProxy.SentinelVE3DProxy")
} catch (f) {
try {
b = new ActiveXObject("Microsoft.SentinelVirtualEarth3D.SentinelVE3D")
} catch (g) {
b = null
}
}
return b
} else if (typeof navigator.plugins != undefined) for (var a = 0; a < navigator.plugins.length; a++) {
var c = navigator.plugins[a].name.indexOf("Virtual Earth 3D");
if (c >= 0) {
var e = navigator.plugins[a].name.indexOf("plugin"),
d = parseFloat(navigator.plugins[a].name.substring(c + 17, e - 1));
return new Msn.VE.FFSentinel(d)
}
}
} else if (typeof navigator.plugins != undefined) for (var a = 0; a < navigator.plugins.length; a++) {
var c = navigator.plugins[a].name.indexOf("Virtual Earth 3D");
if (c >= 0) {
var e = navigator.plugins[a].name.indexOf("plugin"),
d = parseFloat(navigator.plugins[a].name.substring(c + 17, e - 1));
return new Msn.VE.FFSentinel(d)
}
}
return null
}
function HandleModeNotInstalled(b) {
if (b == Msn.VE.MapActionMode.Mode3D) {
map.EnableMode(Msn.VE.MapActionMode.Mode2D);
if (BrowserSupports3D()) {
var a = GetSentinel();
if (a != null) View3DDamaged();
else View3DInstall()
} else if (typeof ShowMessage != "undefined") ShowMessage(L_BrowserNotSupported3D_Text)
}
}
function View3DInstall() {
try {
if (typeof Msn.VE.API == "undefined" || Msn.VE.API == null) state.Set3DViewInstallInProgress("true");
if (window.navigator.userAgent.indexOf("MSIE") != -1) VE_Help.OpenSized(L_View3DHelpWindowTitle_Text, Get3dInstallUrl(), 650, 520);
else VE_Help.OpenSized(L_View3DHelpWindowTitle_Text, Get3dInstallUrl(), 680, 540);
var a = VE_Help.helpPanel.onCloseClick;
VE_Help.helpPanel.onCloseClick = function () {
a();
VE_Help.helpPanel.onCloseClick = a
}
} catch (b) {}
}
function View3DUpgrade(c) {
try {
var b = Get3dInstallUrl("Default.aspx?v=" + c + "&mkt={0}");
if (typeof Msn.VE.API == "undefined" || Msn.VE.API == null) state.Set3DViewInstallInProgress("true");
if (typeof Msn.VE.API != "undefined" && Msn.VE.API != null) window.open(b, "_blank", "width=600,height=320,menubar=0,resizeable=0,status=0,titlebar=0,toolbar=0,scrollbars=0");
else {
VE_Help.OpenSized(L_View3DHelpWindowTitle_Text, b, 600, 320);
var a = VE_Help.helpPanel.onCloseClick;
VE_Help.helpPanel.onCloseClick = function () {
a();
VE_Help.helpPanel.onCloseClick = a
}
}
} catch (d) {}
}
function View3DDamaged() {
try {
VE_Help.Open("", Get3dHelpUrl("View3DUnavailable.htm"))
} catch (a) {}
}
function View3DSwitch() {
if (map) map.EnableMode(Msn.VE.MapActionMode.Mode3D)
}
function Start3DView() {
if (map) {
if (typeof ShowMessage != "undefined") ShowMessage(L_3DLoading_Text);
window.setTimeout(View3DSwitch, 200)
}
}
function Start3DViewWhenUpgradeComplete() {
if (map) {
var a = GetSentinel();
if (a.CurrentVersion >= 4.0) {
if (typeof ShowMessage != "undefined") ShowMessage(L_3DLoading_Text);
window.setTimeout(View3DSwitch, 200)
} else setTimeout(Start3DViewWhenUpgradeComplete, 1500);
a = null
}
}
function NotifyWhen3DUpgraded() {
if (map) {
var a = GetSentinel();
if (a.CurrentVersion >= 4.0) if (map.GetDashboard() && map.GetDashboard().DisplayThreeDUpdatedNotification) map.GetDashboard().DisplayThreeDUpdatedNotification();
else {
if (typeof ShowMessage != "undefined") ShowMessage(L_3DLoading_Text);
window.setTimeout(View3DSwitch, 200)
} else setTimeout(NotifyWhen3DUpgraded, 1500);
a = null
}
}
function PushpinURL(d, c) {
var a = vedomain + "/i/bin/" + window.buildVersion + "/";
if (typeof d == "undefined" || d == null || !d) return a + "pins/red_circ7px.gif";
var b = Msn.VE.PushPinTypes;
switch (d) {
case b.Annotation:
if (c == "shared") return a + "pins/poi_viewer.gif";
else return a + "pins/poi_usergenerated.gif";
case b.Overlay:
if (c == "shared") return a + "pins/poi_cruncher_viewer.gif";
else return a + "pins/poi_cruncher.gif";
case b.SearchResultPrecise:
if (c == "model" || c == "sharemodel") return a + "pins/modelpoi.gif";
else if (c == "shared") return a + "pins/poi_title_viewer.gif";
return a + "pins/poi_" + c + ".gif";
case b.SearchResultNonprecise:
if (c == "model" || c == "sharemodel") return a + "pins/modelpoi.gif";
else if (c == "shared") return a + "pins/poi_title_viewer.gif";
return a + "pins/poi_search_nonprecise.gif";
case b.Collection:
return a + "pins/poi_" + c + ".gif";
case b.AdSponsor:
return a + "pins/poi_search.gif";
case b.DirectionStep:
return a + "pins/poi_direction_step.png";
case b.Direction:
return a + "blue_pushpin.png";
case b.DirectionTemp:
return a + "pins/mapicon_" + c + ".gif";
case b.TrafficOthers:
return a + "Traffic/Traffic" + c + ".gif";
case b.YouAreHere:
return a + "pins/poi_youarehere.gif";
case b.Default:
return a + "pins/" + c;
case b.Context:
return a + "pins/red_circ7px.gif";
case b.AdRoofStandard:
case b.AdRoofWide:
case b.AdStandard:
case b.AdWide:
case b.AdCategory:
return c
}
return a + "pins/poi_usergenerated.gif"
}
function _VEExtractImgUrlFromHtml(d) {
var b = null,
a = document.createElement("div");
a.innerHTML = d;
var c = a.getElementsByTagName("img");
if (c.length >= 1) b = c[0].getAttribute("src");
a = null;
return b
}
var _VEHtmlToImgUrlHash = [];
function TranslatePushpinURL(d, f, g) {
var a = Msn.VE.PushPinTypes,
h, c = null;
switch (g) {
case a.DirectionTemp:
var e = /mapicon_(start|end).gif/g,
b = e.exec(f);
if (b != null && b.length >= 2) {
c = b[1];
break
} else return vedomain + _VEExtractImgUrlFromHtml(f);
case a.SearchResultPrecise:
case a.SearchResultNonprecise:
case a.Collection:
var e = /VE_Pushpin VE_Pushpin_(.*)/g,
b = e.exec(d);
if (b != null && b.length >= 2) c = b[1];
break;
case a.TrafficOthers:
if (typeof _VEHtmlToImgUrlHash[d] == "string") c = _VEHtmlToImgUrlHash[d];
else {
var e = new RegExp(/VE_Pushpin VE_Traffic_(.*)/g),
b = e.exec(d);
if (b != null && b.length >= 2) {
c = b[1];
_VEHtmlToImgUrlHash[d] = c
}
e = null
}
break;
case a.AdRoofStandard:
case a.AdRoofWide:
case a.AdStandard:
case a.AdWide:
case a.AdCategory:
c = _VEExtractImgUrlFromHtml(f)
}
var h = PushpinURL(g, c);
return h
}
var _VE_previousShapeId = null;
function RaiseMouseEvent3D(g, d, b) {
try {
var a = Deserialize3DMessage(g);
if (a.shapeId != null) {
var e = typeof Msn.VE.API != "undefined" && Msn.VE.API != null;
if (b == "onclick" || !e && b == "onmouseover" && a.shapeId.indexOf(_entityIdShapePostfix) > 0 && _VE_previousShapeId != a.shapeId) {
if (typeof VE_Annotations != "undefined") if (VE_Annotations.PanelOpen) return;
_VE_previousShapeId = a.shapeId;
Process3DPushpinHover(a.layerId, a.shapeId, a.rX1, a.rY1, a.rX2, a.rY2, d)
} else if (!e && b == "onmouseout" && a.shapeId.indexOf(_entityIdShapePostfix) > 0) {
VE_MapManager.HighlightEntity(false);
_VE_previousShapeId = null
}
}
var c = GetMapControlInstance(d);
if (c == null) return;
var f = c.CreateEvent(a.lat == null || a.lon == null ? null : new Msn.VE.LatLong(a.lat, a.lon), null, null, null, a.shapeId, a.button, a.alt);
c.Fire(b, f)
} catch (h) {}
}
function OnMouseDown3D(b, a) {
RaiseMouseEvent3D(b, a, "onmousedown")
}
function OnMouseUp3D(b, a) {
__shapeIdBeingDragged = null;
RaiseMouseEvent3D(b, a, "onmouseup")
}
function OnClick3D(b, a) {
RaiseMouseEvent3D(b, a, "onclick")
}
function OnMouseOver3D(b, a) {
RaiseMouseEvent3D(b, a, "onmouseover")
}
function OnMouseOut3D(b, a) {
ero.hide();
RaiseMouseEvent3D(b, a, "onmouseout")
}
function OnDoubleClick3D(b, a) {
RaiseMouseEvent3D(b, a, "ondoubleclick")
}
function OnChangeMapStyle3D() {
var b = GetMapControlInstance();
if (b) {
var a = b.Get3DControl();
UpdateStreetLevelGeometryState(a);
UpdateHiResModelsState(a);
UpdateWeatherPluginState(a)
}
}
function GetMapControlInstance(b) {
if (typeof Msn.VE.API == "undefined" || Msn.VE.API == null) return map;
var a = GetVEMapInstance(b);
if (a == null) return null;
return a.vemapcontrol
}
function GetVEMapInstance(a) {
if (typeof a == "undefined" || a == null) {
if (Msn.VE.API == null || Msn.VE.API == "undefined" || Msn.VE.API.Globals.vemapinstances == null || Msn.VE.API.Globals.vemapinstances == "undefined") return null;
var c = 0;
for (var b in Msn.VE.API.Globals.vemapinstances) if (Msn.VE.API.Globals.vemapinstances[b] instanceof VEMap && Msn.VE.API.Globals.vemapinstances[b].GetMapMode() == VEMapMode.Mode3D) {
c++;
a = b
}
if (c != 1) return null
}
return VEMap._GetMapFromGUID(a)
}
function Get3DHardwareClassification(b) {
var a = b.HardwareClassificationLevel;
if (a == 3) a = "Quality";
else if (a == 2) a = "Balanced";
else if (a == 1) a = "Performance";
else a = "Unknown";
return a
}
VE_3DPlugin = {
MovieRecorderGuid: "791BC97B-7526-4C74-85DB-8CC220E3A65E",
PhotoGuid: "B1FC67C1-F8CE-4CA5-A957-B5FF2215037B",
PhotoManifest: GetManifestUrl("http://go.microsoft.com/fwlink/?LinkID=99342"),
PhotoUrl: GetManifestUrl("http://go.microsoft.com/fwlink/?LinkID=98905"),
HiResModelsGuid: "5D4BE259-4D19-492F-8D6B-830833E2EAD9",
HiResModelsManifest: GetManifestUrl("http://go.microsoft.com/fwlink/?LinkID=124117"),
HiResModelsUrl: GetManifestUrl("http://go.microsoft.com/fwlink/?LinkID=124119"),
WeatherPluginGuid: "A020A315-34D9-4357-94AD-97F909E96B22",
WeatherPluginManifest: GetManifestUrl("http://go.microsoft.com/fwlink/?LinkID=124118"),
WeatherPluginUrl: GetManifestUrl("http://go.microsoft.com/fwlink/?LinkID=124120"),
GeoCommunityGuid: "49D0BC0C-67A7-44CD-93BA-C7CF6F20EAB9",
GeoCommunityManifest: GetManifestUrl("http://go.microsoft.com/fwlink/?LinkID=99343"),
GeoCommunityUrl: GetManifestUrl("http://go.microsoft.com/fwlink/?LinkID=98904"),
StreetLevelGeometryGuid: "C9F0B259-0B78-464A-BEC4-B4E90CF0BC8D",
StreetLevelGeometryManifest: GetManifestUrl("http://go.microsoft.com/fwlink/?LinkID=111353"),
StreetLevelGeometryUrl: GetManifestUrl("http://go.microsoft.com/fwlink/?LinkID=109495")
};
var VE_3DPhotoPluginObj = 0,
VE_3DHiResModelsPluginObj = 0,
VE_3DWeatherPluginObj = 0,
VE_3DGeoCommunityPluginObj = 0,
VE_3DStreetLevelGeometryObj = 0,
PluginEventRegistered = 0,
PhotoPluginEventRegistered = 0,
GeoCommunityPluginEventRegistered = 0,
StreetLevelGeometryEventRegistered = 0,
VE3DVIASavedAction = 0;
function GetVE3DVIAInstallState(a) {
if (!a) {
a = map.Get3DControl();
if (!a) return 0
}
return a.GetComponentInstallState("EE3B731B-969E-4cb6-8949-ADFDC763A547")
}
function OnVE3DVIAInstallEnd() {
if (VE3DVIASavedAction != 0) {
ProcessModelIn3DEx(VE3DVIASavedAction.actionType, VE3DVIASavedAction.properties, VE3DVIASavedAction.control, L_PluginFeatureNotAvailable_Text);
VE3DVIASavedAction = 0
}
}
function ProcessModelRequire3DVIA(b, c, a) {
if (typeof b == "undefined" || b == null) return;
if (!a) {
a = map.Get3DControl();
if (!a) return
}
if (GetVE3DVIAInstallState() == 2) ProcessModelIn3DEx(b, c, a, L_PluginFeatureNotAvailable_Text);
else {
if (!VE3DVIASavedAction) VE3DVIASavedAction = {};
VE3DVIASavedAction.actionType = b;
VE3DVIASavedAction.properties = c;
VE3DVIASavedAction.control = a;
OnSetupVE3DVIA()
}
}
function ProcessModelIn3D(b, c, d) {
var a = L_UnableToDisplay3DVIAModel_Text;
if (VE_ModelActionType.DeleteModel == b) a = "";
ProcessModelIn3DEx(b, c, d, a)
}
function ProcessModelIn3DEx(b, e, a, d) {
if (typeof b == "undefined" || b == null) return;
if (!a) {
var c = GetMapControlInstance();
if (c) a = c.Get3DControl();
if (!a) return
}
if (!VE_3DGeoCommunityPluginObj) VE_3DGeoCommunityPluginObj = CreatePluginObj(a, VE_3DPlugin.GeoCommunityGuid, VE_3DPlugin.GeoCommunityManifest, VE_3DPlugin.GeoCommunityUrl);
if (!GeoCommunityPluginEventRegistered) {
a.AttachPlugInEvent(VE_3DPlugin.GeoCommunityGuid, "OnRefreshModel", "OnRefreshModel");
a.AttachPlugInEvent(VE_3DPlugin.GeoCommunityGuid, "OnLaunchVE3DVIA", "OnLaunchVE3DVIA");
a.AttachPlugInEvent(VE_3DPlugin.GeoCommunityGuid, "LoadModelFileStatus", "VE_OnLoadModelFileStatus");
GeoCommunityPluginEventRegistered = 1
}
FirePluginEventIn3D(VE_3DGeoCommunityPluginObj, b, e, a, d)
}
function ProcessPhotoPluginActionIn3D(b, c, a) {
if (typeof b == "undefined" || b == null) return;
if (!a) {
a = map.Get3DControl();
if (!a) return
}
if (!VE_3DPhotoPluginObj) VE_3DPhotoPluginObj = CreatePluginObj(a, VE_3DPlugin.PhotoGuid, VE_3DPlugin.PhotoManifest, VE_3DPlugin.PhotoUrl);
if (!PhotoPluginEventRegistered) {
a.AttachPlugInEvent(VE_3DPlugin.PhotoGuid, "OnSelectPhoto", "OnSelectPhoto");
a.AttachPlugInEvent(VE_3DPlugin.PhotoGuid, "OnActivate", "OnActivate");
a.AttachPlugInEvent(VE_3DPlugin.PhotoGuid, "OnCameraPan", "OnPhotoCameraPan");
a.AttachPlugInEvent(VE_3DPlugin.PhotoGuid, "OnCameraZoom", "OnPhotoCameraZoom");
a.AttachPlugInEvent(VE_3DPlugin.PhotoGuid, "OnPhotoStateChanged", "OnPhotoStateChanged");
PhotoPluginEventRegistered = 1
}
FirePluginEventIn3D(VE_3DPhotoPluginObj, b, c, a, null)
}
function AllowWeatherPlugin(a) {
if (!a) return false;
var c = GetMapControlInstance(null),
d = a.HardwareClassificationLevel,
b = c.GetMapStyle();
return d == 3 && (b == "a" || b == "h")
}
function AllowHiResModels(a) {
if (!a) return false;
var c = GetMapControlInstance(null),
b = a.HardwareClassificationLevel;
return b == 3
}
function AllowStreetLevelDetail(a) {
if (!a) return false;
var c = GetMapControlInstance(null),
d = a.HardwareClassificationLevel,
b = c.GetMapStyle();
return d == 3 && (b == "a" || b == "h")
}
function LoadWeatherPlugin(a) {
if (!VE_3DWeatherPluginObj) if (a && AllowWeatherPlugin(a)) {
VE_3DWeatherPluginObj = CreatePluginObj(a, VE_3DPlugin.WeatherPluginGuid, VE_3DPlugin.WeatherPluginManifest, VE_3DPlugin.WeatherPluginUrl);
if (VE_3DWeatherPluginObj) {
VE_3DWeatherPluginObj.Loading = 1;
a.LoadPlugInDll(VE_3DWeatherPluginObj.Url)
}
}
}
function OnHiResModelViewed() {}
function LoadHiResModelsPlugin(a) {
if (!VE_3DHiResModelsPluginObj) if (a && AllowHiResModels(a)) {
VE_3DHiResModelsPluginObj = CreatePluginObj(a, VE_3DPlugin.HiResModelsGuid, VE_3DPlugin.HiResModelsManifest, VE_3DPlugin.HiResModelsUrl);
if (VE_3DHiResModelsPluginObj) {
a.AttachPlugInEvent(VE_3DPlugin.HiResModelsGuid, "OnHiResModelViewed", "OnHiResModelViewed");
VE_3DHiResModelsPluginObj.Loading = 1;
a.LoadPlugInDll(VE_3DHiResModelsPluginObj.Url)
}
}
}
function LoadStreetLevelGeometry(a) {
if (!VE_3DStreetLevelGeometryObj) if (a && AllowStreetLevelDetail(a)) {
VE_3DStreetLevelGeometryObj = CreatePluginObj(a, VE_3DPlugin.StreetLevelGeometryGuid, VE_3DPlugin.StreetLevelGeometryManifest, VE_3DPlugin.StreetLevelGeometryUrl);
if (VE_3DStreetLevelGeometryObj) {
VE_3DStreetLevelGeometryObj.Loading = 1;
a.LoadPlugInDll(VE_3DStreetLevelGeometryObj.Url)
}
}
}
function ActivateStreetLevelGeometry(a) {
if (AllowStreetLevelDetail(a)) if (!VE_3DStreetLevelGeometryObj) LoadStreetLevelGeometry(a);
else if (VE_3DStreetLevelGeometryObj.Loaded && !VE_3DStreetLevelGeometryObj.Activated) if (a) a.ActivatePlugIn(VE_3DStreetLevelGeometryObj.Guid, VE_3DStreetLevelGeometryObj.Manifest)
}
function DeactivateStreetLevelGeometry(a) {
if (VE_3DStreetLevelGeometryObj) if (VE_3DStreetLevelGeometryObj.Loaded && VE_3DStreetLevelGeometryObj.Activated && !AllowStreetLevelDetail(a)) if (a) a.DeactivatePlugIn(VE_3DStreetLevelGeometryObj.Guid)
}
function UpdateStreetLevelGeometryState(a) {
var b = AllowStreetLevelDetail(a);
if (b) {
if (!VE_3DStreetLevelGeometryObj.Activated) ActivateStreetLevelGeometry(a)
} else if (VE_3DStreetLevelGeometryObj.Activated) DeactivateStreetLevelGeometry(a)
}
function ActivateWeatherPlugin(a) {
if (AllowWeatherPlugin(a)) if (!VE_3DWeatherPluginObj) LoadWeatherPlugin(a);
else if (VE_3DWeatherPluginObj.Loaded && !VE_3DWeatherPluginObj.Activated) if (a) a.ActivatePlugIn(VE_3DWeatherPluginObj.Guid, VE_3DWeatherPluginObj.Manifest)
}
function DeactivateWeatherPlugin(a) {
if (VE_3DWeatherPluginObj) if (VE_3DWeatherPluginObj.Loaded && VE_3DWeatherPluginObj.Activated && !AllowWeatherPlugin(a)) if (a) a.DeactivatePlugIn(VE_3DWeatherPluginObj.Guid)
}
function UpdateWeatherPluginState(a) {
var b = AllowWeatherPlugin(a);
if (b) {
if (!VE_3DWeatherPluginObj.Activated) ActivateWeatherPlugin(a)
} else if (VE_3DWeatherPluginObj.Activated) DeactivateWeatherPlugin(a)
}
function ActivateHiResModelsPlugin(a) {
if (AllowHiResModels(a)) if (!VE_3DHiResModelsPluginObj) LoadHiResModelsPlugin(a);
else if (VE_3DHiResModelsPluginObj.Loaded && !VE_3DHiResModelsPluginObj.Activated) if (a) a.ActivatePlugIn(VE_3DHiResModelsPluginObj.Guid, VE_3DHiResModelsPluginObj.Manifest)
}
function DeactivateHiResModelsPlugin(a) {
if (VE_3DHiResModelsPluginObj) if (VE_3DHiResModelsPluginObj.Loaded && VE_3DHiResModelsPluginObj.Activated && !AllowHiResModels(a)) if (a) a.DeactivatePlugIn(VE_3DHiResModelsPluginObj.Guid)
}
function UpdateHiResModelsState(a) {
var b = AllowHiResModels(a);
if (b) {
if (!VE_3DHiResModelsPluginObj.Activated) ActivateHiResModelsPlugin(a)
} else if (VE_3DHiResModelsPluginObj.Activated) DeactivateHiResModelsPlugin(a)
}
function CreatePluginObj(b, d, c, e) {
if (!PluginEventRegistered) {
b.AttachEvent("OnPlugInLoaded", "On3DPlugInLoaded");
b.AttachEvent("OnPlugInActivated", "On3DPlugInActivated");
b.AttachEvent("OnPlugInDeactivated", "On3DPlugInDeactivated");
PluginEventRegistered = 1
}
var a = {};
a.Loaded = 0;
a.Loading = 0;
a.Activated = 0;
a.actionCounter = 0;
a.actionType = [];
a.properties = [];
a.control = [];
a.errorMessage = [];
a.Guid = d.toUpperCase();
a.Manifest = c;
a.Url = e;
return a
}
function FirePluginEventIn3D(a, c, d, b, e) {
if (a.Activated) b.RaiseEvent(a.Guid, c, d);
else {
if (!a.Loaded && !a.Loading) {
a.Loading = 1;
b.LoadPlugInDll(a.Url)
}
QueuePluginEvent(a, c, d, b, e)
}
}
function QueuePluginEvent(a, c, d, e, b) {
a.actionType[a.actionCounter] = c;
a.properties[a.actionCounter] = d;
a.control[a.actionCounter] = e;
a.errorMessage[a.actionCounter] = b;
a.actionCounter = a.actionCounter + 1
}
function FireErrorMessage(b) {
var a, c;
for (a = 0; a < b.actionCounter; a = a + 1) {
if (b.errorMessage[a] == null || b.errorMessage[a].length == 0) continue;
var d = false;
for (c = 0; c < a; c = c + 1) if (b.errorMessage[a] == b.errorMessage[c]) {
d = true;
break
}
if (!d) VE_MessageControl._AddMessage(b.errorMessage[a])
}
}
function PostLoadPlugin(b, a, c) {
a.Loading = 0;
if (!a.Loaded) if (c) {
a.Loaded = 1;
b.ActivatePlugIn(a.Guid, a.Manifest)
} else {
if (a.Guid == VE_3DPlugin.GeoCommunityGuid) FireErrorMessage(a);
else VE_MessageControl._AddMessage(L_PluginFeatureNotAvailable_Text, 3000);
a.actionCounter = 0
}
}
function PostActivatePlugin(c, a, d) {
if (d) {
a.Activated = 1;
var b;
for (b = 0; b < a.actionCounter; b = b + 1) if (c == a.control[b]) c.RaiseEvent(a.Guid, a.actionType[b], a.properties[b])
} else if (a.Guid == VE_3DPlugin.GeoCommunityGuid) FireErrorMessage(a);
else VE_MessageControl._AddMessage(L_PluginFeatureNotAvailable_Text, 3000);
a.actionCounter = 0
}
function On3DPlugInLoaded(h, g) {
var a = Deserialize3DMessage(h);
if (typeof a.guid != "undefined" && a.guid != null) a.guid = a.guid.toUpperCase();
else if (typeof a.plugInPath == "string") {
var i = a.plugInPath.toLowerCase(),
f = [VE_3DPhotoPluginObj, VE_3DGeoCommunityPluginObj, VE_3DStreetLevelGeometryObj, VE_3DWeatherPluginObj, VE_3DHiResModelsPluginObj];
for (var d = 0; d < f.length; d++) {
var c = f[d];
if (typeof c == "object" && typeof c.Url == "string" && c.Url.toLowerCase() == i) {
a.guid = c.Guid.toUpperCase();
break
}
}
}
var e = GetMapControlInstance(g);
if (e) {
var b = e.Get3DControl();
if (a.guid == VE_3DPlugin.PhotoGuid) PostLoadPlugin(b, VE_3DPhotoPluginObj, a.success);
else if (a.guid == VE_3DPlugin.GeoCommunityGuid) PostLoadPlugin(b, VE_3DGeoCommunityPluginObj, a.success);
else if (a.guid == VE_3DPlugin.HiResModelsGuid) {
if (a.success && !VE_3DHiResModelsPluginObj.Loaded) {
VE_3DHiResModelsPluginObj.Loaded = 1;
ActivateHiResModelsPlugin(b)
}
} else if (a.guid == VE_3DPlugin.WeatherPluginGuid) {
if (a.success && !VE_3DWeatherPluginObj.Loaded) {
VE_3DWeatherPluginObj.Loaded = 1;
ActivateWeatherPlugin(b)
}
} else if (a.guid == VE_3DPlugin.StreetLevelGeometryGuid) if (a.success && !VE_3DStreetLevelGeometryObj.Loaded) {
VE_3DStreetLevelGeometryObj.Loaded = 1;
ActivateStreetLevelGeometry(b)
}
}
}
function On3DPlugInActivated(e, d) {
var a = Deserialize3DMessage(e);
if (typeof a.guid != "undefined" && a.guid != null) a.guid = a.guid.toUpperCase();
var c = GetMapControlInstance(d);
if (c) {
var b = c.Get3DControl();
if (a.guid == VE_3DPlugin.PhotoGuid) PostActivatePlugin(b, VE_3DPhotoPluginObj, a.success);
else if (a.guid == VE_3DPlugin.GeoCommunityGuid) PostActivatePlugin(b, VE_3DGeoCommunityPluginObj, a.success);
else if (a.guid == VE_3DPlugin.StreetLevelGeometryGuid) PostActivatePlugin(b, VE_3DStreetLevelGeometryObj, a.success);
else if (a.guid == VE_3DPlugin.HiResModelsGuid) PostActivatePlugin(b, VE_3DHiResModelsPluginObj, a.success);
else if (a.guid == VE_3DPlugin.WeatherPluginGuid) PostActivatePlugin(b, VE_3DWeatherPluginObj, a.success)
}
}
function On3DPlugInDeactivated(b) {
var a = Deserialize3DMessage(b);
a.guid = a.guid.toUpperCase();
if (a.guid == VE_3DPlugin.PhotoGuid && a.success) VE_3DPhotoPluginObj.Activated = 0;
else if (a.guid == VE_3DPlugin.GeoCommunityGuid && a.success) VE_3DGeoCommunityPluginObj.Activated = 0;
else if (a.guid == VE_3DPlugin.StreetLevelGeometryGuid && a.success) VE_3DStreetLevelGeometryObj.Activated = 0;
else if (a.guid == VE_3DPlugin.HiResModelsGuid && a.success) VE_3DHiResModelsPluginObj.Activated = 0;
else if (a.guid == VE_3DPlugin.WeatherPluginGuid && a.success) VE_3DWeatherPluginObj.Activated = 0
}
function OnPhotoStateChanged(e, c) {
var a = GetMapControlInstance(c);
if (a == null) return;
var b = a.CreateEvent(),
d = Deserialize3DMessage(e);
b.enabled = d.enabled;
a.Fire("onve3dphotostatechanged", b)
}
function OnLaunchVE3DVIA() {
VE_MessageControl._AddMessage(L_LaunchVE3DVIA_Text, 5000)
}
function VE_OnLoadModelFileStatus(d) {
if (typeof Msn.VE.API != "undefined" && Msn.VE.API != null) {
var c = GetVEMapInstance();
if (c) {
var b = Deserialize3DMessage(d),
a = c.GetShapeByID(b.id);
if (a && a.ModelData && typeof a.ModelData.Callback == "function") a.ModelData.Callback(a, b.status)
}
}
}
var __vemapcontrolisReady = true;
if (!window.__DEP_COL_HASH) window.__DEP_COL_HASH = [];
function openDependency(c, g) {
var d = false,
a = __DEP_COL_HASH[c];
if (!a) {
a = new f(c, g);
var b = __DEP_COL_HASH.push(a);
__DEP_COL_HASH[c] = __DEP_COL_HASH[b - 1]
}
if (a.isClosed) a.reset();
var b, i = arguments.length;
for (b = 2; b < i; b++) {
var e = arguments[b];
if (!a.dependencyExists(e)) a.addDependency(new h(e));
else d = true
}
return !d;
function h(a) {
this.id = a;
this.isReady = false
}
function f(c, d) {
var a = [],
b = d,
e = false;
this.key = c;
this.isClosed = false;
this.addDependency = function (b) {
var c = a.push(b);
a[b.id] = a[c - 1]
};
this.dependencyExists = function (b) {
return a[b] != null
};
this.getDependencies = function () {
return a
};
this.executeCallback = function () {
if (typeof b == "function") b.call()
};
this.reset = function () {
this.isClosed = false;
a = []
}
}
}
function closeDependency(f) {
var b, h = __DEP_COL_HASH.length;
a: for (b = 0; b < h; b++) {
var a = __DEP_COL_HASH[b],
d = a.getDependencies(),
e = d[f];
if (typeof e != "undefined" && e != null) {
e.isReady = true;
if (!a.isClosed) {
var c, g = d.length;
for (c = 0; c < g; c++) if (!d[c].isReady) continue a;
a.isClosed = true;
a.executeCallback()
}
}
}
}
var CompatVersion = "";
if (typeof VEAPI_DisableAtlasCompat == "undefined" || !VEAPI_DisableAtlasCompat) VEAPI_DisableAtlasCompat = navigator.userAgent.indexOf("KHTML") !== -1;
function disable_text_selection(a) {
if (typeof a === "undefined") return;
a.onselectstart = function () {
return false
};
a.onmousedown = function () {
return false
};
a.unselectable = "on";
a.style.MozUserSelect = "none";
a.style.cursor = "default"
}
_VERegisterNamespaces("Web.Browser", "Web.Debug.Performance");
if (!Web.Debug.Enabled) {
Web.Debug.Enabled = false;
Web.Debug.Assert = Web.Debug.Trace = function () {};
Web.Debug.Performance.Start = function () {
this.End = function () {};
return this
}
}
Web.Browser.isSafari = function () {
return navigator.userAgent.indexOf("KHTML") !== -1
};
Web.Browser.GetWebKitVersion = function () {
var b = NaN,
a = / AppleWebKit\/([^ ]+)/.exec(navigator.userAgent);
if (a && a.length == 2) b = parseInt(a[1]);
Web.Browser.GetWebKitVersion = function () {
return b
};
return b
};
Web.Browser.isSafari2 = function () {
return Web.Browser.GetWebKitVersion() < 500
};
Web.Browser.isSafari3 = function () {
return Web.Browser.GetWebKitVersion() >= 500
};
Web.Browser.AttachSafariCompatibility = function (a) {
if (Web.Browser.isSafari2()) try {
document.getElementsByTagName("HTML")[0]
} catch (s) {}
a.CollectGarbage = function () {};
Web.Browser.Button = {
LEFT: 0,
RIGHT: 2,
MIDDLE: 1
};
function i(a) {
window.event = a
}
function q(b, c, d) {
var a = c.slice(2);
if (a !== "mouseenter" && a !== "mouseleave") b.addEventListener(a, i, true);
else {
b.addEventListener("mouseover", i, true);
b.addEventListener("mouseout", i, true)
}
b.addEventListener(a, d, false)
}
function p(d, b, c) {
var a = b.slice(2);
if (b === "mousewheel") a = "DOMMouseScroll";
d.removeEventListener(a, c, false)
}
function j(a, b) {
if (a === "onclick") a = "onmouseup";
q(this, a, b)
}
function k(a, b) {
if (a === "onclick") a = "onmouseup";
p(this, a, b)
}
if (Web.Browser.isSafari2()) if (typeof a["[[DOMDocument.prototype]]"] === "undefined" || typeof a["[[DOMElement.prototype]]"] === "undefined") {
Object.prototype.attachEvent = j;
Object.prototype.detachEvent = k
} else {
a.attachEvent = a["[[DOMDocument.prototype]]"].attachEvent = a["[[DOMElement.prototype]]"].attachEvent = j;
a.detachEvent = a["[[DOMDocument.prototype]]"].detachEvent = a["[[DOMElement.prototype]]"].detachEvent = k
} else if (Web.Browser.isSafari3()) {
a.attachEvent = a.HTMLDocument.prototype.attachEvent = a.HTMLElement.prototype.attachEvent = j;
a.detachEvent = a.HTMLDocument.prototype.detachEvent = a.HTMLElement.prototype.detachEvent = k
}
var g = false;
function c(a) {
if (g) {
a.preventDefault();
a.returnValue = false;
document.removeEventListener(a.type, c, true);
a.capturedTarget = a.target;
g.dispatchEvent(a);
delete a.captureTarget;
if (g) document.addEventListener(a.type, c, true);
a.stopPropagation()
}
}
function b(a) {
a.stopPropagation();
a.preventDefault()
}
function o() {
g = this;
document.addEventListener("mousemove", c, true);
document.addEventListener("mouseover", b, true);
document.addEventListener("mouseout", b, true);
document.addEventListener("mouseenter", b, true);
document.addEventListener("mouseleave", b, true);
document.addEventListener("mouseup", c, true)
}
function m() {
g = null;
document.removeEventListener("mousemove", c, true);
document.removeEventListener("mouseover", b, true);
document.removeEventListener("mouseout", b, true);
document.removeEventListener("mouseenter", b, true);
document.removeEventListener("mouseleave", b, true);
document.removeEventListener("mouseup", c, true)
}
if (Web.Browser.isSafari2()) {
var n = 0;
function l() {
if (typeof a["[[DOMElement.prototype]]"] === "undefined") {
if (n < 100) {
n++;
setTimeout(l, 100)
}
} else {
a["[[DOMElement.prototype]]"].setCapture = o;
a["[[DOMElement.prototype]]"].releaseCapture = m
}
}
l()
} else if (Web.Browser.isSafari3()) {
a.HTMLElement.prototype.setCapture = o;
a.HTMLElement.prototype.releaseCapture = m
}
function h() {}
function d() {}
var f = null,
e = null;
if (Web.Browser.isSafari2()) {
h = function (e, c, b) {
var a = d(e, c, b);
if (a.length > 0) return a[0];
else return null
};
d = function (g, e, d) {
var c = d.getElementsByTagName(e),
b = [],
a, f = c.length;
for (a = 0; a < f; a++) b.push(c[a]);
return b
};
f = typeof a["[[DOMDocument.prototype]]"] !== "undefined" ? a["[[DOMDocument.prototype]]"] : Object.prototype;
e = typeof a["[[DOMElement.prototype]]"] !== "undefined" ? a["[[DOMElement.prototype]]"] : Object.prototype
} else if (Web.Browser.isSafari3()) {
h = function (e, a, c) {
a += "[1]";
var b = d(e, a, c);
if (b.length > 0) return b[0];
else return null
};
d = function (b, f, e) {
var d = b.evaluate(f, e, b.createNSResolver(b.documentElement), XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null),
c = [],
a, g = d.snapshotLength;
for (a = 0; a < g; a++) c.push(d.snapshotItem(a));
return c
};
if (typeof document.implementation !== "undefined" && typeof document.implementation.createDocument !== "undefined") f = document.implementation.createDocument("ns", "root", null).constructor.prototype;
if (typeof Element !== "undefined") e = Element.prototype
}
if (f) {
f.selectNodes = function (a) {
return d(this, a, this)
};
f.selectSingleNode = function (a) {
return h(this, a, this)
}
}
if (e) {
e.selectNodes = function (b) {
var a = this.ownerDocument;
if (a.selectNodes) return d(a, b, this);
else return null
};
e.selectSingleNode = function (b) {
var a = this.ownerDocument;
if (a.selectSingleNode) return h(a, b, this);
else return null
}
}
};
if (Web.Browser.isSafari()) {
Web.Browser.AttachSafariCompatibility(window);
if (Web.Browser.isSafari2()) Msn.Drawing.SvgLayer = function (i, d) {
function g(b) {
var c = "http://www.w3.org/1999/xhtml",
a = document.createElementNS(c, "canvas");
a.setAttribute("id", b);
disable_text_selection(a);
a.setAttribute("width", d.GetMapWidth());
a.setAttribute("height", d.GetMapHeight());
a.style.position = "absolute";
a.style.top = "0px";
a.style.left = "0px";
return a
}
var c = d,
b = null,
h = false,
k = false,
j = true;
if (h === false) {
h = true;
b = document.createElement("div");
b.setAttribute("height", "100%");
b.setAttribute("width", "100%");
i.appendChild(b);
this.lineDashStyles = [];
var a = this.lineDashStyles;
a[0] = ["Solid", "none"];
a[1] = ["ShortDash", "6,2"];
a[2] = ["ShortDot", "2,2"];
a[3] = ["ShortDashDot", "6,2,2,2"];
a[4] = ["ShortDashDotDot", "6,2,2,2,2,2"];
a[5] = ["Dot", "2,6"];
a[6] = ["Dash", "10,6"];
a[7] = ["LongDash", "20,6"];
a[8] = ["DashDot", "10,6,2,6"];
a[9] = ["LongDashDot", "20,6,2,6"];
a[10] = ["LongDashDotDot", "20,6,2,6,2,6"]
}
this.addShape = function (d) {
if (b === null) return;
var j = null;
if (d.type === MC_GEO_TYPE_POINT) {
j = g(d.id !== 0 ? d.id : d.iid);
b.appendChild(j);
var a = j.getContext("2d"),
n = k.x - 6,
o = k.y - 6,
m = 12,
k = 12;
a.fillStyle = d.symbol.fill_color;
a.strokeStyle = d.symbol.stroke_color;
a.lineWidth = d.symbol.stroke_weight;
a.beginPath();
a.rect(n, o, m, k);
a.closePath();
a.fill();
a.stroke()
} else if (d.type === MC_GEO_TYPE_POLYLINE || d.type === MC_GEO_TYPE_POLYGON) {
j = g(d.id !== 0 ? d.id : d.iid);
b.appendChild(j);
var a = j.getContext("2d");
if (d.type === MC_GEO_TYPE_POLYGON) a.fillStyle = f(d.symbol.fill_color, e(d.symbol.fill_opacity));
else a.fillStyle = "";
a.strokeStyle = f(d.symbol.stroke_color, e(d.symbol.stroke_opacity));
a.lineWidth = parseInt(d.symbol.stroke_weight);
var i = GetSvgPath(c, d.points).split(/[\s,]+/),
h, l = i.length;
if (d.type === MC_GEO_TYPE_POLYGON) {
a.beginPath();
a.moveTo(Number(i[0]), Number(i[1]));
for (h = 2; h < l; h += 2) a.lineTo(Number(i[h]), Number(i[h + 1]));
a.closePath();
a.fill()
}
a.beginPath();
a.moveTo(Number(i[0]), Number(i[1]));
for (h = 2; h < l; h += 2) a.lineTo(Number(i[h]), Number(i[h + 1]));
a.stroke()
}
return j
};
this.SetZIndex = function (a) {
if (!c.bShowSVG) return;
c.GetsvgDiv().style.zIndex = a
};
this.UpdatePoints = function (a) {
if (a.type == VEShapeType.Polyline || a.type == VEShapeType.Polygon) {
var b = $ID(a.id !== 0 ? a.id : a.iid);
if (b.parentNode) b.parentNode.removeChild(b);
this.addShape(a)
}
return a
};
this.UpdateStyle = this.UpdatePoints;
function f(b, c) {
if (b.length == 7 && c) {
var a = [];
a.push("rgba(");
a.push(parseInt(b.substring(1, 3), 16));
a.push(",");
a.push(parseInt(b.substring(3, 5), 16));
a.push(",");
a.push(parseInt(b.substring(5, 7), 16));
a.push(",");
a.push(c);
a.push(")");
return a.join("")
} else return b
}
function e(a) {
a += "";
if (a.indexOf("%") > 1) {
a = parseInt(a);
if (a === NaN) a = .3;
else a /= 100
}
return a
}
}
}
var windowWidth = 0,
windowHeight = 0,
scrollbarWidth = null;
function $ID(a) {
var b = document;
return b.getElementById(a)
}
function $CE(a) {
var b = document;
return b.createElement(a)
}
function $CENS(a) {
var b = document;
return b.createElementNS(a)
}
function GetWindowWidth() {
var a = 0;
if (typeof window.innerWidth == "number") a = window.innerWidth;
else if (document.documentElement && document.documentElement.clientWidth) a = document.documentElement.clientWidth;
else if (document.body && document.body.clientWidth) a = document.body.clientWidth;
if (!a || a < 100) a = 100;
return a
}
function GetWindowHeight() {
var a = 0;
if (typeof window.innerHeight == "number") a = window.innerHeight;
else if (document.documentElement && document.documentElement.clientHeight) a = document.documentElement.clientHeight;
else if (document.body && document.body.clientHeight) a = document.body.clientHeight;
if (!a || a < 100) a = 100;
return a
}
function GetScrollbarWidth() {
if (scrollbarWidth) return scrollbarWidth;
if (navigator.userAgent.indexOf("IE") >= 0) {
var a = document.createElement("div"),
b = null;
a.style.visible = "hidden";
a.style.overflowY = "scroll";
a.style.position = "absolute";
a.style.width = 0;
document.body.insertAdjacentElement("afterBegin", a);
b = a.offsetWidth;
a.parentNode.removeChild(a);
if (!b) b = 16;
scrollbarWidth = b;
return b
} else return 0
}
function GetUrlPrefix() {
var a = window.location.pathname.lastIndexOf("/"),
b = window.location.protocol + "//" + window.location.hostname + window.location.pathname.substring(0, a + 1);
return b
}
function GetUrlParameterString() {
var a = window.location.search;
if (a.length == 0 || a.indexOf("?") == -1) return "";
return a.substr(a.indexOf("?") + 1)
}
function CheckWipExistence() {
var a = GetUrlParameterString();
if (a != "" && a.indexOf("wip=") > -1) return true;
return false
}
function GetUrlParameters() {
var b = [],
d = GetUrlParameterString();
if (!d) return b;
var e = d.split("&");
for (var c = 0; c < e.length; c++) {
var a = e[c].split("=");
if (a.length == 2 && a[0] && a[1]) {
b.push(unescape(a[0]));
b.push(unescape(a[1]))
}
}
return b
}
function ParseShiftKeyForLinks(a) {
if (a.shiftKey) return false;
return true
}
_VERegisterNamespaces("Msn.VE.API.Globals");
_VERegisterNamespaces("Msn.VE.API.Constants");
Msn.VE.API.Globals.vemapinstances = null;
Msn.VE.API.Globals.veonbegininvokeevent = null;
Msn.VE.API.Globals.veonendinvokeevent = null;
Msn.VE.API.Globals.vefindresultsnpanel = null;
Msn.VE.API.Globals.language = "en";
Msn.VE.API.Globals.locale = "en-us";
Msn.VE.API.Globals.resourcelocale = "en-us";
Msn.VE.API.Globals.vecurrentversion = "6.3.20091207154938.04";
Msn.VE.API.Globals.ishttpsenabled = false;
Msn.VE.API.Globals.protocol = "https://";
Msn.VE.API.Globals.vecurrentdomain = "https://ecn.dev.virtualearth.net/mapcontrol/v6.3";
Msn.VE.API.Globals.vedebug = false;
Msn.VE.API.Globals.analyticsInitialized = false;
var VE_MapDispatch_SymbolLib = null;
Msn.VE.API.Constants.orthotileserver = "%0ecn.t%2.tiles.virtualearth.net/tiles/%3%4.%5?g=%6&mkt={21}".replace(/%0/g, Msn.VE.API.Globals.protocol);
Msn.VE.API.Constants.obliquetileserver = "%0ecn.t%3.tiles.virtualearth.net/tiles/o%4-%5-%6-%7.jpeg?g=%8".replace(/%0/g, Msn.VE.API.Globals.protocol);
Msn.VE.API.Constants.obliquehybridtileserver = "%0ecn.t%3.tiles.virtualearth.net/tiles/cmd/ObliqueHybrid?a=%4-%5-%6-%7&g=%8".replace(/%0/g, Msn.VE.API.Globals.protocol);
Msn.VE.API.Constants.obliquethumbnailtileserver = "%0ecn.t%1.tiles.virtualearth.net/tiles/ot%2.jpeg?g=%3".replace(/%0/g, Msn.VE.API.Globals.protocol);
Msn.VE.API.Constants.shadedtileserver = "%0ecn.t%2.tiles.virtualearth.net/tiles/%3%4.%5?g=%6&mkt={21}&shading=hill".replace(/%0/g, Msn.VE.API.Globals.protocol);
Msn.VE.API.Constants.lavendertileserver = "%0ecn.t%2.tiles.virtualearth.net/tiles/r%4?g=%6&mkt={21}&lbl=l1&stl=h&shading=hill&n=z".replace(/%0/g, Msn.VE.API.Globals.protocol);
Msn.VE.API.Constants.traffictileserver = "%0t%2.tiles.virtualearth.net/tiles/dp/content?p=tf&a=%4".replace(/%0/g, Msn.VE.API.Globals.protocol);
Msn.VE.API.Constants.trafficmarketsserver = "%0t0.tiles.virtualearth.net/tiles/dp/content?p=ti&a=markets.js".replace(/%0/g, Msn.VE.API.Globals.protocol);
Msn.VE.API.Constants.trafficincidentsserver = "%0t0.tiles.virtualearth.net/tiles/dp/content?p=ti&a=market-%1.js".replace(/%0/g, Msn.VE.API.Globals.protocol);
Msn.VE.API.Constants.orthoorigintileserver = "%0t%2.tiles.virtualearth.net/tiles/%3%4.%5?g=%6&mkt={21}".replace(/%0/g, Msn.VE.API.Globals.protocol);
Msn.VE.API.Constants.obliqueorigintileserver = "%0t%3.tiles.virtualearth.net/tiles/o%4-%5-%6-%7.jpeg?g=%8".replace(/%0/g, Msn.VE.API.Globals.protocol);
Msn.VE.API.Constants.obliquehybridorigintileserver = "%0t%3.tiles.virtualearth.net/tiles/cmd/ObliqueHybrid?a=%4-%5-%6-%7&g=%8".replace(/%0/g, Msn.VE.API.Globals.protocol);
Msn.VE.API.Constants.obliquethumbnailorigintileserver = "%0t%1.tiles.virtualearth.net/tiles/ot%2.jpeg?g=%3".replace(/%0/g, Msn.VE.API.Globals.protocol);
Msn.VE.API.Constants.shadedorigintileserver = "%0t%2.tiles.virtualearth.net/tiles/%3%4.%5?g=%6&mkt={21}&shading=hill".replace(/%0/g, Msn.VE.API.Globals.protocol);
Msn.VE.API.Constants.lavenderorigintileserver = "%0t%2.tiles.virtualearth.net/tiles/r%4?g=%6&mkt={21}&lbl=l1&stl=h&shading=hill&n=z".replace(/%0/g, Msn.VE.API.Globals.protocol);
Msn.VE.API.Constants.imageryurl = "%0dev.virtualearth.net/services/v1/ImageryMetadataService/ImageryMetadataService.asmx".replace(/%0/g, Msn.VE.API.Globals.protocol);
Msn.VE.API.Constants.collectionservice = "%0www.bing.com/maps/GeoCommunity.aspx".replace(/%0/g, Msn.VE.API.Globals.protocol);
Msn.VE.API.Constants.searchservice = "%0dev.virtualearth.net/services/v1/SearchService/SearchService.asmx/Search2".replace(/%0/g, Msn.VE.API.Globals.protocol);
Msn.VE.API.Constants.legacyrouteservice = "__legacyRouteServiceUrl__".replace(/%0/g, Msn.VE.API.Globals.protocol);
Msn.VE.API.Constants.routeservice = "%0dev.virtualearth.net/services/v1/RouteService/RouteService.asmx".replace(/%0/g, Msn.VE.API.Globals.protocol);
Msn.VE.API.Constants.geocodingservice = "%0dev.virtualearth.net/services/v1/geocodeservice/geocodeservice.asmx".replace(/%0/g, Msn.VE.API.Globals.protocol);
Msn.VE.API.Constants.logservice = "%0dev.virtualearth.net/webservices/v1/LoggingService/LoggingService.svc".replace(/%0/g, Msn.VE.API.Globals.protocol);
Msn.VE.API.Constants.frontdoorLogUrl = "".replace(/%0/g, Msn.VE.API.Globals.protocol);
Msn.VE.API.Constants.iconurl = Msn.VE.API.Globals.vecurrentdomain + "/i/bin/" + Msn.VE.API.Globals.vecurrentversion + "/pins/poi_usergenerated.gif";
Msn.VE.API.Constants.clustericonurl = Msn.VE.API.Globals.vecurrentdomain + "/i/bin/" + Msn.VE.API.Globals.vecurrentversion + "/pins/poi_stack.gif";
Msn.VE.API.Constants.atlascompatjs = Msn.VE.API.Globals.vecurrentdomain + "/js/atlascompat.js";
Msn.VE.API.Constants.stylesheet = Msn.VE.API.Globals.vecurrentdomain + "/css/bin/" + Msn.VE.API.Globals.vecurrentversion + "/" + Msn.VE.API.Globals.language + "/mapcontrol.css";
Msn.VE.API.Constants.stylesheetiev6 = Msn.VE.API.Globals.vecurrentdomain + "/css/bin/" + Msn.VE.API.Globals.vecurrentversion + "/" + Msn.VE.API.Globals.language + "/mapcontroliev6.css";
Msn.VE.API.Constants.vedirectionsstarticon = Msn.VE.API.Globals.vecurrentdomain + "/i/bin/" + Msn.VE.API.Globals.vecurrentversion + "/pins/mapicon_start.gif";
Msn.VE.API.Constants.vedirectionsendicon = Msn.VE.API.Globals.vecurrentdomain + "/i/bin/" + Msn.VE.API.Globals.vecurrentversion + "/pins/mapicon_end.gif";
Msn.VE.API.Constants.vedirectionsstepicon = Msn.VE.API.Globals.vecurrentdomain + "/i/bin/" + Msn.VE.API.Globals.vecurrentversion + "/pins/RedCircle%1.gif";
Msn.VE.API.Constants.trafficiconurl = Msn.VE.API.Globals.vecurrentdomain + "/i/bin/" + Msn.VE.API.Globals.vecurrentversion + "/Traffic/Traffic%1.gif";
Msn.VE.API.Constants.trafficmarketiconurl = Msn.VE.API.Globals.vecurrentdomain + "/i/bin/" + Msn.VE.API.Globals.vecurrentversion + "/Traffic/%1TrafficZoom.gif";
Msn.VE.API.Constants.spacerurl = Msn.VE.API.Globals.vecurrentdomain + "/i/bin/" + Msn.VE.API.Globals.vecurrentversion + "/spacer.gif";
Msn.VE.API.Constants.mapguid = "mapguid";
Msn.VE.API.Constants.rim = "rim";
Msn.VE.API.Constants.rimargs = "rimargs";
Msn.VE.API.Constants.contextid = "contextid";
Msn.VE.API.Constants.clienttoken = "token";
Msn.VE.API.Constants.market = "mkt";
Msn.VE.API.Constants.culture = "culture";
Msn.VE.API.Constants.format = "format";
Msn.VE.API.Constants.json = "json";
Msn.VE.API.Constants.requestid = "rid";
Msn.VE.API.Constants.maximportedshapes = "maxitems";
Msn.VE.API.Constants.defaultLogCredentials = "Ahn5L376ymB7iE0SUTiv0-mqke-onEds0hDyR5WF9uaGYphF-L3tsU6i7xcT-B5H";
Msn.VE.API.Globals.vemapmode = Msn.VE.MapActionMode.Mode2D;
Msn.VE.API.Globals.vemapheight = 400;
Msn.VE.API.Globals.vemapwidth = 600;
Msn.VE.API.Globals.vemapzoom = 4;
Msn.VE.API.Globals.vemaplatitude = "43.75";
Msn.VE.API.Globals.vemaplongitude = "-99.71";
Msn.VE.API.Globals.vemapstyle = "r";
Msn.VE.API.Globals.vemaxzoom = "26";
Msn.VE.API.Globals.veminzoom = "1";
Msn.VE.API.Globals.veshapemaxzoom = "21";
Msn.VE.API.Globals.veshapeminzoom = "1";
Msn.VE.API.Globals.vetilesize = 256;
Msn.VE.API.Globals.vepushpinpanelzIndex = 999;
Msn.VE.API.Globals.veshapeiconzindex = 1000;
Msn.VE.API.Globals.veshapepolyshapezindex = 50;
Msn.VE.API.Globals.vetilelayerdefaultzindex = 2;
Msn.VE.API.Globals.vemessagepanelheight = 75;
Msn.VE.API.Globals.vemessagepanelzIndex = 99;
Msn.VE.API.Globals.veplacelistpanelheight = 200;
Msn.VE.API.Globals.veplacelistpanelwidth = 350;
Msn.VE.API.Globals.veplacelistpanelzIndex = 300;
Msn.VE.API.Globals.vefindresultsnpanelwidth = 200;
Msn.VE.API.Globals.vefindresultsnpanelzIndex = 99;
Msn.VE.API.Globals.vefindresultsnpanelcolor = "blue";
Msn.VE.API.Globals.veiscommercialcontrol = false;
Msn.VE.API.Globals.veobliqueMode = null;
Msn.VE.API.Constants.maxasynlatlongs = 50;
Msn.VE.API.Globals.vefindnumresultsdefault = 10;
Msn.VE.API.Globals.vefindnumresultsmin = 1;
Msn.VE.API.Globals.vefindnumresultsmax = 20;
Msn.VE.API.Globals.vedefaultmaximportedshapes = 200;
Msn.VE.API.Globals.Dispose = function () {
Msn.VE.API.Globals.veonbegininvokeevent = null;
Msn.VE.API.Globals.veonendinvokeevent = null;
Msn.VE.API.Globals.vefindresultsnpanel = null
};
Msn.VE.API.Globals.PosX = function (a) {
var b = 0;
if (!a) var a = window.event;
if (a.pageX) b = a.pageX;
else if (a.clientX) b = a.clientX + document.body.scrollLeft;
return b
};
Msn.VE.API.Globals.PosY = function (a) {
var b = 0;
if (!a) var a = window.event;
if (a.pageY) b = a.pageY;
else if (a.clientY) b = a.clientY + document.body.scrollTop;
return b
};
function VE_Help() {}
_VERegisterNamespaces("Msn.VE.Constants.Css");
var MSVE_header = document.getElementsByTagName("body")[0],
VE_ContextMenu = null,
Gimme = {};
(function () {
var b = new function () {
var e = {},
n = new function () {
this.val = -2;
this.t = 0;
this.f = 0;
this.inc = function () {
this.val += 2;
this.t = this.val + 1;
this.f = this.val
}
};
this.query = p;
this.processSelector = f;
this.nthCacheContains = i;
function p(a, b) {
if (!a) return [];
if (a instanceof Array) return a;
if (typeof a !== "string") return [a];
if (typeof document.querySelectorAll !== "undefined") try {
return g(document.querySelectorAll(a))
} catch (c) {}
e = {};
n.inc();
return o(d.parseSelector(a), b)
}
function o(q, c) {
var b = q.selectors,
i = q.hints,
h = i.anchor;
c = c || document.documentElement;
if (h.elem === null) return [];
if (i.isPartialQuery) {
b.unshift(d.createReferenceSelector(c));
c = c.parentNode
} else if (h.elem !== -1 && b.length > 1) c = h.elem;
if (i.initialCollection !== null) elems = j(i.initialCollection, b[b.length - 1]);
else elems = m(b[b.length - 1], c);
if (b.length === 1) return elems;
if (b.length === 3) if (h.isIdeal) return elems;
var s = 0,
k, g, t = elems.length,
r = a.combinator,
l, p, f, e, n = null,
o = [];
a: for (k = 0; k < t; k++) {
g = b.length - 2;
e = b[g];
f = p = elems[k];
while (e) {
l = b[g - 1];
if (!r[e](l, f)) if (f.parentNode && n === " " && e !== " ") {
f = f.parentNode;
continue
} else continue a;
f = l.cursor;
g -= 2;
n = e;
e = g < 1 ? null : b[g]
}
o[s++] = p
}
return o
}
function f(d, b) {
if (!b) return false;
if (d.refersTo) return d.refersTo === b;
var c = d.inProps,
n = c.id,
m = c.tag,
j = c.classes,
i = c.attributes,
l = c.pseudos,
g = a.inRules,
f = a.exRules;
if (n && b.id !== n || m && b.tagName !== m || j.length > 0 && !g["."].processFn(b, j) || i.length > 0 && !g["["].processFn(b, i) || l.length > 0 && !g[":"].processFn(b, l)) return false;
var h, e, k = d.exProps;
for (h in f) {
e = f[h].name;
if (k[e] && !f[h].processFn(b, k[e])) return false
}
return true
}
function m(h, f) {
f = f || document.documentElement;
var l = 0,
d, j, c, a = h.inProps,
m = h.exProps;
if (a.id) {
c = [$ID(a.id)];
delete a.id
} else {
var e = a.pseudos[a.pseudos.length - 1];
if (e && e.name === "nth-child") {
c = k(e.param.a, e.param.b, a.tag);
a.pseudos = a.pseudos.splice(a.pseudos.length, 1)
} else c = f.getElementsByTagName(a.tag || "*");
if (m.isEmpty && a.classes.length < 1 && a.attributes.length < 1 && a.pseudos.length < 1) return g(c);
delete a.tag
}
var i = [];
j = c.length;
for (d = 0; d < j; d++) if (b.processSelector(h, c[d])) i[l++] = c[d];
return i
}
function j(d, g) {
var c = [],
e = 0,
h = d.length,
a, b;
for (b = 0; b < h; b++) {
a = d[b];
if (a.nodeType !== 1) continue;
if (f(g, a)) c[e++] = a
}
return c
}
function g(b) {
var c = [],
d = 0,
e = b.length,
a;
for (a = 0; a < e; a++) c[d++] = b[a];
return c
}
function k(a, b, c) {
return e[a + "n+" + b] = h(a, b, c, true)
}
function l(a, b) {
return e[a + "n+" + b] = h(a, b, null, false)
}
function h(j, n, b, h) {
if (b === "*") b = null;
var k = document.getElementsByTagName("*"),
m = k.length,
i = {},
l = 0,
e, a, f, g, d = h ? [] : {};
for (f = 0; f < m; f++) {
a = k[f];
e = c(a.parentNode);
i[e] = i[e] || 0;
g = (l = ++i[e]) - n;
if (j === 0 && (b && a.tagName !== b ? false : true)) {
if (g === 0) {
if (h) d.push(a);
d[c(a)] = true
}
} else if (j * g >= 0 && g % j === 0 && (b && a.tagName !== b ? false : true)) {
if (h) d.push(a);
d[c(a)] = true
}
}
return d
}
function i(c, d, f) {
var b = c + "n+" + d,
a = e[b];
if (!a) a = e[b] = l(c, d);
return a[f] === true
}
},
d = new function () {
var d = null,
f = null,
c = "";
this.setRules = function (b) {
d = b;
var a;
for (a in d.combinator) if (d.combinator.hasOwnProperty(a)) c += a;
f = new RegExp("\\s*([" + c + "])\\s*", "g")
};
this.parseSelector = function (l) {
l = e(l).replace(f, "$1");
var i = null,
k = [],
n = new b,
m = {
anchor: new g,
isPartialQuery: false,
initialCollection: null
},
h = m.anchor,
p = h,
s, t, v, q, r, u, d, j = 0,
o = "",
w = l.length;
while (j < w) {
d = l.charAt(j);
i = i || a.inRules[d] || a.exRules[d];
if (i) {
u = i.endsWith + (i.stopForCombinators === false ? "" : c);
t = i.startSkip || 0;
v = i.endSkip || 0;
q = i.startModifier || null;
r = i.endModifier || null;
d = l.charAt(j += t);
while (u.indexOf(d) === -1) {
if (d === q) while (d && d !== r) {
o += d;
d = l.charAt(++j)
}
o += d;
d = l.charAt(++j)
}
if ((s = n.addPart(o, i)) !== -1) {
p = h;
h = new g(k.length, s)
}
j += v;
o = "";
i = null;
continue
} else if (c.indexOf(d) !== -1) {
d === "+" || d === "~" ? (h = p) : (p = h);
if (!(m.isPartialQuery = j === 0)) {
k.push(n);
n = new b
}
k.push(d);
m.initialCollection = d === ">" && h.elem && h.elem !== -1 && h.index === k.length - 2 ? h.elem.childNodes : null
} else {
i = a.inRules["tag"];
continue
}
j++
}
k.push(n);
h.isIdeal = h.elem !== -1 && k.length - 3 === h.index;
m.anchor = h;
return {
selectors: k,
hints: m
}
};
this.parseAttribute = function (c) {
var d = /\=|\^=|\$=|\*=|\|=|~=|!=/,
a = c.match(d);
a = a && a[0];
var b = c.split(a),
f = b[0] && e(b[0].replace(/[\[\]"]/g, "")),
g = b[1] && e(b[1].replace(/[\[\]"]/g, ""));
return {
name: f,
delim: a,
val: g
}
};
this.parsePseudo = function (f) {
var d = /(.*)\((.*)\)/,
b = f.match(d),
g = b && b[1] || f,
a = b && b[2],
c, h, e;
if (g === "nth-child") if (a === "even") a = {
wholeValue: a,
a: 2,
b: 0
};
else if (a === "odd") a = {
wholeValue: a,
a: 2,
b: 1
};
else {
d = /([+-]?\d+)?(n)?([+-]?\d+)?/;
b = a.match(d);
c = parseInt(b[1]) || 1;
e = b[2] ? 1 : 0;
h = c && !e ? c : parseInt(b[3]) || 0;
a = {
wholeValue: a,
a: c * e,
b: h
}
}
return {
name: g,
param: a
}
};
this.createReferenceSelector = function (a) {
return new b(a)
};
function b(e) {
this.cursor = null;
this.refersTo = e;
this.inProps = {
id: null,
tag: null,
classes: [],
attributes: [],
pseudos: []
};
this.exProps = {
isEmpty: true
};
var d, b, c = a.exRules;
for (d in c) if (c.hasOwnProperty(d)) {
delete this.exProps.isEmpty;
b = c[d];
switch (b.objType) {
case "array":
this.exProps[b.name] = [];
break;
case "null":
default:
this.exProps[b.name] = null
}
}
}
b.prototype.addPart = function (a, c) {
var b = c.name,
f = c.preFn,
e = c.hintFn,
g = -1;
if (typeof f === "function") a = f(a);
var d = typeof this.inProps[b] !== "undefined" ? this.inProps : this.exProps;
d[b] instanceof Array ? d[b].push(a) : (d[b] = a);
if (typeof e === "function") g = e(a);
return g
};
function g(b, a, c) {
this.index = b === 0 ? 0 : b || NaN;
this.elem = a === null ? null : a || -1;
this.isIdeal = c || false
}
},
a = {
inRules: {
"tag": {
name: "tag",
endsWith: "#.[:",
preFn: function (a) {
return a.toUpperCase()
},
hintFn: function (a) {
return a === "BODY" || a === "HTML" ? document.getElementsByTagName(a)[0] : -1
},
processFn: function (a, b) {
return a.tagName === b
}
},
"#": {
name: "id",
endsWith: "#.[:",
startSkip: 1,
preFn: null,
hintFn: function (a) {
return $ID(a)
},
processFn: function (a, b) {
return a.id === b
}
},
".": {
name: "classes",
endsWith: ".[:",
startSkip: 1,
objType: "array",
processFn: function (d, c) {
var a = d.className;
if (typeof a !== "string") a = d.getAttribute("class");
if (!a || a.length < 1) return false;
var e = " " + a + " ",
b, f = c.length;
for (b = 0; b < f; b++) if (e.indexOf(" " + c[b] + " ") === -1) return false;
return true
}
},
"[": {
name: "attributes",
endsWith: "]",
stopForCombinators: false,
startSkip: 1,
endSkip: 1,
startModifier: '"',
endModifier: '"',
objType: "array",
preFn: d.parseAttribute,
processFn: function (j, g) {
var c, k = g.length,
b, h, i, e, d;
for (c = 0; c < k; c++) {
b = g[c];
h = b.name;
i = b.val;
e = b.delim;
d = f(j, h);
if (d === null) return false;
else if (!e) continue;
else if (!a.attr[e || "unknown"](d, i)) return false
}
return true
}
},
":": {
name: "pseudos",
endsWith: "#.[:)",
startSkip: 1,
startModifier: "(",
endModifier: ")",
objType: "array",
preFn: d.parsePseudo,
processFn: function (f, d) {
var c, e, g = d.length,
b;
for (b = 0; b < g; b++) {
c = d[b];
e = a.pseudo[c.name] || a.pseudo.unknown;
if (!e(f, c)) return false
}
return true
}
}
},
exRules: {},
attr: {
"=": function (a, b) {
return a === b
},
"^=": function (a, b) {
return a.indexOf(b) === 0
},
"$=": function (a, b) {
var c = a.lastIndexOf(b);
return c !== -1 && c + b.length === a.length
},
"*=": function (a, b) {
return a.indexOf(b) !== -1
},
"|=": function (a, b) {
return a === b || a.indexOf(b + "-") === 0
},
"~=": function (a, b) {
return a === b || h(a.split(" "), b)
},
"!=": function (a, b) {
return a !== b
},
"unknown": function () {
return false
}
},
pseudo: {
"first-child": j("previous"),
"last-child": j("next"),
"only-child": function (b) {
return a.pseudo["first-child"](b) && a.pseudo["last-child"](b)
},
"nth-child": function (d, a) {
var e = a.param.a,
f = a.param.b;
return b.nthCacheContains(e, f, c(d))
},
"contains": function (b, a) {
return b.innerHTML.indexOf(a.param) !== -1
},
"unknown": function () {
return false
}
},
combinator: {
" ": function (c, d) {
var a = d.parentNode;
while (a && a !== document) {
if (b.processSelector(c, a)) {
c.cursor = a;
return true
}
a = a.parentNode
}
return false
},
">": function (a, d) {
var c = d.parentNode;
a.cursor = c;
return b.processSelector(a, c)
},
"<": function (d, e) {
var c = e.childNodes,
a, f = c.length;
for (a = 0; a < f; a++) if (b.processSelector(d, c[a])) return true;
return false
},
"~": function (c, d) {
var a = d.previousSibling;
while (a) if (a.nodeType === 1 && b.processSelector(c, a)) {
c.cursor = a;
return true
} else a = a.previousSibling;
return false
},
"+": function (c, d) {
var a = d.previousSibling;
while (a && a.nodeType !== 1) a = a.previousSibling;
c.cursor = a;
return b.processSelector(c, a)
},
",": function () {
return false
}
}
};
Gimme.Selectors = {
addRule: function (b, c) {
a.exRules[b] = c
},
addPseudo: function (b, c) {
a.pseudo[b] = c
},
addAttribute: function (b, c) {
a.attr[b] = c
},
addCombinator: function (b, c) {
a.combinator[b] = c
}
};
d.setRules(a);
Gimme.query = b.query;
Gimme.id = function (a) {
return $ID(a)
};
var g = navigator.userAgent.toLowerCase();
Gimme.Browser = {
isIE: typeof ActiveXObject !== "undefined",
isOpera: typeof window.opera !== "undefined",
isKHTML: g.indexOf("khtml") !== -1,
isGecko: g.indexOf("khtml") === -1 && g.indexOf("gecko") !== -1,
isInIFrame: function () {
try {
return window.frameElement && window.frameElement.tagName === "IFRAME"
} catch (a) {
return true
}
}(),
isInFrameset: window != top,
isInQuirksMode: document.compatMode === "BackCompat",
offsetIncludesBorders: function () {
if (typeof this.value === "undefined") {
var a = document.createElement("div");
a.setAttribute("style", "position:absolute;visibility:hidden;top:0;left:0;border:1px solid #000;");
var b = document.createElement("div");
a.appendChild(b);
document.body.appendChild(a);
this.value = offsetIncludesBorders = b.offsetTop === 1;
document.body.removeChild(a);
a = b = null
}
return this.value
}
};
var o = {
guid: "_$gimme$_guid",
descendant: "_$gimme$_descendant"
},
l = 0;
function c(a) {
if (a === window) return "theWindow";
else if (a === document) return "theDocument";
else if (typeof a.uniqueID !== "undefined") return a.uniqueID;
var b = o.guid;
if (typeof a[b] === "undefined") a[b] = b + l++;
return a[b]
}
var i = function () {
return typeof Array.prototype.indexOf !== "undefined" ? b : a;
function b(b, a) {
return b.indexOf(a)
}
function a(b, c) {
var a, d = b.length;
for (a = 0; a < d; a++) if (b[a] === c) return a;
return -1
}
}();
function h(b, a) {
return i(b, a) !== -1
}
function e(a) {
return a.replace(/^\s+|\s+$/g, "")
}
function n(a) {
return e(a).replace(/\s{2,}/g, " ")
}
var f = function () {
return Gimme.Browser.isIE ? b : a;
function a(b, a) {
return b.getAttribute(a)
}
function b(a, b) {
switch (b.toLowerCase()) {
case "class":
return a.className || null;
case "id":
return a.id || null;
case "href":
case "src":
if (typeof a.getAttribute !== "undefined") return a.getAttribute(b, 2)
}
return a.attributes && a.attributes[b] ? a.attributes[b].nodeValue : a.getAttribute(b)
}
}(),
m = function () {
return typeof document.createElement("div").hasAttribute !== "undefined" ? a : b;
function a(b, a) {
return b.hasAttribute(a)
}
function b(b, a) {
return !!f(b, a)
}
}();
function j(b) {
var a = b + "Sibling";
return function (c) {
var b = c[a];
while (b && b.nodeType !== 1) b = b[a];
return !b
}
}
function k(c, b) {
if (!c) return 0;
if (/px$/.test(c)) return parseInt(c, 10);
if (!b) b = document.body;
var a = document.createElement("div");
a.style.visbility = "hidden";
a.style.position = "absolute";
a.style.lineHeight = "0";
if (/%$/.test(c) || b.tagName === "IMG") {
b = b.parentNode || b;
a.style.height = c
} else {
a.style.borderStyle = "solid";
a.style.borderBottomWidth = "0";
a.style.borderTopWidth = c
}
b.appendChild(a);
var d = a.offsetHeight;
b.removeChild(a);
return d || 0
}
Gimme.Helper = {
getObjectGUID: c,
indexOf: i,
contains: h,
trim: e,
normalize: n,
hasClass: a.inRules["."].processFn,
readAttribute: f,
attrExists: m,
convertToPixels: k
}
})();
function g(a) {
return new Gimme.object(Gimme.query(a))
}
Gimme.object = function (a) {
this.entities = a;
this.length = this.entities.length
};
Gimme.ext = Gimme.object.prototype;
(function () {
var a = Gimme.Helper,
i = a.contains,
k = a.indexOf,
n = a.trim,
h = a.normalize,
d = a.hasClass,
m = a.attrExists,
j = a.readAttribute,
b = a.getObjectGUID,
l = a.convertToPixels;
Gimme.ext.element = function (a) {
return this.entities[a || 0]
};
Gimme.ext.parent = function (a) {
return this.entities[a || 0].parentNode
};
Gimme.ext.addClass = function (b) {
var a = b.split(/\s+/);
this.forEach(function (b) {
g(a).forEach(function (a) {
if (!d(b, [a])) if (b.className === "") b.className = a;
else b.className += " " + a
})
});
return this
};
Gimme.ext.removeClass = function (a) {
return this.swapClass(a, "$1")
};
Gimme.ext.swapClass = function (b, a) {
if (a !== "$1") a = " " + a + " ";
var c = b.split(/\s+/);
this.forEach(function (d) {
var b = d.className;
g(c).forEach(function (c) {
var d = new RegExp("(^| )" + c + "( |$)");
b = b.replace(d, a)
});
d.className = h(b)
});
return this
};
Gimme.ext.hasClass = function (a, b) {
return d(this.entities[b || 0], [a])
};
Gimme.ext.getAncestor = function (b, d) {
var a = this.entities[d || 0],
c = b;
while (c-- > 0) if (a) a = a.parentNode;
else break;
return a
};
Gimme.ext.getSibling = function (b, g) {
var c = this.entities[g || 0];
if (b === 0) return c;
var e = b > 0 ? "nextSibling" : "previousSibling",
a = c,
f = Math.abs(b),
d = 0;
while (d < f) {
a = a[e];
if (!a) break;
if (a.nodeType === 1) d++
}
return a
};
Gimme.ext.select = function (a) {
return new Gimme.object(Gimme.query(a, this.entities[0]))
};
Gimme.ext.setHTML = function (a) {
this.forEach(function (b) {
b.innerHTML = a
});
return this
};
Gimme.ext.getHTML = function (a) {
return this.entities[a || 0].innerHTML
};
Gimme.ext.setValue = function (a) {
this.forEach(function (b) {
if (typeof b.value !== "undefined") b.value = a
});
return this
};
Gimme.ext.getValue = function (a) {
return this.entities[a || 0].value || ""
};
Gimme.ext.readAttribute = function (a, b) {
return j(this.entities[b || 0], a)
};
Gimme.ext.writeAttribute = function (a, b) {
this.forEach(function (c) {
c.setAttribute(a, b)
});
return this
};
Gimme.ext.filter = function (d) {
var b = this.entities,
a = 0,
c = b.length;
while (a < c) if (!d(b[a])) {
b.splice(a, 1);
c--
} else a++;
return this
};
Gimme.ext.iterate = function (b) {
var c = this.entities,
a, e = c.length;
for (a = 0; a < e; a++) {
var d = g(c[a]);
b.call(d, a)
}
b = null;
return this
};
Gimme.ext.getStyle = function (c, p, i) {
var b = this.entities[p || 0];
if (c === "opacity") {
var h = e(b);
if (isNaN(h)) c = h;
else return h
}
if (i !== false) i = true;
var d = "";
if (typeof document.defaultView !== "undefined" && typeof document.defaultView.getComputedStyle !== "undefined") d = document.defaultView.getComputedStyle(b, null);
else if (typeof b.currentStyle !== "undefined") {
d = b.currentStyle;
var k = d[c];
if (k === "auto") {
if (c === "height") {
var f = parseInt(g(b).getStyle("paddingTop")) + parseInt(g(b).getStyle("paddingBottom"));
if (b.clientHeight) return b.clientHeight - f + "px";
else return b.offsetHeight - f - parseInt(g(b).getStyle("borderTopWidth")) - parseInt(g(b).getStyle("borderBottomWidth")) + "px"
}
if (c === "width") {
var f = parseInt(g(b).getStyle("paddingLeft")) + parseInt(g(b).getStyle("paddingRight"));
if (b.clientWidth) return b.clientWidth - f + "px";
else return b.offsetWidth - f - parseInt(g(b).getStyle("borderLeftWidth")) - parseInt(g(b).getStyle("borderRightWidth")) + "px"
}
if (c === "top") return b.offsetTop + "px";
else if (c === "left") return b.offsetLeft + "px";
else if (i && (c === "right" || c === "bottom")) {
var j = {
bottom: ["top", "Height"],
right: ["left", "Width"]
},
n = parseInt(this.getComputedStyle(b, j[c][0], false), 10);
return b.parentNode["client" + j[c][1]] - b["offset" + j[c][1]] - n + "px"
} else return "0px"
}
var o = /(em|ex|%|in|cm|mm|pt|pc|small|medium|large|thin|thick)$/,
m = /border(.*)Width/i,
l = m.test(c) ? c.replace(m, "border$1Style") : null;
if (o.test(k)) if (l !== null && d[l] === "none") return "0px";
else return a.convertToPixels(k, b)
}
return d && d[c]
};
Gimme.ext.setStyle = function (a, b) {
return g(this.entities).setStyles(a, b)
};
Gimme.ext.setStyles = function () {
var b, c, d = arguments,
e = d.length,
a;
if (e % 2 !== 0) return;
this.forEach(function (g) {
for (a = 0; a < e; a += 2) {
b = d[a];
c = d[a + 1];
if (b === "opacity") f(g, c);
else g.style[b] = c
}
});
return this
};
Gimme.ext.addEvent = function () {
if (typeof document.addEventListener !== "undefined") return a;
else if (typeof document.attachEvent !== "undefined") return d;
else return function () {};
function a(b, d, a, e) {
var c = this["on" + b];
if (typeof c === "function" && e !== false) c.call(this, d, a, true);
else this.forEach(function (c) {
c.addEventListener(b, d, a)
});
return this
}
function d(a, d, g, f) {
var e = this["on" + a];
if (typeof e === "function" && f !== false) e.call(this, d, g, true);
else this.forEach(function (f) {
var g = "{" + b(f) + "/" + a + "/" + b(d) + "}",
e = c[g];
if (typeof e !== "undefined") return;
e = function (b) {
b.target = b.srcElement;
if (a == "mouseover") b.relatedTarget = b.fromElement;
else if (a == "mouseout") b.relatedTarget = b.toElement;
b.preventDefault = function () {
b.returnValue = false
};
b.stopPropagation = function () {
b.cancelBubble = true
};
d.call(f, b);
b.target = null;
b.relatedTarget = null;
b.preventDefault = null;
b.stopPropagation = null;
b = null
};
c[g] = e;
f.attachEvent("on" + a, e);
g = null;
e = null
});
return this
}
}();
Gimme.ext.removeEvent = function () {
if (typeof document.removeEventListener !== "undefined") return a;
else if (typeof document.detachEvent !== "undefined") return d;
else return function () {};
function a(b, d, a, e) {
var c = this["on" + b];
if (typeof c === "function" && e !== false) c.call(this, d, a, false);
else this.forEach(function (c) {
c.removeEventListener(b, d, a)
});
return this
}
function d(a, e, g, f) {
var d = this["on" + a];
if (typeof d === "function" && f !== false) d.call(this, e, g, false);
else this.forEach(function (g) {
var d = "{" + b(g) + "/" + a + "/" + b(e) + "}",
f = c[d];
if (typeof f !== "undefined") {
g.detachEvent("on" + a, f);
delete c[d]
}
d = null;
f = null
});
return this
}
}();
Gimme.ext.forEach = function () {
return typeof Array.prototype.forEach !== "undefined" ? b : a;
function b(b, a) {
this.entities.forEach(b, a);
return this
}
function a(e, d) {
var b = this.entities,
a, c, f = b.length;
for (a = 0; a < f; a++) {
c = b[a];
e.call(d, c, a, b)
}
return this
}
}();
Gimme.ext.map = function () {
return typeof Array.prototype.map !== "undefined" ? b : a;
function b(b, a) {
return this.entities.map(b, a)
}
function a(c, b) {
var a = [];
this.forEach(function (d) {
a.push(c.call(b, d))
});
return a
}
}();
Gimme.ext.contains = function (a) {
return i(this.entities, a)
};
Gimme.ext.indexOf = function (a) {
return k(this.entities, a)
};
var c = {},
f = function () {
function c(a, b) {
a.style.opacity = b
}
function d(a, b) {
a.style.filter = "alpha(opacity=" + b * 100 + ")"
}
var a, b = document.createElement("div");
if (typeof b.style.opacity !== "undefined") a = c;
else if (typeof b.style.filter !== "undefined") a = d;
else a = function () {};
b = null;
return a
}(),
e = function () {
function c(a) {
return parseFloat(a.style.opacity) || "opacity"
}
function d(c) {
var b = c.currentStyle.filter,
a = b.match(/pacity\s*=\s*(\d{1,3}.?\d*)\)/);
if (!a) return 1;
else return parseFloat(a[1]) / 100
}
var a, b = document.createElement("div");
if (typeof b.style.opacity !== "undefined") a = c;
else if (typeof b.style.filter !== "undefined") a = d;
else a = function () {};
b = null;
return a
}()
})();
Gimme.Screen = new function () {
this.getViewportSize = function () {
var a = {
width: 0,
height: 0
};
if (typeof window.innerWidth !== "undefined") a = {
width: window.innerWidth,
height: window.innerHeight
};
else if (typeof document.documentElement !== "undefined" && typeof document.documentElement.clientWidth !== "undefined" && document.documentElement.clientWidth !== 0) a = {
width: document.documentElement.clientWidth,
height: document.documentElement.clientHeight
};
else a = {
width: document.getElementsByTagName("body")[0].clientWidth,
height: document.getElementsByTagName("body")[0].clientHeight
};
return a
};
this.getMousePosition = function (a) {
if (!a) a = window.event;
var b = {
x: 0,
y: 0
};
if (typeof a.pageX !== "undefined" && typeof a.x !== "undefined") {
b.x = a.pageX;
b.y = a.pageY
} else {
var c = this.getScrollPosition();
b.x = a.clientX + c.x;
b.y = a.clientY + c.y
}
return b
};
this.getScrollPosition = function () {
var a = {
x: 0,
y: 0
};
if (typeof window.pageYOffset !== "undefined") {
a.x = window.pageXOffset;
a.y = window.pageYOffset
} else if (!Gimme.Browser.isInQuirksMode && typeof document.documentElement.scrollTop !== "undefined") {
a.x = document.documentElement.scrollLeft;
a.y = document.documentElement.scrollTop
} else if (typeof document.body.scrollTop !== "undefined") {
a.x = document.body.scrollLeft;
a.y = document.body.scrollTop
}
return a
}
};
Gimme.ext.getPosition = function (e, j) {
var a = this.entities[j || 0],
f, b, i, h, c = 0,
d = 0;
if (!Gimme.Browser.isOpera && typeof a.getBoundingClientRect !== "undefined") {
h = !Gimme.Browser.isInIFrame && Gimme.Browser.isInFrameset ? 0 : 2;
i = a.getBoundingClientRect();
c = i.left - h;
d = i.top - h;
if (!e) {
b = Gimme.Screen.getScrollPosition();
c += b.x;
d += b.y
} else e = false
} else while (a !== null) {
f = typeof a.scrollTop !== "undefined" && a !== document.body && a !== document.documentElement && a.tagName !== "TEXTAREA" && a.tagName !== "INPUT" ? 1 : 0;
c += a.offsetLeft - f * a.scrollLeft;
d += a.offsetTop - f * a.scrollTop;
a = a.offsetParent;
if (a && !Gimme.Browser.offsetIncludesBorders()) {
c += parseInt(g(a).getStyle("borderLeftWidth")) || 0;
d += parseInt(g(a).getStyle("borderTopWidth")) || 0
}
}
if (e) {
b = Gimme.Screen.getScrollPosition();
c -= b.x;
d -= b.y
}
return {
x: c,
y: d
}
};
Gimme.ext.getScreenPosition = function (a) {
return this.getPosition(true, a)
};
Gimme.ext.getPagePosition = function (a) {
return this.getPosition(false, a)
};
Gimme.ext.getComputedPosition = function (b) {
var a = this.entities[b || 0];
return {
x: parseInt(g(a).getStyle("left"), 10),
y: parseInt(g(a).getStyle("top"), 10)
}
};
Gimme.Util = new function () {
this.setTimeout = function () {
return a(arguments, false)
};
this.setInterval = function () {
return a(arguments, true)
};
function a(a, c) {
var e = a[0],
b = a[1];
function d() {
e.apply(this, Array.prototype.slice.call(a, 2));
if (!c) e = null
}
if (c === true) return window.setInterval(d, b);
else return window.setTimeout(d, b)
}
};
Gimme.Animation = new function () {
var a = {},
b = false;
this.Speeds = {
snail: 2000,
turtle: 1250,
slowly: 1250,
rabbit: 1000,
greyhound: 750,
quickly: 750,
cheetah: 500,
lightning: 250
};
this.Directions = {
vertically: 1,
horizontally: 2,
both: 3
};
this.start = function (b, f, e) {
var c = setInterval(f, e),
d = a[b];
if (typeof d === "undefined") a[b] = {
iids: [c],
callback: null
};
else d.iids.push(c)
};
this.end = function () {
var c, e = arguments.length;
for (c = 0; c < e; c++) {
var d = arguments[c],
b = a[d];
if (typeof b !== "undefined") {
g(b.iids).forEach(function (a) {
clearTimeout(a)
});
if (typeof b.callback === "function") {
b.callback.call();
b.callback = null
}
delete a[d]
}
}
};
this.isRunning = function (b) {
return typeof a[b] !== "undefined"
};
this.whenDone = function (c, b) {
var d = a[c];
if (typeof d === "undefined") a[c] = {
iids: [],
callback: b
};
else d.callback = b
};
this.startGroup = function () {
b = true
};
this.endGroup = function () {
b = false
};
this.isGrouping = function () {
return b === true
}
};
Gimme.Animation.BezierCurve = function () {
this.points = [];
this.args = arguments
};
Gimme.Animation.BezierCurve.prototype.initialize = function () {
var d = this.args,
h = d.length,
g = d[h - 1] || 100,
k = h - 1,
e, f, b, c, a;
for (e = 0; e < k; e++) {
a = d[e];
c = i(a.length);
b = a.length - 1;
for (f = 0; f <= g; f++) this.points.push(j(f / g))
}
this.args = d = null;
return g;
function j(j) {
var d, h = 0,
i = 0;
for (d = 0; d <= b; d++) {
var f = c[b] / (c[d] * c[b - d]),
e = Math.pow(1 - j, b - d),
g = Math.pow(j, d);
h += f * a[d].x * e * g;
i += f * a[d].y * e * g
}
return {
x: h,
y: i
}
}
function i(d) {
var a, c = 1,
b = [1];
for (a = 1; a <= d; a++) {
c *= a;
b.push(c)
}
return b
}
};
Gimme.Animation.BezierCurve.prototype.getPoint = function (c) {
var a = this.points.length;
if (a === 0) a = this.initialize();
var b = Math.floor(c * a);
if (b > a - 1) b = a - 1;
return this.points[b]
};
Gimme.Animation.AccelerationLine = function (a, c) {
var d = a[a.length - 1],
b = g(a).map(function (a) {
return {
x: a / d,
y: 0
}
});
this.bezier = new Gimme.Animation.BezierCurve(b, c);
this.points = this.bezier.points
};
Gimme.Animation.AccelerationLine.prototype.getValue = function (a) {
return this.bezier.getPoint(a).x
};
Gimme.Animation.AccelerationLines = {
zoom: new Gimme.Animation.AccelerationLine([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520], 75),
slowStartAccelerate: new Gimme.Animation.AccelerationLine([0, 1, 2, 3, 8, 50], 100),
quickStartDecelerate: new Gimme.Animation.AccelerationLine([0, 50, 55, 56, 57, 58], 100),
linear: new Gimme.Animation.AccelerationLine([0, 10], 100)
};
Gimme.Animation.AccelerationLines.defaultLine = Gimme.Animation.AccelerationLines.zoom;
Gimme.ext.fadeIn = function (b, c, a) {
g(this.entities).fadeTo(null, .99999, b, c, a);
a = null;
return this
};
Gimme.ext.fadeOut = function (b, c, a) {
g(this.entities).fadeTo(null, 0, b, c, a);
a = null;
return this
};
Gimme.ext.fadeTo = function (b, c, e, h, d, a) {
a = a || Gimme.Animation.AccelerationLines.linear;
g(this.entities).animate(a, e, h, d, f, i);
function i(d) {
d.style.zoom = "1";
var a = b === 0 ? 0 : b || Number(g(d).getStyle("opacity")),
e = c - a;
return {
startOpacity: a,
deltaO: e
}
}
function f(e, b, c, a) {
var f = c.getValue(b),
d = a.startOpacity + f * a.deltaO;
g(e).setStyle("opacity", d)
}
return this
};
Gimme.ext.veil = function (b, d, h, c, e) {
var a = Gimme.Animation.Directions;
b = Math.floor(b) || a[b] || a.vertically;
g(this.entities).animate(e, d, h, c, f, i);
function i(d) {
var e = d.style.display || g(d).getStyle("display");
if (e === "none") return false;
var c = function (b) {
var a = {};
g(b).forEach(function (b) {
a[b] = parseInt(g(d).getStyle(b), 10)
});
return a
}(["height", "width", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft"]);
d["_$gimme$_veil"] = c.height + ";" + c.width + ";" + c.paddingTop + ";" + c.paddingRight + ";" + c.paddingBottom + ";" + c.paddingLeft;
d.style.overflow = "hidden";
if ((b & a.horizontally) === a.horizontally) d.style.height = c.height + "px";
return c
}
function f(d, g, m, c) {
if (g >= 1) d.style.display = "none";
var e = m.getValue(g),
k, l, j, h, f, i;
if ((b & a.vertically) === a.vertically) {
k = c.height - e * c.height;
j = c.paddingTop - e * c.paddingTop;
f = c.paddingBottom - e * c.paddingBottom;
d.style.height = k + "px";
d.style.paddingTop = j + "px";
d.style.paddingBottom = f + "px"
}
if ((b & a.horizontally) === a.horizontally) {
l = c.width - e * c.width;
h = c.paddingRight - e * c.paddingRight;
i = c.paddingLeft - e * c.paddingLeft;
d.style.width = l + "px";
d.style.paddingRight = h + "px";
d.style.paddingLeft = i + "px"
}
}
return this
};
Gimme.ext.unveil = function (b, e, i, d, f) {
var a = Gimme.Animation.Directions;
b = Math.floor(b) || a[b] || a.vertically;
var c = true;
g(this.entities).animate(f, e, i, d, h, j);
function j(b) {
var l = b.style.display || g(b).getStyle("display");
if (l !== "none" && l !== null) return false;
var m = Gimme.Helper.convertToPixels,
d = b.cloneNode(true);
d.setAttribute("style", "position:absolute;top:0;left:0;visibility:hidden;margin:0;padding:0;border:0;height:;width:;");
d.style.display = "block";
b.parentNode.appendChild(d);
var j, k, i, f, e, h, a = b["_$gimme$_veil"];
if (a) {
a = a.split(";");
j = a[0];
k = a[1];
i = a[2];
f = a[3];
e = a[4];
h = a[5]
} else {
var c = g(d);
j = parseInt(m(b.style.height), 10) || parseInt(c.getStyle("height"), 10);
k = parseInt(m(b.style.width), 10) || parseInt(c.getStyle("width"), 10);
d.style.padding = "";
i = parseInt(c.getStyle("paddingTop"), 10);
e = parseInt(c.getStyle("paddingBottom"), 10);
f = parseInt(c.getStyle("paddingRight"), 10);
h = parseInt(c.getStyle("paddingLeft"), 10)
}
b.parentNode.removeChild(d);
b.style.overflow = "hidden";
return {
deltaH: j,
deltaW: k,
paddingTop: i,
paddingBottom: e,
paddingLeft: h,
paddingRight: f
}
}
function h(h, j, p, d) {
var n, o, m, i, k, l, f = g(h),
e = 1 - p.getValue(j);
if (c) {
h.style.display = "block";
c = false
}
if (j >= 1) h.style.overflow = "";
if (b === a.vertically) f.setStyles("width", d.deltaW + "px", "paddingRight", d.paddingRight + "px", "paddingLeft", d.paddingLeft + "px");
else if (b === a.horizontally) f.setStyles("height", d.deltaH + "px", "paddingTop", d.paddingTop + "px", "paddingBottom", d.paddingBottom + "px");
if ((b & a.vertically) === a.vertically) {
n = d.deltaH - e * d.deltaH;
m = d.paddingTop - e * d.paddingTop;
i = d.paddingBottom - e * d.paddingBottom;
f.setStyles("height", n + "px", "paddingTop", m + "px", "paddingBottom", i + "px")
}
if ((b & a.horizontally) === a.horizontally) {
o = d.deltaW - e * d.deltaW;
k = d.paddingRight - e * d.paddingRight;
l = d.paddingLeft - e * d.paddingLeft;
f.setStyles("width", o + "px", "paddingRight", k + "px", "paddingLeft", l + "px")
}
}
return this
};
Gimme.ext.scrollTo = function (b, e, a, c) {
g(this.entities[0]).animate(c, b, e, a, d, f);
function f(c) {
var a = Gimme.Screen.getScrollPosition(),
b = g(c).getPagePosition().y - a.y;
return {
scrollPos: a,
deltaY: b
}
}
function d(f, b, c, a) {
var d = c.getValue(b),
e = a.scrollPos.y + d * a.deltaY;
window.scrollTo(0, Math.floor(e))
}
return this
};
Gimme.ext.slideToPoint = function (a, c, f, b, d) {
g(this.entities).animate(d, c, f, b, e, h);
function h(e) {
var b = g(e).getComputedPosition();
if (a.x === null) a.x = b.x;
if (a.y === null) a.y = b.y;
var d = a.y - b.y,
c = a.x - b.x;
return {
startPt: b,
deltaX: c,
deltaY: d
}
}
function e(c, e, f, a) {
var b = a.startPt,
g = a.deltaX,
h = a.deltaY,
d = f.getValue(e),
i = b.x + d * g,
j = b.y + d * h;
c.style.top = Math.floor(Math.round(j)) + "px";
c.style.left = Math.floor(Math.round(i)) + "px"
}
return this
};
Gimme.ext.followPath = function (f, a, d, e, c) {
a = a || 1;
g(this.entities).animate(f, d, e, c, b, h);
function h(b) {
var a = g(b).getComputedPosition();
return {
startPt: a
}
}
function b(c, e, g, f) {
var b = f.startPt,
d = g.getPoint(e),
h = b.x + d.x * a,
i = b.y + d.y * a;
c.style.top = Math.floor(Math.round(i)) + "px";
c.style.left = Math.floor(Math.round(h)) + "px"
}
return this
};
Gimme.ext.animate = function (d, b, a, h, c, e) {
var f = this.entities.length;
if (f < 1) return;
d = d || Gimme.Animation.AccelerationLines.defaultLine;
b = Math.floor(b) || Gimme.Animation.Speeds[b] || Gimme.Animation.Speeds.quickly;
a = a || "AUTOGUID_" + Math.random((new Date).getTime());
if (!Gimme.Animation.isGrouping() && Gimme.Animation.isRunning(a)) return;
Gimme.Animation.whenDone(a, h);
var g = 0,
j = (new Date).getTime();
this.forEach(function (c, b) {
Gimme.Animation.start(a, i(c, b), 1)
});
function i(i) {
var h = e(i),
l = function () {
var l = (new Date).getTime(),
k = (l - j) / b;
if (k >= 1) {
if (typeof c === "function") c(i, 1, d, h);
if (++g === f) {
Gimme.Animation.end(a);
e = null;
c = null
}
} else c(i, k, d, h)
},
k = function () {
Gimme.Animation.end(a)
};
return h ? l : k
}
};
Gimme.Events = new function () {
var c = {},
b = null,
a = null;
this.captureMouse = function (c) {
Gimme.Events.releaseMouse();
b = c;
if (typeof c.setCapture !== "undefined") c.setCapture();
else {
a = function (b) {
b.stopPropagation();
var d, e;
if (Gimme.Browser.isGecko) {
d = document.createEvent("MouseEvents");
d.initMouseEvent(b.type, b.bubbles, b.cancelable, window, b.detail, b.screenX, b.screenY, b.clientX, b.clientY, b.ctrlKey, b.altKey, b.shiftKey, b.metaKey, b.button, b.relatedTarget);
e = Gimme.Screen.getScrollPosition();
d.__defineGetter__("pageX", function () {
return this.clientX + e.x
});
d.__defineGetter__("pageY", function () {
return this.clientY + e.y
})
} else d = b;
document.removeEventListener(b.type, a, true);
d.captureTarget = b.target;
c.dispatchEvent(d);
if (a !== null) document.addEventListener(b.type, a, true);
delete d.captureTarget
};
document.addEventListener("mouseover", a, true);
document.addEventListener("mouseout", a, true);
document.addEventListener("mousemove", a, true);
document.addEventListener("mouseup", a, true);
document.addEventListener("mousedown", a, true);
document.addEventListener("click", a, true);
document.addEventListener("dblclick", a, true)
}
return this
};
this.releaseMouse = function () {
if (b !== null) {
if (typeof b.releaseCapture !== "undefined") b.releaseCapture();
else {
document.removeEventListener("mouseover", a, true);
document.removeEventListener("mouseout", a, true);
document.removeEventListener("mousemove", a, true);
document.removeEventListener("mouseup", a, true);
document.removeEventListener("mousedown", a, true);
document.removeEventListener("click", a, true);
document.removeEventListener("dblclick", a, true)
}
b = a = null
}
return this
};
this.getCaptureTarget = function (a) {
return a.captureTarget || a.srcElement || a.target
};
Gimme.ext.onmouseenter = function (e, b, c) {
var a = d(e);
c ? this.addEvent("mouseover", a, b, false) : this.removeEvent("mouseover", a, b, false);
a = null
};
Gimme.ext.onmouseleave = function (e, b, c) {
var a = d(e);
c ? this.addEvent("mouseout", a, b, false) : this.removeEvent("mouseout", a, b, false);
a = null
};
Gimme.ext.onmousewheel = function (d, c, e) {
var a = "mousewheel",
b = d;
if (Gimme.Browser.isGecko) {
a = "DOMMouseScroll";
b = f(d)
}
e ? this.addEvent(a, b, c, false) : this.removeEvent(a, b, c, false)
};
function e(c, a, b) {
if (c === a) return false;
var d = 0;
while (a && a != c) {
d++;
a = a.parentNode
}
b = b || d;
return a === c && b === d
}
function d(b) {
var d = Gimme.Helper.getObjectGUID(b),
a = c[d];
if (typeof a === "undefined") a = c[d] = function (c) {
var a = c.relatedTarget;
if (this === a || e(this, a)) return;
b.call(this, c)
};
return a
}
function f(b) {
var d = Gimme.Helper.getObjectGUID(b),
a = c[d];
if (typeof a === "undefined") a = c[d] = function (a) {
a.wheelDelta = -a.detail;
b.call(this, a);
a.wheelDelta = null
};
return a
}
};
Gimme.ver = "Gimme v2.0.0.3 (Caspian) :: 12/2/2008, 9:57:48";
Gimme.ext.getRelativePosition = function (d, e) {
var a = this.entities[e || 0],
b = 0,
c = 0;
while (a !== null && a !== d) {
b += a.offsetLeft;
c += a.offsetTop;
a = a.offsetParent
}
return {
x: b,
y: c
}
};
Gimme.ext.addShim = function (d, e) {
var b = this.entities[0];
if (b.shim) {
b.shim.parentNode.removeChild(b.shim);
b.shim = null
}
var a = document.createElement("iframe");
a.frameBorder = "0";
a.scrolling = "no";
a.className = "iframeShim";
a.style.position = "absolute";
a.style.zIndex = e || "1";
a.style.background = "#fff";
a.style.height = b.offsetHeight + "px";
a.style.width = b.offsetWidth + "px";
var c = g(b);
a.style.top = c.getStyle("top");
a.style.left = c.getStyle("left");
a.style.marginTop = c.getStyle("marginTop");
a.style.marginLeft = c.getStyle("marginLeft");
a.style.marginRight = c.getStyle("marginRight");
a.style.marginBottom = c.getStyle("marginBottom");
this.entities.push(a);
d = d || b;
(d.parentNode || document.body).insertBefore(a, d);
b.shim = a;
return this
};
Gimme.ext.removeShim = function () {
var b = this.entities[0],
a = b.shim;
if (a) {
a.parentNode.removeChild(a);
b.shim = null
}
return this
};
Gimme.ext.toggle = function (a) {
if (a !== true) a = false;
this.forEach(function (c) {
var b = g(c);
if (a) b.setStyle("visibility", b.getStyle("visibility") === "visible" ? "hidden" : "visible");
else b.setStyle("display", b.getStyle("display") !== "none" ? "none" : "block")
});
return this
};
function MVC_Init_AbstractView_Shared() {
Msn.MVC.AbstractView.prototype.GetMoveMenuOptionAsHtml = function (a) {
return a
}
}
function MVC_Init_View3D_Shared() {
Msn.MVC.View3D.prototype.GetMoveMenuOptionAsHtml = function (d, c) {
var e = c.GetPrimitiveCount();
for (var a = 0; a < e; a++) {
var b = c.GetPrimitive(a).type;
if (b == VEShapeType.Polyline || b == VEShapeType.Polygon) return ""
}
return d
}
}
function MVC_Init_ViewFacade_Shared() {
Msn.MVC.ViewFacade.prototype.GetMoveMenuOptionAsHtml = function (a, b) {
if (this._curMvcView == null) return "";
return this._curMvcView.GetMoveMenuOptionAsHtml(a, b)
}
}
function VE_SelectItem(b, a) {
this.data = b;
this.description = a
}
VE_SelectItem.prototype.toString = function () {
return this.description
};
function VE_Select(h, l, k, j) {
this.isVisible = false;
var b = [],
a = document.createElement("div");
a.setAttribute("id", h);
this.id = h;
var v = h,
d = this,
c = -1,
r = k ? k : "",
m = l ? l : "",
p = j ? j : "",
e = "";
function y(d) {
if (!(d instanceof VE_SelectItem)) d = new VE_SelectItem(d, d.toString());
b.push(d);
var c = document.createElement("div");
c.setAttribute("id", v + "_" + (b.length - 1));
c.onclick = w;
c.onmouseover = q;
c.onmouseout = s;
c.innerHTML = d.description;
a.appendChild(c)
}
function x() {
return b.length
}
function u() {
return a
}
function w(e) {
var c = GetTarget(e),
a = f(c);
i(a);
if (d.OnClick) d.OnClick(a, b[a]);
if (d.OnSelect) d.OnSelect(a, b[a])
}
function q(g) {
var a = GetTarget(g),
c = f(a);
e = a.className;
a.className = p;
if (d.OnMouseOver) d.OnMouseOver(c, b[c])
}
function s(g) {
var a = GetTarget(g),
c = f(a);
a.className = e;
if (d.OnMouseOut) d.OnMouseOut(c, b[c])
}
function i(d) {
if (d >= 0 && d < b.length) {
var f = g();
if (f >= 0) a.childNodes[f].className = m;
c = d;
a.childNodes[d].className = r;
e = a.childNodes[d].className
} else {
var f = g();
if (f >= 0) a.childNodes[f].className = m;
c = -1
}
}
function g() {
return c
}
function o() {
if (c >= 0 && c < b.length) return b[c];
return null
}
function n(d) {
if (d < 0 || d >= b.length) return;
if (d < c) c -= 1;
else if (d == c) c = -1;
b.splice(d, 1);
a.removeChild(a.childNodes[d])
}
function f(c) {
for (var b = 0; b < a.childNodes.length; ++b) if (c == a.childNodes[b]) return b;
return -1
}
function t() {
while (b.length > 0) b.pop();
while (a.childNodes.length > 0) a.removeChild(a.lastChild);
c = -1
}
function A() {
a.style.display = "block";
this.isVisible = true
}
function z() {
a.style.display = "none";
this.isVisible = false
}
this.OnClick = null;
this.GetCount = x;
this.GetElement = u;
this.GetSelectedIndex = g;
this.GetSelectedItem = o;
this.SelectItemAtIndex = i;
this.OnSelect = null;
this.AddItem = y;
this.OnMouseOver = null;
this.OnSelect = null;
this.OnMouseOut = null;
this.ClearItems = t;
this.RemoveItemAtIndex = n;
this.Show = A;
this.Hide = z
}
function DecodeHtml(a) {
var c = "";
if (typeof a == "string" && a.length > 0) {
var b = document.createElement("span");
b.innerHTML = a;
c = b.firstChild.nodeValue;
b = null
}
return c
}
function OutputEncoder_URLEncodeUTF8(e) {
if (e == null) return "";
var d = ["%00", "%01", "%02", "%03", "%04", "%05", "%06", "%07", "%08", "%09", "%0a", "%0b", "%0c", "%0d", "%0e", "%0f", "%10", "%11", "%12", "%13", "%14", "%15", "%16", "%17", "%18", "%19", "%1a", "%1b", "%1c", "%1d", "%1e", "%1f", "%20", "%21", "%22", "%23", "%24", "%25", "%26", "%27", "%28", "%29", "%2a", "%2b", "%2c", "%2d", "%2e", "%2f", "%30", "%31", "%32", "%33", "%34", "%35", "%36", "%37", "%38", "%39", "%3a", "%3b", "%3c", "%3d", "%3e", "%3f", "%40", "%41", "%42", "%43", "%44", "%45", "%46", "%47", "%48", "%49", "%4a", "%4b", "%4c", "%4d", "%4e", "%4f", "%50", "%51", "%52", "%53", "%54", "%55", "%56", "%57", "%58", "%59", "%5a", "%5b", "%5c", "%5d", "%5e", "%5f", "%60", "%61", "%62", "%63", "%64", "%65", "%66", "%67", "%68", "%69", "%6a", "%6b", "%6c", "%6d", "%6e", "%6f", "%70", "%71", "%72", "%73", "%74", "%75", "%76", "%77", "%78", "%79", "%7a", "%7b", "%7c", "%7d", "%7e", "%7f", "%80", "%81", "%82", "%83", "%84", "%85", "%86", "%87", "%88", "%89", "%8a", "%8b", "%8c", "%8d", "%8e", "%8f", "%90", "%91", "%92", "%93", "%94", "%95", "%96", "%97", "%98", "%99", "%9a", "%9b", "%9c", "%9d", "%9e", "%9f", "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%a7", "%a8", "%a9", "%aa", "%ab", "%ac", "%ad", "%ae", "%af", "%b0", "%b1", "%b2", "%b3", "%b4", "%b5", "%b6", "%b7", "%b8", "%b9", "%ba", "%bb", "%bc", "%bd", "%be", "%bf", "%c0", "%c1", "%c2", "%c3", "%c4", "%c5", "%c6", "%c7", "%c8", "%c9", "%ca", "%cb", "%cc", "%cd", "%ce", "%cf", "%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", "%d8", "%d9", "%da", "%db", "%dc", "%dd", "%de", "%df", "%e0", "%e1", "%e2", "%e3", "%e4", "%e5", "%e6", "%e7", "%e8", "%e9", "%ea", "%eb", "%ec", "%ed", "%ee", "%ef", "%f0", "%f1", "%f2", "%f3", "%f4", "%f5", "%f6", "%f7", "%f8", "%f9", "%fa", "%fb", "%fc", "%fd", "%fe", "%ff"],
b, a = [],
g = e.length;
for (var f = 0; f < g; f++) {
var c = e.charCodeAt(f),
b = e.charAt(f);
if ("A" <= b && b <= "Z") a = a + b;
else if ("a" <= b && b <= "z") a = a + b;
else if ("0" <= b && b <= "9") a = a + b;
else if (b == " ") a = a + "+";
else if (b == "-" || b == "_" || b == "." || b == "!" || b == "~" || b == "*" || b == "'" || b == "(" || b == ")") a = a + String.fromCharCode(c);
else if (c <= 127) a = a + d[c];
else if (c <= 2047) {
a = a + d[192 | c >> 6];
a = a + d[128 | c & 63]
} else {
a = a + d[224 | c >> 12];
a = a + d[128 | c >> 6 & 63];
a = a + d[128 | c & 63]
}
}
return a
}
function OutputEncoder_URLEncodeEscapeUTF8(e) {
if (e == null) return "";
var d = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "0a", "0b", "0c", "0d", "0e", "0f", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1a", "1b", "1c", "1d", "1e", "1f", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "2a", "2b", "2c", "2d", "2e", "2f", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "3a", "3b", "3c", "3d", "3e", "3f", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "4a", "4b", "4c", "4d", "4e", "4f", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "5a", "5b", "5c", "5d", "5e", "5f", "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "6a", "6b", "6c", "6d", "6e", "6f", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "7a", "7b", "7c", "7d", "7e", "7f", "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "8a", "8b", "8c", "8d", "8e", "8f", "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "9a", "9b", "9c", "9d", "9e", "9f", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "aa", "ab", "ac", "ad", "ae", "af", "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8", "b9", "ba", "bb", "bc", "bd", "be", "bf", "c0", "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "ca", "cb", "cc", "cd", "ce", "cf", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "da", "db", "dc", "dd", "de", "df", "e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7", "e8", "e9", "ea", "eb", "ec", "ed", "ee", "ef", "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "fa", "fb", "fc", "fd", "fe", "ff"],
b, a = [],
g = e.length;
for (var f = 0; f < g; f++) {
var c = e.charCodeAt(f),
b = e.charAt(f);
if ("A" <= b && b <= "Z") a = a + b;
else if ("a" <= b && b <= "z") a = a + b;
else if ("0" <= b && b <= "9") a = a + b;
else if (b == " ") a = a + "+";
else if (b == "-" || b == "_" || b == "." || b == "!" || b == "~" || b == "*" || b == "'" || b == "(" || b == ")") a = a + String.fromCharCode(c);
else if (c <= 127) a = a + "%" + d[c];
else if (c <= 2047) {
a = a + "%25" + d[192 | c >> 6];
a = a + "%25" + d[128 | c & 63]
} else {
a = a + "%25" + d[224 | c >> 12];
a = a + "%25" + d[128 | c >> 6 & 63];
a = a + "%25" + d[128 | c & 63]
}
}
return a
}
function OutputEncoder_EncodeHtml(c) {
var a, b = "";
if (c == null) return "";
for (var d = 0; d < c.length; d++) {
a = c.charCodeAt(d);
if (a > 96 && a < 123 || a > 64 && a < 91 || a == 32 || a > 47 && a < 58 || a == 46 || a == 44 || a == 45 || a == 95) b = b + String.fromCharCode(a);
else b = b + "" + a + ";"
}
return b
}
function OutputEncoder_EncodeHtmlAttribute(c) {
var a, b = "";
if (c == null) return "";
for (var d = 0; d < c.length; d++) {
a = c.charCodeAt(d);
if (a > 96 && a < 123 || a > 64 && a < 91 || a > 47 && a < 58 || a == 46 || a == 44 || a == 45 || a == 95) b = b + String.fromCharCode(a);
else b = b + "" + a + ";"
}
return b
}
function OutputEncoder_EncodeXml(a) {
return OutputEncoder_EncodeHtml(a)
}
function OutputEncoder_EncodeXmlAttribute(a) {
return OutputEncoder_EncodeHtmlAttribute(a)
}
function OutputEncoder_EncodeJs(c) {
var a, b = "";
if (c == null) return "";
for (var d = 0; d < c.length; d++) {
a = c.charCodeAt(d);
if (a > 96 && a < 123 || a > 64 && a < 91 || a == 32 || a > 47 && a < 58 || a == 46 || a == 44 || a == 45 || a == 95) b = b + String.fromCharCode(a);
else if (a > 127) b = b + "\\u" + OutputEncoder_TwoByteHex(a);
else b = b + "\\x" + OutputEncoder_SingleByteHex(a)
}
return "'" + b + "'"
}
function OutputEncoder_EncodeVbs(d) {
var b, a = "",
c = false;
if (d == null) return "";
for (var e = 0; e < d.length; e++) {
b = d.charCodeAt(e);
if (b > 96 && b < 123 || b > 64 && b < 91 || b == 32 || b > 47 && b < 58 || b == 46 || b == 44 || b == 45 || b == 95) {
if (!c) {
a = a + '&"';
c = true
}
a = a + String.fromCharCode(b)
} else {
if (c) {
a = a + '"';
c = false
}
a = a + "&chrw(" + b + ")"
}
}
if (a.charAt(0) == "&") a = a.substring(1);
if (a.length == 0) a = '""';
if (c) a = a + '"';
return a
}
function OutputEncoder_AsUrl(a) {
if (a == null) return "";
if (a.search(/^(?:http|https|ftp):\/\/[a-zA-Z0-9\.\-]+(?:\:\d{1,5})?(?:[A-Za-z0-9\.\;\:\@\&\=\+\$\,\?\/]|%u[0-9A-Fa-f]{4}|%[0-9A-Fa-f]{2})*$/i)) throw "Unsanitized value passed to AsUrl";
return a
}
function OutputEncoder_QualifyUrl(a) {
if (a == null) return "";
if (a.search(/^(?:http|https|ftp):\/\//i)) if (document.location.protocol == "HTTPS") return "https://" + document.location.hostname + OutputEncoder_QualifyUrl_MakePath(a);
else return "http://" + document.location.hostname + OutputEncoder_QualifyUrl_MakePath(a);
else return a
}
function OutputEncoder_QualifyUrl_MakePath(a) {
if (a == null) return "";
if (!a.search(/^[\/\\]/)) return a;
var b = /^(\/(?:.*\/|))(?:[^\/\\]*\.\w+|\w*)$/;
if (!document.location.pathname.search(b)) {
var c = b.exec(document.location.pathname);
return c[1] + a
}
return "/" + a
}
function OutputEncoder_AsNumeric(a) {
if (a == null) return "";
if (isNaN(parseFloat(a))) throw "IOSec.AsNumeric(): Error input [" + a + "] not a valid number.";
return a
}
function OutputEncode_TruncateUrlSafe(a, b, e) {
if (a.length <= b) return a;
var d = "";
if (e && e.length > 0) {
d = OutputEncoder_EncodeUrl(e);
b -= d.length
}
var a = a.substring(0, b);
for (var c = 1; c < 6; c++) if (a.charAt(b - c) == "%") {
a = a.substring(0, b - c);
break
}
return a + d
}
function OutputEncode_EncodeUrlDelims(f, c) {
if (!f) return c;
var a, h, b = "";
for (var d = 0; d < c.length; d++) {
a = c.charCodeAt(d);
if (37 == a) {
b = b + "%" + OutputEncoder_SingleByteHex(a);
continue
}
var e = c.charAt(d);
for (var g = 0; g < f.length; g++) {
h = f.charCodeAt(g);
if (h == a) {
if (a > 127) e = "%u" + OutputEncoder_TwoByteHex(a);
else e = "%" + OutputEncoder_SingleByteHex(a);
break
}
}
b += e
}
return b
}
function OutputEncoder_EncodeUrl(c) {
if (c == null) return "";
var a, e = c.length,
b = new Array(e);
for (var d = 0; d < e; ++d) {
a = c.charCodeAt(d);
if (a > 96 && a < 123 || a > 64 && a < 91 || a > 47 && a < 58 || a == 46 || a == 45 || a == 95) b.push(String.fromCharCode(a));
else if (a > 127) {
b.push("%u");
b.push(OutputEncoder_TwoByteHex(a))
} else {
b.push("%");
b.push(OutputEncoder_SingleByteHex(a))
}
}
return b.join("")
}
function OutputEncoder_SingleByteHex(b) {
if (b == null) return "";
var a = b.toString(16);
for (var c = a.length; c < 2; c++) a = "0" + a;
return a
}
function OutputEncoder_TwoByteHex(b) {
if (b == null) return "";
var a = b.toString(16);
for (var c = a.length; c < 4; c++) a = "0" + a;
return a
}
function GetValidatedUrl(a) {
if (a == null || a == "undefined" || a.length <= 0) return "";
try {
a = unescape(a);
a = a.replace(/\|/g, " ").replace(/\^/g, " ").replace(/^\s+/g, "").replace(/\s+$/g, "");
var b = new RegExp(/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/);
if (a.match(b)) return a;
else return ""
} catch (c) {
return ""
}
}
function OutputEncoder() {
this.GetValidatedUrl = GetValidatedUrl;
this.EncodeHtml = OutputEncoder_EncodeHtml;
this.EncodeHtmlAttribute = OutputEncoder_EncodeHtmlAttribute;
this.EncodeXml = OutputEncoder_EncodeXml;
this.EncodeXmlAttribute = OutputEncoder_EncodeXmlAttribute;
this.EncodeJs = OutputEncoder_EncodeJs;
this.EncodeVbs = OutputEncoder_EncodeVbs;
this.AsNumeric = OutputEncoder_AsNumeric;
this.EncodeUrl = OutputEncoder_EncodeUrl;
this.EncodeUrlDelims = OutputEncode_EncodeUrlDelims;
this.TruncateUrlSafe = OutputEncode_TruncateUrlSafe;
this.SingleByteHex = OutputEncoder_SingleByteHex;
this.TwoByteHex = OutputEncoder_TwoByteHex;
this.AsUrl = OutputEncoder_AsUrl;
this.QualifyUrl = OutputEncoder_QualifyUrl;
this.EncodeUrlUTF8 = OutputEncoder_URLEncodeUTF8;
this.EncodeUrlEscapeUTF8 = OutputEncoder_URLEncodeEscapeUTF8;
this.DecodeHtml = DecodeHtml
}
var IOSec = new OutputEncoder;
function VE_Panel(c, q, r, o, m, f, d, n, p, l, s, t, e, h, i, j) {
var b = this;
this.index = 0;
this.x = q;
this.y = r;
this.width = o;
this.height = m;
this.dynamicHeightMax = 600;
this.color = f;
this.sPanel = null;
this.toolbarHeight = 20;
this.footerHeight = 20;
this.min = false;
this.visible = true;
this.onTitleClick = null;
this.onCloseClick = null;
this.onMaximize = null;
this.onMinimize = null;
this.isLegacyPanel = h == true;
this.usesShimIn3D = !this.isLegacyPanel;
if (!e) e = document.body;
var a = null;
if (!this.isLegacyPanel) {
a = VE_Panel._CreateElement("div", c, "VE_Panel_el", d);
this.el = a;
this.titleDisabled = false;
this.title = document.createElement("a");
this.title.id = c + "_title";
this.title.className = "VE_Panel_title";
this.title.appendChild(document.createElement("span"));
this.title.onclick = function (a) {
VE_Panel._OnTitleClick(a);
return false
};
this.title.href = "#";
a.appendChild(this.title);
this.SetTitle(n);
this.closeboxDisabled = false;
this.cb = VE_Panel._CreateElement("a", c + "_cb", "VE_Panel_cb VE_Panel_cb_" + f, d + 1);
this.cb.onclick = function (a) {
VE_Panel._OnCloseClick(a);
return false
};
this.cb.onmouseover = function () {
if (typeof Msn.VE.Css != "undefined") Msn.VE.Css.Functions.addClass(b.title, "VE_Panel_title_hover")
};
this.cb.onmouseout = function () {
if (typeof Msn.VE.Css != "undefined") Msn.VE.Css.Functions.removeClass(b.title, "VE_Panel_title_hover")
};
this.cb.href = "#";
this.cb.unselectable = "on";
a.appendChild(this.cb);
this.tb = VE_Panel._CreateElement("div", c + "_tb", "toolbar", d + 1);
this.tb.unselectable = "on";
a.appendChild(this.tb)
} else {
var k = $ID(c + "_tb");
this.tb = VE_Panel._CreateElement("div", "", "", d + 1);
k.appendChild(this.tb)
}
this.body = VE_Panel._CreateElement("div", c + "_body", "VE_Panel_body", d + 1);
this.body.innerHTML = p;
if (!this.isLegacyPanel) {
a.appendChild(this.body);
this.foot = VE_Panel._CreateElement("div", c + "_foot", "VE_Panel_foot VE_Panel_foot_" + f, d + 1);
this.foot.innerHTML = l;
this.foot.unselectable = "on";
a.appendChild(this.foot)
} else {
a = this.body;
this.el = a
}
VE_Panel.panels.push(this);
if (i) {
a.style.top = "0";
a.style.left = "0";
if (j) a.style.position = "absolute";
else {
a.style.display = "none";
a.style.visibility = "hidden"
}
}
e.appendChild(a);
if (!Gimme.Browser.isKHTML) {
var g = Gimme.id("TaskHost_CollectionsViewer_state");
if (g !== null) e.appendChild(g)
}
this.Destroy = function () {
if (a.parentNode) a.parentNode.removeChild(a);
if (b.sPanel != null) b.sPanel.Destroy();
if (a.shimElement && a.shimElement.parentNode) a.shimElement.parentNode.removeChild(a.shimElement);
a.shimElement = null;
var d = VE_Panel.panels;
for (var c = 0; c < d.length; c++) if (d[c] == b) {
d.splice(c, 1);
break
}
if (!this.isLegacyPanel) {
b.cb.onclick = b.cb.onmouseover = b.cb.onmouseout = null;
b.title.onclick = null;
b.cb = null;
b.title = null;
b.foot = null;
b.onTitleClick = null;
b.onCloseClick = null
} else {
var f = b.tb.parentNode;
if (f) f.removeChild(b.tb)
}
b.tb = null;
b.sPanel = null;
b.body = null;
b.onMaximize = null;
a = b.el = null;
b = null;
e = null
}
}
VE_Panel.panels = [];
VE_Panel.shadowThickness = 3;
VE_Panel._CreateElement = function (d, e, b, c) {
var a = document.createElement(d);
a.id = e;
a.className = b;
a.style.zIndex = c;
return a
};
VE_Panel._PositionElement = function (a, d, e, c, b) {
a.style.top = e + "px";
a.style.left = d + "px";
a.style.width = c + "px";
a.style.height = b + "px"
};
VE_Panel.prototype.SetPosition = function (c, d, b, a) {
this.x = c;
this.y = d;
this.width = b;
this.height = a;
if (map.IsModeEnabled(Msn.VE.MapActionMode.Mode3D) && this.usesShimIn3D) UpdateIFrameShim(this.el)
};
VE_Panel.prototype.SetToolbarSize = function (toolbarHeight) {
this.toolbarHeight = toolbarHeight;
var d = eval(toolbarHeight) > 0 ? "block" : "none";
this.tb.style.display = d;
this.Resize()
};
VE_Panel.prototype.SetFooterSize = function (footerHeight) {
if (!this.isLegacyPanel) {
this.footerHeight = footerHeight;
var d = eval(footerHeight) > 0 ? "block" : "none";
this.foot.style.display = d;
this.Resize()
}
};
VE_Panel.prototype.Resize = function () {
if (typeof ve_globals != "undefined") {
var geoFn = Msn.VE.Geometry.Functions,
taskAreaHeight = Gimme.Screen.getViewportSize().y - g(ve_globals["taskArea"]).getScreenPosition().y - ve_globals["footer"].offsetHeight;
if (taskAreaHeight >= 0 && typeof taskAreaHeight == "number") ve_globals["taskArea"].style.height = taskAreaHeight - 2 + "px";
if (this.el.id == "contextMenu" || this.el.id == "scratchpad" || this.el.id == "annotationPanel" || this.el.id == "annotationPopup" || this.el.id == "searchPopup" || this.el.id == "help") {
if (this.height != "auto" && typeof this.height == "number") this.el.style.height = eval(this.height) + "px";
if (this.width != "auto" && typeof this.width == "number") this.el.style.width = eval(this.width) + "px";
if (this.x != "auto" && typeof this.x == "number") this.el.style.left = eval(this.x) + "px";
if (this.y != "auto" && typeof this.y == "number") this.el.style.top = eval(this.y) + "px"
}
if (this.el.shimElement) ShowShim(this.el)
}
};
VE_Panel.prototype.SetHeightToFit = function () {
var contentid = this.id + "_body_table",
content = $ID(contentid);
if (!content) return false;
this.height = 0;
var width = Math.max(eval(this.width), 100);
if (content.offsetWidth > width - 14) this.height += scrollbarWidth;
this.height += this.titleDisabled ? 14 : 21 + 14;
this.height += this.toolbarHeight;
this.height += content.offsetHeight;
this.height += this.footerHeight;
this.height = Math.min(this.dynamicHeightMax, this.height)
};
VE_Panel.prototype.DisableClosebox = function () {
if (!this.isLegacyPanel) {
if (this.closeboxDisabled) return;
this.closeboxDisabled = true;
this.el.removeChild(this.cb)
}
};
VE_Panel.prototype.EnableClosebox = function () {
if (!this.isLegacyPanel) {
if (!this.closeboxDisabled) return;
this.closeboxDisabled = false;
this.el.appendChild(this.cb)
}
};
VE_Panel.prototype.DisableTitle = function () {
if (!this.isLegacyPanel) {
if (this.titleDisabled) return;
this.titleDisabled = true;
this.el.removeChild(this.cb);
this.el.removeChild(this.title)
}
};
VE_Panel.prototype.EnableTitle = function () {
if (!this.isLegacyPanel) {
if (!this.titleDisabled) return;
this.titleDisabled = false;
this.el.insertBefore(this.cb, this.tb);
this.el.insertBefore(this.title, this.cb)
}
};
VE_Panel.prototype.SetTitle = function (c) {
if (!this.isLegacyPanel) {
var b = document.createTextNode(c),
a = this.title.firstChild;
if (a) if (a.firstChild) a.replaceChild(b, a.firstChild);
else a.appendChild(b)
}
};
VE_Panel.prototype.SetToolbar = function (a) {
this.tb.innerHTML = a
};
VE_Panel.prototype.SetBody = function (a) {
this.body.innerHTML = a
};
VE_Panel.prototype.SetDynamicBody = function (a) {
this.body.innerHTML = '
' + a + "
"
};
VE_Panel.prototype.SetFooter = function (a) {
if (!this.isLegacyPanel) this.foot.innerHTML = a
};
VE_Panel.prototype.SetOpacity = function (o) {
if (o >= 100) o = 99.99;
with(this.el.style) {
filter = "alpha(opacity:" + o + ")";
o *= .01;
KHTMLOpacity = o;
MozOpacity = o;
opacity = o
}
};
VE_Panel.prototype.SetColor = function (a) {
if (!this.isLegacyPanel) {
this.color = a;
this.title.className = "VE_Panel_title VE_Panel_title_" + a;
this.foot.className = "VE_Panel_foot VE_Panel_foot_" + a;
this.cb.className = "VE_Panel_cb VE_Panel_cb_" + a
}
};
VE_Panel.prototype.Minimize = function () {
this.el.className = " VE_Panel_el_minimized";
if (this.onMinimize) this.onMinimize(this._CreateEvent())
};
VE_Panel.prototype.Maximize = function () {
this.el.className = "VE_Panel_el";
if (this.onMaximize) this.onMaximize(this._CreateEvent());
this.Resize()
};
VE_Panel.prototype.isMaximized = function () {
return this.el.className == "VE_Panel_el"
};
VE_Panel.prototype.Show = function () {
this.el.style.display = "block";
this.visible = true;
if (this.usesShimIn3D) mvcViewFacade.ShowShimIfSupported(this.el)
};
VE_Panel.prototype.Hide = function () {
this.el.style.display = "none";
this.visible = false;
HideShim(this.el)
};
VE_Panel.prototype.IsVisible = function () {
return this.el.style.display != "none"
};
function VE_PanelEvent(a) {
this.srcPanel = a
}
VE_Panel.prototype._CreateEvent = function () {
return new VE_PanelEvent(this)
};
VE_Panel._OnTitleClick = function (c) {
if (!c) c = window.event;
var d = GetTarget(c),
b = VE_Panel.panels;
for (var a = 0; a < b.length; a++) if (b[a].title == d || b[a].title == d.parentNode) {
if (b[a].onTitleClick) b[a].onTitleClick(b[a]._CreateEvent());
return
}
};
VE_Panel._OnCloseClick = function (c) {
if (!c) c = window.event;
var d = GetTarget(c),
b = VE_Panel.panels;
for (var a = 0; a < b.length; a++) if (b[a].cb == d) {
if (b[a].onCloseClick) b[a].onCloseClick(b[a]._CreateEvent());
return
}
};
function Ad(h, j, a, e, b, c, d, i, g, f, k) {
this.title = h;
this.url = j;
this.description = a;
this.latitude = e;
this.longitude = b;
this.address1 = c;
this.address2 = d;
this.city = i;
this.state = g;
this.country = f;
this.zip = k
}
Ad.prototype.ToHtml = function () {
var a = "
";
if (this.description && this.description.length > 0) a = a.replace("$AdDescription$", "
" + IOSec.EncodeHtml(this.description) + "
");
return a
};
Ad.prototype.HasAddress = function () {
return this.address1.length > 0 && this.city.length > 0 && this.state.length > 0 && this.zip.length > 0
};
Ad.prototype.GetAdDescription = function () {
var a = this.description;
if (this.HasAddress()) a = this.address1 + ", " + this.city + ", " + this.state + " " + this.zip;
return a
};
Msn.VE.DirectionsDecoder = function () {
var a = 4,
b = 1000000;
function e(a, c, m, l) {
if (!a || a.length < c) return [];
var k = a.length - a.length % c,
i = [],
f = false,
b = 0,
j = c - 1;
for (var d = 0; d < k; d++) {
var e = a.charCodeAt(d),
h = d % c;
if (l && h == 0) {
f = e & 128;
e &= 127
}
b |= e;
if (h == j) {
var g = b / m;
i.push(f ? -g : g);
b = 0;
f = false
} else b <<= 8
}
return i
}
function d(c) {
return e(c, a, b, true)
}
function c(c) {
var l = true;
if (!c || c.length < a) return [];
var j = [],
g = false,
d = 0,
k = a - 1,
m = c.length;
for (var e = 0; e < m; ++e) {
var f = c[e],
i = e % a;
if (l && i == 0) {
g = f & 128;
f &= 127
}
d |= f;
if (i == k) {
var h = d / b;
j.push(g ? -h : h);
d = 0;
g = false
} else d <<= 8
}
return j
}
this.DecodeCoordinatesString = d;
this.DecodeCoordinatesByteArray = c
};
var HelpHistory = [];
function VE_Help() {}
VE_Help.helpZIndex = 31;
VE_Help.introZIndex = 31;
VE_Help.introPanel = null;
VE_Help.helpPanel = null;
VE_Help.margins = 110;
VE_Help.LiveHelp = new function () {
this.Keyword = "keyword";
this.Search = "search";
this.Topic = "topic"
};
VE_Help.CreateHelpPanel = function () {
VE_Help.CreateSizedHelpPanel(220, 160, windowWidth <= 430 ? 300 : windowWidth - 430, windowHeight <= 220 ? 200 : windowHeight - 220)
};
VE_Help.CreateSizedHelpPanel = function (e, f, c, b) {
if (typeof VE_Help.helpPanel != "undefined" && VE_Help.helpPanel != null) {
VE_Help.helpPanel.SetBody("");
VE_Help.helpPanel.Destroy();
VE_Help.helpPanel = null
}
var d = '',
a = new VE_Panel("help", e, f, c <= 300 ? 300 : c, b <= 200 ? 200 : b, "blue", VE_Help.helpZIndex, L_Help_Text, d, "", null, null, null, null, true, null);
a.body.className = "VE_Panel_body_help";
a.Hide();
a.el.style.visibility = "";
a.SetToolbarSize(0);
a.SetFooterSize(0);
a.onCloseClick = function () {
VE_Help.DisablePreventLayer();
VE_Help.ClosePanel()
};
VE_Help.helpPanel = a
};
VE_Help.EnablePreventLayer = function () {
var a = $ID("__preventLayer__");
if (!a) a = document.createElement("div");
a.id = "__preventLayer__";
a.className = "preventLayer";
document.body.appendChild(a)
};
VE_Help.DisablePreventLayer = function () {
var a = $ID("__preventLayer__");
if (a) document.body.removeChild(a)
};
VE_Help.EnableDrawingPreventLayer = function () {
var c = $ID("msve_header");
if (c) {
var b = $ID("__preventLayerHeader__");
if (!b) b = document.createElement("div");
b.id = "__preventLayerHeader__";
b.className = "preventLayer";
b.style.left = c.clientLeft;
b.style.top = c.clientTop;
b.style.width = c.clientWidth;
b.style.height = c.clientHeight;
document.body.appendChild(b)
}
var d = $ID("sb_foot");
if (d) {
var a = $ID("__preventLayerFooter__");
if (!a) a = document.createElement("div");
a.id = "__preventLayerFooter__";
a.className = "preventLayer";
a.style.left = 0;
a.style.top = GetWindowHeight() - d.clientHeight;
a.style.width = d.clientWidth;
a.style.height = d.clientHeight;
document.body.appendChild(a)
}
};
VE_Help.DisableDrawingPreventLayer = function () {
var d = $ID("__preventLayerHeader__");
if (d) document.body.removeChild(d);
var b = $ID("__preventLayerTaskArea__");
if (b) document.body.removeChild(b);
var a = $ID("__preventLayerActionBar__");
if (a) document.body.removeChild(a);
var c = $ID("__preventLayerFooter__");
if (c) document.body.removeChild(c)
};
function findPosX(a) {
var b = 0;
if (a.offsetParent) while (a.offsetParent) {
b += a.offsetLeft;
a = a.offsetParent
} else if (a.x) b += a.x;
return b
}
function findPosY(a) {
var b = 0;
if (a.offsetParent) while (a.offsetParent) {
b += a.offsetTop;
a = a.offsetParent
} else if (a.y) b += a.y;
return b
}
VE_Help.Open = function (b, c) {
VE_Help.EnablePreventLayer();
VE_Help.helpPanel.Show();
VE_Help.helpPanel.SetTitle(b);
VE_Help.helpPanel.SetBody('');
var a = $ID("helpFrame");
a.src = c;
VE_Help.Redraw()
};
VE_Help.OpenSized = function (f, g, a, b) {
var d = GetWindowWidth(),
c = GetWindowHeight();
if (a > d - 10) a = d - 10;
if (b > c - 10) b = c - 10;
VE_Help.CreateSizedHelpPanel((d - a) / 2, (c - b) / 2, a, b);
VE_Help.EnablePreventLayer();
VE_Help.helpPanel.Show();
VE_Help.helpPanel.SetTitle(f);
VE_Help.helpPanel.SetBody('');
var e = $ID("helpFrame");
e.src = g
};
VE_Help.OpenLiveHelp = function (b, a, c) {
var g = "_live_help",
f = 550,
e = 575,
i = (screen.availWidth - f) * .5,
j = (screen.availHeight - e) * .5,
h = "resizable=yes,top=" + j + ",width=" + f + ",height=" + e + ",left=" + i;
if (typeof b == "undefined" || b == null || b == "") b = liveLocalHelpProjectCode;
if (typeof a == "undefined" || a == null || a == "") a = VE_Help.LiveHelp.Keyword;
if (typeof c == "undefined" || c == null || c == "") c = "qaf";
var k = liveHelpUrl + "&project=" + b + "&querytype=" + a + "&query=" + c,
d = window.open(k, g, h);
if (d != null && typeof d == "object") d.focus()
};
VE_Help.Redraw = function () {
var b = VE_Help.helpPanel;
if (!b) return;
var c = Gimme.Screen.getViewportSize(),
a = g(b.el);
a.setStyle("top", (c.height - a.element().offsetHeight) / 2 + "px");
a.setStyle("left", (c.width - a.element().offsetWidth) / 2 + "px");
ShowShim(b.el)
};
VE_Help.CloseIntro = function () {
if (VE_Help.introPanel) VE_Help.introPanel.Hide()
};
VE_Help.ClosePanel = function () {
if (VE_Help.helpPanel) {
VE_Help.helpPanel.Hide();
VE_Help.DisablePreventLayer()
}
};
VE_Help.Destroy = function () {
if (VE_Help.introPanel) {
VE_Help.introPanel.Destroy();
VE_Help.introPanel = null
}
if (VE_Help.helpPanel) {
VE_Help.helpPanel.Destroy();
VE_Help.helpPanel = null
}
};
function SanitizeHtmlString(a) {
if (!a || typeof a != "string") return a;
return IOSec.EncodeHtml(a)
}
function GetTarget(b) {
if (!b) b = window.event;
var a = null;
if (b.srcElement) a = b.srcElement;
else if (b.target) a = b.target;
if (a && a.nodeType) {
if (b.capturedTarget) a = b.capturedTarget;
if (a.nodeType == 3) a = a.parentNode
}
return a
}
function SelectText(a, c, d) {
if (!a) return;
if (a.createTextRange) {
var b = a.createTextRange();
b.moveStart("character", c);
b.moveEnd("character", d);
b.select()
} else if (a.setSelectionRange) a.setSelectionRange(c, d)
}
function SelectedTextLength(a) {
if (!a) return 0;
if (a.document) {
var b = a.document.selection.createRange();
return b.text.length
} else {
var c = a.selectionStart,
d = a.selectionEnd;
return d - c
}
}
function GetXMLText(a) {
if (a.text) return a.text;
else if (a.textContent) return a.textContent;
else if (a.firstChild && a.firstChild.data) return a.firstChild.data;
return ""
}
function VEValidator() {}
VEValidator.ValidateFloat = function (b, c) {
var a = "";
if (arguments != null && arguments.caller != null) a = VEValidator.GetCaller(arguments.caller);
if (a == "") a = "VEValidator.ValidateFloat";
if (b == null || b == "undefined") throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "float"));
try {
if (isNaN(parseFloat(b))) throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "float"));
return true
} catch (d) {
throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "float"))
}
};
VEValidator.ValidateInt = function (b, c) {
var a = "";
if (arguments != null && arguments.caller != null) a = VEValidator.GetCaller(arguments.caller);
if (a == "") a = "VEValidator.ValidateInt";
if (b == null || b == "undefined") throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "int"));
try {
if (isNaN(parseInt(b)) || parseFloat(b) != parseInt(b)) throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "int"));
return true
} catch (d) {
throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "int"))
}
};
VEValidator.ValidateNonNegativeInt = function (a, c) {
var b = "";
if (arguments != null && arguments.caller != null) b = VEValidator.GetCaller(arguments.caller);
if (b == "") b = "VEValidator.ValidateNonNegativeInt";
if (a == null || a == "undefined") throw new VEException(b, "err_invalidargument", L_invalidnonnegativeint_text.replace("%1", c));
try {
if (isNaN(parseInt(a)) || parseFloat(a) != parseInt(a) || parseInt(a) < 0) throw new VEException(b, "err_invalidargument", L_invalidnonnegativeint_text.replace("%1", c));
return true
} catch (d) {
throw new VEException(b, "err_invalidargument", L_invalidnonnegativeint_text.replace("%1", c))
}
};
VEValidator.ValidateFunction = function (b, c) {
var a = "";
if (arguments != null && arguments.caller != null) a = VEValidator.GetCaller(arguments.caller);
if (a == "") a = "VEValidator.ValidateFunction";
if (b == null || typeof b != "function") throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "function"))
};
VEValidator.ValidateNonNull = function (b, c) {
var a = "";
if (arguments != null && arguments.caller != null) a = VEValidator.GetCaller(arguments.caller);
if (a == "") a = "VEValidator.ValidateNonNull";
if (b == null || b == "undefined") throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "non null"))
};
VEValidator.ValidateBetween = function (b, e, d, c) {
var a = "";
if (arguments != null && arguments.caller != null) a = VEValidator.GetCaller(arguments.caller);
if (a == "") a = "VEValidator.ValidateBetween";
if (b < d || b > c) throw new VEException(a, "err_invalidargument", L_invalidbetweenint_text.replace("%1", e).replace("%2", d).replace("%3", c))
};
VEValidator.ValidateBoolean = function (b, c) {
var a = "";
if (arguments != null && arguments.caller != null) a = VEValidator.GetCaller(arguments.caller);
if (a == "") a = "VEValidator.ValidateBoolean";
if (b != true && b != false) throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "bool"))
};
VEValidator.ValidateMapStyle = function (a, c) {
var b = "";
if (arguments != null && arguments.caller != null) b = VEValidator.GetCaller(arguments.caller);
if (b == "") b = "VEValidator.ValidateMapStyle";
if (a == null || a == "undefined") throw new VEException(b, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "MapStyle"));
if (a == "r" || a == "R" || $MVEM.IsEnabled(MapControl.Features.MapStyle.Shaded) && (a == "s" || a == "S") || $MVEM.IsEnabled(MapControl.Features.MapStyle.Aerial) && (a == "a" || a == "A") || $MVEM.IsEnabled(MapControl.Features.MapStyle.BirdsEye) && (a == "o" || a == "O") || $MVEM.IsEnabled(MapControl.Features.MapStyle.BirdsEye) && (a == "b" || a == "B") || $MVEM.IsEnabled(MapControl.Features.MapStyle.Hybrid) && (a == "h" || a == "H")) return true;
throw new VEException(b, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "MapStyle"))
};
VEValidator.ValidateClusteringType = function (a, c) {
var b = "";
if (arguments != null && arguments.caller != null) b = VEValidator.GetCaller(arguments.caller);
if (b == "") b = "VEValidator.ValidateClusteringType";
if (a == null || a == "undefined") throw new VEException(b, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "ClusteringType"));
if (typeof a == "number" && (a == VEClusteringType.None || a == VEClusteringType.Grid)) return true;
throw new VEException(b, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "ClusteringType"))
};
VEValidator.ValidateMapMode = function (b, c) {
var a = "";
if (arguments != null && arguments.caller != null) a = VEValidator.GetCaller(arguments.caller);
if (a = "") a = "VEValidator.ValidateMapMode";
if (b == null || b == "undefined") throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "MapMode"));
if (b == VEMapMode.Mode2D || $MVEM.IsEnabled(MapControl.Features.MapStyle.View3D) && b == VEMapMode.Mode3D) return true;
throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "MapMode"))
};
VEValidator.ValidateDistanceUnit = function (b, c) {
var a = "";
if (arguments != null && arguments.caller != null) a = VEValidator.GetCaller(arguments.caller);
if (a == "") a = "VEValidator.ValidateDistanceUnit";
if (b == null || b == "undefined") throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "VEDistanceUnit"));
if (b == VEDistanceUnit.Miles || b == VEDistanceUnit.Kilometers) return true;
throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "VEDistanceUnit"))
};
VEValidator.ValidateMaxZoom = function (b, c) {
var a = "";
if (arguments != null && arguments.caller != null) a = VEValidator.GetCaller(arguments.caller);
if (a == "") a = "VEValidator.ValidateMaxZoom";
if (b == null || b == "undefined") throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "ValidateMaxZoom"));
if (b <= Msn.VE.API.Globals.vemaxzoom) return true;
throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "ValidateMaxZoom"))
};
VEValidator.ValidateLayerType = function (a, c) {
var b = "";
if (arguments != null && arguments.caller != null) b = VEValidator.GetCaller(arguments.caller);
if (b == "") b = "VEValidator.ValidateLayerType";
if (a == null || a == "undefined") throw new VEException(b, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "VEDataType"));
if (a == VEDataType.GeoRSS || a == VEDataType.VECollection || a == VEDataType.VETileSource) return true;
throw new VEException(b, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "VEDataType"))
};
VEValidator.ValidateDashboardSize = function (a, c) {
var b = "";
if (arguments != null && arguments.caller != null) b = VEValidator.GetCaller(arguments.caller);
if (b == "") b = "VEValidator.ValidateDashboardSize";
if (a == null || a == "undefined") throw new VEException(b, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "VEDashboardSize"));
if (a == VEDashboardSize.Normal || a == VEDashboardSize.Small || a == VEDashboardSize.Tiny) return true;
throw new VEException(b, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "VEDashboardSize"))
};
VEValidator.ValidateMiniMapSize = function (b, c) {
var a = "";
if (arguments != null && arguments.caller != null) a = VEValidator.GetCaller(arguments.caller);
if (a == "") a = "VEValidator.ValidateMiniMapSize";
if (b == null || b == "undefined") throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "VEMiniMapSize"));
if (b == VEMiniMapSize.Small || b == VEMiniMapSize.Large) return true;
throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "VEMiniMapSize"))
};
VEValidator.ValidateAltitudeMode = function (b, c) {
var a = "";
if (arguments != null && arguments.caller != null) a = VEValidator.GetCaller(arguments.caller);
if (a == "") a = "VEValidator.ValidateAltitudeMode";
if (b == null) throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "VEAltitudeMode"));
if (b != VEAltitudeMode.Absolute && b != VEAltitudeMode.RelativeToGround) throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "VEAltitudeMode"));
return true
};
VEValidator.ValidateObject = function (b, c, e, d) {
var a = "";
if (arguments != null && arguments.caller != null) a = VEValidator.GetCaller(arguments.caller);
if (a == "") a = "VEValidator.ValidateObject";
if (b == null || b == "undefined") throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "non null"));
if (!(b instanceof e)) throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", d))
};
VEValidator.ValidateObjectArray = function (a, d, f, e) {
var b = "";
if (arguments != null && arguments.caller != null) b = VEValidator.GetCaller(arguments.caller);
if (b == "") b = "VEValidator.ValidateObject";
if (a == null || typeof a == "undefined" || a.length == null || typeof a.length == "undefined") throw new VEException(b, "err_invalidargument", L_invalidargument_text.replace("%1", d).replace("%2", "array"));
for (var c = 0; c < a.length; ++c) if (a[c] == null || typeof a[c] == "undefined" || !(a[c] instanceof f)) throw new VEException(b, "err_invalidargument", L_invalidargument_text.replace("%1", d).replace("%2", e))
};
VEValidator.ValidateOrientation = function (a, c) {
var b = "";
if (arguments != null && arguments.caller != null) b = VEValidator.GetCaller(arguments.caller);
if (b == "") b = "VEValidator.ValidateOrientation";
if (a == null || a == "undefined") throw new VEException(b, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "VEOrientation"));
if (a != VEOrientation.North && a != VEOrientation.East && a != VEOrientation.West && a != VEOrientation.South) throw new VEException(b, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "VEOrientation"))
};
VEValidator.ValidateCacheMode = function (a, b) {
var c = "VEValidator.ValidateCacheMode";
if (a == null || a == "undefined") throw new VEException(c, "err_invalidargument", L_invalidargument_text.replace("%1", b).replace("%2", "VECacheMode"));
if (a != VECacheMode.Auto && a != VECacheMode.EnableTileCaching) throw new VEException(c, "err_invalidargument", L_invalidargument_text.replace("%1", b).replace("%2", "VECacheMode"))
};
VEValidator.ValidateBounds = function (a, c) {
var b = "";
if (arguments != null && arguments.caller != null) b = VEValidator.GetCaller(arguments.caller);
if (b == "") b = "VEValidator.ValidateBounds";
if (a == null || a == "undefined") throw new VEException(b, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "VELatLongRectangle"));
if (a.TopLeftLatLong == null || a.BottomRightLatLong == null || a.TopLeftLatLong.Latitude <= a.BottomRightLatLong.Latitude || a.TopLeftLatLong.Longitude >= a.BottomRightLatLong.Longitude) throw new VEException(b, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "VELatLongRectangle"))
};
VEValidator.GetCaller = function () {
return ""
};
function VEPushpin(f, e, d, h, g, c, b, a) {
VEValidator.ValidateNonNull(f, "pinId");
VEValidator.ValidateNonNull(e, "veLatLong");
var i = this;
this.IsInLayer = false;
this.ID = f;
this.LatLong = e;
this.Title = h;
if (d == null || d == "undefined" || d.length == 0) this.Iconurl = Msn.VE.API.Constants.iconurl;
else this.Iconurl = d;
this.Details = g;
if (c == null || c == "undefined" || c.length == 0) this.IconStyle = "";
else this.IconStyle = c;
if (b == null || b == "undefined" || b.length == 0) this.TitleStyle = "VE_Pushpin_Popup_Title";
else this.TitleStyle = b;
if (a == null || a == "undefined" || a.length == 0) this.DetailsStyle = "VE_Pushpin_Popup_Body";
else this.DetailsStyle = a;
if (window.ero == null || window.ero == "undefined") window.ero = ERO.getInstance()
}
VEPushpin.ShowDetailOnMouseOver = true;
VEPushpin.OnMouseOverCallback = null;
VEPushpin.prototype.Dispose = function () {
this.DetailsStyle == null;
this.TitleStyle = null;
this.IconStyle = null;
this.Details = null;
this.IconUrl = null;
this.Title = null;
this.LatLong = null;
this.ID = null;
this.m_vemapcontrol = null;
this.m_vemap = null
};
VEPushpin.Hide = function (a) {
if (window.ero != null) {
if (a == "undefined" || a == null) a = false;
window.ero.hide(a)
}
};
VEPushpin.GetEroContent = function (c, b, e, d) {
var a = "
";
if (c != null && c != "undefined" && c.length > 0) a += '
' + unescape(c) + "
";
if (b != null && b != "undefined" && b.length > 0) a += '
' + unescape(b) + "
";
if (!document.all && (c.length == 0 || b.length == 0)) a += "
";
a += "";
return a
};
VEPushpin.Show = function (l, m, k, h, d, c, g, e) {
var a = VEMap._GetMapFromGUID(l);
if (a == null || a == "undefined") return;
var i = a.vemapcontrol.GetX(h) + a.GetLeft(),
j = a.vemapcontrol.GetY(k) + a.GetTop();
if (VEPushpin.ShowDetailOnMouseOver) {
var b = $ID(m + "_" + a.GUID);
if (b != null && b != "undefined") {
var f = VEPushpin.GetEroContent(d, c, g, e);
window.ero.setContent(f);
window.ero.setBoundingArea(null);
window.ero.getBoundingArea().move(Gimme.Screen.getScrollPosition());
window.ero.dockToElement(b)
}
}
if (VEPushpin.OnMouseOverCallback != null) VEPushpin.OnMouseOverCallback(i, j, d, unescape(c))
};
VEPushpin.Show3D = function (a, c, b, f, d) {
if (VEPushpin.ShowDetailOnMouseOver) {
var e = VEPushpin.GetEroContent(c, b, f, d);
window.ero.setContent(e);
ero.setGlitz(false, false, false, true);
window.ero.dockToRect(a, null, -1)
}
if (VEPushpin.OnMouseOverCallback != null) VEPushpin.OnMouseOverCallback(a.getP1().x, a.getP1().y, c, unescape(b))
};
function GetContent() {
var g = this.ID + "_" + this.m_vemap.GUID,
a = " 0,
d = this.Details != null && this.Details != "undefined" && this.Details.length > 0;
if (e || d) {
var b = "if (VEMap._GetMapFromGUID(" + this.m_vemap.GUID + ").FireEvent(",
c = "))return;";
a += " onmouseout='" + b + '"onmouseout"' + c + "VEPushpin.Hide();' ";
a += " onmousedown='" + b + '"onmousedown"' + c + "VEPushpin.Hide(true);' ";
a += " onmouseover='" + b + '"onmouseover"' + c + 'VEPushpin.Show("' + this.m_vemap.GUID + '","' + this.ID + '",' + this.LatLong.Latitude + "," + this.LatLong.Longitude;
if (e) a += ', "' + escape(this.Title) + '"';
else a += ',""';
if (d) a += ', "' + escape(this.Details) + '"';
else a += ',""';
a += ',"' + this.TitleStyle + '"';
a += ',"' + this.DetailsStyle + '"';
a += ");' "
}
a += "/>";
return a
}
VEPushpin.DisposeERO = function () {
if (window.ero != null && window.ero != "undefined") {
window.ero.destroy();
window.ero = null
}
};
VEPushpin.prototype._SetMapInstance = function (a) {
this.m_vemap = a;
this.m_vemapcontrol = a.vemapcontrol
};
VEPushpin.prototype.GetContent = GetContent;
function GetImageFullUrl(a) {
var b = "";
if (a && a.constructor == String && a.length > 0) {
var c = new Image;
c.src = a;
b = c.src
}
return b
}
function VE_ScratchpadManager() {}
VE_ScratchpadManager.AddGeoLocation = function () {
return
};
VE_ScratchpadManager.AddLocation = VE_ScratchpadManager.AddGeoLocation;
VE_Scratchpad = VE_ScratchpadManager;
function VEMessage(b) {
VEValidator.ValidateObject(b, "vemap", VEMap, "VEMap");
this.m_vemap = b;
var a = this;
this.Show = function (g) {
if (g == null || g == "undefined" || g.length <= 0) return;
g = c(g);
if (this.vemessagepanel == null || this.vemessagepanel == "undefined") {
var d = document.createElement("div");
d.id = this.m_vemap.ID + "_vemessagepanel";
d.className = "VE_Message";
d.style.zIndex = Msn.VE.API.Globals.vemessagepanelzIndex;
var i = this.m_vemap.GetHeight() / 2 - Msn.VE.API.Globals.vemessagepanelheight / 2;
if (i < 0) i = 0;
d.style.top = i + "px";
d.style.left = 30 + "px";
var h = this.m_vemap.GetWidth() - 60;
if (h < 30) h = 30;
d.style.width = h + "px";
d.style.height = Msn.VE.API.Globals.vemessagepanelheight + "px";
d.style.position = "absolute";
this.vemessagepanel = d;
var e = document.createElement("a");
e.className = "VE_Message_Title";
e.style.zIndex = parseInt(Msn.VE.API.Globals.vemessagepanelzIndex) + 1;
e.style.top = "1px";
e.style.left = "1px";
e.style.width = parseInt(this.vemessagepanel.style.width) - 5 + "px";
e.innerHTML = IOSec.EncodeHtml(L_error_text);
e.unselectable = "on";
this.vemessagepanel.appendChild(e);
var f = document.createElement("a");
f.className = "VE_Message_Close";
f.style.zIndex = parseInt(Msn.VE.API.Globals.vemessagepanelzIndex) + 2;
f.style.top = "1px";
f.style.right = "1px";
f.onclick = a.Hide;
f.unselectable = "on";
f.innerHTML = L_close_text;
this.vemessagepanel.appendChild(f);
var b = document.createElement("div");
b.id = this.m_vemap.ID + "_vemessagepanel_body";
b.className = "VE_Message_Body";
b.style.zIndex = parseInt(Msn.VE.API.Globals.vemessagepanelzIndex) + 3;
b.style.top = 22 + "px";
b.style.left = 0 + "px";
b.style.width = parseInt(this.vemessagepanel.style.width) - 8 + "px";
b.onclick = a.Hide;
b.unselectable = "on";
b.innerHTML = g;
this.vemessagepanel.appendChild(b);
this.m_vemap.AddControl(this.vemessagepanel, Msn.VE.API.Globals.vemessagepanelzIndex)
} else {
var b = $ID(this.m_vemap.ID + "_vemessagepanel_body");
b.innerHTML = g
}
this.vemessagepanel.style.display = "block";
mvcViewFacade.ShowShimIfSupported(this.vemessagepanel);
this.timeoutIntervalID = window.setInterval(this.Hide, 10000)
};
this.Hide = function () {
if (a.vemessagepanel != null && a.vemessagepanel != "undefined") {
a.vemessagepanel.style.display = "none";
HideShim(a.vemessagepanel);
if (a.timeoutIntervalID != null) {
window.clearInterval(a.timeoutIntervalID);
a.timeoutIntervalID = null
}
}
};
this.Dispose = function () {
if (this.vemessagepanel != null && this.vemessagepanel != "undefined") this.vemessagepanel = null
};
function c(a) {
var b = /]*>/gi;
a = a.replace(b, "");
b = /<\/a>/gi;
a = a.replace(b, "");
return a
}
}
function VEAmbiguouslist(vemap) {
VEValidator.ValidateNonNull(vemap, "vemap");
this.m_vemap = vemap;
var self = this;
this.ID = this.m_vemap.ID + "_veplacelistpanel";
this.Show = function (a, onSelectCallback, callbackOnClose) {
var body = null,
veambiglistHide = "VEMap._GetMapFromGUID('" + this.m_vemap.GUID + "').m_veambiguouslist.Hide();",
veambiglistSetViewport = "VEMap._GetMapFromGUID('" + this.m_vemap.GUID + "').vemapcontrol.SetViewport";
if (this.veplacelistpanel == null || this.veplacelistpanel == "undefined") {
var e = document.createElement("div");
e.id = this.ID;
e.className = "VE_PlaceList";
e.style.top = this.m_vemap.GetHeight() / 2 - Msn.VE.API.Globals.veplacelistpanelheight / 2 + "px";
e.style.left = this.m_vemap.GetWidth() / 2 - Msn.VE.API.Globals.veplacelistpanelwidth / 2 + "px";
e.style.width = Msn.VE.API.Globals.veplacelistpanelwidth + "px";
e.style.height = Msn.VE.API.Globals.veplacelistpanelheight + "px";
e.style.position = "absolute";
this.veplacelistpanel = e;
var title = document.createElement("a");
title.className = "VE_PlaceList_Title";
title.style.zIndex = parseInt(Msn.VE.API.Globals.veplacelistpanelzIndex) + 1;
title.style.width = parseInt(Msn.VE.API.Globals.veplacelistpanelwidth) - 5 + "px";
title.style.top = "1px";
title.style.left = "1px";
title.style.height = "20px";
title.innerHTML = IOSec.EncodeHtml(L_selectlocation_text);
title.unselectable = "on";
this.veplacelistpanel.appendChild(title);
var cb = document.createElement("a");
cb.className = "VE_PlaceList_Close";
cb.id = this.m_vemap.ID + "_veplaceListclose";
cb.style.zIndex = parseInt(Msn.VE.API.Globals.veplacelistpanelzIndex) + 2;
cb.style.top = "1px";
cb.style.right = "1px";
cb.unselectable = "on";
cb.innerHTML = L_close_text;
this.veplacelistpanel.appendChild(cb);
body = document.createElement("div");
body.id = this.m_vemap.ID + "_veplacelistbody";
body.style.zIndex = 300;
body.style.height = Msn.VE.API.Globals.veplacelistpanelheight - 38 + "px";
body.style.width = Msn.VE.API.Globals.veplacelistpanelwidth - 8 + "px";
body.className = "VE_PlaceList_Body";
this.veplacelistpanel.appendChild(body);
this.m_vemap.AddControl(this.veplacelistpanel, Msn.VE.API.Globals.veplacelistpanelzIndex)
} else body = $ID(this.m_vemap.ID + "_veplacelistbody");
var cb = $ID(this.m_vemap.ID + "_veplaceListclose");
if (callbackOnClose == true) cb.onclick = function () {
eval(veambiglistHide + onSelectCallback + "();")
};
else cb.onclick = self.Hide;
body.innerHTML = "";
for (var i = 0; i < a.length; i++) {
if (a[i] == null || a[i] == "undefined") continue;
var loc = document.createElement("div");
loc.id = "veplacelistpanel_body_loc" + i;
loc.className = "VE_PlaceList_Location";
loc.style.position = "relative";
loc.style.zIndex = parseInt(Msn.VE.API.Globals.veplacelistpanelzIndex) + 4;
loc.unselectable = "on";
if (a[i].name) if (onSelectCallback != null && onSelectCallback != "undefined") loc.innerHTML = '' + a[i].name + "";
else loc.innerHTML = '' + a[i].name + "";
else if (onSelectCallback != null && onSelectCallback != "undefined") loc.innerHTML = '' + a[i][0] + "";
else loc.innerHTML = '' + a[i][0] + "";
body.appendChild(loc)
}
this.veplacelistpanel.style.display = "block";
mvcViewFacade.ShowShimIfSupported(this.veplacelistpanel)
};
this.Hide = function () {
if (self.veplacelistpanel != null && self.veplacelistpanel != "undefined") {
HideShim(self.veplacelistpanel);
self.veplacelistpanel.style.display = "none"
}
};
this.IsVisible = function () {
var a = false;
if (this.veplacelistpanel != null && this.veplacelistpanel != "undefined" && this.veplacelistpanel.style.display != "none") a = true;
return a
};
this.Dispose = function () {
DestroyShim(self.veplacelistpanel);
if (this.veplacelistpanel != null && this.veplacelistpanel != "undefined") this.veplacelistpanel = null
}
}
function VEGraphicsManager(x) {
VEValidator.ValidateObject(x, "vemap", VEMap, "VEMap");
var a = this,
w = !Msn.VE.Environment.IsSVG();
this._spacecontrol = null;
this._hackUniqueLayerId = "UniqueLayer_Hack";
var bb = null;
this._entityIdShapePostfix = "_Shape";
this.m_vemap = x;
this.m_vemapcontrol = this.m_vemap.vemapcontrol;
var f = null,
G = x._mapOptions.DrawingBuffer,
p = false,
T = 1,
d = null;
this._useOffset = VEShapeAccuracy.None;
this._drawOverMaxShapes = VEFailedShapeRequest.DrawInaccurately;
this._failRequest = VEFailedShapeRequest.DrawInaccurately;
var ab = null,
y = null,
g = [],
b = [],
j = {},
e = false,
c = null;
this.m_spec = null;
var s = null,
k = null,
m = true,
Z = Msn.VE.API.Constants.iconurl,
t = 0,
n = new _xy1;
this.SetDisplayThreshold = function (a) {
t = a
};
this.Initialize = function () {
if (this.m_vegraphiccanvas == null || this.m_vegraphiccanvas == "undefined") {
this.m_vegraphicspolylines = [];
this.m_vegraphicspolygons = [];
var b = document.createElement("div");
b.id = "rootgraphicshape";
this.m_vemapcontrol.SetChildDiv(b);
this.m_vegraphiccanvas = Msn.Drawing.Graphic.CreateGraphic(b, this.m_vemapcontrol);
this.m_vegraphiccanvas.SetZIndex(17);
this.m_vemapcontrol.AttachEvent("onstartzoom", a.OnStartZoom);
this.m_vemapcontrol.AttachEvent("onchangeview", a.Update);
this.m_vemapcontrol.AttachEvent("onmapoffsetreset", a.OnMapOffsetReset);
this.m_vemapcontrol.AttachEvent("oninitmode", a.UpdateViewMode);
if (window.ero == null || window.ero == "undefined") window.ero = ERO.getInstance()
}
};
this.HideClusterLayers = function () {
var d = a.m_vemap.GetShapeLayerCount();
for (var c = 0; c < d; c++) {
var b = a.m_vemap.GetShapeLayerByIndex(c);
if (b._isClusterLayer) {
b._originalVisibility = b.GetVisibility();
b.SetVisibility(false)
}
}
};
this.ShowClusterLayers = function () {
var d = a.m_vemap.GetShapeLayerCount();
for (var c = 0; c < d; c++) {
var b = a.m_vemap.GetShapeLayerByIndex(c);
if (b._isClusterLayer) {
if (b._originalVisibility) {
b.SetVisibility(true);
b._clusterZoomLevel = null
}
b._originalVisibility = null
}
}
};
this.UpdateViewMode = function () {
if (a.m_vemap.GetMapMode() == Msn.VE.MapActionMode.Mode3D) {
a.HideClusterLayers();
a.DrawAll3DPushpins();
a.Draw()
} else {
a.ShowClusterLayers();
_spacecontrol = null;
a.ClearAll();
a.Update()
}
};
this.Update = function () {
if (a.m_vemap.GetMapMode() != Msn.VE.MapActionMode.Mode3D) {
a.Clear();
a.Draw()
}
p = false
};
this.OnStartZoom = function () {
a.Clear();
if (a.m_vemap.GetMapMode() == Msn.VE.MapActionMode.Mode2D) {
if (!c) return;
var h = c.GetCollectionCount();
for (var d = 0; d < h; d++) {
var f = c.GetCollectionByIndex(d),
g = f.GetShapeCount();
for (var e = 0; e < g; e++) {
var b = f.Annotations[e];
if (b._isDrawn) {
a.HideShape(b);
a.HideIcon(b)
}
b._isHiddenForZoom = true
}
}
}
};
this.OnMapOffsetReset = function () {
if (a.m_vemap.GetMapMode() != Msn.VE.MapActionMode.Mode3D) p = true
};
this.Clear = function () {
if (a.m_vegraphiccanvas != null && a.m_vegraphiccanvas != "undefined") a.m_vegraphiccanvas.Clear()
};
function D(a) {
var b = false;
if (a.minX > d.x1 && a.minY > d.y1 && a.maxX < d.x2 && a.maxY < d.y2) b = true;
return b
}
function N(a) {
if (typeof a == "undefined" || a.type == VEShapeType.Pushpin) return false;
if (a.minX == null || a.minY == null || a.maxX == null || a.maxY == null) {
var b = null;
b = Msn.Drawing.ComputeBoundingBox(a.points);
if (b) {
a.minX = b[0];
a.minY = b[1];
a.maxX = b[2];
a.maxY = b[3]
} else return false
}
var c = true;
c = IsRecIntersect(f.x1, f.y1, f.x2, f.y2, a.minX, a.minY, a.maxX, a.maxY);
return c
}
function F(c) {
if (!D(c)) {
var a = d;
if (a == null) return false;
var b = null;
b = VE_LineClip.Clip(c.points, a.x1, a.y1, a.x2, a.y2);
if (b) {
c.points = b;
return true
}
}
return false
}
function K(b) {
if (N(b)) {
var f = b.points;
if (!D(b)) {
var c = d;
if (c == null) return;
var e = null;
e = VE_LineClip.Clip(f, c.x1, c.y1, c.x2, c.y2);
if (e) b.points = e
}
a.m_vegraphiccanvas.DrawPrimitive(b);
b.points = f
}
}
function O(b) {
a.m_vemap.m_velayermanager = b;
c = b.VE_LayerManager;
k = c.GetCollectionListDiv();
a.m_vemapcontrol.SetChildDiv(k);
a.m_spec = new VELatLongFactorySpecFromMap(a.m_vemap);
s = new VELatLongFactory(b.m_spec)
}
function l(e) {
if (f == null || e) {
var b = GetCurrentMapViewBounds(a.m_vemapcontrol);
f = G == 0 ? b : GetBufferedMapViewBounds(G, b);
d = GetBufferedMapViewBounds(T, b)
}
currentOffetScene = null;
if (a.m_vemapcontrol.IsMapViewOblique()) {
var c = a.m_vemapcontrol.GetObliqueScene();
if (c != null) currentOffetScene = c.GetID()
}
}
function v() {
e = false;
g = [];
b = [];
for (var a in j) j[a] = null
}
function q(a) {
j[a.GetId()] = null
}
function o(b) {
var c = a.m_vemapcontrol.GetObliqueScene();
if (a.m_vemapcontrol.IsMapViewOblique() && c != null) {
if (j[b.GetId()] == null) {
j[b.GetId()] = b;
g.push(b)
}
} else v()
}
function J(f) {
try {
var n = a.m_vemapcontrol.GetObliqueScene();
if (a.m_vemapcontrol.IsMapViewOblique() && n != null) {
var m = n.GetID();
if (y != m) {
for (var c = 0; c < b.length; c++) g.push(b[c]);
e = true
} else if (f != null) for (var c = 0, d = 0; c < b.length && d < f.length; c++) {
var k = true,
l = [];
if (f[d] != null) {
var j = a.m_vemapcontrol.PixelToLatLong(f[d], a.m_vemapcontrol.GetZoomLevel());
b[c]._OffsetScene = m;
b[c]._OffsetLatLong = s.CreateVELatLong(j.latitude, j.longitude);
l.push(f[d])
} else k = false;
if (b[c].GetPrimitive(0).type != VEShapeType.Pushpin) {
b[c]._OffsetPoints = [];
var i = b[c].GetPrimitive(0).points.length / 2,
p = [];
while (i > 0) {
d++;
if (f[d] == null) {
k = false;
d = d + i - 1;
i = 0
} else {
var j = a.m_vemapcontrol.PixelToLatLong(f[d], a.m_vemapcontrol.GetZoomLevel());
b[c]._OffsetPoints.push(s.CreateVELatLong(j.latitude, j.longitude));
i--;
l.push(f[d])
}
}
}
q(b[c]);
if (k) {
h(b[c]);
if (b[c]._OffsetCallBack) b[c]._OffsetCallBack(l)
} else {
b[c]._OffsetScene = null;
b[c]._OffsetLatLong = null;
b[c]._OffsetPoints = null;
if (a._failRequest == VEFailedShapeRequest.DoNotDraw) {
if (b[c]._OffsetCallBack) b[c]._OffsetCallBack(null)
} else if (a._failRequest == VEFailedShapeRequest.DrawInaccurately) {
b[c]._OffsetScene = -1;
h(b[c]);
b[c]._OffsetScene = null;
if (b[c]._OffsetCallBack) b[c]._OffsetCallBack(null)
} else if (a._failRequest == VEFailedShapeRequest.QueueRequest) {
e = true;
o(b[c])
};
}
d++
} else for (var c = 0; c < b.length; c++) {
q(b[c]);
if (a._failRequest == VEFailedShapeRequest.DoNotDraw) {
if (b[c]._OffsetCallBack) b[c]._OffsetCallBack(null)
} else if (a._failRequest == VEFailedShapeRequest.DrawInaccurately) {
b[c]._OffsetScene = -1;
h(b[c]);
b[c]._OffsetScene = null;
if (b[c]._OffsetCallBack) b[c]._OffsetCallBack(null)
} else if (a._failRequest == VEFailedShapeRequest.QueueRequest) {
e = true;
o(b[c])
};
}
} else v()
} catch (r) {
throw r
} finally {
b = [];
if (e) {
e = false;
a.PushOffsetRequest()
}
}
}
this.PushOffsetRequest = function () {
var k = a.m_vemapcontrol.GetObliqueScene();
if (e || b.length != 0) e = true;
else if (!a.m_vemapcontrol.IsMapViewOblique() || k == null) v();
else if (g.length > 0) {
var f = Msn.VE.API.Constants.maxasynlatlongs,
d = [];
while (g.length > 0 && f > 0) {
var c = g.shift();
if (c.GetPrimitive(0).type != VEShapeType.Pushpin && c.GetPrimitive(0).points.length / 2 > f - 1) {
var j = c.GetPrimitive(0).points;
if (j.length / 2 > Msn.VE.API.Constants.maxasynlatlongs - 1) {
q(c);
if (a._drawOverMaxShapes == VEFailedShapeRequest.DoNotDraw) {
if (c._OffsetCallBack) c._OffsetCallBack(null)
} else if (a._drawOverMaxShapes == VEFailedShapeRequest.DrawInaccurately) {
c._OffsetScene = -1;
h(c);
if (c._OffsetCallBack) c._OffsetCallBack(null)
};
} else {
g.unshift(c);
f = 0
}
} else if (c._OffsetScene != k.GetID()) {
b.push(c);
d.push(new Msn.VE.LatLong(c.Latitude, c.Longitude));
f--;
if (c.GetPrimitive(0).type != VEShapeType.Pushpin) {
var j = c.GetPrimitive(0).points;
for (var i = 0; i < j.length; i = i + 2) {
d.push(new Msn.VE.LatLong(j[i + 1], j[i]));
f--
}
}
} else q(c)
}
if (g.length > 0) e = true;
if (d != null && d.length > 0) {
y = k.GetID();
a.m_vemapcontrol.LatLongToPixelAsync(d, a.m_vemapcontrol.GetZoomLevel(), J)
}
}
};
function Y() {
if (!c) return;
MC_MAX_COL_SIZE = 200;
if (c.GetCollectionCount() < 1) return;
l();
for (var d = 0; d < c.GetCollectionCount(); d++) {
var b = c.GetCollectionByIndex(d);
if (b) {
b._index = d;
MC_MAX_COL_SIZE = Math.max(MC_MAX_COL_SIZE, b.GetShapeCount());
if (!H(b)) i(b)
}
}
a.PushOffsetRequest()
}
function H(b) {
if (!c) return false;
if (b.GetType() == MC_COL_TYPE_TILEIMAGE) return false;
b._mapGuid = a.m_vemap.GUID;
if (!b.GetVisibility()) return false;
if (a.m_vemapcontrol.IsMapViewOblique()) i(b);
X(b);
var q = b.GetShapeCount();
if (a.m_vemap.GetMapMode() == Msn.VE.MapActionMode.Mode3D) {
if (VE_CheckModuleStatus(VE_ModuleName.API3D) == "loaded") mvcViewFacade._curMvcView._DrawCollectionLayer(b);
return true
}
var p = a.m_vemapcontrol.GetZoomLevel();
if (p > b.MaxScale || p < b.MinScale) return false;
l();
var e = b.GetBoundingBox();
if (q > 0 && !IsBoundsIntersect(f, e)) return false;
if (b.Spec != null && b.Spec.IconUrl != null && b.Spec.IconUrl != "undefined") Z = b.Spec.IconUrl;
var g = $ID(b.GetId());
if (g == null) {
g = document.createElement("div");
g.setAttribute("id", b.GetId());
k.appendChild(g)
}
var o = true;
m = true;
if (IsContainedInView(d, e)) {
m = false;
o = IsDisplayShape(a.m_vemap.vemapcontrol, t, e.x1, e.y1, e.x2, e.y2)
}
for (var n = 0; n < q; n++) {
var j = b.Annotations[n];
j._shplayer = b;
j.SetIndex(n);
if (!h(j, g)) r(j);
if (!o) break
}
m = true;
return true
}
function h(b, g) {
if (b.GetVisibility() && !b._clustered) {
if (a.m_vemap.GetMapMode() == Msn.VE.MapActionMode.Mode3D) {
if (VE_CheckModuleStatus(VE_ModuleName.API3D) == "loaded") mvcViewFacade._curMvcView._DrawEntity(b, null, false, false, b._shplayer);
return
}
var m = a.m_vemapcontrol.GetZoomLevel();
if (m > b.maxZoomLevel || m < b.minZoomLevel) return false;
l();
var i = E(b),
j;
if (i && b.GetPrimitive(0).type == VEShapeType.Pushpin && b._OffsetScene == currentOffetScene) {
var q = n.Decode(b._OffsetLatLong);
j = new VELatLongRectangle(q, q)
} else j = b.GetBoundingBox();
if (!IsBoundsIntersect(f, j)) return false;
if (typeof g == "undefined" || g == null) g = I(b.iid);
var d = b.GetPrimitive(0),
e = null,
c = null;
if (i) r(b);
var h = b._isDrawn;
if (d.type != VEShapeType.Pushpin) {
var c = null;
if (b._isDrawn) if (b._isHiddenForZoom || p) {
c = u(b, true);
a.ShowShape(b)
} else c = u(b, false);
else {
var k = true;
k = IsDisplayShape(a.m_vemap.vemapcontrol, t, d.minX, d.minY, d.maxX, d.maxY);
if (k) {
if (i) if (b._OffsetScene == currentOffetScene) try {
b.SetUseOffset(true);
c = z(a.m_vemapcontrol, d, b.GetIndex(), b.GetTitle())
} catch (s) {
throw s
} finally {
b.SetUseOffset(false)
} else o(b);
else c = z(a.m_vemapcontrol, d, b.GetIndex(), b.GetTitle());
if (w && c) {
c.style.zIndex = b.GetZIndexPolyShape();
g.appendChild(c)
}
if (c) h = true;
d._shapeElement = c
}
}
}
if (b.GetIconVisibility()) if (b._isDrawn) {
if (b._isHiddenForZoom || p) {
c = C(b);
if (c && d.isLabel) a.ShowIcon(b)
}
} else {
if (b.IconUrl == null) b.IconUrl = Msn.VE.API.Constants.iconurl;
e = R(b);
if (e) {
e.style.zIndex = b.GetZIndex();
g.appendChild(e);
e.innerHTML = VECreateVEShapeERO(b, a.m_vemap.GUID);
d._iconElement = e;
h = true
}
}
b._isDrawn = h;
b._isHiddenForZoom = false;
return h
}
}
function u(f, d) {
var c = f.GetShapeElement();
if (c) {
var b = f.GetPrimitive(0),
g = b.points,
e = false;
if (m) e = F(b);
d = d || e || b._isClipped;
c = a.m_vemapcontrol.GetGraphic().UpdatePoints(a.m_vemapcontrol, b, c, d);
b.points = g;
b._isClipped = e
}
return c
}
function C(d) {
var b = d.GetIconElement();
if (b) {
var c = B(d);
if (c) {
var e = a.m_vemapcontrol.GetPushpinMapPixel(new Msn.VE.LatLong(c.Latitude, c.Longitude), a.m_vemapcontrol.GetZoomLevel());
b.style.left = MathRound(e.x) - 25 / 2 + "px";
b.style.top = MathRound(e.y) - 25 / 2 + "px"
} else b = null
}
return b
}
function S(c) {
var b = c.GetShapeElement();
if (b) b = a.m_vemapcontrol.GetGraphic().UpdateStyle(a.m_vemapcontrol, c.GetPrimitive(0), b);
return b
}
function P(b) {
var c = b.GetIconElement();
if (c) {
if (b.IconUrl == null) b.IconUrl = Msn.VE.API.Constants.iconurl;
c.style.zIndex = b.GetZIndex();
c.innerHTML = VECreateVEShapeERO(b, a.m_vemap.GUID)
}
return c
}
this.ShowShape = function (b) {
var a = null;
if (b.GetPrimitive(0).type != VEShapeType.Pushpin) {
a = b.GetShapeElement();
if (a) a.style.display = "block"
}
return a
};
this.HideShape = function (b) {
var a = null;
if (b.GetPrimitive(0).type != VEShapeType.Pushpin) {
a = b.GetShapeElement();
if (a) a.style.display = "none"
}
return a
};
this.ShowIcon = function (b) {
var a = b.GetIconElement();
if (a) a.style.display = "block";
return a
};
this.HideIcon = function (b) {
var a = b.GetIconElement();
if (a) a.style.display = "none";
return a
};
function R(d) {
if (a.m_vemap.GetMapMode() == Msn.VE.MapActionMode.Mode3D) return null;
var b = d.GetPrimitive(0),
f = null,
e = b.iid;
if (b.type != VEShapeType.Pushpin) e = Msn.Drawing.GetLabelUID(b.iid);
var c = B(d);
if (c != null) return a.m_vemap.vemapcontrol.AddPushpin(e, c.Latitude, c.Longitude, 25, 25, "VEAPI_Pushpin", null, Msn.VE.API.Globals.vepushpinpanelzIndex - 1, null, true);
else return null
}
function B(a) {
var b = null;
if (E(a)) if (a._OffsetScene == currentOffetScene) b = n.Decode(a._OffsetLatLong);
else o(a);
else b = new VELatLong(a.Latitude, a.Longitude);
return b
}
function E(b) {
if (a._useOffset == VEShapeAccuracy.None || currentOffetScene == null || b._OffsetScene == -1) return false;
else if (a._useOffset == VEShapeAccuracy.Pushpin) return b.GetPrimitive(0).type == VEShapeType.Pushpin;
else if (a._useOffset == VEShapeAccuracy.All) return true;
else return false
}
function z(c, a, g, f) {
if (!a || !a.points || a.points.length < 1 || typeof a.points[0] == "undefined") return;
if (a.type == VEShapeType.Pushpin && (a.symbol == null || a.symbol != null && a.symbol.id == MC_PROPERTY_PUSHPIN)) a.symbol = VE_MapDispatch_SymbolLib.GetMapSymbolByID(MC_PROPERTY_PUSHPIN);
else if (a.symbol == null) {
var b = VE_MapDispatch_SymbolLib.GetCurrentDefaultSymbol();
if (b) a.symbol = b.Clone()
}
var e = a.points,
d = null;
if (m) a._isClipped = F(a);
d = c.GetGraphic().CreatePrimitive(c, a, f);
a.points = e;
return d
}
function W() {
if (!c) return;
var b = c.GetCollectionCount();
if (b < 1) return;
for (var a = 0; a < b; a++) {
var d = c.GetCollectionByIndex(a);
i(d)
}
}
function i(b) {
if (a.m_vemap.GetMapMode() == Msn.VE.MapActionMode.Mode3D) if (VE_CheckModuleStatus(VE_ModuleName.API3D) == "loaded") mvcViewFacade._curMvcView._ClearCollectionLayer(b);
if (b.GetType() == MC_COL_TYPE_TILEIMAGE) return;
var c = null;
c = $ID(b.GetId());
if (c == null) return null;
if (!w || c && c.hasChildNodes()) {
var e = b.GetShapeCount();
for (var d = 0; d < e; d++) r(b.Annotations[d]);
c.innerHTML = ""
}
if (b._clusterLayer) i(b._clusterLayer);
return c
}
function r(b) {
if (a.m_vemap.GetMapMode() == Msn.VE.MapActionMode.Mode3D) if (VE_CheckModuleStatus(VE_ModuleName.API3D) == "loaded") mvcViewFacade._curMvcView._ClearEntity(b);
A(b.GetPrimitive(0));
b._isDrawn = false;
b._isHiddenForZoom = false
}
function A(d) {
var a = null,
b = null,
e = d.iid;
if (d.type != VEShapeType.Pushpin) {
e = Msn.Drawing.GetLabelUID(d.iid);
b = $ID(d.iid);
if (b && b.parentNode) b.parentNode.removeChild(b)
}
a = $ID(e);
if (!a) return null;
a.detachEvent("onmouseover", VEShowVEShapeERO);
a.detachEvent("onmouseout", VEHideVEShapeERO);
a.detachEvent("onclick", VEShowVEShapeERO);
a.parentNode.removeChild(a);
var c = a.vePushpin;
if (typeof c != "undefined" && c != null) {
c.Destroy();
c.innerHtml = "";
c = null
}
}
function I(b) {
var a = c.ParseInternalID(b);
if (a && a[1]) return parentElement = U(a[1], false, k);
else return k
}
function U(b, d, c) {
var a = null;
a = $ID(b);
if (a && d) a.innerHTML = "";
if (!a) {
a = document.createElement("div");
a.setAttribute("id", b);
c.appendChild(a)
}
return a
}
this.InitLayerManager = O;
this.DrawAll = Y;
this.DrawLayer = H;
this.DrawEntity = h;
this.ClearAll = W;
this.ClearLayerDom = i;
this.ClearPrimitiveDom = A;
this.ClearEntityDom = r;
this.UpdatePoints = u;
this.UpdateIconPoints = C;
this.UpdateStyle = S;
this.UpdateIconStyle = P;
this.Draw = function () {
l(true);
if (!w) a.m_vemapcontrol.resetSvgLayer();
VE_LatLongThreshold.IsNotInit = true;
a.DrawAll();
if (a.m_vegraphicspolylines != null && a.m_vegraphicspolylines.length > 0) {
var c = a.m_vegraphicspolylines.length;
for (var b = 0; b < c; b++) {
var e = a.m_vegraphicspolylines[b];
a.DrawOne(e, true, d)
}
}
if (a.m_vegraphicspolygons != null && a.m_vegraphicspolygons.length > 0) {
var g = a.m_vegraphicspolygons.length;
for (var b = 0; b < g; b++) {
var f = a.m_vegraphicspolygons[b];
a.DrawOne(f, false, d)
}
}
};
this.DrawOne = function (b, g, i) {
if (typeof b == "undefined" || b == null) return;
if (a.m_vemap.GetMapMode() == Msn.VE.MapActionMode.Mode3D) {
V(b, g, i);
return
} else a._spacecontrol = null;
l();
a.m_vegraphiccanvas.resetOffset();
var h = b.GetLatLongs(),
c = [];
for (var e = 0; e < h.length; e++) {
var f = n.Decode(h[e]);
c.push(parseFloat(f.Longitude));
c.push(parseFloat(f.Latitude))
}
var d;
if (g) d = new Msn.Drawing.PolyLine(c);
else d = new Msn.Drawing.Polygon(c);
a.m_vegraphiccanvas.SetZIndex(17);
a.m_vegraphiccanvas.SetStroke(b.Stroke);
K(d)
};
function V(d, g) {
if (typeof d == "undefined" || d == null) return;
if (!a._spacecontrol) a._spacecontrol = a.m_vemapcontrol.Get3DControl();
var l = d.GetLatLongs(),
e = [];
for (var h = 0; h < l.length; h++) {
var i = n.Decode(l[h]);
e.push(i.Longitude);
e.push(i.Latitude)
}
var f;
if (g) f = new Msn.Drawing.PolyLine(e);
else f = new Msn.Drawing.Polygon(e);
a.m_vegraphiccanvas.SetZIndex(17);
a.m_vegraphiccanvas.SetStroke(d.Stroke);
var o = d.ID,
m = a._hackUniqueLayerId,
k = ConvertPointArrayToView3DParameter(f.points),
c = GetPrimitiveSymbolOrDefault(f, d.Stroke),
p = ConvertStrokeWeightToView3DParameter(c.stroke_weight),
b = "Linecolor='" + c.stroke_color + "'" + " Lineweight='" + p + "'" + " Dashstyle='" + c.stroke_dashstyle + "'" + " Lineopacity='" + c.stroke_opacity + "'",
j = o + a._entityIdShapePostfix;
if (g) a._spacecontrol.AddPolylineWithProperties(m, j, k, b);
else if (!g) {
b = b.concat(" Fillcolor='", c.fill_color, "'");
b = b.concat(" Fillopacity='", c.fill_opacity, "'");
b = b.concat(" Lineopacity='", c.stroke_opacity, "'");
a._spacecontrol.AddPolygonWithProperties(m, j, k, b)
}
}
function X(b) {
if (!b._isClusterLayer) {
var d;
if (a.m_vemap.GetMapMode() != Msn.VE.MapActionMode.Mode3D && b._clusteringAlgorithm != null) {
var h = a.m_vemap.GetZoomLevel(),
j = a.m_vemap.GetMapMode(),
i = a.m_vemap.GetMapStyle();
if (!b._clusterLayer) b.CreateClusterLayer();
if (!b._clusterLayer._clusterZoomLevel || b._clusterLayer._clusterZoomLevel != h || b._clusterLayer._mapMode != j || b._clusterLayer._mapStyle != i) {
for (var c = 0; c < b.Annotations.length; c++) b.Annotations[c]._clustered = false;
b._clusterLayer._clusterZoomLevel = h;
b._clusterLayer._mapMode = j;
b._clusterLayer._mapStyle = i;
b._clusterLayer.DeleteAllShapes();
if (b._clusteringAlgorithm != null) d = b._clusteringAlgorithm(b);
if (d != null) for (var c = 0; c < d.length; c++) {
var e = d[c];
if (e.Shapes && e.Shapes.length > 0) M(e, b._clusteringOptions)
}
if (b._clusteringOptions && b._clusteringOptions.Callback) clusterDescription = b._clusteringOptions.Callback(d);
var f = [];
for (var c = 0; c < d.length; c++) {
var g = d[c].GetClusterShape();
if (g != null) f.push(g)
}
b._clusterLayer.AddShapes(f);
d = null
}
} else {
if (b._clusterLayer) a.ClearLayerDom(b._clusterLayer);
for (var c = 0; c < b.Annotations.length; c++) {
b.Annotations[c]._clustered = false;
if (b.Annotations[c]._sort) b.Annotations[c]._sort = null
}
}
}
}
function M(a, f) {
if (a != null) {
var c = a.Shapes.length,
d = 0,
e = 0;
for (var b = 0; b < c; b++) {
a.Shapes[b]._clustered = true;
var j = parseFloat(a.Shapes[b].Primitives[0].points[1]),
k = parseFloat(a.Shapes[b].Primitives[0].points[0]);
d += j;
e += k
}
if (!a.LatLong && c > 0) {
var h = d / c,
i = e / c;
a.LatLong = new VELatLong(h, i)
}
var g = new VEShape(VEShapeType.Pushpin, a.LatLong);
a._clusterShape = g;
Q(a, f);
L(a)
}
}
function Q(a, b) {
if (a != null && a._clusterShape != null) if (b && b.Icon) a._clusterShape.SetCustomIcon(b.Icon);
else a._clusterShape.SetCustomIcon(Msn.VE.API.Constants.clustericonurl)
}
function L(b) {
if (b != null && b._clusterShape != null) {
var d = L_ClusterDefaultTitle_Text.replace(/%1/g, b.Shapes.length);
b._clusterShape.SetTitle(d);
var c = a.m_vemap.vemapcontrol.GetCurrentMode();
if (c && a.m_vemap.GetZoomLevel() < c.GetCurrentMaxZoomLevel(a.m_vemap.vemapcontrol.GetCurrentMapView())) b._clusterShape.SetDescription(L_ClusterDefaultDescription_Text)
}
}
}
VEGraphicsManager.prototype.RemoveLine = function (a) {
this.RemoveLinebyId(a.ID)
};
VEGraphicsManager.prototype.RemoveLinebyId = function (b) {
if (this.m_vegraphiccanvas == null || this.m_vegraphiccanvas == "undefined") {
throw new VEException("VEMap:RemoveLinebyId", "err_GraphicsInitError", L_GraphicsInitError_Text);
return
}
var c = this.m_vegraphicspolylines.length,
a = 0;
while (a < c && b != this.m_vegraphicspolylines[a].ID) a++;
if (a < c) this.m_vegraphicspolylines.splice(a, 1);
else {
throw new VEException("VEMap:RemoveLinebyId", "err_GraphicsInitError", L_invalidpolylineid_text);
return
}
if (this.m_vemap.GetMapMode() == Msn.VE.MapActionMode.Mode3D) this.Clear3DShape(b);
else {
this.Clear();
this.Draw()
}
};
VEGraphicsManager.prototype.RemoveAllLines = function () {
if (this.m_vemap.GetMapMode() == Msn.VE.MapActionMode.Mode3D) this.ClearAll3DShape();
this.m_vegraphicspolylines = [];
this.Clear();
this.Draw()
};
VEGraphicsManager.prototype.DrawLine = function (a) {
if (this.m_vegraphiccanvas == null || this.m_vegraphiccanvas == "undefined") {
throw new VEException("VEMap:DrawLine", "err_GraphicsInitError", L_GraphicsInitError_Text);
return
}
VEValidator.ValidateObject(a, "vePolyline", VEPolyline, "VEPolyline");
var c = this.m_vegraphicspolylines.length;
for (var b = 0; b < c; b++) if (a.ID == this.m_vegraphicspolylines[b].ID) throw new VEException("VEMap:DrawLine", "err_invalidpolylineid", L_invalidpolylineid_text);
this.m_vegraphicspolylines.push(a);
this.DrawOne(a, true)
};
VEGraphicsManager.prototype.RemovePolygon = function (a) {
this.RemovePolygonbyId(a.ID)
};
VEGraphicsManager.prototype.RemovePolygonbyId = function (b) {
if (this.m_vegraphiccanvas == null || this.m_vegraphiccanvas == "undefined") {
throw new VEException("VEMap:RemovePolygonbyId", "err_GraphicsInitError", L_GraphicsInitError_Text);
return
}
var c = this.m_vegraphicspolygons.length,
a = 0;
while (a < c && b != this.m_vegraphicspolygons[a].ID) a++;
if (a < c) this.m_vegraphicspolygons.splice(a, 1);
else {
throw new VEException("VEMap:RemovePolygonbyId", "err_GraphicsInitError", L_invalidpolygonid_text);
return
}
if (this.m_vemap.GetMapMode() == Msn.VE.MapActionMode.Mode3D) this.Clear3DShape(b);
else {
this.Clear();
this.Draw()
}
};
VEGraphicsManager.prototype.RemoveAllPolygons = function () {
if (this.m_vemap.GetMapMode() == Msn.VE.MapActionMode.Mode3D) this.ClearAll3DShape();
this.m_vegraphicspolygons = [];
this.Clear();
this.Draw()
};
VEGraphicsManager.prototype.DrawPolygon = function (a) {
if (this.m_vegraphiccanvas == null || this.m_vegraphiccanvas == "undefined") {
throw new VEException("VEMap:DrawPolygon", "err_GraphicsInitError", L_GraphicsInitError_Text);
return
}
VEValidator.ValidateObject(a, "vePolygon", VEPolygon, "VEPolygon");
var c = this.m_vegraphicspolygons.length;
for (var b = 0; b < c; b++) if (a.ID == this.m_vegraphicspolygons[b].ID) throw new VEException("VEMap:DrawPolygon", "err_invalidpolygonid", L_invalidpolygonid_text);
this.m_vegraphicspolygons.push(a);
this.DrawOne(a, false)
};
VEGraphicsManager.prototype.Dispose = function () {
if (this.m_vegraphiccanvas != null) {
this.m_vegraphiccanvas.Clear();
this.m_vegraphiccanvas.Destroy();
this.m_vegraphiccanvas = null
}
if (this.m_vegraphicspolylines != null && this.m_vegraphicspolylines != "undefined") {
var b = this.m_vegraphicspolylines.length;
for (var a = 0; a < b; a++) this.m_vegraphicspolylines.pop().Dispose()
}
if (this.m_vegraphicspolygons != null && this.m_vegraphicspolygons != "undefined") {
var c = this.m_vegraphicspolygons.length;
for (var a = 0; a < c; a++) this.m_vegraphicspolygons.pop().Dispose()
}
if (this.m_vemap != null) {
this.m_vemapcontrol.DetachEvent("onchangeview", this.Update);
this.m_vemapcontrol.DetachEvent("onobliquechange", this.Update);
this.m_vemapcontrol.DetachEvent("onstartzoom", this.Clear)
}
};
VEGraphicsManager.prototype.DrawAll3DPushpins = function () {
if (this.m_vemap.GetMapMode() != Msn.VE.MapActionMode.Mode3D) return;
if (!this.m_vemap.pushpins) return;
if (typeof this._spacecontrol == "undefined" || this._spacecontrol == null) this._spacecontrol = this.m_vemapcontrol.Get3DControl();
if (!this._spacecontrol) return;
var c = this.m_vemap.pushpins,
e = c.length;
for (var a = 0; a < e; a++) {
var b = c[a],
d = b.LatLong;
this.Add3DPushpin(b.ID, d.Latitude, d.Longitude, 25, 25, "VEAPI_Pushpin", b, Msn.VE.API.Globals.vepushpinpanelzIndex - 1)
}
};
VEGraphicsManager.prototype.Add3DPushpin = function (b, e, f, n, l, g, d, m) {
var h = f,
j = e,
k = this._hackUniqueLayerId,
o = 'text=""',
c;
c = GetImageFullUrl(d.Iconurl);
var i = b;
this.m_vemapcontrol.Get3DControl().AddPointWithProperties(k, i, j, h, c, o);
var a = null;
if (!$ID(b)) {
a = this.m_vemapcontrol.AddPushpin(b, e, f, n, l, g, d.GetContent(), m, "VEAPI_Pushpin", false, false);
if (a) a.style.display = "none"
}
};
VEGraphicsManager.prototype.Remove3DPushpin = function (a) {
if (typeof this._spacecontrol == "undefined" || this._spacecontrol == null) this._spacecontrol = this.m_vemapcontrol.Get3DControl();
this.Clear3DShape(a);
this.m_vemapcontrol.RemovePushpin(a)
};
VEGraphicsManager.prototype.ClearAllPushpins = function (b) {
if (typeof this._spacecontrol == "undefined" || this._spacecontrol == null) this._spacecontrol = this.m_vemapcontrol.Get3DControl();
var d = b.length;
for (var c = 0; c < d; c++) {
var a = b.pop();
if (!a.IsInLayer) {
this.Clear3DShape(a.ID);
a.Dispose()
}
}
this.m_vemapcontrol.ClearPushpins()
};
VEGraphicsManager.prototype.ClearAll3DShape = function () {
var c = null,
b = 0;
if (this.m_vegraphicspolylines != null && this.m_vegraphicspolylines != "undefined") {
b = this.m_vegraphicspolylines.length;
for (var a = 0; a < b; a++) {
c = this.m_vegraphicspolylines[a];
this.Clear3DShape(c.ID)
}
}
if (this.m_vegraphicspolygons != null && this.m_vegraphicspolygons != "undefined") {
b = this.m_vegraphicspolygons.length;
for (var a = 0; a < b; a++) {
c = this.m_vegraphicspolygons[a];
this.Clear3DShape(c.ID)
}
}
};
VEGraphicsManager.prototype.Clear3DShape = function (c) {
var a = c;
this._spacecontrol.DeleteGeometry(this._hackUniqueLayerId, a);
var b = a + this._entityIdShapePostfix;
this._spacecontrol.DeleteGeometry(this._hackUniqueLayerId, b)
};
function ConvertPointArrayToView3DParameter(a) {
var b = "",
c = a.length;
for (i = 0; i < c; i += 2) {
var d = a[i],
e = a[i + 1];
b += d + "," + e + " "
}
return b
}
function ConvertStrokeWeightToView3DParameter(a) {
if (a == null) return "";
var c = a.length,
b = a.substring(0, c - 2);
return b + "px"
}
function GetPrimitiveSymbolOrDefault(c, b) {
var a = c.symbol;
if (a == null) {
if (typeof b != "undefined") {
c.symbol = new VEShapeStyle;
a = c.symbol;
a.stroke_weight = b.width + "pt";
a.joinstyle = b.linejoin;
a.stroke_color = b.color.ToHexString();
a.stroke_dashstyle = b.linecap;
a.stroke_opacity = b.color.A.toString();
a.fill_color = b.fillcolor.ToHexString();
a.fill_opacity = b.fillcolor.A.toString();
return a
} else if (_defaultSymbol == null) {
_defaultSymbol = new VEShapeStyle;
_defaultSymbol.id = MC_PROPERTY_DEFAULT;
c.symbol = _defaultSymbol
}
return _defaultSymbol
}
return a
}
function VELatLong(b, a, c, d) {
this.Latitude = null;
this.Longitude = null;
this.Altitude = null;
this.AltitudeMode = null;
this._reserved = null;
if (b != null) {
VEValidator.ValidateFloat(b, "latitude");
this.Latitude = b
}
if (a != null) {
VEValidator.ValidateFloat(a, "longitude");
this.Longitude = a
}
if (c != null) this.SetAltitude(c, d)
}
VELatLong.prototype.SetAltitude = function (b, a) {
VEValidator.ValidateFloat(b, "altitude");
this.Altitude = b;
if (a != null) {
VEValidator.ValidateAltitudeMode(a, "altitudeMode");
this.AltitudeMode = a
} else this.AltitudeMode = VEAltitudeMode.Default
};
VELatLong.prototype.HasAltitude = function () {
return this.Altitude != null
};
function Clone() {
var a = new VELatLong;
a.Latitude = this.Latitude;
a.Longitude = this.Longitude;
a._reserved = this._reserved;
a.Altitude = this.Altitude;
a.AltitudeMode = this.AltitudeMode;
return a
}
function toString() {
var a = "";
if (this.Latitude != null && this.Longitude != null) a = this.Latitude + ", " + this.Longitude;
if (this.Altitude != null) a += ", " + this.Altitude;
return a
}
VELatLong.prototype.toString = toString;
VELatLong.prototype.Clone = Clone;
function VELatLongRectangle(d, c, b, a) {
VEValidator.ValidateObject(d, "topLeftLatLong", VELatLong, "VELatLong");
VEValidator.ValidateObject(c, "bottomRightLatLong", VELatLong, "VELatLong");
this.TopLeftLatLong = d;
this.BottomRightLatLong = c;
if (b != null && b != "undefined") {
VEValidator.ValidateObject(b, "topRightLatLong", VELatLong, "VELatLong");
this.TopRightLatLong = b
}
if (a != null && a != "undefined") {
VEValidator.ValidateObject(a, "bottomLeftLatLong", VELatLong, "VELatLong");
this.BottomLeftLatLong = a
}
}
VEAltitudeMode = new function () {
this.Default = "Ground";
this.Absolute = "Datum";
this.RelativeToGround = "Ground"
};
function _xy1() {
var a = new _xz1;
this.Decode = function (c) {
VEValidator.ValidateObject(c, "veLatLong", VELatLong, "VELatLong");
var b = c.Clone();
if (b.Latitude == null || b.Longitude == null && b._reserved != null) {
var d = a.Decode(b._reserved);
b.Latitude = d[0];
b.Longitude = d[1];
b._reserved = null
}
return b
}
}
function VELatLongFactoryAlwaysEncodeSpec() {
this.IsEncode = function () {
return true
}
}
function VELatLongFactorySpecFromMap(a) {
VEValidator.ValidateObject(a, "vemap", VEMap, "VEMap");
var b = a;
this.IsEncode = function () {
var a = b.GetMapStyle();
return a == VEMapStyle.Birdseye || a == VEMapStyle.BirdseyeHybrid
}
}
function VELatLongFactorySpecFromMapView(a) {
VEValidator.ValidateNonNull(a, "mapView");
var b = a;
this.IsEncode = function () {
return Msn.VE.MapStyle.IsViewOblique(b.mapStyle)
}
}
function VELatLongFactory(a) {
VEValidator.ValidateNonNull(a, "veLatLongFactorySpec");
var c = a,
b = new _xz1;
this.CreateVELatLong = function (e, d) {
var a = null;
if (c.IsEncode()) {
a = new VELatLong;
a._reserved = b.Encode(e, d)
} else a = new VELatLong(e, d);
return a
}
}
function VEPolyline(d, c, a, b) {
VEValidator.ValidateNonNull(d, "id");
VEValidator.ValidateNonNull(c, "arrVELatLong");
this.ID = d;
this.LatLongs = c;
this.Stroke = new Msn.Drawing.Stroke;
if (a == null || a == "undefined") a = new VEColor(17, 221, 17, .7);
this.SetColor(a);
if (b == null || b == "undefined") b = 6;
this.SetWidth(b)
}
function SetColor(a) {
VEValidator.ValidateNonNull(a);
this.Stroke.color = new Msn.Drawing.Color(a.R, a.G, a.B, a.A)
}
function SetWidth(a) {
VEValidator.ValidateInt(a, "width");
this.Stroke.width = a
}
function GetLatLongs() {
return this.LatLongs
}
function Dispose() {
this.ID = null;
this.LatLongs = null;
this.Stroke = null
}
VEPolyline.prototype.SetColor = SetColor;
VEPolyline.prototype.SetWidth = SetWidth;
VEPolyline.prototype.GetLatLongs = GetLatLongs;
VEPolyline.prototype.Dispose = Dispose;
function VEPolygon(e, d, c, a, b) {
VEValidator.ValidateNonNull(e, "id");
VEValidator.ValidateNonNull(d, "arrVELatLong");
this.ID = e;
this.LatLongs = d;
this.Stroke = new Msn.Drawing.Stroke;
if (c == null || c == "undefined") c = new VEColor(17, 221, 17, .7);
this.SetFillColor(c);
if (a == null || a == "undefined") a = new VEColor(17, 221, 17, .7);
this.SetOutlineColor(a);
if (b == null || b == "undefined") b = 6;
this.SetOutlineWidth(b)
}
function SetFillColor(a) {
VEValidator.ValidateNonNull(a);
this.Stroke.fillcolor = new Msn.Drawing.Color(a.R, a.G, a.B, a.A)
}
function SetOutlineColor(a) {
VEValidator.ValidateNonNull(a);
this.Stroke.color = new Msn.Drawing.Color(a.R, a.G, a.B, a.A)
}
function SetOutlineWidth(a) {
VEValidator.ValidateInt(a, "width");
this.Stroke.width = a
}
function GetLatLongs() {
return this.LatLongs
}
function Dispose() {
this.ID = null;
this.LatLongs = null;
this.Stroke = null
}
VEPolygon.prototype.SetFillColor = SetFillColor;
VEPolygon.prototype.SetOutlineColor = SetOutlineColor;
VEPolygon.prototype.SetOutlineWidth = SetOutlineWidth;
VEPolygon.prototype.GetLatLongs = GetLatLongs;
VEPolygon.prototype.Dispose = Dispose;
function VEColor(d, c, b, a) {
VEValidator.ValidateInt(d, "r");
VEValidator.ValidateBetween(d, "r", 0, 255);
VEValidator.ValidateInt(c, "g");
VEValidator.ValidateBetween(c, "g", 0, 255);
VEValidator.ValidateInt(b, "b");
VEValidator.ValidateBetween(b, "b", 0, 255);
VEValidator.ValidateFloat(a, "a");
VEValidator.ValidateBetween(a, "a", 0, 1);
Msn.Drawing.Color.call(this, d, c, b, a)
}
var L_integerencodingoutofrange_text = "VEIntegerEncoding: The number encoded is out of supported range",
L_floatintegermapencodingoutofrange_text = "VEFloatIntegerMap: The number encoded is out of supported range",
L_integerencodinginvalidstringlength_text = "VEIntegerEncoding: Invalid string length",
L_integerencodingunknowndigit_text = "VEIntegerEncoding: The encoded string has an unknown digit";
function VEIntegerEncoding(g, j) {
var e = g,
d = g.length,
a = j,
h = 1;
for (var i = 0; i < a; ++i) h *= d;
var f = h - 1,
c = [];
for (var b = 0; b < e.length; ++b) c[e.substr(b, 1)] = b;
this.MaxValue = function () {
return f
};
this.ValueLength = function () {
return a
};
this.Encode = function (c) {
if (c <= f) {
var h = "",
g = [];
for (var b = 0; b < a; ++b) g[b] = 0;
var i = a - 1;
while (c > 0) {
g[i] = Math.floor(c % d);
c = Math.floor(c / d);
--i
}
for (var b = 0; b < g.length; ++b) h += e.substr(g[b], 1);
return h
} else throw L_integerencodingoutofrange_text
};
this.Decode = function (c) {
if (c.length == a) {
var b = 0;
for (var e = 0; e < c.length; ++e) {
b *= d;
b += this.DigitValue(c.substr(e, 1))
}
return b
} else throw L_integerencodinginvalidstringlength_text
};
this.DigitValue = function (a) {
if (c[a] != null && c[a] != "undefined") return c[a];
else throw L_integerencodingunknowndigit_text
}
}
function VEFloatIntegerMap(e, d, f) {
var a = e,
c = d,
b = f;
this.MinFloat = function () {
return a
};
this.MaxFloat = function () {
return c
};
this.MaxInt = function () {
return b
};
this.FloatToInt = function (d) {
if (d >= a && d <= c) {
var e = (d - a) / (c - a),
f = e * b + .5;
return Math.min(Math.floor(f), b)
} else throw L_floatintegermapencodingoutofrange_text
};
this.IntToFloat = function (d) {
if (d <= b) {
var f = d / b,
e = a + f * (c - a);
return e
} else throw L_floatintegermapencodingoutofrange_text
}
}
var L_velatlongencodinginvalidstringlength_text = "_xz1: Invalid string length";
function _xz1(b) {
var i = -90,
h = 90,
g = -180,
f = 180,
j = "0123456789bcdfghjkmnpqrstvwxyz",
e = 6;
if (b != null && typeof b != "undefined") e = b;
var a = new VEIntegerEncoding(j, e),
d = new VEFloatIntegerMap(i, h, a.MaxValue()),
c = new VEFloatIntegerMap(g, f, a.MaxValue());
this.Encode = function (e, b) {
var f = a.Encode(d.FloatToInt(e)) + a.Encode(c.FloatToInt(b));
return f
};
this.Decode = function (f) {
if (f.length == 2 * a.ValueLength()) {
var e = a.ValueLength(),
j = f.substr(0, e),
h = f.substr(e, e),
i = a.Decode(j),
g = a.Decode(h),
b = [];
b[0] = d.IntToFloat(i);
b[1] = c.IntToFloat(g);
return b
} else throw L_velatlongencodinginvalidstringlength_text
}
}
function _xz1ForMobile() {
_xz1.call(this, 5)
}
VEMapMode = new function () {
this.Mode2D = 1;
this.Mode3D = 2
};
function VEMapViewSpecification(c, d, e, g, f) {
this.LatLong = null;
this.ZoomLevel = null;
this.Altitude = null;
this.Pitch = null;
this.Heading = null;
if (c != null && c != "undefined") {
VEValidator.ValidateObject(c, "veLatLong", VELatLong, "VELatLong");
this.LatLong = c
}
if (d != null && d != "undefined") {
VEValidator.ValidateNonNegativeInt(d, "zoomLevel");
this.ZoomLevel = d
}
if (e != null && e != "undefined") {
VEValidator.ValidateFloat(e, "altitude");
this.Altitude = parseFloat(e)
}
if (g != null && g != "undefined") {
VEValidator.ValidateFloat(g, "pitch");
var a = parseFloat(g);
a = a % 360;
if (a < -90) a = -90;
if (a > 90) a = 90;
this.Pitch = a
}
if (f != null && f != "undefined") {
VEValidator.ValidateFloat(f, "heading");
var b = parseFloat(f);
b = b % 360;
if (b < 0) b += 360;
this.Heading = b
}
}
function MapViewSpecClone() {
var a = new VEMapViewSpecification;
a.LatLong = this.LatLong.Clone();
a.Altitude = this.Altitude;
a.Pitch = this.Pitch;
a.Heading = this.Heading;
return veLatLong
}
VEMapViewSpecification.prototype.Clone = MapViewSpecClone;
VEMapStyle = new function () {
this.Road = Msn.VE.MapStyle.Road;
this.Shaded = Msn.VE.MapStyle.Shaded;
this.Aerial = Msn.VE.MapStyle.Aerial;
this.Hybrid = Msn.VE.MapStyle.Hybrid;
this.Oblique = Msn.VE.MapStyle.Oblique;
this.Birdseye = Msn.VE.MapStyle.Oblique;
this.BirdseyeHybrid = Msn.VE.MapStyle.ObliqueHybrid
};
VEOrientation = new function () {
this.North = Msn.VE.Orientation.North;
this.East = Msn.VE.Orientation.East;
this.West = Msn.VE.Orientation.West;
this.South = Msn.VE.Orientation.South
};
function VEBirdseyeScene(d) {
VEValidator.ValidateNonNull(d, "obliqueScene");
var a = d,
f = null,
c = null,
e = new VELatLongFactory(new VELatLongFactoryAlwaysEncodeSpec),
b = new _xy1;
this.PixelToLatLong = function (d, b, f) {
if (b != null) {
VEValidator.ValidateNonNegativeInt(b, "zoomLevel");
b = parseInt(b)
} else b = VEMap._GetMapFromGUID(c).GetZoomLevel();
if (f) {
VEValidator.ValidateObjectArray(d, "pixelArray", VEPixel, "VEPixel array");
VEValidator.ValidateFunction(f, "callback");
this.PixelToLatLongAsync(d, b, f)
} else {
VEValidator.ValidateObject(d, "pixel", VEPixel, "VEPixel");
var g = a.PixelToLatLong(d, b);
return e.CreateVELatLong(g.latitude, g.longitude)
}
};
this.PixelToLatLongAsync = function (b, c, d) {
a.PixelToLatLongAsync(b, c, d)
};
this.LatLongToPixel = function (e, d, f) {
if (d != null) {
VEValidator.ValidateNonNegativeInt(d, "zoomLevel");
d = parseInt(d)
} else d = VEMap._GetMapFromGUID(c).GetZoomLevel();
if (f) {
VEValidator.ValidateObjectArray(e, "veLatLongArray", VELatLong, "VELatLong array");
VEValidator.ValidateFunction(f, "callback");
this.LatLongToPixelAsync(e, d, f)
} else {
VEValidator.ValidateObject(e, "veLatLong", VELatLong, "VELatLong");
var g = b.Decode(e),
h = new Msn.VE.LatLong(g.Latitude, g.Longitude);
return a.LatLongToPixel(h, d)
}
};
this.LatLongToPixelAsync = function (e, g, h) {
var f = [];
for (var c = 0; c < e.length; ++c) {
var d = b.Decode(e[c]);
f[c] = new Msn.VE.LatLong(d.Latitude, d.Longitude)
}
a.LatLongToPixelAsync(f, g, h)
};
this.IsValidTile = function (c, d, b) {
return a.IsValidTile(c, d, b)
};
this.GetID = function () {
return a.GetID()
};
this.GetTileFilename = function () {
return a.GetTileFilename()
};
this.GetThumbnailFilename = function () {
return a.GetThumbnailFilename()
};
this.GetOrientation = function () {
return a.GetOrientation()
};
this.GetBounds = function () {
return a.GetBounds()
};
this.GetWidth = function () {
return a.GetWidth()
};
this.GetHeight = function () {
return a.GetHeight()
};
this.ContainsLatLong = function (d) {
VEValidator.ValidateObject(d, "veLatLong", VELatLong, "VELatLong");
var c = b.Decode(d),
e = new Msn.VE.LatLong(c.Latitude, c.Longitude);
return a.ContainsLatLong(e)
};
this.ContainsPixel = function (d, e, b) {
var c = new VEPixel(d, e);
return a.ContainsPixel(c, b)
};
this.SetClientToken = function (b) {
f = b;
a.SetClientToken(b)
};
this.SetGUID = function (b) {
c = b;
a.SetGUID(b)
};
this.GetBoundingRectangle = function () {
var g = a.PixelToLatLong(new VEPixel(0, 0), 2),
h = a.PixelToLatLong(new VEPixel(a.GetWidth(), a.GetHeight()), 2),
i = null;
if (g && h) {
var b = 100,
c = g.latitude,
d = h.latitude,
e = g.longitude,
f = h.longitude;
if (c < d) {
c = Math.floor(c * b) / b;
d = Math.ceil(d * b) / b
} else {
c = Math.ceil(c * b) / b;
d = Math.floor(d * b) / b
}
if (e < f) {
e = Math.floor(e * b) / b;
f = Math.ceil(f * b) / b
} else {
e = Math.ceil(e * b) / b;
f = Math.floor(f * b) / b
}
i = new VELatLongRectangle(new VELatLong(c, e), new VELatLong(d, f))
}
return i
};
this.GetBoundingRectangleNorthFacing = function () {
var b = this.GetBoundingRectangle(),
c = null;
switch (a.GetOrientation()) {
case Msn.VE.Orientation.East:
c = new VELatLongRectangle(new VELatLong(b.TopLeftLatLong.Latitude, b.BottomRightLatLong.Longitude), new VELatLong(b.BottomRightLatLong.Latitude, b.TopLeftLatLong.Longitude));
break;
case Msn.VE.Orientation.South:
c = new VELatLongRectangle(new VELatLong(b.BottomRightLatLong.Latitude, b.BottomRightLatLong.Longitude), new VELatLong(b.TopLeftLatLong.Latitude, b.TopLeftLatLong.Longitude));
break;
case Msn.VE.Orientation.West:
c = new VELatLongRectangle(new VELatLong(b.BottomRightLatLong.Latitude, b.TopLeftLatLong.Longitude), new VELatLong(b.TopLeftLatLong.Latitude, b.BottomRightLatLong.Longitude));
break;
default:
c = b
}
return c
}
}
VEMap.prototype.__HandleAuthentication = function (a) {
if (this.vemapcontrol) this.vemapcontrol.__HandleAuthentication(a)
};
VEMap.prototype.IsValidCredentialsInResponse = function (a) {
var b = false;
if (a && a.ResponseSummary && a.ResponseSummary.AuthResultCode != null) {
var c = a.ResponseSummary.AuthResultCode;
switch (c) {
case VEAuthenticationCode.None:
case VEAuthenticationCode.NoToken:
case VEAuthenticationCode.TokenValid:
b = true
}
}
return b
};
var VE_ModuleName = {
APICORE: "__core__",
APICONTROLS: "__controls__",
APIBIRDSEYE: "__birdseye__",
APILAYERS: "__layers__",
APIFIND: "__find__",
APIROUTING: "__routing__",
APITRAFFIC: "__traffic__",
API3D: "__3d__",
APITILES: "__tiles__"
},
_VE_ModuleStatus = {
"__core__": "loaded",
"__layers__": null,
"__controls__": null,
"__find__": null,
"__routing__": null,
"__traffic__": null,
"___3d__": null,
"__birdseye__": null,
"__tiles__": null
};
function _VE_InitAllModules(a) {
if (Msn.VE.API.Globals.vemapinstances || a == null) {
var b = Msn.VE.API.Globals.vemapinstances;
for (var c in b) if (b[c] instanceof VEMap) b[c]._InitializeModules(a.split(","))
}
if (_VEDownloadQueue) _VEDownloadQueue.Fire(a)
}
function VE_GetLoadedAPIModules() {
var b = [VE_ModuleName.APICORE, VE_ModuleName.APICONTROLS, VE_ModuleName.APIBIRDSEYE, VE_ModuleName.APILAYERS, VE_ModuleName.APIFIND, VE_ModuleName.APIROUTING, VE_ModuleName.APITRAFFIC, VE_ModuleName.API3D, VE_ModuleName.APITILES],
c = [],
d = b.length;
for (var a = 0; a < d; a++) if (VE_CheckModuleStatus(b[a]) == "loaded") c.push(b[a]);
return c
}
function VE_CheckModuleStatus(a) {
if (a == VE_ModuleName.API3D) a = "_" + a;
return _VE_ModuleStatus[a]
}
function VE_SetModuleStatus(a, b) {
if (a == null && typeof _VE_ModuleStatus[a] == "undefined") return;
if (a == VE_ModuleName.API3D) a = "_" + a;
_VE_ModuleStatus[a] = b
}
VE_RequestUrl = Msn.VE.API.Globals.vecurrentdomain + "/veapi.ashx?VEAPI_DisableAtlasCompat=true&v=" + Msn.VE.API.Globals.vecurrentversion + "&__load__";
function VEOndemandJsDownloads(l, a, d, g) {
var e = null;
if (a == null || typeof a != "string" || typeof d != "object") throw new VEException("VEJsDownloadQueue:Fire", "err_invalidmoduleurl", L_noscripturl_text);
if (typeof g != "object") g = null;
var j = false,
h = false,
b = null;
b = a.split(",");
var m = b.length,
i = true,
f = null;
for (var c = 0; c < m; c++) {
f = VE_CheckModuleStatus(b[c]);
if (typeof f == "undefined") throw new VEException("VEJsDownloadQueue:Fire", "err_invalidmoduleurl", L_noscripturl_text);
else if (f == null) {
if (i) {
a = b[0];
i = false
} else a += "," + b[c];
j = true;
VE_SetModuleStatus(b[c], "loading")
} else if (f == "loading") h = true
}
if (j) {
if (_VEDownloadQueue == null) _VEDownloadQueue = new VEJsDownloadQueue;
var k = VE_RequestUrl + "=" + a;
_VEDownloadQueue.Push(a, d.GUID, g);
if (l) VENetwork.DownloadScript(k);
else VENetwork.DownloadScript(k, _VEDownloadQueue.Fire, a);
e = null
} else if (h) {
_VEDownloadQueue.Push(a, d.GUID, g);
e = null
} else e = d;
return e
}
function VEJsDownloadQueue() {
var a = [],
c = [],
b = [];
this.Dispose = function () {
a = [];
c = [];
b = []
};
this.Push = function (d, f, e) {
if (typeof mapContext == "undefined") mapContext = null;
a.push(e);
c.push(d);
b.push(f)
};
this.Fire = function (f) {
if (a.length == 0) return;
for (var d = 0; d < a.length; d++) if (c[d] == f) {
if (b[d]) {
var e = null;
e = Msn.VE.API.Globals.vemapinstances[b[d]];
if (e && typeof a[d][0] == "function") a[d][0].call(e, a[d][1], a[d][2], a[d][3], a[d][4]);
else throw new VEException("VEJsDownloadQueue:Fire", "err_invalidinvoketarget", L_invalidinvoketarget_text)
} else a[d][0](a[d][1], a[d][2], a[d][3], a[d][4]);
a.splice(d, 1);
c.splice(d, 1);
b.splice(d, 1);
d--
}
}
}
var _VEDownloadQueue = null;
_VERegisterNamespaces("Msn.VE");
Msn.VE.Animation = {
Animation: function (h, f) {
var b = false;
this.Running = b;
var e = h,
d = f,
a = null;
function c() {
if (b) {
e();
a = setTimeout(c, d)
} else a = null
}
function g() {
if (!b) {
b = true;
c();
a = window.setTimeout(c, d)
}
}
this.Start = g;
function i() {
if (a != null) {
window.clearTimeout(a);
a = null
}
b = false
}
this.Stop = i
},
AccelerationFunction: function (e) {
var b = null,
a = 200,
d = e;
this.setSteps = function (d) {
a = d;
b = null;
c()
};
this.getSteps = function () {
return a
};
this.getValue = function (e) {
if (!b) c();
var d = parseInt(Math.round(e * a));
if (d < 0) d = 0;
if (d > a) d = a;
return b[d]
};
this.getTotal = function () {
return this.getValue(1)
};
function c() {
b = [];
b[0] = 0;
for (var c = 1; c <= a; c++) b[c] = b[c - 1] + d(c / a)
}
},
Movie: function (b, g) {
var a = this;
this.Repeat = true;
this.AppendContent = true;
var e = [],
c = -1,
d = null;
this.addFrame = function (b, a) {
if (a == null) a = true;
var c = {
data: b,
append: a
};
e.push(c)
};
this.start = function () {
a.stop();
a.show();
a.clear();
c = -1;
d = setInterval(h, g)
};
this.stop = function () {
if (d) clearInterval(d)
};
this.end = function () {
a.stop();
f(e.length - 1)
};
this.show = function () {
b.style.visibility = "visible"
};
this.hide = function () {
b.style.visibility = "hidden"
};
this.clear = function () {
b.innerHTML = ""
};
function h() {
c++;
if (c > e.length - 1) {
c = 0;
if (!a.Repeat) {
clearInterval(d);
return
} else a.clear()
}
f(c)
}
function f(c) {
var a = e[c];
if (a.append) b.innerHTML += a.data;
else b.innerHTML = a.data
}
},
RollDirection: {
TopDown: 1,
RightLeft: 2,
BottomUp: 4,
LeftRight: 8
},
RollStyle: {
In: 0,
Out: 1
},
Roller: function (q) {
var c = this;
this.superclass = Msn.VE.OO.Eventable.EventableObject;
this.superclass();
var l = Msn.VE.Css,
a = Msn.VE.Animation,
h = Msn.VE.OO.Eventable,
b = q,
d = null,
f = true,
g = false,
e = AccelerationFunctions.CrazyElevator,
i = 10,
j = 10,
m = 5,
p = {
top: 1,
right: 2,
bottom: 3,
left: 4
},
o = {
top: 3,
right: 4,
bottom: 1,
left: 2
};
this.setAccelerationFunction = function (a) {
if (a instanceof Msn.VE.Animation.AccelerationFunction) e = a
};
this.setXLeave = function (a) {
if (typeof a == "number" && a >= 0) i = Math.floor(a, 10)
};
this.setYLeave = function (a) {
if (typeof a == "number" && a >= 0) j = Math.floor(a, 10)
};
this.getLeave = function () {
return {
x: i,
y: j
}
};
this.setDelay = function (a) {
if (typeof a == "number" && a > 0) m = Math.floor(a, 10)
};
this.isExpanded = function () {
return f
};
this.isRolling = function () {
return g
};
this.isAssociated = function () {
if (d != null && d.length > 0) return true;
return false
};
this.associate = function (a) {
if (a instanceof Array) d = a
};
this.rollIn = function (d) {
if (g) return;
c.executeEvent("beforerollin", c, new h.EventArgs("beforerollin", b));
k(a.RollStyle.In, d);
f = false
};
this.rollOut = function (d) {
if (g) return;
c.executeEvent("beforerollout", c, new h.EventArgs("beforerollout", b));
k(a.RollStyle.Out, d);
f = true
};
this.expand = function (b) {
k(a.RollStyle.Out, b, false);
f = true
};
this.collapse = function (b) {
k(a.RollStyle.In, b, false);
f = false
};
function k(u, k, t) {
g = true;
if (t !== false) t = true;
n();
var f = p,
q = 0,
r = 0;
if (u == a.RollStyle.Out) {
f = o;
q = i;
r = j
}
var y = b.offsetWidth,
w = b.offsetHeight,
A = y - i,
B = w - j,
C = A / e.getTotal(),
D = B / e.getTotal(),
x = e.getSteps();
if (!t) {
v(1)();
return
}
for (var s = 0; s <= x; s++) {
var z = s / x;
setTimeout(v(z), s * m)
}
function v(i) {
return function () {
var m = parseInt(Math.round(e.getValue(i) * C)) + q,
n = parseInt(Math.round(e.getValue(i) * D)) + r,
j = {
top: 0,
right: 0,
bottom: 0,
left: 0
};
if ((k & a.RollDirection.TopDown) == a.RollDirection.TopDown) {
l.Functions.setClip(b, f.top, n + "px");
j.top = n - r
}
if ((k & a.RollDirection.RightLeft) == a.RollDirection.RightLeft) {
l.Functions.setClip(b, f.right, y - m + "px");
j.right = -m + q
}
if ((k & a.RollDirection.BottomUp) == a.RollDirection.BottomUp) {
l.Functions.setClip(b, f.bottom, w - n + "px");
j.bottom = -n + r
}
if ((k & a.RollDirection.LeftRight) == a.RollDirection.LeftRight) {
l.Functions.setClip(b, f.left, m + "px");
j.left = m - q
}
if (d != null) {
var p;
for (p = 0; p < d.length; p++) {
var o = d[p],
t = j.top + j.bottom,
x = o.origPos.y + t,
s = j.left + j.right,
v = o.origPos.x + s;
if (s != 0) o.style.left = v + "px";
if (t != 0) o.style.top = x + "px"
}
}
if (i == 1) {
g = false;
if (u == a.RollStyle.In) c.executeEvent("afterrollin", c, new h.EventArgs("afterrollin", b));
else {
b.style.clip = "rect(auto auto auto auto)";
c.executeEvent("afterrollout", c, new h.EventArgs("afterrollout", b))
}
}
c.executeEvent("roll", c, new h.EventArgs("roll", b))
}
}
}
function n() {
var b = Msn.VE.Css;
if (d == null) return;
var c, i = d.length;
for (c = 0; c < i; c++) {
var a = d[c];
a.origPos = {
x: parseInt(b.Functions.getComputedStyle(a, "left")),
y: parseInt(b.Functions.getComputedStyle(a, "top"))
};
if (isNaN(a.origPos.x)) {
var f = parseInt(b.Functions.getComputedStyle(a, "marginLeft"), 10),
e = parseInt(b.Functions.getCoputedStyle(a, "paddingLeft"), 10);
a.origPos.x = a.offsetLeft - (isNaN(f) ? 0 : f) - (isNaN(e) ? 0 : e)
}
if (isNaN(a.origPos.y)) {
var h = parseInt(b.Functions.getComputedStyle(a, "marginTop"), 10),
g = parseInt(b.Functions.getComputedStyle(a, "paddingTop"), 10);
a.origPos.y = a.offsetTop - (isNaN(h) ? 0 : h) - (isNaN(g) ? 0 : g)
}
}
b = null
}
},
Slider: function () {
var d = this,
c = Msn.VE.Geometry,
a = AccelerationFunctions.Linear,
b = 5;
this.setAccelerationFunction = function (b) {
if (b instanceof Msn.VE.Animation.AccelerationFunction) a = b
};
this.setDelay = function (a) {
if (typeof a == "number" && a > 0) b = a
};
this.slideToPoint = function (e, i) {
var d = new c.Point(e.offsetLeft, e.offsetTop),
n = d.getDistanceFrom(i);
a.setSteps(Math.floor(n / 10));
var p = n / a.getTotal(),
o = i.y - d.y,
l = i.x - d.x,
f = Math.atan(o / l),
m = a.getSteps();
for (var h = 0; h <= m; h++) {
sum = a.getValue(h / m);
var g = sum * p,
k, j;
if (l < 0) {
k = d.y - Math.sin(f) * g;
j = d.x - Math.cos(f) * g
} else {
k = d.y + Math.sin(f) * g;
j = d.x + Math.cos(f) * g
}
setTimeout(q(j, k), h * b)
}
function q(a, b) {
return function () {
e.style.top = parseInt(Math.round(b)) + "px";
e.style.left = parseInt(Math.round(a)) + "px"
}
}
}
}
};
var AccelerationFunctions = {
Linear: new Msn.VE.Animation.AccelerationFunction(function () {
return 1
}),
ExponentialAcc: new Msn.VE.Animation.AccelerationFunction(function (b) {
var a = 0,
d = 1,
c = d - a,
f = a + b * c,
e = Math.pow(f, 2);
return e
}),
ExponentialDec: new Msn.VE.Animation.AccelerationFunction(function (b) {
var a = -1,
d = 0,
c = d - a,
f = a + b * c,
e = Math.pow(f, 2);
return e
}),
CosineWave: new Msn.VE.Animation.AccelerationFunction(function (b) {
var a = -Math.PI,
d = Math.PI,
c = d - a,
f = a + b * c,
e = Math.cos(f) + 1;
return e
}),
CrazyElevator: new Msn.VE.Animation.AccelerationFunction(function (b) {
var a = -5,
d = 5,
c = d - a,
f = a + b * c,
e = 2 / (Math.pow(Math.abs(f), 3) + 1);
return e
})
};
_VERegisterNamespaces("Msn.VE.Geometry");
Msn.VE.Geometry.Point = function (c, d) {
var a = this,
b = Msn.VE.Geometry;
this.x = c;
this.y = d;
this.add = function (c, d) {
var e = new b.Point(a.x + c, a.y + d);
return e
};
this.getDistanceFrom = function (b) {
var c = Math.pow(b.x - a.x, 2) + Math.pow(b.y - a.y, 2),
d = Math.sqrt(c);
return d
}
};
Msn.VE.Geometry.Overlap = {
Range: {
GreaterThanX: 1,
LessThanX: 2,
GreaterThanY: 4,
LessThanY: 8,
InXRange: 16,
InYRange: 32,
InRange: 48
},
getInstance: function (f, g) {
var d = Msn.VE.Geometry.Overlap,
a = f,
b = g,
c = 0;
e();
function e() {
if (b.getP2().x > a.getP2().x) c += d.Range.GreaterThanX;
if (b.getP1().x < a.getP1().x) c += d.Range.LessThanX;
if (b.getP2().y > a.getP2().y) c += d.Range.GreaterThanY;
if (b.getP1().y < a.getP1().y) c += d.Range.LessThanY;
if (a.getP1().x <= b.getP1().x && b.getP2().x <= a.getP2().x) c += d.Range.InXRange;
if (a.getP1().y <= b.getP1().y && b.getP2().y <= a.getP2().y) c += d.Range.InYRange
}
this.getRange = function () {
return c
};
this.getLeftXBleed = function () {
if (c & d.Range.LessThanX) return Math.abs(a.getP1().x - b.getP1().x);
else return 0
};
this.getRightXBleed = function () {
if (c & d.Range.GreaterThanX) return b.getP2().x - a.getP2().x;
else return 0
};
this.getTopYBleed = function () {
if (c & d.Range.LessThanY) return Math.abs(a.getP1().y - b.getP1().y);
else return 0
};
this.getBottomYBleed = function () {
if (c & d.Range.GreaterThanY) return b.getP2().y - a.getP2().y;
else return 0
}
}
};
Msn.VE.Geometry.Rectangle = function (h, i) {
var g = this,
a = h,
b = i,
d, e;
f();
function f() {
c()
}
this.move = function (c) {
a.x = c.x;
a.y = c.y;
b.x = c.x + e;
b.y = c.y + d
};
this.getP1 = function () {
return a
};
this.getP2 = function () {
return b
};
this.setP1 = function (b) {
a = b;
c()
};
this.setP2 = function (a) {
b = a;
c()
};
this.getWidth = function () {
return e
};
this.getHeight = function () {
return d
};
this.containsPoint = function (c) {
return c.x >= a.x && c.x <= b.x && c.y >= a.y && c.y <= b.y
};
this.scale = function (d) {
a.x -= d;
a.y -= d;
b.x += d;
b.y += d;
c()
};
this.getOverlap = function (a) {
var b = Msn.VE.Geometry;
return new b.Overlap.getInstance(g, a)
};
function c() {
d = b.y - a.y;
e = b.x - a.x
}
};
Msn.VE.Geometry.Functions = {
getSlope: function (a, b) {
return (b.y - a.y) / (b.x - a.x)
},
getYIntercept: function (b, a) {
return a.y - b * a.x
},
getBestBoundingPoint: function (f, b, c) {
var a = Msn.VE.Geometry;
if (!b) b = g(f).getScreenPosition();
var e = new a.Rectangle(b, new a.Point(b.x + f.offsetWidth, b.y + f.offsetHeight)),
j = c.getOverlap(e),
d = j.getRange();
if ((d & a.Overlap.Range.InRange) == a.Overlap.Range.InRange) return b;
var h = b.x,
i = b.y;
if (d & a.Overlap.Range.GreaterThanX) h = c.getP2().x - e.getWidth();
if (d & a.Overlap.Range.LessThanX) h = c.getP1().x;
if (d & a.Overlap.Range.GreaterThanY) i = c.getP2().y - e.getHeight();
if (d & a.Overlap.Range.LessThanY) i = c.getP1().y;
return new a.Point(h, i)
}
};
_VERegisterNamespaces("Msn.VE.OO.Eventable");
Msn.VE.OO.Eventable.EventArgs = function (b, a) {
this.EventName = b;
this.Recipient = a
};
Msn.VE.OO.Eventable.EventableObject = function () {
if (typeof window.attachEvent != "undefined") window.attachEvent("onunload", c);
var a = [];
this.getEventHash = function () {
return a
};
this.hookEvent = function (d, e) {
var c = a[d];
if (typeof c == "undefined" || c == null) {
c = new b(d);
a[d] = c
}
c.addEvent(e)
};
this.unhookEvent = function (d, e) {
var c = a[d];
if (c instanceof b) c.removeEvent(e)
};
this.executeEvent = function (g, h, f) {
var d = a[g];
if (!(d instanceof b)) return;
var e = d.getEvents(),
c;
for (c = 0; c < e.length; c++) e[c].call(h, f)
};
function b(b) {
var c = b,
a = [];
this.addEvent = function (c) {
if (typeof c == "function") {
var b;
for (b = 0; b < a.length; b++) if (a[b] == c) return;
a.push(c)
}
};
this.removeEvent = function (c) {
if (typeof c != "function") return;
var b;
for (b = 0; b < a.length; b++) if (a[b] == c) {
a[b] = null;
delete a[b];
a.splice(b, 1)
}
};
this.destroy = function () {
var b;
for (b = 0; b < a.length; b++) {
a[b] = null;
delete a[b]
}
};
this.getEvents = function () {
return a
}
}
function c() {
var d;
for (d in a) if (a[d] instanceof b) {
a[d].destroy();
a[d] = null
}
a = null;
window.detachEvent("onunload", c)
}
};
var ERO = {
Classes: {
ContainerNoBeak: "ero ero-noBeak",
ContainerRightBeak: "ero ero-rightBeak",
ContainerLeftBeak: "ero ero-leftBeak",
Beak: "ero-beak",
Shadow: "ero-shadow",
Body: "ero-body",
Actions: "ero-actions",
ActionsBackground: "ero-actionsBackground",
PreviewArea: "ero-previewArea",
PaddingHack: "ero-paddingHack",
ProgressAnimation: "ero-progressAnimation"
},
DefaultClasses: null,
BeakDirection: {
Right: 0,
Left: 1
},
DockPosition: {
Top: 0,
Center: 1
},
m_theEro: null,
BeakHeight: 34,
Glitz: function (d, e, b, c) {
var a = this;
this.useBeak = d;
this.useFade = e;
this.useProgressTimer = b;
this.isTemporary = c;
this.copy = function () {
return new ERO.Glitz(a.useBeak, a.useFade, a.useProgressTimer, a.isTemporary)
}
},
EROEventArgs: function (c, a, b) {
this.superclass = Msn.VE.OO.Eventable.EventArgs;
this.superclass(c, a);
this.Entity = b
},
getInstance: function () {
var a = Msn.VE.Geometry;
if (!ERO.m_theEro) {
ERO.m_theEro = new b;
ERO.m_theEro.setBoundingArea(null)
}
ERO.m_theEro.addToPage();
return ERO.m_theEro;
function b() {
this.superclass = Msn.VE.OO.Eventable.EventableObject;
this.superclass();
var c = this,
r = null,
f = null,
k = null,
h = false,
o = 500,
n = 0,
B = true,
i = new ERO.Glitz(true, true, true, false),
C = i.copy(),
w = 0,
z = false,
b = document.createElement("div");
b.className = ERO.Classes.ContainerLeftBeak;
if (typeof b.addEventListener != "undefined") {
b.addEventListener("mouseover", x, false);
b.addEventListener("mouseout", y, false)
} else {
b.attachEvent("onmouseover", x);
b.attachEvent("onmouseout", y)
}
var s = document.createElement("div");
s.className = ERO.Classes.Shadow;
var j = document.createElement("div");
j.className = ERO.Classes.Body;
var q = document.createElement("div");
q.className = ERO.Classes.Actions;
var p = document.createElement("ul"),
m = document.createElement("div");
m.className = ERO.Classes.ActionsBackground;
var l = document.createElement("div");
l.className = ERO.Classes.PreviewArea;
var t = document.createElement("div");
t.className = ERO.Classes.Beak;
var v = document.createElement("div");
v.className = ERO.Classes.PaddingHack;
b.appendChild(s);
b.appendChild(t);
s.appendChild(j);
j.appendChild(m);
m.appendChild(l);
m.appendChild(q);
q.appendChild(p);
m.appendChild(v);
var d = document.createElement("div");
d.className = ERO.Classes.ProgressAnimation;
var e = new Msn.VE.Animation.Movie(d, 75);
e.addFrame('');
e.addFrame('');
e.addFrame('');
e.addFrame("");
e.addFrame("");
e.addFrame('', false);
e.addFrame('', false);
e.Repeat = false;
this.destroy = function () {
if (b) {
if (typeof b.removeEventListener != "undefined") {
b.removeEventListener("mouseover", x, false);
b.removeEventListener("mouseout", y, false)
} else {
b.detachEvent("onmouseover", x);
b.detachEvent("onmouseout", y)
}
if (j.shimElement) {
j.shimElement.removeNode(true);
j.shimElement = null
}
b.parentNode.removeChild(b);
d.parentNode.removeChild(d);
b = null;
s = null;
j = null;
q = null;
p = null;
m = null;
l = null;
t = null;
v = null
}
ERO.m_theEro = null;
k = null
};
this.getElement = function () {
return b
};
this.getBody = function () {
return j
};
this.getAnimation = function () {
return e
};
this.getDelay = function () {
return o + n
};
this.setDelay = function (a) {
o = a || o
};
this.getDelayDelta = function () {
return n
};
this.setDelayDelta = function (a, b) {
B = b == false ? false : true;
if (typeof a == "number") {
n = a;
if (!h && r != -1) c.hide()
}
};
this.setClasses = function (b, d) {
var a;
if (ERO.DefaultClasses === null) {
ERO.DefaultClasses = {};
for (a in ERO.Classes) ERO.DefaultClasses[a] = ERO.Classes[a]
}
if (d !== false) c.setClasses(ERO.DefaultClasses, false);
for (a in b) if (typeof ERO.Classes[a] != "undefined") ERO.Classes[a] = b[a];
D()
};
this.setBeak = function (a) {
if (a == ERO.BeakDirection.Left) g(b).removeClass(ERO.Classes.ContainerRightBeak).addClass(ERO.Classes.ContainerLeftBeak);
else g(b).removeClass(ERO.Classes.ContainerLeftBeak).addClass(ERO.Classes.ContainerRightBeak)
};
this.setContent = function (c) {
var a = document.createElement("div");
a.className = "firstChild";
a.innerHTML = c;
var b = l.firstChild;
if (b) l.replaceChild(a, b);
else l.appendChild(a);
a = null;
b = null
};
this.addAction = function (b) {
var a = document.createElement("li");
if (!b) return;
a.innerHTML = b;
p.appendChild(a);
a = null
};
this.clearActions = function () {
var a = p.getElementsByTagName("li"),
c = a.length;
for (var b = 0; b < c; b++) p.removeChild(a[0])
};
this.dockToText = function (e, b, i) {
b = typeof b != "undefined" ? b : typeof window.event != "undefined" ? window.event : null;
var k = g(e).getPagePosition(),
h = Gimme.Screen.getMousePosition(b).x,
j = new a.Point(h, k.y),
f = new a.Point(0, parseInt(d.offsetHeight / 2, 10));
c.dockToPoint(j, f, e, i)
};
this.dockToElement = function (b, e) {
var d = g(b).getPagePosition(),
f = new a.Rectangle(d, new a.Point(d.x + b.offsetWidth, d.y + b.offsetHeight));
c.dockToRect(f, null, b, e)
};
this.dockToPoint = function (b, d, f, e) {
c.dockToRect(new a.Rectangle(b, b), d, f, e)
};
this.dockToRect = function (m, q, I, C) {
if (k === I) {
clearTimeout(r);
if (h) return
} else if (k !== null) {
clearTimeout(r);
A()
}
var v = "px";
h = true;
k = I;
b.style.visibility = "hidden";
c.setBeak(ERO.BeakDirection.Left);
if (typeof q == "undefined" || q == null) q = {
x: 0,
y: 0
};
C = C || "";
j.style.width = C;
var g = l.offsetHeight - ERO.BeakHeight;
d.style.top = m.getP1().y - d.offsetHeight + q.y + v;
d.style.left = m.getP2().x - d.offsetWidth + q.x + v;
var s = m.getP2().x,
E = m.getP2().y - g - ERO.BeakHeight / 2 - m.getHeight() / 2,
y = c.getSize(),
G = y.getP2().y - y.getP1().y,
B = y.getP2().x - y.getP1().x,
J = new a.Rectangle(new a.Point(s, E), new a.Point(s + B, E + G)),
D = f.getOverlap(J),
p = D.getRange(),
x, w;
if (p & a.Overlap.Range.InXRange) w = s;
if (p & a.Overlap.Range.InYRange) x = E;
if (p & a.Overlap.Range.GreaterThanX) {
c.setBeak(ERO.BeakDirection.Right);
w = s > f.getP2().x ? f.getP1().x + f.getWidth() - B : s - B - m.getWidth()
}
if (p & a.Overlap.Range.LessThanX) {
c.setBeak(ERO.BeakDirection.Left);
w = f.getP1().x
}
if (p & a.Overlap.Range.GreaterThanY) {
x = f.getP1().y + f.getHeight() - G;
var H = D.getBottomYBleed();
g += H;
if (g > b.offsetHeight - ERO.BeakHeight) g = b.offsetHeight - ERO.BeakHeight - 4
}
if (p & a.Overlap.Range.LessThanY) {
x = f.getP1().y;
var H = D.getTopYBleed();
g -= H;
if (g < 0) g = 0
}
b.style.top = x + v;
b.style.left = w + v;
t.style.top = g + "px";
c.executeEvent("beforeshow", c, new ERO.EROEventArgs("beforeshow", b, k));
if (!i.useBeak) b.className = ERO.Classes.ContainerNoBeak;
z = false;
if (i.useProgressTimer) {
e.start();
if (!i.useFade) {
setTimeout(u, o + n);
return
}
}
if (i.useFade) setTimeout(F, o + n);
else u()
};
this.showImmediate = function () {
z = h = true;
e.end();
u()
};
this.hide = function (a) {
h = false;
if (a === true) A();
else {
clearTimeout(r);
r = setTimeout(A, o + n)
}
};
this.setGlitz = function (c, d, a, b) {
if (c != null) i.useBeak = c;
if (d != null) i.useFade = d;
if (a != null) i.useProgressTimer = a;
if (b === true) i.isTemporary = b;
else C = i.copy()
};
this.setBoundingArea = function (e, g) {
if (e === null) {
var b = Gimme.Screen.getScrollPosition(),
c = Gimme.Screen.getViewportSize(),
d = new a.Rectangle(new a.Point(0, 0), new a.Point(c.width, c.height));
d.move(new a.Point(b.x, b.y));
f = d
} else f = new a.Rectangle(e, g)
};
this.getBoundingArea = function () {
return f
};
this.isInUse = function () {
return h
};
this.isVisible = function () {
return b.style.visibility == "visible"
};
this.addToPage = function () {
b.style.visibility = "hidden";
d.style.visibility = "hidden";
document.body.appendChild(b);
document.body.appendChild(d)
};
this.getSize = function () {
var c = b.offsetLeft,
d = b.offsetTop,
f = c + b.offsetWidth,
g = d + b.offsetHeight,
e = new a.Rectangle(new a.Point(c, d), new a.Point(f, g));
return e
};
function E(b, a) {
if (b == a) return false;
while (a && a != b) a = a.parentNode;
return a == b
}
function x() {
h = true
}
function y(a) {
var d = a.relatedTarget || a.toElement || a.srcElement;
if (!E(b, d)) c.hide()
}
function u() {
if (b && h) {
if (b.style.visibility != "visible") b.style.visibility = "visible";
if (typeof b.style.opacity != "undefined") b.style.opacity = 1;
c.executeEvent("aftershow", c, new ERO.EROEventArgs("aftershow", b, k));
i = C.copy()
}
}
function A() {
if (!h && b) {
c.executeEvent("beforehide", c, new ERO.EROEventArgs("beforehide", b, k));
b.style.visibility = "hidden";
e.hide();
if (!Msn.VE.API) {
d.style.left = b.style.left = "0";
d.style.top = b.style.top = "0"
}
k = null;
c.executeEvent("afterhide", c, new ERO.EROEventArgs("afterhide", b, k))
}
if (B) n = 0
}
function F() {
if (z || !h || !b) return;
if (b.style && typeof b.style.filter != "undefined") {
b.style.filter = "progid:DXImageTransform.Microsoft.Fade(duration=.5)";
b.filters[0].Apply();
b.style.visibility = "visible";
b.style.display = "block";
b.filters[0].Play();
var c = setInterval(function () {
if (b.filters[0].status == 0) {
clearInterval(c);
u()
}
}, 10)
} else {
b.style.visibility = "visible";
if (w === 0) a()
}
function a() {
if (h && ++w <= 10) {
var c = w * .09999999;
b.style.opacity = c;
setTimeout(a, 50)
} else {
u();
w = 0
}
}
}
function D() {
b.className = ERO.Classes.Container;
s.className = ERO.Classes.Shadow;
j.className = ERO.Classes.Body;
t.className = ERO.Classes.Beak;
q.className = ERO.Classes.Actions;
m.className = ERO.Classes.ActionsBackground;
l.className = ERO.Classes.PreviewArea;
v.className = ERO.Classes.PaddingHack;
d.className = ERO.Classes.ProgressAnimation
}
}
}
};
function LogEROBehavior(eroEvent, fromPanel) {
var bERO = $find(eroEvent.Entity.id + "_ero");
if (bERO != null) {
var eroSource = eval(fromPanel ? bERO.get_EROPanel() : bERO.get_EROMap()),
pageName = eval(bERO.get_PageName());
if (eroSource) $VE_A.Log(pageName, eroSource)
}
}
function LogEROBehaviorFromPanel(a) {
ero.unhookEvent("aftershow", LogEROBehaviorFromPanel);
LogEROBehavior(a, true)
}
function LogEROBehaviorFromMap(a) {
ero.unhookEvent("aftershow", LogEROBehaviorFromMap);
LogEROBehavior(a, false)
}
function VETime() {}
VETime.FormatTime = function (a) {
if (a == null || a == "" || a == "undefined") return "";
var c = false,
d = a.substr(0, 10),
e = a.substr(11, 5),
b = "";
if (a.indexOf("AM") > -1) {
b = "AM";
c = true
} else b = "PM";
return d + " " + VETime.ConvertTo12HourFormat(e, c) + " " + b
};
VETime.ConvertTo12HourFormat = function (d, c) {
var a = d;
try {
var b = parseFloat(a.replace(":", "."));
if (b > 12) if (b < 13 && c != true);
else b = b - 12;
a = b.toFixed(2);
a = a.replace(".", ":")
} catch (e) {
a = ""
}
return a
};
VETime.FormatPanelTime = function (a, g) {
if (a == null || a == "" || a == "undefined") return "";
try {
var b = 0,
d = false,
i = a.substr(4, 8),
h = a.indexOf(":"),
f = a.substr(h - 2, 5),
c = "";
if (a.indexOf("AM") > -1) {
c = "AM";
d = true;
b = a.indexOf("AM")
} else {
c = "PM";
b = a.indexOf("PM")
}
var e = "";
if (b > 0) e = a.substr(b + 3, 3);
if (g) return i + " " + VETime.ConvertTo12HourFormat(f, d) + " " + c + " " + e;
else return VETime.ConvertTo12HourFormat(f, d) + " " + c + " " + e
} catch (j) {}
};
VETime.getMonth = function (a) {
switch (a) {
case "01":
return " Jan";
case "02":
return " Feb";
case "03":
return " Mar";
case "04":
return " Apr";
case "05":
return " May";
case "06":
return " Jun";
case "07":
return " Jul";
case "08":
return " Aug";
case "09":
return " Sep";
case "10":
return " Oct";
case "11":
return " Nov";
case "12":
return " Dec"
}
};
VEMap.prototype.GetImageryMetadata = function (c, a) {
var j = this;
VEValidator.ValidateFunction(c);
if (a) {
VEValidator.ValidateObject(a, "options", VEImageryMetadataOptions, "VEImageryMetadataOptions");
if (a.LatLong != null) VEValidator.ValidateObject(a.LatLong, "LatLong", VELatLong, "VELatLong");
if (a.MapStyle != null) VEValidator.ValidateMapStyle(a.MapStyle, "MapStyle");
if (a.ZoomLevel != null) {
VEValidator.ValidateNonNegativeInt(a.ZoomLevel, "ZoomLevel");
if (a.ZoomLevel == 0 || a.ZoomLevel > Msn.VE.API.Globals.vemaxzoom) throw new VEException("VEMap.GetImageryMetadata", "err_invalidargument", L_invalidargument_text.replace("%1", "ZoomLevel").replace("%2", "int"))
}
} else a = new VEImageryMetadataOptions;
if (a.LatLong == null) a.LatLong = this.GetCenter();
if (a.MapStyle == null) a.MapStyle = this.GetMapStyle();
if (a.ZoomLevel == null) a.ZoomLevel = this.GetZoomLevel();
if ((a.MapStyle == VEMapStyle.Road || a.MapStyle == VEMapStyle.Shaded || a.MapStyle == VEMapStyle.Aerial || a.MapStyle == VEMapStyle.Hybrid) && (this.HasClientToken() || this.HasValidCredentials())) {
if (a.MapStyle == VEMapStyle.Shaded) a.MapStyle == VEMapStyle.Road;
var d = new Msn.VE.LatLong;
d.latitude = a.LatLong.Latitude;
d.longitude = a.LatLong.Longitude;
var g = this.vemapcontrol.GetOrthoMode(),
i = g.LatLongToPixel(d, a.ZoomLevel),
h = VEPixelToQuadKey(i, a.ZoomLevel),
b = [];
b.push(new VEParameter("quadKey", '"' + h + '"'));
b.push(new VEParameter("mapStyle", '"' + a.MapStyle + '"'));
b.push(new VEParameter("tileGeneration", '"' + this.vemapcontrol.GetTileGeneration(a.MapStyle) + '"'));
this.vemapcontrol.Fire("onstartrequest");
function e(a) {
j._GetImageryMetadataHandler(a, c)
}
VEAPIRequestInvoke(Msn.VE.API.Constants.imageryurl + "/GetTileMetadata", b, e, this)
} else {
var f = new VEImageryMetadata;
c(f)
}
};
VEMap.prototype._GetImageryMetadataHandler = function (a, c) {
this.vemapcontrol.Fire("onendrequest");
this.__HandleAuthentication(a);
var b = null;
if (a) {
b = new VEImageryMetadata;
if (typeof a.Vintage != "undefined" && a.Vintage != null) {
if (typeof a.Vintage.From != "undefined" && a.Vintage.From != null) {
var d = a.Vintage.From;
b.DateRangeStart = ParseJsonDate(d)
}
if (typeof a.Vintage.To != "undefined" && a.Vintage.To != null) {
var e = a.Vintage.To;
b.DateRangeEnd = ParseJsonDate(e)
}
}
}
if (typeof c == "function") c(b)
};
function ParseJsonDate(dateString) {
var date = null;
if (dateString) try {
dateString = dateString.replace(/\//g, "");
date = eval("new " + dateString + ";")
} catch (a) {}
return date
}
function VEImageryMetadata() {
this.DateRangeStart = null;
this.DateRangeEnd = null;
this.toString = function () {
strDateStart = "";
strDateEnd = "";
if (this.DateRangeStart) strDateStart += this.DateRangeStart.getFullYear();
if (this.DateRangeEnd) strDateEnd += this.DateRangeEnd.getFullYear();
var a;
if (strDateStart == strDateEnd) a = strDateStart;
else a = strDateStart + " - " + strDateEnd;
return a
}
}
function VEImageryMetadataOptions() {
this.LatLong = null;
this.MapStyle = null;
this.ZoomLevel = null
}
var customCursors = Msn.VE.Css.Cursors.CustomCursors;
if (customCursors != null) {
var i, len = customCursors.length;
for (i = 0; i < len; i++) customCursors[i].domain = Msn.VE.API.Globals.vecurrentdomain;
Msn.VE.Css.Cursors.defineCustomCursors(customCursors)
}
if (!(navigator.userAgent.indexOf("IE") >= 0) && (typeof VEAPI_DisableAtlasCompat == "undefined" || VEAPI_DisableAtlasCompat != true)) VENetwork.DownloadScript(Msn.VE.API.Constants.atlascompatjs);
VENetwork.AttachStyleSheet(Msn.VE.API.Constants.stylesheet);
if (navigator.userAgent.indexOf("MSIE") >= 0 && parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE") + 5)) == 6) VENetwork.AttachStyleSheet(Msn.VE.API.Constants.stylesheetiev6);
try {
document.namespaces.add("v", "urn:schemas-microsoft-com:vml")
} catch (a) {}
function RequestQueueItem(a, b, c, d) {
this.Call = a;
this.Param1 = b;
this.Param2 = c;
this.Param3 = d
}
function VECustomEvent(b, a) {
this.Name = b;
this.Callback = a
}
VECacheMode = {
Auto: 0,
EnableTileCaching: 1
};
function VEMapOptions() {
this.EnableBirdseye = true;
this.EnableDashboardLabels = true;
this.LoadBaseTiles = true;
this.BirdseyeOrientation = VEOrientation.North;
this.DrawingBuffer = 0;
this.CacheMode = VECacheMode.Auto;
this.DashboardColor = "blue";
this.EnableClickableLogo = false;
this.EnableSearchLogo = false
}
function VEMap(m) {
var a = this;
this.ID = m;
this.GUID = VENetwork.GetExecutionID();
this.ClientToken = null;
this.Credentials = null;
var i = false;
this.SessionQueue = null;
var f = null,
l = null,
d = null;
if (Msn.VE.API.Globals.vemapinstances == null || Msn.VE.API.Globals.vemapinstances == "undefined") Msn.VE.API.Globals.vemapinstances = [];
Msn.VE.API.Globals.vemapinstances[this.GUID] = a;
this.requestQueue = [];
this.preInitCustomEvents = [];
this.network = new VENetwork;
this.mapelement = $ID(m);
this.pushpins = [];
this.DisambiguationCallback = null;
this.ShowMessageBox = true;
if (this.mapelement == null) throw new VEException("VEMap:cstr", "err_invalidelement", L_invalidelement_text);
this.m_vedirectionsmanager = null;
this._dm = this.m_vedirectionsmanager;
this.m_routemanager = null;
this.m_vesearchmanager = null;
this._sm = this.m_vesearchmanager;
this.m_vemessage = new VEMessage(this);
this.m_veambiguouslist = new VEAmbiguouslist(this);
var c = new VELatLongFactory(new VELatLongFactorySpecFromMap(this)),
b = new _xy1;
this.queueEventInitialized = false;
this.RequestQueueEnabled = true;
this.queueEventInitialized = false;
windowWidth = GetWindowWidth();
windowHeight = GetWindowHeight();
scrollbarWidth = GetScrollbarWidth();
this.dashboardSize = Msn.VE.DashboardSize.Normal;
this.dashboardVersion = 6;
this._showDashboard = true;
this._showScalebar = true;
this._mapPrintOptions = null;
this.LoadMap = function (c, j, l, k, d, i, e, h) {
if (!a) throw new VEException("VEMap:LoadMap", "err_notinitializedmap", L_notinitialized_text);
if (typeof d != "undefined" && d != null) {
VEValidator.ValidateMapMode(d, "mapMode");
this.mapMode = d
}
if (c != null && c != "undefined") {
VEValidator.ValidateObject(c, "veLatLong", VELatLong, "VELatLong");
var f = b.Decode(c);
this.initialLatitude = f.Latitude;
this.initialLongitude = f.Longitude
}
this.fixedMap = k;
this.initialZoomLevel = j;
this.initialMapStyle = l;
this.showMapModeSwitch = i;
if (e != null && typeof e != "undefined") this.tileBuffer = e;
this._mapOptions = h ? h : new VEMapOptions;
VEValidator.ValidateOrientation(this._mapOptions.BirdseyeOrientation, "VEMapOptions.BirdseyeOrientation");
VEValidator.ValidateFloat(this._mapOptions.DrawingBuffer, "VEMapOptions.DrawingBuffer");
VEValidator.ValidateBetween(this._mapOptions.DrawingBuffer, "VEMapOptions.DrawingBuffer", 0, Number.POSITIVE_INFINITY);
VEValidator.ValidateCacheMode(this._mapOptions.CacheMode, "VEMapOptions.CacheMode");
this.veonmaploadevent = this.onLoadMap;
this.mapelement.innerHTML = "";
this.mapelement.innerHTML = "
" + L_loading_text + "
";
this.InitializeMap();
this.vemapcontrol.AttachEvent("onstartpan", function () {
if (window.ero) window.ero.hide(true)
});
g([new VEParameter("entry", "0")])
};
function g(b) {
if (b) {
var e = Msn.VE.API.Constants.logservice + "/Log";
b.push(new VEParameter("fmt", "1"));
b.push(new VEParameter("type", "3"));
b.push(new VEParameter("group", "MapControl"));
b.push(new VEParameter("name", "AJAX"));
b.push(new VEParameter("version", Msn.VE.API.Globals.vecurrentversion));
b.push(new VEParameter("session", a.GUID));
b.push(new VEParameter("mkt", Msn.VE.API.Globals.locale));
var p = a.Credentials != null && a.Credentials.length > 0;
if (p || !a.HasClientToken()) {
var i = VENetwork.GetExecutionID(),
c = "LogCredCB" + i;
b.push(new VEParameter("auth", p ? a.Credentials : Msn.VE.API.Constants.defaultLogCredentials));
b.push(new VEParameter("&jsonp", c));
var m = new VENetwork;
m.UseCloseDep = true;
m.ServiceUrl = e;
if (!a.SessionQueue) a.SessionQueue = [];
l = c;
window[c] = function (b) {
if (a && l == c) {
if (d != null) {
clearTimeout(d);
d = null
}
var e = b != null && b.authenticationResultCode == "ValidCredentials";
f = e && typeof b.sessionId == "string" && b.sessionId.length > 0 ? b.sessionId : null;
if (e) j();
else h();
k()
}
window[c] = null
};
if (d != null) clearTimeout(d);
d = setTimeout(n, 10000);
m.BeginInvoke("_f" + i, b, null, null, i)
} else {
b.push(new VEParameter("auth", a.ClientToken));
b.push(new VEParameter("image", "1"));
e += "?";
for (var g = 0; g < b.length; g++) e += b[g].Name + "=" + b[g].Value + "&";
var o = new Image;
o.onerror = h;
o.onload = j;
o.src = e
}
}
}
function n() {
d = null;
f = null;
LogCredCBMethodName = null;
h();
k()
}
function k() {
if (a) {
var c = a.SessionQueue;
a.SessionQueue = null;
if (c) for (var d = 0; d < c.length; d++) {
var b = c[d];
VEAPIRequestInvoke(b.service, b.parameters, b.fnCallback, a)
}
}
}
function h() {
i = false;
if (a && a.vemapcontrol) a.vemapcontrol.Fire("oncredentialserror")
}
function j() {
i = true;
if (a && a.vemapcontrol) a.vemapcontrol.Fire("oncredentialsvalid")
}
this._ReArrangeControls = function () {
if (a.controlzIndexes != null && a.controls != null && a.controlzIndexes.length == a.controls.length) {
var d = a.controls.length;
for (var b = 0; b < d; b++) {
document.body.removeChild(a.controls[b]);
var c = a.controls[b];
c.style.top = a.controltops[b];
c.style.left = a.controllefts[b];
a._AddControlInner(c, a.controlzIndexes[b])
}
}
};
this._ClearView = function () {
VEPushpin.Hide();
a.m_vemessage.Hide();
if (typeof VE_TrafficManager != "undefined" && VE_TrafficManager.turnedOn == true) VE_TrafficManager._ViewChangeNotification()
};
this._RefreshLayers = function () {
if (a.vemapcontrol.GetMapMode() != 2) a.vemapcontrol.PanView();
if (typeof VE_TrafficManager != "undefined" && VE_TrafficManager.turnedOn == true) VE_TrafficManager._ViewChangeNotification()
};
this.SetViewport = function (a, c, b, d) {
return this.vemapcontrol.SetViewport(a, c, b, d)
};
this.GetCenter = function () {
var b = this.vemapcontrol.GetCenterLatitude(),
d = this.vemapcontrol.GetCenterLongitude(),
a = c.CreateVELatLong(b, d);
return a
};
this.GetMapView = function () {
var e;
if (this.vemapcontrol.IsModeEnabled(Msn.VE.MapActionMode.Mode3D)) {
var d = this.vemapcontrol.Get3DVisibleArea(true);
if (d == null) return null;
var b = d[0],
g = d[1],
a = d[2],
f = d[3];
e = new VELatLongRectangle(c.CreateVELatLong(b.latitude, b.longitude), c.CreateVELatLong(a.latitude, a.longitude), c.CreateVELatLong(g.latitude, g.longitude), c.CreateVELatLong(f.latitude, f.longitude))
} else {
var b = this.vemapcontrol.PixelToLatLong(new VEPixel(0, 0)),
a = this.vemapcontrol.PixelToLatLong(new VEPixel(this.GetWidth(), this.GetHeight()));
if (b == null || a == null) return null;
e = new VELatLongRectangle(c.CreateVELatLong(this.vemapcontrol.ClipLatitude(b.latitude), this.vemapcontrol.ClipLongitude(b.longitude)), c.CreateVELatLong(this.vemapcontrol.ClipLatitude(a.latitude), this.vemapcontrol.ClipLongitude(a.longitude)))
}
return e
};
this.PixelToLatLong = function (b, a, d) {
if (a != null) {
VEValidator.ValidateNonNegativeInt(a, "zoomLevel");
a = parseInt(a)
}
if (d) {
VEValidator.ValidateObjectArray(b, "pixelArray", VEPixel, "VEPixel array");
VEValidator.ValidateFunction(d, "callback");
if (typeof b.length != "undefined" && b.length > 0) this.PixelToLatLongAsync(b, a, d)
} else {
VEValidator.ValidateObject(b, "pixel", VEPixel, "VEPixel");
var e = this.vemapcontrol.PixelToLatLong(b, a),
f = c.CreateVELatLong(e.latitude, e.longitude);
return f
}
};
this.PixelToLatLongAsync = function (a, b, c) {
this.vemapcontrol.PixelToLatLongAsync(a, b, c)
};
this.SetCenter = function (c) {
VEValidator.ValidateObject(c, "veLatLong", VELatLong, "VELatLong");
var a = b.Decode(c);
this._QueueRequest(this.vemapcontrol.SetCenterAccurate, a.Latitude, a.Longitude)
};
this.SetCenterClassic = function (c) {
VEValidator.ValidateObject(c, "veLatLong", VELatLong, "VELatLong");
var a = b.Decode(c);
this._QueueRequest(this.vemapcontrol.SetCenter, a.Latitude, a.Longitude)
};
this.SetCenterAndZoom = function (c, d) {
VEValidator.ValidateObject(c, "veLatLong", VELatLong, "VELatLong");
VEValidator.ValidateNonNegativeInt(d, "zoomLevel");
var a = b.Decode(c);
this._QueueRequest(this.vemapcontrol.SetCenterAndZoom, a.Latitude, a.Longitude, d);
return true
};
this.GetMouseWheelZoomToCenter = function () {
return a.vemapcontrol.GetMouseWheelZoomToCenter()
};
this.SetMouseWheelZoomToCenter = function (b) {
return a.vemapcontrol.SetMouseWheelZoomToCenter(b)
};
this.IncludePointInView = function (c) {
VEValidator.ValidateObject(c, "veLatLong", VELatLong, "VELatLong");
var a = b.Decode(c);
return this.vemapcontrol.IncludePointInViewport(a.Latitude, a.Longitude)
};
this.GetOffsetX = function () {
return a.vemapcontrol.GetOffsetX()
};
this.GetOffsetY = function () {
return a.vemapcontrol.GetOffsetY()
};
this.getSvgLayer = function () {
return a.vemapcontrol.getSvgLayer()
};
this.resizeSVG = function () {
return a.vemapcontrol.resizeSVG()
};
this.GetsvgDiv = function () {
return a.vemapcontrol.GetsvgDiv()
};
this.LatLongToPixel = function (c, a, d) {
if (a != null) {
VEValidator.ValidateNonNegativeInt(a, "zoomLevel");
a = parseInt(a)
}
if (d) {
VEValidator.ValidateObjectArray(c, "veLatLongArray", VELatLong, "VELatLong array");
VEValidator.ValidateFunction(d, "callback");
this.LatLongToPixelAsync(c, a, d)
} else {
VEValidator.ValidateObject(c, "veLatLong", VELatLong, "VELatLong");
var e = b.Decode(c),
f = new Msn.VE.LatLong(e.Latitude, e.Longitude);
return this.vemapcontrol.LatLongToPixel(f, a)
}
};
this.LatLongToPixelAsync = function (d, f, g) {
var e = [];
for (var a = 0; a < d.length; ++a) {
var c = b.Decode(d[a]);
e[a] = new Msn.VE.LatLong(c.Latitude, c.Longitude)
}
this.vemapcontrol.LatLongToPixelAsync(e, f, g)
};
this.PanToLatLong = function (c) {
VEValidator.ValidateObject(c, "veLatLong", VELatLong, "VELatLong");
var a = b.Decode(c);
if (this.GetMapMode() == Msn.VE.MapActionMode.Mode2D) {
a.Latitude = this.vemapcontrol.ClipLatitude(a.Latitude);
a.Longitude = this.vemapcontrol.ClipLongitude(a.Longitude)
}
this._QueueRequest(this.vemapcontrol.PanToLatLong, a.Latitude, a.Longitude);
return true
};
this.SetMapView = function (a) {
VEValidator.ValidateNonNull(a, "arrObject");
if (a instanceof VEMapViewSpecification) {
var j = b.Decode(a.LatLong);
view = new Msn.VE.MapView(this.vemapcontrol);
view.SetCenterLatLong(new Msn.VE.LatLong(j.Latitude, j.Longitude));
view.SetMapStyle(this.vemapcontrol.GetMapStyle());
if (a.ZoomLevel != null) view.SetZoomLevel(a.ZoomLevel);
else view.SetZoomLevel(this.vemapcontrol.GetZoomLevel());
if (a.Altitude != null) view.SetAltitude(a.Altitude);
if (a.Heading != null) view.SetDirection(a.Heading);
if (a.Pitch != null) view.SetTilt(a.Pitch);
this._QueueRequest(this.vemapcontrol.SetView, view)
} else if (a instanceof VELatLongRectangle) {
var f = b.Decode(a.TopLeftLatLong),
g = b.Decode(a.BottomRightLatLong),
k = this.GetMapView(),
h = b.Decode(k.TopLeftLatLong),
i = b.Decode(k.BottomRightLatLong),
l = h.Latitude != f.Latitude || h.Longitude != f.Longitude || i.Latitude != g.Latitude || i.Longitude != g.Longitude;
if (l) this.vemapcontrol.SetViewport(f.Latitude, f.Longitude, g.Latitude, g.Longitude)
} else {
var d = [];
for (var c = 0; c < a.length; c++) {
VEValidator.ValidateNonNull(a[c], "arrObject[" + c + "]");
if (a[c] instanceof VELatLong) e([a[c]], d);
else if (a[c] instanceof VEShape) e(a[c].GetPoints(), d);
else if (a[c] instanceof VEPolyline) e(a[c].GetLatLongs(), d);
else if (a[c] instanceof VEPolygon) e(a[c].GetLatLongs(), d);
else if (a[c] instanceof VELatLongRectangle) e([a[c].TopLeftLatLong, a[c].BottomRightLatLong], d);
else throw new VEException("VEMap:SetMapView", "err_invalidargument", L_invalidargument_text.replace("%1", "arrObject").replace("%2", "object"))
}
this._QueueRequest(this.vemapcontrol.SetBestMapView, d)
}
return true
};
function e(d, e) {
for (var a = 0; a < d.length; a++) {
var c = b.Decode(d[a]),
f = new Msn.VE.LatLong(c.Latitude, c.Longitude);
e.push(f)
}
}
this.AddPushpin = function (a) {
if (typeof a == "object" && !(a instanceof VEPushpin)) {
var e = new VEShape(VEShapeType.Pushpin, a);
this.AddShape(e);
return e
}
VEValidator.ValidateObject(a, "vePushpin", VEPushpin, "VEPushpin");
var f = this.pushpins.length;
for (var d = 0; d < f; d++) {
var g = this.pushpins[d];
if (g.ID == a.ID) throw new VEException("VEMap:AddPushpin", "err_invalidpushpinid", L_invalidpushpinid_text)
}
this.pushpins.push(a);
a._SetMapInstance(this);
var c = b.Decode(a.LatLong);
if (this.GetMapMode() == Msn.VE.MapActionMode.Mode3D) this.m_vegraphicsmanager.Add3DPushpin(a.ID, c.Latitude, c.Longitude, 25, 25, "VEAPI_Pushpin", a, Msn.VE.API.Globals.vepushpinpanelzIndex - 1);
else this.vemapcontrol.AddPushpin(a.ID, c.Latitude, c.Longitude, 25, 25, "VEAPI_Pushpin", a.GetContent(), Msn.VE.API.Globals.vepushpinpanelzIndex - 1)
};
this._DisambiguateCallback = "VEMap._GetMapFromGUID(" + this.GUID + ")._sm.FindAmbiguousListCallBack";
this._Disambiguate = function (f, b, d, c, e) {
var a = $ID(this.ID + "_vewhereinput");
if (a) a.value = unescape(f);
this.vemapcontrol.SetViewport(b, d, c, e);
if (this.m_vesearchmanager != null && this.lastwhatsearch != null && this.lastwhatsearch.length > 0) this.Find(this.lastwhatsearch, null, 1, this.m_vesearchmanager.vesearchcallback)
};
this._DoFind = function () {
try {
this.lastwhatsearch = $ID(this.ID + "_vewhatinput").value;
this.lastwheresearch = $ID(this.ID + "_vewhereinput").value;
this.Find(this.lastwhatsearch, this.lastwheresearch)
} catch (a) {
this.ShowMessage(a.message)
}
};
this.Dispose = function () {
try {
g([new VEParameter("entry", "1")]);
a.SessionQueue = null;
if (a.vemapcontrol != null) {
a.vemapcontrol.DetachEvent("onchangeview", a._ClearView);
a.vemapcontrol.DetachEvent("onresize", a._ReArrangeControls);
a.vemapcontrol.DetachEvent("onendpan", a._RefreshLayers);
a.vemapcontrol.DetachEvent("oninitmode", a._EROHouseKeeping)
}
a.vemapcontrol.DetachEvent("onclick", VEPushpin.Hide);
var c = a.controlzIndexes.length;
for (var b = 0; b < c; b++) a.controlzIndexes.pop();
var c = a.controls.length;
for (var b = 0; b < c; b++) {
try {
document.body.removeChild(a.controls[b])
} catch (h) {}
a.controls[b] = null;
a.controltops[b] = null;
a.controllefts[b] = null
}
a.controls = null;
a.controlzIndexes = null;
if (a.m_velayermanager) a.m_velayermanager.Dispose();
if (a.m_vesearchmanager) {
a.m_vesearchmanager.Dispose();
a.m_vesearchmanager = null;
a._sm = null
}
if (a.m_routemanager) {
a.m_routemanager.Dispose();
a.m_routemanager = null
}
for (var b = 0; b < a.pushpins.length; ++b) if (a.pushpins[b] != null && a.pushpins[b] != "undefined") {
if (a.GetMapMode() == Msn.VE.MapActionMode.Mode3D) a.m_vegraphicsmanager.Remove3DPushpin(a.pushpins[b].ID);
a.pushpins[b].Dispose();
a.pushpins[b] = null
}
a.pushpins = null;
if (a.m_vegraphicsmanager) a.m_vegraphicsmanager.Dispose();
if (a.m_vetilesourcemanager) a.m_vetilesourcemanager.Dispose();
a.m_vemessage.Dispose();
a.m_veambiguouslist.Dispose();
try {
if (typeof VE_TrafficManager != "undefined") VE_TrafficManager.Destroy();
this.m_vetrafficmanager = null
} catch (h) {}
Msn.VE.API.Globals.vemapinstances[a.GUID] = null;
a.veonmaploadevent = null;
a.veloadingdiv = null;
a.vemapcontrol.Destroy();
try {
var f = $ID(a.ID);
f.innerHTML = ""
} catch (h) {}
a.ClientToken = null;
a.ID = null;
a.vemapcontrol = null;
var e = 0;
for (var d in Msn.VE.API.Globals.vemapinstances) if (typeof Msn.VE.API.Globals.vemapinstances[d] != "function" && Msn.VE.API.Globals.vemapinstances[d] != null)++e;
if (e == 0) {
VE_Help.Destroy();
VEPushpin.DisposeERO();
Msn.VE.API.Globals.Dispose()
}
Msn.VE.API.Globals.vemapinstances[this.GUID] = null;
var c = a.preInitCustomEvents.length;
for (var b = 0; b < c; ++b) a.preInitCustomEvents.pop();
a.preInitCustomEvents = null;
a.requestQueue = null;
a.network = null;
a.mapelement = null;
a.pushpins = null;
if (a._mapOptions) a._mapOptions = null;
a = null
} catch (h) {}
};
this.GetDashboardSize = function () {
return this.dashboardSize
};
this.SetClientToken = function (a) {
this.ClientToken = a;
if (this.vemapcontrol) {
this.vemapcontrol.SetClientToken(a);
g([new VEParameter("entry", "2")])
}
};
this.SetCredentials = function (a) {
this.Credentials = a;
if (this.vemapcontrol) g([new VEParameter("entry", "2")])
};
this._GetCredentials = function () {
var b;
if (f != null && f.length > 0) b = f;
else if (a.Credentials != null && a.Credentials.length > 0) b = a.Credentials;
else if (a.HasClientToken()) b = a.ClientToken;
else b = Msn.VE.API.Constants.defaultLogCredentials;
return b
};
this.HasValidCredentials = function () {
return i
}
}
VEMap._GetMapFromGUID = function (a) {
if (Msn.VE.API.Globals.vemapinstances != null && Msn.VE.API.Globals.vemapinstances[a] == null || Msn.VE.API.Globals.vemapinstances[a] == "undefined") {
throw new VEException("VEMap:_GetMapFromGUID", "err_notinitialized", L_notinitialized_text);
return
}
return Msn.VE.API.Globals.vemapinstances[a]
};
VEMap.prototype.InitializeMap = function () {
_VERegisterNamespaces("Msn.VE");
this.mapelement.innerHTML = "";
this.mapelement.style.overflow = "hidden";
if (this.mapelement.className == null || this.mapelement.className == "undefined" || this.mapelement.className == "") {
if (this.mapelement.style == null || this.mapelement.style.height == null || this.mapelement.style.height == "undefined" || this.mapelement.style.height == "") this.mapelement.style.height = Msn.VE.API.Globals.vemapheight + "px";
if (this.mapelement.style == null || this.mapelement.style.width == null || this.mapelement.style.width == "undefined" || this.mapelement.style.width == "") this.mapelement.style.width = Msn.VE.API.Globals.vemapwidth + "px"
}
var a = {};
if (this.mapMode != null && this.mapMode != "undefined") a.mapMode = this.mapMode;
else a.mapMode = Msn.VE.API.Globals.vemapmode;
a.mapGUID = this.GUID;
a.clientToken = this.ClientToken;
if (this.initialLatitude != null && this.initialLatitude != "undefined") a.latitude = this.initialLatitude;
else a.latitude = Msn.VE.API.Globals.vemaplatitude;
if (this.initialLongitude != null && this.initialLongitude != "undefined") a.longitude = this.initialLongitude;
else a.longitude = Msn.VE.API.Globals.vemaplongitude;
if (this.initialZoomLevel != null && this.initialZoomLevel != "undefined") a.zoomlevel = this.initialZoomLevel;
else a.zoomlevel = Msn.VE.API.Globals.vemapzoom;
if (this.initialMapStyle != null && this.initialMapStyle != "undefined") a.mapstyle = this.initialMapStyle;
else a.mapstyle = Msn.VE.API.Globals.vemapstyle;
this.m_dashboardId = this.ID + "_dashboard";
if (this.fixedMap != true) {
a.showDashboard = VE_CheckModuleStatus(VE_ModuleName.APICONTROLS) == "loaded" && this._showDashboard;
a.dashboardSize = this.dashboardSize;
a.dashboardVersion = this.dashboardVersion;
a.dashboardX = 5;
a.dashboardY = 5;
a.dashboardId = this.m_dashboardId;
a.showScaleBar = this._showScalebar
}
a.dashboardColor = this._mapOptions.DashboardColor;
a.obliqueEnabled = this._mapOptions.EnableBirdseye;
a.labelsDefault = this._mapOptions.EnableDashboardLabels;
a.loadBaseTiles = this._mapOptions.LoadBaseTiles;
a.birdseyeOrientation = this._mapOptions.BirdseyeOrientation;
a.useOriginTiles = this._mapOptions.CacheMode == VECacheMode.Auto;
a.useEnhancedRoadStyle = this._mapOptions.UseEnhancedRoadStyle;
a.obliqueUrl = Msn.VE.API.Constants.imageryurl;
if (this.fixedMap == true) a.fixedView = true;
a.disableLogo = false;
a.enableClickLogo = this._mapOptions.EnableClickableLogo;
a.enableSearchLogo = this._mapOptions.EnableSearchLogo;
if (this.showMapModeSwitch == false) a.showMapModeSwitch = false;
else a.showMapModeSwitch = true;
if (this.tileBuffer != null && typeof this.tileBuffer != "undefined") a.buffer = this.tileBuffer * Msn.VE.API.Globals.vetilesize;
this.vemapcontrol = new Msn.VE.MapControl(this.mapelement, a, this);
var d = this.preInitCustomEvents.length;
for (var c = 0; c < d; ++c) {
var b = this.preInitCustomEvents.pop();
this.vemapcontrol.AttachCustomEvent(b.Name, b.Callback)
}
this.vemapcontrol.Init();
if (!this.fixedMap == true) this.vemapcontrol.AttachEvent("onchangeview", this._ClearView);
this.vemapcontrol.AttachEvent("onendpan", this._RefreshLayers);
this.vemapcontrol.AttachEvent("oninitmode", this._ResetQueueEvent);
this.vemapcontrol.AttachEvent("oninitmode", this._EROHouseKeeping);
_VERegisterNamespaces("Msn.Drawing");
this.m_vegraphicsmanager = new VEGraphicsManager(this);
this.m_vegraphicsmanager.Initialize();
this.m_velayermanager = null;
this._lm = this.m_velayermanager;
this.m_vetilesourcemanager = null;
this.m_vetrafficmanager = null;
_VERegisterNamespaces("Msn.VE.UI");
Msn.VE.UI.Color = {
Red: "red",
Orange: "orange",
Yellow: "yellow"
};
if (($ID("help") == null || $ID("help") == "undefined") && !Msn.VE.API.Globals.ishttpsenabled) VE_Help.CreateHelpPanel();
this._InitializeModules(VE_GetLoadedAPIModules());
if (this.veonmaploadevent) this.veonmaploadevent(this);
this.controlzIndexes = [];
this.controls = [];
this.controltops = [];
this.controllefts = [];
this.vemapcontrol.AttachEvent("onresize", this._ReArrangeControls);
if (window.ero == null || typeof window.ero == "undefined") window.ero = ERO.getInstance();
this._EROHouseKeeping(this.GetMapMode());
window.attachEvent("onunload", DisposeAllMaps);
if (this._mapPrintOptions) this.SetPrintOptions(this._mapPrintOptions)
};
function DisposeAllMaps() {
for (var a in Msn.VE.API.Globals.vemapinstances) if (Msn.VE.API.Globals.vemapinstances[a] instanceof VEMap) Msn.VE.API.Globals.vemapinstances[a].Dispose();
if (_VEDownloadQueue) {
_VEDownloadQueue.Dispose();
_VEDownloadQueue = null
}
if (VE_Help && VE_Help.Destroy) VE_Help.Destroy()
}
VEMap.prototype.DeleteAllPushpins = function () {
VEPushpin.Hide();
if (this.pushpins != null && this.pushpins != "undefined") if (this.GetMapMode() == Msn.VE.MapActionMode.Mode3D) {
this.m_vegraphicsmanager.ClearAllPushpins(this.pushpins);
return
} else {
var c = this.pushpins.length;
for (var a = 0; a < c; a++) {
var b = this.pushpins.pop();
if (!b.IsInLayer) b.Dispose()
}
}
return this.vemapcontrol.ClearPushpins()
};
VEMap.prototype.GetMapStyle = function () {
return this.vemapcontrol.GetMapStyle()
};
VEMap.prototype.GetZoomLevel = function () {
return this.vemapcontrol.GetZoomLevel()
};
VEMap.prototype.StartContinuousPan = function (a, b) {
VEValidator.ValidateInt(a, "deltaX");
VEValidator.ValidateInt(b, "deltaY");
return this.vemapcontrol.ContinuousPan(parseInt(a), parseInt(b))
};
VEMap.prototype.EndContinuousPan = function () {
return this.vemapcontrol.StopContinuousPan()
};
VEMap.prototype.Pan = function (a, b) {
VEValidator.ValidateInt(a, "deltaX");
VEValidator.ValidateInt(b, "deltaY");
if (this.GetMapMode() != Msn.VE.MapActionMode.Mode3D) return this.vemapcontrol.PanByPixel(new VEPixel(parseInt(a), parseInt(b)), false);
else return false
};
VEMap.prototype.DeletePushpin = function (c) {
var d = 0;
if (typeof this.pushpins == "object" && this.pushpins && this.pushpins.constructor == Array) d = this.pushpins.length;
for (var a = 0; a < d; a++) {
var b = this.pushpins[a];
if (b != null && b.ID == c) {
if (!b.IsInLayer) b.Dispose();
this.pushpins.splice(a, 1);
if (this.GetMapMode() == Msn.VE.MapActionMode.Mode3D) return this.m_vegraphicsmanager.Remove3DPushpin(c);
else return this.vemapcontrol.RemovePushpin(c)
}
}
throw new VEException("VEMap:DeletePushpin", "err_invalidpushpinid", L_invalidpushpinid_text)
};
VEMap.prototype.Resize = function (d, c) {
var b = -1,
a = -1;
if (d != null && typeof d != "undefined") {
VEValidator.ValidateNonNegativeInt(d, "width");
b = parseInt(d)
}
if (c != null && typeof c != "undefined") {
VEValidator.ValidateNonNegativeInt(c, "height");
a = parseInt(c)
}
if (b >= 0 || a >= 0) {
if (b < 0) b = this.GetWidth();
if (a < 0) a = this.GetHeight()
}
return this.vemapcontrol.Resize(b, a)
};
VEMap.prototype.SetMapMode = function (a) {
VEValidator.ValidateMapMode(a, "mapMode");
this.vemapcontrol.EnableMode(a, this.GUID)
};
VEMap.prototype.GetMapMode = function () {
if (this.vemapcontrol.IsModeEnabled(Msn.VE.MapActionMode.Mode3D)) return VEMapMode.Mode3D;
return VEMapMode.Mode2D
};
VEMap.prototype.SetMapStyle = function (a) {
VEValidator.ValidateMapStyle(a, "mapStyle");
if (this.GetMapMode() == Msn.VE.MapActionMode.Mode3D && (a == VEMapStyle.Birdseye || a == VEMapStyle.BirdseyeHybrid)) return false;
this.vemapcontrol.SetMapStyle(a)
};
VEMap.prototype.SetScaleBarDistanceUnit = function (a) {
VEValidator.ValidateDistanceUnit(a, "distanceUnit");
this.vemapcontrol.SetScaleBarDistanceUnit(a == VEDistanceUnit.Miles ? Msn.VE.DistanceUnit.Miles : Msn.VE.DistanceUnit.Kilometers)
};
VEMap.prototype.SetZoomLevel = function (a) {
VEValidator.ValidateNonNegativeInt(a, "zoomLevel");
this._QueueRequest(this.vemapcontrol.SetZoom, parseInt(a));
return true
};
VEMap.prototype.ZoomIn = function () {
this.vemapcontrol.ZoomIn()
};
VEMap.prototype.ZoomOut = function () {
this._QueueRequest(this.vemapcontrol.ZoomOut)
};
VEMap.prototype.AttachEvent = function (b, a) {
VEValidator.ValidateNonNull(b, "eventname");
VEValidator.ValidateNonNull(a, "eventhandler");
if (this.vemapcontrol) this.vemapcontrol.AttachCustomEvent(b, a);
else this.preInitCustomEvents.push(new VECustomEvent(b, a))
};
VEMap.prototype.DetachEvent = function (b, a) {
VEValidator.ValidateNonNull(b, "eventname");
VEValidator.ValidateNonNull(a, "eventhandler");
this.vemapcontrol.DetachCustomEvent(b, a)
};
VEMap.prototype.FireEvent = function (a) {
try {
var b = window.event;
return this.vemapcontrol.FireCustomEvent(a, b)
} catch (c) {
return false
}
};
VEMap.prototype.ShowMessage = function (a) {
if (this.ShowMessageBox) this.m_vemessage.Show(a)
};
VEMap.prototype.GetHeight = function () {
var a = 0;
if (this.mapelement.style.height.search(/px/) > 0) a = parseInt(this.mapelement.style.height.replace("px", ""));
if (isNaN(a) || a == 0) a = this.mapelement.offsetHeight;
return a
};
VEMap.prototype.GetWidth = function () {
var a = 0;
if (this.mapelement.style.width.search(/px/) > 0) a = parseInt(this.mapelement.style.width.replace("px", ""));
if (isNaN(a) || a == 0) a = this.mapelement.offsetWidth;
return a
};
VEMap.prototype.GetLeft = function () {
return this.vemapcontrol.GetLeftPx()
};
VEMap.prototype.GetTop = function () {
return this.vemapcontrol.GetTopPx()
};
VEMap.prototype.SetFindResultsPanel = function (a) {
if (a == null || a == "undefined") throw new VEException("VEMap:SetFindResultsPanel", "err_invalidelement", L_invalidelement_text);
var b = $ID(a);
if (b == null || b == "undefined") throw new VEException("VEMap:SetFindResultsPanel", "err_invalidelement", L_invalidelement_text);
this.searchelement = a
};
VEMap.prototype._AddControlInner = function (a) {
a.style.position = "absolute";
a.style.zIndex = 201;
var e = this.GetTop(),
d = this.GetLeft();
if (!a.style.top) a.style.top = "0px";
if (!a.style.left) a.style.left = "0px";
var c = a.style.top,
b = a.style.left;
if (isNaN(c)) c = c.toString().toLowerCase();
if (isNaN(b)) b = b.toString().toLowerCase();
e += parseInt(c.replace("px"));
d += parseInt(b.replace("px"));
a.style.top = e + "px";
a.style.left = d + "px";
document.body.appendChild(a)
};
VEMap.prototype.AddControl = function (a, b) {
if (a == null || a == "undefined") throw new VEException("VEMap:AddControl", "err_invalidelement", L_invalidelement_text);
if (this.controls == null || this.controls == "undefined") throw new VEException("VEMap:AddControl", "err_notinitialized", L_notinitialized_text);
this.controlzIndexes.push(b);
this.controls.push(a);
this.controltops.push(a.style.top);
this.controllefts.push(a.style.left);
this._AddControlInner(a, b)
};
VEMap.prototype.DeleteControl = function (b) {
if (b == null || b == "undefined") throw new VEException("VEMap:DeleteControl", "err_invalidelement", L_invalidelement_text);
if (this.controls == null || this.controls == "undefined") throw new VEException("VEMap:DeleteControl", "err_notinitialized", L_notinitialized_text);
if (b.shimElement) {
b.shimElement.removeNode(true);
b.shimElement = null
}
document.body.removeChild(b);
var c = -1;
for (var a = 0; a < this.controls.length; a++) if (this.controls[a] == b) {
c = a;
break
}
if (c >= 0) {
for (var a = c; a < this.controls.length - 1; a++) {
this.controls[a] = this.controls[a + 1];
this.controlzIndexes[a] = this.controlzIndexes[a + 1];
this.controltops[a] = this.controltops[a + 1];
this.controllefts[a] = this.controllefts[a + 1]
}
this.controls.pop();
this.controlzIndexes.pop();
this.controltops.pop();
this.controllefts.pop()
}
};
VEMap.prototype.ShowControl = function (a) {
if (a != null && a != "undefined") {
if (a.shimElement) a.shimElement.style.display = "block";
a.style.visibility = "visible";
mvcViewFacade.ShowShimIfSupported(a)
}
};
VEMap.prototype.HideControl = function (a) {
if (a != null && a != "undefined") {
HideShim(a);
a.style.visibility = "hidden"
}
};
VEMap.prototype.Clear = function () {
this._ClearView();
this.ClearTraffic();
if (typeof VE_TrafficManager != "undefined") VE_TrafficManager.Destroy();
this.DeleteAllPushpins();
this.DeleteAllShapeLayers();
this.DeleteRoute();
this.m_vegraphicsmanager.Clear();
this.m_veambiguouslist.Hide();
this.m_vemessage.Hide()
};
VEMap.prototype._ShowLoading = function () {
if (!this.veloadingdiv) {
this.veloadingdiv = document.createElement("div");
this.veloadingdiv.className = "VE_Network_Loading";
this.veloadingdiv.style.top = "75px";
this.veloadingdiv.style.left = "80px";
this.veloadingdiv.innerHTML = L_loading_text;
this.AddControl(this.veloadingdiv, 202)
}
if (this.veloadingdiv.style.display != "block") this.veloadingdiv.style.display = "block";
else this.veloadingdiv.style.display = "none"
};
VEMap.prototype.AddPolyline = function (a) {
if (typeof a == "object" && !(a instanceof VEPolyline)) {
var b = new VEShape(VEShapeType.Polyline, a);
this.AddShape(b);
return b
}
this.m_vegraphicsmanager.DrawLine(a)
};
VEMap.prototype.DeletePolyline = function (a) {
this.m_vegraphicsmanager.RemoveLinebyId(a)
};
VEMap.prototype.DeleteAllPolylines = function () {
this.m_vegraphicsmanager.RemoveAllLines()
};
VEMap.prototype.AddPolygon = function (a) {
if (typeof a == "object" && !(a instanceof VEPolygon)) {
var b = new VEShape(VEShapeType.Polygon, a);
this.AddShape(b);
return b
}
this.m_vegraphicsmanager.DrawPolygon(a)
};
VEMap.prototype.DeletePolygon = function (a) {
this.m_vegraphicsmanager.RemovePolygonbyId(a)
};
VEMap.prototype.DeleteAllPolygons = function () {
this.m_vegraphicsmanager.RemoveAllPolygons()
};
VEMap.prototype.LoadModules = function (c, a, d) {
var b = null;
b = VEOndemandJsDownloads(true, c, this, [this.LoadModules, c, a, d]);
if (b) if (typeof a == "function" && a != null) a(d)
};
VEMap.prototype._InitializeModules = function (b) {
var c = b.length;
for (var a = 0; a < c; a++) switch (b[a]) {
case VE_ModuleName.APILAYERS:
this.InitMapDrawing();
break;
case VE_ModuleName.APIFIND:
this.InitSearch();
break;
case VE_ModuleName.APIROUTING:
this.InitRouting();
break;
case VE_ModuleName.API3D:
this.Init3D();
break;
case VE_ModuleName.APICONTROLS:
this.InitNavControl();
break;
case VE_ModuleName.APIBIRDSEYE:
this.InitBirdseye();
break;
case VE_ModuleName.APITILES:
this.InitTiles()
}
};
VEMap.prototype._ResetQueueEvent = function (a) {
if (a == Msn.VE.MapActionMode.Mode2D) this.queueEventInitialized = false
};
VEMap.prototype._QueueRequest = function (a, b, c, d) {
if (this.vemapcontrol.IsModeEnabled(Msn.VE.MapActionMode.Mode3D) && this.RequestQueueEnabled) {
if (!this.queueEventInitialized) {
this.vemapcontrol.Get3DControl().AttachEvent("OnCameraChanged", "ProcessQueuedRequest");
this.queueEventInitialized = true
}
if (this.vemapcontrol.IsCameraFlying() || this.requestQueue.length > 0) {
this.requestQueue.push(new RequestQueueItem(a, b, c, d));
return
}
}
a(b, c, d)
};
VEMap.prototype._ProcessQueuedRequest = function () {
if (this.requestQueue.length > 0) {
var a = this.requestQueue.shift();
a.Call(a.Param1, a.Param2, a.Param3)
}
};
VEMap.prototype.ShowMapModeSwitch = function (a) {
if (this.fixedMap != true) {
this.vemapcontrol.SetShowMapModeSwitch(a);
this.showMapModeSwitch = a
}
};
VEMap.prototype.SetTileBuffer = function (a) {
this.tileBuffer = a;
if (this.vemapcontrol != null && this.vemapcontrol != "undefined") this.vemapcontrol.SetTilePixelBuffer(a * Msn.VE.API.Globals.vetilesize)
};
VEMap.prototype._EROHouseKeeping = function (d) {
if (d == Msn.VE.MapActionMode.Mode2D) {
ero.setGlitz(true, false, true, false);
ero.unhookEvent("aftershow", c);
ero.unhookEvent("afterhide", b);
ero.unhookEvent("beforeshow", a)
} else {
ero.setGlitz(true, false, true, false);
ero.hookEvent("aftershow", c);
ero.hookEvent("afterhide", b);
ero.hookEvent("beforeshow", a)
}
function c() {
ShowShim(ero.getBody(), ero.getElement())
}
function b() {
HideShim(ero.getBody())
}
function a(a) {
if (a.Entity == -1) ero.setGlitz(false, null, false, true)
}
};
VEMap.prototype.AllTilesLoaded = function () {
if (this.vemapcontrol.IsModeEnabled(Msn.VE.MapActionMode.Mode3D)) {
var a = this.vemapcontrol.Get3DControl();
return a ? a.AllTilesLoaded : false
}
return true
};
VEMap.prototype.HasClientToken = function () {
return this.ClientToken != null && typeof this.ClientToken != "undefined" && this.ClientToken.length > 0
};
VEMap.GetVersion = function () {
return Msn.VE.API.Globals.vecurrentversion
};
VEMap.prototype.ShowDisambiguationDialog = function (a) {
VEValidator.ValidateBoolean(a, "value");
this.m_vedirectionsmanager.m_showDisambigousDialog = a
};
VEMap.prototype.SetAnimationEnabled = function (a) {
VEValidator.ValidateBoolean(a, "value");
if (this.vemapcontrol) this.vemapcontrol.SetAnimationEnabled(a)
};
function VEPrintOptions(a) {
VEValidator.ValidateBoolean(a, "enablePrinting");
this.EnablePrinting = a
}
VEMap.prototype.SetPrintOptions = function (a) {
VEValidator.ValidateBoolean(a.EnablePrinting, "VEPrintOptions.EnablePrinting");
if (!(Web.Browser.isSafari() || Msn.VE.Environment.IsIE80())) {
this._mapPrintOptions = a;
if (this.vemapcontrol) this.vemapcontrol.SetPrintable(a.EnablePrinting)
}
};
function VEAPIRequestInvoke(f, a, e, b) {
if (b && b.SessionQueue) b.SessionQueue.push({
service: f,
parameters: a,
fnCallback: e
});
else {
var d = new VENetwork,
c = VENetwork.GetExecutionID();
d.UseCloseDep = true;
d.ServiceUrl = f;
if (b) a.push(new VEParameter(Msn.VE.API.Constants.clienttoken, b._GetCredentials()));
a.push(new VEParameter(Msn.VE.API.Constants.culture, '"' + Msn.VE.API.Globals.locale + '"'));
a.push(new VEParameter(Msn.VE.API.Constants.format, Msn.VE.API.Constants.json));
a.push(new VEParameter(Msn.VE.API.Constants.requestid, c));
d.BeginInvoke("_f" + c, a, e, null, c)
}
}
VEMap.prototype.GetDistance = function (a, b) {
VEValidator.ValidateObject(a, "veLatLong1", VELatLong, "VELatLong");
VEValidator.ValidateObject(b, "veLatLong2", VELatLong, "VELatLong");
var h = 6378137,
c = Math.PI / 180,
d = a.Latitude * c,
e = b.Latitude * c,
f = Math.sin((d - e) / 2),
g = Math.sin((a.Longitude - b.Longitude) * c / 2),
i = Math.asin(Math.sqrt(f * f + Math.cos(d) * Math.cos(e) * g * g));
return h * 2 * i / 1000
};
VEMap.prototype.InitNavControl = function () {};
VEDashboardSize = Msn.VE.DashboardSize;
VEMap.prototype.SetDashboardSize = function (a) {
if (typeof a != "undefined" && a != null) {
VEValidator.ValidateDashboardSize(a, "VEDashboardSize");
this.dashboardSize = a;
this.dashboardVersion = 6;
if (this.dashboardSize == VEDashboardSize.Small || this.dashboardSize == VEDashboardSize.Tiny) this.dashboardVersion = 5
}
};
VEMap.prototype.SetDashboardVersion = function (a) {
this.dashboardVersion = a
};
VEMap.prototype.ShowDashboard = function () {
if (this.vemapcontrol) {
var a = this.vemapcontrol.GetDashboard();
if (!a) this.vemapcontrol.CreateDashboard(5, 5, this.dashboardSize, this.m_dashboardId, this.showMapModeSwitch, this._mapOptions.EnableBirdseye, this._mapOptions.EnableDashboardLabels, this.dashboardVersion);
else a.Show();
if ($MVEM.IsEnabled(MapControl.Features.MapStyle.View3D)) this.Show3DNavigationControl()
}
this._showDashboard = true
};
VEMap.prototype.HideDashboard = function () {
if (this.vemapcontrol) {
var a = this.vemapcontrol.GetDashboard();
if (a) a.Hide();
if ($MVEM.IsEnabled(MapControl.Features.MapStyle.View3D)) this.Hide3DNavigationControl()
}
this._showDashboard = false
};
VEMap.prototype.ShowScalebar = function () {
if (this.vemapcontrol) this.vemapcontrol.SetScaleBarVisibility(true);
this._showScalebar = true
};
VEMap.prototype.HideScalebar = function () {
if (this.vemapcontrol) this.vemapcontrol.SetScaleBarVisibility(false);
this._showScalebar = false
};
VEMap.prototype.ShowMiniMap = function (a, b, d) {
if (a != null && typeof a != "undefined" && b != null && typeof b != "undefined") {
VEValidator.ValidateInt(a, "x");
VEValidator.ValidateInt(b, "y")
}
if (d) VEValidator.ValidateMiniMapSize(d, "size");
var c = this.vemapcontrol.GetMinimap();
if (c) {
if (a != null && typeof a != "undefined" && b != null && typeof b != "undefined") c.SetPosition(parseInt(a), parseInt(b));
c.Show()
} else c = this.vemapcontrol.CreateMinimap(a, b, null, true, false, null, this.ClientToken);
if (d) c.SetSize(d)
};
VEMap.prototype.HideMiniMap = function () {
var a = this.vemapcontrol.GetMinimap();
if (a) a.Hide()
};
VE_SetModuleStatus(VE_ModuleName.APICONTROLS, "loaded");
VEMap.prototype.InitBirdseye = function () {};
VEMap.prototype.GetBirdseyeScene = function () {
if (this.GetMapMode() == Msn.VE.MapActionMode.Mode3D) return null;
var a = null,
b = this.vemapcontrol.GetObliqueScene();
if (b != null && b != "undefined") {
a = new VEBirdseyeScene(b);
a.SetClientToken(this.ClientToken);
a.SetGUID(this.GUID)
}
return a
};
VEMap.prototype.IsBirdseyeAvailable = function () {
if (this.GetMapMode() == Msn.VE.MapActionMode.Mode3D) return false;
return this.vemapcontrol.IsObliqueAvailable()
};
VEMap.prototype.SetBirdseyeOrientation = function (a) {
if (this.GetMapMode() == Msn.VE.MapActionMode.Mode3D) return false;
VEValidator.ValidateOrientation(a, "orientation");
return this.vemapcontrol.SetObliqueOrientation(a)
};
VEMap.prototype.SetBirdseyeScene = function (a, b, c, d) {
if (this.GetMapMode() == Msn.VE.MapActionMode.Mode3D) return false;
if (a == null || a instanceof VELatLong) return this.SetBirdseye(a, b, c, d);
else return this.vemapcontrol.SetObliqueScene(a)
};
VEMap.prototype.SetBirdseye = function (b, a, c, d) {
if (this.GetMapMode() == Msn.VE.MapActionMode.Mode3D) return false;
if (b) VEValidator.ValidateObject(b, "veLatLong", VELatLong, "VELatLong");
else b = this.GetCenter();
if (a) VEValidator.ValidateOrientation(a, "orientation");
else a = VEOrientation.North;
if (c) VEValidator.ValidateNonNegativeInt(c, "zoomLevel");
else c = 1;
if (d) VEValidator.ValidateFunction(d, "callback");
else d = null;
var e = (new _xy1).Decode(b);
return this.vemapcontrol.SetObliqueLocation(new Msn.VE.LatLong(e.Latitude, e.Longitude), a, c, d)
};
VEMap.prototype.SetShapesAccuracy = function (a) {
if (a != VEShapeAccuracy.None && a != VEShapeAccuracy.Pushpin && a != VEShapeAccuracy.All) throw new VEException("VEMap:SetShapesAccuracy", "err_invalidargument", L_invalidargument_text.replace("%1", "value").replace("%2", "VEShapeAccuracy"));
this.m_vegraphicsmanager._useOffset = a
};
VEMap.prototype.SetOverMaxPointsShapeRequest = function (a) {
if (a != VEFailedShapeRequest.DoNotDraw && a != VEFailedShapeRequest.DrawInaccurately) throw new VEException("VEMap:SetOverMaxPointsShapeRequest", "err_invalidargument", L_invalidargument_text.replace("%1", "value").replace("%2", "VEFailedShapeRequest"));
this.m_vegraphicsmanager._drawOverMaxShapes = a
};
VEMap.prototype.SetFailedShapeRequest = function (a) {
if (a != VEFailedShapeRequest.DoNotDraw && a != VEFailedShapeRequest.DrawInaccurately && a != VEFailedShapeRequest.QueueRequest) throw new VEException("VEMap:SetFailedShapeRequest", "err_invalidargument", L_invalidargument_text.replace("%1", "value").replace("%2", "VEFailedShapeRequest"));
this.m_vegraphicsmanager._failRequest = a
};
VEMap.prototype.SetShapesAccuracyRequestLimit = function (a) {
VEValidator.ValidateNonNegativeInt(a, "value");
Msn.VE.API.Constants.maxasynlatlongs = a
};
VEShapeAccuracy = new function () {
this.None = 0;
this.Pushpin = 1;
this.All = 2
};
VEFailedShapeRequest = new function () {
this.DoNotDraw = 0;
this.DrawInaccurately = 1;
this.QueueRequest = 2
};
VE_SetModuleStatus(VE_ModuleName.APIBIRDSEYE, "loaded");
VEMap.prototype.SetDisplayThreshold = function (a) {
var a = parseInt(a);
if (isNaN(a)) this.m_vegraphicsmanager.SetDisplayThreshold(a)
};
VEMap.prototype.EnableShapeDisplayThreshold = function (a) {
VEValidator.ValidateBoolean(a, "value");
VE_LatLongThreshold.UseThreshold = a
};
VEMap.prototype.ImportShapeLayerData = function (a, c, b) {
VEValidator.ValidateObject(a, "_spec", VEShapeSourceSpecification, "VEShapeSourceSpecification");
if (typeof a.LayerSource != "string" || typeof a.Type != "string") throw new VEException("VEMap:AddLayer", "err_invalidlayertype", L_invalidlayertype_text);
this.m_velayermanager.ImportLayer(a, c, b)
};
VEMap.prototype.Import3DModel = function (a, c, d, b, e) {
VEValidator.ValidateObject(a, "modelShapeSource", VEModelSourceSpecification, "VEModelSourceSpecification");
if (typeof a.ModelSource != "string" || typeof a.Format != "string") throw new VEException("VEMap:Import3DModel", "err_invalidlayertype", L_invalidlayertype_text);
return this.m_velayermanager.ImportModelLayer(a, c, d, b, e)
};
VEMap.prototype.SetInfoBoxStyles = function (a) {
window.ero.setClasses(a)
};
VEMap.prototype.ClearInfoBoxStyles = function () {
window.ero.setClasses(_VECustomInfoBox)
};
VEMap.prototype.SetDefaultInfoBoxStyles = function () {
window.ero.setClasses(ERO.DefaultClasses)
};
VEMap.prototype.ShowInfoBox = function (c, b, d) {
var l = typeof c == "object" && c instanceof VEShape;
if (!l) return;
var k = c._shplayer == null || c._shplayer._mapGuid == null;
if (k) return;
var h = null,
e = null,
g = null;
if (typeof b == "object") if (b instanceof VELatLong) {
var i = new _xy1;
b = i.Decode(b);
e = b.Latitude;
g = b.Longitude
} else if (b instanceof VEPixel) if (!isNaN(b.x) && !isNaN(b.y)) h = b;
if (e == null && h == null) {
var f = c.Primitives[0];
if (f.type == VEShapeType.Pushpin) {
e = f.points[1];
g = f.points[0]
} else {
e = f.labelPosY;
g = f.labelPosX
}
}
var m = Msn.Drawing.GetLabelUID(c.Primitives[0].iid),
a = null;
if (e != null) {
a = this.vemapcontrol.LatLongToPixel(new Msn.VE.LatLong(e, g), this.vemapcontrol.GetZoomLevel());
if (a == null) a = new VEPixel(0, 0)
} else a = h;
var j = typeof d == "object" && d instanceof VEPixel;
if (j) if (!isNaN(d.x) && !isNaN(d.y)) {
a.x += d.x;
a.y += d.y
}
if (a.x < 0 || a.x > this.GetWidth() || a.y < 0 || a.y > this.GetHeight()) if (b instanceof VELatLong) throw new VEException("VEMap:ShowInfoBox", "L_invalidargument_text", L_invalidargument_text.replace("%1", "veAnchor").replace("%2", "VELatLong"));
else if (b instanceof VEPixel) throw new VEException("VEMap:ShowInfoBox", "L_invalidargument_text", L_invalidargument_text.replace("%1", "veAnchor").replace("%2", "VEPixel"));
else return;
a.x += this.GetLeft();
a.y += this.GetTop();
VEShowVEShapeERO(m, this.GUID, null, c, a.x, a.y)
};
VEMap.prototype.HideInfoBox = function () {
VEHideVEShapeERO(true)
};
VEMap.prototype.CloneShape = function (a) {
VEValidator.ValidateObject(a, "_veshape", VEShape, "VEShape");
var c = this.m_velayermanager.VE_LayerManager,
b = c.CloneAnnotation(a);
return b
};
VEMap.prototype.AddShape = function (b) {
var a = this.m_velayermanager.VE_LayerManager.GetCollectionByIndex(0);
a._mapGuid = this.GUID;
a.AddShape(b)
};
VEMap.prototype.DeleteShape = function (a) {
VEValidator.ValidateObject(a, "_veshape", VEShape, "VEShape");
if (a._shplayer) a._shplayer.DeleteShape(a)
};
VEMap.prototype.GetShapeByID = function (a) {
if (typeof a == "undefined" || a == null || a == "") return null;
var b = this.m_velayermanager.VE_LayerManager,
c = b.GetAnnotationById(a);
return c
};
VEMap.prototype.AddShapeLayer = function (a, c) {
VEValidator.ValidateObject(a, "shpLyr", VEShapeLayer, "VEShapeLayer");
if (a._mapGuid != null) throw new VEException("VEMap:AddLayer", "err_invalidlayertype", L_invalidlayertype_text);
a._mapGuid = this.GUID;
var d = this.m_velayermanager.VE_LayerManager;
d.AddCollection(null, a);
if (!a.GetVisibility()) return;
if (typeof c != "undefined" && c == true) {
var b = a.GetBoundingBox(),
e = [new Msn.VE.LatLong(b.y1, b.x1), new Msn.VE.LatLong(b.y2, b.x2)];
this.vemapcontrol.SetBestMapView(e)
}
this.m_vegraphicsmanager.DrawLayer(a)
};
VEMap.prototype.DeleteShapeLayer = function (a) {
VEValidator.ValidateObject(a, "shpLyr", VEShapeLayer, "VEShapeLayer");
try {
a._clusteringAlgorithm = null;
a.DeleteAllShapes();
a.DeleteClusterLayer();
this.m_velayermanager.VE_LayerManager.RemoveCollection(a)
} catch (b) {}
};
VEMap.prototype.DeleteAllShapeLayers = function () {
try {
this.DeleteAllShapes();
var d = [],
c = this.GetShapeLayerCount();
for (var a = 0; a < c; a++) {
var b = this.GetShapeLayerByIndex(a);
if (b._isClusterLayer) {
this.DeleteShapeLayer(b);
a--;
c--
}
b._clusterLayer = null
}
this.m_velayermanager.VE_LayerManager.DeleteAll()
} catch (e) {}
};
VEMap.prototype.DeleteAllShapes = function () {
try {
this.m_vegraphicsmanager.ClearAll();
var b = this.m_velayermanager.VE_LayerManager,
c = b.GetCollectionCount();
for (var a = 0; a < c; a++) b.GetCollectionByIndex(a).DeleteAllShapes()
} catch (d) {}
};
VEMap.prototype.ShowAllShapeLayers = function () {
this.m_velayermanager.ShowAllLayers()
};
VEMap.prototype.HideAllShapeLayers = function () {
this.m_vegraphicsmanager.ClearAll();
this.m_velayermanager.VE_LayerManager.SetVisibility(false)
};
VEMap.prototype.GetShapeLayerByIndex = function (b) {
if (typeof b == "undefined" || this.m_velayermanager == null) return null;
var a = null;
a = this.m_velayermanager.VE_LayerManager.GetCollectionByIndex(b);
if (a) a._mapGuid = this.GUID;
return a
};
VEMap.prototype.GetShapeLayerCount = function () {
if (this.m_velayermanager == null) return 0;
return this.m_velayermanager.VE_LayerManager.GetCollectionCount()
};
VEMap.prototype.AddCustomLayer = function (b) {
var a = g(this.mapelement).select(".MSVE_Map").element();
if (a) a.appendChild(b)
};
VEMap.prototype.RemoveCustomLayer = function (b) {
var a = g(this.mapelement).select(".MSVE_Map").element();
if (a) a.removeChild(b)
};
VEModelFormat = new function () {
this.OBJ = "obj"
};
VEModelStatusCode = new function () {
this.Success = "Success";
this.InvalidURL = "InvalidURL";
this.Failed = "Failed"
};
function VEModelSourceSpecification(b, c, a) {
this.Format = null;
this.Layer = null;
this.ModelSource = null;
if (typeof b == "undefined" || b == null) this.Format = VEModelFormat.OBJ;
else if (b === VEModelFormat.OBJ) this.Format = b;
else throw new VEException("VEModelSourceSpecification", "err_invalidargument", L_invalidargument_text.replace("%1", "modelFormat").replace("%2", "VEModelFormat"));
if (typeof a == "object" && a instanceof VEShapeLayer) this.Layer = a;
else if (typeof a != "undefined" && a != null) throw new VEException("VEModelSourceSpecification", "err_invalidargument", L_invalidargument_text.replace("%1", "layer").replace("%2", "VEShapeLayer"));
if (typeof c == "string") this.ModelSource = c;
else throw new VEException("VEModelSourceSpecification", "err_invalidargument", L_invalidargument_text.replace("%1", "modelSource").replace("%2", "String"))
}
function VEModelScale(a, b, c) {
this.X = this.Y = this.Z = 1;
if (typeof a != "undefined" && a != null) {
VEValidator.ValidateFloat(a, "x");
this.X = parseFloat(a)
}
var d = typeof b != "undefined" && b != null,
e = typeof c != "undefined" && c != null;
if (!d && !e) this.Y = this.Z = this.X;
if (d) {
VEValidator.ValidateFloat(b, "y");
this.Y = parseFloat(b)
}
if (e) {
VEValidator.ValidateFloat(c, "z");
this.Z = parseFloat(c)
}
}
VEModelScaleUnit = new function () {
this.Inches = .0254;
this.Feet = .3048;
this.Yards = .9144;
this.Millimeters = .001;
this.Centimeters = .01;
this.Meters = 1
};
function VEModelOrientation(a, c, b) {
this.Heading = 0;
this.Tilt = 0;
this.Roll = 0;
if (typeof a != "undefined" && a != null) {
VEValidator.ValidateFloat(a, "heading");
this.Heading = parseFloat(a)
}
if (typeof c != "undefined" && c != null) {
VEValidator.ValidateFloat(c, "tilt");
this.Tilt = parseFloat(c)
}
if (typeof b != "undefined" && b != null) {
VEValidator.ValidateFloat(b, "roll");
this.Roll = parseFloat(b)
}
}
VEDataType = new function () {
this.VECollection = "c";
this.GeoRSS = "g";
this.VETileSource = "t";
this.ImportXML = "i"
};
function VEShapeSourceSpecification(a, c, b) {
this.Type = null;
this.Layer = null;
this.LayerSource = null;
this.Method = "Get";
this.FnCallback = null;
this.SetsBestMapView = true;
this.Success = false;
this.MaxImportedShapes = Msn.VE.API.Globals.vedefaultmaximportedshapes;
if (typeof a == "string" && (a == "c" || a == "g" || a == VEDataType.ImportXML)) this.Type = a;
else throw new VEException("VEShapeSourceSpecification", "err_invalidargument", L_invalidargument_text.replace("%1", "type").replace("%2", "VEDataType"));
if (typeof b == "object" && b instanceof VEShapeLayer) this.Layer = b;
if (typeof c == "string") this.LayerSource = c;
else throw new VEException("VEShapeSourceSpecification", "err_invalidargument", L_invalidargument_text.replace("%1", "layerSource").replace("%2", "String"))
}
function VELayerManager(c) {
var a = this;
VEValidator.ValidateNonNull(c, "vemap");
this.m_vemap = c;
this.m_vemapcontrol = this.m_vemap.vemapcontrol;
this.m_veLatLongDecoder = new _xy1;
this.m_spec = new VELatLongFactorySpecFromMap(this.m_vemap);
var e = new VELatLongFactory(this.m_spec);
this.VE_LayerManager = new Msn.VE.Core.LayerManager;
var b = null;
if (a.m_vemap.m_vegraphicsmanager) a.m_vemap.m_vegraphicsmanager.InitLayerManager(this);
this.ImportLayer = function (a, d, c) {
a.Method = "Get";
if (typeof d == "function") a.FnCallback = d;
if (typeof c != "undefined" && c != null) a.SetsBestMapView = c;
if (typeof a.Layer != "object" || !(a.Layer instanceof VEShapeLayer)) a.Layer = this.VE_LayerManager.GetCollectionByIndex(0);
else if (a.Layer._mapGuid == null) {
a.Layer._mapGuid = this.m_vemap.GUID;
this.VE_LayerManager.AddCollection(null, a.Layer)
} else if (a.Layer._mapGuid != this.m_vemap.GUID) throw new VEException("VEMap:AddLayer", "err_invalidlayertype", L_invalidlayertype_text);
a.Layer.Spec = a;
if (a.Type == VEDataType.GeoRSS) {
if (b == null) b = new Msn.Drawing.MapGeoRssReader;
this.AddGeoRSSLayer(a.Layer)
} else if (a.Type == VEDataType.VECollection) this.AddVECollectionLayer(a.Layer);
else if (a.Type == VEDataType.ImportXML) this.AddVEImportedLayer(a.Layer);
else throw new VEException("VEMap:ImportShapeLayerData", "err_invalidlayertype", L_invalidlayertype_text)
};
this.AddGeoRSSLayer = function (b) {
try {
VENetwork.DownloadXml(b.Spec.LayerSource, b.Spec.Method, a.RetrieveGeoRSSCallback, b.GetId())
} catch (c) {
throw c
}
};
this.AddVECollectionLayer = function (d) {
try {
var b = d;
b.SetMsnId(d.Spec.LayerSource);
var a = [];
a.push(new VEParameter(Msn.VE.API.Constants.clienttoken, this.m_vemap._GetCredentials()));
a.push(new VEParameter("mapguid", this.m_vemap.GUID));
a.push(new VEParameter("action", "retrieveCollection"));
a.push(new VEParameter(VE_CollectionsManagerConstants.C_Id, b.Spec.LayerSource));
var e = "VEMap._GetMapFromGUID('" + this.m_vemap.GUID + "')._lm.RetrieveCollectionCallback";
a.push(new VEParameter(Msn.VE.API.Constants.rim, e));
a.push(new VEParameter(Msn.VE.API.Constants.rimargs, "'" + b.GetId() + "'"));
a.push(new VEParameter(Msn.VE.API.Constants.market, Msn.VE.API.Globals.locale));
var c = new VENetwork;
c.ServiceUrl = Msn.VE.API.Constants.collectionservice;
c.BeginInvoke(null, a, _VEAPIOnImportLayerDataCallback, this.m_vemap.GUID + "_" + b.GetId())
} catch (f) {
throw f
}
};
this.AddVEImportedLayer = function (a) {
VEValidator.ValidateNonNegativeInt(a.Spec.MaxImportedShapes, "VEShapeSourceSpecification.MaxImportedShapes");
if (a.Spec.MaxImportedShapes == 0) a.Spec.MaxImportedShapes = Msn.VE.API.Globals.vedefaultmaximportedshapes;
else a.Spec.MaxImportedShapes = parseInt(a.Spec.MaxImportedShapes);
try {
var b = [];
a.SetMsnId(a.GetId());
b.push(new VEParameter(Msn.VE.API.Constants.clienttoken, this.m_vemap._GetCredentials()));
b.push(new VEParameter("mapguid", this.m_vemap.GUID));
b.push(new VEParameter("action", "importcol"));
b.push(new VEParameter("saveimport", "v"));
b.push(new VEParameter(VE_CollectionsManagerConstants.C_Id, a.GetId()));
b.push(new VEParameter("mapurl", IOSec.EncodeUrl(a.Spec.LayerSource)));
var d = "VEMap._GetMapFromGUID('" + this.m_vemap.GUID + "')._lm.RetrieveImportedCallback";
b.push(new VEParameter(Msn.VE.API.Constants.rim, d));
b.push(new VEParameter(Msn.VE.API.Constants.rimargs, "'" + a.GetId() + "'"));
b.push(new VEParameter(Msn.VE.API.Constants.market, Msn.VE.API.Globals.locale));
b.push(new VEParameter(Msn.VE.API.Constants.maximportedshapes, a.Spec.MaxImportedShapes));
var c = new VENetwork;
c.ServiceUrl = Msn.VE.API.Constants.collectionservice;
c.BeginInvoke(null, b, _VEAPIOnImportLayerDataCallback, this.m_vemap.GUID + "_" + a.GetId())
} catch (e) {
throw e
}
};
this.ImportModelLayer = function (c, j, b, e, f) {
if (typeof b != "object" || !(b instanceof VELatLong)) throw new VEException("VEMap:Import3DModel", "err_invalidargument", L_invalidargument_text.replace("%1", "latLong").replace("%2", "VELatLong"));
var h = typeof e != "undefined" && e != null;
if (h && (typeof e != "object" || !(e instanceof VEModelOrientation))) throw new VEException("VEMap:Import3DModel", "err_invalidargument", L_invalidargument_text.replace("%1", "orientation").replace("%2", "VEModelOrientation"));
var i = typeof f != "undefined" && f != null;
if (i && (typeof f != "object" || !(f instanceof VEModelScale))) throw new VEException("VEMap:Import3DModel", "err_invalidargument", L_invalidargument_text.replace("%1", "scale").replace("%2", "VEModelScale"));
if (typeof c.Layer != "object" || !(c.Layer instanceof VEShapeLayer)) {
c.Layer = this.VE_LayerManager.GetCollectionByIndex(0);
c.Layer._mapGuid = this.m_vemap.GUID
} else if (c.Layer._mapGuid == null) {
c.Layer._mapGuid = this.m_vemap.GUID;
this.VE_LayerManager.AddCollection(null, c.Layer)
} else if (c.Layer._mapGuid != this.m_vemap.GUID) throw new VEException("VEMap:Import3DModel", "err_invalidlayertype", L_invalidlayertype_text);
try {
b.AltitudeMode = VEAltitudeMode.RelativeToGround;
var a = new VEShape(VEShapeType.Pushpin, b),
d = "";
d = d.concat("modelUrl=", c.ModelSource, ";latitude=", b.Latitude, ";longitude=", b.Longitude);
if (b.HasAltitude()) d = d.concat(";altitude=", b.Altitude);
if (i) d = d.concat(";xScale=", f.X, ";yScale=", f.Y, ";zScale=", f.Z);
if (h) d = d.concat(";xRotation=", e.Tilt, ";yRotation=", e.Roll, ";zRotation=", e.Heading);
var g = new VE_3DModelData;
g.Properties = d;
if (typeof j == "function") g.Callback = j;
a.ModelData = g;
a.Latitude = b.Latitude;
a.Longitude = b.Longitude;
a.Url = "";
a.IconId = "";
a.Notes = "";
a.SetDisplayOrder(0);
a.SetIndex(0);
a.Title = "";
a.minZoomLevel = 15;
c.Layer.AddShape(a);
return a
} catch (k) {
throw k
}
};
function d(a) {
if (!document.all) {
var c = new DOMParser;
return c.parseFromString(a, "text/xml")
} else {
var b = new ActiveXObject("Msxml2.DOMDocument");
b.loadXML(a);
return b
}
}
this.RetrieveGeoRSSCallback = function (f, g) {
var c = a.VE_LayerManager.RetrieveCollectionById(g),
e = false;
try {
e = b.ReadGeoRSS(f, c)
} catch (i) {
a.m_vemap.ShowMessage(i.message || L_loadxml_text);
return
}
if (!e) {
a.m_vemap.ShowMessage(L_loadxml_text);
return
}
if (c.GetVisibility()) {
if (c.Spec.SetsBestMapView && c.GetShapeCount() > 0) {
var d = c.GetBoundingBox(),
h = [new Msn.VE.LatLong(d.y1, d.x1), new Msn.VE.LatLong(d.y2, d.x2)];
a.m_vemapcontrol.SetBestMapView(h)
}
a.m_vemap.m_vegraphicsmanager.DrawLayer(c)
}
if (typeof c.Spec.FnCallback == "function") c.Spec.FnCallback(c)
};
this.RetrieveImportedCallback = function (a, b) {
var c = parseInt(a);
if (isNaN(c)) this.RetrieveCollectionCallback(a, b)
};
this.RetrieveCollectionCallback = function (f, g) {
var h = d(f),
b = a.VE_LayerManager.RetrieveCollectionById(g);
if (!b) return;
b.Spec.Success = true;
var e = new VE_MapRequestBean(MC_ACTION_RETRIEVE_COLLECTION);
VE_MapCmlReader.ExtractCollections(e, h, this.VE_LayerManager);
if (b.GetVisibility()) {
if (b.Spec.SetsBestMapView && b.GetShapeCount() > 0) {
var c = b.GetBoundingBox(),
i = [new Msn.VE.LatLong(c.y1, c.x1), new Msn.VE.LatLong(c.y2, c.x2)];
a.m_vemapcontrol.SetBestMapView(i)
}
a.m_vemap.m_vegraphicsmanager.DrawLayer(b)
}
if (b.Spec.FnCallback != null && b.Spec.FnCallback != "undefined") b.Spec.FnCallback(b)
};
this.RetrieveAllAnnotationsCallback = function () {}
}
VELayerManager.prototype.Dispose = function () {
this.m_vemap.m_vegraphicsmanager.ClearAll();
this.VE_LayerManager.DeleteAll();
this.m_vemapcontrol = null;
this.m_vemap = null;
this.m_veLatLongDecoder = null;
this.m_spec = null;
this.VE_LayerManager.Dispose();
this.VE_LayerManager = null
};
VELayerManager.prototype.ShowAllLayers = function () {
this.VE_LayerManager.SetVisibility(true);
var b = [],
e = this.VE_LayerManager.GetCollectionCount();
for (var c = 0; c < e; ++c) {
var d = this.VE_LayerManager.GetCollectionByIndex(c);
if (d.GetShapeCount() > 0) {
var a = d.GetBoundingBox();
if (a != null) {
b.push(new Msn.VE.LatLong(a.y1, a.x1));
b.push(new Msn.VE.LatLong(a.y2, a.x2))
}
}
}
if (b.length >= 2) this.m_vemapcontrol.SetBestMapView(b);
this.m_vemap.m_vegraphicsmanager.DrawAll()
};
function _VEAPIOnImportLayerDataCallback(h, a) {
try {
if (typeof a == "string" && a.length > 2) {
var g = a.length,
c = a.indexOf("_");
if (c < 0 || c > g - 2) return;
var f = a.substring(0, c),
e = a.substring(c + 1),
d = VEMap._GetMapFromGUID(f)._lm,
b = d.VE_LayerManager.RetrieveCollectionById(e);
if (!b.Spec.Success) if (typeof b.Spec.FnCallback == "function") b.Spec.FnCallback(b, L_loadxml_text);
else d.m_vemap.ShowMessage(L_loadxml_text)
}
} catch (i) {
throw i;
return
}
}
function VECreateVEShapeERO(b, d) {
if (b._IconContent == null) {
var a = [],
f = b.GetPrimitive(0),
e = f.iid;
if (f.type != VEShapeType.Pushpin) e = Msn.Drawing.GetLabelUID(e);
var c = b._customIcon;
if (c == null) c = b.IconUrl;
if (c.indexOf("<") < 0) c = '';
a.push("
");
a.push(c);
a.push("
");
b._IconContent = a.join("")
}
return b._IconContent
}
function VEDragVEShapeDown(f, e) {
var a = GetVEMapInstance(e);
if (a == null) return;
if (a.m_velayermanager == null) return;
var b = a.m_velayermanager.VE_LayerManager;
if (!b) return;
annotation = b.GetAnnotationById(f);
if (!annotation) return;
if (annotation.Draggable) {
if (typeof annotation.onstartdrag == "function") annotation.onstartdrag(new ShapeDragEventArgs(annotation, annotation.GetIconAnchor()));
function c(c) {
var b = a.PixelToLatLong(new VEPixel(c.mapX, c.mapY));
if (typeof annotation.ondrag != "function" || !(annotation.ondrag(new ShapeDragEventArgs(annotation, b)) == true)) annotation.SetIconAnchor(b);
return true
}
function d() {
a.DetachEvent("onmousemove", c);
a.DetachEvent("onmouseup", d);
if (typeof annotation.onenddrag == "function") annotation.onenddrag(new ShapeDragEventArgs(annotation, annotation.GetIconAnchor()))
}
a.AttachEvent("onmousemove", c);
a.AttachEvent("onmouseup", d)
}
}
function VEShowVEShapeERO(m, q, h, p, f, g) {
var j = GetVEMapInstance(q);
if (j == null) return;
var a = null,
s = null,
r = null;
if (typeof p == "object") a = p;
else {
if (j.m_velayermanager == null) return;
var k = null;
k = j.m_velayermanager.VE_LayerManager;
if (!k) return;
a = k.GetAnnotationById(m);
if (!a) return
}
if (!a._eroContent) {
var l = false,
e = a.Title,
d = a.Notes,
n = IOSec.GetValidatedUrl(a.Url),
i = IOSec.GetValidatedUrl(a.PhotoUrl);
r = a.Latitude;
s = a.Longitude;
var c = "";
if (typeof i == "string" && i.length > 1) {
c = c.concat('");
c = c.concat('')
}
e = c.concat(e);
if (typeof n == "string" && n.length > 0) d = d.concat("
");
l = true
}
if (!document.all && (e.length == 0 || d.length == 0)) b.push("
");
b.push("");
if (l) a._eroContent = b.join("");
else a._eroContent = ""
}
eroContent = a._eroContent;
if (eroContent.length > 0) {
window.ero.setContent(eroContent);
if (j.GetMapMode() == Msn.VE.MapActionMode.Mode2D) if (typeof f == "number" && typeof g == "number") {
var h = new Msn.VE.Geometry.Rectangle(new Msn.VE.Geometry.Point(f, g), new Msn.VE.Geometry.Point(f, g));
window.ero.dockToRect(h, null, -1)
} else {
var o = $ID(m);
if (o != null && o != "undefined") {
window.ero.setBoundingArea(null);
window.ero.getBoundingArea().move(Gimme.Screen.getScrollPosition());
window.ero.dockToElement(o)
}
} else {
if (typeof h == "undefined" || h == null) h = new Msn.VE.Geometry.Rectangle(new Msn.VE.Geometry.Point(f, g), new Msn.VE.Geometry.Point(f, g));
ero.setGlitz(false, false, false, true);
window.ero.dockToRect(h, null, -1)
}
}
}
function VEHideVEShapeERO(a) {
if (window.ero != null) {
if (a == "undefined" || a == null) a = false;
window.ero.hide(a)
}
}
var _VECustomInfoBox = {
ContainerNoBeak: "customInfoBox-noBeak",
ContainerRightBeak: "customInfoBox-with-rightBeak",
ContainerLeftBeak: "customInfoBox-with-leftBeak",
Beak: "customInfoBox-beak",
Shadow: "customInfoBox-shadow",
Body: "customInfoBox-body",
Actions: "customInfoBox-actions",
ActionsBackground: "customInfoBox-actionsBackground",
PreviewArea: "customInfoBox-previewArea",
PaddingHack: "customInfoBox-paddingHack",
ProgressAnimation: "customInfoBox-progressAnimation"
};
function VE_GetGeoCommunityUrl(a) {
if (a) return MC_GEOCOMMUNITY_SERVICEURL;
else return "GeoCommunity.asjx"
}
function VE_IsLargeData(a) {
if (a.length > MC_GEOCOMMUNITY_SIZELIMIT - 2048) return true;
return false
}
var MC_GEOCOMMUNITY_SIZELIMIT = 204800,
MC_GEOCOMMUNITY_SERVICEURL = "GeoCommunity.asjx",
MC_VESHAPE_EMPTY = -1777,
MC_VIEW_BUFFER = 1,
MC_STYLE_PINZIndex = 300,
MC_IID_NAMESPACE = "msftve",
MC_IID_CON_TOKEN = "_",
MC_GEO_TYPE_MULTIGEOMETRY = "Multigeometry",
MC_GEO_TYPE_FREEHAND = "Freehand",
MC_STYLE_FILL_COLOR = "fillcolor",
MC_STYLE_STROKE_COLOR = "strokecolor",
MC_STYLE_STROKE_WEIGHT = "strokeweight",
MC_STYLE_STROKE_STYLE = "stroke-style",
MC_STYLE_STROKE_DASH = "stroke-dashstyle",
MC_STYLE_FONT_COLOR = "font_color",
MC_STYLE_STROKE_ARROW = "stroke_arrow",
MC_STYLE_FONT_ITALIC = "font_italic",
MC_STYLE_FONT_UNDERSCORE = "font_underscore",
MC_STYLE_FONT_BOLD = "font_bold",
STATE_DEFAULT = 0,
STATE_DRAWING = 1,
STATE_EDITING = 2,
MC_DRAW_DEFAULT = 100,
MC_DRAW_POINT = 101,
MC_DRAW_POLYLINE = 102,
MC_DRAW_POLYGON = 103,
MC_DRAW_RECT = 104,
MC_DRAW_CIRCLE = 105,
MC_DRAW_TEXT = 1065,
MC_DRAW_MODEL = 1066,
MC_EDIT_ADDNODE = 107,
MC_EDIT_DELNODE = 108,
MC_EDIT_MOVENODE = 108,
MC_EDIT_SELNODE = 109,
MC_EDIT_SELEDGE = 110,
MC_EDIT_CONTINUELINE = 111,
MC_LABEL_VIEWER = "viewer",
MC_PROPERTY_DEFAULT = 0,
MC_PROPERTY_HIGHWAY = 1,
MC_PROPERTY_ROAD = 2,
MC_PROPERTY_LAKE = 3,
MC_PROPERTY_PARK = 4,
MC_PROPERTY_PARKINGLOT = 5,
MC_PROPERTY_PUSHPIN = 6,
MC_PROPERTY_TEMPDRAW = 7,
MC_PROPERTY_TEMPEDIT = 8,
MC_PROPERTY_EDITNODE = 10,
MC_PROPERTY_EDITSELNODE = 11,
MC_PROPERTY_GHOSTNODE = 12,
MC_NUMBERFORMAT_NUMBEROFDIGITSAFTERDOT = 2,
MC_NUMBERFORMAT_ZEROSTRING = "0",
MC_DECIMALROUNDOFF_THRESHOLD = 100,
MC_CML_ENTITY_NAME = "Entity",
MC_CML_ENTITY_PRIMITIVES = "Primitives",
MC_CML_ENTITY_PRIMITIVE = "Primitive",
MC_CML_ENTITY_COORDINATES = "coordinates",
MC_CML_DESCRIPTION = "Description",
MC_CML_TAGS = "Tags",
MC_CML_VIEWPORT = "ViewPort",
MC_CML_TOUR = "Tour",
MC_CML_PITCH = "pitch",
MC_CML_HEADING = "heading",
MC_CML_MAPSTYLE = "mapstyle",
MC_CML_SCENEID = "sceneId",
MC_CML_ACTIONS = "Actions",
MC_CML_ACTION = "Action",
MC_CML_MODELREP = "ModelRep",
MC_CML_TRANSFORM = "transform",
MC_CML_MODELREFID = "modelRefId",
MC_CML_ENTITY_TYPE_PUSHPIN = "pushpin",
MC_CML_PROPERTYS = "Properties",
MC_CML_PROPERTY = "Property",
MC_CML_MINBOUNDS = "minbounds",
MC_CML_MAXBOUNDS = "maxbounds",
MC_CML_R2EOFFSET = "r2eoffset",
MC_CML_PHOTOS = "Photos",
MC_CML_PHOTO = "Photo",
MC_CML_PREAUTHURL = "PreAuthUrl",
MC_CML_PUBLISHER = "publisher",
MC_CML_PROPERTY_ROUTABLELATITUDE = "RoutableLatitude",
MC_CML_PROPERTY_ROUTABLELONGITUDE = "RoutableLongitude",
MC_CML_PROPERTY_ICONURL = "iconurl",
MC_CML_PROPERTY_KEYWORDS = "keywords",
MC_CML_PROPERTY_URL = "url",
MC_CML_PROPERTY_PHOTOURL = "photourl",
MC_CML_PROPERTY_USERDATE = "userdate",
MC_CML_PROPERTY_DISPLAYORDER = "displayorder",
MC_CML_PROPERTY_BUSINESSLISTINGID = "businesslistingid",
MC_CML_PROPERTY_MAPSERVICETYPE = "mapserviceType",
MC_CML_PROPERTY_MAPSERVICESOURCE = "mapserviceSource",
MC_CML_PROPERTY_MAPSERVICEOPACITY = "mapserviceOpacity",
MC_CML_PROPERTY_MAPSERVICEMETADATA = "mapserviceMetadata",
MC_CML_PROPERTY_MAPSERVICESTATUS = "mapserviceStatus",
MC_CML_PROPERTY_SOURCEURL = "sourceurl",
MC_CML_PROPERTY_SOURCETYPE = "sourcetype",
MC_CML_TILEID = "tileId",
MC_CML_PROPERTY_TYPE = "type",
MC_CML_LASTMODIFIED = "DateModified",
MC_CML_DATECREATED = "DateCreated",
MC_CML_ROOT = "CML",
MC_CML_SEPERT = "/",
MC_CML_TOKEN = ",",
MC_CML_VERSION = "0.1",
MC_CML_ID = "id",
MC_CML_IID = "clientid",
MC_CML_NAME = "name",
MC_CML_CULTURE = "culture",
MC_CML_SHARELEVEL = "Sharelevel",
MC_CML_STATE = "State",
MC_CML_STATE_PUBLIC_CAN_VIEW = 1,
MC_CML_STATE_OWNER_CAN_VIEW = 2,
MC_CML_STATE_OWNER_CAN_UPDATE = 4,
MC_CML_STATE_OWNER_IS_VIEWING = 8,
MC_CML_TYPE = "Type",
MC_CML_Add = "Add",
MC_CML_EXTRUSION = "Extrusion",
MC_CML_VISIBILITY = "visibility",
MC_CML_DISPLAYORDER = "displayorder",
MC_CML_DEFAULTSTYLE = "DefaultStyle",
MC_CML_LABELSTYLE = "LabelStyle",
MC_CML_POSITION = "Position",
MC_CML_STYLE = "Style",
MC_CML_FILLSYMBOL = "Fill",
MC_CML_SHAPESYMBOL = "Shape",
MC_CML_STYLESYMBOL = "Style",
MC_CML_STROKESYMBOL = "Stroke",
MC_CML_SHADOWSYMBOL = "Shadow",
MC_CML_IMAGEDATASYMBOL = "Imagedata",
MC_CML_ZOOMLEVEL = "zoomlevel",
MC_CML_ONSCRATCHPAD = "onScratchpad",
MC_CML_TOKEN1 = ",",
MC_CML_TOKEN2 = ":",
MC_CML_TOKEN3 = ";",
MC_CML_CONTENTS = "Contents",
MC_CML_CONTENT = "Content",
MC_CML_SIMPLEHTML = "SimpleHTML",
MC_CML_GLINK = "glink",
MC_CML_COLLECTIONS = "Collections",
MC_CML_COLLECTION = "Collection",
MC_CML_ENTITY = "Entity",
MC_CML_MULTIGEOMETRY = "MultiGeometry",
MC_CML_POLYGON = "Polygon",
MC_CML_OUTLS = "outerBoundaryIs",
MC_CML_ITLS = "interBoundaryIs",
MC_CML_LINEARSTRING = "LinearRing",
MC_CML_POLYLINE = "LineString",
MC_CML_LENGTH = "length",
MC_CML_AREA = "area",
MC_CML_HREF = "href",
MC_CML_POINT = "Point",
MC_CML_COORDS = "coordinates",
MC_CML_ALTITUDE = "altitudes",
MC_CML_ALTITUDEMODE = "altitudemode",
MC_CML_ALTGROUND = "Ground",
MC_CML_ALTDATUM = "Datum",
MC_CML_EXTRUDE = "extruded",
MC_CML_KEY = "key",
MC_CML_VALUE = "value",
MC_CML_CLIENTDATA = "ClientData",
MC_CML_EXCOL_PREFIX = "E*",
MC_CML_IMPORT_DATAURL = "mapurl",
MC_CML_IMPORT_SAVESTATUS = "saveimport",
MC_CML_IMPORT_COLNAME = "colname",
MC_CML_IMPORT_REPORT = "importreport",
MC_CML_IMPORT_FILEUPLOAD = "fileupload",
MC_CML_CID_LIST = "cids",
MC_ACTION_IMPORT_COLLECTION = "ImportCol",
MC_ACTION_IMPORT_ENTITY = "ImportEntity",
MC_ACTION_CLONE_ENTITY = "CloneEntity",
MC_ACTION_CREATE_COLLECTION = "CreateCollection",
MC_ACTION_UPDATE_COLLECTION = "UpdateCollection",
MC_ACTION_DELETE_COLLECTION = "DeleteCollection",
MC_ACTION_CLEAR_COLLECTION = "ClearCollection",
MC_ACTION_RETRIEVE_ALLCOLLECTIONS = "RetrieveAllCollections",
MC_ACTION_RETRIEVE_ALLCOLLECTIONS_METADATA = "RetrieveAllCollectionsMetadata",
MC_ACTION_RETRIEVE_COLLECTION = "RetrieveCollection",
MC_ACTION_RETRIEVE_SHAREDCOLLECTION = "RetrieveSharedCollection",
MC_ACTION_DELETE_ENTITY = "DeleteEntity",
MC_ACTION_ADD_ENTITY = "AddEntity",
MC_FCCALLBACK = "fncallback",
MC_ACTION_REPAINT = "Repaint",
MC_ACTION_CREATE_PHOTO = "CreatePhoto",
MC_ACTION_DELETE_PHOTO = "DeletePhoto",
MC_CHANGE_STATE_UPDATE = 1,
MC_CHANGE_STATE_DELETE = 2,
MC_CHANGE_STATE_CREATE = 3,
MC_CHANGE_STATE_CLONE = 4,
MC_CHANGE_STATE_MOVE = 5,
MC_CHANGE_STATE_DEFAULT = 0,
MC_CHANGE_TYPE_METADATA = 1,
MC_CHANGE_TYPE_CHILDREN = 2,
MC_CHANGE_TYPE_ALL = 3,
MC_MAPSERVICE_STATUS_NONE = 0,
MC_MAPSERVICE_STATUS_ERROR = 1,
MC_MAPSERVICE_STATUS_READY = 2,
MC_MAPSERVICE_STATUS_FETCH = 3,
MC_MAPSERVICE_ARG_SERVICETYPE = "svc",
MC_MAPSERVICE_ARG_COLLECTIONID = "cid",
MC_MAPSERVICE_ARG_ENTITYID = "eid",
MC_COLLECTION_SIGNIN_SIZE = 2048,
MC_MAXSHAPEPOINTS_IN_EMAIL = 200,
MC_MAX_EMAIL_LINK_LEN = 1800,
MC_MIN_EMAIL_NOTES_LEN = 100,
MC_MAX_DRILL_SIZE = 200,
MC_TIMER_KEEPTRYING = "keeptrying",
MC_TIMER_MINDELAY = 0,
MC_TIMER_DELAY = 3000,
MC_TIMER_REPEAT_DELAY = 3000,
MC_TIMER_NOW = 10,
MC_TIMER_EXTENDDELAY = 5000,
MC_TIMER_EXTENDDELAY_CN = 100000,
MC_REQUEST_QUEUE_MAXSIZE = 20,
MC_TIMER_VALUE = "DELAYVALUE",
MC_UPLOAD_TIMEOUT = 90000,
MC_KVP_COLLIST = "COLLIST",
MC_KVP_COL_MSNID = "COL_MSNID",
MC_KVP_COL_MSNID2 = "COL_MSNID2",
MC_KVP_COL = "COL",
MC_KVP_COL_CLIENTDATA = "COL_CLIENTDATA",
MC_KVP_ENTITY_MSNID = "ENTITY_MSNID",
MC_KVP_ENTITYLIST = "ENTITYLIST",
MC_KVP_ENTITY = "ENTITY",
MC_KVP_SERVER_STATUS = "req_status",
MC_KVP_SETBESTMAPVIEW = "set_best_view",
MC_KVP_VIEWTOUR = "view_tour",
MC_KVP_CML = "CML",
MC_COLLECTIONLIST_UL_ID = "sp_collection_list",
MC_SCRATCHPADITEM_LI_SUFFIX = "_li",
MC_SCRATCHPADITEM_MEASURE_SUFFIX = "_m",
MC_SIGNIN = "Signin",
MC_SCRATCHPAD_DRAGCURSOR = "move",
MC_SCRATCHPAD_DRAGGEDSTYLE = "DraggedLI",
MC_SCRATCHPAD_COLLECTIONLISTDIV_ID = "scratchPadCollectionListWrapper",
MC_SCRATCHPAD_WRAPLEN_TITLE = 22,
MC_SCRATCHPAD_WRAPLEN_DESC = 26,
MC_CV_WRAPLEN_COLLECTIONDESC = 28,
MC_CV_WRAPLEN_TITLE = 22,
MC_CV_WRAPLEN_DESC = 22,
MC_ERO_WRAPLEN_TITLE = 22,
MC_ERO_WRAPLEN_DESC = 28,
MC_SERVER_STATUS_NO_ACCESS = "not authorized",
MC_SERVER_STATUS_BUSY = "server busy",
MC_SERVER_STATUS_OK = "200",
MC_SERVER_STATUS_STORE_ERROR = "570",
MC_SERVER_STATUS_NAMEEXIST_ERROR = "571",
MC_SERVER_STATUS_QUOTA_ERROR = "572",
MC_SERVER_STATUS_UNEXPECTED_ERROR = "500",
MC_SERVER_STATUS_ACCESSDENIED_ERROR = "403",
MC_SERVER_STATUS_CONTAINSSENSITIVEWORDS_ERROR = "581",
MC_COL_TYPE_FAVORITE = 1,
MC_COL_TYPE_COLLECTION = 0,
MC_COL_TYPE_RESULT = 2,
MC_COL_TYPE_TRAFFIC = 3,
MC_COL_TYPE_DRIVING = 4,
MC_COL_TYPE_RSSFEED = 5,
MC_COL_TYPE_TILEIMAGE = 6,
MC_DS_MSN_CML = 0,
MC_DS_FILE_CML = 1,
MC_DS_MSN_VEML = 2,
MC_MAX_LOADED_COLS = 2,
MC_MAX_COL_SIZE = 200,
cssCursors, MC_SA_NEWCOL = "newcol",
MC_SA_IMPORT = "import",
MC_SA_UPLOADPHOTO = "uploadphoto",
MC_SA_REFRESH = "forcedrefresh";
function VE_MapStruct() {}
VE_MapStruct.PushpinType = {
ViewerClass: "VE_Community_searchResult",
PushpinClass: "VE_Pushpin",
Token: " ",
PushpinAn: "VE_Pushpin VE_Pushpin_aN",
Polyline: "VE_Pushpin VE_Pushpin_Polyline",
Polygon: "VE_Pushpin VE_Pushpin_Polygon",
Model: "VE_Pushpin VE_Pushpin_Model_viewer",
Overlay: "VE_Pushpin VE_Pushpin_Overlay",
PushpinViewer: "VE_Pushpin_viewer",
PolylineViewer: "VE_Pushpin_Polyline_viewer",
PolygonViewer: "VE_Pushpin_Polygon_viewer",
ModelViewer: "VE_Pushpin_Model_viewer",
OverlayViewer: "VE_Pushpin_Overlay_viewer",
PushpinViewerTopMost: "VE_Pushpin_viewer topMost",
PolylineViewerTopMost: "VE_Pushpin_Polyline_viewer polytopMost",
PolygonViewerTopMost: "VE_Pushpin_Polyline_viewer polytopMost",
ModelViewerTopMost: "VE_Pushpin_Model_viewer polytopMost",
OverlayViewerTopMost: "VE_Pushpin_Overlay_viewer polytopMost",
SearchResults: "searchResults"
};
VE_MapStruct.PushpinSize = {
WidthaN: 22,
HeightaN: 17,
WidthShp: 22,
HeightShp: -17,
WidthLbl: -29,
HeightLbl: -17,
WidthView: 22,
HeightView: 17,
WidthShpView: 22,
HeightShpView: -17
};
_VERegisterNamespaces("Msn.VE.Core");
Msn.VE.Core.Layer = function () {
this.iid = null;
this.MsnId = null;
this.Name = "unsaved collection";
this.Type = 0;
this.Visibility = true;
this.Boundingbox = null;
this.MaxScale = 21;
this.MinScale = 1;
this.Spec = null
};
Msn.VE.Core.Layer.prototype.SetMsnId = function (a) {
this.MsnId = a
};
Msn.VE.Core.Layer.prototype.GetMsnId = function () {
return this.MsnId
};
Msn.VE.Core.Layer.prototype.SetId = function (a) {
this.iid = a
};
Msn.VE.Core.Layer.prototype.GetId = function () {
return this.iid
};
Msn.VE.Core.Layer.prototype.SetName = function (a) {
this.Name = a
};
Msn.VE.Core.Layer.prototype.GetName = function () {
return this.Name
};
Msn.VE.Core.Layer.prototype.SetType = function (a) {
this.Type = a
};
Msn.VE.Core.Layer.prototype.GetType = function () {
return this.Type
};
Msn.VE.Core.Layer.prototype.SetVisibility = function (a) {
this.Visibility = a
};
Msn.VE.Core.Layer.prototype.GetVisibility = function () {
return this.Visibility
};
Msn.VE.Core.Layer.prototype.SetMaxZoomLevel = function (a) {
this.MaxScale = a
};
Msn.VE.Core.Layer.prototype.GetMaxZoomLevel = function () {
return this.MaxScale
};
Msn.VE.Core.Layer.prototype.SetMinZoomLevel = function (a) {
this.MinScale = a
};
Msn.VE.Core.Layer.prototype.GetMinZoomLevel = function () {
return this.MinScale
};
Msn.VE.Core.Layer.prototype.SetBoundingBox = function (f, e, c, d, a, b) {
if (!this.Boundingbox) {
if (c == null || d == null || a == null || b == null) return null;
this.Boundingbox = new Msn.VE.Bounds(f, e, c, d, a, b)
} else {
this.Boundingbox.x1 = c;
this.Boundingbox.y1 = d;
this.Boundingbox.z1 = f;
this.Boundingbox.x2 = a;
this.Boundingbox.y2 = b;
this.Boundingbox.z2 = e
}
return this.Boundingbox
};
Msn.VE.Core.Layer.prototype.GetBoundingBox = function () {
if (typeof this.Boundingbox == "undefined" || !this.Boundingbox) this.Boundingbox = new Msn.VE.Bounds(0, 0, Infinity, Infinity, -Infinity, -Infinity);
return this.Boundingbox
};
Msn.VE.Core.VectorLayer = function () {};
Msn.VE.Core.VectorLayer.prototype = new Msn.VE.Core.Layer;
Msn.VE.Core.RasterLayer = function () {};
Msn.VE.Core.RasterLayer.prototype = new Msn.VE.Core.Layer;
function VELatLong(b, a, c, d) {
this.Latitude = null;
this.Longitude = null;
this.Altitude = null;
this.AltitudeMode = null;
this._reserved = null;
if (b != null) {
VEValidator.ValidateFloat(b, "latitude");
this.Latitude = b
}
if (a != null) {
VEValidator.ValidateFloat(a, "longitude");
this.Longitude = a
}
if (c != null) this.SetAltitude(c, d)
}
VELatLong.prototype.SetAltitude = function (b, a) {
VEValidator.ValidateFloat(b, "altitude");
this.Altitude = b;
if (a != null) {
VEValidator.ValidateAltitudeMode(a, "altitudeMode");
this.AltitudeMode = a
} else this.AltitudeMode = VEAltitudeMode.Default
};
VELatLong.prototype.HasAltitude = function () {
return this.Altitude != null
};
function Clone() {
var a = new VELatLong;
a.Latitude = this.Latitude;
a.Longitude = this.Longitude;
a._reserved = this._reserved;
a.Altitude = this.Altitude;
a.AltitudeMode = this.AltitudeMode;
return a
}
function toString() {
var a = "";
if (this.Latitude != null && this.Longitude != null) a = this.Latitude + ", " + this.Longitude;
if (this.Altitude != null) a += ", " + this.Altitude;
return a
}
VELatLong.prototype.toString = toString;
VELatLong.prototype.Clone = Clone;
function VELatLongRectangle(d, c, b, a) {
VEValidator.ValidateObject(d, "topLeftLatLong", VELatLong, "VELatLong");
VEValidator.ValidateObject(c, "bottomRightLatLong", VELatLong, "VELatLong");
this.TopLeftLatLong = d;
this.BottomRightLatLong = c;
if (b != null && b != "undefined") {
VEValidator.ValidateObject(b, "topRightLatLong", VELatLong, "VELatLong");
this.TopRightLatLong = b
}
if (a != null && a != "undefined") {
VEValidator.ValidateObject(a, "bottomLeftLatLong", VELatLong, "VELatLong");
this.BottomLeftLatLong = a
}
}
VEAltitudeMode = new function () {
this.Default = "Ground";
this.Absolute = "Datum";
this.RelativeToGround = "Ground"
};
function VEValidator() {}
VEValidator.ValidateFloat = function (b, c) {
var a = "";
if (arguments != null && arguments.caller != null) a = VEValidator.GetCaller(arguments.caller);
if (a == "") a = "VEValidator.ValidateFloat";
if (b == null || b == "undefined") throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "float"));
try {
if (isNaN(parseFloat(b))) throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "float"));
return true
} catch (d) {
throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "float"))
}
};
VEValidator.ValidateInt = function (b, c) {
var a = "";
if (arguments != null && arguments.caller != null) a = VEValidator.GetCaller(arguments.caller);
if (a == "") a = "VEValidator.ValidateInt";
if (b == null || b == "undefined") throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "int"));
try {
if (isNaN(parseInt(b)) || parseFloat(b) != parseInt(b)) throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "int"));
return true
} catch (d) {
throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "int"))
}
};
VEValidator.ValidateNonNegativeInt = function (a, c) {
var b = "";
if (arguments != null && arguments.caller != null) b = VEValidator.GetCaller(arguments.caller);
if (b == "") b = "VEValidator.ValidateNonNegativeInt";
try {
if (a == null || a == "undefined") throw new VEException(b, "err_invalidargument", L_invalidnonnegativeint_text.replace("%1", c));
} catch (d) {
//throw new VEException(b, "err_invalidargument", L_invalidnonnegativeint_text.replace("%1", c));
}
try {
if (isNaN(parseInt(a)) || parseFloat(a) != parseInt(a) || parseInt(a) < 0) throw new VEException(b, "err_invalidargument", L_invalidnonnegativeint_text.replace("%1", c));
return true
} catch (d) {
//throw new VEException(b, "err_invalidargument", L_invalidnonnegativeint_text.replace("%1", c))
}
};
VEValidator.ValidateFunction = function (b, c) {
var a = "";
if (arguments != null && arguments.caller != null) a = VEValidator.GetCaller(arguments.caller);
if (a == "") a = "VEValidator.ValidateFunction";
if (b == null || typeof b != "function") throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "function"))
};
VEValidator.ValidateNonNull = function (b, c) {
var a = "";
if (arguments != null && arguments.caller != null) a = VEValidator.GetCaller(arguments.caller);
if (a == "") a = "VEValidator.ValidateNonNull";
if (b == null || b == "undefined") throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "non null"))
};
VEValidator.ValidateBetween = function (b, e, d, c) {
var a = "";
if (arguments != null && arguments.caller != null) a = VEValidator.GetCaller(arguments.caller);
if (a == "") a = "VEValidator.ValidateBetween";
if (b < d || b > c) throw new VEException(a, "err_invalidargument", L_invalidbetweenint_text.replace("%1", e).replace("%2", d).replace("%3", c))
};
VEValidator.ValidateBoolean = function (b, c) {
var a = "";
if (arguments != null && arguments.caller != null) a = VEValidator.GetCaller(arguments.caller);
if (a == "") a = "VEValidator.ValidateBoolean";
if (b != true && b != false) throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "bool"))
};
VEValidator.ValidateMapStyle = function (a, c) {
var b = "";
if (arguments != null && arguments.caller != null) b = VEValidator.GetCaller(arguments.caller);
if (b == "") b = "VEValidator.ValidateMapStyle";
if (a == null || a == "undefined") throw new VEException(b, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "MapStyle"));
if (a == "r" || a == "R" || $MVEM.IsEnabled(MapControl.Features.MapStyle.Shaded) && (a == "s" || a == "S") || $MVEM.IsEnabled(MapControl.Features.MapStyle.Aerial) && (a == "a" || a == "A") || $MVEM.IsEnabled(MapControl.Features.MapStyle.BirdsEye) && (a == "o" || a == "O") || $MVEM.IsEnabled(MapControl.Features.MapStyle.BirdsEye) && (a == "b" || a == "B") || $MVEM.IsEnabled(MapControl.Features.MapStyle.Hybrid) && (a == "h" || a == "H")) return true;
throw new VEException(b, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "MapStyle"))
};
VEValidator.ValidateClusteringType = function (a, c) {
var b = "";
if (arguments != null && arguments.caller != null) b = VEValidator.GetCaller(arguments.caller);
if (b == "") b = "VEValidator.ValidateClusteringType";
if (a == null || a == "undefined") throw new VEException(b, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "ClusteringType"));
if (typeof a == "number" && (a == VEClusteringType.None || a == VEClusteringType.Grid)) return true;
throw new VEException(b, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "ClusteringType"))
};
VEValidator.ValidateMapMode = function (b, c) {
var a = "";
if (arguments != null && arguments.caller != null) a = VEValidator.GetCaller(arguments.caller);
if (a = "") a = "VEValidator.ValidateMapMode";
if (b == null || b == "undefined") throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "MapMode"));
if (b == VEMapMode.Mode2D || $MVEM.IsEnabled(MapControl.Features.MapStyle.View3D) && b == VEMapMode.Mode3D) return true;
throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "MapMode"))
};
VEValidator.ValidateDistanceUnit = function (b, c) {
var a = "";
if (arguments != null && arguments.caller != null) a = VEValidator.GetCaller(arguments.caller);
if (a == "") a = "VEValidator.ValidateDistanceUnit";
if (b == null || b == "undefined") throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "VEDistanceUnit"));
if (b == VEDistanceUnit.Miles || b == VEDistanceUnit.Kilometers) return true;
throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "VEDistanceUnit"))
};
VEValidator.ValidateMaxZoom = function (b, c) {
var a = "";
if (arguments != null && arguments.caller != null) a = VEValidator.GetCaller(arguments.caller);
if (a == "") a = "VEValidator.ValidateMaxZoom";
if (b == null || b == "undefined") throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "ValidateMaxZoom"));
if (b <= Msn.VE.API.Globals.vemaxzoom) return true;
throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "ValidateMaxZoom"))
};
VEValidator.ValidateLayerType = function (a, c) {
var b = "";
if (arguments != null && arguments.caller != null) b = VEValidator.GetCaller(arguments.caller);
if (b == "") b = "VEValidator.ValidateLayerType";
if (a == null || a == "undefined") throw new VEException(b, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "VEDataType"));
if (a == VEDataType.GeoRSS || a == VEDataType.VECollection || a == VEDataType.VETileSource) return true;
throw new VEException(b, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "VEDataType"))
};
VEValidator.ValidateDashboardSize = function (a, c) {
var b = "";
if (arguments != null && arguments.caller != null) b = VEValidator.GetCaller(arguments.caller);
if (b == "") b = "VEValidator.ValidateDashboardSize";
if (a == null || a == "undefined") throw new VEException(b, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "VEDashboardSize"));
if (a == VEDashboardSize.Normal || a == VEDashboardSize.Small || a == VEDashboardSize.Tiny) return true;
throw new VEException(b, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "VEDashboardSize"))
};
VEValidator.ValidateMiniMapSize = function (b, c) {
var a = "";
if (arguments != null && arguments.caller != null) a = VEValidator.GetCaller(arguments.caller);
if (a == "") a = "VEValidator.ValidateMiniMapSize";
if (b == null || b == "undefined") throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "VEMiniMapSize"));
if (b == VEMiniMapSize.Small || b == VEMiniMapSize.Large) return true;
throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "VEMiniMapSize"))
};
VEValidator.ValidateAltitudeMode = function (b, c) {
var a = "";
if (arguments != null && arguments.caller != null) a = VEValidator.GetCaller(arguments.caller);
if (a == "") a = "VEValidator.ValidateAltitudeMode";
if (b == null) throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "VEAltitudeMode"));
if (b != VEAltitudeMode.Absolute && b != VEAltitudeMode.RelativeToGround) throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "VEAltitudeMode"));
return true
};
VEValidator.ValidateObject = function (b, c, e, d) {
var a = "";
if (arguments != null && arguments.caller != null) a = VEValidator.GetCaller(arguments.caller);
if (a == "") a = "VEValidator.ValidateObject";
if (b == null || b == "undefined") throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "non null"));
if (!(b instanceof e)) throw new VEException(a, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", d))
};
VEValidator.ValidateObjectArray = function (a, d, f, e) {
var b = "";
if (arguments != null && arguments.caller != null) b = VEValidator.GetCaller(arguments.caller);
if (b == "") b = "VEValidator.ValidateObject";
if (a == null || typeof a == "undefined" || a.length == null || typeof a.length == "undefined") throw new VEException(b, "err_invalidargument", L_invalidargument_text.replace("%1", d).replace("%2", "array"));
for (var c = 0; c < a.length; ++c) if (a[c] == null || typeof a[c] == "undefined" || !(a[c] instanceof f)) throw new VEException(b, "err_invalidargument", L_invalidargument_text.replace("%1", d).replace("%2", e))
};
VEValidator.ValidateOrientation = function (a, c) {
var b = "";
if (arguments != null && arguments.caller != null) b = VEValidator.GetCaller(arguments.caller);
if (b == "") b = "VEValidator.ValidateOrientation";
if (a == null || a == "undefined") throw new VEException(b, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "VEOrientation"));
if (a != VEOrientation.North && a != VEOrientation.East && a != VEOrientation.West && a != VEOrientation.South) throw new VEException(b, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "VEOrientation"))
};
VEValidator.ValidateCacheMode = function (a, b) {
var c = "VEValidator.ValidateCacheMode";
if (a == null || a == "undefined") throw new VEException(c, "err_invalidargument", L_invalidargument_text.replace("%1", b).replace("%2", "VECacheMode"));
if (a != VECacheMode.Auto && a != VECacheMode.EnableTileCaching) throw new VEException(c, "err_invalidargument", L_invalidargument_text.replace("%1", b).replace("%2", "VECacheMode"))
};
VEValidator.ValidateBounds = function (a, c) {
var b = "";
if (arguments != null && arguments.caller != null) b = VEValidator.GetCaller(arguments.caller);
if (b == "") b = "VEValidator.ValidateBounds";
if (a == null || a == "undefined") throw new VEException(b, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "VELatLongRectangle"));
if (a.TopLeftLatLong == null || a.BottomRightLatLong == null || a.TopLeftLatLong.Latitude <= a.BottomRightLatLong.Latitude || a.TopLeftLatLong.Longitude >= a.BottomRightLatLong.Longitude) throw new VEException(b, "err_invalidargument", L_invalidargument_text.replace("%1", c).replace("%2", "VELatLongRectangle"))
};
VEValidator.GetCaller = function () {
return ""
};
Msn.VE.Core.MapServiceLayerManager = function () {
var a = [],
v = 200,
b = null;
MapOverlayNode = function (b, a) {
this.item = b;
this.layers = a
};
function f(d) {
if (!d.IsOverlay()) return -1;
var e = a.length;
for (var c = 0; c < e; c++) {
var b = a[c];
if (b != null && b.item != null && (b.item == d || b.item.iid == d.iid)) return c
}
return -1
}
function g(c) {
var b = f(c);
return b != -1 ? a[b] : null
}
function q(a) {
if (a == null || a.Annotations == null) return;
if (b != null && a.MsnId != b) d();
b = a.MsnId;
var f = a.Annotations.length;
for (var c = 0; c < f; c++) e(a.Annotations[c])
}
function p(a) {
if (a == null || a.Annotations == null) return;
if (b != null && a.MsnId == b) d();
else {
var e = a.Annotations.length;
for (var c = 0; c < e; c++) j(a.Annotations[c])
}
b = null
}
function e(b) {
if (b == null || !b.IsOverlay()) return null;
var c = m(b);
if (c != null) a.push(c);
return c
}
function j(e) {
var b = f(e);
if (b == -1) return;
var d = a[b];
if (d == null) return;
a.splice(b, 1);
c(d)
}
function c(c) {
if (c == null || c.layers == null) return;
var b = [],
e = c.layers.length - 1;
for (var a = e; a >= 0; a--) {
var d = c.layers[a];
if (d == null) continue;
b.push(d.ID)
}
if (map.IsModeEnabled(Msn.VE.MapActionMode.Mode3D)) r(b);
var e = b.length;
for (var a = 0; a < e; a++) {
map.ClearTileLayer(b[a]);
map.DeleteTileSource(b[a], true)
}
}
function d() {
for (var b = a.length; b >= 0; b--) {
var d = a[b];
a.splice(b, 1);
c(d)
}
}
function o(a, d, b) {
if (!a.IsOverlay()) return;
var c = g(a);
return i(c, d, b)
}
function i(c, h, i) {
if (c == null || c.layers == null || c.layers.length == 0) return;
var a = [],
m = c.layers.length;
for (var g = 0; g < m; g++) {
var d = c.layers[g];
if (d == null || d.Bounds == null) continue;
var k = d.Bounds.length;
for (var f = 0; f < k; f++) {
var b = d.Bounds[f];
if (b == null) continue;
a.push(new Msn.VE.LatLong(b.TopLeftLatLong.Latitude, b.TopLeftLatLong.Longitude));
a.push(new Msn.VE.LatLong(b.BottomRightLatLong.Latitude, b.BottomRightLatLong.Longitude));
a.push(new Msn.VE.LatLong(b.TopRightLatLong.Latitude, b.TopRightLatLong.Longitude));
a.push(new Msn.VE.LatLong(b.BottomLeftLatLong.Latitude, b.BottomLeftLatLong.Longitude));
break
}
break
}
if (a.length < 4) return;
var e = VE_MapManager.GetSelectedCollection();
if (typeof e != "undefined" && e != null && e.GetMsnId() == h.MsnId) map.SetBestMapView(a);
if (!i) return;
var j = new Msn.VE.LatLong((a[0].latitude + a[3].latitude) / 2, (a[0].longitude + a[2].longitude) / 2);
if (l(c.item, j)) t(c.item, h)
}
function l(d, c) {
var b = d.GetPrimitive(0);
if (!b || !b.points || b.points.length < 2) return false;
var e = b.iid;
if (!e) return false;
var g = c.longitude - b.points[0],
f = c.latitude - b.points[1];
d.MovePrimitive(g, f);
var a = scratchPad.getItems().retrieveByKey(e);
if (a) scratchPad.updateItem(a, a.getTitle(), a.getDescription(), c.latitude, c.longitude, a.getInfoUrl(), a.getPhotoUrl(), a.getKeywords(), a.getMapserviceType(), a.getMapserviceSource(), a.getMapserviceOpacity());
return true
}
function t(a, b) {
if (a.mapserviceStatus == MC_MAPSERVICE_STATUS_FETCH) a.mapserviceStatus = MC_MAPSERVICE_STATUS_NONE;
a.SetChangeState(MC_CHANGE_STATE_UPDATE);
a.SetChangeType(MC_CHANGE_TYPE_ALL);
b.UpdateEntityAnnotation(a);
mvcViewFacade.OnEntityRepaint(a);
VE_MapViewPreUpdate.HandleEntity(b, a)
}
function x() {
return v
}
function w() {
return a.length
}
function m(e) {
if (!e.IsOverlay()) return null;
var W = map.IsModeEnabled(Msn.VE.MapActionMode.Mode3D),
w = 32,
z = e.mapserviceMetadata.split("]");
if (!z || z.length <= 1) return null;
var l = [],
v = [],
u = [],
S = z.length;
for (var q = 0; q < S; q++) {
var m = z[q];
if (!m || m.length <= 1 || m.charAt(0) != "[") continue;
m = m.substring(1, m.length);
var B = m.split("&");
if (!B) continue;
var G = B.length;
for (var f = 0; f < G; f++) {
var I = B[f];
if (!I) continue;
var t = I.split("=", 2);
if (!t || t.length != 2) continue;
var H = t[0].trim().toLowerCase(),
y = t[1];
y = s(y);
if (q == 0) l[H] = y;
else {
if (f == 0) v.push([]);
var R = v[q - 1];
R[H] = y
}
}
}
var Q = l["type"];
if (Q != "VE") return null;
var U = l["referencename"],
V = l["displayname"],
n = l["tilesource"];
if (n == null || n == "" || typeof n == "undefined") return null;
n = n.replace(/%20/g, " ");
var i = l["minzoom"];
i = i == null || typeof i == "undefined" || i == "" ? 1 : parseInt(i);
if (i < 1 || i > w) i = 1;
var d = l["maxzoom"];
d = d == null || typeof d == "undefined" || d == "" ? w : parseInt(d);
if (d < 1 || d > w || d < D) d = w;
var k = parseFloat(e.mapserviceOpacity);
if (isNaN(k) || k < 0 || k > 100) k = .6;
if (k > 1) k /= 100;
var j = g(e),
J = "{VE_MapServiceLayer:" + e.mapserviceType + ":" + e.iid + "}",
T = v.length;
for (var A = 0; A < T; A++) {
var x = v[A],
r = x["bbox"];
if (r == null || typeof r == "undefined") continue;
var b = r.split(",", 4);
if (b == null || typeof r == "undefined" || b.length != 4) continue;
var O = new VELatLong(parseFloat(b[3]), parseFloat(b[0])),
N = new VELatLong(parseFloat(b[1]), parseFloat(b[2])),
P = new VELatLong(parseFloat(b[3]), parseFloat(b[2])),
M = new VELatLong(parseFloat(b[1]), parseFloat(b[0])),
K = new VELatLongRectangle(O, N, P, M),
E = [];
E.push(K);
var D = x["minzoom"],
L = x["maxzoom"],
p = x["displayname"];
if (p == null || typeof p == "undefined" || p == "") p = "{" + e.mapserviceType + ":" + e.iid + ":" + A.toString() + "}";
var C = J + ":" + p,
a = null;
if (j != null) {
var G = j.layers.length;
for (var f = 0; f < G; f++) if (j.layers[f].ID == C) {
a = j.layers[f];
j.layers.splice(f, 1);
break
}
}
if (a == null) {
a = new VETileSourceSpecification;
a.ID = C
}
if (a == null) continue;
u.push(a);
a.NumServers = 1;
a.TileSource = n;
a.Opacity = k;
a.MinZoomLevel = D;
a.MaxZoomLevel = L;
a.Bounds = E
}
var F = u.length;
for (var o = 0; o < F; o++) {
var a = u[o];
map.SetTileSource(a);
map.LoadTileLayer(a.ID, a.ID, a.Opacity, 2)
}
h();
if (j != null) {
var F = j.layers.length;
for (var o = 0; o < F; o++) c(j.layers[o])
}
return new MapOverlayNode(e, u)
}
function h() {
var a = map.Get3DControl();
if (typeof a != "undefined" && a != null) map.AddMapServiceLayersTo3D(a)
}
function r(b) {
if (!b || b.length == 0) return;
var a = map.Get3DControl();
if (typeof a != "undefined" && a != null) map.DeleteMapServiceLayersFrom3D(a, b)
}
function n(a, f, d) {
if (!a || !a.Annotations) return;
var e = a.Annotations.length;
for (var c = 0; c < e; c++) {
var b = a.Annotations[c];
if (b && b.Id == f) {
k(b, d);
break
}
}
}
function k(a, d) {
var c = false;
if (a && a.IsOverlay()) {
VE_MapCmlReader.ExtractEntityProperties(d, a);
if (a.mapserviceStatus == "OK") a.mapserviceStatus = MC_MAPSERVICE_STATUS_READY;
var b = parseInt(a.mapserviceStatus);
if (isNaN(b)) b = MC_MAPSERVICE_STATUS_ERROR;
switch (b) {
case MC_MAPSERVICE_STATUS_READY:
e(a);
c = true;
break;
case MC_MAPSERVICE_STATUS_ERROR:
ShowMessage(a.Title + ": " + L_MapserviceSourceError_Text)
}
}
return c
}
function u(c, b, a, d) {
if (a && c == MC_ACTION_ADD_ENTITY) {
if (!VE_MapOverlays.UpdateAnnotationOverlay(a, b)) return;
VE_MapOverlays.ActivateEntityOverlayViewport(a, d, true)
}
}
function s(a) {
if (!a) return "";
a = a.replace(/%5B/g, "[");
a = a.replace(/%5D/g, "]");
a = a.replace(/%3D/g, "=");
a = a.replace(/%26/g, "&");
a = a.replace(/%25/g, "%");
return a
}
this.MoveMapserviceLocation = l;
this.ExtractEntityOverlay = u;
this.ActivateEntityOverlays = e;
this.DeactivateEntityOverlays = j;
this.DeactivateNodeOverlays = c;
this.ActivateCollectionOverlays = q;
this.ActivateCollectionOverlays3D = h;
this.DeactivateCollectionOverlays = p;
this.DeactivateActiveOverlays = d;
this.ActivateEntityOverlayViewport = o;
this.ActivateOverlayNodeViewport = i;
this.UpdateAnnotationOverlay = k;
this.UpdateAnnotationOverlayByMsnId = n;
this.ActivateTileSource = m;
this.ActiveOverlayNode = g;
this.ActiveOverlayIndex = f;
this.ActiveOverlayLimit = x;
this.ActiveOverlayCount = w
};
var VE_MapOverlays = new Msn.VE.Core.MapServiceLayerManager;
_VERegisterNamespaces("Msn.VE.Core");
Msn.VE.Core.EventRegistry = function () {
var a = new VE_MapHashtable;
this.AddListener = function (c, b) {
a.put(c, b)
};
this.RemoveListener = function (e, d) {
var b = a.get(e);
if (b == "undefined" || b == null || b.length < 1) return null;
for (var c = 0; c < b.length; c++) if (b[c] == d) b.splice(c, 1)
};
this.Fire = function (e, d) {
if (e == "undefined" || e == null) return;
var b = a.get(e);
if (b == "undefined" || b == null || b.length < 1) return null;
for (var c = 0; c < b.length; c++) {
if (b[c] == "undefined" || b[c] == null) continue;
if (d == "undefined" || d == null) b[c]();
else b[c](d)
}
d = null
}
};
function VE_MapHashtable() {
this.hash = [];
this.keys = []
}
VE_MapHashtable.prototype.hash = null;
VE_MapHashtable.prototype.keys = null;
VE_MapHashtable.prototype.get = function (a) {
return this.hash[a]
};
VE_MapHashtable.prototype.put = function (b, c) {
if (c == null) return null;
var a = null;
a = this.hash[b];
if (a == null || a == "undefined") {
this.keys[this.keys.length] = b;
a = []
}
a.push(c);
this.hash[b] = a
};
_VERegisterNamespaces("Msn.Drawing");
Msn.Drawing.MapGeoRssReader = function () {};
Msn.Drawing.MapGeoRssReader.prototype.ReadGeoRSS = function (z, q) {
var C = false,
r = null,
p = null,
u = null,
m = null,
g = null,
f = null,
c = null,
l = z.getElementsByTagName("item");
if (l.length < 1) l = z.getElementsByTagName("entry");
var k = VEShapeType.Pushpin;
if (l.length > 0) {
var j, o, A, F = l.length;
for (j = 0; j < F; j++) {
g = null;
f = null;
c = null;
k = VEShapeType.Pushpin;
r = "";
p = "";
u = "";
m = "";
A = l[j].childNodes.length;
for (o = 0; o < A; o++) {
if (l[j].childNodes[o].nodeType != 1) continue;
var a = l[j].childNodes[o].nodeName,
b = l[j].childNodes[o];
if (a == "title") if (b.firstChild) r = b.firstChild.nodeValue;
else r = "";
else if (a == "description" || a == "summary" || a == "content") if (b.firstChild) p = b.firstChild.nodeValue;
else p = "";
else if (a == "link") if (b.firstChild) u = b.firstChild.nodeValue;
else u = b.getAttribute("href");
else if (a == "icon") m = b.firstChild.nodeValue;
else if (a == "virtualearth:icon") m = b.firstChild.nodeValue;
else if (a == "geo:lat") g = b.firstChild.nodeValue;
else if (a == "geo:lon") f = b.firstChild.nodeValue;
else if (a == "geo:long") f = b.firstChild.nodeValue;
else if (a == "geo:Point" || a == "geo:point") for (d = 0; d < b.childNodes.length; d++) {
var e = b.childNodes[d];
if (e.nodeName == "geo:lat") g = e.firstChild.nodeValue;
else if (e.nodeName == "geo:lon" || e.nodeName == "geo:long") f = e.firstChild.nodeValue
} else if (a == "georss:point" || a == "georss:line" || a == "georss:polygon") {
if (b.firstChild) {
var n = b.firstChild.nodeValue;
if (n.length == 4096 && typeof b.textContent != "undefined" && b.textContent != null) n = b.textContent;
c = this.ExtractLatLonPairFromXMLList(n);
if (c && c.length > 1) {
g = c[1];
f = c[0];
if (a == "georss:line") k = VEShapeType.Polyline;
else if (a == "georss:polygon") k = VEShapeType.Polygon
}
}
} else if (a == "gml:name") if (b.firstChild) r = b.firstChild.nodeValue;
else r = "";
else if (a == "gml:description") if (b.firstChild) p = b.firstChild.nodeValue;
else p = "";
else if (a == "gml:Point" || a == "gml:point" || a == "georss:where" && b.firstChild.nodeName == "gml:Point") {
var i = null;
if (a == "gml:Point" || a == "gml:point") i = b.childNodes;
else i = b.firstChild.childNodes;
for (d = 0; d < i.length; d++) {
var e = i[d];
if (e.nodeName == "gml:pos") if (e.firstChild) {
var n = e.firstChild.nodeValue;
c = this.ExtractLatLonPairFromXMLList(n);
if (c && c.length > 1) {
g = c[1];
f = c[0]
}
}
}
} else if (a == "gml:pos" || a == "gml:posList") {
if (l[j].childNodes[o].firstChild) {
var n = l[j].childNodes[o].firstChild.nodeValue;
c = this.ExtractLatLonPairFromXMLList(n);
if (c && c.length > 1) {
g = c[1];
f = c[0];
if (a == "gml:posList") k = VEShapeType.Polyline
}
}
} else if (a == "gml:LineString" || a == "georss:where" && b.firstChild.nodeName == "gml:LineString") {
var i = null;
if (a == "gml:LineString") i = b.childNodes;
else i = b.firstChild.childNodes;
k = VEShapeType.Polyline;
var x = i.length;
for (d = 0; d < x; d++) {
var e = i[d];
if (e.nodeName == "gml:posList") if (e.firstChild) {
var n = e.firstChild.nodeValue;
c = this.ExtractLatLonPairFromXMLList(n);
if (c && c.length > 1) {
g = c[1];
f = c[0]
}
}
}
} else if (a == "gml:Polygon" || a == "georss:where" && b.firstChild.nodeName == "gml:Polygon") {
var i = null;
if (a == "gml:Polygon") i = b.childNodes;
else i = b.firstChild.childNodes;
k = VEShapeType.Polygon;
var x = i.length;
for (d = 0; d < x; d++) {
var v = i[d];
if (v.nodeName == "gml:exterior" || v.nodeName == "gml:interior") {
var e = null;
e = v.childNodes;
var E = e.length;
for (var t = 0; t < E; t++) if (e[t].nodeName == "gml:LinearRing" && e[t].firstChild) {
var n = null,
y = e[t].firstChild;
if (y.nodeName == "gml:posList" && y.firstChild) {
n = y.firstChild.nodeValue;
c = this.ExtractLatLonPairFromXMLList(n);
if (c && c.length > 1) {
g = c[1];
f = c[0]
}
}
}
}
}
}
}
if (g == null || g == "undefined" || g.length <= 0 || f == null || f == "undefined" || f.length <= 0) continue;
if (q.Spec.IconUrl != null && q.Spec.IconUrl != "undefined") m = q.Spec.IconUrl;
if (m == null || m == "undefined" || m.length <= 0) m = Msn.VE.API.Constants.iconurl;
var D = p;
try {
var s = null;
if (k == VEShapeType.Pushpin) if (g != null && f != null) s = new Msn.Drawing.Point(f, g);
else continue;
else if (k == VEShapeType.Polyline) {
if (c.length < 4) continue;
s = new Msn.Drawing.PolyLine(c)
} else if (k == VEShapeType.Polygon) {
if (c.length < 8) continue;
s = new Msn.Drawing.Polygon(c)
}
var h;
if (Msn.VE.API != null) {
var w = s.points,
x = w.length,
B = [];
for (var d = 0; d < x - 1; d = d + 2) B.push(new VELatLong(w[d + 1], w[d]));
h = new VEShape(k, B)
} else {
h = new VEShape(MC_VESHAPE_EMPTY);
h.AddPrimitive(s)
}
h.Latitude = g;
h.Longitude = f;
h.Url = u;
h.IconId = m;
h.Notes = D;
h.SetDisplayOrder(j);
h.SetIndex(j);
h.Title = r;
if (Msn.VE.API != null) q.AddShape(h);
else q.AddEntityAnnotation(h)
} catch (H) {
throw new VEException("VEMap:AddGeoRSSLayerPushpins", "err_invalidLatLong", H.message)
}
}
}
if (q.GetShapeCount() > 0) C = true;
return C
};
Msn.Drawing.MapGeoRssReader.prototype.ExtractLatLonPairFromXMLList = function (a) {
a = a.replace(/^\s+/g, "");
a = a.replace(/\s+$/g, "");
var b = [];
if (a.indexOf(",") > 0) b = a.split(",");
else {
a = a.replace(/\s+/g, " ");
b = a.split(" ")
}
var d = b.length;
if (d / 2 != Math.round(d / 2)) return null;
for (var c = 0; c < d - 1; c = c + 2) {
var e = parseFloat(b[c]),
f = parseFloat(b[c + 1]);
if (isNaN(e) || isNaN(f)) throw new VEException("VEMap:ExtractLatLonPairFromXMLList", "err_invalidLatLong", L_GeoRssInvalidFormatError_Text);
b[c] = f;
b[c + 1] = e
}
return b
};
_VERegisterNamespaces("VE_MapCmlReader");
VE_MapCmlReader = function () {};
VE_MapCmlReader.ReadCMLDom = function (c, b, a) {
return VE_MapCmlReader.ExtractCollections(c, b, a)
};
VE_MapCmlReader.ExtractCollections = function (h, r, k) {
var u = null,
b = r.getElementsByTagName(MC_CML_COLLECTION);
if (!b) return null;
var m = b.length;
if (m < 1) return null;
var p = [],
o = h.action;
for (var c = 0; c < m; c++) {
var t = b[c].getAttribute(MC_CML_ID),
s = b[c].getAttribute(MC_CML_IID),
j = unescape(b[c].getAttribute(MC_CML_NAME)),
l = b[c].getAttribute(MC_CML_CULTURE),
q = b[c].getAttribute(MC_CML_VISIBILITY),
i = b[c].getAttribute(MC_CML_TYPE),
a = k.GetCollectionByMsnId(h, t, s);
if (!a) continue;
if (o == MC_ACTION_IMPORT_ENTITY || o == MC_ACTION_CLONE_ENTITY) {
var n = b[c].childNodes.length;
for (var g = 0; g < n; g++) {
var e = b[c].childNodes.item(g);
if (e.nodeName == MC_CML_ENTITY) VE_MapCmlReader.ExtractEntity(h, e, a, k)
}
} else {
if (q != null && q == "false") a.SetVisibility(false);
if (i && i != "" && i != "undefined") a.SetType(i);
if (j && j != "" && j != "undefined") a.SetName(j);
if (l && l != "") a.Culture = l;
var n = b[c].childNodes.length;
for (var g = 0; g < n; g++) {
var e = b[c].childNodes.item(g),
d = GetXMLText(e);
switch (e.nodeName) {
case MC_CML_SHARELEVEL:
if (d == "public") {
a.IsPublic = true;
a.IsIndexed = false
} else if (d == "indexed") {
a.IsPublic = true;
a.IsIndexed = true
} else {
a.IsPublic = false;
a.IsIndexed = false
}
break;
case MC_CML_PROPERTYS:
a._properties = VE_MapCmlReader.ExtractProperties(e);
break;
case MC_CML_DESCRIPTION:
a.Notes = unescape(d);
break;
case MC_CML_TAGS:
a.Tags = unescape(d);
break;
case MC_CML_LASTMODIFIED:
var f = new Date(d);
if (isNaN(f)) a.DateModified = Date();
else a.DateModified = d;
break;
case MC_CML_DATECREATED:
var f = new Date(d);
if (isNaN(f)) a.DateCreated = Date();
else a.DateCreated = d;
break;
case MC_CML_ENTITY:
VE_MapCmlReader.ExtractEntity(h, e, a, k);
break;
case MC_CML_STATE:
var f = parseInt(d);
if ((f & MC_CML_STATE_OWNER_CAN_VIEW) == MC_CML_STATE_OWNER_CAN_VIEW && (f & MC_CML_STATE_PUBLIC_CAN_VIEW) != MC_CML_STATE_PUBLIC_CAN_VIEW) a.ViewableByOwnerOnly = true;
else a.ViewableByOwnerOnly = false;
if ((f & MC_CML_STATE_OWNER_CAN_UPDATE) == MC_CML_STATE_OWNER_CAN_UPDATE) a.EditableByOwner = true;
else a.EditableByOwner = false;
if ((f & MC_CML_STATE_OWNER_IS_VIEWING) == MC_CML_STATE_OWNER_IS_VIEWING) a.OwnerIsViewing = true;
else a.OwnerIsViewing = false
}
}
}
p.push(a)
}
return p
};
VE_MapCmlReader.ExtractEntity = function (p, j, c, o) {
var d = j,
m = d.getAttribute(MC_CML_ID),
r = d.getAttribute(MC_CML_IID),
l = d.getAttribute(MC_CML_TYPE),
k = unescape(d.getAttribute(MC_CML_NAME)),
s = d.getAttribute(MC_CML_VISIBILITY),
g = p.action;
if (g == MC_ACTION_ADD_ENTITY) {
var f = p.GetParameters(MC_KVP_ENTITYLIST);
if (typeof f == "undefined" || f == null) return;
for (var i = 0; i < f.length; i++) {
var e = f[i];
if (typeof e == "undefined" || e == null) continue;
if (e.GetId() == r) {
e.SetMsnId(m);
f.splice(i, 1);
if (e.IsOverlay() && j.childNodes.length > 0) VE_MapOverlays.ExtractEntityOverlay(g, j.childNodes[0], e, c);
break
}
}
return
}
var h;
if (g == MC_ACTION_CREATE_COLLECTION || g == MC_ACTION_IMPORT_ENTITY || g == MC_ACTION_IMPORT_COLLECTION) h = o.GetAnnotationByMsnId(c, m, r);
else h = o.GetAnnotationByMsnId(c, m);
var a = h[1];
if (h[0]) return;
if (l && l != "") a.SetType(l);
if (k && k != "") a.Title = k;
if (s && s != "") a.SetVisibility(false);
var b = null,
v = null,
u = d.childNodes.length;
for (var n = 0; n < u; n++) {
b = d.childNodes[n];
if (b.nodeType == 1) {
var t = b.nodeName;
switch (t) {
case MC_CML_PROPERTYS:
VE_MapCmlReader.ExtractEntityProperties(b, a);
break;
case MC_CML_DESCRIPTION:
a.Notes = unescape(GetXMLText(b));
if (typeof Msn.VE.API == "undefined" || Msn.VE.API == null) a.Notes = a.Notes.replace(/ /gi, "\n");
break;
case MC_CML_ENTITY_PRIMITIVES:
var q = VE_MapCmlReader.ExtractPrimitives(b);
if (q) {
a.ClearAllPrimitives();
a.SetPrimitives(q)
}
break;
case MC_CML_VIEWPORT:
a.ViewPort = VE_MapCmlReader.ExtractViewPort(b);
break;
case MC_CML_TOUR:
a.Tour = VE_MapCmlReader.ExtractTour(b);
break;
case MC_CML_MODELREP:
a.ModelRep = VE_MapCmlReader.ExtractModelRep(b);
break;
case MC_CML_PHOTOS:
a.Photos = VE_MapCmlReader.ExtractPhotos(b)
}
}
}
if (a.GetPrimitiveCount() == 0) VE_MapManager.GetLayerManager().DeleteAnnotationFromCollection(c, a);
else if (!h[0]) if (Msn.VE.API != null) c.AddShape(a);
else c.AddEntityAnnotation(a);
else c.UpdateEntityAnnotation(a);
return c
};
VE_MapCmlReader.ExtractViewPort = function (g) {
var a = new VE_3DViewPort,
f = true,
h = g.childNodes.length;
for (var e = 0; e < h; e++) {
var d = g.childNodes[e],
b = GetXMLText(d);
switch (d.nodeName) {
case MC_CML_ENTITY_COORDINATES:
var c = b.split(MC_CML_TOKEN1);
if (c.length == 2) {
a.Longitude = parseFloat(c[0]);
a.Latitude = parseFloat(c[1])
} else f = false;
break;
case MC_CML_ALTITUDE:
a.Altitude = parseFloat(b);
break;
case MC_CML_ALTITUDEMODE:
a.Altitudemode = b;
break;
case MC_CML_PITCH:
a.Pitch = parseFloat(b);
break;
case MC_CML_HEADING:
a.Heading = parseFloat(b);
break;
case MC_CML_MAPSTYLE:
a.Mapstyle = b;
break;
case MC_CML_SCENEID:
a.SceneId = parseInt(b);
break;
case MC_CML_PROPERTYS:
a.Properties = VE_MapCmlReader.ExtractProperties(d)
}
}
if (!f || isNaN(a.Longitude) || isNaN(a.Latitude) || isNaN(a.Latitude) || isNaN(a.Pitch) || isNaN(a.Heading)) a = null;
return a
};
VE_MapCmlReader.ExtractTour = function (el) {
var Tour = new VE_3DTour;
Tour.Actions = [];
var actionKey = null,
actionValue = null,
actions = el.selectSingleNode(MC_CML_ACTIONS),
childNodesLen = actions.childNodes.length;
for (var i = 0; i < childNodesLen; i++) {
var actionNode = null;
actionNode = actions.childNodes[i].selectSingleNode(MC_CML_PROPERTYS);
var action = null,
actionStr = "{",
actionLen = actionNode.childNodes.length;
if (actionLen > 0) {
for (var j = 0; j < actionLen; j++) {
var node = actionNode.childNodes[j];
if (node.nodeName == MC_CML_PROPERTY) {
actionKey = node.getAttribute(MC_CML_KEY);
actionValue = node.getAttribute(MC_CML_VALUE);
if (typeof actionKey != "undefined" && actionKey != null && typeof actionValue != "undefined" && actionValue != null) actionStr = actionStr.concat("'", actionKey, "':'", actionValue, "',")
}
}
actionStr = actionStr.substring(0, actionStr.length - 1);
actionStr = actionStr.concat("}");
action = eval("(" + actionStr + ")")
}
if (typeof action != "undefined" && action != null) Tour.Actions.push(action)
}
if (Tour.Actions.length < 1) Tour = null;
return Tour
};
VE_MapCmlReader.ExtractModelRep = function (e) {
var a = new VE_3DModelRep,
f = e.childNodes.length;
for (var d = 0; d < f; d++) {
var c = e.childNodes[d],
b = GetXMLText(c);
switch (c.nodeName) {
case MC_CML_TRANSFORM:
a.Transform = b.split(MC_CML_TOKEN1);
break;
case MC_CML_MODELREFID:
a.ModelRefId = b;
break;
case MC_CML_PROPERTYS:
a.Properties = VE_MapCmlReader.ExtractProperties(c);
break;
case MC_CML_MINBOUNDS:
a.MinBounds = b;
break;
case MC_CML_MAXBOUNDS:
a.MaxBounds = b;
break;
case MC_CML_R2EOFFSET:
a.R2eoffset = b
}
}
if (typeof a.Transform != "object" || a.Transform.length != 16) a = null;
return a
};
VE_MapCmlReader.ExtractEntityProperties = function (h, a) {
var i = h.childNodes.length;
for (var g = 0; g < i; g++) {
var e = h.childNodes.item(g);
if (e.nodeName == MC_CML_PROPERTY) {
var b = e.getAttribute(MC_CML_VALUE);
switch (e.getAttribute(MC_CML_KEY)) {
case MC_CML_PROPERTY_ROUTABLELATITUDE:
a.RoutableLatitude = parseFloat(b);
break;
case MC_CML_PROPERTY_ROUTABLELONGITUDE:
a.RoutableLongitude = parseFloat(b);
break;
case MC_CML_PROPERTY_URL:
var d = null;
d = unescape(b);
if (d != "undefined" && d) a.Url = d;
break;
case MC_CML_PROPERTY_ICONURL:
var c = null;
c = unescape(b);
if (c) if (!(c.indexOf("://") > 0 && c.indexOf("http") < 0)) a.SetIconUrl(c);
break;
case MC_CML_PROPERTY_KEYWORDS:
a.Keywords = unescape(b);
break;
case MC_CML_PROPERTY_PHOTOURL:
var f = null;
f = unescape(b);
if (f) a.PhotoUrl = f;
break;
case MC_CML_PROPERTY_USERDATE:
a.UserDate = b;
break;
case MC_CML_PROPERTY_DISPLAYORDER:
a.DisplayOrder = b;
break;
case MC_CML_PROPERTY_BUSINESSLISTINGID:
a.SetBusinessListingId(b);
break;
case MC_CML_LASTMODIFIED:
a.LastModified = b;
break;
case MC_CML_DISPLAYORDER:
a.SetDisplayOrder(b);
break;
case MC_CML_ZOOMLEVEL:
a.SetZoomLevel(b);
break;
case MC_CML_ONSCRATCHPAD:
a.SetOnScratchpad(b);
break;
case MC_CML_PROPERTY_SOURCEURL:
a.SourceUrl = unescape(b);
break;
case MC_CML_PROPERTY_SOURCETYPE:
a.SourceType = b;
break;
case MC_CML_TILEID:
a.TileId = b;
break;
case MC_CML_PROPERTY_MAPSERVICETYPE:
a.mapserviceType = b;
break;
case MC_CML_PROPERTY_MAPSERVICESOURCE:
a.mapserviceSource = unescape(b);
break;
case MC_CML_PROPERTY_MAPSERVICEOPACITY:
a.mapserviceOpacity = b;
break;
case MC_CML_PROPERTY_MAPSERVICEMETADATA:
a.mapserviceMetadata = unescape(b);
break;
case MC_CML_PROPERTY_MAPSERVICESTATUS:
a.mapserviceStatus = b
}
}
}
return a
};
VE_MapCmlReader.ExtractPhotos = function (l) {
var n = [],
j = l.childNodes.length;
if (j == 0) return null;
for (var g = 0; g < j; g++) {
var a = l.childNodes.item(g);
if (a.nodeName == MC_CML_PHOTO) {
var c = new VE_Photo;
c.Id = a.getAttribute(MC_CML_ID);
var k = {},
m = true,
o = a.childNodes.length;
for (var h = 0; h < o; h++) {
var e = a.childNodes.item(h);
if (e.nodeName == MC_CML_PROPERTYS) {
var p = e.childNodes.length;
for (var i = 0; i < p; i++) {
var f = e.childNodes.item(i);
if (f.nodeName == MC_CML_PROPERTY) {
var b = f.getAttribute(MC_CML_VALUE),
d = f.getAttribute(MC_CML_KEY);
if (d != "undefined" && d != null && b != "undefined" && b != null) if (d == MC_CML_PROPERTY_URL) {
var q = unescape(b);
c.Url = q
} else {
k[d] = b;
m = false
}
}
}
}
}
if (!m) c.Properties = k;
n.push(c)
}
}
return n
};
VE_MapCmlReader.ExtractProperties = function (a) {
if (typeof a == "undefined" || a == null || a.childNodes.length < 1) return null;
var h = a.childNodes.length,
d = {},
e = true;
for (var c = 0; c < h; c++) {
var b = a.childNodes.item(c);
if (b.nodeName == MC_CML_PROPERTY) {
var f = b.getAttribute(MC_CML_VALUE),
g = b.getAttribute(MC_CML_KEY);
if (g != null && f != null) {
d[g] = f;
e = false
}
}
}
if (e) return null;
else return d
};
VE_MapCmlReader.ExtractPrimitives = function (l) {
var g = [],
o = l.childNodes.length;
for (var k = 0; k < o; k++) {
var f = l.childNodes.item(k);
if (f.nodeName == MC_CML_ENTITY_PRIMITIVE) {
var d = true,
a = null,
c = null,
n = null,
p = f.childNodes.length;
for (var j = 0; j < p; j++) {
var b = f.childNodes[j];
if (d) {
var e = b.getAttribute(MC_CML_LENGTH),
m = b.getAttribute(MC_CML_AREA);
switch (b.nodeName) {
case MC_CML_POLYGON:
d = false;
a = VE_MapCmlReader.ExtractPolygon(b);
if (e) a.SetLength(e * 1);
if (m) a.SetArea(m * 1);
break;
case MC_CML_POLYLINE:
d = false;
a = VE_MapCmlReader.ExtractPolyLine(b);
if (e) a.SetLength(e * 1);
break;
case MC_CML_POINT:
n = VEShapeType.Pushpin;
d = false;
a = VE_MapCmlReader.ExtractPoint(b)
}
} else if (b.nodeName == MC_CML_DEFAULTSTYLE) {
var i = VE_MapCmlReader.ExtractStyle(b, n);
c = i[0];
if (i.length > 1) {
var h = i[1];
if (h) {
a.labelPosX = h.longitude;
a.labelPosY = h.latitude
}
}
}
}
if (a != null) {
if (Msn.VE.API) {
if (!c) c = VE_GetDefaultAPISymbol(a.type);
a.symbol = c
} else if (a.type != VEShapeType.Pushpin) a.symbol = c;
g.push(a)
}
}
}
if (g.length < 1) return null;
return g
};
VE_MapCmlReader.ExtractPolygon = function (c) {
var a = c.selectSingleNode(MC_CML_OUTLS).selectSingleNode(MC_CML_LINEARSTRING),
b = a.selectSingleNode(MC_CML_COORDS);
return VE_MapCmlReader.BuildShape(VEShapeType.Polygon, GetXMLText(b), a)
};
VE_MapCmlReader.ExtractPolyLine = function (a) {
var b = a.selectSingleNode(MC_CML_COORDS);
return VE_MapCmlReader.BuildShape(VEShapeType.Polyline, GetXMLText(b), a)
};
VE_MapCmlReader.BuildShape = function (c, i, d) {
var h = null,
g = d.selectSingleNode(MC_CML_ALTITUDE);
if (g != null) h = GetXMLText(g);
var b = VE_GetLatLongPairsFromString(i, h);
if (b == null || b.LonLats == null) return null;
var a = null;
if (VEShapeType.Polyline == c) {
a = new Msn.Drawing.PolyLine(b.LonLats);
a.iid = Msn.Drawing.GetGeoUID(VEShapeType.Polyline)
} else if (VEShapeType.Polygon == c) {
a = new Msn.Drawing.Polygon(b.LonLats);
a.iid = Msn.Drawing.GetGeoUID(VEShapeType.Polygon)
} else if (VEShapeType.Pushpin == c) {
a = new Msn.Drawing.Point(b.LonLats[0], b.LonLats[1]);
a.iid = Msn.Drawing.GetGeoUID(VEShapeType.Pushpin)
}
if (b.Altitudes) {
var e = d.selectSingleNode(MC_CML_ALTITUDEMODE);
if (e != null) a.altitudeMode = GetXMLText(e);
if (VEShapeType.Pushpin == c) {
a.altitudes = b.Altitudes;
return a
} else {
a.altitudes = b.Altitudes;
var f = d.selectSingleNode(MC_CML_EXTRUDE);
if (f != null) if (GetXMLText(f).toLowerCase() == "true") a.extruded = true;
a.minZ = b.minZ;
a.maxZ = b.maxZ;
a.labelPosZ = a.maxZ
}
}
if (VEShapeType.Pushpin != c) {
a.minX = b.minX;
a.minY = b.minY;
a.maxX = b.maxX;
a.maxY = b.maxY
}
return a
};
VE_MapCmlReader.ExtractPoint = function (a) {
var b = a.selectSingleNode(MC_CML_COORDS);
return VE_MapCmlReader.BuildShape(VEShapeType.Pushpin, GetXMLText(b), a)
};
VE_MapCmlReader.ExtractStyle = function (i, n) {
var e = [],
a;
if (Msn.VE.API) a = VE_GetDefaultAPISymbol(n);
else a = VE_MapDispatch_SymbolLib.GetCurrentDefaultSymbol();
a = a.Clone();
var k = i.childNodes.length,
d = null;
for (var f = 0; f < k; f++) {
var c = i.childNodes.item(f);
if (c.nodeName == MC_CML_STYLE) {
var l = GetXMLText(c),
j = l.split(MC_CML_TOKEN3),
b = null,
m = j.length;
for (var g = 0; g < m; g++) {
b = j[g].split(MC_CML_TOKEN2);
if (b != null || b.length == 2) switch (b[0]) {
case MC_STYLE_STROKE_COLOR:
a.stroke_color = b[1];
break;
case MC_STYLE_FILL_COLOR:
a.fill_color = b[1];
break;
case MC_STYLE_STROKE_WEIGHT:
a.stroke_weight = b[1];
break;
case MC_STYLE_STROKE_STYLE:
a.stroke_style = b[1];
break;
case MC_STYLE_STROKE_DASH:
a.stroke_dashstyle = b[1]
}
b = null
}
} else if (c.nodeName == MC_CML_LABELSTYLE) {
var h = c.selectSingleNode(MC_CML_POSITION);
if (h != null) d = VE_GetLatLongFromString(GetXMLText(h))
}
}
e.push(a);
if (d) e.push(d);
return e
};
function VE_GetDefaultAPISymbol(b) {
var a = null;
if (typeof VE_MapDispatch_SymbolLib != "undefined") {
if (b == VEShapeType.Pushpin) a = VE_MapDispatch_SymbolLib.GetMapSymbolByID(MC_PROPERTY_PUSHPIN);
else a = VE_MapDispatch_SymbolLib.GetCurrentDefaultSymbol();
a.imagedata_src = Msn.VE.API.Constants.iconurl;
a.style_zIndex = Msn.VE.API.Globals.veshapeiconzindex;
a.style_zIndex_polyshape = Msn.VE.API.Globals.veshapepolyshapezindex
}
return a
}
function VE_GetLatLongFromString(c) {
var a = c.split(MC_CML_TOKEN1);
if (typeof a == "undefined" || a == null || a.length != 2) return null;
var b = new Msn.VE.LatLong;
b.longitude = parseFloat(a[0]);
b.latitude = parseFloat(a[1]);
return b
}
function VE_GetLatLongPairsFromString(o, b) {
if (o == null || typeof o != "string") return null;
var j = null,
k = null,
h = null,
i = null,
n = [];
try {
var p = o.split(MC_CML_TOKEN1),
e = null,
m = null,
g = null,
f = null,
d = true;
if (b == null || typeof b != "string") d = false;
if (d) {
m = b.split(MC_CML_TOKEN1);
d = p.length / 2 != m.length ? false : true;
e = []
}
j = 180;
k = 90;
h = -180;
i = -90;
g = Number.MAX_VALUE;
f = Number.MIN_VALUE;
var q = true,
c = NaN,
b = NaN,
r = p.length;
for (var l = 0; l < r; l++) {
c = parseFloat(p[l]);
if (!isNaN(c)) n.push(c);
else continue;
if (q) {
if (d) {
b = parseFloat(m[l / 2]);
if (isNaN(b)) d = false;
else {
e.push(b);
g = Math.min(g, b);
f = Math.max(f, b)
}
}
j = Math.min(j, c);
h = Math.max(h, c);
q = false
} else {
k = Math.min(k, c);
i = Math.max(i, c);
q = true
}
}
if (!d || e.length != n.length / 2) {
g = null;
f = null;
e = null
}
} catch (s) {
return null
}
var a = new VE_LocationResult;
a.minX = j;
a.minY = k;
a.maxX = h;
a.maxY = i;
a.minZ = g;
a.maxZ = f;
a.LonLats = n;
a.Altitudes = e;
return a
}
function VE_LocationResult() {
this.minX = null;
this.minY = null;
this.maxX = null;
this.maxY = null;
this.LonLats = null;
this.minZ = null;
this.maxZ = null;
this.Altitudes = null
}
VEShapeStyleLibrary = function () {
var a = [];
this.AddMapSymbol = function (b) {
if (b.stroke_color2 == null || b.stroke_color2 == "") if (b.stroke_color == "red") b.stroke_color2 = "blue";
else b.stroke_color2 = "red";
if (b.fill_color2 == null || b.fill_color2 == "") if (b.fill_color == "blue") b.fill_color2 = "red";
else b.fill_color2 = "blue";
a.push(b)
};
var b = null;
this.GetCurrentDefaultSymbol = function () {
if (b == null) b = this.GetMapSymbolByID(MC_PROPERTY_PARK);
return b
};
this.GetMapSymbolByID = function (c) {
if (a.length > 0) {
for (var d = 0; d < a.length; d++) if (a[d].id == c) return a[d]
} else {
var e = new VEShapeStyle;
e.id = MC_PROPERTY_DEFAULT;
this.AddMapSymbol(e)
}
var b = null;
if (typeof c == "undefined" || c == 0) return a[0];
b = new VEShapeStyle;
switch (c) {
case MC_PROPERTY_HIGHWAY:
b.id = c;
break;
case MC_PROPERTY_ROAD:
b.id = c;
b.stroke_color = "yellow";
b.stroke_style = "thickbetweenthin";
b.stroke_weight = 6;
break;
case MC_PROPERTY_LAKE:
b.id = c;
break;
case MC_PROPERTY_PARK:
b.id = c;
b.stroke_opacity = "50%";
b.stroke_endcap = "square";
b.stroke_joinstyle = "bevel";
break;
case MC_PROPERTY_PARKINGLOT:
b.id = c;
break;
case MC_PROPERTY_PUSHPIN:
b.id = c;
break;
case MC_PROPERTY_TEMPDRAW:
b.id = c;
b.stroke_weight = 1;
b.stroke_dashstyle = "dashdot";
break;
case MC_PROPERTY_TEMPEDIT:
b.id = c;
b.stroke_weight = 1;
b.stroke_color = "#0F0F0F";
b.stroke_dashstyle = "longdashdot";
break;
case MC_PROPERTY_EDITNODE:
b.id = c;
b.shape_drawtype = "v:rect";
b.style_filter = "100%";
b.stroke_color = "#000000";
b.fill_color = "yellow";
break;
case MC_PROPERTY_EDITSELNODE:
b.id = c;
b.shape_drawtype = "v:rect";
b.style_filter = "100%";
b.stroke_color = "red";
b.fill_color = "yellow";
break;
case MC_PROPERTY_GHOSTNODE:
b.id = c;
b.shape_drawtype = "v:rect";
b.style_filter = "100%";
b.stroke_opacity = "100%";
b.fill_opacity = "100%";
b.stroke_color = "#666666";
b.fill_color = "#dddd88";
break;
default:
return a[0]
}
this.AddMapSymbol(b);
return b
};
this.GetLocalMapSymbol = function (b) {
var a = VE_MapManager.GetEntityPrimitiveByElmt(b);
if (a == null) return null;
geometry = a[2];
if (typeof geometry == "undefined" || geometry == null) return null;
return geometry.symbol
}
};
function VE_MapRequestBean(c) {
this.action = c == "undefined" ? null : c;
var a = null,
b = "action=" + this.action;
this.SetParameters = function (d, c) {
if (a == null) a = [];
a[d] = c;
b = b.concat("&", d, "=", c)
};
this.GetParameters = function () {
return a
};
this.ToString = function () {
return b
}
}
_VERegisterNamespaces("Msn.Drawing");
Msn.Drawing.GetTextUID = function (a) {
return a + MC_IID_CON_TOKEN + "t"
};
Msn.Drawing.GetLabelUID = function (a) {
return a + MC_IID_CON_TOKEN + "l"
};
Msn.Drawing.IsLabel = function (a) {
return a.indexOf(MC_IID_CON_TOKEN + "l") > 0 ? true : false
};
Msn.Drawing.GetShpElementUIDByLabelUID = function (c) {
var b = "",
a = c.split(MC_IID_CON_TOKEN);
if (!a || a[0] != MC_IID_NAMESPACE) return null;
b = b.concat(a[0], MC_IID_CON_TOKEN, a[1], MC_IID_CON_TOKEN, a[2], MC_IID_CON_TOKEN, a[3]);
return b
};
Msn.Drawing.GetEntityUIDByPrimitiveUID = function (c) {
var b = "",
a = c.split(MC_IID_CON_TOKEN);
if (!a || a[0] != MC_IID_NAMESPACE) return null;
b = b.concat(a[0], MC_IID_CON_TOKEN, a[1], MC_IID_CON_TOKEN, a[2]);
return b
};
Msn.Drawing.CreatePointPushpin = function (p, a, r, y, g, m, l, x, h) {
var d = null,
i = r;
Msn.Drawing.CalculateLabelPosition(a, false);
var u = a.labelPosX ? a.labelPosX : a.points[0],
t = a.labelPosY ? a.labelPosY : a.points[1],
s = m ? m : 22,
q = l ? l : 17,
f = a.iid,
b = g,
n = g && g.indexOf("VE_Pushpin_Overlay") != -1;
if (a.type == VEShapeType.Pushpin) {
if (typeof b == "undefined" || !b) b = n ? VE_MapStruct.PushpinType.Overlay : VE_MapStruct.PushpinType.PushpinAn
} else {
f = Msn.Drawing.GetLabelUID(a.iid);
if (typeof b == "undefined" || !b) b = VE_MapStruct.PushpinType.Polyline
}
var o = n ? Msn.VE.PushPinTypes.Overlay : Msn.VE.PushPinTypes.Annotation,
k = i + "";
if (h) {
b = "VEAPI_Pushpin";
k = _VE_GetCustomIcon(f + "_img", h, i, false)
}
d = p.AddPushpin(f, t, u, s, q, b, k, MC_STYLE_PINZIndex, o, true);
if (h) {
var c = $ID(f + "_img");
if (c != null) {
var w = c.style.height,
v = c.style.width;
if (isNaN(parseInt(w)) || isNaN(parseInt(v))) {
c.style.height = "25px";
c.style.width = "30px"
}
if (d != null) {
var e = parseInt(d.style.top),
j = parseInt(c.style.height);
if (isNaN(e)) e = j;
else e += j;
d.style.top = e + "px"
}
}
}
return d
};
function _VE_GetCustomIcon(i, h, e, f) {
var g = "")
}
function _VE_OnCustonIconError(a, e) {
var f = typeof Msn.VE.API != "undefined" && Msn.VE.API != null;
if (!f && typeof a != "undefined") {
var b = VE_MapManager.GetAnnotationById(a.id);
if (b) {
b.IconUrl = null;
var d = VE_MapStruct.PushpinType,
c = d.PushpinViewer;
if (b.IsOverlay()) c = d.OverlayViewer;
else if (b.GetType() != VEShapeType.Pushpin) c = d.PolylineViewer;
if (a.parentElement) {
a.parentElement.className = "bullet " + c;
a.parentElement.innerText = e;
a.parentElement.removeChild(a)
}
}
}
}
function _VE_ResizeImage(a, c, b) {
var e = c,
d = b;
if (a.width > c) d = parseInt(a.height * c / a.width);
else if (a.height > b) e = parseInt(a.width * b / a.height);
else {
e = a.width;
d = a.height
}
a.style.height = d + "px";
a.style.width = e + "px";
if (a.style.visibility == "hidden") a.style.visibility = "visible";
return a
}
function IsPointInPolygon(a, b, e, f, c, d) {
if (a > c || a < e || b > d || b < f) return false;
return true
}
function GetAgentName() {
var c = ["msie", "firefox"],
d = "";
for (var a = 0; a < c.length; a++) {
var e = navigator.userAgent.toLowerCase(),
b = c[a];
if (e.indexOf(b) != -1) d = b
}
return d
}
function VE_DisableSelection(a) {
if (typeof a.onselectstart != "undefined") a.attachEvent("onselectstart", donothingsayno);
else if (typeof a.style.MozUserSelect != "undefined") a.style.MozUserSelect = "none"
}
function VE_EnableSelection(a) {
if (typeof a.onselectstart != "undefined") a.detachEvent("onselectstart", donothingsayno);
else if (typeof a.style.MozUserSelect != "undefined") a.style.removeProperty("-moz-user-select")
}
function VE_FindFirstAncestor(c, d, b) {
var a = d;
while (a != null && a.nodeName.toUpperCase() != c.toUpperCase() && b > 0) {
a = a.parentElement;
--b
}
return a
}
function VE_ChangeOpacity(b, a) {
if (typeof Web != "undefined" && typeof Web.Browser != "undefined" && typeof Web.Browser.isMozilla == "function" && Web.Browser.isMozilla()) b.style.opacity = a / 100;
else b.style.filter = "alpha(opacity=" + a + ")"
}
function VE_SanitizeHTML(b) {
if (typeof b == "undefined" || !b) return b;
var a = document.createElement("div");
a.innerHTML = b + " __hack";
VE_WalkNode(a, VE_RemoveHarmfulHTML);
var c = a.innerHTML;
a = null;
return c.substring(0, c.length - 7)
}
function VE_RemoveHarmfulHTML(c) {
if (c == null) return;
var e = "",
a = null,
f = [];
for (var d = 0; c.hasChildNodes() && d < c.childNodes.length; ++d) {
e = null;
a = c.childNodes[d];
switch (a.nodeName) {
case "A":
e = a.getAttribute("HREF");
case "B":
case "BR":
var g = [];
for (var b = 0; b < a.attributes.length; ++b) g.push(a.attributes[b].nodeName);
for (var b = 0; b < g.length; ++b) a.removeAttribute(g[b]);
if (a.nodeName == "A") if (e != null && e.match(/^https?:\/\//gi) != null) {
a.setAttribute("TARGET", "_blank");
a.setAttribute("HREF", e)
}
break;
case "#text":
break;
default:
f.push(a);
c.insertBefore(document.createTextNode(" "), a.nextSibling);
for (var b = 0; a.hasChildNodes() && b < a.childNodes.length; ++b) c.insertBefore(a.childNodes[b], a.nextSibling)
}
}
for (var d = 0; d < f.length; ++d) c.removeChild(f[d])
}
function VE_WalkNode(a, b) {
if (b == null || a == null) return;
b(a);
for (var c = 0; a.hasChildNodes() && c < a.childNodes.length; ++c) VE_WalkNode(a.childNodes[c], b)
}
function VE_AbortTimeoutCallback(a) {
if (a != -1) try {
window.clearTimeout(a)
} catch (b) {}
a = -1
}
_VERegisterNamespaces("Msn.Drawing");
Msn.Drawing.CalculateLabelPosition = function (a, g) {
if (a.type == VEShapeType.Pushpin) return null;
if (typeof g != "undefined" && g == true) {
a.labelPosX = null;
a.labelPosY = null;
a.labelPosZ = null
}
if (a.labelPosX == null && a.labelPosY == null) if (a.type == VEShapeType.Polyline) {
var b = Math.round((a.points.length / 2 - 1) / 2 - 1);
b = b > -1 ? b : 0;
a.labelPosX = (a.points[2 * b] + a.points[2 * b + 2]) / 2;
a.labelPosY = (a.points[2 * b + 1] + a.points[2 * b + 3]) / 2;
if (a.altitudes) a.labelPosZ = Math.max(a.altitudes[b], a.altitudes[b + 1])
} else if (a.type == VEShapeType.Polygon) {
var c = a.points.length,
d = 0,
e = 0,
f = null;
if (a.altitudes) f = a.altitudes[0];
if (c >= 4 && a.points[0] == a.points[c - 2] && a.points[1] == a.points[c - 1]) c -= 2;
for (var b = 0; b < c; b = b + 2) {
d = d + a.points[b];
e = e + a.points[b + 1];
if (a.altitudes) f = Math.max(f, a.altitudes[b / 2])
}
d = d * 2 / c;
e = e * 2 / c;
a.labelPosX = d;
a.labelPosY = e;
a.labelPosZ = f
}
};
_VERegisterNamespaces("Msn.VE.Core");
Msn.VE.Core.LayerManager = function () {
var register = new Msn.VE.Core.EventRegistry,
self = this,
cols = [],
loadedColIds = [],
layerListDiv = null,
unsavedName = L_CollectionManagerUnsavedCollectionTitle_Text,
CopyPasteBoard = null,
CountPastes = 0,
UndoPrimitives = null,
_HighlightEntity = null,
_isHighlighted = false;
function GetCollectionListDiv() {
if (layerListDiv == null) {
layerListDiv = document.createElement("div");
layerListDiv.id = "VELayerListDiv";
Init()
}
return layerListDiv
}
function Init() {
CreateCollection(0, 0, unsavedName)
}
var visibleBounds = null;
this.SetBoundingBox = function (e, f, a, c, b, d) {
if (visibleBounds) visibleBounds = new Msn.VE.Bounds(0, 0, a, c, b, d);
else {
visibleBounds.z1 = e;
visibleBounds.z2 = f;
visibleBounds.x1 = a;
visibleBounds.x2 = b;
visibleBounds.y1 = c;
visibleBounds.y2 = d
}
};
this.GetBoundingBox = function () {
if (visibleBounds == null) {
var a = GetSelectedCollection();
if (a) return a.GetBoundingBox()
}
return visibleBounds
};
var selecteColMsnId = 0;
this.GetSelectedCollectionMsnId = function () {
return selecteColMsnId
};
var selectedAnnotation = null;
this.SetSelectedAnnotation = function (a) {
selectedAnnotation = a
};
this.ClearSelectedAnnotation = function () {
selectedAnnotation = null
};
this.GetSelectedAnnotation = function () {
return selectedAnnotation
};
this.IsSelectedCollectionUnsaved = function () {
if (selecteColMsnId == 0) return true;
else return false
};
this.SetSelectedCollectionMsnId = function (a) {
selecteColMsnId = a;
if (a != 0) {
for (var d = 0; d < loadedColIds.length; d++) if (loadedColIds[d] == a) return a;
loadedColIds.push(a);
if (loadedColIds.length > MC_MAX_LOADED_COLS) {
var c = loadedColIds.shift();
c = GetCollectionIndexByMsnId(c);
if (c > 0) {
var b = GetCollectionByIndex(c);
if (b && b.GetType() == MC_COL_TYPE_COLLECTION) {
mvcViewFacade.OnCollectionLayerClear(b);
EmptyCollection(b)
}
}
}
}
};
this.AddListener = function (b, a) {
register.AddListener(b, a)
};
this.RemoveListener = function (b, a) {
register.RemoveListener(b, a)
};
this.Fire = function (b, a) {
register.Fire(b, a)
};
function AddCollection(b, a) {
if (b == 0) cols.unshift(a);
else cols.push(a);
return a
}
function IsCollectionExist(c) {
if (cols.length > 0) for (var a = 0; a < cols.length; a++) {
var b = cols[a];
if (b.GetMsnId() && b.GetMsnId() == c) return true
}
return false
}
function SaveCollection(b) {
var a = cols[0];
if (a.GetMsnId() == 0) {
a = cols.shift();
cols.push(a);
CreateCollection(0, 0, unsavedName);
a.SetMsnId(b);
return a
}
}
function GetCollectionIndexByMsnId(c) {
if (cols.length > 0) for (var a = 0; a < cols.length; a++) {
var d = cols[a],
b = d.GetMsnId();
if (b && b == c) return a
}
return 0
}
function GetCollectionByMsnId(b, a) {
if (!b) return null;
switch (b.action) {
case MC_ACTION_RETRIEVE_ALLCOLLECTIONS_METADATA:
return this.RetrieveCollection(a);
break;
case MC_ACTION_IMPORT_COLLECTION:
return CreateCollection(cols.length - 1, a, unsavedName);
case MC_ACTION_CREATE_COLLECTION:
return this.SaveCollection(a);
break;
case MC_ACTION_CLONE_ENTITY:
case MC_ACTION_UPDATE_COLLECTION:
return this.RetrieveCollection(a);
break;
case MC_ACTION_IMPORT_ENTITY:
case MC_ACTION_ADD_ENTITY:
return this.RetrieveCollection(a);
break;
case MC_ACTION_RETRIEVE_SHAREDCOLLECTION:
case MC_ACTION_RETRIEVE_COLLECTION:
return this.RetrieveCollection(a)
}
}
function RetrieveCollection(c) {
var d = false;
if (cols.length > 0) for (var b = 0; b < cols.length; b++) {
var a = cols[b];
if (a.GetMsnId() && a.GetMsnId() == c) {
d = true;
return a
}
}
if (!d) return CreateCollection(-1, c, unsavedName)
}
function SetVisibility(b) {
for (var a = 0; a < cols.length; a++) {
cols[a].SetVisibility(b);
if (b) VE_MapOverlays.ActivateCollectionOverlays(cols[a]);
else VE_MapOverlays.DeactivateCollectionOverlays(cols[a])
}
}
function RetrieveCollectionById(c) {
if (cols.length > 0) for (var a = 0; a < cols.length; a++) {
var b = cols[a];
if (b.GetId() == c) return b
}
return null
}
function CreateCollection(b, c, d) {
var a = new VEShapeLayer;
a.SetMsnId(c);
a.SetName(d);
a = AddCollection(b, a);
return a
}
function CreateNewCollection(b) {
var a = null;
if (b == MC_COL_TYPE_TILEIMAGE) a = new Msn.VE.Core.RasterLayer;
else a = new VEShapeLayer;
a.SetType(b);
a.SetMsnId(0);
a = AddCollection(cols.length, a);
return a
}
function GetSelectedCollection() {
if (cols.length > 0) for (var a = 0; a < cols.length; a++) {
var b = cols[a];
if (self.GetSelectedCollectionMsnId() == cols[a].GetMsnId()) return cols[a]
}
return CreateCollection(0, 0, unsavedName)
}
function GetCollection(c) {
var a = [];
a[0] = false;
a[1] = false;
if (cols.length > 0) for (var b = 0; b < cols.length; b++) if (cols[b].GetMsnId() == c) {
a[0] = true;
var e = cols[b].Annotations.length;
if (!cols[b].Annotations || e < 1) a[1] = false;
else a[1] = true;
a[2] = cols[b];
return a
}
var d = CreateCollection(0, c, unsavedName);
a[2] = d;
return a
}
function GetCollectionCount() {
if (!cols) return 0;
return cols.length
}
function GetCollectionByIndex(a) {
if (cols == null || cols.length < a || a < 0) return null;
return cols[a]
}
function Dispose() {
DeleteAll();
cols = [];
loadedColIds = []
}
function DeleteAll() {
var a = null;
while (cols.length > 1) {
a = cols.pop();
EmptyCollection(a)
}
if (cols.length == 1) EmptyCollection(cols[0])
}
function RemoveCollection(a) {
EmptyCollection(a);
DeleteCollection(a)
}
function EmptyCollection(a) {
VE_MapOverlays.DeactivateCollectionOverlays(a);
var c = null;
if (a.Annotations.length > 0) for (var b = 0; b < a.Annotations.length; b++) {
c = a.Annotations[b];
ClearEntity(c)
}
a.Annotations = [];
a.SetBoundingBox(0, 0, Infinity, Infinity, -Infinity, -Infinity)
}
function DeleteCollection(b) {
VE_MapOverlays.DeactivateCollectionOverlays(b);
var c = 0;
if (cols.length == 1) {
cols.pop();
c = 0;
CreateCollection(0, 0, unsavedName)
} else for (var a = 0; a < cols.length; a++) if (cols[a].iid == b.iid) {
c = a;
cols.splice(a, 1);
break
}
b = null;
selecteColMsnId = 0
}
function GetSelectedCollectionAnnotationCount() {
var a = self.GetSelectedCollection();
return a.GetShapeCount()
}
function GetAnnotationByMsnId(a, d, f) {
var b = [];
if (a && a.Annotations && a.GetShapeCount() > 0) for (var c = 0; c < a.Annotations.length; c++) if (d && a.Annotations[c].GetMsnId() == d || f && a.Annotations[c].GetId() == f) {
b[0] = true;
a.Annotations[c].SetMsnId(d);
b[1] = a.Annotations[c];
return b
}
var e = new VEShape(MC_VESHAPE_EMPTY);
e.SetMsnId(d);
b[0] = false;
b[1] = e;
return b
}
function GetAnnotationById(e) {
if (cols.length < 1) return null;
var d = e,
a = d.split(MC_IID_CON_TOKEN);
if (a[0] != MC_IID_NAMESPACE) return null;
a[1] = a[0] + MC_IID_CON_TOKEN + a[1];
a[2] = a[1] + MC_IID_CON_TOKEN + a[2];
for (var b = 0; b < cols.length; b++) if (cols[b].iid == a[1]) {
var f = cols[b].Annotations.length;
for (var c = 0; c < f; c++) if (cols[b].Annotations[c].GetId() == a[2]) {
return cols[b].Annotations[c];
break
}
break
}
return null
}
function GetCollectionByAnId(d) {
if (cols.length < 1) return null;
var c = d,
a = c.split(MC_IID_CON_TOKEN);
if (a[0] != MC_IID_NAMESPACE) return null;
a[1] = a[0] + MC_IID_CON_TOKEN + a[1];
a[2] = a[1] + MC_IID_CON_TOKEN + a[2];
for (var b = 0; b < cols.length; b++) if (cols[b].iid == a[1]) {
cols[b]._index = b;
return cols[b]
}
return null
}
function DeleteAnnotationById(c) {
if (cols.length < 1) return null;
for (var a = 0; a < cols.length; a++) if (cols[a].GetMsnId() == selecteColMsnId) {
var d = cols[a].Annotations.length;
for (var b = 0; b < d; b++) if (cols[a].Annotations[b].GetId() == c) {
ClearEntity(cols[a].Annotations[b]);
cols[a].Annotations.splice(b, 1);
cols[a].UpdateBoundingBox();
break
}
break
}
}
function MoveAnnotations(h, i) {
var c = null,
e = null,
b = null;
if (cols.length < 1) return null;
for (var a = 0; a < cols.length; a++) if (cols[a].GetMsnId() == selecteColMsnId) {
c = a;
var k = cols[a].Annotations.length;
for (var f = 0; f < k; f++) {
var g = cols[a].Annotations[f].GetId();
if (e == null && g == h) e = f;
else if (b == null && g == i) b = f;
if (e != null && b != null) break
}
break
}
if (c == null || e == null || b == null) return null;
var j = cols[c].Annotations[e],
d = null;
if (e < b) for (var a = e; a < b; ++a) {
cols[c].Annotations[a] = cols[c].Annotations[a + 1];
d = cols[c].Annotations[a];
d.SetDisplayOrder(a + 1);
d.SetIndex(a);
d.SetChangeState(MC_CHANGE_STATE_UPDATE)
} else for (var a = e; a > b; --a) {
cols[c].Annotations[a] = cols[c].Annotations[a - 1];
d = cols[c].Annotations[a];
d.SetDisplayOrder(a + 1);
d.SetIndex(a);
d.SetChangeState(MC_CHANGE_STATE_UPDATE)
}
cols[c].Annotations[b] = j;
d = cols[c].Annotations[b];
d.SetDisplayOrder(b + 1);
d.SetIndex(b);
d.SetChangeState(MC_CHANGE_STATE_UPDATE);
if (e < b) for (var a = e; a <= b; ++a) mvcViewFacade.OnEntityRepaint(cols[c].Annotations[a]);
else for (var a = b; a <= e; ++a) mvcViewFacade.OnEntityRepaint(cols[c].Annotations[a])
}
function SwapAnnotations(j, k) {
var a = null,
b = null,
c = null;
if (cols.length < 1) return null;
for (var d = 0; d < cols.length; d++) if (cols[d].GetMsnId() == selecteColMsnId) {
a = d;
var m = cols[d].Annotations.length;
for (var e = 0; e < m; e++) {
if (b == null && cols[d].Annotations[e].GetId() == j) b = e;
else if (c == null && cols[d].Annotations[e].GetId() == k) c = e;
if (b != null && c != null) break
}
break
}
if (a == null || b == null || c == null) return null;
var l = cols[a].Annotations[b];
cols[a].Annotations[b] = cols[a].Annotations[c];
cols[a].Annotations[c] = l;
var f = cols[a].Annotations[b].GetDisplayOrder(),
g = cols[a].Annotations[c].GetDisplayOrder();
cols[a].Annotations[b].SetDisplayOrder(g);
cols[a].Annotations[c].SetDisplayOrder(f);
var h = cols[a].Annotations[b].GetIndex(),
i = cols[a].Annotations[c].GetIndex();
cols[a].Annotations[b].SetIndex(i);
cols[a].Annotations[c].SetIndex(h);
cols[a].Annotations[b].SetChangeState(MC_CHANGE_STATE_UPDATE);
cols[a].Annotations[c].SetChangeState(MC_CHANGE_STATE_UPDATE);
mvcViewFacade.OnEntityRepaint(cols[a].Annotations[b]);
mvcViewFacade.OnEntityRepaint(cols[a].Annotations[c]);
return null
}
function DeleteAnnotation(b) {
if (!b) return null;
if (cols.length < 1) return null;
var e = b.GetId(),
a = e.split(MC_IID_CON_TOKEN);
if (a[0] != MC_IID_NAMESPACE) return null;
a[1] = a[0] + MC_IID_CON_TOKEN + a[1];
var d = null;
for (var c = 0; c < cols.length; c++) if (cols[c].iid == a[1]) {
d = cols[c];
break
}
if (d == null) return null;
VE_MapOverlays.DeactivateEntityOverlays(b);
DeleteAnnotationFromCollection(d, b)
}
function UpdateBoundingBox(c) {
if (c == null || c.Annotations.length < 1) return null;
var b = null,
a = null,
e = null;
for (var d = 0; d < c.Annotations.length; d++) {
e = c.Annotations[d];
b = e.GetBoundingBox();
if (b == null) return null;
if (a != null) {
a.x1 = Math.min(a.x1, b.x1);
a.y1 = Math.min(a.y1, b.y1);
a.x2 = Math.max(a.x2, b.x2);
a.y2 = Math.max(a.y2, b.y2)
} else a = new Msn.VE.Bounds(0, 0, b.x1, b.y1, b.x2, b.y2);
b = null
}
if (a) c.SetBoundingBox(0, 0, a.x1, a.y1, a.x2, a.y2)
}
function DeleteAnnotationFromCollection(a, b) {
ClearEntity(b);
if (a.Annotations.length == 1 && a.Annotations[0].GetId() == b.GetId()) a.Annotations.pop();
else for (var c = 0; c < a.Annotations.length; c++) if (a.Annotations[c].GetId() == b.GetId()) {
a.Annotations.splice(c, 1);
break
}
b = null;
a.UpdateBoundingBox();
if (a == GetSelectedCollection()) if (typeof mvcViewFacade != "undefined" && typeof mvcViewFacade.OnCollectionLayerRepaint == "function") mvcViewFacade.OnCollectionLayerRepaint(a)
}
function CloneCollection(a) {
if (typeof a == "undefined" || a == null) return null;
var g = a.Annotations.length,
b = new VEShapeLayer;
b.SetName(name);
b.SetName(a.GetName());
b.SetType(a.GetType());
b.SetVisibility(a.GetVisibility());
b.SetMaxZoomLevel(a.GetMaxZoomLevel());
b.SetMinZoomLevel(a.GetMinZoomLevel());
var c = a.GetBoundingBox();
if (c) b.SetBoundingBox(c.z1, c.z2, c.x1, c.y1, c.x2, c.y2);
b.Tags = a.Tags;
b.SetChangeType(a.GetChangeType());
b.SetChangeState(a.GetChangeState());
b.Notes = a.Notes;
b.IsPublic = a.IsPublic;
b.IsIndexed = a.IsIndexed;
b.DateCreated = a.DateCreated;
b.DateModified = a.DateModified;
b._properties = CloneProperties(a._properties);
if (g > 0) {
var e = null,
f = null;
for (var d = 0; d < g; d++) {
e = a.Annotations[d];
f = CloneAnnotationById(e.GetId());
b.AddEntityAnnotation(f)
}
}
return b
}
function CloneAnnotationById(b) {
var a = self.GetAnnotationById(b);
return CloneAnnotation(a)
}
function CloneAnnotation(an) {
var annotation = an;
if (typeof annotation == "undefined" || annotation == null) return;
var primitive = annotation.GetPrimitive(0);
if (primitive.points == null || primitive.points.length < 1) return null;
var copypoints = new Array(primitive.points.length),
copyprimitive = null;
for (var j = 0; j < primitive.points.length; j = j + 2) {
copypoints[j] = primitive.points[j];
copypoints[j + 1] = primitive.points[j + 1]
}
switch (primitive.type) {
case VEShapeType.Polygon:
case VEShapeType.Polyline:
if (primitive.type == VEShapeType.Polyline) {
copyprimitive = new Msn.Drawing.PolyLine(copypoints);
copyprimitive.iid = Msn.Drawing.GetGeoUID(VEShapeType.Polyline)
} else copyprimitive = new Msn.Drawing.Polygon(copypoints);
copyprimitive.minX = primitive.minX;
copyprimitive.minY = primitive.minY;
copyprimitive.maxX = primitive.maxX;
copyprimitive.maxY = primitive.maxY;
copyprimitive.minZ = primitive.minZ;
copyprimitive.maxZ = primitive.maxZ;
copyprimitive.labelPosX = primitive.labelPosX;
copyprimitive.labelPosY = primitive.labelPosY;
copyprimitive.labelPosZ = primitive.labelPosZ;
copyprimitive.extruded = primitive.extruded;
copyprimitive.isLabel = primitive.isLabel;
if (primitive.altitudes) {
var altitudeLen = primitive.altitudes.length;
copyprimitive.altitudes = [];
for (var j = 0; j < altitudeLen; j++) copyprimitive.altitudes[j] = primitive.altitudes[j]
}
break;
case VEShapeType.Pushpin:
copyprimitive = new Msn.Drawing.Point(copypoints[0], copypoints[1]);
copyprimitive.altitudes = [];
if (primitive.altitudes) copyprimitive.altitudes[0] = primitive.altitudes[0]
}
copyprimitive.altitudeMode = primitive.altitudeMode;
copyprimitive.symbol = primitive.symbol;
var copyannotation = new VEShape(MC_VESHAPE_EMPTY);
copyannotation.AddPrimitive(copyprimitive);
copyannotation.IconUrl = annotation.IconUrl;
copyannotation.SetProperties(null, annotation.Title, annotation.Url, annotation.PhotoUrl, annotation.UserDate, annotation.Notes, annotation.RoutableLatitude, annotation.RoutableLongitude, annotation.BusinessListingId, annotation.IconId, annotation.LastModified, annotation.Keywords, annotation.mapserviceType, annotation.mapserviceSource, annotation.mapserviceOpacity);
copyannotation.SetDisplayOrder(annotation.GetDisplayOrder());
copyannotation.SetZoomLevel(annotation.GetZoomLevel());
var bbox = annotation.GetBoundingBox();
if (bbox) copyannotation.SetBoundingBox(bbox.z1, bbox.z2, bbox.x1, bbox.y1, bbox.x2, bbox.y2);
if (annotation.ViewPort) {
copyannotation.ViewPort = new VE_3DViewPort;
copyannotation.ViewPort.Latitude = annotation.ViewPort.Latitude;
copyannotation.ViewPort.Longitude = annotation.ViewPort.Longitude;
copyannotation.ViewPort.Altitude = annotation.ViewPort.Altitude;
copyannotation.ViewPort.Altitudemode = annotation.ViewPort.Altitudemode;
copyannotation.ViewPort.Pitch = annotation.ViewPort.Pitch;
copyannotation.ViewPort.Heading = annotation.ViewPort.Heading;
copyannotation.ViewPort.Mapstyle = annotation.ViewPort.Mapstyle;
copyannotation.ViewPort.SceneId = annotation.ViewPort.SceneId;
copyannotation.ViewPort.Properties = CloneProperties(annotation.ViewPort.Properties)
}
copyannotation.SourceUrl = annotation.SourceUrl;
copyannotation.SourceType = annotation.SourceType;
if (annotation.ModelRep) {
copyannotation.ModelRep = new VE_3DModelRep;
copyannotation.ModelRep.Transform = annotation.ModelRep.Transform;
copyannotation.ModelRep.ModelRefId = annotation.ModelRep.ModelRefId;
copyannotation.ModelRep.MinBounds = annotation.ModelRep.MinBounds;
copyannotation.ModelRep.MaxBounds = annotation.ModelRep.MaxBounds;
copyannotation.ModelRep.R2eoffset = annotation.ModelRep.R2eoffset;
copyannotation.ModelRep.Properties = CloneProperties(annotation.ModelRep.Properties)
}
if (annotation.ModelData) {
copyannotation.ModelData = new VE_3DModelData;
copyannotation.ModelData.Properties = annotation.ModelData.Properties;
copyannotation.ModelData.Callback = annotation.ModelData.Callback
}
if (annotation.Photos) {
var length = annotation.Photos.length;
copyannotation.Photos = [];
var copyphoto = null,
photo = null;
for (var i = 0; i < length; i++) {
photo = annotation.Photos[i];
copyphoto = new VE_Photo;
copyphoto.Id = photo.Id;
copyphoto.Url = photo.Url;
copyphoto.Properties = CloneProperties(photo.Properties);
copyannotation.Photos.push(copyphoto)
}
}
if (annotation.Tour && typeof annotation.Tour.Actions == "object") {
copyannotation.Tour = new VE_3DTour;
copyannotation.Tour.Actions = [];
var tourLen = annotation.Tour.Actions.length;
for (var i = 0; i < tourLen; i++) {
var actionStr = "{",
touraction = annotation.Tour.Actions[i];
for (var tourkey in touraction) actionStr = actionStr.concat("'", tourkey, "':'", touraction[tourkey], "',");
actionStr = actionStr.substring(0, actionStr.length - 1);
actionStr = actionStr.concat("}");
var targetAction = eval("(" + actionStr + ")");
if (typeof targetAction != "undefined" && targetAction != null) copyannotation.Tour.Actions.push(targetAction)
}
}
return copyannotation
}
function CloneProperties(a) {
if (typeof a != "object" || a == null) return null;
var c = {};
for (var b in a) c[b] = a[b];
return c
}
function AddAnnotationToCollection(a, b) {
if (typeof b == "undefined" || b == null) {
var c = self.GetSelectedCollection();
c.AddEntityAnnotation(a)
} else b.AddEntityAnnotation(a);
if (typeof mvcViewFacade != "undefined" && typeof mvcViewFacade.OnEntityRepaint == "function") mvcViewFacade.OnEntityRepaint(a)
}
function DeleteAllPrimitivesFromAnnotation(a) {
if (typeof a != "undefined" && a.GetPrimitiveCount() > 0) {
var c = a.GetPrimitiveCount();
if (c < 1) return null;
for (var b = 0; b < c; b++) DeletePrimitiveFromAnnotation(a.GetPrimitive(b), a)
}
return a
}
function DeletePrimitiveFromAnnotation(b, a) {
a.DeletePrimitive(b.iid);
if (a.GetPrimitiveCount() == 0) {
DeleteAnnotation(a);
a = null
}
return a
}
function ClearEntity(a) {
if (typeof a == "undefined" && a == null) return null;
VE_MapOverlays.DeactivateEntityOverlays(a);
a.ClearAllPrimitives()
}
function ParseInternalID(b) {
var a = b.split(MC_IID_CON_TOKEN);
if (!a || a[0] != MC_IID_NAMESPACE) return null;
a[1] = a[0] + MC_IID_CON_TOKEN + a[1];
a[2] = a[1] + MC_IID_CON_TOKEN + a[2];
a[3] = a[2] + MC_IID_CON_TOKEN + a[3];
return a
}
function GetEntityPrimitiveById(i) {
if (cols.length < 1) return null;
var a = i.split(MC_IID_CON_TOKEN);
if (a[0] != MC_IID_NAMESPACE) return null;
a[1] = a[0] + MC_IID_CON_TOKEN + a[1];
a[2] = a[1] + MC_IID_CON_TOKEN + a[2];
a[3] = a[2] + MC_IID_CON_TOKEN + a[3];
var b = null,
e = null,
d = null;
for (var g = 0; g < cols.length; g++) {
b = cols[g];
if (b.iid == a[1]) {
var j = null;
for (var c = 0; c < b.Annotations.length; c++) if (b.Annotations[c].GetId() == a[2]) {
e = b.Annotations[c];
for (var h = 0; h < b.Annotations[c].GetPrimitiveCount(); h++) {
d = b.Annotations[c].GetPrimitive(h);
if (d.iid == a[3]) {
var f = [];
f[0] = b;
f[1] = e;
f[2] = d;
return f
}
d = null
}
e = null
}
}
}
if (b == null || e == null || d == null) return null
}
function SavedLayerCount() {
var c = 0,
d = cols.length;
if (cols.length > 0) for (var b = 0; b < d; b++) {
var a = cols[b],
e = a.GetMsnId();
if (e != 0 && a.GetType() == MC_COL_TYPE_COLLECTION && !a.IsExSource()) c++
}
return c
}
function IsHighlightEntity(a) {
if (_HighlightEntity != null && _HighlightEntity.iid == a) return true;
else return false
}
function IsHighlightPrimitive(b) {
if (_HighlightEntity != null) {
var a = _HighlightEntity.GetPrimitive(0);
if (a && a.iid == b) return true
}
return false
}
function GetHighlightEntity() {
return _HighlightEntity
}
function SetHighlightEntity(a) {
_HighlightEntity = a
}
function CheckHighlightStatus(a) {
return _isHighlighted == a ? true : false
}
function SetHighlightStatus(a) {
_isHighlighted = a
}
this.SetHighlightEntity = SetHighlightEntity;
this.SetHighlightStatus = SetHighlightStatus;
this.CheckHighlightStatus = CheckHighlightStatus;
this.IsHighlightEntity = IsHighlightEntity;
this.IsHighlightPrimitive = IsHighlightPrimitive;
this.GetHighlightEntity = GetHighlightEntity;
this.GetCollectionListDiv = GetCollectionListDiv;
this.Init = Init;
this.IsCollectionExist = IsCollectionExist;
this.GetCollectionIndexByMsnId = GetCollectionIndexByMsnId;
this.GetAnnotationByMsnId = GetAnnotationByMsnId;
this.GetSelectedCollection = GetSelectedCollection;
this.GetCollection = GetCollection;
this.RetrieveCollection = RetrieveCollection;
this.RetrieveCollectionById = RetrieveCollectionById;
this.CreateNewCollection = CreateNewCollection;
this.SaveCollection = SaveCollection;
this.GetCollectionCount = GetCollectionCount;
this.GetSelectedCollectionAnnotationCount = GetSelectedCollectionAnnotationCount;
this.GetCollectionByIndex = GetCollectionByIndex;
this.GetCollectionByMsnId = GetCollectionByMsnId;
this.RemoveCollection = RemoveCollection;
this.EmptyCollection = EmptyCollection;
this.GetAnnotationById = GetAnnotationById;
this.GetCollectionByAnId = GetCollectionByAnId;
this.DeleteAnnotationById = DeleteAnnotationById;
this.SwapAnnotations = SwapAnnotations;
this.MoveAnnotations = MoveAnnotations;
this.DeleteAnnotation = DeleteAnnotation;
this.DeleteAnnotationFromCollection = DeleteAnnotationFromCollection;
this.CloneAnnotationById = CloneAnnotationById;
this.CloneAnnotation = CloneAnnotation;
this.AddAnnotationToCollection = AddAnnotationToCollection;
this.DeleteAllPrimitivesFromAnnotation = DeleteAllPrimitivesFromAnnotation;
this.ParseInternalID = ParseInternalID;
this.GetEntityPrimitiveById = GetEntityPrimitiveById;
this.CloneCollection = CloneCollection;
this.AddCollection = AddCollection;
this.DeleteAll = DeleteAll;
this.SetVisibility = SetVisibility;
this.SavedLayerCount = SavedLayerCount;
this.Dispose = Dispose
};
VE_CollectionActions = function () {};
VE_CollectionActions.Create = "CreateCollection";
VE_CollectionActions.Update = "UpdateCollection";
VE_CollectionActions.RetrieveAll = "RetrieveAllCollections";
VE_CollectionActions.RetrieveDetails = "RetrieveCollectionDetails";
VE_CollectionActions.Delete = "DeleteCollection";
VE_CollectionActions.DeleteAll = "DeleteAllCollections";
VE_CollectionActions.DeleteAllAnnotations = "DeleteAllAnnotations";
VE_AnnotationActions = function () {};
VE_AnnotationActions.Create = "CreateAnnotation";
VE_AnnotationActions.Delete = "DeleteAnnotation";
VE_AnnotationActions.Update = "UpdateAnnotation";
VE_AnnotationActions.RetrieveAll = "RetrieveAllAnnotations";
VE_AnnotationState = function () {};
VE_AnnotationState.None = "None";
VE_AnnotationState.Added = "Added";
VE_AnnotationState.Updated = "Updated";
VE_AnnotationState.Deleted = "Deleted";
VE_CollectionsManagerConstants = function () {};
VE_CollectionsManagerConstants.Handler = "UserCollections.aspx?action=";
VE_CollectionsManagerConstants.Market = "mkt=";
VE_CollectionsManagerConstants.Random = "rand=";
VE_CollectionsManagerConstants.A_Id = "aid";
VE_CollectionsManagerConstants.A_Title = "atitle";
VE_CollectionsManagerConstants.A_Latitude = "alatitude";
VE_CollectionsManagerConstants.A_Longitude = "alongitude";
VE_CollectionsManagerConstants.A_Notes = "anotes";
VE_CollectionsManagerConstants.A_Keywords = "akeywords";
VE_CollectionsManagerConstants.A_IconId = "aiconid";
VE_CollectionsManagerConstants.A_InfoUrl = "aurl";
VE_CollectionsManagerConstants.A_PhotoUrl = "aphotourl";
VE_CollectionsManagerConstants.A_UserDate = "auserdate";
VE_CollectionsManagerConstants.A_DisplayOrder = "adisplayorder";
VE_CollectionsManagerConstants.A_BusinessId = "abusinesslistingid";
VE_CollectionsManagerConstants.A_CreationId = "acreationid";
VE_CollectionsManagerConstants.A_State = "astate";
VE_CollectionsManagerConstants.A_MapserviceType = "amapservicetype";
VE_CollectionsManagerConstants.A_MapserviceSource = "amapservicesource";
VE_CollectionsManagerConstants.A_MapserviceOpacity = "amapserviceopacity";
VE_CollectionsManagerConstants.C_Id = "cid";
VE_CollectionsManagerConstants.C_Name = "cname";
VE_CollectionsManagerConstants.C_IsPublic = "cispublic";
VE_CollectionsManagerConstants.C_Length = "cannotationcount";
VE_CollectionsManagerConstants.C_Keywords = "ckeywords";
VE_CollectionsManagerConstants.ViewerDefaultTitle = L_CollectionManagerViewerDefaultTitle_Text;
VE_CollectionsManagerConstants.MinimizedTimerDelay = 1;
VE_CollectionsManagerConstants.TimerDelay = 2000;
VE_CollectionsManagerConstants.ExtendedTimerDelay = 5000;
VE_CollectionsManagerConstants.MAX_COLLECTION_SIZE = 200;
VE_CollectionsManagerConstants.HELP_FILE_PATH = "/cPublicPrivate.htm";
VE_CollectionsManagerConstants.TourMode = "tour";
VELayerProperties = {
CopyAllowed: "copyallowed"
};
VEShapeLayer = function () {
this._mapGuid = null;
this.Name = "";
this.MsnId = "";
this.IsPublic = false;
this.Culture = "en-us";
this.IsIndexed = false;
this.SourceUrl = null;
this.DateCreated = Date();
this.DateModified = Date();
this.Tags = "";
this.Notes = "";
this.Annotations = [];
this.Dirty = false;
this.IsClearDom = true;
this.ViewableByOwnerOnly = false;
this.EditableByOwner = true;
this.OwnerIsViewing = false;
this._properties = null;
this.iid = MC_IID_NAMESPACE + MC_IID_CON_TOKEN + Msn.Drawing.GetGeoUID(MC_GEO_TYPE_COL);
this._index = 0;
this.GetShapeCount = function () {
if (this.Annotations) return this.Annotations.length;
else return 0
};
this.ClearAnnotations = function () {
while (this.Annotations.length) {
var a = this.Annotations.pop();
a = null
}
};
this.AddAnnotation = function (a, b) {
if (a && this.Annotations) {
this.IsClearDom = true;
a.IsClearDom = true;
if (typeof b == "number" && b >= 0 && b < this.Annotations.length) {
this.Annotations.splice(b, 0, a);
return this.Annotations.length
} else {
a.SetIndex(this.Annotations.length);
a.SetDisplayOrder(this.Annotations.length);
return this.Annotations.push(a)
}
}
};
this.RetrieveAnnotationById = function (b) {
if (this.Annotations.length > 0 && b) {
var a = 0;
while (a < this.Annotations.length) {
if (b == this.Annotations[a].Id) return a;
a++
}
}
return null
};
this.ResetOrder = function () {
if (this.Annotations && this.Annotations != "" && this.Annotations != "undefined" && this.Annotations.length > 0) {
for (var a = 0; a < this.Annotations.length; a++) if (this.Annotations[a] instanceof VEShape) {
this.Annotations[a].DisplayOrder = a;
this.Annotations[a].Delta = 0
}
this.Dirty = false
}
};
this.ReOrder = function () {
this.Annotations.sort(this.sortByIndex);
this.Dirty = false
};
this.sortByIndex = function (a, b) {
if (a instanceof VEShape && b instanceof VEShape) {
a.DisplayOrder = a.DisplayOrder + a.Delta;
b.DisplayOrder = b.DisplayOrder + b.Delta;
a.Delta = 0;
b.Delta = 0;
return a.DisplayOrder - b.DisplayOrder
}
}
};
VEShapeLayer.prototype = new Msn.VE.Core.VectorLayer;
VEShapeLayer.prototype.isEmptyOnServerSide = false;
VEShapeLayer.prototype.IsUpdateCollection = true;
VEShapeLayer.prototype.AddEntityAnnotation = function (a) {
this.UpdateEntityAnnotation(a);
this.AddAnnotation(a)
};
VEShapeLayer.prototype.SetChangeState = function (a) {
this.ChangeState = a
};
VEShapeLayer.prototype.GetChangeState = function () {
if (typeof this.ChangeState == "undefined") this.ChangeState = MC_CHANGE_STATE_DEFAULT;
return this.ChangeState
};
VEShapeLayer.prototype.SetChangeType = function (a) {
this.ChangeType = a
};
VEShapeLayer.prototype.GetChangeType = function () {
if (typeof this.ChangeType == "undefined") this.ChangeType = MC_CHANGE_TYPE_ALL;
return this.ChangeType
};
VEShapeLayer.prototype.UpdateEntityAnnotation = function (c) {
this.IsClearDom = true;
c.IsClearDom = true;
if (this.Annotations.length < 1) this.SetBoundingBox(0, 0, Infinity, Infinity, -Infinity, -Infinity);
var d = true,
a = this.GetBoundingBox(),
b = null;
b = c.GetBoundingBox();
var e = a.x1 <= a.x2 && a.y1 <= a.y2,
f = b.x1 <= b.x2 && b.y1 <= b.y2;
if (e && f) d = a.x1 < b.x1 && a.y1 < b.y1 && a.x2 > b.x2 && a.y2 > b.y2;
c.Update(true, this.iid);
if (a) if (d) {
a.x1 = Math.min(b.x1, a.x1);
a.y1 = Math.min(b.y1, a.y1);
a.x2 = Math.max(b.x2, a.x2);
a.y2 = Math.max(b.y2, a.y2)
} else a = this.UpdateBoundingBox();
else a = new Msn.VE.Bounds(0, 0, b.x1, b.y1, b.x2, b.y2);
this.SetBoundingBox(0, 0, a.x1, a.y1, a.x2, a.y2);
this._SetTileId();
a = null;
return c
};
VEShapeLayer.prototype.UpdateBoundingBox = function () {
var h = this.Annotations.length,
g = null,
a = null,
b = Infinity,
d = Infinity,
c = -Infinity,
e = -Infinity;
for (var f = 0; f < h; f++) {
g = this.Annotations[f];
a = g.GetBoundingBox();
b = Math.min(a.x1, b);
d = Math.min(a.y1, d);
c = Math.max(a.x2, c);
e = Math.max(a.y2, e)
}
this.SetBoundingBox(0, 0, b, d, c, e);
this._SetTileId();
return this.GetBoundingBox()
};
VEShapeLayer.prototype.IsExSource = function () {
if (this.MsnId != 0 && this.MsnId.indexOf(MC_CML_EXCOL_PREFIX) == 0) return true;
else return false
};
VEShapeLayer.prototype.IsFromMsnStorage = function () {
if (this.MsnId == 0 || this.IsExSource()) return false;
else return true
};
VEShapeLayer.prototype.GetProperty = function (b) {
if (this._properties == null) return null;
var a = this._properties[b];
if (b == VELayerProperties.CopyAllowed) if (!this.IsPublic) {
a = 0;
this._properties[VELayerProperties.CopyAllowed] = a
} else if (a == null) {
a = 1;
this._properties[VELayerProperties.CopyAllowed] = a
}
return typeof a == "undefined" ? null : a
};
VEShapeLayer.prototype.SetProperty = function (b, a) {
if (typeof b != "string" && typeof b != "number" || typeof a != "string" && typeof a != "number" && typeof a != "boolean") return null;
if (this._properties == null) this._properties = {};
this._properties[b] = a
};
VEShapeLayer.prototype._SetTileId = function () {
if (typeof VE_ShapeIndexManager != "undefined") {
var a = VE_ShapeIndexManager.GetTileId(this.Boundingbox);
if (a != null) this.SetProperty(MC_CML_TILEID, a)
}
};
VEShapeLayer.prototype.IsDuplicate = function (b) {
var i = this.Annotations.length,
e = b.GetPrimitive(0);
if (i < 1 || e == null) return false;
var n = e.type,
a = null,
d = 0,
c = 0,
l = b.ToString(),
m = b.GetId(),
h = b.GetMsnId(),
g = b.GetBusinessListingId();
for (var f = 0; f < i; f++) {
a = this.Annotations[f];
primitive2 = a.GetPrimitive(0);
if (primitive2 == null || e.type != primitive2.type) continue;
d = a.GetMsnId();
c = a.GetBusinessListingId();
if (m != a.GetId()) {
var k = h != 0 && d != 0 && h == d;
if (k) return true;
var j = g != 0 && c != 0 && g == c;
if (j) return true;
if (l == a.ToString()) return true
}
d = 0;
c = 0
}
return false
};
VEShapeLayer.prototype.GetBoundingRectangle = function () {
var a = this.GetBoundingBox();
return new VELatLongRectangle(new VELatLong(a.y2, a.x1), new VELatLong(a.y1, a.x2))
};
VEShapeLayer.prototype.GetShapeByIndex = function (a) {
var b = this.Annotations.length;
if (typeof a != "number" && a > 0 && a < b - 1) return null;
return this.Annotations[a]
};
VEShapeLayer.prototype.GetShapeByID = function (b) {
var c = this.Annotations.length;
for (var a = 0; a < c; a++) if (this.Annotations[a].GetId() == b) return this.Annotations[a];
return null
};
VEShapeLayer.prototype.DeleteAllShapes = function () {
if (this._mapGuid != null) {
var b = GetVEMapInstance(this._mapGuid);
if (b != null) b.m_vegraphicsmanager.ClearLayerDom(this)
}
var c = this.Annotations.length;
for (var a = 0; a < c; a++) this.Annotations[a].DisposeEx();
this.Annotations = [];
this.Boundingbox = new Msn.VE.Bounds(0, 0, Infinity, Infinity, -Infinity, -Infinity);
this.ClearClusterLayer()
};
VEShapeLayer.prototype.SwapShapes = function (a, b) {
var a = parseInt(a),
b = parseInt(b);
VEValidator.ValidateInt(a, "idx1");
VEValidator.ValidateInt(b, "idx2");
if (a == b) return false;
var c = this.Annotations.length;
VEValidator.ValidateBetween(a, "idx1", 0, c - 1);
VEValidator.ValidateBetween(b, "idx2", 0, c - 1);
var h = this.Annotations[a];
this.Annotations[a] = this.Annotations[b];
this.Annotations[b] = h;
var d = this.Annotations[a].GetDisplayOrder(),
e = this.Annotations[b].GetDisplayOrder();
this.Annotations[a].SetDisplayOrder(e);
this.Annotations[b].SetDisplayOrder(d);
var f = this.Annotations[a].GetIndex(),
g = this.Annotations[b].GetIndex();
this.Annotations[a].SetIndex(g);
this.Annotations[b].SetIndex(f);
if (this.Annotations[a].GetVisibility()) this.Annotations[a].Show();
if (this.Annotations[b].GetVisibility()) this.Annotations[b].Show();
return true
};
VEShapeLayer.prototype.AddShape = function (a, b) {
if (a && typeof a.length != "undefined") this.AddShapes(a, b);
else {
VEValidator.ValidateObject(a, "_veshape", VEShape, "VEShape");
if (a._shplayer != null || a.Primitives[0] == null) throw new VEException("AddShape", "err_invalidargument", L_ShpExist_text);
a._shplayer = this;
this.UpdateEntityAnnotation(a);
this.AddAnnotation(a, b);
if (a.GetVisibility()) a.Show()
}
};
VEShapeLayer.prototype.AddShapes = function (c) {
VEValidator.ValidateObjectArray(c, "_veshapeArray", VEShape, "VEShape Array");
var h = c.length,
g = GetVEMapInstance(this._mapGuid);
if (g && g.GetMapMode() == Msn.VE.MapActionMode.Mode3D) for (var a = 0; a < h; ++a) this.AddShape(c[a]);
else {
if (this._index == 0 && this.GetShapeCount() == 0) this.Show();
var d = [],
f = this.Annotations.length;
for (var a = 0; a < f; a++) this.Annotations[a].ClearDomElements();
if (!Msn.VE.Environment.IsIE50()) for (var a = 0; a < f; a++) {
var b = this.Annotations[a];
if (b._isDrawn) {
if (b.IconUrl == null) b.IconUrl = Msn.VE.API.Constants.iconurl;
d.push(b.ToHtml())
}
}
for (var a = 0; a < h; ++a) {
var b = c[a];
b._shplayer = this;
this.UpdateEntityAnnotation(b);
this.AddAnnotation(b);
if (b.IconUrl == null) b.IconUrl = Msn.VE.API.Constants.iconurl;
d.push(b.ToHtml());
b._isDrawn = true
}
var e = $ID(this.GetId());
if (e) if (Msn.VE.Environment.IsIE50()) e.innerHTML += d.join("");
else e.innerHTML = d.join("")
}
this.Cluster()
};
VEShapeLayer.prototype.DeleteShape = function (b) {
VEValidator.ValidateObject(b, "_veshape", VEShape, "VEShape");
var d = this.Annotations.length;
for (var a = 0; a < d; a++) if (this.Annotations[a].GetId() == b.GetId()) {
if (this._mapGuid != null) {
var c = GetVEMapInstance(this._mapGuid);
if (c != null) c.m_vegraphicsmanager.ClearEntityDom(this.Annotations[a])
}
this.Annotations[a].DisposeEx();
this.Annotations.splice(a, 1);
this.UpdateBoundingBox();
break
}
this.Cluster()
};
VEShapeLayer.prototype.Show = function () {
this.SetVisibility(true);
if (this._mapGuid == null) return null;
var a = GetVEMapInstance(this._mapGuid);
if (a == null) return null;
if (this._clusterLayer) {
this._clusterLayer.SetVisibility(true);
this._clusterLayer._clusterZoomLevel = null
}
a.m_vegraphicsmanager.DrawLayer(this)
};
VEShapeLayer.prototype.Hide = function () {
this.SetVisibility(false);
if (this._mapGuid == null) return null;
var a = GetVEMapInstance(this._mapGuid);
if (a == null) return null;
a.m_vegraphicsmanager.ClearLayerDom(this);
if (this._clusterLayer) this._clusterLayer.SetVisibility(false)
};
VEShapeLayer.prototype.SetTitle = function (a) {
if (typeof a != "undefined" && a != null) this.Name = a.replace(/%0D%0A/g, "\r\n").replace(/%0A/g, "\n")
};
VEShapeLayer.prototype.GetTitle = function () {
if (typeof this.Name == "undefined") this.Name = "my collection";
return this.Name
};
VEShapeLayer.prototype.SetDescription = function (a) {
if (typeof a != "undefined" && a != null) this.Notes = a.replace(/%0D%0A/g, "\r\n").replace(/%0A/g, "\n")
};
VEShapeLayer.prototype.GetDescription = function () {
if (typeof this.Notes == "undefined") this.Notes = "";
return this.Notes
};
VEShapeLayer.prototype.SetMaxZoomLevel = function (a) {
a = parseInt(a);
if (isNaN(a) || a > Msn.VE.API.Globals.veshapemaxzoom || a < Msn.VE.API.Globals.veshapeminzoom) throw new VEException("VEShapeLayer.SetMaxZoomLevel", "err_incorrectzoomlevel", L_Shp_IncorrectZoomLevel_Text);
else if (a < this.MinScale) throw new VEException("VEShapeLayer.SetMaxZoomLevel", "err_incorrectzoomlevel", L_Shp_IncorrectZoomLevel2_Text);
this.MaxScale = a;
if (this.GetVisibility()) this.Show()
};
VEShapeLayer.prototype.GetMaxZoomLevel = function () {
return this.MaxScale
};
VEShapeLayer.prototype.SetMinZoomLevel = function (a) {
a = parseInt(a);
if (isNaN(a) || a < Msn.VE.API.Globals.veshapeminzoom || a > Msn.VE.API.Globals.veshapemaxzoom) throw new VEException("VEShapeLayer.SetMinZoomLevel", "err_incorrectzoomlevel", L_Shp_IncorrectZoomLevel_Text);
else if (a > this.MaxScale) throw new VEException("VEShapeLayer.SetMinZoomLevel", "err_incorrectzoomlevel", L_Shp_IncorrectZoomLevel2_Text);
this.MinScale = a;
if (this.GetVisibility()) this.Show()
};
VEShapeLayer.prototype.GetMinZoomLevel = function () {
return this.MinScale
};
VEShapeLayer.prototype.IsVisible = function () {
return this.GetVisibility()
};
VEShapeLayer.prototype.SetClusteringConfiguration = function (b, a) {
if (!this._isClusterLayer) {
if (a != null) {
VEValidator.ValidateObject(a, "clusteringOptions", VEClusteringOptions, "VEClusteringOptions");
if (a.Icon != null) VEValidator.ValidateObject(a.Icon, "clusteringOptions.Icon", VECustomIconSpecification, "VECustomIconSpecification");
if (a.Callback != null) VEValidator.ValidateFunction(a.Callback, "clusteringOptions.Callback")
}
if (typeof b == "number") {
VEValidator.ValidateClusteringType(b, "type");
if (b == VEClusteringType.Grid) this._clusteringAlgorithm = GridCluster;
else this._clusteringAlgorithm = null
} else if (typeof b == "function") this._clusteringAlgorithm = b;
else throw new VEException("VEShapeLayer:SetClusteringConfiguration", "err_invalidargument", L_invalidargument_text.replace("%1", "type").replace("%2", "VEClusteringType"));
this._clusteringOptions = a;
if (this._clusteringAlgorithm == null) this.DeleteClusterLayer();
else this.CreateClusterLayer();
var c = GetVEMapInstance(this._mapGuid);
if (c != null && c.m_vegraphicsmanager != null) if (this._clusterLayer != null) this.Cluster();
else c.m_vegraphicsmanager.DrawLayer(this)
} else throw new VEException("VEShapeLayer:SetClusteringConfiguration", "err_invalidlayertype", L_InvalidClusterLayer_Text)
};
VEShapeLayer.prototype.Cluster = function () {
if (!this._isClusterLayer && this._clusterLayer) {
this._clusterLayer._clusterZoomLevel = null;
var a = GetVEMapInstance(this._mapGuid);
if (a != null && a.m_vegraphicsmanager != null) a.m_vegraphicsmanager.DrawLayer(this)
}
};
VEShapeLayer.prototype.GetClusteredShapes = function (b) {
var a = [];
VEValidator.ValidateClusteringType(b, "type");
switch (b) {
case VEClusteringType.Grid:
a = GridCluster(this)
}
return a
};
VEShapeLayer.prototype.CreateClusterLayer = function () {
if (!this._isClusterLayer && !this._clusterLayer) {
var a = GetVEMapInstance(this._mapGuid);
if (a != null) {
this._clusterLayer = new VEShapeLayer;
this._clusterLayer._isClusterLayer = true;
a.AddShapeLayer(this._clusterLayer)
}
}
};
VEShapeLayer.prototype.DeleteClusterLayer = function () {
if (this._clusterLayer) {
var a = GetVEMapInstance(this._mapGuid);
if (a != null) {
a.DeleteShapeLayer(this._clusterLayer);
this._clusterLayer = null
}
}
};
VEShapeLayer.prototype.ClearClusterLayer = function () {
if (this._clusterLayer) {
this._clusterLayer._clusterZoomLevel = null;
this._clusterLayer.DeleteAllShapes()
}
};
function GridCluster(m) {
var q = [],
g = GetVEMapInstance(m._mapGuid);
if (g != null) {
var b = {},
d = g.GetZoomLevel(),
p = 2,
r = 0;
if (g.vemapcontrol.IsMapViewOblique()) d += 18;
var u = m.Annotations.length;
for (var n = 0; n < u; n++) {
var a = m.Annotations[n];
if (a.GetVisibility() && !a.IsModel() && a.GetType() == VEShapeType.Pushpin) {
if (!a._sort) {
a._sort = {};
a._sort.zoomLevel = d
}
if (a._sort.zoomLevel != d || !a._sort.zoomQuadKey) {
a._sort.zoomLevel = d;
var j = new Msn.VE.LatLong;
j.latitude = a.Primitives[0].points[1];
j.longitude = a.Primitives[0].points[0];
var s = g.vemapcontrol.GetOrthoMode(),
t = s.LatLongToPixel(j, d + p);
a._sort.zoomQuadkey = VEPixelToQuadKey(t, d + p)
}
if (!b[a._sort.zoomQuadkey]) b[a._sort.zoomQuadkey] = [];
b[a._sort.zoomQuadkey].push(a)
}
}
for (var o in b) {
var e = b[o],
c = e.length;
if (c > 1) {
var h = new VEClusterSpecification;
h.Shapes = e;
var k = 0,
l = 0,
i = false;
for (var f = 0; f < c; f++) {
k += parseFloat(e[f].Primitives[0].points[1]);
l += parseFloat(e[f].Primitives[0].points[0]);
i = i || e[f].IsEncrypted()
}
h.LatLong = i ? VEShape.LatLongFactory.CreateVELatLong(k / c, l / c) : new VELatLong(k / c, l / c);
q[r] = h;
r++
}
}
b = null
}
return q
}
function VEShape(c, b) {
this.Id = 0;
this.Title = Msn.VE.API ? "" : L_AnnotationConfDefaultTitle_Text;
this.Latitude = 0;
this.Longitude = 0;
this.RoutableLatitude = null;
this.RoutableLongitude = null;
this.Notes = "";
this.Keywords = "";
this.Url = "";
this.PhotoUrl = "";
this.UserDate = new Date;
this.DisplayOrder = 0;
this.BusinessListingId = 0;
this.IconId = 0;
this.LastModified = new Date;
this._cacheOfSerializationLength = 0;
this.TileId = null;
this.IsClearDom = true;
this.mapserviceType = "None";
this.mapserviceSource = "";
this.mapserviceOpacity = .6;
this.mapserviceMetadata = "";
this.mapserviceStatus = 0;
this.ViewPort = null;
this.Tour = null;
this.ModelRep = null;
this.ModelData = null;
this.IsModelVisible = false;
this.Photos = null;
this.SourceUrl = null;
this.SourceType = null;
this.ShowDetailOnMouseOver = true;
this.OnMouseOverCallback = null;
this._customIcon = null;
this._IconContent = null;
this._eroContent = null;
this._shplayer = null;
this.IconUrl = null;
this.maxZoomLevel = 21;
this.minZoomLevel = 1;
var a = false;
this.IsEncrypted = function () {
return a
};
this.SetEncrypted = function () {
a = true
};
if (typeof this._Construct == "function") this._Construct(true, c, b)
}
VEShape.prototype.GetCacheOfSerializationLength = function () {
if (this._cacheOfSerializationLength <= 0) {
var a = VE_CookieSerializer.SerializeAnnotation(this);
if (a != null) this._cacheOfSerializationLength = a.length
}
return this._cacheOfSerializationLength
};
VEShape.prototype.InvalidateCacheOfSerializationLength = function () {
this._cacheOfSerializationLength = 0
};
VEShape.prototype.index = 0;
VEShape.prototype.SetIndex = function (a) {
this.index = a
};
VEShape.prototype.GetIndex = function () {
return this.index
};
VEShape.prototype.SetDisplayOrder = function (a) {
this.DisplayOrder = a
};
VEShape.prototype.GetDisplayOrder = function () {
return this.DisplayOrder
};
VEShape.prototype.SetProperties = function (b, n, o, j, k, m, g, e, c, l, i, a, h, f, d) {
if (b) this.Id = b;
this.Title = n.replace(/%0D%0A/g, "\r\n").replace(/%0A/g, "\n");
this.RoutableLatitude = g;
this.RoutableLongitude = e;
this.Notes = m.replace(/%0D%0A/g, "\r\n").replace(/%0A/g, "\n");
if (a != null && a.length > 0 && a[0] != null) {
this.Keywords = a;
this.Keywords[0] = this.Keywords[0].replace(/%0D%0A/g, "\r\n").replace(/%0A/g, "\n")
} else this.Keywords = a;
this.Url = o;
this.PhotoUrl = j;
this.UserDate = k;
this.BusinessListingId = c;
this.IconId = l;
this.LastModified = i;
this.mapserviceType = h;
this.mapserviceSource = f;
this.mapserviceOpacity = d
};
VEShape.prototype.symbolUrl = "samplesymbol";
VEShape.prototype.GetMsnId = function () {
return this.Id
};
VEShape.prototype.SetMsnId = function (a) {
this.Id = a
};
VEShape.prototype.SetBoundingBox = function (f, e, c, d, a, b) {
if (typeof this.Boundingbox == "undefined" || this.Boundingbox == null) {
if (c == null || d == null || a == null || b == null) return null;
this.Boundingbox = new Msn.VE.Bounds(f, e, c, d, a, b)
} else {
this.Boundingbox.x1 = c;
this.Boundingbox.y1 = d;
this.Boundingbox.z1 = f;
this.Boundingbox.x2 = a;
this.Boundingbox.y2 = b;
this.Boundingbox.z2 = e
}
if (typeof VE_ShapeIndexManager != "undefined") this.TileId = VE_ShapeIndexManager.GetTileId(this.Boundingbox);
return this.Boundingbox
};
VEShape.prototype.GetBoundingBox = function () {
if (typeof this.Boundingbox == "undefined" || !this.Boundingbox) this.Boundingbox = new Msn.VE.Bounds(0, 0, Infinity, Infinity, -Infinity, -Infinity);
return this.Boundingbox
};
VEShape.prototype.GetCenterPoint = function () {
if (!this.GetBoundingBox()) return;
var a = new Array(2);
a[0] = (this.GetBoundingBox().x1 + this.GetBoundingBox().x2) / 2;
a[1] = (this.GetBoundingBox().y1 + this.GetBoundingBox().y2) / 2;
return a
};
VEShape.prototype.SetId = function (a) {
this.iid = a
};
VEShape.prototype.GetId = function () {
if (typeof this.iid == "undefined" || this.iid == 0 || this.iid == null) this.iid = Msn.Drawing.GetGeoUID(MC_GEO_TYPE_ENTITY);
return this.iid
};
VEShape.prototype.SetVisibility = function (a) {
this.Visibility = a
};
VEShape.prototype.GetVisibility = function () {
if (typeof this.Visibility == "undefined" || typeof this.Visibility == "null") this.Visibility = true;
return this.Visibility
};
VEShape.prototype.SetBusinessListingId = function (a) {
if (typeof a == "undefined" || a == "null") this.BusinessListingId = 0;
else this.BusinessListingId = a
};
VEShape.prototype.GetBusinessListingId = function () {
if (typeof this.BusinessListingId == "undefined" || this.BusinessListingId == null || this.BusinessListingId == "null") this.BusinessListingId = 0;
return this.BusinessListingId
};
VEShape.prototype.SetType = function (a) {
this.Type = a
};
VEShape.prototype.GetType = function () {
if (typeof this.Type == "undefined") this.Type = "aN";
return this.Type
};
VEShape.prototype.SetSaveStatus = function (a) {
this.SaveStatus = a
};
VEShape.prototype.IsSaved = function () {
if (typeof this.SaveStatus == "undefined") this.SaveStatus = true;
return this.SaveStatus
};
VEShape.prototype.SetOnScratchpad = function (a) {
this.OnScratchpad = a
};
VEShape.prototype.IsOnScratchpad = function () {
if (typeof this.OnScratchpad == "undefined") this.OnScratchpad = true;
return this.OnScratchpad
};
VEShape.prototype.SetZoomLevel = function (a) {
this.ZoomLevel = a
};
VEShape.prototype.GetZoomLevel = function () {
if (typeof this.ZoomLevel == "undefined") this.ZoomLevel = 12;
return this.ZoomLevel
};
VEShape.prototype.SetChangeState = function (a) {
this.ChangeState = a
};
VEShape.prototype.GetChangeState = function () {
if (typeof this.ChangeState == "undefined") this.ChangeState = MC_CHANGE_STATE_DEFAULT;
return this.ChangeState
};
VEShape.prototype.SetChangeType = function (a) {
this.ChangeType = a
};
VEShape.prototype.GetChangeType = function () {
if (typeof this.ChangeType == "undefined") this.ChangeType = MC_CHANGE_TYPE_ALL;
return this.ChangeType
};
VEShape.prototype.HasAltitude = function () {
var a = this.Primitives;
if (typeof a == "undefined" || a == null) return false;
if (a[0].altitudes == null) return false;
else return true
};
VEShape.prototype.GetPrimitiveCount = function () {
if (typeof this.Primitives == "undefined" || this.Primitives == null) {
this.Primitives = [];
return 0
}
return this.Primitives.length
};
VEShape.prototype.SetPrimitives = function (a) {
this.Primitives = a;
this.SetType(a[0].type)
};
VEShape.prototype.GetPrimitives = function () {
if (typeof this.Primitives == "undefined" || this.Primitives == null) this.Primitives = [];
return this.Primitives
};
VEShape.prototype.GetPrimitive = function (a) {
if (typeof this.Primitives == "undefined" || this.Primitives == null || this.Primitives.length == 0) {
this.Primitives = [];
return null
}
if (a < this.Primitives.length) return this.Primitives[a];
else return this.Primitives[0]
};
VEShape.prototype.AddPrimitive = function (a) {
if (typeof this.Primitives == "undefined" || this.Primitives == null) this.Primitives = [];
this.Primitives.push(a);
this.SetType(a.type)
};
VEShape.prototype.UpdateUI = function () {};
VEShape.prototype.DeletePrimitive = function (c) {
if (typeof this.Primitives == "undefined" || this.Primitives == null) {
this.Primitives = [];
return null
}
if (this.Primitives.length == 1) {
this.Primitives[0].Destroy();
this.Primitives.pop();
this.Primitives = [];
return null
}
var b = null;
for (var a = 0; a < this.Primitives.length; a++) {
b = this.Primitives[a];
if (b.iid == c) {
this.Primitives[a].splice(a, 1);
break
}
}
if (b) b.Destroy()
};
VEShape.prototype.ClearAllPrimitives = function () {
if (typeof this.Primitives == "undefined" || this.Primitives == null) {
this.Primitives = [];
return
}
for (var a = 0; a < this.Primitives.length; a++) this.Primitives[a].Destroy();
this.Primitives = []
};
VEShape.prototype.Update = function (j, h) {
var b = false,
l = this.GetId().split(MC_IID_CON_TOKEN);
if (l[0] == MC_IID_NAMESPACE) b = true;
else {
b = false;
if (!h) return false;
var k = h.split(MC_IID_CON_TOKEN);
if (k[0] != MC_IID_NAMESPACE) return false
}
var m = this.Primitives.length,
a = null,
d = Infinity,
f = Infinity,
e = -Infinity,
g = -Infinity;
for (var i = 0; i < m; i++) {
a = this.Primitives[i];
if (a.type != VEShapeType.Pushpin) {
if (!b || j || (a.minX == null || a.minY == null || a.maxX == null || a.maxY == null)) {
var c = Msn.Drawing.ComputeBoundingBox(a.points);
if (c) {
a.minX = c[0];
a.minY = c[1];
a.maxX = c[2];
a.maxY = c[3]
}
}
d = Math.min(a.minX, d);
f = Math.min(a.minY, f);
e = Math.max(a.maxX, e);
g = Math.max(a.maxY, g);
Msn.Drawing.CalculateLabelPosition(a);
this.Longitude = a.labelPosX;
this.Latitude = a.labelPosY;
this.Altitude = a.labelPosZ
} else {
d = Math.min(a.points[0], d);
f = Math.min(a.points[1], f);
e = Math.max(a.points[0], e);
g = Math.max(a.points[1], g);
this.Longitude = a.points[0];
this.Latitude = a.points[1]
}
if (!b) a.iid = h + MC_IID_CON_TOKEN + this.GetId() + MC_IID_CON_TOKEN + a.iid;
a.title = this.Title;
if (a.shape != null) a.shape.id = a.iid
}
this.SetBoundingBox(0, 0, d, f, e, g);
if (!b) this.SetId(h + MC_IID_CON_TOKEN + this.GetId());
this.guid = this.GetId();
return this.GetBoundingBox()
};
VEShape.prototype.SetIconUrl = function (a) {
this.IconUrl = a
};
VEShape.prototype.GetIconUrl = function () {
return this.IconUrl
};
VEShape.prototype.IsModel = function () {
return this.ModelRep == null && this.ModelData == null ? false : true
};
VEShape.prototype.IsOverlay = function () {
return IsValidMapserviceType(this.mapserviceType) && this.mapserviceType != VEMapserviceType.None
};
VEShape.prototype.MovePrimitive = function (d, c) {
var d = parseFloat(d),
c = parseFloat(c);
if (isNaN(d) || isNaN(c)) return;
var f = null;
for (var e = 0; e < this.Primitives.length; e++) {
f = this.Primitives[e];
var b = f.points,
g = b.length;
for (var a = 0; a < g - 1; a = a + 2) {
b[a] = b[a] + d;
b[a + 1] = b[a + 1] + c
}
}
};
VEShape.prototype.Dispose = function () {
this.ClearAllPrimitives();
this.Boundingbox = null;
this._customIcon = null;
this._IconContent = null;
this._eroContent = null;
this._shplayer = null;
this.IconUrl = null;
this.Id = null;
this.Title = null;
this.Latitude = null;
this.Longitude = null;
this.RoutableLatitude = null;
this.RoutableLongitude = null;
this.Notes = null;
this.Keywords = null;
this.Url = null;
this.PhotoUrl = null;
this.UserDate = null;
this.DisplayOrder = null;
this.BusinessListingId = null;
this.IconId = null;
this.LastModified = null;
this.ViewPort = null;
this.Tour = null;
this.ModelRep = null;
this.ModelData = null;
this.SourceUrl = null;
this.SourceType = null;
this.Photos = null
};
VEShape.prototype.ToString = function () {
var a = "",
f = this.Primitives.length,
d = null;
for (var e = 0; e < f; e++) {
d = this.Primitives[e];
if (d.type == VEShapeType.Pushpin) a = a.concat("", d.points.join(","), "")
}
var b = "",
c = "";
a = a.concat("");
a = a.concat(b, this.GetBusinessListingId(), c, b, this.Url, c, b, this.PhotoUrl, c, b, this.Title, c, b, this.Type, c);
a = a.concat("");
a = a.concat("");
return a
};
function VE_3DViewPort() {
this.Latitude = 0;
this.Longitude = 0;
this.Altitude = 0;
this.Altitudemode = "Datum";
this.Pitch = 0;
this.Heading = 0;
this.Mapstyle = "r";
this.SceneId = 0;
this.Properties = null
}
function VE_3DModelRep() {
this.Transform = null;
this.ModelRefId = null;
this.MinBounds = null;
this.MaxBounds = null;
this.Properties = null;
this.R2eoffset = null
}
function VE_3DModelData() {
this.Properties = null;
this.Callback = null
}
function VE_3DTour() {
this.Actions = null
}
function VE_Photo() {
this.Id = null;
this.Url = null;
this.Properties = null
}
VEShape.prototype.SetPhotos = function (a) {
this.Photos = a
};
function _VE_EntityDrawingState() {
this.zIndexIcon = null;
this.zIndexPolyShape = null;
this.minZoomLevel = null;
this.maxZoomLevel = null;
this.isShared = null;
this.parentEl = null;
this.text = null
}
function _VE_CreateServiceInstance(a) {
switch (a) {
case _VE_ServiceType.MapCruncher:
return new VETileSourceSpecification;
default:
return null
}
return null
}
_VE_ServiceType = {
MapCruncher: "t",
NetworkLink: "n"
};
VEShape.Decoder = new _xy1;
VEShape.LatLongFactory = new VELatLongFactory(new VELatLongFactoryAlwaysEncodeSpec);
VEShape.prototype._Construct = function (j, g, e) {
var a = [],
d = [],
k = false,
f = null;
if (typeof g != "undefined") {
if (g == MC_VESHAPE_EMPTY && j) {
this.maxZoomLevel = Msn.VE.API.Globals.veshapemaxzoom;
this.minZoomLevel = Msn.VE.API.Globals.veshapeminzoom;
this._eroContent = null;
this._shplayer = null;
return
}
} else throw new VEException("VEShape", "err_invalidargument", L_invalidargument_text.replace("%1", "type").replace("%2", "VEShapeType"));
if (typeof e == "object") if (typeof e.length == "number") {
var l = e.length;
for (var h = 0; h < l; h++) if (e[h] instanceof VELatLong) {
var c = VEShape.Decoder.Decode(e[h]);
if (e[h]._reserved) this.SetEncrypted();
a.push(c.Longitude);
a.push(c.Latitude);
if (c.Altitude != null) {
if (c.AltitudeMode != null) if (f != null && f != c.AltitudeMode) throw new VEException("VEShape", "err_altitudemodemismatch", L_altitudemodemismatch_Text);
else f = c.AltitudeMode;
k = true;
d.push(c.Altitude)
} else d.push(0)
} else throw new VEException("VEShape", "err_invalidargument", L_invalidargument_text.replace("%1", "points[" + h + "]").replace("%2", "VELatLong"))
} else if (e instanceof VELatLong) {
var c = VEShape.Decoder.Decode(e);
if (e._reserved) this.SetEncrypted();
a.push(c.Longitude);
a.push(c.Latitude);
if (c.Altitude != null) {
k = true;
f = c.AltitudeMode;
d.push(c.Altitude)
}
} else throw new VEException("VEShape", "err_invalidargument", L_invalidargument_text.replace("%1", "points").replace("%2", "VELatLong"));
else throw new VEException("VEShape", "err_invalidargument", L_invalidargument_text.replace("%1", "points").replace("%2", "VELatLong[]"));
var b = null,
i = a.length;
if (g == VEShapeType.Pushpin) {
if (i < 2) throw new VEException("VEShape", "err_incorrectpoints", L_Shp_IncorrectPoints_Text);
if (j) b = new Msn.Drawing.Point(a[0], a[1])
} else if (g == VEShapeType.Polyline) {
if (i < 3) throw new VEException("VEShape", "err_incorrectpoints", L_Shp_IncorrectPoints_Text);
if (j) b = new Msn.Drawing.PolyLine(a)
} else if (g == VEShapeType.Polygon) {
if (i < 5) throw new VEException("VEShape", "err_incorrectpoints", L_Shp_IncorrectPoints_Text);
if (a[0] != a[i - 2] || a[1] != a[i - 1] || k && d[0] != d[i / 2 - 1]) {
a.push(a[0]);
a.push(a[1]);
d.push(d[0])
}
if (j) b = new Msn.Drawing.Polygon(a)
} else throw new VEException("VEShape", "err_invalidargument", L_invalidargument_text.replace("%1", "type").replace("%2", "VEShapeType"));
if (j) {
this.maxZoomLevel = Msn.VE.API.Globals.veshapemaxzoom;
this.minZoomLevel = Msn.VE.API.Globals.veshapeminzoom;
this._eroContent = null;
this._shplayer = null;
this._shapeElement = null;
this._iconElement = null;
this._isClipped = false;
if (k) {
b.altitudes = d;
if (f) b.altitudeMode = f;
else b.altitudeMode = VEAltitudeMode.Default
} else {
b.altitudes = null;
b.altitudeMode = VEAltitudeMode.Default
}
if (typeof VE_MapDispatch_SymbolLib != "undefined") {
if (g == VEShapeType.Pushpin) b.symbol = VE_MapDispatch_SymbolLib.GetMapSymbolByID(MC_PROPERTY_PUSHPIN);
else b.symbol = VE_MapDispatch_SymbolLib.GetCurrentDefaultSymbol();
b.symbol.imagedata_src = Msn.VE.API.Constants.iconurl;
b.symbol.style_zIndex = Msn.VE.API.Globals.veshapeiconzindex;
b.symbol.style_zIndex_polyshape = Msn.VE.API.Globals.veshapepolyshapezindex;
this.AddPrimitive(b)
} else throw new VEException("VEShape:new VEShape", "err_notinitialized", L_shp_Notinitialized_text)
} else {
this.Primitives[0].points = a;
if (k) {
this.Primitives[0].altitudes = d;
if (f) this.Primitives[0].altitudeMode = f;
else this.Primitives[0].altitudeMode = VEAltitudeMode.Default
} else {
this.Primitives[0].altitudes = null;
this.Primitives[0].altitudeMode = VEAltitudeMode.Default
}
}
};
VEShape.prototype.GetShapeType = function () {
return this.Primitives[0].type
};
VEShape.prototype.GetShapeLayer = function () {
return this._shplayer
};
VEShape.prototype.GetID = function () {
if (this._shplayer == null) return null;
return this.GetId()
};
VEShape.prototype.Show = function () {
this.SetVisibility(true);
if (this._shplayer == null || this._shplayer._mapGuid == null) return;
vmap = GetVEMapInstance(this._shplayer._mapGuid);
if (vmap == null) return;
if (this._shplayer.GetVisibility()) {
vmap.m_vegraphicsmanager.ClearEntityDom(this);
if (this._shplayer._clusterLayer) this._shplayer.Cluster();
else vmap.m_vegraphicsmanager.DrawEntity(this);
vmap.m_vegraphicsmanager.PushOffsetRequest()
}
};
VEShape.prototype.Redraw = function (c, d, e, f, b) {
if (this.GetVisibility() && this._shplayer && this._shplayer._mapGuid && this._shplayer.GetVisibility()) {
var a = GetVEMapInstance(this._shplayer._mapGuid);
if (a == null) return;
if (a.GetMapMode() == Msn.VE.MapActionMode.Mode3D || !this._isDrawn) this.Show();
else {
if (c) a.m_vegraphicsmanager.UpdatePoints(this, true);
if (d) a.m_vegraphicsmanager.UpdateIconPoints(this);
if (e) a.m_vegraphicsmanager.UpdateStyle(this);
if (f) a.m_vegraphicsmanager.UpdateIconStyle(this);
if (b) if (this.GetIconVisibility()) a.m_vegraphicsmanager.ShowIcon(this);
else a.m_vegraphicsmanager.HideIcon(this)
}
}
};
VEShape.prototype.Hide = function () {
this.SetVisibility(false);
if (this._shplayer == null || this._shplayer._mapGuid == null) return;
vmap = GetVEMapInstance(this._shplayer._mapGuid);
if (vmap == null) return;
vmap.m_vegraphicsmanager.ClearEntityDom(this);
if (this._shplayer.GetVisibility()) this._shplayer.Cluster()
};
VEShape.prototype.SetIconVisibility = function (a) {
if (this.Primitives[0].type != VEShapeType.Pushpin) this.Primitives[0].isLabel = a
};
VEShape.prototype.HideIcon = function () {
if (this.Primitives[0].type != VEShapeType.Pushpin || this.IsModel()) this.Primitives[0].isLabel = false;
if (this._shplayer == null || this._shplayer._mapGuid == null) return;
this.Redraw(false, false, false, false, true)
};
VEShape.prototype.ShowIcon = function () {
if (this.Primitives[0].type != VEShapeType.Pushpin || this.IsModel()) this.Primitives[0].isLabel = true;
if (this._shplayer == null || this._shplayer._mapGuid == null) return;
this.Redraw(false, false, false, false, true)
};
VEShape.prototype.GetIconVisibility = function () {
if (this.Primitives[0].type != VEShapeType.Pushpin) return this.Primitives[0].isLabel;
else return true
};
VEShape.prototype.GetPoints = function () {
var d = [],
b = this.Primitives[0].points,
e = this.Primitives[0].altitudes,
f = b.length;
for (var a = 0; a < f - 1; a = a + 2) {
var c = null;
if (this.IsEncrypted()) c = VEShape.LatLongFactory.CreateVELatLong(b[a + 1], b[a]);
else c = new VELatLong(b[a + 1], b[a]);
if (e) c.SetAltitude(e[a / 2], this.Primitives[0].altitudeMode);
d.push(c)
}
return d
};
VEShape.prototype.SetPoints = function (b) {
if (this.IsModel()) return false;
this._Construct(false, this.Primitives[0].type, b);
if (this._shplayer != null) this._shplayer.UpdateEntityAnnotation(this);
var a = this.Primitives[0];
Msn.Drawing.CalculateLabelPosition(a, true);
if (this.Primitives[0].type != VEShapeType.Pushpin) {
this.Latitude = a.labelPosY;
this.Longitude = a.labelPosX;
this.Altitude = a.labelPosZ
}
this.Redraw(true, true);
if (this._shplayer && this._shplayer._mapGuid && this._shplayer.GetVisibility() && this.GetVisibility()) this._shplayer.Cluster()
};
VEShape.prototype.SetTitle = function (a) {
if (typeof a != "undefined" && a != null) {
this._eroContent = null;
this.Title = a.replace(/%0D%0A/g, "\r\n").replace(/%0A/g, "\n")
}
};
VEShape.prototype.GetTitle = function () {
if (typeof this.Title == "undefined") this.Title = L_AnnotationConfDefaultTitle_Text;
return this.Title
};
VEShape.prototype.SetDescription = function (a) {
if (typeof a != "undefined" && a != null) {
this._eroContent = null;
this.Notes = a.replace(/%0D%0A/g, "\r\n").replace(/%0A/g, "\n")
}
};
VEShape.prototype.GetDescription = function () {
if (typeof this.Notes == "undefined") this.Notes = "";
return this.Notes
};
VEShape.prototype.SetMaxZoomLevel = function (a) {
a = parseInt(a);
if (isNaN(a) || a > this.maxZoomLevel) throw new VEException("VEShape.SetMaxZoomLevel", "err_incorrectzoomlevel", L_Shp_IncorrectZoomLevel_Text);
else if (a < this.minZoomLevel) throw new VEException("VEShape.SetMaxZoomLevel", "err_incorrectzoomlevel", L_Shp_IncorrectZoomLevel2_Text);
this.maxZoomLevel = a;
if (this.GetVisibility()) this.Show()
};
VEShape.prototype.GetMaxZoomLevel = function () {
return this.maxZoomLevel
};
VEShape.prototype.SetMinZoomLevel = function (a) {
a = parseInt(a);
if (isNaN(a) || a < 1) throw new VEException("VEShape.SetMinZoomLevel", "err_incorrectzoomlevel", L_Shp_IncorrectZoomLevel_Text);
else if (a > this.maxZoomLevel) throw new VEException("VEShape.SetMinZoomLevel", "err_incorrectzoomlevel", L_invalidminmaxzoom_text);
this.minZoomLevel = a;
if (this.GetVisibility()) this.Show()
};
VEShape.prototype.GetMinZoomLevel = function () {
return this.minZoomLevel
};
VEShape.prototype.GetCustomIcon = function () {
var a = null,
b = this.Primitives[0].symbol;
if (typeof b == "object" && b.isOn == true) {
a = new VECustomIconSpecification;
a.Image = b.imagedata_src;
a.TextBold = b.textbox_bold;
a.TextItalics = b.textbox_italic;
a.TextUnderline = b.textbox_underscore;
a.TextFont = b.textbox_font;
a.TextSize = b.textbox_size;
a.TextOffset = new VEPixel(b.textbox_OffsetX, b.textbox_OffsetY);
a.ImageOffset = new VEPixel(b.img_offsetX, b.img_offsetY);
a.CustomHTML = this._customIcon;
a.TextContent = this.Primitives[0].name;
a.ImageWidth = b.img_width;
a.ImageHeight = b.img_height;
var e = new VEHexStringToColor,
d = b.textbox_color;
if (d.indexOf("#") == 0) d = d.substring(1);
a.ForeColor = e.Convert(d);
a.ForeColor.A = b.textbox_color_opacity;
var c = b.textbox_backcolor;
if (c.indexOf("#") == 0) c = c.substring(1);
a.BackColor = e.Convert(c);
a.BackColor.A = b.textbox_backcolor_opacity
} else a = this._customIcon;
return a
};
VEShape.prototype.SetCustomIcon = function (b) {
if (typeof b == "undefined" || b == null) return null;
if (typeof b == "object") {
VEValidator.ValidateObject(b, "_content_", VECustomIconSpecification, "VECustomIconSpecification");
if (typeof b.TextContent == "string" && b.TextContent != null) this.Primitives[0].name = b.TextContent;
var a = this.Primitives[0].symbol;
if (a.id == MC_PROPERTY_PARK || a.id == MC_PROPERTY_PUSHPIN) a = a.Clone();
if (typeof b.Image == "string" && b.Image != null) a.imagedata_src = GetImageFullUrl(b.Image);
else a.imagedata_src = Msn.VE.API.Constants.iconurl;
var e = b.ForeColor;
if (typeof e == "object" && e != null) {
VEValidator.ValidateObject(e, "fC", VEColor, "VEColor");
a.textbox_color = e.ToHexString();
a.textbox_color_opacity = e.A
}
var d = b.BackColor;
if (typeof d == "object" && d != null) {
VEValidator.ValidateObject(d, "bC", VEColor, "VEColor");
a.textbox_backcolor = d.ToHexString();
a.textbox_backcolor_opacity = d.A
}
var g = b.TextOffset;
if (typeof g == "object" && g != null) {
VEValidator.ValidateObject(g, "tO", VEPixel, "VEPixel");
a.textbox_OffsetX = b.TextOffset.x;
a.textbox_OffsetY = b.TextOffset.y
}
var f = b.ImageOffset;
if (typeof f == "object" && f != null) {
VEValidator.ValidateObject(f, "iO", VEPixel, "VEPixel");
a.img_offsetX = f.x;
a.img_offsetY = f.y
}
if (b.TextBold) a.textbox_bold = true;
if (b.TextItalics) a.textbox_italic = true;
if (b.TextUnderline) a.textbox_underscore = true;
var l = parseInt(b.ImageWidth);
if (!isNaN(l)) a.img_width = l;
var k = parseInt(b.ImageHeight);
if (!isNaN(k)) a.img_height = k;
a.textbox_font = b.TextFont;
a.imagedata_on = true;
var i = parseInt(b.TextSize);
if (!isNaN(i)) a.textbox_size = i;
a.isOn = true;
this.Primitives[0].symbol = a;
if (b.CustomHTML != null) this._customIcon = b.CustomHTML;
else if (this.Primitives[0].name) {
var c = [];
c.push("
");
c.push("
");
c.push(this.Primitives[0].name);
c.push("
");
c.push(" ');
else c.push("/>");
c.push("
");
this._customIcon = c.join("")
} else this._customIcon = a.imagedata_src
} else if (typeof b == "string") {
this._customIcon = b;
if (b.indexOf("<") < 0) {
var a = this.Primitives[0].symbol;
if (a.id == MC_PROPERTY_PARK || a.id == MC_PROPERTY_PUSHPIN) a = a.Clone();
a.imagedata_src = GetImageFullUrl(b);
a.isOn = true;
this.Primitives[0].symbol = a
}
}
this._IconContent = null;
this.Redraw(false, false, false, true)
};
VEShape.prototype.GetIconAnchor = function () {
if (this.Altitude) return new VELatLong(this.Latitude, this.Longitude, this.Altitude, this.Primitives[0].altitudeMode);
else return new VELatLong(this.Latitude, this.Longitude)
};
VEShape.prototype.SetIconAnchor = function (a) {
if (this.IsModel()) return false;
if (a != null && a != "undefined") {
VEValidator.ValidateObject(a, "veLatlong", VELatLong, "VELatLong");
if (a.HasAltitude() && a.AltitudeMode != this.Primitives[0].altitudeMode) throw new VEException("VEShape", "err_altitudemodemismatch", L_altitudemodemismatch_Text);
var b = this.Primitives[0];
if (b.type != VEShapeType.Pushpin) {
this.Latitude = a.Latitude;
this.Longitude = a.Longitude;
b.labelPosX = this.Longitude;
b.labelPosY = this.Latitude;
if (a.HasAltitude()) {
this.Altitude = a.Altitude;
b.labelPosZ = a.Altitude
} else {
this.Altitude = null;
b.labelPosZ = null
}
} else this.SetPoints(a)
}
this.Redraw(false, true)
};
VEShape.prototype.GetCustomInfoBox = function () {
return this._eroContent
};
VEShape.prototype.SetCustomInfoBox = function (a) {
if (typeof a != "undefined" && a != null) this._eroContent = a.replace(/%0D%0A/g, "\r\n").replace(/%0A/g, "\n")
};
VEShape.prototype.SetZIndex = function (c, b) {
if (c != null) VEValidator.ValidateInt(c, "icon");
if (b != null) VEValidator.ValidateInt(b, "polyshape");
if (c == null && b == null) throw new VEException("VEShape.SetZIndex", "L_invalidzindex_text", L_invalidzindex_text);
var a = this.Primitives[0].symbol;
if (a.id == MC_PROPERTY_PARK || a.id == MC_PROPERTY_PUSHPIN) a = a.Clone();
if (c != null) a.style_zIndex = parseInt(c);
if (b != null) a.style_zIndex_polyshape = parseInt(b);
this.Primitives[0].symbol = a;
this.Redraw(false, false, true, true)
};
VEShape.prototype.GetZIndex = function () {
if (this.Primitives[0].symbol != null && this.Primitives[0].symbol.style_zIndex != null) return this.Primitives[0].symbol.style_zIndex;
else return Msn.VE.API.Globals.veshapeiconzindex
};
VEShape.prototype.GetZIndexPolyShape = function () {
if (this.Primitives[0].symbol != null && this.Primitives[0].symbol.style_zIndex_polyshape != null) return this.Primitives[0].symbol.style_zIndex_polyshape;
else return Msn.VE.API.Globals.veshapepolyshapezindex
};
VEShape.prototype.SetLineColor = function (b) {
if (this.Primitives[0].type == VEShapeType.Pushpin) return false;
if (typeof b == "object" && b != null) {
VEValidator.ValidateObject(b, "_color", VEColor, "VEColor");
var a = this.Primitives[0].symbol;
if (a.id == MC_PROPERTY_PARK || a.id == MC_PROPERTY_PUSHPIN) a = a.Clone();
a.stroke_color = b.ToHexString();
a.stroke_opacity = b.A;
this.Primitives[0].symbol = a;
this.Redraw(false, false, true, false)
} else if (typeof b != "undefined") throw new VEException("SetLineColor", "err_invalidargument", L_invalidargument_text.replace("%1", "color").replace("%2", "VEColor"))
};
VEShape.prototype.GetLineColor = function () {
if (this.Primitives[0].type == VEShapeType.Pushpin) return null;
var c = this.Primitives[0].symbol,
e = new VEHexStringToColor,
a = c.stroke_color;
if (a.indexOf("#") == 0) a = a.substring(1);
var b = e.Convert(a),
d = c.stroke_opacity.toString();
if (d.indexOf("%") > 0) b.A = parseInt(d) / 100;
else b.A = c.stroke_opacity;
return b
};
VEShape.prototype.SetFillColor = function (b) {
if (this.Primitives[0].type == VEShapeType.Pushpin) return false;
if (typeof b == "object" && b != null) {
VEValidator.ValidateObject(b, "_color", VEColor, "VEColor");
var a = this.Primitives[0].symbol;
if (a.id == MC_PROPERTY_PARK || a.id == MC_PROPERTY_PUSHPIN) a = a.Clone();
a.fill_color = b.ToHexString();
a.fill_opacity = b.A;
this.Primitives[0].symbol = a;
this.Redraw(false, false, true, false)
} else if (typeof b != "undefined") throw new VEException("SetFillColor", "err_invalidargument", L_invalidargument_text.replace("%1", "color").replace("%2", "VEColor"))
};
VEShape.prototype.GetFillColor = function () {
if (this.Primitives[0].type == VEShapeType.Pushpin) return null;
var c = this.Primitives[0].symbol,
e = new VEHexStringToColor,
a = c.fill_color;
if (a.indexOf("#") == 0) a = a.substring(1);
var b = e.Convert(a),
d = c.fill_opacity.toString();
if (d.indexOf("%") > 0) b.A = parseInt(d) / 100;
else b.A = c.fill_opacity;
return b
};
VEShape.prototype.SetLineWidth = function (c) {
if (this.Primitives[0].type == VEShapeType.Pushpin) throw new VEException("VEShape.SetLineWidth", "err_invalidlinewidth", L_Shp_IncorrectLineWidth_Text);
var b = parseInt(c);
if (isNaN(b) || b < 1) throw new VEException("VEShape.SetLineWidth", "err_invalidlinewidth", L_Shp_IncorrectLineWidth_Text);
var a = this.Primitives[0].symbol;
if (a.id == MC_PROPERTY_PARK || a.id == MC_PROPERTY_PUSHPIN) a = a.Clone();
a.stroke_weight = b;
this.Primitives[0].symbol = a;
this.Redraw(false, false, true, false)
};
VEShape.prototype.GetLineWidth = function () {
if (this.Primitives[0].type == VEShapeType.Pushpin) return null;
var a = parseInt(this.Primitives[0].symbol.stroke_weight);
if (isNaN(a)) return 0;
else return a
};
VEShape.prototype.SetPhotoURL = function (a) {
this._eroContent = null;
this.PhotoUrl = a
};
VEShape.prototype.GetPhotoURL = function () {
return this.PhotoUrl
};
VEShape.prototype.SetMoreInfoURL = function (a) {
this._eroContent = null;
this.Url = a
};
VEShape.prototype.GetMoreInfoURL = function () {
return this.Url
};
VEShapeLayer.prototype.GetBoundingRectangle = function () {
var a = this.GetBoundingBox();
return new VELatLongRectangle(new VELatLong(a.y2, a.x1), new VELatLong(a.y1, a.x2))
};
VEShape.prototype._OffsetScene = null;
VEShape.prototype._OffsetLatLong = null;
VEShape.prototype._OffsetPoints = null;
VEShape.prototype._OriginalPoints = null;
VEShape.prototype._UsingOffset = false;
VEShape.prototype.SetUseOffset = function (b) {
if (this._UsingOffset != b) {
this._UsingOffset = b;
if (b) {
if (this._OffsetPoints != null) {
var a = [];
for (var c = 0; c < this._OffsetPoints.length; c++) {
var d = VEShape.Decoder.Decode(this._OffsetPoints[c]);
a.push(d.Longitude);
a.push(d.Latitude)
}
this._OriginalPoints = this.Primitives[0].points;
this.Primitives[0].points = a
}
} else if (this._OriginalPoints != null) {
this.Primitives[0].points = this._OriginalPoints;
this._OriginalPoints = null
}
}
};
VEShape.prototype.GetUseOffset = function () {
return this._UsingOffset
};
VEAltitudeMode = new function () {
this.Default = "Ground";
this.Absolute = "Datum";
this.RelativeToGround = "Ground"
};
VEShape.prototype.SetAltitude = function (a, f) {
if (this.IsModel()) return false;
var b = this.Primitives[0],
d = b.points.length / 2,
e = [];
if (typeof a == "number") {
VEValidator.ValidateFloat(a, "altitude");
a = parseFloat(a);
for (var c = 0; c < d; c++) e.push(a)
} else if (a instanceof Array) if (a.length == d && (a[0] == a[d - 1] || this.Primitives[0].type != VEShapeType.Polygon) || a.length == d - 1 && this.Primitives[0].type == VEShapeType.Polygon) {
for (var c = 0; c < a.length; c++) {
VEValidator.ValidateFloat(a[c], "altitude[" + c + "]");
e.push(parseFloat(a[c]))
}
if (a.length == d - 1) e.push(parseFloat(a[0]))
} else throw new VEException("VEShape", "err_incorrectpoints", L_Shp_IncorrectPoints_Text);
else throw new VEException("VEShape:SetAltitude", "err_invalidargument", L_invalidargument_text.replace("%1", "altitude").replace("%2", "float"));
if (f != null) {
VEValidator.ValidateAltitudeMode(f, "altitudeMode");
b.altitudeMode = f
}
b.altitudes = e;
Msn.Drawing.CalculateLabelPosition(b, true);
if (b.type != VEShapeType.Pushpin) {
this.Latitude = b.labelPosY;
this.Longitude = b.labelPosX;
this.Altitude = b.labelPosZ
}
this.Redraw(false, true)
};
VEShape.prototype.GetAltitude = function () {
return this.Primitives[0].altitudes
};
VEShape.prototype.SetAltitudeMode = function (b) {
if (this.IsModel()) return false;
VEValidator.ValidateAltitudeMode(b, "value");
var a = this.Primitives[0];
a.altitudeMode = b;
if (!a.altitudes) this.SetAltitude(0);
this.Redraw(true, true)
};
VEShape.prototype.GetAltitudeMode = function () {
return this.Primitives[0].altitudeMode
};
VEShape.prototype.SetLineToGround = function (a) {
if (this.IsModel()) return false;
VEValidator.ValidateBoolean(a, "value");
if (this.Primitives[0].type != VEShapeType.Pushpin) {
this.Primitives[0].extruded = a;
this.Redraw(true, true)
}
};
VEShape.prototype.GetLineToGround = function () {
if (this.Primitives[0].extruded != null) return this.Primitives[0].extruded;
else return null
};
VEShape.prototype.ToHtml = function () {
var a = [],
b = GetVEMapInstance(this._shplayer._mapGuid);
if (b && b.vemapcontrol) {
var c = b.vemapcontrol.GetPushpinMapPixel(new Msn.VE.LatLong(this.Latitude, this.Longitude), b.vemapcontrol.GetZoomLevel());
a.push("');
a.push(VECreateVEShapeERO(this, this._shplayer._mapGuid));
a.push("")
}
return a.join("")
};
VEShape.prototype._isDrawn = false;
VEShape.prototype._isHiddenForZoom = false;
VEShape.prototype.GetShapeElement = function () {
var a = this.Primitives[0];
if (this._isDrawn && a && a.type != VEShapeType.Pushpin) {
if (a._shapeElement == null) a._shapeElement = $ID(a.iid);
return a._shapeElement
}
return null
};
VEShape.prototype.GetIconElement = function () {
var a = this.Primitives[0];
if (this._isDrawn && a) {
if (a._iconElement == null) if (a.type == VEShapeType.Pushpin) a._iconElement = $ID(a.iid);
else a._iconElement = $ID(Msn.Drawing.GetLabelUID(a.iid));
return a._iconElement
}
return null
};
VEShape.prototype.ClearDomElements = function () {
var a = this.Primitives[0];
if (a) {
a._shapeElement = null;
a._iconElement = null
}
};
VEShape.prototype.DisposeEx = function () {
this.ClearDomElements();
this.Dispose()
};
VEShape.prototype.Draggable = false;
VEShape.prototype.onstartdrag = null;
VEShape.prototype.ondrag = null;
VEShape.prototype.onenddrag = null;
function ShapeDragEventArgs(b, a) {
this.Shape = b;
this.LatLong = a
}
function VECustomIconSpecification() {
this.Image = null;
this.TextContent = null;
this.CustomHTML = null;
this.textFont = "Arial";
this.TextBold = false;
this.TextItalics = false;
this.TextUnderline = false;
this.TextSize = 7;
this.ImageOffset = null;
this.TextOffset = null;
this.ForeColor = null;
this.BackColor = null;
this.ImageWidth = -1;
this.ImageHeight = -1
}
function VEClusteringOptions() {
this.Icon = null;
this.Callback = null
}
VEClusteringType = new function () {
this.None = 0;
this.Grid = 1
};
function VEClusterSpecification() {
this._clusterShape = null;
this.Shapes = [];
this.LatLong = null;
VEClusterSpecification.prototype.GetClusterShape = function () {
return this._clusterShape
}
}
VE_SetModuleStatus(VE_ModuleName.APILAYERS, "loaded");
VEMap.prototype.InitMapDrawing = function () {
cssCursors = Msn.VE.Css.Cursors;
if (VE_MapDispatch_SymbolLib == null) {
VE_MapDispatch_SymbolLib = new VEShapeStyleLibrary;
VEShapeStyle.prototype.imagedata_src = Msn.VE.API.Constants.iconurl
}
if (this.m_velayermanager == null) {
this.m_velayermanager = new VELayerManager(this);
this._lm = this.m_velayermanager
}
};
VEMap.prototype.InitTiles = function () {
if (!this.m_vetilesourcemanager) this.m_vetilesourcemanager = new VETileSourceManager(this)
};
VEMap.prototype.AddTileLayer = function (a, b, c) {
VEValidator.ValidateObject(a, "tileSourceSpec", VETileSourceSpecification, "VETileSourceSpecification");
this.m_vetilesourcemanager.AddTileSource(a, c, b)
};
VEMap.prototype.ShowTileLayer = function (a) {
this.m_vetilesourcemanager.ShowTileLayer(a)
};
VEMap.prototype.ShowAllTileLayers = function () {
this.m_vetilesourcemanager.ShowAllTileLayers()
};
VEMap.prototype.HideTileLayer = function (a) {
this.m_vetilesourcemanager.HideTileLayer(a)
};
VEMap.prototype.ShowBaseTileLayer = function () {
this.m_vetilesourcemanager.ShowBaseTileLayer()
};
VEMap.prototype.HideBaseTileLayer = function () {
this.m_vetilesourcemanager.HideBaseTileLayer()
};
VEMap.prototype.HideAllTileLayers = function () {
this.m_vetilesourcemanager.HideAllTileLayers()
};
VEMap.prototype.DeleteTileLayer = function (a) {
this.m_vetilesourcemanager.DeleteSourceById(a)
};
VEMap.prototype.DeleteAllTileLayers = function () {
this.m_vetilesourcemanager.DeleteAllSources()
};
VEMap.prototype.GetTileLayerCount = function () {
return this.m_vetilesourcemanager.GetSourceCount()
};
VEMap.prototype.GetTileLayerByID = function (a) {
return this.m_vetilesourcemanager.GetSourceById(a)
};
VEMap.prototype.GetTileLayerByIndex = function (a) {
return this.m_vetilesourcemanager.GetSourceByIndex(a)
};
function VETileSourceSpecification(h, i, d, g, f, e, c, a, b) {
this.ID = null;
this.TileSource = null;
this.NumServers = 1;
this.Bounds = null;
this.MinZoomLevel = 0;
this.MaxZoomLevel = 1;
this.GetTilePath = null;
this.Opacity = null;
this.ZIndex = null;
this.SetsBestMapView = true;
this.FnCallback = null;
this.IsVisible = true;
this.LoadTiles = true;
if (typeof h == "string") this.ID = h;
else throw new VEException("VETileSourceSpecification", "err_invalidargument", L_invalidargument_text.replace("%1", "ID").replace("%2", "string"));
if (typeof i == "string") this.TileSource = i.replace(/%20/g, " ");
else throw new VEException("VETileSourceSpecification", "err_invalidargument", L_invalidargument_text.replace("%1", "tileSource").replace("%2", "string"));
if (d != "undefined" && d != null) this.NumServers = d;
if (g != "undefined" && g != null) this.Bounds = g;
if (f != "undefined" && f != null) this.MinZoomLevel = f;
if (e != "undefined" && e != null) this.MaxZoomLevel = e;
if (c != "undefined" && c != null) this.GetTilePath = c;
if (a != "undefined" && a != null) {
VEValidator.ValidateFloat(a, "Opacity");
if (a < 0 || a > 1) throw new VEException("VEMap:AddTileLayer", "err_invalidOpacity", L_invalidopacity_text);
this.Opacity = a
}
if (b != "undefined" && b != null) {
VEValidator.ValidateInt(b, "ZIndex");
this.ZIndex = b
} else this.ZIndex = Msn.VE.API.Globals.vetilelayerdefaultzindex
}
function VETileSourceManager(a) {
var b = this;
VEValidator.ValidateNonNull(a, "vemap");
this.m_vemap = a;
this.m_vemapcontrol = this.m_vemap.vemapcontrol;
this.m_vetilesources = [];
this.AddTileSource = function (a, d, c) {
VEValidator.ValidateObject(a, "tileSourceSpec", VETileSourceSpecification, "VETileSourceSpecification");
VEValidator.ValidateNonNull(a.ID, "tileSourceSpec.ID");
if (a.MinZoomLevel != null) VEValidator.ValidateNonNegativeInt(a.MinZoomLevel, "tileSourceSpec.MinZoomLevel");
if (a.MaxZoomLevel != null) {
VEValidator.ValidateNonNegativeInt(a.MaxZoomLevel, "tileSourceSpec.MaxZoomLevel");
VEValidator.ValidateMaxZoom(a.MaxZoomLevel, "tileSourceSpec.MaxZoomLevel")
}
if (a.MinZoomLevel != null && a.MaxZoomLevel != null) if (a.MinZoomLevel > a.MaxZoomLevel) throw new VEException("VETileSourceManager:AddVETileSource", "err_invalidsourceid", L_invalidminmaxzoom_text);
if (a.Bounds) {
var e = a.Bounds.length;
for (var b = 0; b < e; b++) VEValidator.ValidateBounds(a.Bounds[b], "VETileSourceManager.Bounds[" + b + "]")
}
if (typeof d == "function") a.FnCallback = d;
if (typeof c != "undefined" && (c == "false" || !c)) a.IsVisible = false;
this.AddVETileSourceSpec(a)
};
this.AddVETileSourceSpec = function (b) {
var c = this.GetSourceById(b.ID);
if (c != null && c != "undefined") throw new VEException("VETileSourceManager:AddVETileSource", "err_invalidsourceid", L_invalidsourceid_text);
this.m_vetilesources.push(b);
a.vemapcontrol.SetTileSource(b);
if (b.IsVisible) a.vemapcontrol.LoadTileLayer(b.ID, b.ID, b.Opacity, b.ZIndex);
if (b.FnCallback) b.FnCallback(b)
};
this.GetSourceById = function (c) {
var b = this.m_vetilesources.length;
for (var a = 0; a < b; ++a) if (this.m_vetilesources[a].ID == c) return this.m_vetilesources[a];
return null
};
this.GetSourceCount = function () {
return this.m_vetilesources.length
};
this.GetSourceByIndex = function (b) {
var a = null;
if (this.m_vetilesources && this.m_vetilesources[b]) a = this.m_vetilesources[b];
return a
};
this.ShowTileLayer = function (c) {
if (this.m_vetilesources == null || this.m_vetilesources == "undefined") {
throw new VEException("VEMap:RemoveSourcebyId", "err_GraphicsInitError", L_GraphicsInitError_Text);
return
}
var b = this.GetSourceById(c);
if (b) {
b.IsVisible = true;
a.vemapcontrol.SetTileLayerVisibility(b.ID, true);
a.vemapcontrol.LoadTileLayer(b.ID, b.ID, b.Opacity, b.ZIndex)
} else {
throw new VEException("VEMap:HideSourcebyId", "err_invalidsourceid", L_invalidsourceid_text);
return
}
};
this.ShowAllTileLayers = function () {
if (this.m_vetilesources == null || this.m_vetilesources == "undefined") {
throw new VEException("VEMap:HideAllTileLayersbyId", "err_GraphicsInitError", L_GraphicsInitError_Text);
return
}
var b = this.m_vetilesources.length;
for (var a = 0; a < b; ++a) this.ShowTileLayer(this.m_vetilesources[a].ID)
};
this.HideAllTileLayers = function () {
if (this.m_vetilesources == null || this.m_vetilesources == "undefined") {
throw new VEException("VEMap:HideAllTileLayersbyId", "err_GraphicsInitError", L_GraphicsInitError_Text);
return
}
var b = this.m_vetilesources.length;
for (var a = 0; a < b; ++a) this.HideTileLayer(this.m_vetilesources[a].ID)
};
this.HideTileLayer = function (c) {
if (this.m_vetilesources == null || this.m_vetilesources == "undefined") {
throw new VEException("VEMap:RemoveSourcebyId", "err_GraphicsInitError", L_GraphicsInitError_Text);
return
}
var b = this.GetSourceById(c);
if (b) {
if (b.IsVisible) {
b.IsVisible = false;
a.vemapcontrol.SetTileLayerVisibility(b.ID, false);
a.vemapcontrol.LoadTileLayer(b.ID, b.ID, b.Opacity, b.ZIndex)
}
} else {
throw new VEException("VEMap:HideSourcebyId", "err_invalidsourceid", L_invalidsourceid_text);
return
}
};
this.HideBaseTileLayer = function () {
a.vemapcontrol.HideBaseTileLayer()
};
this.ShowBaseTileLayer = function () {
a.vemapcontrol.ShowBaseTileLayer()
};
this.DeleteSourceById = function (b) {
if (this.m_vetilesources == null || this.m_vetilesources == "undefined") {
throw new VEException("VEMap:RemoveSourcebyId", "err_GraphicsInitError", L_GraphicsInitError_Text);
return
}
var c = this.m_vetilesources.length,
a = 0;
while (a < c && b != this.m_vetilesources[a].ID) a++;
if (a < c) {
this.m_vemapcontrol.ClearTileLayer(b);
this.m_vemapcontrol.DeleteTileSource(b);
this.m_vetilesources[a] = null;
this.m_vetilesources.splice(a, 1)
} else {
throw new VEException("VEMap:RemoveSourcebyId", "err_invalidsourceid", L_invalidsourceid_text);
return
}
};
this.Dispose = function () {
this.DeleteAllSources();
this.m_vetilesources = null;
this.m_vemapcontrol = null;
this.m_vemap = null
};
this.DeleteAllSources = function () {
if (this.m_vetilesources == null || this.m_vetilesources == "undefined") {
throw new VEException("VEMap:RemoveSourcebyId", "err_GraphicsInitError", L_GraphicsInitError_Text);
return
}
var b = this.m_vetilesources.length;
for (var a = 0; a < b; ++a) if (this.m_vetilesources[a]) {
this.m_vemapcontrol.ClearTileLayer(this.m_vetilesources[a].ID);
this.m_vemapcontrol.DeleteTileSource(this.m_vetilesources[a].ID);
this.m_vetilesources[a] = null
}
this.m_vetilesources = []
}
}
VE_SetModuleStatus(VE_ModuleName.APITILES, "loaded");
VEMap.prototype.InitSearch = function () {
if (!this.m_vesearchmanager) {
this.m_vesearchmanager = new VE_SearchManager(this);
this.m_vesearchmanager.Initialize();
this._sm = this.m_vesearchmanager
}
};
VEMap.prototype.Find = function (l, j, i, f, g, b, e, d, a, c, h) {
this.InitSearch();
var k = new VEFindSpec(l, j, i, f, g, b, e, d, a, c, h);
this.m_vesearchmanager.Find(k)
};
VEMap.prototype.Geocode = function (c, b, a) {
if (a == null || typeof a == "undefined") a = new VEGeocodeOptions;
this.Find(null, c, null, null, null, null, null, null, a.UseDefaultDisambiguation, a.SetBestMapView, b)
};
VEMap.prototype.Search = function (d, c, a) {
this.InitSearch();
if (a == null || typeof a == "undefined") a = new VESearchOptions;
var b = new VEFindSpec(null, null, a.FindType, a.ShapeLayer, a.StartIndex, a.NumberOfResults, a.ShowResults, a.CreateResults, a.UseDefaultDisambiguation, a.SetBestMapView, c, d);
if (a.BoundingRectangle != null && a.BoundingRectangle instanceof VELatLongRectangle) b.WhereRect = a.BoundingRectangle;
this.m_vesearchmanager.Find(b)
};
VEMap.prototype.FindLocations = function (a, b) {
VEValidator.ValidateObject(a, "veLatLong", VELatLong, "VELatLong");
this.InitSearch();
this.m_vesearchmanager.ReverseGeocode(a, b)
};
VEMap.prototype.CreateFindControl = function (b) {
VEValidator.ValidateNonNull(b, "findControlId");
el = document.createElement("div");
el.className = "VE_FindControl";
el.id = b;
el.style.zIndex = 199;
el.style.position = "absolute";
el.style.padding = "5px";
function a(a) {
a.cancelBubble = true
}
el.attachEvent("onmousedown", a);
el.attachEvent("onmouseup", a);
el.attachEvent("onmousemove", a);
el.attachEvent("onmousewheel", a);
el.attachEvent("ondblclick", a);
el.attachEvent("oncontextmenu", a);
el.attachEvent("onclick", a);
var c = this.ID + "_vewhatinputcontainer",
e = this.ID + "_vewhatinput",
d = this.ID + "_vewhereinput";
el.innerHTML = "
" + L_what_text + " " + '' + "
" + "
" + L_where_text + " " + '" + "
" + "
" + '" + "
";
this.mapelement.appendChild(el);
addIFrameShim(el);
if (el.shimElement) el.shimElement.className = "VE_FindControl_Iframe";
return el
};
VEMap.prototype.ShowFindControl = function (c, b) {
if (typeof c != "undefined" || typeof b != "undefined") {
VEValidator.ValidateInt(c, "top");
VEValidator.ValidateInt(b, "left")
}
var d = this.ID + "_vefindcontrolinput",
a = $ID(d);
if (typeof a == "undefined" || a == null) a = this.CreateFindControl(d);
if (isNaN(c)) a.style.top = "35px";
else a.style.top = c + "px";
if (isNaN(b)) a.style.left = "195px";
else a.style.left = b + "px";
a.style.display = "block";
ShowShim(a)
};
VEMap.prototype.HideFindControl = function () {
var a = $ID(this.ID + "_vefindcontrolinput");
if (a != null && a != "undefined") {
a.style.display = "none";
HideShim(a)
}
};
VEMap.prototype.SetFindResultsPanel = function (a) {
if (a == null || a == "undefined") throw new VEException("VEMap:SetFindResultsPanel", "err_invalidelement", L_invalidelement_text);
var b = $ID(a);
if (b == null || b == "undefined") throw new VEException("VEMap:SetFindResultsPanel", "err_invalidelement", L_invalidelement_text);
this.searchelement = a
};
function VEMatchCode() {}
VEMatchCode.None = 0;
VEMatchCode.Good = 1;
VEMatchCode.Ambiguous = 2;
VEMatchCode.UpHierarchy = 4;
VEMatchCode.Modified = 8;
function VEMatchConfidence() {}
VEMatchConfidence.High = 0;
VEMatchConfidence.Medium = 1;
VEMatchConfidence.Low = 2;
function VELocationPrecision() {}
VELocationPrecision.Interpolated = 0;
VELocationPrecision.Rooftop = 1;
function VEGeocodeLocation(b, a) {
this.LatLong = b;
this.Precision = a
}
function VEPlace(e, d, a, b, c, g, f) {
VEValidator.ValidateNonNull(e, "name");
VEValidator.ValidateNonNull(d, "velatLong");
this.Name = e;
this.LatLong = d;
if (typeof a != "undefined" && a != null) this.LatLongRect = a;
else this.LatLongRect = null;
this.MatchConfidence = typeof b != "undefined" ? b : null;
this.MatchCode = typeof c != "undefined" ? c : null;
this.Precision = g;
this.Locations = f
}
function VEGeocodeOptions(b, a) {
this.SetBestMapView = b;
this.UseDefaultDisambiguation = a
}
function VESearchOptions(d, e, f, i, g, h, c, b, a) {
this.SetBestMapView = d;
this.CreateResults = e;
this.ShowResults = f;
this.FindType = i;
this.ShapeLayer = g;
this.StartIndex = h;
this.NumberOfResults = c;
this.BoundingRectangle = b;
this.UseDefaultDisambiguation = a
}
function VEFindSpec(l, a, j, g, h, b, f, e, c, d, i, k) {
this.DisambuigationCancelled = false;
this.WhatString = "";
this.WhatResults = null;
this.WhatHasMore = null;
if (l != null) {
if (typeof l != "string") throw new VEException("VEMap.Find", "err_invalidargument", L_invalidargument_text.replace("%1", "what").replace("%2", "string"));
this.WhatString = IOSec.EncodeUrl(l)
}
this.WhereString = "";
this.WhereRect = null;
this.WhereLatLong = null;
this.WhereResults = null;
if (a != null) if (a instanceof VELatLongRectangle) this.WhereRect = a;
else if (a instanceof VEPlace) {
this.WhereRect = a.LatLongRect;
this.WhereLatLong = a.LatLong;
this.WhereResults = a
} else if (a instanceof VELatLong) this.WhereLatLong = a;
else if (typeof a == "string") {
if (Msn.VE.API.Globals.locale.toLowerCase() == "zh-cn" && a.replace(/(^\s*)/g, "").toLowerCase().indexOf("map of ") != 0) a = "map of " + a;
this.WhereString = IOSec.EncodeUrl(a)
} else throw new VEException("VEMap.Find", "err_invalidargument", L_invalidwhere_text);
if (this.WhatString == "" && this.WhereString == "" && this.QueryString == "") throw new VEException("VEMap.Find", "err_invalidwhatwhere", L_invalidwhatwhere_text);
this.FindType = VEFindType.Businesses;
if (j != null) if (j == VEFindType.Businesses) this.FindType = j;
else throw new VEException("VEMap.Find", "err_invalidargument", L_invalidargument_text.replace("%1", "findType").replace("%2", "VEFindType"));
this.ShapeLayer = null;
if (g != null) {
VEValidator.ValidateObject(g, "shapeLayer", VEShapeLayer, "VEShapeLayer");
this.ShapeLayer = g
}
this.StartIndex = 0;
if (h != null) {
VEValidator.ValidateNonNegativeInt(h, "startIndex");
this.StartIndex = parseInt(h)
}
this.NumberOfResults = Msn.VE.API.Globals.vefindnumresultsdefault;
if (b != null) {
VEValidator.ValidateInt(b);
b = parseInt(b);
VEValidator.ValidateBetween(b, "numberOfResults", Msn.VE.API.Globals.vefindnumresultsmin, Msn.VE.API.Globals.vefindnumresultsmax);
this.NumberOfResults = b
}
this.ShowResults = true;
if (f != null) {
VEValidator.ValidateBoolean(f, "showResults");
this.ShowResults = f
}
this.CreateResults = true;
if (e != null) {
VEValidator.ValidateBoolean(e, "createResults");
this.CreateResults = e
}
this.UseDefaultDisambiguation = true;
if (c != null) {
VEValidator.ValidateBoolean(c, "useDefaultDisambiguation");
this.UseDefaultDisambiguation = c
}
this.SetBestMapView = true;
if (d != null) {
VEValidator.ValidateBoolean(d, "setBestMapView");
this.SetBestMapView = d
}
this.Callback = null;
if (i != null) if (typeof i == "function") this.Callback = i;
else throw new VEException("VEMap.Find", "err_invalidargument", L_invalidargument_text.replace("%1", "callback").replace("%2", "function"));
this.QueryString = "";
if (typeof k != "undefined" && k != null) this.QueryString = IOSec.EncodeUrl(k);
this.ErrorMessage = null
}
function VEFindResults(a, c, b) {
this.ShapeLayer = a;
this.Results = c;
this.HasMore = b
}
function VEFindResult(a, d, e, b, f, c, g) {
VEValidator.ValidateNonNull(a, "findType");
VEValidator.ValidateNonNull(e, "name");
VEValidator.ValidateNonNull(b, "description");
VEValidator.ValidateNonNull(c, "isSponsored");
this.findType = a;
this.FindType = a;
this.shape = d;
this.Shape = d;
this.Name = e;
this.Description = b;
this.LatLong = f;
this.IsSponsored = c;
this.Phone = g
}
VEFindType = new function () {
this.Businesses = "Business"
};
function VE_SearchManager(c) {
VEValidator.ValidateObject(c, "vemap", VEMap, "VEMap");
this.m_vemap = c;
var a = this,
b = new VELatLongFactory(new VELatLongFactorySpecFromMap(this.m_vemap));
this.m_showDisambigousDialog = true;
this._DisambiguateCallback = "VEMap._GetMapFromGUID(" + c.GUID + ")._sm.FindAmbiguousListCallBack";
var g = new _xy1,
e = null;
this.Initialize = function () {};
this.Find = function (b) {
if (b.QueryString.length > 0) h(b);
else if (b.WhereString.length > 0) i(b);
else if (b.WhatString.length > 0) j(b);
else {
if (b.SetBestMapView && b.DisambuigationCancelled == false) if (b.WhereRect != null) a.m_vemap.SetMapView(b.WhereRect);
else if (b.WhereLatLong != null && b.WhatResults != null) {
var d = [b.WhereLatLong];
for (var c = 0; c < b.WhatResults.length; c++) if (b.WhatResults[c].LatLong != null) d.push(b.WhatResults[c].LatLong);
a.m_vemap.SetMapView(d)
}
if (b.Callback != null) b.Callback(b.ShapeLayer, b.WhatResults, b.WhereResults, b.WhatHasMore, b.ErrorMessage);
else if (b.ErrorMessage != null && b.ErrorMessage.length != 0) this.m_vemap.ShowMessage(b.ErrorMessage)
}
};
function h(b) {
var g = d(f()),
e = [],
i = "",
g = "";
if (b.WhereRect != null) g = d(b.WhereRect);
else {
b.WhereRect = f();
g = d(b.WhereRect)
}
if (b.ShapeLayer == null) b.ShapeLayer = c.GetShapeLayerByIndex(0);
e.push(new VEParameter("count", b.NumberOfResults + 1));
e.push(new VEParameter("startingIndex", b.StartIndex));
e.push(new VEParameter("mapBounds", '"' + g + '"'));
e.push(new VEParameter("locationCoordinates", '"' + i + '"'));
e.push(new VEParameter("entityType", '"' + b.FindType + '"'));
e.push(new VEParameter("sortorder", ""));
e.push(new VEParameter("query", '"' + b.QueryString + '"'));
e.push(new VEParameter("location", ""));
e.push(new VEParameter("keyword", ""));
function h(c) {
a.SearchQueryResponseHandler(c, b)
}
c.vemapcontrol.Fire("onstartrequest");
VEAPIRequestInvoke(Msn.VE.API.Constants.searchservice, e, h, c)
}
function i(e) {
var h = d(f()),
b = [];
b.push(new VEParameter("count", e.NumberOfResults));
b.push(new VEParameter("query", '"' + e.WhereString + '"'));
b.push(new VEParameter("landmark", ""));
b.push(new VEParameter("addressLine", ""));
b.push(new VEParameter("locality", ""));
b.push(new VEParameter("postalTown", ""));
b.push(new VEParameter("adminDistrict", ""));
b.push(new VEParameter("district", ""));
b.push(new VEParameter("postalCode", ""));
b.push(new VEParameter("countryRegion", ""));
b.push(new VEParameter("mapBounds", '"' + h + '"'));
b.push(new VEParameter("currentLocation", ""));
b.push(new VEParameter("curLocAccuracy", ""));
b.push(new VEParameter("entityTypes", ""));
b.push(new VEParameter("rankBy", ""));
function g(b) {
if (a) a.GeocodeResponseHandler(b, e)
}
c.vemapcontrol.Fire("onstartrequest");
VEAPIRequestInvoke(Msn.VE.API.Constants.geocodingservice + "/Geocode", b, g, c)
}
function j(b) {
if (b.ShapeLayer == null) b.ShapeLayer = c.GetShapeLayerByIndex(0);
var j = "",
h = "";
if (b.WhereLatLong != null) {
var i = g.Decode(b.WhereLatLong);
j = i.Latitude + ", " + i.Longitude
} else if (b.WhereRect != null) h = d(b.WhereRect);
else {
b.WhereRect = f();
h = d(b.WhereRect)
}
var k = b.WhatString + " -location:jp",
e = [];
e.push(new VEParameter("count", b.NumberOfResults + 1));
e.push(new VEParameter("startingIndex", b.StartIndex));
e.push(new VEParameter("mapBounds", '"' + h + '"'));
e.push(new VEParameter("locationCoordinates", '"' + j + '"'));
e.push(new VEParameter("entityType", '"' + b.FindType + '"'));
e.push(new VEParameter("sortorder", ""));
e.push(new VEParameter("query", ""));
e.push(new VEParameter("location", ""));
e.push(new VEParameter("keyword", '"' + k + '"'));
function l(c) {
a.SearchResponseHandler(c, b)
}
c.vemapcontrol.Fire("onstartrequest");
VEAPIRequestInvoke(Msn.VE.API.Constants.searchservice, e, l, c)
}
this.GeocodeResponseHandler = function (f, d) {
a.m_vemap.vemapcontrol.Fire("onendrequest");
a.m_vemap.__HandleAuthentication(f);
var g = [];
if (f && f.Results && f.Results.length > 0) {
var n = f.Results[0].MatchConfidence,
o = f.Results.length,
h = [];
for (var k = 0; k < o; ++k) {
var c = f.Results[k],
i = [];
if (c.Locations && c.Locations.length) for (var l = 0; l < c.Locations.length; ++l) {
var j = c.Locations[l];
i.push(new VEGeocodeLocation(new VELatLong(j.Coordinates.Latitude, j.Coordinates.Longitude), j.Precision))
}
var m = new VEPlace(c.Name, b.CreateVELatLong(c.BestLocation.Coordinates.Latitude, c.BestLocation.Coordinates.Longitude), new VELatLongRectangle(b.CreateVELatLong(c.BestView.NorthEastCorner.Latitude, c.BestView.NorthEastCorner.Longitude), b.CreateVELatLong(c.BestView.SouthWestCorner.Latitude, c.BestView.SouthWestCorner.Longitude)), c.MatchConfidence, c.MatchCode, c.BestLocation.Precision, i);
if (c.MatchConfidence == n) {
g.push([c.Name, c.BestView.NorthEastCorner.Latitude, c.BestView.NorthEastCorner.Longitude, c.BestView.SouthWestCorner.Latitude, c.BestView.SouthWestCorner.Longitude, c.BestLocation.Coordinates.Latitude, c.BestLocation.Coordinates.Longitude, c.MatchConfidence, c.MatchCode, c.BestLocation.Precision, i]);
h.push(m)
} else if (!d.UseDefaultDisambiguation) h.push(m)
}
d.WhereResults = h;
d.WhereLatLong = h[0].LatLong;
d.WhereRect = h[0].LatLongRect
} else d.ErrorMessage = a.m_vemap.IsValidCredentialsInResponse(f) ? L_invalidsearchlocation_Text.replace(/%1/g, MapControl.Features.PlatformName) : L_CredentialsInvalid_Text;
d.WhereString = "";
if (g.length > 1) {
if (d.SetBestMapView) a.m_vemap.SetViewport(g[0][1], g[0][2], g[0][3], g[0][4]);
e = d;
if (d.UseDefaultDisambiguation) a.m_vemap.m_veambiguouslist.Show(g, a._DisambiguateCallback, true);
else if (typeof a.m_vemap.DisambiguationCallback != "undefined" && a.m_vemap.DisambiguationCallback != null && typeof a.m_vemap.DisambiguationCallback == "function") a.m_vemap.DisambiguationCallback(d.WhereResults);
else a.Find(d)
} else a.Find(d)
};
this.SearchQueryResponseHandler = function (c, f) {
a.m_vemap.vemapcontrol.Fire("onendrequest");
a.m_vemap.__HandleAuthentication(c);
var p = null,
m = [],
i = [];
if (c.SearchRegion != null && c.SearchRegion.Source == "Query" && c.SearchRegion.GeocodeLocations != null && c.SearchRegion.GeocodeLocations.length > 0) {
var s = c.SearchRegion.GeocodeLocations.length,
l = [];
for (var h = 0; h < s; ++h) {
var n = c.SearchRegion.GeocodeLocations[h];
l.push(new VEGeocodeLocation(new VELatLong(n.Coordinates.Latitude, n.Coordinates.Longitude), n.Precision))
}
var o = new VEPlace(c.SearchRegion.ExplicitLocation.Name, b.CreateVELatLong(c.SearchRegion.ExplicitLocation.Coordinates.Latitude, c.SearchRegion.ExplicitLocation.Coordinates.Longitude), new VELatLongRectangle(b.CreateVELatLong(c.SearchRegion.MapBounds.NorthEastCorner.Latitude, c.SearchRegion.MapBounds.NorthEastCorner.Longitude), b.CreateVELatLong(c.SearchRegion.MapBounds.SouthWestCorner.Latitude, c.SearchRegion.MapBounds.SouthWestCorner.Longitude)), c.SearchRegion.MatchConfidence, c.SearchRegion.MatchCode, c.SearchRegion.ExplicitLocation.Precision, l);
m.push(o);
i.push([c.SearchRegion.ExplicitLocation.Name, c.SearchRegion.MapBounds.NorthEastCorner.Latitude, c.SearchRegion.MapBounds.NorthEastCorner.Longitude, c.SearchRegion.MapBounds.SouthWestCorner.Latitude, c.SearchRegion.MapBounds.SouthWestCorner.Longitude, c.SearchRegion.ExplicitLocation.Coordinates.Latitude, c.SearchRegion.ExplicitLocation.Coordinates.Longitude, c.SearchRegion.MatchConfidence, c.SearchRegion.MatchCode, c.SearchRegion.ExplicitLocation.Precision, l]);
f.WhereLatLong = o.LatLong;
f.WhereRect = o.LatLongRect;
p = c.SearchRegion.MatchConfidence
}
if (c.AlternateSearchRegions != null && c.AlternateSearchRegions.length > 0) for (var h = 0; h < c.AlternateSearchRegions.length; ++h) {
var d = c.AlternateSearchRegions[h];
if (d.Source == "Query" && d.GeocodeLocations != null && d.GeocodeLocations.length > 0) {
if (p == null) p = d.MatchConfidence;
var l = [],
s = d.GeocodeLocations.length;
for (var t = 0; t < s; ++t) {
var n = d.GeocodeLocations[t];
l.push(new VEGeocodeLocation(new VELatLong(n.Coordinates.Latitude, n.Coordinates.Longitude), n.Precision))
}
var o = new VEPlace(d.ExplicitLocation.Name, b.CreateVELatLong(d.ExplicitLocation.Coordinates.Latitude, d.ExplicitLocation.Coordinates.Longitude), new VELatLongRectangle(b.CreateVELatLong(d.MapBounds.NorthEastCorner.Latitude, d.MapBounds.NorthEastCorner.Longitude), b.CreateVELatLong(d.MapBounds.SouthWestCorner.Latitude, d.MapBounds.SouthWestCorner.Longitude)), d.MatchConfidence, d.MatchCode, d.ExplicitLocation.Precision, l);
if (d.MatchConfidence == p) {
m.push(o);
i.push([d.ExplicitLocation.Name, d.MapBounds.NorthEastCorner.Latitude, d.MapBounds.NorthEastCorner.Longitude, d.MapBounds.SouthWestCorner.Latitude, d.MapBounds.SouthWestCorner.Longitude, d.ExplicitLocation.Coordinates.Latitude, d.ExplicitLocation.Coordinates.Longitude, d.MatchConfidence, d.MatchCode, d.ExplicitLocation.Precision, l])
} else if (!f.UseDefaultDisambiguation) m.push(o)
}
}
if (m != null && m.length > 0) f.WhereResults = m;
f.WhereString = "";
var r = [],
w = [],
x = f.ShapeLayer;
if (c.SearchResults != null && c.SearchResults.length > 0) {
var s = Math.min(c.SearchResults.length, f.NumberOfResults);
for (var h = 0; h < s; h++) {
var g = c.SearchResults[h],
k = null,
u = b.CreateVELatLong(g.Location.Latitude, g.Location.Longitude),
j = g.Address != null && g.Address.length > 0 ? g.Address + ", " : "";
j += g.City != null && g.City.length > 0 ? g.City + ", " : "";
j += g.State != null && g.State.length > 0 ? g.State : "";
j = j.replace(/(, )+$/, "");
if (f.CreateResults) {
k = new VEShape(VEShapeType.Pushpin, u);
k.SetTitle(g.Name);
k.SetDescription(g.Phone != null ? j + " " + g.Phone : j);
if (!f.ShowResults) k.SetVisibility(false);
x.AddShape(k);
w.push(k)
}
var v = new VEFindResult(f.FindType, k, g.Name, j, u, false, g.Phone);
r.push(v)
}
}
f.WhatString = "";
f.QueryString = "";
if (r.length > 0) {
f.WhatResults = r;
f.WhatHasMore = c.SearchResults.length > f.NumberOfResults
}
var q = false;
if (i.length > 1) {
if (f.SetBestMapView) a.m_vemap.SetViewport(i[0][1], i[0][2], i[0][3], i[0][4]);
e = f;
if (f.UseDefaultDisambiguation) {
if (c.ParseResults != null && c.ParseResults.length > 0 && c.ParseResults[0].Keyword != null && c.ParseResults[0].Keyword != "") f.WhatString = IOSec.EncodeUrl(c.ParseResults[0].Keyword);
a.m_vemap.m_veambiguouslist.Show(i, a._DisambiguateCallback, true);
q = true
} else if (typeof a.m_vemap.DisambiguationCallback != "undefined" && a.m_vemap.DisambiguationCallback != null && typeof a.m_vemap.DisambiguationCallback == "function") {
a.m_vemap.DisambiguationCallback(f.WhereResults);
q = true
}
}
if ((f.WhereResults == null || f.WhereResults.length == 0) && (f.WhatResults == null || f.WhatResults.length == 0)) f.ErrorMessage = a.m_vemap.IsValidCredentialsInResponse(c) ? L_invalidsearchresult_Text : L_CredentialsInvalid_Text;
if (!q) a.Find(f)
};
this.SearchResponseHandler = function (g, d) {
a.m_vemap.vemapcontrol.Fire("onendrequest");
a.m_vemap.__HandleAuthentication(g);
var h = [],
l = [],
m = d.ShapeLayer;
if (g.SearchResults != null && g.SearchResults.length > 0) {
var n = Math.min(g.SearchResults.length, d.NumberOfResults);
for (var i = 0; i < n; i++) {
var c = g.SearchResults[i],
f = null,
j = b.CreateVELatLong(c.Location.Latitude, c.Location.Longitude),
e = c.Address != null && c.Address.length > 0 ? c.Address + ", " : "";
e += c.City != null && c.City.length > 0 ? c.City + ", " : "";
e += c.State != null && c.State.length > 0 ? c.State : "";
e = e.replace(/(, )+$/, "");
if (d.CreateResults) {
f = new VEShape(VEShapeType.Pushpin, j);
f.SetTitle(c.Name);
f.SetDescription(c.Phone != null ? e + " " + c.Phone : e);
if (!d.ShowResults) f.SetVisibility(false);
m.AddShape(f);
l.push(f)
}
var k = new VEFindResult(d.FindType, f, c.Name, e, j, false, c.Phone);
h.push(k)
}
}
d.WhatString = "";
if (h.length > 0) {
d.WhatResults = h;
d.WhatHasMore = g.SearchResults.length > d.NumberOfResults
} else d.ErrorMessage = a.m_vemap.IsValidCredentialsInResponse(g) ? L_invalidsearchresult_Text : L_CredentialsInvalid_Text;
a.Find(d)
};
this.FindAmbiguousListCallBack = function (f, h, j, i, k) {
var c = e;
e = null;
if (f != null) {
var d = $ID(this.m_vemap.ID + "_vewhereinput");
if (d) d.value = unescape(f);
var b = c.WhereResults,
g = -1;
if (b) for (var a = 0; a < b.length; a++) if (b[a].LatLongRect.TopLeftLatLong.Latitude == h && b[a].LatLongRect.TopLeftLatLong.Longitude == j && b[a].LatLongRect.BottomRightLatLong.Latitude == i && b[a].LatLongRect.BottomRightLatLong.Longitude == k) {
g = a;
if (c != null) {
c.WhereResults = [b[a]];
c.WhereLatLong = b[a].LatLong;
c.WhereRect = b[a].LatLongRect
}
break
}
} else c.DisambuigationCancelled = true;
this.Find(c)
};
function f() {
var a = null;
if (c.vemapcontrol.IsMapViewOblique()) {
var b = c.GetBirdseyeScene();
if (b) a = b.GetBoundingRectangleNorthFacing()
} else a = c.GetMapView();
return a
}
function d(a) {
var i = "";
if (a && a.TopLeftLatLong && a.BottomRightLatLong) {
var h = g.Decode(a.TopLeftLatLong),
f = g.Decode(a.BottomRightLatLong),
b = h.Latitude,
c = f.Longitude,
d = f.Latitude,
e = h.Longitude;
if (b < d) {
var j = b;
b = d;
d = j
}
if (c < e) {
var j = c;
c = e;
e = j
}
return i = b + ", " + c + ", " + d + ", " + e
}
return i
}
this.ReverseGeocode = function (b, c) {
if (b.Latitude == null || b.Longitude == null) {
if (typeof c == "function") c(null)
} else {
var d = [];
d.push(new VEParameter("latitude", b.Latitude));
d.push(new VEParameter("longitude", b.Longitude));
this.m_vemap.vemapcontrol.Fire("onstartrequest");
function e(b) {
a.ReverseGeocodeResponseHandler(b, c)
}
VEAPIRequestInvoke(Msn.VE.API.Constants.geocodingservice + "/ReverseGeocode", d, e, this.m_vemap)
}
};
this.ReverseGeocodeResponseHandler = function (d, j) {
a.m_vemap.vemapcontrol.Fire("onendrequest");
a.m_vemap.__HandleAuthentication(d);
var e = null;
if (d && d.Results && d.Results.length > 0) {
e = [];
var l = d.Results.length;
for (var g = 0; g < l; ++g) {
var c = d.Results[g],
i = [];
if (c.Locations && c.Locations.length) for (var h = 0; h < c.Locations.length; ++h) {
var f = c.Locations[h];
i.push(new VEGeocodeLocation(b.CreateVELatLong(f.Coordinates.Latitude, f.Coordinates.Longitude), f.Precision))
}
var k = new VEPlace(c.Name, b.CreateVELatLong(c.BestLocation.Coordinates.Latitude, c.BestLocation.Coordinates.Longitude), new VELatLongRectangle(b.CreateVELatLong(c.BestView.NorthEastCorner.Latitude, c.BestView.SouthWestCorner.Longitude), b.CreateVELatLong(c.BestView.SouthWestCorner.Latitude, c.BestView.NorthEastCorner.Longitude)), c.MatchConfidence, c.MatchCode, c.BestLocation.Precision, i);
e.push(k)
}
}
if (typeof j == "function") j(e)
};
this.Dispose = function () {
this.m_vemap = null;
this.m_veLatLongFactory = null;
a = null
}
}
function VE_SearchResultCategory(b, a) {
this.id = b;
this.name = a;
this.IsValid = function () {
return typeof parseInt(b) == "number" && typeof a == "string" && a.length > 0
};
this.Destroy = function () {
this.id = null;
this.name = null
}
}
Msn.VE.Search = {};
Msn.VE.Search.strLastWhere = "";
function VE_SearchResult(w, u, l, t, s, v, p, n, r, d, o, k, h, g, q, f, a, j, i, c, b, m) {
this.id = w;
this.name = u;
this.description = l;
this.phone = t;
this.rating = s;
this.type = v;
this.latitude = p;
this.longitude = n;
this.pushPin = null;
this.pinId = null;
this.keywords = o;
this.infoUrl = r;
this.photoUrl = typeof d != "undefined" ? d : "";
this.mapserviceType = k;
this.mapserviceSource = h;
this.mapserviceOpacity = g;
this.website = b != null && typeof b != "undefined" && b.constructor == String ? b : "";
this.country = q;
var e = null;
this.SetGeoRef = function (a) {
e = a
};
this.GetGeoRef = function () {
return e
};
this.insideBoundingBox = f;
var a = a;
this.GetDistanceFromCenter = function (b, c) {
if (typeof a == "number" && Msn.VE.DistanceUnit.IsValidType(b)) if (b == "mi") {
if (a.toFixed) return c ? a.toFixed(2) + L_DirectionsMi_Text : a.toFixed(2)
} else if (b == "km") if (a.toFixed) return c ? (a * 1.60934).toFixed(2) + L_DirectionsKm_Text : (a * 1.60934).toFixed(2)
};
this.roofTopLatitude = j;
this.roofTopLongitude = i;
if (typeof c === "boolean") this.isLocationPrecise = c;
else this.isLocationPrecise = true;
this.brandInfo = m;
this.adInfo = null;
this.whitePageInfo = null
}
function VE_WebSearchResult(h, g, i, j, k) {
var c = a(h),
d = a(g),
e = a(i),
b = a(j),
f = a(k);
this.GetCaptionUrl = function () {
return c
};
this.SetCaptionUrl = function (b) {
c = a(b)
};
this.GetDescription = function () {
return d
};
this.SetDescription = function (b) {
d = a(b)
};
this.GetDisplayUrl = function () {
return e
};
this.SetDisplayUrl = function (b) {
e = a(b)
};
this.GetTitle = function () {
return b
};
this.SetTitle = function (c) {
b = a(c)
};
this.GetUrl = function () {
return f
};
this.SetUrl = function (b) {
f = a(b)
};
function a(a) {
if (typeof a == "string" && a.length >= 0) return a;
return null
}
}
VE_SearchResult.prototype.Equals = function (a) {
if (a == null || a == "undefined") return false;
try {
var b = this.name == a.name && this.description == a.description && this.phone == a.phone && this.rating == a.rating && this.type == a.type && this.latitude == a.latitude && this.longitude == a.longitude;
return b
} catch (c) {
return false
}
};
VE_WebSearchResult.prototype.Equals = function (a) {
if (a instanceof VE_WebSearchResult) {
var b = this.GetCaptionUrl() == a.GetCaptionUrl() && this.GetDescription() == a.GetDescription() && this.GetTitle() == a.GetTitle() && this.GetDisplayUrl() == a.GetDisplayUrl() && this.GetUrl() == a.GetUrl();
return b
}
return false
};
function VE_ColInfo(e, d, b, a, c) {
this.id = e;
this.name = d;
this.businessId = b;
this.entityCount = a;
this.colType = c
}
VE_SetModuleStatus(VE_ModuleName.APIFIND, "loaded");
VEMap.prototype.InitRouting = function () {
if (!this.m_vedirectionsmanager) {
this.m_vedirectionsmanager = new VEDirectionsManager(this);
this.m_vedirectionsmanager.Initialize();
this._dm = this.m_vedirectionsmanager
}
if (!this.m_routemanager) this.m_routemanager = new VERouteManager(this)
};
VEMap.prototype.GetRoute = function (d, e, b, c, a) {
this.InitRouting();
this.m_vedirectionsmanager.GetDrivingDirections(d, e, b, c, a)
};
VEMap.prototype.DeleteRoute = function () {
this.InitRouting();
this.m_routemanager.ClearRoute()
};
function VERouteDistanceUnit() {}
VERouteDistanceUnit.Mile = "Mile";
VERouteDistanceUnit.Kilometer = "Kilometer";
VERouteDistanceUnit.Default = VERouteDistanceUnit.Mile;
function VERouteOptimize() {}
VERouteOptimize.MinimizeTime = "MinimizeTime";
VERouteOptimize.MinimizeDistance = "MinimizeDistance";
VERouteOptimize.Default = "Default";
function VERouteMode() {}
VERouteMode.Driving = "Driving";
VERouteMode.Walking = "Walking";
VERouteMode.Default = VERouteMode.Driving;
function VERouteWarningSeverity() {}
VERouteWarningSeverity.None = 0;
VERouteWarningSeverity.LowImpact = 1;
VERouteWarningSeverity.Minor = 2;
VERouteWarningSeverity.Moderate = 3;
VERouteWarningSeverity.Serious = 4;
function VERouteHintType() {}
VERouteHintType.PreviousIntersection = 1;
VERouteHintType.NextIntersection = 2;
VERouteHintType.Landmark = 3;
function VEServiceRequest(d, b, c, a) {
this.ID = d;
this.Service = b;
this.Params = c;
this.Callback = a
}
function VE_Location(c, b, a) {
this.name = c;
this.latitude = b;
this.longitude = a
}
function VERouteOptions() {
this.DistanceUnit = VERouteDistanceUnit.Default;
this.RouteOptimize = VERouteOptimize.Default;
this.RouteMode = VERouteMode.Default;
this.RouteCallback = null;
this.DrawRoute = true;
this.RouteWeight = 6;
this.RouteColor = new VEColor(0, 169, 235, .7);
this.RouteZIndex = 4;
this.SetBestMapView = true;
this.ShowDisambiguation = true;
this.ShowErrorMessages = true;
this.UseTraffic = false;
this.UseMWS = false
}
function VERoute() {
this.RouteLegs = [];
this.Distance = 0;
this.Time = 0;
this.ShapePoints = null
}
function VERouteItinerary() {
this.Items = []
}
function VERouteItineraryItem(f, c, a, e, g, b, d) {
this.Text = f;
this.LatLong = c;
this.Distance = a;
this.Shape = e;
this.Time = g;
this.Warnings = b;
this.Hints = d
}
function VERouteLeg(a, b, d, c, e) {
this.StartLocation = a;
this.EndLocation = b;
this.Distance = d;
this.Itinerary = c;
this.Time = e
}
function VERouteHint(b, a) {
this.Type = b;
this.Text = a
}
function VERouteWarning(b, a) {
this.Text = b;
this.Severity = a
}
VEMap.prototype.GetDirections = function (b, a) {
this.m_routemanager.GetRoute(b, a)
};
function VERouteManager(vemap) {
var self = this,
m_vemap = vemap,
m_routeShapeLayer = null,
m_routeHighlight = null,
m_encoder = new _xz1,
m_veLatLongDecoder = new _xy1,
m_veLatLongFactory = new VELatLongFactory(new VELatLongFactorySpecFromMap(m_vemap)),
m_routeDecoder = new Msn.VE.DirectionsDecoder,
m_routeOptions = null,
m_locations = [],
m_currentLocationIndex = 0,
m_requestQueue = [],
m_route = null,
m_requestID = null;
this.GetRoute = function (e, a) {
m_requestID = VENetwork.GetExecutionID();
m_vemap.DeleteRoute();
if (!e || !e.length || e.length < 2) throw new VEException("", "err_invalidargument", L_invaliddirections_text);
if (a) {
VEValidator.ValidateObject(a, "routeOptions", VERouteOptions, "VERouteOptions");
if (a.DistanceUnit != VERouteDistanceUnit.Mile && a.DistanceUnit != VERouteDistanceUnit.Kilometer) throw new VEException("", "err_invalidargument", L_invalidargument_text.replace("%1", "routeOptions.DistanceUnit").replace("%2", "VERouteDistanceUnit"));
if (a.RouteOptimize != VERouteOptimize.Default && a.RouteOptimize != VERouteOptimize.MinimizeTime && a.RouteOptimize != VERouteOptimize.MinimizeDistance) throw new VEException("", "err_invalidargument", L_invalidargument_text.replace("%1", "routeOptions.RouteOptimize").replace("%2", "VERouteOptimize"));
if (a.RouteMode != VERouteMode.Driving && a.RouteMode != VERouteMode.Walking) throw new VEException("", "err_invalidargument", L_invalidargument_text.replace("%1", "routeOptions.RouteMode").replace("%2", "VERouteMode"));
if (a.RouteMode == VERouteMode.Driving && !$MVEM.IsEnabled(MapControl.Features.RouteOptions.RouteMode.Driving) || a.RouteMode == VERouteMode.Walking && !$MVEM.IsEnabled(MapControl.Features.RouteOptions.RouteMode.Walking)) throw new VEException("", "err_notSupportProperty", L_UnsupportProperty_Text.replace("%1", "VERouteOptions").replace("%2", "RouteMode").replace("%3", a.RouteMode.toString()));
VEValidator.ValidateBoolean(a.DrawRoute, "routeOptions.DrawRoute");
if (a.RouteCallback) VEValidator.ValidateFunction(a.RouteCallback, "routeOptions.RouteCallback");
VEValidator.ValidateFloat(a.RouteWeight, "routeOptions.RouteWeight");
VEValidator.ValidateObject(a.RouteColor, "routeOptions.RouteColor", VEColor, "VEColor");
VEValidator.ValidateInt(a.RouteZIndex, "routeOptions.RouteZIndex");
VEValidator.ValidateBoolean(a.SetBestMapView, "routeOptions.SetBestMapView");
VEValidator.ValidateBoolean(a.ShowDisambiguation, "routeOptions.ShowDisambiguation");
VEValidator.ValidateBoolean(a.ShowErrorMessages, "routeOptions.ShowErrorMessages");
VEValidator.ValidateBoolean(a.UseMWS, "routeOptions.UseMWS");
VEValidator.ValidateBoolean(a.UseTraffic, "routeOptions.UseTraffic");
if (!$MVEM.IsEnabled(MapControl.Features.RouteOptions.UseMWS) && a.UseMWS) throw new VEException("", "err_notSupportProperty", L_UnsupportProperty_Text.replace("%1", "VERouteOptions").replace("%2", "UseMWS").replace("%3", "true"));
if (!$MVEM.IsEnabled(MapControl.Features.RouteOptions.UseTraffic) && a.UseTraffic) throw new VEException("", "err_notSupportProperty", L_UnsupportProperty_Text.replace("%1", "VERouteOptions").replace("%2", "UseTraffic").replace("%3", "true"));
m_routeOptions = a
} else m_routeOptions = new VERouteOptions;
m_locations = [];
m_currentLocationIndex = 0;
m_requestQueue = [];
var i = e.length;
for (var d = 0; d < i; ++d) {
var f = e[d];
VEValidator.ValidateNonNull(e[d], "Location");
if (f instanceof VELatLong) m_locations[d] = m_veLatLongDecoder.Decode(f);
else {
var b = [],
g = "",
c = null;
if (m_vemap.vemapcontrol.IsMapViewOblique()) {
var h = m_vemap.GetBirdseyeScene();
if (h) c = h.GetBoundingRectangleNorthFacing()
} else c = m_vemap.GetMapView();
if (c && c.TopLeftLatLong && c.BottomRightLatLong) g = c.TopLeftLatLong.Latitude + ", " + c.BottomRightLatLong.Longitude + ", " + c.BottomRightLatLong.Latitude + ", " + c.TopLeftLatLong.Longitude;
b.push(new VEParameter("count", ""));
b.push(new VEParameter("query", '"' + IOSec.EncodeUrl(f) + '"'));
b.push(new VEParameter("landmark", ""));
b.push(new VEParameter("addressLine", ""));
b.push(new VEParameter("locality", ""));
b.push(new VEParameter("postalTown", ""));
b.push(new VEParameter("adminDistrict", ""));
b.push(new VEParameter("district", ""));
b.push(new VEParameter("postalCode", ""));
b.push(new VEParameter("countryRegion", ""));
b.push(new VEParameter("mapBounds", '"' + g + '"'));
b.push(new VEParameter("currentLocation", ""));
b.push(new VEParameter("curLocAccuracy", ""));
b.push(new VEParameter("entityTypes", ""));
b.push(new VEParameter("rankBy", ""));
m_requestQueue.push(new VEServiceRequest(d, Msn.VE.API.Constants.geocodingservice + "/Geocode", b, self.GeocodeResponseHandler))
}
}
self.ExecuteNextRequest()
};
this.ClearRoute = function () {
if (m_route) {
if (m_routeShapeLayer) {
m_vemap.DeleteShapeLayer(m_routeShapeLayer);
m_routeShapeLayer = null
}
for (var a = 0; a < m_route.RouteLegs.length; ++a) {
var c = m_route.RouteLegs[a];
for (var b = 0; b < c.Itinerary.Items.length; ++b) {
var d = c.Itinerary.Items[b];
if (d.Shape) d.Shape = null
}
}
m_route = null
}
this.RemoveRouteHighLight()
};
this.ExecuteNextRequest = function () {
if (m_requestQueue.length > 0) {
var b = m_requestID;
function c(c) {
if (m_requestID == b) a.Callback(c, a.ID)
}
var a = m_requestQueue.shift();
m_vemap.vemapcontrol.Fire("onstartrequest");
VEAPIRequestInvoke(a.Service, a.Params, c, m_vemap)
} else self.ExecuteRouteRequest()
};
this.ExecuteRouteRequest = function () {
var d = m_requestID;
function e(a) {
if (m_requestID == d) self.RouteResponseHandler(a)
}
var a = [],
c = "",
f = m_locations.length;
for (var b = 0; b < f; ++b) c += m_encoder.Encode(m_locations[b].Latitude, m_locations[b].Longitude);
a.push(new VEParameter("encodedWaypoints", '"' + c + '"'));
a.push(new VEParameter("encodingLength", "6"));
a.push(new VEParameter("unit", '"' + m_routeOptions.DistanceUnit + '"'));
a.push(new VEParameter("routeOptimize", '"' + m_routeOptions.RouteOptimize + '"'));
a.push(new VEParameter("mode", '"' + m_routeOptions.RouteMode + '"'));
a.push(new VEParameter("useMws", m_routeOptions.UseMWS ? "true" : "false"));
a.push(new VEParameter("useTraffic", m_routeOptions.UseTraffic ? "true" : "false"));
m_vemap.vemapcontrol.Fire("onstartrequest");
VEAPIRequestInvoke(Msn.VE.API.Constants.routeservice + "/CalculateRoute2", a, e, m_vemap)
};
this.GeocodeResponseHandler = function (a, e) {
m_vemap.vemapcontrol.Fire("onendrequest");
m_vemap.__HandleAuthentication(a);
if (a && a.Results && a.Results.length > 0) if (a.Results.length == 1 || !m_routeOptions.ShowDisambiguation || a.Results[0].MatchConfidence != a.Results[1].MatchConfidence) {
var b = GetRouteLocation(a.Results[0]);
if (b != null) m_locations[e] = new VELatLong(b.Coordinates.Latitude, b.Coordinates.Longitude);
self.ExecuteNextRequest()
} else {
var g = a.Results[0].MatchConfidence,
f = [];
for (var d = 0; d < a.Results.length; ++d) {
var c = a.Results[d];
if (c.MatchConfidence == g) {
var b = GetRouteLocation(c);
if (b != null) f.push(new VE_Location(c.Name, b.Coordinates.Latitude, b.Coordinates.Longitude))
}
}
m_currentLocationIndex = e;
m_vemap.m_veambiguouslist.Show(f, "VEMap._GetMapFromGUID(" + m_vemap.GUID + ").m_routemanager.DisambiguateLocation")
} else {
if (m_routeOptions.ShowErrorMessages) m_vemap.ShowMessage(m_vemap.IsValidCredentialsInResponse(a) ? L_invalidlocation_Text : L_CredentialsInvalid_Text);
if (m_routeOptions.RouteCallback) m_routeOptions.RouteCallback(null)
}
};
function GetRouteLocation(a) {
var b = null;
if (a.Locations && a.Locations.length) for (var c = 0; c < a.Locations.length; ++c) if (a.Locations[c].Precision == VELocationPrecision.Interpolated) {
b = a.Locations[c];
break
}
if (b == null) b = a.BestLocation;
return b
}
this.DisambiguateLocation = function (c, a, b) {
if (a && b) {
m_locations[m_currentLocationIndex] = new VELatLong(a, b);
self.ExecuteNextRequest()
}
};
this.RouteResponseHandler = function (object) {
m_vemap.vemapcontrol.Fire("onendrequest");
m_vemap.__HandleAuthentication(object);
m_route = new VERoute;
if (object && object.ResponseSummary && object.ResponseSummary.StatusCode == 0) if (object.RouteResult) {
if (object.RouteResult.RouteSummary) {
if (object.RouteResult.RouteSummary.Distance) m_route.Distance = object.RouteResult.RouteSummary.Distance;
if (object.RouteResult.RouteSummary.TimeInSeconds) m_route.Time = object.RouteResult.RouteSummary.TimeInSeconds
}
if (object.RouteResult.RouteLegs) {
var len = object.RouteResult.RouteLegs.length;
for (var i = 0; i < len; ++i) {
var leg = object.RouteResult.RouteLegs[i],
itinerary = new VERouteItinerary,
itineraryItemsLen = leg.Itinerary.Items.length;
for (var j = 0; j < itineraryItemsLen; ++j) {
var item = leg.Itinerary.Items[j],
warnings = null;
if (item.ItemWarnings) {
warnings = [];
for (var k = 0; k < item.ItemWarnings.length; ++k) warnings.push(new VERouteWarning(item.ItemWarnings[k].WarningText.Text, item.ItemWarnings[k].WarningCriticality))
}
var hints = null;
if (item.ItemHints) {
hints = [];
for (var k = 0; k < item.ItemHints.length; ++k) hints.push(new VERouteHint(item.ItemHints[k].HintType, item.ItemHints[k].HintText.Text))
}
itinerary.Items.push(new VERouteItineraryItem(item.Text.Text, m_veLatLongFactory.CreateVELatLong(item.ItemDetails[0].Coordinate.Latitude, item.ItemDetails[0].Coordinate.Longitude), item.ItemSummary.Distance, null, item.ItemSummary.TimeInSeconds, warnings, hints))
}
m_route.RouteLegs.push(new VERouteLeg(m_veLatLongFactory.CreateVELatLong(leg.ActualStart.Latitude, leg.ActualStart.Longitude), m_veLatLongFactory.CreateVELatLong(leg.ActualEnd.Latitude, leg.ActualEnd.Longitude), leg.LegSummary.Distance, itinerary, leg.LegSummary.TimeInSeconds))
}
}
}
if (m_route && m_route.RouteLegs && m_route.RouteLegs.length > 0) {
if (m_routeOptions.DrawRoute) {
var shapes = [],
stepIndex = 0;
for (var routeLegIndex = 0; routeLegIndex < m_route.RouteLegs.length; ++routeLegIndex) {
var routeLeg = m_route.RouteLegs[routeLegIndex];
for (var itemIndex = 0; itemIndex < routeLeg.Itinerary.Items.length; ++itemIndex) {
var item = routeLeg.Itinerary.Items[itemIndex],
shape = new VEShape(VEShapeType.Pushpin, item.LatLong);
if (routeLegIndex == 0 && itemIndex == 0) {
shape.SetTitle(L_Start_Text);
shape.SetCustomIcon(Msn.VE.API.Constants.vedirectionsstarticon)
} else if (routeLegIndex == m_route.RouteLegs.length - 1 && itemIndex == routeLeg.Itinerary.Items.length - 1) {
shape.SetTitle(L_End_Text);
shape.SetCustomIcon(Msn.VE.API.Constants.vedirectionsendicon)
} else {
shape.SetTitle(L_DirectionsStep_Text + " " + stepIndex);
shape.SetCustomIcon(Msn.VE.API.Constants.vedirectionsstepicon.replace("%1", stepIndex))
}
shape.SetDescription(item.Text);
item.Shape = shape;
shapes.push(shape);
++stepIndex
}
}
m_routeShapeLayer = new VEShapeLayer;
m_vemap.AddShapeLayer(m_routeShapeLayer);
m_routeShapeLayer.AddShape(shapes)
}
if (object.RouteResult && object.RouteResult.RoutePath) {
var rp = object.RouteResult.RoutePath,
shapePointLatitudes = m_routeDecoder.DecodeCoordinatesString(rp.ShapePointsLatitudes),
shapePointLongitudes = m_routeDecoder.DecodeCoordinatesString(rp.ShapePointsLongitudes);
if (m_vemap.HasClientToken() || m_vemap.HasValidCredentials()) {
m_route.ShapePoints = [];
if (shapePointLatitudes.length == shapePointLongitudes.length) {
var len = shapePointLatitudes.length;
for (var i = 0; i < len; ++i) m_route.ShapePoints[i] = m_veLatLongFactory.CreateVELatLong(shapePointLatitudes[i], shapePointLongitudes[i])
}
}
if (m_routeOptions.DrawRoute) {
if (m_routeOptions.SetBestMapView && rp.JavascriptBestView) {
var bestView = eval(rp.JavascriptBestView),
latlongs = [];
for (var i = 0; i < bestView.length; ++i) latlongs.push(new VELatLong(bestView[i].latitude, bestView[i].longitude));
m_vemap.SetMapView(latlongs)
}
self.CreateRouteHighLight("veDDHighlight", shapePointLatitudes, shapePointLongitudes, eval(rp.JavascriptRouteRegions), eval(rp.JavascriptZoomLevelsForGeneralizedLines))
}
}
} else if (m_routeOptions.ShowErrorMessages) m_vemap.ShowMessage(m_vemap.IsValidCredentialsInResponse(object) ? L_invalidroute_Text : L_CredentialsInvalid_Text);
if (m_routeOptions.RouteCallback) m_routeOptions.RouteCallback(m_route)
};
this.CreateRouteHighLight = function (e, c, d, b, a) {
if (m_routeHighlight) this.RemoveRouteHighLight();
m_routeHighlight = m_vemap.vemapcontrol.AddLine(e, c, d, m_routeOptions.RouteWeight, m_routeOptions.RouteColor, m_routeOptions.RouteZIndex, b, a)
};
this.RemoveRouteHighLight = function () {
if (m_routeHighlight) {
m_vemap.vemapcontrol.RemoveLine(m_routeHighlight.id);
m_routeHighlight = null
}
};
this.Dispose = function () {
self = null
}
}
var L_cannotrenderroute_text = "The route could not be drawn because this web browser does not support SVG and VML.";
VEDistanceUnit = new function () {
this.Miles = "m";
this.Kilometers = "k"
};
VERouteType = new function () {
this.Shortest = "s";
this.Quickest = "q"
};
function VERouteDeprecated(b, c, a) {
VEValidator.ValidateObject(b, "startLocation", VERouteLocation, "VERouteLocation");
VEValidator.ValidateObject(c, "endLocation", VERouteLocation, "VERouteLocation");
VEValidator.ValidateObject(a, "veRouteItinerary", VERouteItineraryDeprecated, "VERouteItineraryDeprecated");
this.StartLocation = b;
this.EndLocation = c;
this.Itinerary = a
}
function VERouteLocation(b, a) {
VEValidator.ValidateNonNull(b, "address");
VEValidator.ValidateObject(a, "veLatLong", VELatLong, "VELatLong");
this.Address = b;
this.LatLong = a
}
function VERouteItineraryDeprecated(c, a, d, b) {
this.Distance = c;
this.DistanceUnit = a;
this.Time = d;
this.RouteType = b;
this.Segments = [];
this.AddSegment = function (a) {
VEValidator.ValidateObject(a, "segment", VERouteSegment, "VERouteSegment");
this.Segments.push(a)
}
}
function VERouteSegment(b, c, a) {
VEValidator.ValidateObject(a, "veLatLong", VELatLong, "VELatLong");
this.Instruction = b;
this.Distance = c;
this.LatLong = a
}
function VEDirectionsManager(c) {
VEValidator.ValidateObject(c, "vemap", VEMap, "VEMap");
this.m_vemap = c;
var a = this;
this.lastStartString = "";
this.lastEndString = "";
this.laststart = "";
this.lastend = "";
this.lastcallback = null;
this.disambigwhat = "";
this.veroutecache = [];
var f = new VELatLongFactory(new VELatLongFactorySpecFromMap(this.m_vemap)),
e = new _xy1;
this.m_showDisambigousDialog = true;
this.Initialize = function () {};
this.GetDrivingDirections = function (b, c, e, f, g) {
if (b == null || typeof b == "undefined" || b.length <= 0) throw new VEException("VEDirectionsManager:GetDrivingDirections", "err_invaliddirections", L_invaliddirections_text);
if (c == null || typeof c == "undefined" || c.length <= 0) throw new VEException("VEDirectionsManager:GetDrivingDirections", "err_invaliddirections", L_invaliddirections_text);
this.lastStartString = typeof b == "string" ? b : "";
this.lastEndString = typeof c == "string" ? c : "";
if (e != null && typeof e != "undefined" && (e == VEDistanceUnit.Kilometers || e == VEDistanceUnit.Miles)) this.lastdist = e;
else this.lastdist = VEDistanceUnit.Miles;
if (f != null && typeof f != "undefined" && (f == VERouteType.Quickest || f == VERouteType.Shortest)) this.lasttype = f;
else this.lasttype = VERouteType.Quickest;
var a = new VERouteOptions;
a.DistanceUnit = this.lastdist == VEDistanceUnit.Kilometers ? VERouteDistanceUnit.Kilometer : VERouteDistanceUnit.Mile;
a.RouteOptimize = this.lasttype == VERouteType.Shortest ? VERouteOptimize.MinimizeDistance : VERouteOptimize.MinimizeTime;
a.RouteMode = VERouteMode.Driving;
a.DrawRoute = true;
a.UseMWS = true;
if (typeof g == "function") a.RouteCallback = function (a) {
d(a, g)
};
this.m_vemap.GetDirections([b, c], a)
};
function d(g, m) {
var i = null;
if (g != null && g.RouteLegs != null && g.RouteLegs.length == 1) {
var c = g.RouteLegs[0],
k = new VERouteLocation(a.lastStartString, c.StartLocation),
l = new VERouteLocation(a.lastEndString, c.EndLocation),
h;
if (c.Time < 60) h = L_routelessthanoneminute_Text;
else {
var d = new Date;
d.setHours(0, 0, 0, 0);
d.setSeconds(c.Time);
h = d.getHours() != 0 ? L_hoursandminutes_Text.replace(/%1/, d.getHours()).replace(/%2/, d.getMinutes()) : L_minutes_Text.replace(/%1/, d.getMinutes())
}
var j = new VERouteItineraryDeprecated(b(c.Distance), a.lastdist == VEDistanceUnit.Miles ? "mi" : "km", h, a.lasttype),
f = c.Itinerary.Items;
for (var e = 0; e < f.length; e++) {
var n = new VERouteSegment(f[e].Text, b(f[e].Distance), f[e].LatLong);
j.AddSegment(n)
}
i = new VERouteDeprecated(k, l, j)
}
m(i)
}
function b(a) {
return MathRound(a * 10) / 10
}
}
function VE_Directions() {}
VE_SetModuleStatus(VE_ModuleName.APIROUTING, "loaded");
VEMap.prototype.LoadTraffic = function (c, b, a) {
if (this.m_vetrafficmanager) VE_TrafficManager.ClearTraffic();
else this.m_vetrafficmanager = new VE_TrafficManager(this);
VE_TrafficManager.m_vemap = this;
if (!VE_TrafficManager.turnedOn && $ID("MSVE_navAction_traffic") != null) g($ID("MSVE_navAction_traffic")).addClass("MSVE_selected");
VE_TrafficManager.turnedOn = true;
VE_TrafficManager.showTrafficFlow = c;
VE_TrafficManager.showIncidents = b;
VE_TrafficManager.showConstructionIncidents = a;
VE_TrafficManager.markets = [];
VE_TrafficManager.incidents = [];
if (this.vemapcontrol) this.vemapcontrol.UpdateCopyright();
window.setTimeout(VE_TrafficManager.GetMarkets, 100)
};
VEMap.prototype.ClearTraffic = function () {
if (VE_TrafficManager.markets[0] != null) {
VE_TrafficManager.ClearTraffic();
if (VE_TrafficManager.turnedOn && $ID("MSVE_navAction_traffic") != null) g($ID("MSVE_navAction_traffic")).removeClass("MSVE_selected")
}
if (this.vemapcontrol) this.vemapcontrol.UpdateCopyright()
};
VEMap.prototype.ShowTrafficLegend = function (a, b) {
if (VE_TrafficManager && VE_TrafficManager.turnedOn) VE_TrafficManager.ShowTrafficLegend(a, b)
};
VEMap.prototype.HideTrafficLegend = function () {
if (VE_TrafficManager) VE_TrafficManager.HideTrafficLegend()
};
VEMap.prototype.SetTrafficLegendText = function (a) {
if (VE_TrafficManager) VE_TrafficManager.SetTrafficLegendText(a)
};
function VE_TrafficManager(a) {
VEValidator.ValidateObject(a, "vemap", VEMap, "VEMap")
}
VE_TrafficManager.m_vemap = null;
VE_TrafficManager.markets = [];
VE_TrafficManager.incidents = [];
VE_TrafficManager.incidentJSFiles = [];
VE_TrafficManager.showingMarkets = [];
VE_TrafficManager.showConstructionIncidents = false;
VE_TrafficManager.incidentsAvailable = false;
VE_TrafficManager.flowAvailable = false;
VE_TrafficManager.turnedOn = false;
VE_TrafficManager.legendPinned = true;
VE_TrafficManager.showIncidents = false;
VE_TrafficManager.showTrafficFlow = false;
VE_TrafficManager.prevZoomLevel = 0;
VE_TrafficManager.displayAtZoomlevelMin = 7;
VE_TrafficManager.displayAtZoomlevelMax = 15;
VE_TrafficManager.prevMapStyle = "";
VE_TrafficManager.isViewDirty = false;
VE_TrafficManager.masterTimer = null;
VE_TrafficManager.slaveTimer = null;
VE_TrafficManager.SelectedMarketIcon = null;
VE_TrafficManager.MarketIcons = null;
VE_TrafficManager.Severity = {
Serious: L_TrafficManagerSerious_Text,
Moderate: L_TrafficManagerModerate_Text,
Minor: L_TrafficManagerMinor_Text
};
VE_TrafficManager.GetMarkets = function () {
try {
VENetwork.DownloadScript(VE_TrafficManager.m_vemap.vemapcontrol.GetMarketsFile(), VE_TrafficManager.GetTrafficInfo)
} catch (a) {}
};
VE_TrafficManager._ProcessMarkets = function (a) {
if (VE_TrafficManager.markets[0] == null) VE_TrafficManager.markets[0] = [];
if (a != null && a.length > 0) {
var c = a.length;
for (var b = 0; b < c; b++) if (a[b] != null) VE_TrafficManager.markets[0].push(a[b])
}
};
VE_TrafficManager._GetIncidents = function (b) {
VE_TrafficManager.showingMarkets = VE_TrafficManager._GetIncidentMarkets();
if (b) if (VE_TrafficManager.showingMarkets.length > 0) {
VE_TrafficManager.incidentsAvailable = true;
for (var a = 0; a < VE_TrafficManager.showingMarkets.length; a++) try {
var c = VENetwork.DownloadScript(VE_TrafficManager.m_vemap.vemapcontrol.GetIncidentsFile().replace("%1", VE_TrafficManager.showingMarkets[a]), null);
VE_TrafficManager.incidentJSFiles.push(c)
} catch (d) {}
}
};
VE_TrafficManager._ProcessIncidents = function (f, g, a) {
if (VE_TrafficManager.m_vemap != null) {
var d = new Date;
d.setTime(Date.parse(f));
this.LastUpdateTimestamp = d.toLocaleTimeString();
if (isNaN(d)) this.LastUpdateTimestamp = "";
if (a == null || a.length <= 0) return;
var b = a[0].MarketId;
if (VE_TrafficManager.incidents[b] == null) VE_TrafficManager.incidents[b] = [];
else {
VE_TrafficManager._ClearPins(b);
var e = VE_TrafficManager.incidents[b].length;
for (var c = 0; c < e; c++) VE_TrafficManager.incidents[b].pop()
}
if (a != null && a.length > 0) {
var e = a.length;
for (var c = 0; c < e; c++) if (a[c] != null) VE_TrafficManager.incidents[b].push(a[c])
}
VE_TrafficManager._DisplayIncidents()
}
};
VE_TrafficManager._GetIncidentMarkets = function () {
var b = [],
h = VE_TrafficManager.m_vemap.vemapcontrol.PixelToLatLong(new VEPixel(0, 0)),
g = VE_TrafficManager.m_vemap.vemapcontrol.PixelToLatLong(new VEPixel(VE_TrafficManager.m_vemap.GetWidth(), VE_TrafficManager.m_vemap.GetHeight()));
if (h == null || g == null) return b;
var c = h.latitude,
d = g.longitude,
e = g.latitude,
f = h.longitude;
if (c < e) {
var i = c;
c = e;
e = i
}
if (d < f) {
var i = d;
d = f;
f = i
}
if (VE_TrafficManager.markets.length == 0) return b;
var k = new VELatLongRectangle(new VELatLong(c, f), new VELatLong(e, d)),
l = VE_TrafficManager.markets[0].length;
for (var a = 0; a < l; a++) {
var j = new VELatLongRectangle(new VELatLong(VE_TrafficManager.markets[0][a].NELatitude, VE_TrafficManager.markets[0][a].SWLongitude), new VELatLong(VE_TrafficManager.markets[0][a].SWLatitude, VE_TrafficManager.markets[0][a].NELongitude));
if (VE_TrafficManager._isBBOverlap(k, j)) {
if (VE_TrafficManager.markets[0][a].Incident == "Incidents") b.push(VE_TrafficManager.markets[0][a].Id);
if (VE_TrafficManager.markets[0][a].Flow == "Flow") VE_TrafficManager.flowAvailable = true
}
}
return b
};
VE_TrafficManager._isBBOverlap = function (b, a) {
return VE_TrafficManager._IsRectInBoundingBox(b, a) || VE_TrafficManager._IsRectInBoundingBox(a, b)
};
VE_TrafficManager._IsRectInBoundingBox = function (a, b) {
return !(a.BottomRightLatLong.Latitude > b.TopLeftLatLong.Latitude || a.BottomRightLatLong.Longitude < b.TopLeftLatLong.Longitude || a.TopLeftLatLong.Latitude < b.BottomRightLatLong.Latitude || a.TopLeftLatLong.Longitude > b.BottomRightLatLong.Longitude)
};
VE_TrafficManager.GetTrafficInfo = function () {
if (!VE_TrafficManager.turnedOn) return;
try {
if (VE_TrafficManager.m_vemap.vemapcontrol.IsModeEnabled(Msn.VE.MapActionMode.Mode3D)) if (VE_TrafficManager.showTrafficFlow) VE_TrafficManager.m_vemap.vemapcontrol.Show3DTraffic(false);
else VE_TrafficManager.m_vemap.vemapcontrol.Remove3DTraffic();
var a = VE_TrafficManager.m_vemap.GetZoomLevel();
if (VE_TrafficManager.m_vemap.vemapcontrol.IsMapViewOblique()) return;
VE_TrafficManager.prevZoomLevel = a;
VE_TrafficManager.prevMapStyle = VE_TrafficManager.m_vemap.GetMapStyle();
VE_TrafficManager.incidentsAvailable = false;
VE_TrafficManager.flowAvailable = false;
VE_TrafficManager._ClearPins();
VE_TrafficManager.m_vemap.vemapcontrol.ClearTileLayer("Traffic");
if (a > VE_TrafficManager.displayAtZoomlevelMin) {
VE_TrafficManager._GetIncidents(VE_TrafficManager.showIncidents);
if (VE_TrafficManager.showTrafficFlow && VE_TrafficManager.flowAvailable && a < VE_TrafficManager.displayAtZoomlevelMax) VE_TrafficManager.m_vemap.vemapcontrol.SetTrafficView()
}
if ($MVEM.IsEnabled(MapControl.Features.Traffic.ShowOnNavbar)) {
VE_TrafficManager._RenderMarketIcon();
if (a <= VE_TrafficManager.displayAtZoomlevelMin) VE_TrafficManager.SetTrafficLegendText(L_MapLegendAndPopupLink_Text)
}
VE_TrafficManager.RenewAutoRefresh()
} catch (b) {} finally {}
};
VE_TrafficManager._DisplayIncidents = function () {
if (VE_TrafficManager.showingMarkets != null && VE_TrafficManager.showingMarkets.length > 0) {
var d = VE_TrafficManager.showingMarkets.length;
for (var b = 0; b < d; b++) {
var a = VE_TrafficManager.showingMarkets[b];
if (VE_TrafficManager.incidents[a] != null && VE_TrafficManager.incidents[a].length > 0 && $MVEM.IsEnabled(MapControl.Features.Traffic.ShowIncidents)) {
VE_TrafficManager._RemoveDuplicates(a);
VE_TrafficManager._RenderTrafficInfo(a)
}
}
if (this.LastUpdateTimestamp != null && typeof this.LastUpdateTimestamp != "undefined") VE_TrafficManager.SetTrafficLegendText(this.LastUpdateTimestamp);
VE_TrafficManager.ShowTrafficLegend();
if (VE_TrafficManager.m_vemap) {
var c = VE_TrafficManager.m_vemap.GetDashboardSize();
if (c == VEDashboardSize.Small || c == VEDashboardSize.Tiny) VE_TrafficManager.ShowTrafficLegend(41, 37)
}
}
};
VE_TrafficManager._RenderTrafficInfo = function (c) {
if (c) VE_TrafficManager._ClearPins(c);
else VE_TrafficManager._ClearPins();
var e = VE_TrafficManager.m_vemap.GetZoomLevel();
if (e > VE_TrafficManager.displayAtZoomlevelMin) {
if (c == null) return;
if (VE_TrafficManager.incidents[c] != null) {
var b = VE_TrafficManager.incidents[c],
f = VE_TrafficManager.incidents[c].length;
for (var a = 0; a < f; a++) if (b[a].Type != VE_TrafficIncidentType.Weather && b[a].Type != VE_TrafficIncidentType.MassTransit) {
if (!VE_TrafficManager.showConstructionIncidents) if (b[a].Type == VE_TrafficIncidentType.UnscheduledConstruction || b[a].Type == VE_TrafficIncidentType.ScheduledConstruction) continue;
if (VE_TrafficManager.flowAvailable && b[a].Type == VE_TrafficIncidentType.Congestion) continue;
var d = new VEPushpin("pin_traffic_incident_" + c + "_" + b[a].Id, new VELatLong(b[a].Latitude, b[a].Longitude), Msn.VE.API.Constants.trafficiconurl.replace("%1", VE_TrafficManager.GetColor(b[a].Criticality)), "", VE_TrafficManager.CreatePopupContent(b[a]));
b[a].pushPin = d;
VE_TrafficManager.m_vemap.AddPushpin(d)
}
}
}
};
VE_TrafficManager._RenderMarketIcon = function () {
if (VE_TrafficManager.markets == null || VE_TrafficManager.markets.length == 0 || !$MVEM.IsEnabled(MapControl.Features.Traffic.ShowOnNavbar)) return;
if (VE_TrafficManager.MarketIcons == null) VE_TrafficManager.MarketIcons = [];
var d = VE_TrafficManager.m_vemap.GetZoomLevel();
if (VE_TrafficManager.MarketIcons.length > 0 && d > VE_TrafficManager.displayAtZoomlevelMin) {
for (var b = 0; b < VE_TrafficManager.markets[0].length; b++) VE_TrafficManager.m_vemap.DeletePushpin("pin_traffic_market_" + VE_TrafficManager.markets[0][b].Id);
VE_TrafficManager.MarketIcons = [];
VE_TrafficManager.m_vemap.DetachEvent("onmouseover", VE_TrafficManager.MouseOverMarketIconHandler);
VE_TrafficManager.m_vemap.DetachEvent("onmouseout", VE_TrafficManager.MouseOutMarketIconHandler)
}
if (d <= VE_TrafficManager.displayAtZoomlevelMin && VE_TrafficManager.MarketIcons == 0) {
for (var b = 0; b < VE_TrafficManager.markets.length; b++) for (var c = 0; c < VE_TrafficManager.markets[b].length; c++) {
var a = VE_TrafficManager.markets[b][c],
g = (a.NELatitude + a.SWLatitude) / 2,
h = (a.NELongitude + a.SWLongitude) / 2,
e = "pin_traffic_market_" + a.Id,
f = new VELatLong(g, h),
i = new VEPushpin(e, f, Msn.VE.API.Constants.trafficmarketiconurl.replace("%1", ""), a.Name + " " + L_NavActionTraffic_Text, VE_TrafficManager.CreateMarketIconPopupContent(a), "", "traffictitle");
VE_TrafficManager.MarketIcons.push(e);
VE_TrafficManager.m_vemap.AddPushpin(i)
}
VE_TrafficManager.m_vemap.AttachEvent("onmouseover", VE_TrafficManager.MouseOverMarketIconHandler);
VE_TrafficManager.m_vemap.AttachEvent("onmouseout", VE_TrafficManager.MouseOutMarketIconHandler)
}
};
VE_TrafficManager.MouseOverMarketIconHandler = function () {
for (var a = 0; a < VE_TrafficManager.MarketIcons.length; a++) if (VE_TrafficManager.MarketIcons[a] + "_" + VE_TrafficManager.m_vemap.GUID == window.event.srcElement.id) {
VE_TrafficManager.SelectedMarketIcon = window.event.srcElement;
VE_TrafficManager.SelectedMarketIcon.src = Msn.VE.API.Constants.trafficmarketiconurl.replace("%1", "poi_hover_");
break
}
};
VE_TrafficManager.MouseOutMarketIconHandler = function () {
if (VE_TrafficManager.SelectedMarketIcon != null) {
VE_TrafficManager.SelectedMarketIcon.src = Msn.VE.API.Constants.trafficmarketiconurl.replace("%1", "");
VE_TrafficManager.SelectedMarketIcon = null
}
};
VE_TrafficManager.CreateMarketIconPopupContent = function (a) {
if (a == null || a == "undefined") return "";
var c = (parseFloat(a.SWLatitude) + parseFloat(a.NELatitude)) / 2,
b = (parseFloat(a.SWLongitude) + parseFloat(a.NELongitude)) / 2,
d = '' + L_MapLegendAndPopupLink_Text + "";
return d
};
VE_TrafficManager.GetColor = function (a) {
switch (a) {
case 0:
return Msn.VE.UI.Color.Red;
break;
case 1:
return Msn.VE.UI.Color.Orange;
break;
case 2:
return Msn.VE.UI.Color.Yellow;
break;
default:
return Msn.VE.UI.Color.Yellow
}
};
VE_TrafficManager.CreatePopupContent = function (a) {
var b = '
";
return b
};
VE_TrafficManager._GetSeverity = function (a) {
switch (a) {
case 0:
return VE_TrafficManager.Severity.Serious;
break;
case 1:
return VE_TrafficManager.Severity.Moderate;
break;
case 2:
return VE_TrafficManager.Severity.Minor;
break;
default:
return VE_TrafficManager.Severity.Minor
}
};
VE_TrafficManager._RemoveDuplicates = function (c) {
if (c == null || c == "undefined") return;
var a = VE_TrafficManager.incidents[c];
if (a == null) return;
for (var b = 0; b < a.length; b++) for (var d = b + 1; d < a.length; d++) if (a[b].Id == a[d].Id) a.splice(b, 1)
};
VE_TrafficManager.ClearTraffic = function () {
VE_TrafficManager._ClearPins();
if (VE_TrafficManager.m_vemap != null) {
VE_TrafficManager.m_vemap.DetachEvent("onmouseover", VE_TrafficManager.MouseOverMarketIconHandler);
VE_TrafficManager.m_vemap.DetachEvent("onmouseout", VE_TrafficManager.MouseOutMarketIconHandler)
}
if (VE_TrafficManager.m_vemap != null && VE_TrafficManager.m_vemap.vemapcontrol != null) {
VE_TrafficManager.m_vemap.vemapcontrol.ClearTileLayer("Traffic");
VE_TrafficManager.HideTrafficLegend();
if (VE_TrafficManager.m_vemap.vemapcontrol.IsModeEnabled(Msn.VE.MapActionMode.Mode3D)) VE_TrafficManager.m_vemap.vemapcontrol.Remove3DTraffic()
}
VE_TrafficManager.MarketIcons = [];
VE_TrafficManager.turnedOn = false;
VE_TrafficManager.ExpireAutoRefresh()
};
VE_TrafficManager.Destroy = function () {
VE_TrafficManager.ClearTraffic();
VE_TrafficManager.incidentsAvailable = false;
VE_TrafficManager.flowAvailable = false;
if (VE_TrafficManager.incidents != null) {
if (VE_TrafficManager.markets[0] != null) for (var c = 0; c < VE_TrafficManager.markets[0].length; c++) {
var b = VE_TrafficManager.markets[0][c].Id,
i = VE_TrafficManager.incidents[b];
if (i == null) continue;
var a = VE_TrafficManager.incidents[b].pop();
if (a == null) continue;
for (var e = 0; e < a.length; e++) {
var f = a.pop();
f = null
}
a = null
}
VE_TrafficManager.incidents[b] = null
}
if (VE_TrafficManager.markets != null && VE_TrafficManager.markets[0] != null && VE_TrafficManager.markets[0].length > 0) {
var h = VE_TrafficManager.markets[0].length;
for (var d = 0; d < h; d++) {
var g = VE_TrafficManager.markets[0].pop();
g = null
}
VE_TrafficManager.markets[0] = null
}
VE_TrafficManager.m_vemap = null
};
VE_TrafficManager._ClearPins = function (e) {
if (VE_TrafficManager.markets == null || VE_TrafficManager.markets.length <= 0) return;
var c = VE_TrafficManager.markets[0];
if (c != null && c.length > 0) for (var a = 0; a < c.length; a++) if (c[a].pushPin && c[a].pushPin.ID != null) {
VE_TrafficManager.m_vemap.DeletePushpin(c[a].pushPin.ID);
c[a].pushPin = null
}
if (VE_TrafficManager.m_vemap != null && VE_TrafficManager.m_vemap.pushpins != null && VE_TrafficManager.m_vemap.pushpins.length > 0 && VE_TrafficManager.MarketIcons != null) for (var a = 0; a < VE_TrafficManager.MarketIcons.length; a++) VE_TrafficManager.m_vemap.DeletePushpin(VE_TrafficManager.MarketIcons[a]);
if (VE_TrafficManager.incidents == null || VE_TrafficManager.incidents.length <= 0) return;
if (e) {
var b = VE_TrafficManager.incidents[e];
if (b == null) return;
for (var a = 0; a < b.length; a++) if (b[a].pushPin && b[a].pushPin.ID != null) {
VE_TrafficManager.m_vemap.DeletePushpin(b[a].pushPin.ID);
b[a].pushPin = null
}
} else if (c != null && c.length > 0) for (var d = 0; d < VE_TrafficManager.markets[0].length; d++) {
var f = VE_TrafficManager.markets[0][d].Id,
b = VE_TrafficManager.incidents[f];
if (b == null) continue;
for (var a = 0; a < b.length; a++) if (b[a].pushPin && b[a].pushPin.ID != null) {
VE_TrafficManager.m_vemap.DeletePushpin(b[a].pushPin.ID);
b[a].pushPin = null
}
b = null
}
};
VE_TrafficManager._ViewChangeNotification = function () {
if (VE_TrafficManager.m_vemap.vemapcontrol.IsMapViewOblique()) return;
if (!VE_TrafficManager.turnedOn) return;
var a = VE_TrafficManager.m_vemap.GetZoomLevel();
if (VE_TrafficManager.prevZoomLevel <= VE_TrafficManager.displayAtZoomlevelMin && a > VE_TrafficManager.displayAtZoomlevelMin) VE_TrafficManager.isViewDirty = true;
else if (VE_TrafficManager.prevZoomLevel > VE_TrafficManager.displayAtZoomlevelMin && a <= VE_TrafficManager.displayAtZoomlevelMin) VE_TrafficManager.isViewDirty = true;
else if (VE_TrafficManager.prevZoomLevel < VE_TrafficManager.displayAtZoomlevelMax && a >= VE_TrafficManager.displayAtZoomlevelMax) VE_TrafficManager.isViewDirty = true;
else if (VE_TrafficManager.prevZoomLevel >= VE_TrafficManager.displayAtZoomlevelMax && a < VE_TrafficManager.displayAtZoomlevelMax) VE_TrafficManager.isViewDirty = true;
else if (Msn.VE.MapStyle.IsViewOblique(VE_TrafficManager.prevMapStyle)) VE_TrafficManager.isViewDirty = true;
else {
var b = VE_TrafficManager._GetIncidentMarkets();
if (b != null && b.length > 0) for (var c = 0; c < b.length; c++) {
var e = false;
for (var d = 0; d < VE_TrafficManager.showingMarkets.length; d++) if (b[c] == VE_TrafficManager.showingMarkets[d]) {
e = true;
break
}
if (!e) {
VE_TrafficManager.isViewDirty = true;
break
} else VE_TrafficManager.isViewDirty = false
} else VE_TrafficManager.isViewDirty = true
}
VE_TrafficManager.prevZoomLevel = a;
VE_TrafficManager.prevMapStyle = VE_TrafficManager.m_vemap.GetMapStyle();
if (VE_TrafficManager.isViewDirty) window.setTimeout("VE_TrafficManager.GetTrafficInfo()", 1);
VE_TrafficManager.RenewAutoRefresh()
};
VE_TrafficManager.ExpireAutoRefresh = function () {
if (VE_TrafficManager.masterTimer != null) window.clearInterval(VE_TrafficManager.masterTimer);
if (VE_TrafficManager.slaveTimer != null) window.clearInterval(VE_TrafficManager.slaveTimer)
};
VE_TrafficManager.RenewAutoRefresh = function () {
if (!VE_TrafficManager.turnedOn) return;
VE_TrafficManager.ExpireAutoRefresh();
VE_TrafficManager.masterTimer = window.setInterval("VE_TrafficManager.ExpireAutoRefresh()", VE_TrafficManager.m_vemap.vemapcontrol.GetSlidingExpirationForAutoRefresh());
VE_TrafficManager.slaveTimer = window.setInterval(VE_TrafficManager.AutoRefresh, VE_TrafficManager.m_vemap.vemapcontrol.GetAutoRefreshRate())
};
VE_TrafficManager.AutoRefresh = function () {
try {
var a = VE_TrafficManager.m_vemap.GetZoomLevel();
if (a >= 9) VE_TrafficManager.GetTrafficInfo()
} catch (b) {}
};
VE_TrafficIncidentType = new function () {
this.ScheduledConstruction = "SCHEDULED CONSTRUCTION";
this.OtherNews = "OTHER NEWS";
this.Congestion = "CONGESTION";
this.Accident = "ACCIDENT";
this.DisabledVehicle = "DISABLED VEHICILE";
this.RoadHazard = "ROAD HAZARD";
this.UnscheduledConstruction = "UNSCHEDULED CONSTRUCTION";
this.PlannedEvent = "PLANNED EVENT";
this.MassTransit = "MASS TRANSIT";
this.Weather = "WEATHER";
this.Miscellaneous = "MISCELLANEOUS"
};
function VE_Market(h, g, f, e, c, d, b, a) {
this.Id = h;
this.Name = g;
this.GMTOffset = f;
this.SWLatitude = e;
this.SWLongitude = c;
this.NELatitude = d;
this.NELongitude = b;
if (a.indexOf("Flow") == 0) this.Flow = "Flow";
if (a.indexOf("Incidents") != -1) this.Incident = "Incidents"
}
function VE_Incident(h, k, b, g, j, f, d, a, e, i, c) {
this.MarketId = h;
this.Id = k;
this.Description = b;
this.Location = g;
this.Type = j;
this.Latitude = f;
this.Longitude = d;
this.Criticality = a;
this.Starttime = e;
this.Endtime = i;
this.Direction = c
}
VE_TrafficManager.ShowTrafficLegend = function (a, b) {
if (VE_TrafficManager.turnedOn) {
if (VE_TrafficManager.legend == null) {
VE_TrafficManager.legend = VE_TrafficManager.m_vemap.vemapcontrol.CreateLegend();
if (VE_TrafficManager.legend != null) VE_TrafficManager.legend.ShowTrafficLegend(true)
}
if (VE_TrafficManager.legend && typeof a != "undefined" && a != null && typeof b != "undefined" && b != null) {
VE_TrafficManager.legend.UnPin();
VE_TrafficManager.legend.MoveTo(a, b);
VE_TrafficManager.legendPinned = false
}
VE_TrafficManager.m_vemap.vemapcontrol.OnView3DScaleBarPositionUpdate()
}
};
VE_TrafficManager.HideTrafficLegend = function () {
if (VE_TrafficManager.legend != null) {
VE_TrafficManager.legend.ShowTrafficLegend(false);
VE_TrafficManager.legend = null;
VE_TrafficManager.m_vemap.vemapcontrol.OnView3DScaleBarPositionUpdate()
}
};
VE_TrafficManager.SetTrafficLegendText = function (a) {
if (VE_TrafficManager.legend != null) {
if (typeof a == "undefined" || a == null) a = "";
VE_TrafficManager.legend.SetTrafficLegendMsg(a)
}
};
function VETime() {}
VETime.FormatTime = function (a) {
if (a == null || a == "" || a == "undefined") return "";
var c = false,
d = a.substr(0, 10),
e = a.substr(11, 5),
b = "";
if (a.indexOf("AM") > -1) {
b = "AM";
c = true
} else b = "PM";
return d + " " + VETime.ConvertTo12HourFormat(e, c) + " " + b
};
VETime.ConvertTo12HourFormat = function (d, c) {
var a = d;
try {
var b = parseFloat(a.replace(":", "."));
if (b > 12) if (b < 13 && c != true);
else b = b - 12;
a = b.toFixed(2);
a = a.replace(".", ":")
} catch (e) {
a = ""
}
return a
};
VETime.FormatPanelTime = function (a, g) {
if (a == null || a == "" || a == "undefined") return "";
try {
var b = 0,
d = false,
i = a.substr(4, 8),
h = a.indexOf(":"),
f = a.substr(h - 2, 5),
c = "";
if (a.indexOf("AM") > -1) {
c = "AM";
d = true;
b = a.indexOf("AM")
} else {
c = "PM";
b = a.indexOf("PM")
}
var e = "";
if (b > 0) e = a.substr(b + 3, 3);
if (g) return i + " " + VETime.ConvertTo12HourFormat(f, d) + " " + c + " " + e;
else return VETime.ConvertTo12HourFormat(f, d) + " " + c + " " + e
} catch (j) {}
};
VETime.getMonth = function (a) {
switch (a) {
case "01":
return " Jan";
case "02":
return " Feb";
case "03":
return " Mar";
case "04":
return " Apr";
case "05":
return " May";
case "06":
return " Jun";
case "07":
return " Jul";
case "08":
return " Aug";
case "09":
return " Sep";
case "10":
return " Oct";
case "11":
return " Nov";
case "12":
return " Dec"
}
};
VE_SetModuleStatus(VE_ModuleName.APITRAFFIC, "loaded");
VEMap.prototype.SetAltitude = function (a) {
try {
VEValidator.ValidateFloat(a, "level");
var b = parseFloat(a);
this._QueueRequest(this.vemapcontrol.SetAltitude, b)
} catch (c) {
throw c;
return
}
};
VEMap.prototype.SetPitch = function (b) {
try {
VEValidator.ValidateFloat(b, "pitch");
var a = parseFloat(b);
a = a % 360;
if (a > 0) a = a < 1 ? 0 : -90;
if (a < -90) a = -90;
this._QueueRequest(this.vemapcontrol.SetTilt, a)
} catch (c) {
throw c;
return
}
};
VEMap.prototype.SetHeading = function (b) {
try {
VEValidator.ValidateFloat(b, "heading");
var a = parseFloat(b);
a = a % 360;
if (a < 0) a = 360 + a;
this._QueueRequest(this.vemapcontrol.SetDirection, a)
} catch (c) {
throw c;
return
}
};
VEMap.prototype.GetAltitude = function () {
return this.vemapcontrol.GetAltitude()
};
VEMap.prototype.GetPitch = function () {
return this.vemapcontrol.GetTilt()
};
VEMap.prototype.GetHeading = function () {
return this.vemapcontrol.GetDirection()
};
VEMap.prototype._Toggle3DNavigationControl = function (b) {
if (this.GetMapMode() == VEMapMode.Mode3D) {
var a = this.vemapcontrol.Get3DControl();
if (a != null) a.ShowNavigationControl = b
}
};
VEMap.prototype.Show3DNavigationControl = function () {
this._Toggle3DNavigationControl(true)
};
VEMap.prototype.Hide3DNavigationControl = function () {
this._Toggle3DNavigationControl(false)
};
VEMap.prototype.Show3DBirdseye = function (b) {
VEValidator.ValidateBoolean(b, "birdseyeOption");
if (this.GetMapMode() == VEMapMode.Mode3D && this.vemapcontrol) {
var a = this.GetMapStyle(),
c = a == VEMapStyle.Road || a == VEMapStyle.Hybrid || a == VEMapStyle.Shaded;
this.vemapcontrol.Show3DBirdseye(b, c)
}
};
function MVC_Init_AbstractView_Shared() {
Msn.MVC.AbstractView.prototype.GetMoveMenuOptionAsHtml = function (a) {
return a
}
}
function MVC_Init_View3D_Shared() {
Msn.MVC.View3D.prototype.GetMoveMenuOptionAsHtml = function (d, c) {
var e = c.GetPrimitiveCount();
for (var a = 0; a < e; a++) {
var b = c.GetPrimitive(a).type;
if (b == VEShapeType.Polyline || b == VEShapeType.Polygon) return ""
}
return d
}
}
function MVC_Init_ViewFacade_Shared() {
Msn.MVC.ViewFacade.prototype.GetMoveMenuOptionAsHtml = function (a, b) {
if (this._curMvcView == null) return "";
return this._curMvcView.GetMoveMenuOptionAsHtml(a, b)
}
}
function MVC_Init_AbstractView_Drawing() {
Msn.MVC.AbstractView.prototype.OnAfterViewChanged = function () {};
Msn.MVC.AbstractView.prototype.OnAllCollectionLayersRepaint = function () {
this._DrawAllCollectionLayers()
};
Msn.MVC.AbstractView.prototype.OnAllCollectionLayersClear = function () {
this._ClearAllCollectionLayers()
};
Msn.MVC.AbstractView.prototype.OnCollectionLayerRepaint = function (a) {
this._DrawCollectionLayer(a)
};
Msn.MVC.AbstractView.prototype.OnCollectionLayerClear = function (a) {
this._ClearCollectionLayer(a)
};
Msn.MVC.AbstractView.prototype.OnEntityRepaint = function (b, a, c, d) {
this._DrawEntity(b, a, c, d)
};
Msn.MVC.AbstractView.prototype.OnEntityLabelRepaint = function (a, b) {
this._DrawEntityLabel(a, b)
};
Msn.MVC.AbstractView.prototype.OnHighlightEntity = function (b, a) {
this._HighlightEntity(b, a)
};
Msn.MVC.AbstractView.prototype.OnEntityClear = function (a) {
this._ClearEntity(a)
};
Msn.MVC.AbstractView.prototype.OnEntityPrimitiveRepaint = function (c, a, b) {
this._DrawEntityPrimitive(c, a, b)
};
Msn.MVC.AbstractView.prototype.OnEntityPrimitiveClear = function (b, a) {
this._ClearEntityPrimitive(b, a)
};
Msn.MVC.AbstractView.prototype.OnContextMenuRemoveContextPin = function () {
map.RemovePushpin("context_pin");
this._contextPin = null
};
Msn.MVC.AbstractView.prototype.OnContextMenuPlaceContextPin = function (b, a, c) {
this._contextPin = map.AddPushpin("context_pin", b, a, 7, 7, "VE_Pushpin VE_Pushpin_" + c, "", VE_ScratchpadManager.pinZIndex, Msn.VE.PushPinTypes.Context)
};
Msn.MVC.AbstractView.prototype.GetDefaultMapCoordinatesToPutPushpin = function () {
var a = this._contextPin;
if (a == null) return [0, 0];
var c = a.vePushpin.GetLatitude(),
b = a.vePushpin.GetLongitude();
return [b, c]
}
}
function MVC_Init_FlatlandView_Drawing() {
Msn.MVC.FlatlandView.prototype.OnAfterViewChanged = function () {
VE_EditControl.DrawUnfinishedGeometry();
this._DrawAllCollectionLayers()
};
Msn.MVC.FlatlandView.prototype._DrawAllCollectionLayers = function () {
this._GetMapDrawingView().DrawAll()
};
Msn.MVC.FlatlandView.prototype._ClearAllCollectionLayers = function () {
this._GetMapDrawingView().ClearAll()
};
Msn.MVC.FlatlandView.prototype._DrawCollectionLayer = function (a) {
this._GetMapDrawingView().UpdateIndex();
this._GetMapDrawingView().DrawLayer(a)
};
Msn.MVC.FlatlandView.prototype._ClearCollectionLayer = function (a) {
this._GetMapDrawingView().ClearLayerDom(a)
};
Msn.MVC.FlatlandView.prototype._DrawEntity = function (b, a, c, d) {
this._GetMapDrawingView().DrawEntity(b, a, c, d)
};
Msn.MVC.FlatlandView.prototype._DrawEntityLabel = function (a, b) {
this._GetMapDrawingView().DrawEntityLabel(a, b)
};
Msn.MVC.FlatlandView.prototype._HighlightEntity = function (b, a) {
this._GetMapDrawingView().HighlightEntity(b, a)
};
Msn.MVC.FlatlandView.prototype._ClearEntity = function (a) {
this._GetMapDrawingView().ClearEntityDom(a)
};
Msn.MVC.FlatlandView.prototype._DrawEntityPrimitive = function (c, a, b) {
this._GetMapDrawingView().DrawPrimitive(c, a, b)
};
Msn.MVC.FlatlandView.prototype._ClearEntityPrimitive = function (b, a) {
this._GetMapDrawingView().ClearPrimitiveDom(b, a)
};
Msn.MVC.FlatlandView.prototype._GetMapDrawingView = function () {
if (this._mapDrawingView == null) this._mapDrawingView = new Msn.Drawing.MapFlatlandView;
return this._mapDrawingView
}
}
function MVC_Init_View3D_Drawing() {
Msn.MVC.View3D.prototype._DrawAllCollectionLayers = function () {
var c = VE_MapManager.GetCollectionCount();
for (var a = 0; a < c; a++) {
var b = VE_MapManager.GetCollectionByIndex(a);
b._index = a;
this._DrawCollectionLayer(b)
}
};
Msn.MVC.View3D.prototype._ClearAllCollectionLayers = function () {};
Msn.MVC.View3D.prototype._DrawCollectionLayer = function (a) {
this._ClearCollectionLayer(a);
if (a.GetVisibility()) {
var d = false;
if (a.GetType() == MC_COL_TYPE_FAVORITE) d = true;
var e = a.GetShapeCount();
for (var b = 0; b < e; b++) {
var c = a.Annotations[b];
c.SetIndex(b);
if (c.GetVisibility()) this._DrawEntity(c, null, false, d, a)
}
}
};
Msn.MVC.View3D.prototype._ClearCollectionLayer = function (b) {
var c = b.GetShapeCount();
for (var a = 0; a < c; a++) this._ClearEntity(b.Annotations[a])
};
Msn.MVC.View3D.prototype._HighlightEntity = function (a, c) {
if (a == null) return;
var e = a.GetId(),
d = a.GetPrimitive(0);
if (d.type == VEShapeType.Pushpin) return;
var b = e + this._entityIdShapePostfix;
this._spacecontrol.SetGeometryHighlight(this._hackUniqueLayerId, b, c)
};
Msn.MVC.View3D.prototype._DrawEntityLabel = function (d, u) {
var e = d.GetPrimitive(0),
c = u;
if (typeof c == "undefined" || c == null) {
c = new _VE_EntityDrawingState;
c.zIndexIcon = this._GetZIndex(null, d);
c.zIndexPolyShape = this._GetZIndexPolyShape(null, d);
c.minZoomLevel = b(d);
c.maxZoomLevel = a(d);
c.isShared = false
}
if (!c.text) {
if (typeof c.zIndexIcon == "undefined" || c.zIndexIcon == null) c.zIndexIcon = this._GetZIndex(null, d);
c.text = this._GetDefautlStyleProperties(d, d.GetIndex() + 1, c.zIndexIcon)
}
var h = c.text,
m = this._hackUniqueLayerId,
s = d.GetBusinessListingId(),
l = "title_search3",
p = c.isShared,
r = d.IsOverlay(),
k = d.GetId(),
i = null,
j = null,
o = 0,
f = e.symbol,
g = null;
if (p) l = "shared";
if (d.IsModel()) if (p) l = "sharemodel";
else l = "model";
else if (e.type == VEShapeType.Pushpin) {
var q = r ? Msn.VE.PushPinTypes.Overlay : Msn.VE.PushPinTypes.Annotation;
if (p) g = PushpinURL(q, "shared");
else if (typeof s != "undefined" && parseInt(s) != 0) g = PushpinURL(q, "business");
else g = PushpinURL(q)
}
if (d.IconUrl) g = d.IconUrl;
else if (!g) g = PushpinURL(Msn.VE.PushPinTypes.SearchResultPrecise, l);
if (e.type == VEShapeType.Pushpin) {
i = e.points[0];
j = e.points[1];
if (f == null) {
e.symbol = VE_MapDispatch_SymbolLib.GetMapSymbolByID(MC_PROPERTY_PUSHPIN);
f = e.symbol
}
} else {
f = this._GetPrimitiveSymbolOrDefault(e);
i = e.labelPosX;
j = e.labelPosY;
o = e.labelPosZ
}
if (f && r) {
if (!f.textbox_OffsetX) f.textbox_OffsetX = "50%";
if (!f.textbox_OffsetY) f.textbox_OffsetY = "50%";
if (h && h.indexOf("textoffset") == -1) h += ' textoffset ="' + f.textbox_OffsetX + "," + f.textbox_OffsetY + '" '
}
var v = typeof Msn.VE.API != "undefined" && Msn.VE.API != null;
if (v) {
g = f.imagedata_src;
h = this._GetAPIProperties(d, f, c.zIndexIcon, c.minZoomLevel, c.maxZoomLevel)
}
if (e.type == VEShapeType.Pushpin) {
var t = d.ModelData != null && typeof d.ModelData == "object";
if (!t || e.isLabel) if (e.altitudes == null) this._spacecontrol.AddPointWithProperties(m, k, j, i, g, h);
else {
var n = e.altitudes[0];
if (d.IsModel() && parseFloat(n) < 0) n = 0;
this._spacecontrol.AddPointWithAltitudeAndProperties(m, k, j, i, n, g, h)
}
} else if (e.isLabel) if (o) this._spacecontrol.AddPointWithAltitudeAndProperties(m, k, j, i, o, g, h);
else this._spacecontrol.AddPointWithProperties(m, k, j, i, g, h)
};
Msn.MVC.View3D.prototype._DrawPolyline = function (f, d) {
var c = f.GetPrimitive(0),
l = f.GetId();
if (c.type == VEShapeType.Pushpin) return;
var g = this._ConvertPointArrayToView3DParameter(c.points, c.altitudes),
b = this._GetPrimitiveSymbolOrDefault(c),
k = this._ConvertStrokeWeightToView3DParameter(b.stroke_weight),
h = d.zIndexPolyShape,
j = d.minZoomLevel,
i = d.maxZoomLevel,
a = [];
a.push("Linecolor='");
a.push(b.stroke_color);
a.push("'");
a.push(" Lineweight='");
a.push(k);
a.push("'");
a.push(" zindex='");
a.push(h);
a.push("'");
a.push(" Dashstyle='");
a.push(b.stroke_dashstyle);
a.push("'");
a.push(" minLOD='");
a.push(j);
a.push("'");
a.push(" maxLOD='");
a.push(i);
a.push("'");
a.push(" extruded='");
a.push(c.extruded);
a.push("'");
a.push(" altitudeMode='");
a.push(c.altitudeMode);
a.push("'");
a.push(" Lineopacity='");
a.push(b.stroke_opacity);
a.push("'");
a.push(" highlightlinecolor='");
a.push(b.stroke_color2);
a.push("'");
var e = l + this._entityIdShapePostfix;
if (c.type == VEShapeType.Polygon) {
a.push(" Fillcolor='");
a.push(b.fill_color);
a.push("'");
a.push(" Fillopacity='");
a.push(b.fill_opacity);
a.push("'");
a.push(" highlightfillcolor='");
if (b.fill_color2.indexOf("#") == 0 && b.fill_color2.length < 8) b.fill_color2 = "#4C" + b.fill_color2.substring(1);
a.push(b.fill_color2);
a.push("'");
this._spacecontrol.AddPolygonWithProperties(this._hackUniqueLayerId, e, g, a.join(""))
} else this._spacecontrol.AddPolylineWithProperties(this._hackUniqueLayerId, e, g, a.join(""))
};
Msn.MVC.View3D.prototype._DrawEntity = function (c, l, o, n, k) {
if (c == null) return;
var h = c.GetId();
if (!c.GetVisibility()) {
this._spacecontrol.DeleteGeometry(this._hackUniqueLayerId, h);
return
}
var e = typeof k != "object" ? null : k;
if (c.IsModel()) {
var g, f = "clientid=" + c.GetId();
if (c.ModelData) {
f = f.concat(";", c.ModelData.Properties, ";maxLod=", a(c), ";minLod=", b(c));
g = VE_ModelActionType.LoadModelFile
} else {
f += ";msnid=" + c.GetMsnId();
if (!e) e = VE_MapManager.GetSelectedCollection();
f += ";cclientid=" + e.GetId() + ";cmsnid=" + e.GetMsnId();
g = VE_ModelActionType.AddModel
}
ProcessModelIn3D(g, f, this._spacecontrol)
}
var m = c.GetPrimitive(0),
d = new _VE_EntityDrawingState;
d.minZoomLevel = b(c);
d.maxZoomLevel = a(c);
d.isShared = n;
d.parentEl = l;
var i = m.type == VEShapeType.Pushpin ? true : false,
j = typeof Msn.VE.API != "undefined" && Msn.VE.API != null;
if (i || j || !j && VE_MapManager.IsHighlightEntity(h)) {
d.zIndexIcon = this._GetZIndex(e, c);
d.text = this._GetDefautlStyleProperties(c, c.GetIndex() + 1, d.zIndexIcon);
this._DrawEntityLabel(c, d)
}
if (!i) {
d.zIndexPolyShape = this._GetZIndexPolyShape(e, c);
this._DrawPolyline(c, d)
}
};
Msn.MVC.View3D.prototype._GetDefautlStyleProperties = function (b, f, e) {
var c = "",
d = b.GetPrimitive(0),
a = [];
if (b.IconUrl) {
a.push('text=""');
a.push('width="32" ');
a.push('height="32" ')
} else a.push('text="' + (b.GetIndex() + 1) + '" ');
a.push('altitudeMode="' + d.altitudeMode + '" ');
a.push('zindex ="' + e + '" ');
c = a.join(" ");
return c
};
Msn.MVC.View3D.prototype._GetStyleProperties = function (f, i) {
var h = "",
g = "",
e = f.GetPrimitive(0),
d = e.symbol;
if (e.name) g = e.name;
var c = [];
c.push('text="' + g + '" ');
c.push('altitudeMode="' + e.altitudeMode + '" ');
c.push('width="' + d.img_width + '" ');
c.push('height="' + d.img_height + '" ');
c.push('textbold ="' + d.textbox_bold + '" ');
c.push('textfont="' + d.textbox_font + '" ');
c.push('textitalics="' + d.textbox_italic + '" ');
c.push('textunderline ="' + d.textbox_underscore + '" ');
c.push('textsize ="' + d.textbox_size + '" ');
c.push('minLOD ="' + b(f) + '" ');
c.push('maxLOD ="' + a(f) + '" ');
c.push('imageoffset ="' + d.img_offsetX + "," + d.img_offsetY + '" ');
c.push('textoffset ="' + d.textbox_OffsetX + "," + d.textbox_OffsetY + '" ');
var k = d.textbox_color.replace("#", "#" + parseInt(d.textbox_color_opacity * 255).toString(16)),
j = d.textbox_backcolor.replace("#", "#" + parseInt(d.textbox_backcolor_opacity * 255).toString(16));
c.push('forecolor="' + k + '" ');
c.push('backcolor ="' + j + '" ');
c.push('zindex ="' + i + '" ');
h = c.join(" ");
return h
};
Msn.MVC.View3D.prototype._GetAPIProperties = function (c, h, d, f, e) {
var b, g = c.GetPrimitive(0);
if (h.isOn) b = this._GetStyleProperties(c, d);
else {
var a = [];
a.push('text=""');
a.push('minLOD ="', f, '" ');
a.push('maxLOD ="', e, '" ');
a.push('altitudeMode ="', g.altitudeMode, '" ');
a.push('zindex ="' + d + '" ');
b = a.join(" ")
}
return b
};
function b(a) {
var b = a.minZoomLevel;
if (Msn.VE.API != null && a._shplayer != null && b < a._shplayer.MinScale) b = a._shplayer.MinScale;
return b
}
function a(a) {
var b = a.maxZoomLevel;
if (Msn.VE.API != null && a._shplayer != null && b > a._shplayer.MaxScale) b = a._shplayer.MaxScale;
return b
}
Msn.MVC.View3D.prototype._GetZIndex = function (a, b) {
var d = 60;
if (typeof Msn.VE.API == "undefined" || Msn.VE.API == null) {
if (a == null) a = VE_MapManager.GetCollectionByAnId(b.GetId());
if (a != null) d = c(a, b)
} else d = b.GetZIndex();
return d
};
Msn.MVC.View3D.prototype._GetZIndexPolyShape = function (a, b) {
var d = 60;
if (typeof Msn.VE.API == "undefined" || Msn.VE.API == null) {
if (a == null) a = VE_MapManager.GetCollectionByAnId(b.GetId());
if (a != null) d = c(a, b)
} else d = b.GetZIndexPolyShape();
return d
};
function c(c, a) {
var b = VE_MapManager.GetCollectionCount();
return (b - c._index) * MC_MAX_COL_SIZE + a.GetIndex()
}
Msn.MVC.View3D.prototype._ClearEntity = function (a) {
if (a.IsModel()) {
var b, c = "clientid=" + a.GetId();
if (a.ModelData) b = VE_ModelActionType.DeleteModelFile;
else {
c += ";msnid=" + a.GetMsnId() + "";
b = VE_ModelActionType.DeleteModel
}
ProcessModelIn3D(b, c, this._spacecontrol)
}
var e = a.GetId();
this._spacecontrol.DeleteGeometry(this._hackUniqueLayerId, e);
var d = a.GetPrimitive(0);
if (d == null || d.type != VEShapeType.Pushpin) {
var f = e + this._entityIdShapePostfix;
this._spacecontrol.DeleteGeometry(this._hackUniqueLayerId, f)
}
};
Msn.MVC.View3D.prototype._DrawEntityPrimitive = function () {};
Msn.MVC.View3D.prototype._ClearEntityPrimitive = function (a, b) {
if (a == null) return;
if (typeof b != "undefined" && b == true) if (a.type != VEShapeType.Pushpin) {
var c = Msn.Drawing.GetEntityUIDByPrimitiveUID(a.iid);
this._spacecontrol.DeleteGeometry(this._hackUniqueLayerId, c)
}
};
Msn.MVC.View3D.prototype._ConvertPointArrayToView3DParameter = function (c, b) {
var a = "",
d = c.length;
for (i = 0; i < d; i += 2) {
var e = c[i],
f = c[i + 1];
if (b == null || b.length != d / 2) a = a.concat(e, ",", f, " ");
else a = a.concat(e, ",", f, ",", b[i / 2], " ")
}
return a
};
Msn.MVC.View3D.prototype._ConvertStrokeWeightToView3DParameter = function (a) {
if (a == null) return "2px";
var b = parseInt(a);
if (isNaN(b)) return "2px";
else return b + "px"
};
Msn.MVC.View3D.prototype._GetPrimitiveSymbolOrDefault = function (b) {
var a = b.symbol;
if (a == null) return VE_MapDispatch_SymbolLib.GetCurrentDefaultSymbol();
return a
}
}
function MVC_Init_ViewFacade_Drawing() {}
VE_SetModuleStatus(VE_ModuleName.API3D, "loaded");
VEMap.prototype.Init3D = function () {
MVC_Init_AbstractView_Shared();
MVC_Init_ViewFacade_Shared();
MVC_Init_View3D_Shared();
MVC_Init_AbstractView_Drawing();
MVC_Init_ViewFacade_Drawing();
MVC_Init_FlatlandView_Drawing();
MVC_Init_View3D_Drawing()
};
if (typeof closeDependency != "undefined") closeDependency("mapcontrol.js")