Skip to content

Instantly share code, notes, and snippets.

@javisantana
Created April 25, 2016 06:50
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save javisantana/e5d2bfb4cd2cb68d7ac063190e2ba15c to your computer and use it in GitHub Desktop.
Save javisantana/e5d2bfb4cd2cb68d7ac063190e2ba15c to your computer and use it in GitHub Desktop.
first version of google maps source code (from archive.org)
/*
FILE ARCHIVED ON 3:09:27 feb 10, 2005 AND RETRIEVED FROM THE
INTERNET ARCHIVE ON 19:57:07 abr 24, 2016.
JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.
ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
SECTION 108(a)(3)).
*/
// Copyright 2005 Google
function ci(vg, Pf, yh) {
this.type = vg;
this.version = Pf;
this.os = yh
};
var m = new ci(0, 0, null);
var Eb = navigator.userAgent.toLowerCase();
if (Eb.indexOf("msie") != -1 && document.all) {
m.type = 1;
if (Eb.indexOf("msie 5")) m.version = 5
} else if (Eb.indexOf("safari") != -1) {
m.type = 3;
if (Eb.indexOf("safari/125") != -1) m.version = 1
} else if (Eb.indexOf("mozilla") != -1) {
m.type = 2
}
if (Eb.indexOf("x11;") != -1) {
m.os = 1
};
var _timeoutCounter = 0;
Object.prototype.setTimeout = function(Zd, Kh) {
var ae = "tempVar" + _timeoutCounter;
_timeoutCounter++;
eval(ae + " = this;");
var dh = Zd.replace(/\\/g, "\\\\").replace(/\"/g, '\\"');
return window.setTimeout(ae + '._setTimeoutDispatcher("' + dh + '");' + ae + " = null;", Kh)
};
Object.prototype._setTimeoutDispatcher = function(Zd) {
eval(Zd)
};
Object.prototype.eventHandler = function(Rf) {
var h = this;
h = h;
return function(b) {
if (!b) b = window.event;
if (b && !b.target) b.target = b.srcElement;
h[Rf](b)
}
};
String.prototype.xmlEscape = function() {
return this.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;")
};
String.prototype.jsEscape = function() {
return this.replace(/\\/g, "\\\\").replace(/\'/g, '\\"').xmlEscape()
};
Array.prototype.clear = function() {
while (this.length > 0) this.pop()
};
document.getElementsByClassName = function(ia) {
var ec = document.all;
if (!ec) ec = document.getElementsByTagName("*");
var ge = new Array();
for (var a = 0; a < ec.length; a++) {
if (ec[a].className == ia) {
ge[ge.length] = ec[a]
}
}
return ge
};
function o() {}
o.createElement = function(C, ac) {
var f;
if (m.type == 1) {
f = document.createElement("DIV");
f.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + C + (ac ? '",sizingMethod=crop)' : '")')
} else {
f = document.createElement("IMG");
f.src = C
}
return f
};
o.create = function(C, g, k, K, top, Ga, ac, xa) {
return zb.create(C, g, k, K, top, Ga, ac, xa, o.createElement)
};
function zb() {}
zb.create = function(C, g, k, K, top, Ga, ac, xa, of) {
var f;
if (!of) {
f = document.createElement("IMG");
if (C) f.src = C
} else {
f = of(C, ac)
}
if (g && k) {
f.style.width = yb(g);
f.style.height = yb(k);
f.width = g;
f.height = k
}
if (top || (K || (top == 0 || K == 0))) {
f.style.position = "absolute";
f.style.left = yb(K);
f.style.top = yb(top)
}
if (Ga || Ga == 0) {
f.style.zIndex = Ga
}
if (m.type == 1) {
f.unselectable = "on";
f.onselectstart = Sd
} else {
f.className = "noselect"
}
f.oncontextmenu = Sd;
if (xa) {
Nb(f, xa)
}
return f
};
function Oh(Ze, ia, pf) {
if (m.type == 1) {
Ze.attachEvent("on" + ia, pf)
} else {
Ze.addEventListener(ia, pf, false)
}
}
function Z(b) {
if (m.type == 1) {
window.event.cancelBubble = true
} else {
b.cancelBubble = true;
b.preventDefault();
b.stopPropagation()
}
}
function Sg(Fb, ai) {
var ld = window.document.createElement("a");
ld.href = "javascript:void(0)";
ld.onclick = ai;
ld.appendChild(window.document.createTextNode(Fb));
return ld
}
if (!Array.prototype.push) {
Array.prototype.push = function(Te) {
this[this.length] = Te
}
}
function Te(F) {
return document.getElementById(F)
}
function yb(x) {
return x + "px"
}
function Nb(c, xa) {
if (c.className) {
c.className += " " + xa
} else {
c.className = xa
}
}
function kh(D) {
var l = 0;
while (D) {
l += D.offsetTop;
D = D.offsetParent
}
return l
}
function sc(aa) {
this.size = 0;
if (aa) {
for (var a = aa.length - 1; a >= 0; a--) this.add(aa[a])
}
}
sc.prototype.add = function(kb) {
if (!this.contains(kb)) {
this[":" + kb] = 1;
this.size++
}
};
sc.prototype.remove = function(kb) {
if (this.contains(kb)) {
delete this[":" + kb];
this.size--
}
};
sc.prototype.contains = function(kb) {
return this[":" + kb] == 1
};
function Sd() {
return false
};
var q = "/web/20050210030927/http://www.google.com/mapfiles/";
var Be = "/web/20050210030927/http://maps.google.com";
var Rc = new Array("q", "ll", "spn", "z", "t", "sll", "sspn", "vp", "f", "output", "deb");
function Ja() {
this.args = new Object();
this.reset()
}
Ja.prototype.setValue = function(ia, O) {
this.args[ia] = O
};
Ja.prototype.setAllMapValues = function(p) {
this.setValue("ll", this.getLatLngArg(p.getCenterLatLng()));
this.setValue("spn", this.getSpanArg(p.getSpanLatLng()));
this.setValue("z", p.zoomLevel);
this.setValue("t", this.getSpecArg(p.spec))
};
Ja.prototype.getLatLngArg = function(j) {
return cd(j.y) + "," + cd(j.x)
};
Ja.prototype.getSpanArg = function(Ma) {
return cd(Ma.height) + "," + cd(Ma.width)
};
Ja.prototype.getSpecArg = function(Ub) {
return Ub == Cc ? null : "i"
};
Ja.prototype.reset = function() {
for (var a = 0; a < Rc.length; a++) {
this.args[Rc[a]] = null
}
if (window._df && window._df.length > 0) {
this.setValue("deb", window._df)
}
};
Ja.prototype.getURL = function(Gh) {
var Kd = new Array();
for (var a = 0; a < Rc.length; a++) {
var ia = Rc[a];
if (this.args[ia]) {
Kd.push(ia + "=" + encodeURIComponent(this.args[ia]))
}
}
var lb = "/maps";
if (Kd.length > 0) lb += "?" + Kd.join("&");
if (Gh) return Be + lb;
return lb
};
function cd(fb) {
if (fb.toFixed) {
return fb.toFixed(6).toString()
} else {
return fb.toString()
}
};
var db = new Object();
function qa(F, Ba) {
this.id = F;
this.ticketClass = Ba
}
qa.create = function(Ba) {
if (!Ba) Ba = "_dtc";
if (!db[Ba]) db[Ba] = 1;
else db[Ba]++;
return new qa(db[Ba], Ba)
};
qa.invalidateAll = function() {
for (var a in db) {
try {
db[a]++
} catch (b) {}
}
};
qa.invalidate = function(xa) {
db[xa]++
};
qa.prototype.isValid = function() {
return db[this.ticketClass] == this.id
};
function Xd() {}
Xd.create = function() {
if (m.type == 1) {
var Ud = m.version == 5 ? "Microsoft.XMLHTTP" : "Msxml2.XMLHTTP";
return new ActiveXObject(Ud)
} else {
return new XMLHttpRequest()
}
};
function Y(Vc) {
if (m.type == 1) {
this.stylesheet = Vc
} else if (m.type != 3) {
this.processor = new XSLTProcessor();
this.processor.importStylesheet(Vc)
}
}
Y.cache_ = new Object();
Y.create = function(Vc) {
return new Y(Vc)
};
Y.getCached = function(lb) {
return Y.cache_[lb]
};
Y.cache = function(lb, Nf) {
Y.cache_[lb] = Nf
};
Y.prototype.transformToHTML = function(qc, vb) {
if (this.stylesheet) {
vb.innerHTML = qc.transformNode(this.stylesheet)
} else {
var Uh = this.processor.transformToFragment(qc, window.document);
vb.innerHTML = "";
vb.appendChild(Uh)
}
};
Y.asynchronousTransform = function(qc, vb, kc, Nc, Ba) {
if (m.type == 3) return;
var cc = Y.getCached(kc);
if (cc) {
cc.transformToHTML(qc, vb);
if (Nc) Nc();
return
}
var yc = qa.create(Ba);
var sa = Xd.create();
nd('<a href="' + kc.xmlEscape() + '">' + kc.xmlEscape() + "</a>", 0);
sa.open("GET", kc, true);
sa.onreadystatechange = function() {
if (sa.readyState == 4) {
if (yc.isValid()) {
try {
var Db = sa.responseXML;
var cc = Y.create(Db);
Y.cache(kc, cc);
cc.transformToHTML(qc, vb);
if (Nc) Nc()
} catch (b) {}
}
}
};
sa.send(null)
};
function Ug(c) {
while (c.hasChildNodes()) {
c.removeChild(c.lastChild)
}
}
function fg(str) {
if (m.type == 1) {
var Ud = m.version == 5 ? "Microsoft.XmlDom" : "Msxml2.XmlDom";
var Db = new ActiveXObject(Ud);
Db.loadXML(str);
return Db
} else {
return (new DOMParser()).parseFromString(str, "text/xml")
}
};
function nd(Sh, ja) {}
Object.prototype.trace = function(Sh, ja, ii) {};
function I() {}
I.start = function() {};
I.end = function() {};
I.addTime = function(te) {};
function n(x, l) {
this.x = x;
this.y = l
}
n.prototype.toString = function() {
return "(" + this.x + ", " + this.y + ")"
};
n.prototype.equals = function(Q) {
if (!Q) return false;
return this.x == Q.x && this.y == Q.y
};
n.prototype.distanceFrom = function(Q) {
var va = this.x - Q.x;
var za = this.y - Q.y;
return Math.sqrt(va * va + za * za)
};
n.prototype.approxEquals = function(Q) {
if (!Q) return false;
return zc(this.x, Q.x) && zc(this.y, Q.y)
};
function L(g, k) {
this.width = g;
this.height = k
}
L.prototype.toString = function() {
return "(" + this.width + ", " + this.height + ")"
};
L.prototype.equals = function(Q) {
if (!Q) return false;
return this.width == Q.width && this.height == Q.height
};
L.prototype.approxEquals = function(Q) {
if (!Q) return false;
return zc(this.width, Q.width) && zc(this.height, Q.height)
};
function zc(lg, qh) {
return Math.round(lg * 1000000) == Math.round(qh * 1000000)
}
function T(Nh, Jg, ed, Jc) {
this.minX = Nh;
this.minY = Jg;
this.maxX = ed;
this.maxY = Jc
}
T.prototype.toString = function() {
return "Bounds(" + this.minX + "," + this.minY + "," + this.maxX + "," + this.maxY + ")"
};
T.prototype.containsSegment = function(md, Pc) {
if (this.minX > md.x && this.minX > Pc.x) return false;
if (this.maxX < md.x && this.maxX < Pc.x) return false;
if (this.minY > md.y && this.minY > Pc.y) return false;
if (this.maxY < md.y && this.maxY < Pc.y) return false;
return true
};
T.prototype.containsBounds = function(pd) {
return this.minX < pd.minX && (this.maxX > pd.maxX && (this.minY < pd.minY && this.maxY > pd.maxY))
};
function Wb(Sf) {
this.ticks = Sf;
this.tick = 0
}
Wb.prototype.reset = function() {
this.tick = 0
};
Wb.prototype.next = function() {
this.tick++;
var Ta = Math.PI * (this.tick / this.ticks - 0.5);
return (Math.sin(Ta) + 1) / 2
};
Wb.prototype.more = function() {
return this.tick < this.ticks
};
function Ng(O, aa) {
if (!aa) aa = new Array();
while (O >= 32) {
aa.push(String.fromCharCode((32 | O & 31) + 63));
O >>= 5
}
aa.push(String.fromCharCode(O + 63));
return aa
}
function Mb(O, aa) {
return Ng(O < 0 ? ~(O << 1) : O << 1, aa)
}
function Lb(ah, yd, he, Dd) {
this.numLevels = he;
this.zoomFactor = Dd;
this.decodePolyline(ah);
this.decodeLevels(yd);
this.minTolerance = 1.0E-5
}
Lb.prototype.decodePolyline = function(Vb) {
I.start("Polyline", "decodePolyline");
var Ch = Vb.length;
var pb = 0;
var aa = new Array();
var Ka = 0;
var Pa = 0;
while (pb < Ch) {
var ub;
var oc = 0;
var Fa = 0;
do {
ub = Vb.charCodeAt(pb++) - 63;
Fa |= (ub & 31) << oc;
oc += 5
} while (ub >= 32);
Ka = Ka + (Fa & 1 ? ~(Fa >> 1) : Fa >> 1);
aa.push(Ka);
oc = 0;
Fa = 0;
do {
ub = Vb.charCodeAt(pb++) - 63;
Fa |= (ub & 31) << oc;
oc += 5
} while (ub >= 32);
Pa = Pa + (Fa & 1 ? ~(Fa >> 1) : Fa >> 1);
aa.push(Pa)
}
this.points = aa;
this.numPoints = this.points.length >> 1;
I.end("Polyline", "decodePolyline")
};
Lb.prototype.decodeLevels = function(Vb) {
I.start("Polyline", "decodeLevels");
var Xc = new Array(this.numLevels);
for (var oe = 0; oe < this.numLevels; ++oe) Xc[oe] = new Array();
var a = 0;
for (var U = 0; U < this.numPoints; ++U) {
var wb = Vb.charCodeAt(a++) - 63;
while (wb >= 0) {
var Ob = Xc[wb--];
while (Ob.length < U) {
Ob.push(U)
}
}
}
for (var wb = 0; wb < this.numLevels; ++wb) {
var Ob = Xc[wb];
for (var U = Ob.length; U < this.numPoints; ++U) {
Ob.push(this.numPoints)
}
}
this.nextPointIndexAtLevel = Xc;
I.end("Polyline", "decodeLevels")
};
Lb.prototype.getPoint = function(pb, j) {
if (j == null) j = new n();
pb <<= 1;
j.y = this.points[pb] * 1.0E-5;
j.x = this.points[pb + 1] * 1.0E-5;
return j
};
Lb.prototype.getVectors = function(A, J, v) {
I.start("Polyline", "getVectors");
if (v == null) v = new Array();
this.getVectorsHelper(A, 0, this.numPoints - 1, this.numLevels - 1, J, v);
I.end("Polyline", "getVectors");
return v
};
Lb.prototype.getVectorsHelper = function(A, Rh, tb, ja, Cf, v) {
var vc = 7.62939453125E-6;
for (var a = ja; a > 0; --a) {
vc *= this.zoomFactor
}
var _expandedBounds = new T();
_expandedBounds.minX = Math.floor((A.minX - vc) * 100000);
_expandedBounds.minY = Math.floor((A.minY - vc) * 100000);
_expandedBounds.maxX = Math.ceil((A.maxX + vc) * 100000);
_expandedBounds.maxY = Math.ceil((A.maxY + vc) * 100000);
var bc = Rh;
var mc;
var la = new n();
la.y = this.points[bc << 1];
la.x = this.points[(bc << 1) + 1];
var na = new n();
while ((mc = this.nextPointIndexAtLevel[ja][bc]) <= tb) {
na.y = this.points[mc << 1];
na.x = this.points[(mc << 1) + 1];
if (_expandedBounds.containsSegment(la, na)) {
if (ja > Cf) {
this.getVectorsHelper(A, bc, mc, ja - 1, Cf, v)
} else {
v.push(la.y * 1.0E-5);
v.push(la.x * 1.0E-5);
v.push(na.y * 1.0E-5);
v.push(na.x * 1.0E-5)
}
}
var Yd = la;
la = na;
na = Yd;
bc = mc
}
};
var ei = q + "markerTransparent.png";
function d(P, Ub, g, k, Yf, xe) {
if (!P) return;
this.container = P;
this.disablePopups = Yf;
this.disableDragging = xe;
this.zoomLevel = 0;
this.topLeftTile = null;
this.currentPanOffset = new L(0, 0);
this.centerBitmap = new n(0, 0);
this.tilePaddingOffset = new L(0, 0);
this.tableSize = new L(0, 0);
this.overlays = new Array();
this.locations = new Array();
this.panDistance = new L(0, 0);
this.panKeys = new sc();
this.setSpecification(Ub);
this.container.style.overflow = "hidden";
if (this.container.style.position != "absolute") this.container.style.position = "relative";
this.container.style.backgroundColor = this.spec.backgroundColor;
if (!g || !k) {
g = this.container.offsetWidth;
k = this.container.offsetHeight
}
this.viewSize = new L(g, k);
if (m.type == 1) {
this.container.onresize = this.eventHandler("onResize");
window.onblur = this.eventHandler("onWindowBlur")
} else {
window.addEventListener("resize", this.eventHandler("onResize"), false);
window.addEventListener("blur", this.eventHandler("onWindowBlur"), false)
}
this.div = this.createMapDiv();
this.container.appendChild(this.div);
if (!this.disablePopups) {
this.infoWindow = new t("14em", this.eventHandler("onInfoCloseClick"), this.div, 50, 20)
}
this.directionsDiv = document.createElement("div");
this.directionsDiv.directionsBounds = new T(-Infinity, -Infinity, Infinity, Infinity);
this.div.appendChild(this.directionsDiv);
this.dragObject = new Na(this.div, 0, 0);
this.dragObject.ondrag = this.eventHandler("onDrag");
this.dragObject.ondragstart = this.eventHandler("onDragStart");
this.dragObject.ondragend = this.eventHandler("onDragEnd");
this.div.ondblclick = this.eventHandler("onDoubleClick");
this.dragObject.onclick = this.eventHandler("onClick");
if (xe) {
this.dragObject.disable()
}
this.initializeMap();
this.onzoom = null;
this.onpan = null;
this.onmousedown = null;
this.onspecificationchange = null;
this.oninfowindowclose = null;
this.onresize = null;
this.stateListeners = null
}
d.prototype.createMapDiv = function() {
var i = document.createElement("div");
i.style.position = "absolute";
i.style.top = "0px";
i.style.left = "0px";
i.style.zIndex = 0;
i.style.backgroundColor = this.spec.backgroundColor;
return i
};
d.prototype.loadTileImages = function() {
while (this.tileImages.length > this.tableSize.width) {
var Ve = this.tileImages.pop();
for (var a = 0; a < Ve.length; a++) {
this.div.removeChild(Ve[a])
}
}
for (var a = this.tileImages.length; a < this.tableSize.width; a++) {
this.tileImages.push(new Array())
}
for (var a = 0; a < this.tileImages.length; a++) {
while (this.tileImages[a].length > this.tableSize.height) {
var f = this.tileImages[a].pop();
this.div.removeChild(f)
}
for (var G = this.tileImages[a].length; G < this.tableSize.height; G++) {
var f = zb.create(null, this.spec.tileSize, this.spec.tileSize, null, null, 0, null, null);
f.style.position = "absolute";
this.tileImages[a].push(f);
this.div.appendChild(f);
this.configureImage(f, a, G)
}
}
};
d.prototype.deleteTiles = function() {
if (this.tileImages) {
for (var a = 0; a < this.tileImages.length; a++) {
if (this.tileImages[a]) {
for (var G = 0; G < this.tileImages[a].length; G++) {
this.div.removeChild(this.tileImages[a][G])
}
}
}
}
this.tileImages = null
};
d.prototype.initializeMap = function() {
this.deleteTiles();
this.tileImages = new Array();
this.calculateTileMeasurements();
this.loadTileImages()
};
d.prototype.getSpanLatLng = function(e) {
if (!e) e = new L(0, 0);
var wa = this.spec.getLatLng(this.centerBitmap.x - this.viewSize.width / 2, this.centerBitmap.y - this.viewSize.height / 2, this.zoomLevel);
var ra = this.spec.getLatLng(this.centerBitmap.x + this.viewSize.width / 2, this.centerBitmap.y + this.viewSize.height / 2, this.zoomLevel);
e.width = Math.abs(ra.x - wa.x);
e.height = Math.abs(ra.y - wa.y);
return e
};
d.prototype.getCenterLatLng = function(e) {
if (!e) e = new n(0, 0);
if (this.centerLatLng) {
e.x = this.centerLatLng.x;
e.y = this.centerLatLng.y;
return e
}
if (this.lastLatLng) {
var V = this.spec.getBitmapCoordinate(this.lastLatLng.y, this.lastLatLng.x, this.zoomLevel);
if (V.equals(this.centerBitmap)) {
e.x = this.lastLatLng.x;
e.y = this.lastLatLng.y;
return e
}
}
var j = this.spec.getLatLng(this.centerBitmap.x, this.centerBitmap.y, this.zoomLevel);
e.x = j.x;
e.y = j.y;
return e
};
d.prototype.getBoundsBitmap = function(e) {
if (!e) e = new T(0, 0, 0, 0);
e.minX = this.centerBitmap.x - this.viewSize.width / 2;
e.minY = this.centerBitmap.y - this.viewSize.height / 2;
e.maxX = this.centerBitmap.x + this.viewSize.width / 2;
e.maxY = this.centerBitmap.y + this.viewSize.height / 2;
return e
};
d.prototype.getBoundsLatLng = function(e) {
e = this.getBoundsBitmap(e);
var wa = this.spec.getLatLng(e.minX, e.minY, this.zoomLevel);
var ra = this.spec.getLatLng(e.maxX, e.maxY, this.zoomLevel);
e.minX = wa.x;
e.minY = ra.y;
e.maxX = ra.x;
e.maxY = wa.y;
return e
};
d.prototype.calculateTileMeasurements = function() {
var mh = Math.ceil(this.viewSize.width / this.spec.tileSize) + 2;
var Lg = Math.ceil(this.viewSize.height / this.spec.tileSize) + 2;
this.tableSize.width = mh;
this.tableSize.height = Lg;
var sb = Math.floor((this.tableSize.width * this.spec.tileSize - this.viewSize.width) / 2);
var jb = Math.floor((this.tableSize.height * this.spec.tileSize - this.viewSize.height) / 2);
this.tilePaddingOffset.width = sb;
this.tilePaddingOffset.height = jb
};
d.prototype.configureImage = function(f, x, l) {
var ug = (this.currentPanOffset.width + x) * this.spec.tileSize;
var Wh = (this.currentPanOffset.height + l) * this.spec.tileSize;
var K = -this.tilePaddingOffset.width + ug;
var top = -this.tilePaddingOffset.height + Wh;
if (f.tileLeft != K || f.tileTop != top) {
f.style.left = K + "px";
f.style.top = top + "px";
f.tileLeft = K;
f.tileTop = top
}
if (!this.topLeftTile) {
f.src = this.spec.emptyTileURL
} else {
var C = this.spec.getTileURL(this.topLeftTile.x + x, this.topLeftTile.y + l, this.zoomLevel);
if (f.src != C) {
f.src = this.spec.emptyTileURL;
f.src = C;
f.style.display = ""
}
}
};
d.prototype.onDrag = function() {
if (!this.topLeftTile) return;
this.onMove();
this.rotateTiles()
};
var _moveOffset = new L(0, 0);
d.prototype.onMove = function() {
this.centerLatLng = null;
var Aa = this.getCurrentOffset(_moveOffset);
var x = this.topLeftTile.x * this.spec.tileSize + Math.floor(this.viewSize.width / 2) + this.tilePaddingOffset.width - Aa.width;
var l = this.topLeftTile.y * this.spec.tileSize + Math.floor(this.viewSize.height / 2) + this.tilePaddingOffset.height - Aa.height;
this.centerBitmap.x = x;
this.centerBitmap.y = l;
this.drawDirections(this.directions, this.directionsDiv);
if (this.onpan) this.onpan(x, l)
};
var _rotateOffset = new L(0, 0);
d.prototype.rotateTiles = function() {
var Aa = this.getCurrentOffset(_rotateOffset);
if (Math.abs(this.dragObject.left) > 10000000 || Math.abs(this.dragObject.top) > 10000000) {
this.cancelPan();
this.centerAtBitmap(this.centerBitmap);
return
}
while (Aa.width < -this.tilePaddingOffset.width / 2) {
this.rotateRight();
this.getCurrentOffset(Aa)
}
while (Aa.width > this.tilePaddingOffset.width / 2) {
this.rotateLeft();
this.getCurrentOffset(Aa)
}
while (Aa.height < -this.tilePaddingOffset.height / 2) {
this.rotateDown();
this.getCurrentOffset(Aa)
}
while (Aa.height > this.tilePaddingOffset.height / 2) {
this.rotateUp();
this.getCurrentOffset(Aa)
}
};
d.prototype.rotateLeft = function() {
this.currentPanOffset.width--;
this.topLeftTile.x--;
var Qa = this.tileImages.pop();
if (Qa) {
this.tileImages.unshift(Qa);
for (var a = 0; a < Qa.length; a++) {
this.configureImage(Qa[a], 0, a)
}
}
};
d.prototype.rotateRight = function() {
this.currentPanOffset.width++;
this.topLeftTile.x++;
var Qa = this.tileImages.shift();
this.tileImages.push(Qa);
var x = this.tileImages.length - 1;
for (var a = 0; a < Qa.length; a++) {
this.configureImage(Qa[a], x, a)
}
};
d.prototype.rotateUp = function() {
this.currentPanOffset.height--;
this.topLeftTile.y--;
for (var a = 0; a < this.tileImages.length; a++) {
var f = this.tileImages[a].pop();
this.tileImages[a].unshift(f);
this.configureImage(f, a, 0)
}
};
d.prototype.rotateDown = function() {
this.currentPanOffset.height++;
this.topLeftTile.y++;
var l = this.tileImages[0].length - 1;
for (var a = 0; a < this.tileImages.length; a++) {
var f = this.tileImages[a].shift();
this.tileImages[a].push(f);
this.configureImage(f, a, l)
}
};
d.prototype.getTotalOffset = function(c) {
if (!c) return new L(0, 0);
var gf = this.getTotalOffset(c.offsetParent);
return new L(gf.width + c.offsetLeft, gf.height + c.offsetTop)
};
d.prototype.onDragStart = function(b) {
if (this.onmousedown) this.onmousedown(b)
};
d.prototype.onDragEnd = function(b) {
this.onStateChanged()
};
d.prototype.onDoubleClick = function(b) {
if (this.disableDragging) return;
var j = this.getRelativeClickPoint(b, this.container);
var xc = Math.floor(this.viewSize.width / 2) - j.x;
var Zb = Math.floor(this.viewSize.height / 2) - j.y;
this.pan(xc, Zb)
};
d.prototype.onClick = function(b) {
this.closeInfoWindow()
};
d.prototype.getRelativeClickPoint = function(b, qg, e) {
if (!e) e = new n();
if (b.x || b.y) {
e.x = b.x;
e.y = b.y
} else {
var hd = this.getTotalOffset(qg);
e.x = b.pageX - hd.width;
e.y = b.pageY - hd.height
}
return e
};
d.prototype.reconfigureAllImages = function() {
if (this.tileImages.length == 0) return;
var Yc = new Array();
for (var a = 0; a < this.tileImages.length; a++) {
for (var G = 0; G < this.tileImages[a].length; G++) {
f = this.tileImages[a][G];
f.coordX = a;
f.coordY = G;
var Df = Math.min(a, this.tileImages.length - a - 1);
var Re = Math.min(G, this.tileImages[a].length - G - 1);
if (Df == 0 || Re == 0) {
f.priority = 0
} else {
f.priority = Df + Re
}
Yc.push(f)
}
}
Yc.sort(function(xg, Lh) {
return Lh.priority - xg.priority
});
for (var a = 0; a < Yc.length; a++) {
var f = Yc[a];
if (m.type == 1) this.div.removeChild(f);
this.configureImage(f, f.coordX, f.coordY);
if (m.type == 1) this.div.appendChild(f)
}
};
d.prototype.pan = function(va, za) {
if (!this.topLeftTile) return;
var Va = Math.sqrt(va * va + za * za);
var oh = Math.max(10, Math.floor(Va / 20));
this.panSiner = new Wb(oh);
this.panSiner.reset();
this.panDistance.width = va;
this.panDistance.height = za;
this.panStart = new n(this.dragObject.left, this.dragObject.top);
this.doPan()
};
d.prototype.doPan = function() {
var Ta = this.panSiner.next();
this.dragObject.moveTo(this.panStart.x + this.panDistance.width * Ta, this.panStart.y + this.panDistance.height * Ta);
this.onMove();
if (this.panSiner.more()) {
this.panTimeout = this.setTimeout("this.doPan()", 10);
this.rotateTiles()
} else {
this.panTimeout = null;
this.onStateChanged()
}
};
d.prototype.cancelPan = function() {
if (this.panTimeout) {
clearTimeout(this.panTimeout)
}
};
d.prototype.recenterOrPanToLatLng = function(j) {
if (!this.topLeftTile) return;
this.centerLatLng = new n(j.x, j.y);
this.lastLatLng = this.centerLatLng;
var j = this.spec.getBitmapCoordinate(this.centerLatLng.y, this.centerLatLng.x, this.zoomLevel);
this.recenterOrPanToBitmap(j)
};
d.prototype.recenterOrPanToBitmap = function(j) {
if (!this.topLeftTile) return;
var xc = this.centerBitmap.x - j.x;
var Zb = this.centerBitmap.y - j.y;
if (xc == 0 && Zb == 0) return;
if (Math.abs(xc) < this.viewSize.width && Math.abs(Zb) < this.viewSize.height) {
this.pan(xc, Zb);
return
}
this.centerAtBitmap(j);
this.onStateChanged()
};
d.prototype.centerAndZoom = function(Hc, J) {
var He = false;
if (J != this.zoomLevel) {
var Wd = this.zoomLevel;
this.zoomLevel = J;
He = true
}
this.centerAtLatLng(Hc);
if (He && this.onzoom) this.onzoom(Wd, this.zoomLevel);
this.onStateChanged()
};
d.prototype.centerAtLatLng = function(j) {
this.centerLatLng = new n(j.x, j.y);
this.lastLatLng = this.centerLatLng;
var j = this.spec.getBitmapCoordinate(this.centerLatLng.y, this.centerLatLng.x, this.zoomLevel);
this.centerAtBitmap(j)
};
d.prototype.centerAtBitmap = function(j) {
this.centerBitmap.x = j.x;
this.centerBitmap.y = j.y;
var K = j.x - Math.floor(this.viewSize.width / 2) - this.tilePaddingOffset.width;
var top = j.y - Math.floor(this.viewSize.height / 2) - this.tilePaddingOffset.height;
var Qb = Math.floor(K / this.spec.tileSize);
var gc = Math.floor(top / this.spec.tileSize);
var sb = Qb * this.spec.tileSize - K;
var jb = gc * this.spec.tileSize - top;
if (sb < -this.tilePaddingOffset.width / 2) {
Qb++;
sb += this.spec.tileSize
} else if (sb > this.tilePaddingOffset.width / 2) {
Qb--;
sb -= this.spec.tileSize
}
if (jb < -this.tilePaddingOffset.height / 2) {
gc++;
jb += this.spec.tileSize
} else if (jb > this.tilePaddingOffset.height / 2) {
gc--;
jb -= this.spec.tileSize
}
if (!this.topLeftTile) {
this.topLeftTile = new n(Qb, gc)
} else {
this.topLeftTile.x = Qb;
this.topLeftTile.y = gc
}
this.currentPanOffset.width = 0;
this.currentPanOffset.height = 0;
this.reconfigureAllImages();
this.repositionOverlays();
this.dragObject.moveTo(sb, jb);
this.onStateChanged()
};
d.prototype.addStateListener = function(Vg) {
if (!this.stateListeners) this.stateListeners = new Array();
this.stateListeners.push(Vg)
};
d.prototype.onStateChanged = function() {
if (!this.topLeftTile) return;
if (this.stateListeners) {
for (var a = 0; a < this.stateListeners.length; a++) {
this.stateListeners[a].onMapStateChanged(this)
}
}
};
d.prototype.onResize = function(b) {
if (this.viewSize.width != this.container.offsetWidth || this.viewSize.height != this.container.offsetHeight) {
this.viewSize.width = this.container.offsetWidth;
this.viewSize.height = this.container.offsetHeight;
this.calculateTileMeasurements();
this.loadTileImages();
this.centerAtBitmap(this.centerBitmap);
if (this.onresize) this.onresize()
}
};
d.prototype.getCurrentOffset = function(e) {
if (!e) e = new L(0, 0);
e.width = this.dragObject.left + this.currentPanOffset.width * this.spec.tileSize;
e.height = this.dragObject.top + this.currentPanOffset.height * this.spec.tileSize;
return e
};
d.prototype.switchSpecification = function(ab) {
if (this.spec == ab) return;
var wd = this.spec;
var B = this.getCenterLatLng();
this.setSpecification(ab);
this.div.style.backgroundColor = this.spec.backgroundColor;
if (wd.tileSize != ab.tileSize) {
this.topLeftTile = null;
this.initializeMap()
}
this.centerAtLatLng(B);
if (this.onspecificationchange) this.onspecificationchange(wd, ab)
};
d.prototype.setSpecification = function(ab) {
this.spec = ab;
var hh = new Image();
hh.src = this.spec.emptyTileURL
};
d.prototype.zoomTo = function(ja) {
if (!this.topLeftTile) return;
if (ja >= this.spec.numZoomLevels) {
ja = this.spec.numZoomLevels - 1
} else if (ja < 0) {
ja = 0
}
var Wd = this.zoomLevel;
if (ja != Wd) {
var B = this.getCenterLatLng();
this.centerAndZoom(B, ja)
}
};
d.prototype.toggleTileBorders = function() {
if (this.tileImages) {
for (var a = 0; a < this.tileImages.length; a++) {
if (this.tileImages[a]) {
for (var G = 0; G < this.tileImages[a].length; G++) {
var f = this.tileImages[a][G];
if (f.hasBorder) {
f.style.border = "0";
f.hasBorder = false
} else {
f.style.border = "1px solid black";
f.hasBorder = true
}
}
}
}
}
};
d.prototype.addOverlay = function(ha) {
this.overlays.push(ha);
this.locations.clear();
for (var a = 0; a < this.overlays.length; a++) {
var ha = this.overlays[a];
if (ha.locations) {
for (var G = 0; G < ha.locations.length; G++) {
var r = ha.locations[G];
if (r.icon.iconClass.name != "noicon") {
this.locations.push(r)
}
}
}
}
this.locations.sort(d.orderLocations);
for (var a = 0; a < this.locations.length; a++) {
var r = this.locations[a];
if (!r.marker) {
r.marker = this.createLocalMarker(r);
this.setMarkerPosition(r.marker, r.icon.iconClass, r.point)
}
r.marker.icon.style.zIndex = 10 + a;
r.marker.transparentIcon.style.zIndex = 30 + a
}
if (this.locations.length == 1) {
this.clearInfoWindowArgs(r.xml);
this.showInfoWindow(this.locations[0])
}
};
function cb(W, Ib, Ua, p, Sb) {
this.icon = W;
this.transparentIcon = Ib;
this.shadow = Ua;
this.layer = [W, Ib, Ua];
this.map = p;
this.mouseTarget = Sb
}
cb.prototype.addLayer = function(f) {
this.layer.push(f)
};
cb.prototype.setPosition = function(x, l) {
for (var a = 0; a < this.layer.length; ++a) {
this.layer[a].style.left = yb(x);
this.layer[a].style.top = yb(l)
}
};
cb.prototype.appendTo = function(i) {
for (var a = 0; a < this.layer.length; ++a) {
i.appendChild(this.layer[a])
}
};
cb.prototype.removeFrom = function(i) {
for (var a = 0; a < this.layer.length; ++a) {
i.removeChild(this.layer[a])
}
};
cb.prototype.hide = function() {
for (var a = 0; a < this.layer.length; ++a) {
this.layer[a].style.display = "none"
}
};
cb.prototype.show = function() {
for (var a = 0; a < this.layer.length; ++a) {
this.layer[a].style.display = ""
}
};
cb.prototype.isVisible = function() {
return this.layer[0].style.display != "none"
};
d.prototype.createLocalMarker = function(r) {
var pa = this.createLocationMarker(r.icon.image, r.icon.iconClass);
var h = this;
pa.mouseTarget.onmousedown = function(b) {
return h.onIconMouseDown(r, b)
};
return pa
};
var _imageMapCounter = 0;
d.prototype.createLocationMarker = function(Ue, s) {
var W = o.create(Ue, s.width, s.height, 0, 0, 10, false, "noprint");
var Ib = o.create(ei, s.width, s.height, 0, 0, 30, false, "noprint");
var Ua = o.create(s.shadowURL, s.shadowWidth, s.height, 0, 0, 3, false, "noprint");
var Uf = m.type == 2 ? "ff" : "ie";
var Kf = zb.create(Ue.replace(/\.png$/, Uf + ".gif"), s.width, s.height, 0, 0, 10, false, "noscreen");
var eg = s.shadowURL.replace(/[^\/]*$/, "dithshadow.gif");
var Cg = zb.create(eg, s.shadowWidth, s.height, 0, 0, 3, false, "noscreen");
var p = null;
var Sb = Ib;
if (m.type == 2) {
var hf = "map" + _imageMapCounter;
_imageMapCounter++;
p = document.createElement("map");
p.setAttribute("name", hf);
var z = document.createElement("area");
z.setAttribute("shape", "poly");
z.setAttribute("alt", "");
z.setAttribute("coords", s.imageMap);
z.setAttribute("href", "javascript:void(0)");
Sb = z;
p.appendChild(z);
this.div.appendChild(p);
Ib.setAttribute("usemap", "#" + hf)
} else {
Sb.style.cursor = "pointer"
}
var Dc = new cb(W, Ib, Ua, p, Sb);
Dc.addLayer(Kf);
if (m.type != 2) {
Dc.addLayer(Cg)
}
Dc.appendTo(this.div);
return Dc
};
d.prototype.clearOverlays = function() {
this.lastPageCenter = this.getCenterLatLng();
this.lastPageZoom = this.zoomLevel;
for (var a = 0; a < this.locations.length; a++) {
var r = this.locations[a];
r.marker.removeFrom(this.div);
if (r.marker.map) this.div.removeChild(r.marker.map);
r.marker = null
}
this.closeInfoWindow();
this.overlays.clear();
this.locations.clear();
this.directions = null;
this.drawDirections(null, this.directionsDiv)
};
d.prototype.getDivCoordinate = function(x, l, e) {
if (!e) e = new n(0, 0);
var Hh = x - this.topLeftTile.x * this.spec.tileSize - this.tilePaddingOffset.width + this.currentPanOffset.width * this.spec.tileSize;
var tg = l - this.topLeftTile.y * this.spec.tileSize - this.tilePaddingOffset.height + this.currentPanOffset.height * this.spec.tileSize;
e.x = Hh;
e.y = tg;
return e
};
d.orderLocations = function(Ye, ye) {
if (Ye.point.y > ye.point.y) return -1;
if (Ye.point.y < ye.point.y) return 1;
return 0
};
d.prototype.repositionOverlays = function() {
for (var a = 0; a < this.locations.length; a++) {
var Sa = this.locations[a];
this.setMarkerPosition(Sa.marker, Sa.icon.iconClass, Sa.point)
}
this.drawDirections(this.directions, this.directionsDiv, true);
if (!this.disablePopups) {
this.repositionInfoWindow();
if (m.type != 1 && this.infoWindow.hasMask()) this.addMarkersToInfoWindowMask()
}
};
d.prototype.setMarkerPosition = function(pa, s, Ef) {
var Pb = this.spec.getBitmapCoordinate(Ef.y, Ef.x, this.zoomLevel);
var wc = this.getDivCoordinate(Pb.x, Pb.y);
var x = wc.x - s.pointCoord.x;
var l = wc.y - s.pointCoord.y;
pa.setPosition(x, l)
};
d.prototype.loadVPage = function(E, xf, Hg) {
this.clearOverlays();
var B = xf ? xf : E.center;
var ka = Hg;
if (ka == null && E.viewSpan) {
ka = this.spec.getLowestZoomLevel(E.viewSpan, this.viewSize.width, this.viewSize.height)
}
this.lastPageZoom = ka;
this.lastPageCenter = B;
if (B) {
if (!this.topLeftTile || ka != null && ka != this.zoomLevel) {
if (!ka) ka = 4;
this.centerAndZoom(B, ka)
} else {
this.recenterOrPanToLatLng(B)
}
}
for (var a = 0; a < E.overlays.length; a++) {
this.addOverlay(E.overlays[a])
}
this.directions = E.directions;
this.drawDirections(this.directions, this.directionsDiv);
this.onStateChanged()
};
d.prototype.registerKeyHandlers = function(C) {
if (m.type == 1) {
C.onkeydown = this.eventHandler("onKeyPress");
C.onkeyup = this.eventHandler("onKeyUp")
} else {
C.addEventListener("keypress", this.eventHandler("onKeyPress"), false);
C.addEventListener("keyup", this.eventHandler("onKeyUp"), false)
}
};
d.prototype.onKeyPress = function(b) {
if (this.ignoreKeyEvent(b)) return true;
switch (b.keyCode) {
case 38:
case 40:
case 37:
case 39:
this.panKeys.add(b.keyCode);
this.startContinuousPan();
return false;
case 34:
this.pan(0, -Math.floor(this.viewSize.height * 0.75));
return false;
case 33:
this.pan(0, Math.floor(this.viewSize.height * 0.75));
return false;
case 36:
this.pan(Math.floor(this.viewSize.width * 0.75), 0);
return false;
case 35:
this.pan(-Math.floor(this.viewSize.width * 0.75), 0);
return false;
case 187:
case 107:
this.zoomTo(this.zoomLevel - 1);
return false;
case 189:
case 109:
this.zoomTo(this.zoomLevel + 1);
return false
}
switch (b.which) {
case 61:
case 43:
this.zoomTo(this.zoomLevel - 1);
return false;
case 45:
case 95:
this.zoomTo(this.zoomLevel + 1);
return false
}
return true
};
d.prototype.onKeyUp = function(b) {
switch (b.keyCode) {
case 38:
case 40:
case 37:
case 39:
this.panKeys.remove(b.keyCode);
return false
}
};
d.prototype.ignoreKeyEvent = function(b) {
if (b.ctrlKey || (b.altKey || b.metaKey)) return true;
if (b.target && (b.target.nodeName == "INPUT" && b.target.getAttribute("type").toLowerCase() == "text" || b.target.nodeName == "TEXTAREA")) {
return true
}
return false
};
d.prototype.startContinuousPan = function() {
if (!this.topLeftTile) return;
this.cancelPan();
if (!this.continuousPanTimeout) {
this.panSiner = new Wb(100);
this.continuousPanTimeout = this.setTimeout("this.doContinuousPan()", 5)
}
};
d.prototype.doContinuousPan = function() {
if (this.panKeys.size > 0) {
var Pd = (this.panKeys.contains(37) ? 1 : 0) + (this.panKeys.contains(39) ? -1 : 0);
var re = (this.panKeys.contains(38) ? 1 : 0) + (this.panKeys.contains(40) ? -1 : 0);
var Ta = 1;
if (this.panSiner.more()) Ta = this.panSiner.next();
var fb = Pd > 0 ? Math.floor : Math.ceil;
var va = fb(7 * Ta * Pd + 5 * Pd);
fb = re > 0 ? Math.floor : Math.ceil;
var za = fb(7 * Ta * re + 5 * re);
this.dragObject.moveTo(this.dragObject.left + va, this.dragObject.top + za);
this.onMove();
this.rotateTiles();
this.continuousPanTimeout = this.setTimeout("this.doContinuousPan()", 10)
} else {
this.continuousPanTimeout = null;
this.onStateChanged()
}
};
d.prototype.onWindowBlur = function(b) {
if (this.panKeys.size > 0) {
this.panKeys = new sc()
}
};
d.prototype.onIconMouseDown = function(r, b) {
Z(b);
if (this.onmousedown) this.onmousedown();
this.clearInfoWindowArgs(r.xml);
this.showInfoWindow(r)
};
d.prototype.clearInfoWindowArgs = function(ca) {
ca.setAttribute("arg0", "");
ca.setAttribute("arg1", "");
ca.setAttribute("arg2", "")
};
d.prototype.infoWindowNavigate = function(Gg, Oe, Ff, We) {
if (!this.openLocation || this.disablePopups) return;
if (Oe) this.openLocation.xml.setAttribute("arg0", Oe);
if (Ff) this.openLocation.xml.setAttribute("arg1", Ff);
if (We) this.openLocation.xml.setAttribute("arg2", We);
this.onInfoWindowLoad = Gg;
this.showInfoWindow(this.openLocation)
};
var _infoBitmapCoord = new n(0, 0);
var _infoDivCoord = new n(0, 0);
d.prototype.showInfoWindow = function(r) {
if (this.disablePopups) return;
if (!r.infoStyle) return;
this.openLocation = r;
var V = this.spec.getBitmapCoordinate(r.point.y, r.point.x, this.zoomLevel, _infoBitmapCoord);
var ya = this.getDivCoordinate(V.x, V.y, _infoDivCoord);
this.infoWindow.point = r.point;
this.infoWindow.iconClass = r.icon.iconClass;
var h = this;
var ze = function() {
h.showSizedInfoWindow(ya.x, ya.y, r.icon.iconClass)
};
if (m.type != 3) {
Y.asynchronousTransform(r.xml, this.infoWindow.offscreenArea, r.infoStyle, ze)
} else {
r.toHTML(this.infoWindow.offscreenArea);
ze()
}
};
d.prototype.addMarkersToInfoWindowMask = function() {
if (this.disablePopups || (!this.infoWindow.isVisible() || !this.infoWindow.point)) return;
this.infoWindow.clearMaskMap();
var Da = new n(this.infoWindow.getOffsetLeft(), this.infoWindow.getOffsetTop());
var hb = new n(Da.x + this.infoWindow.getTotalWidth(), Da.y + this.infoWindow.getTotalHeight());
for (var a = 0; a < this.locations.length; a++) {
var pa = this.locations[a].marker;
if (pa.icon.offsetTop > hb.y) break;
this.addMarkerToInfoWindowMask(Da, hb, pa)
}
if (this.directionsMarkersAreVisible()) {
this.addMarkerToInfoWindowMask(Da, hb, this.directionsStart);
this.addMarkerToInfoWindowMask(Da, hb, this.directionsEnd)
}
};
d.prototype.addMarkerToInfoWindowMask = function(Da, hb, pa) {
var W = pa.icon;
if (W.offsetLeft + W.width >= Da.x && (W.offsetLeft <= hb.x && (W.offsetTop + W.height >= Da.y && W.offsetTop <= hb.y))) {
var le = M.get("local").translateImageMapArray(W.offsetLeft - Da.x, W.offsetTop - Da.y);
this.infoWindow.addAreaToMaskMap(le, pa.mouseTarget.onmousedown)
}
};
d.prototype.showSizedInfoWindow = function(x, l, s, ad) {
qa.invalidate("infoWindowOffscreen");
var yc = qa.create("infoWindowOffscreen");
this.infoWindow.prepareOffscreen();
var p = this;
var vh = function() {
if (yc.isValid()) {
p.infoWindow.flipOffscreenArea();
p.infoWindow.sizeToContent(ad);
p.infoWindow.positionAt(x, l, s);
if (m.type != 1 && p.infoWindow.hasMask()) p.addMarkersToInfoWindowMask();
p.infoWindow.show();
p.panToInfoWindow();
if (p.onInfoWindowLoad) {
p.onInfoWindowLoad();
p.onInfoWindowLoad = null
}
}
};
window.setTimeout(vh, 0)
};
d.prototype.showMapBlowup = function(j, s) {
if (this.disablePopups) return;
var V = this.spec.getBitmapCoordinate(j.y, j.x, this.zoomLevel, _infoBitmapCoord);
var ya = this.getDivCoordinate(V.x, V.y, _infoDivCoord);
this.infoWindow.point = j;
this.infoWindow.iconClass = s ? s : M.get("noicon");
var P = document.createElement("div");
P.style.border = "1px solid silver";
P.style.width = "200px";
P.style.height = "200px";
var jd = new d(P, this.spec, 200, 200, true, true);
jd.directions = this.directions;
jd.centerAndZoom(j, 1);
this.onspecificationchange = function(wd, ab) {
jd.switchSpecification(ab)
};
this.infoWindow.clearOffscreenArea();
this.infoWindow.offscreenArea.appendChild(P);
this.showSizedInfoWindow(ya.x, ya.y, this.infoWindow.iconClass, 203);
return jd
};
d.prototype.createSpecChangeLink = function(p, Fb, Ub) {
var Kg = function() {
p.switchSpecification(Ub)
};
return Sg(Fb, Kg)
};
d.prototype.onInfoCloseClick = function(b) {
this.closeInfoWindow()
};
d.prototype.closeInfoWindow = function() {
if (!this.disablePopups) {
this.infoWindow.hide();
if (this.oninfowindowclose) this.oninfowindowclose()
}
};
d.prototype.panToInfoWindow = function() {
if (this.disablePopups) return;
var V = this.spec.getBitmapCoordinate(this.infoWindow.point.y, this.infoWindow.point.x, this.zoomLevel, _infoBitmapCoord);
var ya = this.getDivCoordinate(V.x, V.y, _infoDivCoord);
var ma = new n(this.centerBitmap.x, this.centerBitmap.y);
var K = this.infoWindow.left + (V.x - ya.x);
var top = this.infoWindow.top + (V.y - ya.y);
var Jf = Math.floor(this.viewSize.width / 2);
var td = Math.floor(this.viewSize.height / 2);
ma.y = Math.min(ma.y, top + td - 25);
ma.y = Math.max(ma.y, V.y - td + 25);
var fc = 25;
var Af = V.y - this.infoWindow.getTotalHeightAboveGround() - (ma.y - td);
if (Af < 55) fc = fc + 50;
else if (Af < 295) fc = fc + 35;
ma.x = Math.min(ma.x, K + Jf - fc);
ma.x = Math.max(ma.x, K + this.infoWindow.getTotalWidth() - Jf + 25);
this.centerLatLng = null;
this.recenterOrPanToBitmap(ma)
};
d.prototype.repositionInfoWindow = function() {
if (this.disablePopups || (!this.infoWindow.isVisible() || !this.infoWindow.point)) return;
var j = this.infoWindow.point;
var V = this.spec.getBitmapCoordinate(j.y, j.x, this.zoomLevel, _infoBitmapCoord);
var ya = this.getDivCoordinate(V.x, V.y, _infoDivCoord);
this.infoWindow.positionAt(ya.x, ya.y, this.infoWindow.iconClass)
};
var _csStartPoint = new n(0, 0);
var _csStartDivPoint = new n(0, 0);
var _csBitmapPoint = new n(0, 0);
//TALK
d.prototype.getVMLPathString = function(y) {
I.start("Map", "getVMLPathString");
var u = new Array();
u.push("m");
u.push(y.polyline.points[0]);
u.push(y.polyline.points[1]);
u.push("l");
u = u.concat(y.polyline.points);
for (var a = 0; a < y.segments.length; a++) {
var U = y.segments[a].pointIndex << 1;
var id = U + 4;
var Me = u[id];
var Bf = u[id + 1];
u[id] = Me + " " + Bf + " e m";
u[id + 1] = Me + " " + Bf + " l"
}
u.push("e");
var str = u.join(" ");
I.end("Map", "getVMLPathString");
return str
};
d.prototype.createRawVML = function(pe, i, c) {
I.start("Map", "createRawVML");
var ua;
var fi = false;
if (!c) {
c = document.createElement("v:shape");
ua = document.createElement("v:stroke");
c.appendChild(ua);
c.path = pe;
fi = true
} else {
i.removeChild(c);
ua = c.firstChild
}
var qb = this.centerBitmap;
var uc = this.getDivCoordinate(qb.x, qb.y, _csStartDivPoint);
c.unselectable = "on";
c.strokecolor = "blue";
c.strokeweight = 5;
c.fill = false;
c.filled = false;
var g = 100;
var k = 100;
c.style.position = "absolute";
c.style.width = g + "px";
c.style.height = k + "px";
c.style.left = uc.x + "px";
c.style.top = uc.y - k + "px";
c.style.rotation = "-90";
var Hc = this.getCenterLatLng();
var Nd = Hc.y * 100000 + " " + Hc.x * 100000;
c.coordorigin = Nd;
var Ne = this.spec.getPixelsPerDegree(this.zoomLevel);
c.coordsize = 100000 * k / Ne.y + " " + 100000 * g / Ne.x;
ua.joinstyle = "round";
ua.endcap = "round";
ua.opacity = 0.45;
I.end("Map", "createRawVML");
i.appendChild(c);
return c
};
d.prototype.getBitmapVectors = function(eb, v, A) {
if (!v) v = new Array();
if (!A) A = new T();
A.minX = Infinity;
A.minY = Infinity;
A.maxX = -Infinity;
A.maxY = -Infinity;
for (var a = 0; a < eb.length;) {
var Ka = eb[a++];
var Pa = eb[a++];
var ga = this.spec.getBitmapCoordinate(Ka, Pa, this.zoomLevel, _csStartPoint);
ga.x = Math.round(ga.x);
ga.y = Math.round(ga.y);
v.push(ga.x);
v.push(ga.y);
if (ga.x < A.minX) A.minX = ga.x;
if (ga.y < A.minY) A.minY = ga.y;
if (ga.x > A.maxX) A.maxX = ga.x;
if (ga.y > A.maxY) A.maxY = ga.y
}
return v
};
d.prototype.getVectorPath = function(v, A) {
var u = new Array();
var ic;
var hc;
for (var a = 0; a < v.length;) {
var ib = v[a++];
var mb = v[a++];
var Hb = v[a++];
var xb = v[a++];
if (mb != ic || ib != hc) {
u.push("m");
u.push(ib);
u.push(mb);
u.push("l")
}
u.push(Hb);
u.push(xb);
ic = xb;
hc = Hb
}
u.push("e");
return u.join(" ")
};
d.prototype.getEncodedImageSource = function(v, A) {
var u = new Array();
var hc;
var ic;
for (var a = 0; a < v.length;) {
var ib = v[a++];
var mb = v[a++];
var Hb = v[a++];
var xb = v[a++];
if (ib == Hb && mb == xb) {
continue
}
if (ib != hc || mb != ic) {
if (u.length > 0) {
Mb(9999, u)
}
Mb(ib - A.minX, u);
Mb(mb - A.minY, u)
}
Mb(Hb - ib, u);
Mb(xb - mb, u);
ic = xb;
hc = Hb
}
Mb(9999, u);
return u.join("")
};
d.prototype.createVectorSegments = function(rb, Ab, La, ea) {
I.start("Map", "createVectorSegments");
var eb = rb.getVectors(Ab, La);
var v = new Array();
var da = new T();
this.getBitmapVectors(eb, v, da);
if (!ea) {
ea = new T()
}
var Ca = new T(Math.max(ea.minX, da.minX), Math.max(ea.minY, da.minY), Math.min(ea.maxX, da.maxX), Math.min(ea.maxY, da.maxY));
var c;
if (v.length > 0) {
var qb = this.centerBitmap;
var uc = this.getDivCoordinate(qb.x, qb.y, _csStartDivPoint);
c = document.createElement("v:shape");
c.unselectable = "on";
c.strokecolor = "blue";
c.strokeweight = 5;
c.fill = false;
c.filled = false;
var g = 1;
var k = 1;
c.style.position = "absolute";
c.style.width = g + "px";
c.style.height = k + "px";
c.style.left = uc.x + "px";
c.style.top = uc.y + "px";
var Nd = qb.x + " " + qb.y;
c.coordorigin = Nd;
c.coordsize = g + " " + k;
c.path = this.getVectorPath(v, Ca);
var ua = document.createElement("v:stroke");
ua.joinstyle = "round";
ua.endcap = "round";
ua.opacity = 0.45;
c.appendChild(ua)
} else {
c = document.createElement("div")
}
c.sourceBounds = ea;
I.end("Map", "createVectorSegments");
return c
};
d.prototype.createImageSegments = function(rb, Ab, La, ea) {
I.start("Map", "createImageSegments");
var u;
var Ca;
do {
var eb = rb.getVectors(Ab, La);
var v = new Array();
var da = new T();
this.getBitmapVectors(eb, v, da);
da.minX -= 10;
da.minY -= 10;
da.maxX += 10;
da.maxY += 10;
if (!ea) {
ea = new T()
}
Ca = new T(Math.max(ea.minX, da.minX), Math.max(ea.minY, da.minY), Math.min(ea.maxX, da.maxX), Math.min(ea.maxY, da.maxY));
u = this.getEncodedImageSource(v, Ca);
++La
} while (u.length > 900);
var c;
if (u.length > 0) {
var ef = this.getDivCoordinate(Ca.minX, Ca.minY, _csStartDivPoint);
var g = Math.ceil(Ca.maxX - Ca.minX);
var k = Math.ceil(Ca.maxY - Ca.minY);
var C = "/web/20050210030927/http://www.google.com/maplinedraw?width=" + g + "&height=" + k + "&path=" + u;
nd('<a href="' + C.xmlEscape() + '">' + C.xmlEscape() + "</a>", 0);
if (m.type != 1) {
g = null;
k = null
}
var xa = m.type == 2 ? "noprint" : null;
c = o.create(C, g, k, ef.x, ef.y, 0, false, xa)
} else {
c = document.createElement("div")
}
c.sourceBounds = ea;
I.end("Map", "createImageSegments");
return c
};
d.prototype.drawDirections = function(y, N, ih) {
if (!y && !N.directions) return;
var Tf = this.getBoundsBitmap();
var ba = N.directionsBounds;
if (!ih) {
if (y == N.directions) {
if (ba.containsBounds(Tf)) {
return
}
}
}
if (N.directions != y) {
while (N.hasChildNodes()) {
N.removeChild(N.lastChild)
}
N.directions = y;
if (y && (m.type == 1 && (!this.forceImageSegments && y.polyline.points.length < 16000))) {
var pe = this.getVMLPathString(y);
N.path = pe
} else {
N.path = null
}
}
if (y) {
I.start("Map", "drawDirections");
var c = null;
var Ke = 900;
var g = Math.min(this.viewSize.width, Ke);
var k = Math.min(this.viewSize.height, Ke);
if (m.type == 1 && !this.forceImageSegments) {
g = 5000;
k = 5000
}
ba.minX = this.centerBitmap.x - g;
ba.minY = this.centerBitmap.y - k;
ba.maxX = this.centerBitmap.x + g;
ba.maxY = this.centerBitmap.y + k;
var wa = this.spec.getLatLng(ba.minX, ba.minY, this.zoomLevel);
var ra = this.spec.getLatLng(ba.maxX, ba.maxY, this.zoomLevel);
var Ab = new T(wa.x, ra.y, ra.x, wa.y);
if (N.path) {
c = null;
if (N.hasChildNodes()) {
c = N.firstChild
}
c = this.createRawVML(N.path, N, c)
} else {
while (N.hasChildNodes()) {
N.removeChild(N.lastChild)
}
var La = 0;
var Ma = new L(y.polyline.minTolerance, y.polyline.minTolerance);
while (La < y.polyline.numLevels) {
Ma.width *= y.polyline.zoomFactor;
Ma.height *= y.polyline.zoomFactor;
if (this.zoomLevel < this.spec.getLowestZoomLevel(Ma, 2, 2)) {
break
}++La
}
if (m.type == 1 && !this.forceImageSegments) {
c = this.createVectorSegments(y.polyline, Ab, La, ba)
} else {
c = this.createImageSegments(y.polyline, Ab, La, ba)
}
N.appendChild(c)
}
c.style.zIndex = 2;
this.drawDirectionsMarkers();
I.end("Map", "drawDirections")
} else {
ba.minX = -Infinity;
ba.minY = -Infinity;
ba.maxX = Infinity;
ba.maxY = Infinity;
this.hideDirectionsMarkers()
}
};
var bh = q + "dd-start.png";
var Eg = q + "dd-end.png";
d.prototype.drawDirectionsMarkers = function() {
if (!this.directionsStart || !this.directionsEnd) {
this.directionsStart = this.createLocationMarker(bh, M.get("local"));
this.directionsEnd = this.createLocationMarker(Eg, M.get("local"));
var h = this;
this.directionsStart.mouseTarget.onmousedown = function(b) {
Z(b);
h.showDirectionsStart()
};
this.directionsEnd.mouseTarget.onmousedown = function(b) {
Z(b);
h.showDirectionsEnd()
}
}
this.setMarkerPosition(this.directionsStart, M.get("local"), this.directions.polyline.getPoint(0));
var tb = (this.directions.polyline.points.length >> 1) - 1;
this.setMarkerPosition(this.directionsEnd, M.get("local"), this.directions.polyline.getPoint(tb));
this.directionsStart.show();
this.directionsEnd.show();
var Ad = 0;
var Vd = 0;
if (this.directions.polyline.getPoint(0).y < this.directions.polyline.getPoint(tb).y) {
Ad = 1
} else {
Vd = 1
}
this.directionsStart.icon.style.zIndex = 10 + Ad;
this.directionsStart.transparentIcon.style.zIndex = 30 + Ad;
this.directionsEnd.icon.style.zIndex = 10 + Vd;
this.directionsEnd.transparentIcon.style.zIndex = 30 + Vd
};
d.prototype.showDirectionsStart = function() {
if (!this.directions) return;
this.showMapBlowup(this.directions.polyline.getPoint(0), M.get("local"))
};
d.prototype.showDirectionsEnd = function() {
if (!this.directions) return;
var tb = (this.directions.polyline.points.length >> 1) - 1;
this.showMapBlowup(this.directions.polyline.getPoint(tb), M.get("local"))
};
d.prototype.showDirectionsStep = function(Kb) {
if (!this.directions) return;
var j = this.directions.polyline.getPoint(Kb.pointIndex);
var Bb = this.showMapBlowup(j);
if (Kb.pointIndex != 0) {
var Za = Bb.getDirIndicatorAngle(Kb.pointIndex);
var di = Bb.getDirIndicatorPath(Za);
var Rb = 12 * Math.cos(Za);
var jc = 12 * Math.sin(Za);
Rb = Math.floor(-12 - Rb);
jc = Math.floor(-12 - jc);
var Pb = Bb.spec.getBitmapCoordinate(j.y, j.x, Bb.zoomLevel);
var wc = Bb.getDivCoordinate(Pb.x, Pb.y);
var pa = o.create(di, 24, 24, wc.x + Rb, wc.y + jc, 2, false);
Bb.div.appendChild(pa)
}
};
d.prototype.getDirIndicatorAngle = function(U) {
var Za = 0;
if (U > 1) {
var la = this.directions.polyline.getPoint(U - 2);
var na = this.directions.polyline.getPoint(U);
la = this.spec.getBitmapCoordinate(la.y, la.x, this.zoomLevel);
na = this.spec.getBitmapCoordinate(na.y, na.x, this.zoomLevel);
Za = Math.atan2(na.y - la.y, na.x - la.x)
}
return Za
};
var Xh = q + "dir_";
d.prototype.getDirIndicatorPath = function(Za) {
var Xb = Math.round(Za * 60 / Math.PI) * 3 + 90;
while (Xb >= 120) Xb -= 120;
while (Xb < 0) Xb += 120;
var C = Xh + Xb + ".png";
return C
};
d.prototype.hideDirectionsMarkers = function() {
if (this.directionsStart && this.directionsEnd) {
this.directionsStart.hide();
this.directionsEnd.hide()
}
};
d.prototype.directionsMarkersAreVisible = function() {
return this.directionsStart && (this.directionsEnd && (this.directionsStart.isVisible() && this.directionsEnd.isVisible()))
};
d.prototype.createMapControl = function() {
var X = document.createElement("div");
this.createPanningControls(X);
this.createZoomControls(X);
this.createZoomSlider(X);
return X
};
var rh = q + "zoom-plus.png";
var lh = q + "zoom-minus.png";
var ph = q + "sliderbar.png";
var Wg = q + "slider.png";
d.prototype.createZoomControls = function(X) {
var h = this;
var Zc = o.create(rh, 17, 17, 20, 70, 1, false);
Zc.style.cursor = "pointer";
Zc.onclick = function(b) {
h.zoomTo(h.zoomLevel - 1);
Z(b)
};
Zc.title = "Zoom in";
X.appendChild(Zc);
var bd = o.create(lh, 17, 17, 20, 260, 1, false);
bd.style.cursor = "pointer";
bd.onclick = function(b) {
h.zoomTo(h.zoomLevel + 1);
Z(b)
};
bd.title = "Zoom out";
X.appendChild(bd)
};
var Dg = q + "center.png";
var zh = q + "east.png";
var jh = q + "west.png";
var Lf = q + "north.png";
var wh = q + "south.png";
var Ph = q + "panshadow.png";
d.prototype.createPanningControls = function(X) {
var h = this;
var Ua = o.create(Ph, 59, 64, 0, 0, 0, false);
X.appendChild(Ua);
var Fc = o.create(Lf, 17, 17, 20, 0, 1, false);
Fc.style.cursor = "pointer";
Fc.onclick = function(b) {
h.pan(0, Math.floor(h.viewSize.height * 0.5));
Z(b)
};
Fc.title = "Go up";
X.appendChild(Fc);
var Ic = o.create(zh, 17, 17, 40, 20, 1, false);
Ic.style.cursor = "pointer";
Ic.onclick = function(b) {
h.pan(-Math.floor(h.viewSize.width * 0.5), 0);
Z(b)
};
Ic.title = "Go right";
X.appendChild(Ic);
var qd = o.create(wh, 17, 17, 20, 40, 1, false);
qd.style.cursor = "pointer";
qd.onclick = function(b) {
h.pan(0, -Math.floor(h.viewSize.height * 0.5));
Z(b)
};
qd.title = "Go down";
X.appendChild(qd);
var Wc = o.create(jh, 17, 17, 0, 20, 1, false);
Wc.style.cursor = "pointer";
Wc.onclick = function(b) {
h.pan(Math.floor(h.viewSize.width * 0.5), 0);
Z(b)
};
Wc.title = "Go left";
X.appendChild(Wc);
var B = o.create(Dg, 17, 17, 20, 20, 1, false);
B.style.cursor = "pointer";
B.onclick = function(b) {
if (h.lastPageCenter) {
if (h.lastPageZoom != h.zoomLevel) {
h.centerAndZoom(h.lastPageCenter, h.lastPageZoom)
} else {
h.recenterOrPanToLatLng(h.lastPageCenter)
}
} else if (h.lastLatLng) {
h.recenterOrPanToLatLng(this.map.lastLatLng)
}
Z(b)
};
B.title = "Return to the last result";
X.appendChild(B)
};
var yg = q + "slidershadow.png";
d.prototype.createZoomSlider = function(X) {
var Ua = o.create(yg, 19, 215, 20, 64, 0, false);
X.appendChild(Ua);
var Ia = document.createElement("div");
Ia.style.position = "absolute";
Ia.style.left = "21px";
Ia.style.top = "90px";
Ia.style.width = "15px";
Ia.style.height = "167px";
var rd = o.create(ph, 15, 167, 0, 0, 1, false);
Ia.appendChild(rd);
var rc = -1 * Math.floor(3.5) + 1;
var fe = o.create(Wg, 22, 14, rc, this.getRelativeZoomSliderPos(), 2, false);
fe.title = "Drag to zoom";
Ia.appendChild(fe);
X.appendChild(Ia);
var A = new T(rc, 1, rc + 22, 166);
var Gd = new Na(fe, rc, this.getRelativeZoomSliderPos(), A);
this.onzoom = function() {
Gd.moveTo(rc, h.getRelativeZoomSliderPos())
};
var h = this;
Gd.ondragend = function() {
var Jh = Gd.top + Math.floor(5.5);
h.zoomTo(h.getZoomFromRelativeCoord(Jh))
};
rd.style.cursor = "pointer";
rd.title = "Click to set zoom level";
rd.onclick = function(b) {
var l;
if (window.event) {
l = window.event.offsetY
} else {
var hd = h.getTotalOffset(Ia);
l = b.pageY - hd.height - 2
}
Z(b);
h.zoomTo(h.getZoomFromRelativeCoord(l))
}
};
d.prototype.getRelativeZoomSliderPos = function() {
return 1 + this.zoomLevel * 11
};
d.prototype.getZoomFromRelativeCoord = function(l) {
var ka = Math.floor((l - 1) / 11);
return Math.max(0, Math.min(this.spec.numZoomLevels - 1, ka))
};
d.prototype.showCopyright = function() {
var ee = this.createCopyright("&copy;2005 Google");
ee.style.left = "3px";
ee.style.bottom = "3px";
this.container.appendChild(ee);
var zd = this.createCopyright("Map data &copy;2005 NAVTEQ&trade;, TeleAtlas");
zd.style.right = "3px";
zd.style.bottom = "3px";
this.container.appendChild(zd)
};
d.prototype.createCopyright = function(S) {
var i = document.createElement("div");
i.style.position = "absolute";
i.style.cursor = "default";
i.unselectable = "on";
i.onselectstart = Sd;
i.innerHTML = S;
i.style.fontSize = "11px";
i.style.fontFamily = "Arial, sans serif";
Nb(i, "noselect");
return i
};
function pc(p) {
this.anchorLevel = null;
this.anchor = new n(0, 0);
this.spec = null;
this.span = new L(Infinity, Infinity);
this.points = null;
this.map = p;
this.map.addStateListener(this);
this.map.onresize = this.eventHandler("onMapResize")
}
var _bPoint = new n(0, 0);
pc.prototype.onMapStateChanged = function() {
if (this.anchorLevel != this.map.zoomLevel || this.spec != this.map.spec) {
this.reset();
this.addPoint(0, 0, true);
return
}
var B = this.map.getCenterLatLng(_bPoint);
var Uc = Math.round((B.x - this.anchor.x) / this.span.width);
var od = Math.round((B.y - this.anchor.y) / this.span.height);
this.addPoint(Uc, od, true)
};
pc.prototype.onMapResize = function() {
this.reset();
this.addPoint(0, 0, false)
};
pc.prototype.reset = function() {
this.map.getCenterLatLng(this.anchor);
this.map.getSpanLatLng(this.span);
this.spec = this.map.spec;
this.anchorLevel = this.map.zoomLevel;
this.points = new Object()
};
pc.prototype.addPoint = function(Uc, od, Qg) {
var str = Uc + "," + od;
if (this.points[str]) return;
this.points[str] = 1;
if (Qg) {
var w = new Ja();
w.setAllMapValues(this.map);
var Td = _bPoint;
Td.x = this.anchor.x + Uc * this.span.width;
Td.y = this.anchor.y + od * this.span.height;
w.setValue("vp", w.getLatLngArg(Td));
var fa = w.getURL();
nd('<a href="' + fa.xmlEscape() + '">' + fa.xmlEscape() + "</a>", 0);
(new Image()).src = fa
}
};
function Na(C, K, top, P) {
this.src = C;
this.container = P;
this.ondragstart = null;
this.ondrag = null;
this.ondragend = null;
this.onmove = null;
this.onclick = null;
this.disabled = false;
this.dragPoint = new n(0, 0);
this.clickStartPos = new n(0, 0);
this.src.style.position = "absolute";
this.moveTo(K, top);
this.mouseDownHandler = this.eventHandler("onMouseDown");
this.mouseMoveHandler = this.eventHandler("onMouseMove");
this.mouseUpHandler = this.eventHandler("onMouseUp");
if (m.type == 2) {
window.addEventListener("mouseout", this.eventHandler("onWindowMouseOut"), false)
}
this.eventSrc = this.src.setCapture ? this.src : window;
if (this.src.addEventListener) {
this.src.addEventListener("mousedown", this.mouseDownHandler, false)
} else {
this.src.onmousedown = this.mouseDownHandler
}
}
Na.prototype.moveTo = function(K, top) {
if (this.left != K || this.top != top) {
this.left = K;
this.top = top;
this.src.style.left = this.left + "px";
this.src.style.top = this.top + "px";
if (this.onmove) this.onmove()
}
};
Na.prototype.onMouseDown = function(b) {
if (b.cancelDrag) {
return
}
var Ih = m.type == 2 ? b.button == 0 : b.button == 1;
if (this.disabled || !Ih) {
Z(b);
return false
}
this.dragPoint.x = b.screenX;
this.dragPoint.y = b.screenY;
if (window.addEventListener) {
this.eventSrc.addEventListener("mousemove", this.mouseMoveHandler, false);
this.eventSrc.addEventListener("mouseup", this.mouseUpHandler, false)
} else {
this.eventSrc.onmousemove = this.mouseMoveHandler;
this.eventSrc.onmouseup = this.mouseUpHandler
}
if (this.src.setCapture) this.src.setCapture();
this.clickStartTime = (new Date()).getTime();
this.clickStartPos.x = b.screenX;
this.clickStartPos.y = b.screenY;
if (this.ondragstart) this.ondragstart(b);
this.originalCursor = this.src.style.cursor;
this.src.style.cursor = "move";
Z(b)
};
Na.prototype.onMouseMove = function(b) {
if (m.os == 1) {
if (b == null) return;
if (this.dragDisabled) {
this.savedMove = new Object();
this.savedMove.screenX = b.screenX;
this.savedMove.screenY = b.screenY;
return
}
this.setTimeout("this.dragDisabled = false; this.onMouseMove(this.savedMove)", 30);
this.dragDisabled = true;
this.savedMove = null
}
var ue = 1;
if (m.type == 3 && m.version == 1) {
ue = -1
}
var x = this.left + (b.screenX - this.dragPoint.x);
var l = this.top + (b.screenY - this.dragPoint.y) * ue;
var va = 0;
var za = 0;
if (this.container) {
var Ec = x;
if (x < this.container.minX) {
Ec = this.container.minX
} else {
var ed = this.container.maxX - this.src.offsetWidth;
if (x > ed) {
Ec = ed
}
}
va = Ec - x;
x = Ec;
var Qc = l;
if (l < this.container.minY) {
Qc = this.container.minY
} else {
var Jc = this.container.maxY - this.src.offsetHeight;
if (l > Jc) Qc = Jc
}
za = Qc - l;
l = Qc
}
this.moveTo(x, l);
this.dragPoint.x = b.screenX + va;
this.dragPoint.y = b.screenY + za;
if (this.ondrag) this.ondrag(b)
};
Na.prototype.onMouseUp = function(b) {
if (this.eventSrc.removeEventListener) {
this.eventSrc.removeEventListener("mousemove", this.mouseMoveHandler, false);
this.eventSrc.removeEventListener("mouseup", this.mouseUpHandler, false)
} else {
this.eventSrc.onmousemove = null;
this.eventSrc.onmouseup = null
}
this.src.style.cursor = this.originalCursor;
if (document.releaseCapture) document.releaseCapture();
if (this.ondragend) this.ondragend(b);
if (this.onclick) {
var Zg = (new Date()).getTime();
if (Zg - this.clickStartTime <= 500 && (Math.abs(this.clickStartPos.x - b.screenX) <= 2 && Math.abs(this.clickStartPos.y - b.screenY) <= 2)) {
this.onclick(b)
}
}
};
Na.prototype.onWindowMouseOut = function(b) {
if (!b.relatedTarget) this.onMouseUp(b)
};
Na.prototype.disable = function() {
this.disabled = true
};
Na.prototype.enable = function() {
this.disabled = false
};
var je = "centerlat";
var ke = "centerlng";
function H(bb, Ya, Bc, Tc, B, Tg, Xf, Ah, dg, z, Sc, y, nb, ca) {
this.query = bb;
this.title = Ya;
this.error = Bc;
this.spelling = Tc;
this.center = B;
this.viewSpan = Tg;
this.searchCenter = Xf;
this.searchSpan = Ah;
this.ads = dg;
this.area = z;
this.overlays = Sc;
this.directions = y;
this.debug = nb;
this.xml = ca
}
function Yb(kd, Mg, ca) {
this.locations = kd;
this.panelStyle = Mg;
this.xml = ca
}
function Lc(F, j, W, Bg, ca) {
this.id = F;
this.point = j;
this.icon = W;
this.infoStyle = Bg;
this.xml = ca
}
function qe(f, s) {
this.image = f;
this.iconClass = s
}
function Tb(rb, Oc, ca) {
this.polyline = rb;
this.segments = Oc;
this.xml = ca
}
function Ld(F, se, U) {
this.id = F;
this.description = se;
this.pointIndex = U
}
function M(ia, g, k, pg, Qh, ig, eh, Ag, Cd) {
this.name = ia;
this.width = g;
this.height = k;
this.pointCoord = pg;
this.infoTipCoord = Qh;
this.shadowTipCoord = ig;
this.shadowURL = eh;
this.shadowWidth = Ag;
this.imageMapArray = Cd;
if (this.imageMapArray) {
this.imageMap = this.imageMapArray.join(",")
} else {
this.imageMap = null
}
}
M.prototype.translateImageMapArray = function(x, l) {
var Ra = "";
for (var a = 0; a < this.imageMapArray.length; a += 2) {
Ra += this.imageMapArray[a] + x + "," + (this.imageMapArray[a + 1] + l) + (a < this.imageMapArray.length - 2 ? "," : "")
}
return Ra
};
M.classes = new Object();
M.load = function(s) {
M.classes[s.name] = s
};
M.get = function(ia) {
return M.classes[ia]
};
H.loadFromXML = function(c) {
I.start("Page", "loadFromXML");
var bb = null;
var tf = c.getElementsByTagName("query");
if (tf.length > 0) {
bb = H.getNodeValue(tf[0])
}
var Ya = null;
var Se = c.getElementsByTagName("title");
if (Se.length > 0) {
Ya = H.getNodeValue(Se[0])
}
var Bc = null;
var vf = c.getElementsByTagName("error");
if (vf.length > 0) {
Bc = vf[0]
}
var Tc = null;
var ve = c.getElementsByTagName("spelling");
if (ve.length > 0) {
Tc = ve[0]
}
var B = null;
var Md = c.getElementsByTagName("center");
if (Md.length > 0) {
B = new n(parseFloat(Md[0].getAttribute("lng")), parseFloat(Md[0].getAttribute("lat")))
}
var Ma = null;
var Bd = c.getElementsByTagName("span");
if (Bd.length > 0) {
Ma = new L(parseFloat(Bd[0].getAttribute("lng")), parseFloat(Bd[0].getAttribute("lat")))
}
var Gf = null;
var de = c.getElementsByTagName("searchcenter");
if (de.length > 0) {
Gf = new n(parseFloat(de[0].getAttribute("lng")), parseFloat(de[0].getAttribute("lat")))
}
var ff = null;
var Hd = c.getElementsByTagName("searchspan");
if (Hd.length > 0) {
ff = new L(parseFloat(Hd[0].getAttribute("lng")), parseFloat(Hd[0].getAttribute("lat")))
}
var Sc = new Array();
var df = c.getElementsByTagName("overlay");
for (var a = 0; a < df.length; a++) {
Sc.push(Yb.loadFromXML(df[a]))
}
var y = null;
var zf = c.getElementsByTagName("directions");
if (zf.length > 0) {
y = Tb.loadFromXML(zf[0])
}
var nb = null;
var lf = c.getElementsByTagName("debug");
if (lf.length > 0) {
nb = H.getNodeValue(lf[0])
}
I.end("Page", "loadFromXML");
return new H(bb, Ya, Bc, Tc, B, Ma, Gf, ff, null, null, Sc, y, nb, c)
};
Yb.loadFromXML = function(c) {
var kd = new Array();
var Fe = c.getElementsByTagName("location");
for (var a = 0; a < Fe.length; a++) {
kd.push(Lc.loadFromXML(Fe[a]))
}
return new Yb(kd, c.getAttribute("panelStyle"), c)
};
Yb.prototype.getLocationById = function(F) {
for (var a = 0; a < this.locations.length; a++) {
if (this.locations[a].id == F) return this.locations[a]
}
return null
};
Lc.loadFromXML = function(c) {
var uf = c.getElementsByTagName("point")[0];
var j = new n(parseFloat(uf.getAttribute("lng")), parseFloat(uf.getAttribute("lat")));
var Zh = c.getElementsByTagName("icon")[0];
var W = qe.loadFromXML(Zh);
return new Lc(c.getAttribute("id"), j, W, c.getAttribute("infoStyle"), c)
};
qe.loadFromXML = function(c) {
var s = M.get(c.getAttribute("class"));
if (s) {
return new qe(c.getAttribute("image"), s)
} else {
return null
}
};
Tb.loadFromXML = function(c) {
var dd = c.getElementsByTagName("polyline")[0];
var Ig = H.getNodeValue(dd.getElementsByTagName("points")[0]);
var yd = H.getNodeValue(dd.getElementsByTagName("levels")[0]);
var he = parseInt(dd.getAttribute("numLevels"));
var Dd = parseInt(dd.getAttribute("zoomFactor"));
var rb = new Lb(Ig, yd, he, Dd);
var Oc = new Array();
var gi = c.getElementsByTagName("segments")[0];
var Pe = gi.getElementsByTagName("segment");
for (var a = 0; a < Pe.length; ++a) {
Oc.push(Ld.loadFromXML(Pe[a]))
}
return new Tb(rb, Oc, c)
};
Tb.prototype.getSegmentById = function(F) {
for (var a = 0; a < this.segments.length; a++) {
if (this.segments[a].id == F) return this.segments[a]
}
return null
};
Ld.loadFromXML = function(c) {
var F = c.getAttribute("id");
var U = parseInt(c.getAttribute("pointIndex"));
var se = H.getNodeValue(c);
return new Ld(F, se, U)
};
H.getNodeValue = function(D) {
if (m.type == 1) return D.text;
var O = "";
if (D.nodeType == 3 || D.nodeType == 4) return D.nodeValue;
if (D.nodeType == 1) {
for (var Ea = D.firstChild; Ea != null; Ea = Ea.nextSibling) {
O += H.getNodeValue(Ea)
}
}
return O
};
var ag = q + "iws_nw.png";
var Yh = q + "iws_n.png";
var sh = q + "iws_ne.png";
var kg = q + "iws_e.png";
var bg = q + "iws_c.png";
var fh = q + "iws_w.png";
var mg = q + "iws_sw.png";
var cf = q + "iws_s.png";
var gg = q + "iws_se.png";
var Zf = q + "iws_tap.png";
var Dh = q + "iw_nw.png";
var gh = q + "iw_n.png";
var th = q + "iw_ne.png";
var ng = q + "iw_e.png";
var sg = q + "iw_c.png";
var nh = q + "iw_w.png";
var Fh = q + "iw_sw.png";
var af = q + "iw_s.png";
var Of = q + "iw_se.png";
var Yg = q + "iw_tap.png";
function t(xh, Eh, yf, Vf, Qf) {
this.oncloseclick = Eh;
this.createWindow(Vf);
this.createShadow(Qf);
if (m.type != 1) {
this.createMask()
} else {
this.maskPng = null
}
this.createContentArea(xh);
this.createCloseButton();
yf.appendChild(this.windowDiv);
yf.appendChild(this.shadowDiv);
this.setSize(208, 69);
this.hide()
}
t.prototype.setContentSize = function(g, k) {
this.setSize(g - (this.window.w.width - 15) * 2, k - (this.window.n.height - 15) * 2)
};
t.prototype.setSize = function(g, k) {
if (g < 0) g = 0;
if (k < 0) k = 0;
this.width = g;
this.height = k;
this.setWindowSize(g, k);
this.setShadowSize(g, k);
if (this.hasMask()) this.setMaskSize();
this.closeButton.style.left = this.getTotalWidth() - this.closeButton.width - 10 - 1 + "px";
this.closeButton.style.top = "10px"
};
t.prototype.getWindowHeight = function() {
return this.window.c.height + 2 * this.window.n.height
};
t.prototype.getTotalHeight = function() {
return this.height + this.window.pointer.height + this.window.n.height
};
t.prototype.getTotalHeightAboveGround = function() {
return this.getTotalHeight() + (this.iconClass.pointCoord.y - this.iconClass.infoTipCoord.y)
};
t.prototype.getTotalShadowHeight = function() {
return Math.floor(this.height / 4) + this.shadow.pointer.height + this.shadow.nw.height
};
t.prototype.getTotalWidth = function() {
return this.width + this.window.w.width + this.window.e.width
};
t.prototype.getOffsetLeft = function() {
return this.windowDiv.offsetLeft
};
t.prototype.getOffsetTop = function() {
return this.windowDiv.offsetTop
};
t.prototype.setWindowSize = function(g, k) {
this.window.n.style.width = g + "px";
this.window.e.style.height = k + "px";
this.window.c.style.width = g + "px";
this.window.c.style.height = k + "px";
this.window.w.style.height = k + "px";
var Ha = this.calculatePointerOffset(g);
this.window.s1.style.width = Ha + "px";
this.window.pointer.style.left = Ha + this.window.sw.width + "px";
this.window.s2.style.left = Ha + this.window.pointer.width + this.window.sw.width + "px";
this.window.s2.style.width = g - Ha - this.window.pointer.width + "px";
var Gb = g + this.window.w.width + "px";
this.window.ne.style.left = Gb;
this.window.e.style.left = Gb;
this.window.se.style.left = Gb;
var ta = k + this.window.n.height + "px";
this.window.sw.style.top = ta;
this.window.s1.style.top = ta;
this.window.pointer.style.top = ta;
this.window.s2.style.top = ta;
this.window.se.style.top = ta
};
t.prototype.setShadowSize = function(g, k) {
g -= 15;
var ob = Math.floor(k / 4);
var Gb = g + this.shadow.nw.width;
var Ha = this.calculatePointerOffset(g) - 41;
var ta = ob + this.shadow.n.height + "px";
var sd = ob + this.shadow.nw.height;
this.shadow.s1Div.style.width = Ha + "px";
this.shadow.pointer.style.left = Ha + this.shadow.sw.width + "px";
this.shadow.s2Div.style.left = Ha + this.shadow.pointer.width + this.shadow.sw.width + "px";
this.shadow.s2Div.style.width = g - Ha - this.shadow.pointer.width + "px";
this.shadow.sw.style.top = ta;
this.shadow.s1Div.style.top = ta;
this.shadow.pointer.style.top = ta;
this.shadow.s2Div.style.top = ta;
this.shadow.se.style.top = ta;
this.shadow.se.style.left = Gb + "px";
var Xe = this.shadow.nw.height;
var kf = Math.floor(k / 2);
this.shadow.wDiv.style.height = ob + "px";
this.shadow.wDiv.style.left = Xe + "px";
this.shadow.wDiv.style.width = kf + "px";
this.shadow.w.style.left = ob - this.shadow.w.width + 80 + "px";
var jf = this.shadow.nw.height + g + 70;
this.shadow.eDiv.style.height = ob + "px";
this.shadow.eDiv.style.left = jf + "px";
this.shadow.eDiv.style.width = k + "px";
this.shadow.e.style.left = ob - this.shadow.w.width + 80 + "px";
var Ee = Xe + kf;
this.shadow.cDiv.style.width = jf - Ee + "px";
this.shadow.cDiv.style.height = ob + "px";
this.shadow.cDiv.style.left = Ee + "px";
this.shadow.nw.style.left = sd + "px";
this.shadow.nDiv.style.width = g - 30 + "px";
this.shadow.nDiv.style.left = sd + this.shadow.nw.width + "px";
this.shadow.ne.style.left = Gb + sd - 30 + "px"
};
t.prototype.setMaskSize = function() {
this.maskPng.style.width = this.getTotalWidth() + "px";
this.maskPng.style.height = this.getTotalHeight() + "px";
var wf = this.getTotalWidth();
var Kc = this.getWindowHeight();
var Pg = this.getTotalHeight();
var me = this.window.pointer.offsetLeft;
var cg = me + this.window.pointer.width;
var Mf = me + 53;
var rg = me + 4;
var Oa = ",";
var p = this.getMaskMap();
var z = p.firstChild;
z.setAttribute("coords", "0,0,0," + Kc + Oa + Mf + Oa + Kc + Oa + rg + Oa + Pg + Oa + cg + Oa + Kc + Oa + wf + Oa + Kc + Oa + wf + ",0")
};
t.prototype.hide = function() {
if (this.windowDiv) this.windowDiv.style.display = "none";
this.shadowDiv.style.display = "none"
};
t.prototype.show = function() {
this.windowDiv.style.display = "";
this.shadowDiv.style.display = "";
this.windowDiv.style.visibility = "visible";
this.shadowDiv.style.visibility = "visible";
this.contentArea.style.visibility = "visible"
};
t.prototype.isVisible = function() {
return this.windowDiv.style.display != "none"
};
t.prototype.sizeToContent = function(ad) {
var g = ad ? ad : this.contentArea.offsetWidth;
var k = this.contentArea.offsetHeight;
this.setContentSize(Math.max(g, 183), k)
};
t.prototype.positionAt = function(x, l, s) {
var Rb = this.calculatePointerOffset(this.width) + this.window.w.width + 5;
var jc = this.height + this.window.n.height + this.window.s1.height;
this.left = x - Rb;
this.top = l - jc;
this.left += s.infoTipCoord.x - s.pointCoord.x;
this.top += s.infoTipCoord.y - s.pointCoord.y;
this.windowDiv.style.left = this.left + "px";
this.windowDiv.style.top = this.top + "px";
var nf = 0;
var sf = this.getTotalHeight() - this.getTotalShadowHeight();
nf += s.shadowTipCoord.x - s.infoTipCoord.x;
sf += s.shadowTipCoord.y - s.infoTipCoord.y;
this.shadowDiv.style.left = this.left + nf + "px";
this.shadowDiv.style.top = this.top + sf + "px"
};
t.prototype.calculatePointerOffset = function(g) {
return Math.floor(g / 4)
};
t.prototype.createCroppingDiv = function(f) {
var i = window.document.createElement("div");
i.style.overflow = "hidden";
i.style.position = "absolute";
i.style.width = f.width + "px";
i.style.height = f.height + "px";
i.style.left = f.style.left;
i.style.top = f.style.top;
i.style.zIndex = f.style.zIndex;
f.style.left = "0px";
f.style.top = "0px";
i.appendChild(f);
return i
};
t.prototype.createWindow = function(Ga) {
this.window = new Object();
this.window.nw = o.create(Dh, 25, 25, 0, 0, 0, false);
this.window.n = o.create(gh, 640, 25, this.window.nw.width, 0, 0, true);
this.window.ne = o.create(th, 25, 25, 0, 0, 0, false);
this.window.w = o.create(nh, 25, 640, 0, this.window.nw.height, 0, true);
this.window.c = o.create(sg, 640, 640, this.window.w.width, this.window.n.height, 0, true);
this.window.e = o.create(ng, 25, 640, 0, this.window.ne.height, 0, true);
this.window.sw = o.create(Fh, 25, 96, 0, 0, 0, false);
this.window.s1 = o.create(af, 640, 96, this.window.sw.width, 0, 0, true);
this.window.pointer = o.create(Yg, 98, 96, 0, 0, 0, false);
this.window.s2 = o.create(af, 640, 96, 0, 0, 0, true);
this.window.se = o.create(Of, 25, 96, 0, 0, 0, false);
this.window.nw.onmousedown = this.onMouseDown;
this.window.n.onmousedown = this.onMouseDown;
this.window.ne.onmousedown = this.onMouseDown;
this.window.w.onmousedown = this.onMouseDown;
this.window.c.onmousedown = this.onMouseDown;
this.window.e.onmousedown = this.onMouseDown;
this.window.sw.onmousedown = this.onMouseDown;
this.window.s1.onmousedown = this.onMouseDown;
this.window.pointer.onmousedown = this.onMouseDown;
this.window.s2.onmousedown = this.onMouseDown;
this.window.se.onmousedown = this.onMouseDown;
this.windowDiv = window.document.createElement("div");
this.windowDiv.style.position = "absolute";
this.windowDiv.style.left = "0px";
this.windowDiv.style.top = "0px";
this.windowDiv.style.zIndex = Ga;
Nb(this.windowDiv, "infowindow");
this.windowDiv.appendChild(this.window.nw);
this.windowDiv.appendChild(this.window.n);
this.windowDiv.appendChild(this.window.ne);
this.windowDiv.appendChild(this.window.w);
this.windowDiv.appendChild(this.window.c);
this.windowDiv.appendChild(this.window.e);
this.windowDiv.appendChild(this.window.sw);
this.windowDiv.appendChild(this.window.s1);
this.windowDiv.appendChild(this.window.pointer);
this.windowDiv.appendChild(this.window.s2);
this.windowDiv.appendChild(this.window.se)
};
t.prototype.createShadow = function(Ga) {
this.shadow = new Object();
this.shadow.nw = o.create(ag, 70, 30, 0, 0, 0, false);
this.shadow.n = o.create(Yh, 640, 30, this.shadow.nw.width, 0, 0, false);
this.shadow.ne = o.create(sh, 70, 30, 0, 0, 0, false);
this.shadow.w = o.create(fh, 360, 280, 0, this.shadow.nw.height, 0, false);
this.shadow.c = o.create(bg, 640, 640, this.shadow.w.width, this.shadow.n.height, 0, false);
this.shadow.e = o.create(kg, 360, 280, 0, this.shadow.ne.height, 0, false);
this.shadow.sw = o.create(mg, 70, 60, 0, 0, 0, false);
this.shadow.s1 = o.create(cf, 320, 60, this.shadow.sw.width, 0, 0, false);
this.shadow.pointer = o.create(Zf, 140, 60, 0, 0, 0, false);
this.shadow.s2 = o.create(cf, 320, 60, 0, 0, 0, false);
this.shadow.se = o.create(gg, 70, 60, 0, 0, 0, false);
this.shadow.nDiv = this.createCroppingDiv(this.shadow.n);
this.shadow.wDiv = this.createCroppingDiv(this.shadow.w);
this.shadow.eDiv = this.createCroppingDiv(this.shadow.e);
this.shadow.s1Div = this.createCroppingDiv(this.shadow.s1);
this.shadow.s2Div = this.createCroppingDiv(this.shadow.s2);
this.shadow.cDiv = this.createCroppingDiv(this.shadow.c);
this.shadowDiv = window.document.createElement("div");
this.shadowDiv.style.position = "absolute";
this.shadowDiv.style.left = "0px";
this.shadowDiv.style.top = "0px";
this.shadowDiv.style.zIndex = 0;
this.shadowDiv.style.zIndex = Ga;
Nb(this.shadowDiv, "infowindow");
this.shadowDiv.appendChild(this.shadow.nw);
this.shadowDiv.appendChild(this.shadow.nDiv);
this.shadowDiv.appendChild(this.shadow.ne);
this.shadowDiv.appendChild(this.shadow.wDiv);
this.shadowDiv.appendChild(this.shadow.cDiv);
this.shadowDiv.appendChild(this.shadow.eDiv);
this.shadowDiv.appendChild(this.shadow.sw);
this.shadowDiv.appendChild(this.shadow.s1Div);
this.shadowDiv.appendChild(this.shadow.pointer);
this.shadowDiv.appendChild(this.shadow.s2Div);
this.shadowDiv.appendChild(this.shadow.se)
};
t.prototype.hasMask = function() {
return this.maskPng != null
};
t.prototype.getMaskMap = function() {
return document.getElementById(this.maskMapId)
};
var Bh = q + "transparent.gif";
var Qe = 0;
t.prototype.createMask = function() {
var p = document.createElement("map");
this.maskMapId = "iwMap" + Qe;
p.setAttribute("id", this.maskMapId);
p.setAttribute("name", this.maskMapId);
Qe++;
this.windowDiv.appendChild(p);
var z = document.createElement("area");
z.setAttribute("shape", "poly");
z.setAttribute("coords", "");
z.setAttribute("href", "");
z.onclick = function() {
return false
};
z.onmousedown = this.onmousedown;
p.appendChild(z);
for (var a = 0; a < 10; a++) {
var z = document.createElement("area");
z.setAttribute("shape", "poly");
z.setAttribute("coords", "");
z.setAttribute("href", "javascript:void(0)");
z.onclick = function() {
return false
};
p.appendChild(z)
}
this.maskPng = o.create(Bh, 0, 0, 0, 0, 0, false);
this.windowDiv.appendChild(this.maskPng);
this.maskPng.setAttribute("usemap", "#" + this.maskMapId);
this.nextMaskArea = 1
};
t.prototype.addAreaToMaskMap = function(le, Wf) {
if (this.hasMask()) {
var p = this.getMaskMap();
if (this.nextMaskArea < p.childNodes.length) {
var z = p.childNodes[this.nextMaskArea];
z.setAttribute("coords", le);
z.onmousedown = Wf;
this.nextMaskArea++
}
}
};
t.prototype.clearMaskMap = function() {
if (this.hasMask()) {
var p = this.getMaskMap();
for (var a = 1; a < p.childNodes.length; a++) {
var z = p.childNodes[a];
z.setAttribute("coords", "");
z.onmousedown = null
}
this.nextMaskArea = 1
}
};
t.prototype.getMaskLeft = function() {
return this.windowDiv.offsetLeft
};
t.prototype.getMaskTop = function() {
return this.windowDiv.offsetTop
};
t.prototype.createContentArea = function(g) {
var i = window.document.createElement("div");
i.style.width = g;
i.style.position = "absolute";
i.style.left = "15px";
i.style.top = "15px";
i.style.zIndex = 3;
i.style.cursor = "auto";
i.onmousedown = this.onMouseDown;
this.windowDiv.appendChild(i);
this.contentArea = i;
this.contentArea.onmousedown = this.onMouseDown;
i = window.document.createElement("div");
i.style.width = g;
i.style.position = "absolute";
i.style.left = "15px";
i.style.top = "15px";
i.style.zIndex = 3;
i.style.cursor = "auto";
i.style.visibility = "hidden";
this.windowDiv.appendChild(i);
this.offscreenArea = i;
this.offscreenArea.onmousedown = this.onMouseDown
};
t.prototype.prepareOffscreen = function() {
if (this.windowDiv.style.display == "none") {
this.windowDiv.style.display = "";
this.shadowDiv.style.display = "";
this.windowDiv.style.visibility = "hidden";
this.shadowDiv.style.visibility = "hidden";
this.contentArea.style.visibility = "hidden";
this.offscreenArea.style.visibility = "hidden"
}
};
t.prototype.clearOffscreenArea = function() {
Ug(this.offscreenArea)
};
t.prototype.flipOffscreenArea = function() {
var Yd = this.offscreenArea;
this.offscreenArea = this.contentArea;
this.contentArea = Yd;
this.contentArea.style.visibility = "visible";
this.offscreenArea.style.visibility = "hidden";
this.clearOffscreenArea()
};
t.prototype.onMouseDown = function(b) {
if (b) {
b.cancelDrag = true
} else {
Z(b)
}
};
var Mh = q + "close.gif";
t.prototype.createCloseButton = function() {
this.closeButton = zb.create(Mh, 14, 13, null, null, 4, null, null);
this.closeButton.style.position = "absolute";
this.closeButton.style.cursor = "pointer";
this.closeButton.onmousedown = this.eventHandler("onCloseMouseDown");
this.windowDiv.appendChild(this.closeButton)
};
t.prototype.onCloseMouseDown = function(b) {
Z(b);
if (this.oncloseclick) this.oncloseclick(b)
};
var Mc = new n(-98.35, 39.5);
var oa = new Array();
var _i;
for (_i = 0; _i < [131072, 65536, 32768, 16384, 8192, 4096, 2048, 1024, 512, 256, 128, 64, 32, 16, 8].length; _i++) {
oa.push(new n([131072, 65536, 32768, 16384, 8192, 4096, 2048, 1024, 512, 256, 128, 64, 32, 16, 8][_i] * 0.77162458338772, [131072, 65536, 32768, 16384, 8192, 4096, 2048, 1024, 512, 256, 128, 64, 32, 16, 8][_i]))
}
var Fg = q + "transparent.gif";
var Rg = q + "water.gif";
function gb(Ce) {
this.tileSize = 128;
this.backgroundColor = "#f2efe9";
this.emptyTileURL = Fg;
this.numZoomLevels = oa.length;
if (Ce) {
this.baseURL = Ce
} else {
this.baseURL = "/web/20050210030927/http://mt.google.com/mt?";
if (window._tv && window._tv.length > 0) {
this.baseURL += "v=" + encodeURIComponent(window._tv) + "&"
}
}
}
var Cc = new gb();
gb.prototype.getBitmapCoordinate = function(Ka, Pa, J, e) {
if (!e) e = new n(0, 0);
var x = Pa - Mc.x;
var l = Mc.y - Ka;
e.x = Math.floor(x * oa[J].x);
e.y = Math.floor(l * oa[J].y);
return e
};
gb.prototype.getLatLng = function(x, l, J, e) {
if (!e) e = new n(0, 0);
x /= oa[J].x;
l /= oa[J].y;
e.x = x + Mc.x;
e.y = Mc.y - l;
return e
};
gb.prototype.getTileCoordinate = function(Ka, Pa, J, e) {
var tc = this.getBitmapCoordinate(Ka, Pa, J, e);
tc.x = Math.floor(tc.x / this.tileSize);
tc.y = Math.floor(tc.y / this.tileSize);
return tc
};
gb.prototype.getTileURL = function(x, l, J) {
if (x < Jb[J].minX || (x > Jb[J].maxX || (l < Jb[J].minY || l > Jb[J].maxY))) {
return Rg
}
return this.baseURL + "x=" + x + "&y=" + l + "&zoom=" + J
};
gb.prototype.getLowestZoomLevel = function(rf, Ae, Je) {
Ae += 4;
Je += 4;
for (var a = 0; a < oa.length; a++) {
if (oa[a].x * rf.width <= Ae && oa[a].y * rf.height <= Je) {
return a
}
}
return oa.length - 1
};
gb.prototype.getPixelsPerDegree = function(J) {
return oa[J]
};
var Jb = new Array();
for (_i = 0; _i < 9; _i++) {
Jb.push(new T(-Infinity, -Infinity, Infinity, Infinity))
}
for (_i = 9; _i < oa.length; _i++) {
var wa = Cc.getTileCoordinate(85, -179.5, _i);
var ra = Cc.getTileCoordinate(12, -50, _i);
Jb.push(new T(wa.x, wa.y, ra.x, ra.y))
}
function ch(gd) {
if (window.clipboardData) {
gd.onpaste = Vh;
gd.ondrop = wg
}
return true
}
function Vh(b) {
var nc = document.selection;
if (nc) {
var Cb = nc.createRange();
if (Cb) {
var Fb = window.clipboardData.getData("Text");
if (Fb) {
Cb.text = Le(Fb, null);
return false
}
}
}
return true
}
var Ac = null;
function wg(b) {
if (!b) b = window.event;
if (b.dataTransfer) {
Ac = Le(b.dataTransfer.getData("Text"), null);
setTimeout("_finishDrop()", 1)
}
return true
}
function _finishDrop() {
if (!Ac) return;
var nc = document.selection;
if (nc) {
var Cb = nc.createRange();
if (Cb) {
Cb.text = Ac;
Cb.select()
}
}
Ac = null
}
function Le(str, Fd) {
if (!Fd) Fd = ", ";
var Ra = str.replace(/^[ \r\n\t\v]+/g, "");
Ra = Ra.replace(/[ \r\n\t\v]+$/g, "");
Ra = Ra.replace(/[ \t\v]*\r?\n[\r\n]*[ \t\v]*/g, Fd);
return Ra
}
function _pastebox(gd) {
ch(gd)
};
function R(Rd, Od, xd, Jd, Id) {
this.map = null;
this.mapContainer = Rd;
this.panel = Od;
this.metaPanel = xd;
this.permalink = Jd;
this.feedbackLink = Id;
this.urlMaker = new Ja();
this.loadIconClasses();
Oh(window, "resize", this.eventHandler("resizeMapView"));
this.resizeMapView()
}
R.prototype.loadMap = function(hi) {
this.map = new d(this.mapContainer, Cc);
this.map.registerKeyHandlers(window.document);
this.createMapControl();
this.map.showCopyright();
new pc(this.map, this);
this.map.addStateListener(this)
};
R.prototype.createMapControl = function() {
var lc = this.map.createMapControl();
lc.style.position = "absolute";
lc.style.left = "8px";
lc.style.top = "8px";
Nb(lc, "noprint");
this.mapContainer.appendChild(lc)
};
R.prototype.onMapStateChanged = function() {
try {
if (this.vpageDoc) {
var B = this.map.getCenterLatLng();
this.vpageDoc.getElementById(je).value = B.y;
this.vpageDoc.getElementById(ke).value = B.x;
this.vpageDoc.getElementById("zoom").value = this.map.zoomLevel
}
var fa = this.getPageURL();
this.permalink.href = fa;
this.feedbackLink.href = "/web/20050210030927/http://www.google.com/support/maps/bin/request.py?url=" + encodeURIComponent(fa) + "&ua=" + encodeURIComponent(navigator.userAgent)
} catch (b) {}
};
var _windowSizeStorage;
R.prototype.resizeMapView = function() {
var uh = this.getWindowSize(_windowSizeStorage);
var k = uh.height - kh(this.mapContainer) - 10;
this.mapContainer.style.height = k + "px";
if (this.map) this.map.onResize()
};
R.prototype.getWindowSize = function(e) {
if (!e) e = new L(0, 0);
if (window.self && self.innerWidth) {
e.width = self.innerWidth;
e.height = self.innerHeight;
return e
}
if (document.documentElement && document.documentElement.clientHeight) {
e.width = document.documentElement.clientWidth;
e.height = document.documentElement.clientHeight;
return e
}
e.width = document.body.clientWidth;
e.height = document.body.clientHeight;
return e
};
R.prototype.loadIconClasses = function() {
var Cd = [9, 0, 6, 1, 4, 2, 2, 4, 0, 8, 0, 12, 1, 14, 2, 16, 5, 19, 7, 23, 8, 26, 9, 30, 9, 34, 11, 34, 11, 30, 12, 26, 13, 24, 14, 21, 16, 18, 18, 16, 20, 12, 20, 8, 18, 4, 16, 2, 15, 1, 13, 0];
M.load(new M("local", 20, 34, new n(9, 34), new n(9, 2), new n(17, 23), q + "shadow50.png", 37, Cd));
M.load(new M("noicon", 0, 0, new n(0, 0), new n(0, 0), new n(0, 0), null, 0, null))
};
R.prototype.loadXML = function(Og, zg) {
qa.invalidateAll();
this.clearSearchState();
try {
this.vpageDoc = zg;
var ca = fg(Og);
this.loadVPage(ca)
} catch (b) {}
};
R.prototype.loadVPage = function(ca) {
var E = H.loadFromXML(ca, null, null);
this.vpage = E;
if (E.title) {
window.document.title = "Google Maps - " + E.title
} else {
window.document.title = "Google Maps"
}
if (E.error || E.spelling) {
if (m.type != 3) {
Y.asynchronousTransform(E.xml, this.metaPanel, "/mapfiles/metapanel.xsl", null, "metaPanel")
} else {
E.metaToHTML(this.metaPanel)
}
this.metaPanel.style.display = ""
}
if (E.overlays && E.overlays.length > 0) {
var ha = E.overlays[0];
if (ha.panelStyle && ha.locations) {
this.showOverlayPanel(ha)
}
} else if (E.directions) {
this.showDirectionsPanel(E.directions)
}
if (E.debug) {
var nb = document.createElement("pre");
nb.appendChild(document.createTextNode(E.debug));
this.metaPanel.appendChild(nb);
this.metaPanel.style.display = ""
}
var B = null;
var ka = null;
if (this.vpageDoc) {
var ud = this.vpageDoc.getElementById(je);
var vd = this.vpageDoc.getElementById(ke);
if (ud && (vd && (ud.value.length > 0 && vd.value.length > 0))) {
B = new n(parseFloat(vd.value), parseFloat(ud.value))
}
var Qd = this.vpageDoc.getElementById("zoom");
if (Qd && Qd.value.length > 0) {
ka = parseInt(Qd.value)
}
}
this.map.loadVPage(E, B, ka);
this.lastSearchSpan = this.map.getSpanLatLng()
};
R.prototype.showOverlayPanel = function(ha) {
var h = this;
window.showLocationInfo = function(F) {
var r = ha.getLocationById(F);
if (r) {
h.map.clearInfoWindowArgs(r.xml);
h.map.showInfoWindow(r)
}
};
if (m.type != 3) {
Y.asynchronousTransform(ha.xml, this.panel, ha.panelStyle, null, "panel")
} else {
ha.toHTML(this.panel)
}
};
R.prototype.showDirectionsPanel = function(y) {
this.highlightedTd = null;
var h = this;
window.showDirectionsSegment = function(F) {
var Kb = y.getSegmentById(F);
var Gc = document.getElementById(F);
if (Kb) {
h.map.showDirectionsStep(Kb);
if (Gc) {
if (this.highlightedTd) this.highlightedTd.style.backgroundColor = "white";
this.highlightedTd = Gc;
Gc.style.backgroundColor = "#eeeeee";
h.map.oninfowindowclose = function() {
h.highlightedTd = null;
Gc.style.backgroundColor = "white";
h.map.oninfowindowclose = null
}
}
}
};
window.showDirectionsStart = function() {
h.map.showDirectionsStart();
if (this.highlightedTd) this.highlightedTd.style.backgroundColor = "white";
this.highlightedTd = null
};
window.showDirectionsEnd = function() {
h.map.showDirectionsEnd();
if (this.highlightedTd) this.highlightedTd.style.backgroundColor = "white";
this.highlightedTd = null
};
if (m.type != 3) {
Y.asynchronousTransform(y.xml, this.panel, "/mapfiles/directionspanel.xsl", null, "panel")
} else {
y.toHTML(this.panel)
}
};
R.prototype.search = function(bb, Th, og) {
qa.invalidateAll();
this.clearSearchState();
if (!bb || bb.length == 0) return;
this.panel.innerHTML = "Searching...";
this.urlMaker.reset();
var w = this.urlMaker;
w.setValue("sll", w.getLatLngArg(this.map.getCenterLatLng()));
w.setValue("sspn", w.getSpanArg(this.map.getSpanLatLng()));
w.setValue("z", this.map.zoomLevel);
w.setValue("t", w.getSpecArg(this.map.spec));
w.setValue("q", bb);
w.setValue("f", og);
if (m.type != 3) {
w.setValue("output", "js");
var fa = w.getURL();
nd('<a href="' + fa.xmlEscape() + '">' + fa.xmlEscape() + "</a>", 0);
Th.src = fa
} else {
w.setValue("output", "xml");
this.loadSafari(w.getURL())
}
};
R.prototype.clearSearchState = function() {
this.map.clearOverlays();
this.metaPanel.innerHTML = "";
this.metaPanel.style.display = "none";
this.panel.innerHTML = "";
this.vpage = null;
this.vpageDoc = null
};
R.prototype.getPageURL = function() {
this.urlMaker.reset();
var w = this.urlMaker;
if (this.vpage && this.vpageDoc) {
w.setValue("q", this.vpage.query);
var bi = parseFloat(this.vpageDoc.getElementById(je).value);
var jg = parseFloat(this.vpageDoc.getElementById(ke).value);
var bf = new n(jg, bi);
var we = this.map.getSpanLatLng();
var qf = this.vpage.center;
if (this.vpage.searchCenter) {
w.setValue("sll", w.getLatLngArg(this.vpage.searchCenter));
qf = this.vpage.searchCenter
}
var ma = false;
if (!bf.approxEquals(qf)) {
ma = true;
w.setValue("ll", w.getLatLngArg(bf))
}
var ie = this.lastSearchSpan;
if (this.vpage.searchSpan) {
w.setValue("sspn", w.getSpanArg(this.vpage.searchSpan));
ie = this.vpage.searchSpan
}
if (ma || ie && !we.approxEquals(ie)) {
w.setValue("spn", w.getSpanArg(we))
}
} else {
w.setAllMapValues(this.map)
}
return w.getURL()
};
R.prototype.email = function() {
var fa = "mailto:?subject=" + encodeURIComponent("Google Map") + "&body=" + encodeURIComponent(Be + this.getPageURL());
window.location.href = fa
};
R.prototype.print = function() {
window.print()
};
R.prototype.initSafari = function() {
if (m.type == 3) {
this.urlMaker.reset();
var w = this.urlMaker;
w.setValue("output", "xml");
this.loadSafari(w.getURL())
}
};
R.prototype.loadSafari = function(fa) {
try {
var sa = Xd.create();
sa.open("GET", fa, true);
var yc = qa.create("xml");
var h = this;
sa.onreadystatechange = function() {
if (sa.readyState == 4) {
if (yc.isValid()) {
try {
h.clearSearchState();
var Db = sa.responseXML;
h.loadVPage(Db)
} catch (b) {}
}
}
};
sa.send(null)
} catch (b) {}
};
function _app(Rd, Od, xd, Jd, Id) {
return new R(Rd, Od, xd, Jd, Id)
}
Yb.prototype.toHTML = function(P) {
var S = "";
if (this.locations.length > 0) {
var S = "<table>";
for (var a = 0; a < this.locations.length; a++) {
var Sa = this.locations[a];
var Wa = Sa.xml.getElementsByTagName("info")[0];
var Ya = dc(Wa.getElementsByTagName("title")[0], false);
var Va = H.getNodeValue(Wa.getElementsByTagName("distance")[0]);
var ne = H.getNodeValue(Wa.getElementsByTagName("phone")[0]);
S += '<tr><td style="vertical-align: top; padding-right: 4px;"><a href="javascript:showLocationInfo(\'' + Sa.id + "')\">" + '<img style="width:24px; height:38px" alt="" ' + 'src="' + q + "icon" + Sa.id + '.png"/></a></td>' + '<td style="padding-bottom: 0.5em; padding-top: 1px"><div>' + "<a href=\"javascript:showLocationInfo('" + Sa.id + "')\" " + 'style="color: #0000cc">' + Ya + "</a></div>" + '<div style="font-size: smaller">' + ne + " - " + '<span style="color: #7777cc">' + Va + "</span></div>" + "</td></tr>"
}
S += "</table>"
}
P.innerHTML = S
};
Lc.prototype.toHTML = function(P) {
var Wa = this.xml.getElementsByTagName("info")[0];
var Ya = H.getNodeValue(Wa.getElementsByTagName("title")[0]);
var Va = H.getNodeValue(Wa.getElementsByTagName("distance")[0]);
var ne = H.getNodeValue(Wa.getElementsByTagName("phone")[0]);
var Xa = Wa.getElementsByTagName("line");
var Ed = "";
var be = "";
if (Xa.length > 0) Ed = H.getNodeValue(Xa[0]);
if (Xa.length > 1) be = H.getNodeValue(Xa[1]);
var Ge = (Ed + ", " + be).jsEscape();
var S = "<div><b>" + Ya.xmlEscape() + "</b></div>" + '<div style="font-size: small">' + ne + "</div>" + '<div style="font-size: small"><div>' + Ed.xmlEscape() + "</div><div>" + be.xmlEscape() + "</div></div>" + '<div style="font-size: small; margin-top: 0.4em">Directions:' + " <a href=\"javascript:directionsSearch(null, '" + Ge + "', false)\">To here</a> - " + "<a href=\"javascript:directionsSearch('" + Ge + "', null, false)\">From here</a></div>";
P.innerHTML = S
};
H.prototype.metaToHTML = function(P) {
var S = "";
if (this.spelling) {
var hg = dc(this.spelling, false);
var str = H.getNodeValue(this.spelling);
S += '<div style="color: #cc0000; margin-bottom: 1em">Did you mean: <a href="javascript:search(\'' + str.jsEscape() + "')\">" + hg + "</a></div>"
}
if (this.error) {
var str = dc(this.error, false);
S += "<p>" + str + "</p>"
}
P.innerHTML = S
};
Tb.prototype.toHTML = function(P) {
var Hf = Ie(this.xml.getElementsByTagName("source")[0]);
var mf = Ie(this.xml.getElementsByTagName("destination")[0]);
var ce = this.xml.getElementsByTagName("segments")[0];
var Va = ce.getAttribute("distance");
var te = ce.getAttribute("time");
var S = '<table class="dirsummary"><tr><td class="name" onclick="showDirectionsStart()" style="cursor: pointer"><a href="javascript:void(0)" onclick="javascript:return true">Start from</a>:</td><td class="value" onclick="showDirectionsStart()" style="cursor: pointer">' + Hf.xmlEscape() + "</td></tr>" + '<tr><td class="name" onclick="showDirectionsEnd()" ' + 'style="cursor: pointer"><a href="javascript:void(0)" ' + 'onclick="javascript:return true">Arrive at</a>:</td>' + '<td class="value" onclick="showDirectionsEnd()" ' + 'style="cursor: pointer">' + mf.xmlEscape() + "</td></tr>" + '<tr><td class="name">Distance:</td><td class="value">' + Va + "(about " + te + ")</td></tr></table>" + '<div class="reverse"><a ' + "href=\"javascript:javascript:directionsSearch('" + mf.jsEscape() + "', '" + Hf.jsEscape() + "', true)\">" + 'Reverse directions</a></div><table class="directions">';
var If = ce.getElementsByTagName("segment");
for (var a = 0; a < If.length; a++) {
var fd = If[a];
var F = fd.getAttribute("id");
var Va = fd.getAttribute("distance");
var Xg = parseInt(fd.getAttribute("meters"));
var str = dc(fd, false);
S += '<tr id="' + F + '"><td class="num" ' + "onclick=\"showDirectionsSegment('" + F + "', this)\">" + '<a href="javascript:void(0)" onclick="return true">' + (a + 1) + '.</td><td class="desc" onclick="showDirectionsSegment(\'' + F + "', true)\">" + str + " - go <b>" + Va + "</b></td></tr>";
if (Xg > 16903) {
S += '<tr><td colspan="2" class="gap"><div class="gap">&#8943;</div></td></tr>'
}
}
S += "</table>";
P.innerHTML = S
};
function Ie(D) {
var Xa = D.getElementsByTagName("line");
var str = "";
for (var a = 0; a < Xa.length; a++) {
str += H.getNodeValue(Xa[a]);
if (a < Xa.length - 1) str += ", "
}
return str
}
function dc(D, De) {
var O = "";
if (D.nodeType == 3 || D.nodeType == 4) return D.nodeValue;
if (D.nodeType == 1) {
if (De && D.tagName) O += "<" + D.tagName + ">";
for (var Ea = D.firstChild; Ea != null; Ea = Ea.nextSibling) {
O += dc(Ea, true)
}
if (De && D.tagName) O += "</" + D.tagName + ">"
}
return O
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment