// Copyright (C) 2010-2011 AvantLogic Corporation: http://www.mapsalive.com

if (typeof (console) === 'undefined')
{
	console = function() { };
	console.log = function(s) { };
}





































































































var maMarkerType_Symbol = 1;var maMarkerType_Shape = 2;var maMarkerType_SymbolAndShape = 3;var maMarkerType_Text = 4;var maMarkerType_Photo = 5;var maShapeType_None = 0;var maShapeType_Circle = 1;var maShapeType_Rectangle = 2;var maShapeType_Polygon = 3;var maShapeType_Line = 4;var maShapeType_Hybrid = 5;var maActionNone = 0;var maActionGotoPage = 1;var maActionLinkToUrl = 2;var maActionCallJavascript = 3;var maActionLinkToUrlNewWindow = 5;var maShowContentOnMouseover = 0;var maShowContentOnClick = 1;var maShowContentNever = 2;maClient.runtimeVersionHtml5 = 3;maClient.Html5 = function() { };function maMarkerInstance( map, viewId, markerType, markerStyleId, normalSymbolId, selectedSymbolId, pctX, pctY, x, y, shapeType, shapeW, shapeH, normalSymbolW, normalSymbolH, selectedSymbolW, selectedSymbolH, symbolLocationX, symbolLocationY, anchorX, anchorY, rotation, zoomThreshold, flags, tooltip, clickAction, clickActionTarget, mouseoverAction, mouseoverActionTarget, mouseoutAction, mouseoutActionTarget, touchPerformsClickAction, showContentEvent, shapeCoords) { this.map = map;this.viewId = viewId;this.markerType = markerType;this.markerStyleId = markerStyleId;this.blendMode = "";this.customMarkerStyle = null;this.normalSymbolId = normalSymbolId;this.selectedSymbolId = selectedSymbolId;this.shapeType = shapeType;this.shapeW = shapeW;this.shapeH = shapeH;this.normalSymbolW = normalSymbolW;this.normalSymbolH = normalSymbolH;this.selectedSymbolW = selectedSymbolW;this.selectedSymbolH = selectedSymbolH;this.symbolLocationX = symbolLocationX;this.symbolLocationY = symbolLocationY;this.anchorX = anchorX;this.anchorY = anchorY;this.zoomThreshold = zoomThreshold;this.flags = flags;this.isDisabled = (flags & 0x00000001) !== 0;this.isHidden = (flags & 0x00000002)!== 0;this.isStatic = (flags & 0x00000004)!== 0;this.isRoute = (flags & 0x00000008)!== 0;this.markerZooms = (flags & 0x00000020)!== 0;this.isShapeOnly = (flags & 0x00000040) !== 0;this.isNotAnchored = (flags & 0x00000080) !== 0;this.isBound = (flags & 0x00000100) !== 0;this.doesNotShowContent = (flags & 0x00000400) !== 0;this.appearsSelected = false;this.tooltip = tooltip;this.clickAction = clickAction;this.clickActionTarget = clickActionTarget;this.mouseoverAction = mouseoverAction;this.mouseoverActionTarget = mouseoverActionTarget;this.mouseoutAction = mouseoutAction;this.mouseoutActionTarget = mouseoutActionTarget;this.touchPerformsClickAction = touchPerformsClickAction;this.mouseIsOverMarker = false;this.showContentEvent = showContentEvent;this.routeDefinition = null;this.blinkAlpha = 1.0;this.blinkCount = 0;this.blinkLimit = 0;this.blinkDirection = 0;this.visited = false;this.cornerX = 0;this.cornerY = 0;this.drawnMaxWidth = 0;this.drawnMaxHeight = 0;this.isVisibleAtCurrentZoomLevel = false;if (this.isNotAnchored) { this.x = Math.round(this.map.viewPort.w * pctX);this.y = Math.round(this.map.viewPort.h * pctY);} else { this.x = x;this.y = y;} this.rotation = rotation * Math.PI / 180;if (this.rotation !== 0) { var hypotenuse = Math.round(Math.sqrt((shapeW * shapeW) + (shapeH * shapeH)));this.maxWidth = hypotenuse;this.maxHeight = hypotenuse;if (anchorX !== 0 || anchorY !== 0) { this.maxWidth *= 3;this.maxHeight *= 3;} } else { this.maxWidth = shapeW;this.maxHeight = shapeH;} this.maxWidth += 2;this.maxHeight += 2;this.shapeCoords = shapeCoords;this.paddingNormal = new Object();this.paddingSelected = new Object();this.paddingNormal.x = 0;this.paddingNormal.y = 0;this.paddingNormal.w = 0;this.paddingNormal.h = 0;this.paddingSelected.x = 0;this.paddingSelected.y = 0;this.paddingSelected.w = 0;this.paddingSelected.h = 0;var me = this;var symbolType;var symbolIdN = 0;var symbolIdS = 0;if (markerType == maMarkerType_Symbol || markerType == maMarkerType_SymbolAndShape) { symbolType = "S";if (normalSymbolId !== 0) { symbolIdN = normalSymbolId;} if (selectedSymbolId !== 0) { symbolIdS = selectedSymbolId;} } else if (markerType == maMarkerType_Text || markerType == maMarkerType_Photo) { symbolType = "H";symbolIdN = viewId;symbolIdS = viewId;} if (symbolIdN !== 0) { this.hasImageN = true;this.imgLoadedN = false;this.imgN = new Image();this.imgN.onload = function() { me.imgLoadedN = true; };this.imgN.src = this.getSymbolDataUri(symbolIdN, symbolType, "N");} else { this.hasImageN = false;} if (symbolIdS !== 0) { this.hasImageS = true;this.imgLoadedS = false;this.imgS = new Image();this.imgS.onload = function() { me.imgLoadedS = true; };this.imgS.src = this.getSymbolDataUri(symbolIdS, symbolType, "S");} else { this.hasImageS = false;} } maMarkerInstance.prototype.getSymbolDataUri = function(symbolId, symbolType, symbolState) { var markerImages = this.map.markerImages();for (var index in markerImages) { var o = markerImages[index];if (o.id == symbolType + symbolId + symbolState) { return "data:image/png;base64," + o.data;} } return null;};maMarkerInstance.prototype.anchorScaledX = function() { var x = this.anchorX;if (this.markerZooms) { x = Math.round(x * this.map.currentMapScale);} return x;};maMarkerInstance.prototype.anchorScaledY = function() { var y = this.anchorY;if (this.markerZooms) { y = Math.round(y * this.map.currentMapScale);} return y;};maMarkerInstance.prototype.blendOnto = function() { var mode = this.blendMode.toLowerCase();if (maTour.disableBlendEffect && maClient.mobile) { return;} if (mode.length === 0 || mode == "normal" || mode == "invert") { return;} var x = this.cornerX;var y = this.cornerY;var w = this.drawnMaxWidth;var h = this.drawnMaxHeight;var lineWidth = this.lineWidth();w += lineWidth;h += lineWidth;x -= lineWidth / 2;y -= lineWidth / 2;if (x < 0) { w += x;x = 0;} if (y < 0) { h += y;y = 0;} if (x + w > this.map.viewPort.w) { w -= x + w - this.map.viewPort.w;} if (y + h > this.map.viewPort.h) { h -= y + h - this.map.viewPort.h;} this.map.hitLayerContext.clearRect(0, 0, this.map.viewPort.w, this.map.viewPort.h);this.map.drawMarkerShape(this, this.map.hitLayerContext, false);var hitLayerImageData;var mapLayerImageData;var markerLayerImageData;try { hitLayerImageData = this.map.hitLayerContext.getImageData(x, y, w, h);mapLayerImageData = this.map.mapLayerContext.getImageData(x, y, w, h);markerLayerImageData = this.map.markerLayerContext.getImageData(x, y, w, h);} catch (error) { return;} var hit = hitLayerImageData.data;var src = mapLayerImageData.data;var dst = markerLayerImageData.data;var x_ = x;var y_ = y;var clip = this.map.clipBounds;var pixelCount = dst.length;for (var px = 0; px < pixelCount; px += 4) { var skip = false;if (hit[px + 3] === 0) { skip = true;} else if (clip !== null && (x_ < clip.x || x_ >= clip.x + clip.w || y_ < clip.y || y_ >= clip.y + clip.h)) { skip = true;} x_ += 1;if (x_ - x >= w) { x_ = x;y_ += 1;} if (skip) { continue;} var sA = src[px + 3] / 255;var dA = dst[px + 3] / 255;var dA2 = (sA + dA - sA * dA);dst[px + 3] = dA2 * 255;var sRA = src[px] / 255 * sA;var dRA = dst[px] / 255 * dA;var sGA = src[px + 1] / 255 * sA;var dGA = dst[px + 1] / 255 * dA;var sBA = src[px + 2] / 255 * sA;var dBA = dst[px + 2] / 255 * dA;var demultiply = 255 / dA2;switch (mode) { case 'darken': dst[px] = (sRA > dRA ? dRA : sRA) * demultiply;dst[px + 1] = (sGA > dGA ? dGA : sGA) * demultiply;dst[px + 2] = (sBA > dBA ? dBA : sBA) * demultiply;break;case 'difference': dst[px] = (sRA + dRA - 2 * Math.min(sRA * dA, dRA * sA)) * demultiply;dst[px + 1] = (sGA + dGA - 2 * Math.min(sGA * dA, dGA * sA)) * demultiply;dst[px + 2] = (sBA + dBA - 2 * Math.min(sBA * dA, dBA * sA)) * demultiply;break;case 'lighten': dst[px] = (sRA < dRA ? dRA : sRA) * demultiply;dst[px + 1] = (sGA < dGA ? dGA : sGA) * demultiply;dst[px + 2] = (sBA < dBA ? dBA : sBA) * demultiply;break;case 'multiply': dst[px] = (sRA * dRA + sRA * (1 - dA) + dRA * (1 - sA)) * demultiply;dst[px + 1] = (sGA * dGA + sGA * (1 - dA) + dGA * (1 - sA)) * demultiply;dst[px + 2] = (sBA * dBA + sBA * (1 - dA) + dBA * (1 - sA)) * demultiply;break;case 'overlay':  dst[px] = (sRA <= 0.5) ? (2 * dst[px] * sRA / dA) : 255 - (2 - 2 * sRA / sA) * (255 - dst[px]);dst[px + 1] = (sGA <= 0.5) ? (2 * dst[px + 1] * sGA / dA) : 255 - (2 - 2 * sGA / sA) * (255 - dst[px + 1]);dst[px + 2] = (sBA <= 0.5) ? (2 * dst[px + 2] * sBA / dA) : 255 - (2 - 2 * sBA / sA) * (255 - dst[px + 2]);break;case 'hardlight':  dst[px] = (dRA <= 0.5) ? (2 * src[px] * dRA / dA) : 255 - (2 - 2 * dRA / dA) * (255 - src[px]);dst[px + 1] = (dGA <= 0.5) ? (2 * src[px + 1] * dGA / dA) : 255 - (2 - 2 * dGA / dA) * (255 - src[px + 1]);dst[px + 2] = (dBA <= 0.5) ? (2 * src[px + 2] * dBA / dA) : 255 - (2 - 2 * dBA / dA) * (255 - src[px + 2]);break;case 'screen': dst[px] = (sRA + dRA - sRA * dRA) * demultiply;dst[px + 1] = (sGA + dGA - sGA * dGA) * demultiply;dst[px + 2] = (sBA + dBA - sBA * dBA) * demultiply;break;default: break;} } this.map.markerLayerContext.putImageData(markerLayerImageData, x, y);};maMarkerInstance.prototype.computeMarkerLocationValues = function() { this.drawnMaxWidth = this.drawnMaxWidth_();this.drawnMaxHeight = this.drawnMaxHeight_();this.cornerX = this.cornerX_();this.cornerY = this.cornerY_();this.isVisibleAtCurrentZoomLevel = this.isVisibleAtCurrentZoomLevel_();};maMarkerInstance.prototype.centerX = function() { var x = this.x;if (this.isNotAnchored) { x -= this.map.mapPanX;} else { x = Math.round(this.map.currentMapScale * x);} return x;};maMarkerInstance.prototype.centerY = function() { var y = this.y;if (this.isNotAnchored) { y -= this.map.mapPanY;} else { y = Math.round(this.map.currentMapScale * y);} return y;};maMarkerInstance.prototype.cornerX_ = function() { return this.centerX() - Math.round(this.drawnMaxWidth / 2) - this.anchorScaledX() - this.map.viewPort.x1;};maMarkerInstance.prototype.cornerY_ = function() { return this.centerY() - Math.round(this.drawnMaxHeight / 2) - this.anchorScaledY() - this.map.viewPort.y1;};maMarkerInstance.prototype.offsetX = function() { return -Math.round(this.shapeW / 2);};maMarkerInstance.prototype.offsetY = function() { return -Math.round(this.shapeH / 2);};maMarkerInstance.prototype.drawnWidth = function() { var w = this.shapeW;if (this.markerZooms) w = Math.round(this.map.currentMapScale * w);return w;};maMarkerInstance.prototype.drawnHeight = function() { var h = this.shapeH;if (this.markerZooms) h = Math.round(this.map.currentMapScale * h);return h;};maMarkerInstance.prototype.drawnMaxWidth_ = function() { var w = this.maxWidth;if (this.markerZooms) w = Math.round(this.map.currentMapScale * w);return w;};maMarkerInstance.prototype.drawnMaxHeight_ = function() { var h = this.maxHeight;if (this.markerZooms) h = Math.round(this.map.currentMapScale * h);return h;};maMarkerInstance.prototype.isVisibleAtCurrentZoomLevel_ = function() { if (this.isHidden) return false;var isVisible = true;var zoomLevelPercent = Math.round(this.map.currentMapScale * 100);if (this.zoomThreshold < 0) { isVisible = zoomLevelPercent <= -this.zoomThreshold;} else if (this.zoomThreshold > 0) { isVisible = zoomLevelPercent >= this.zoomThreshold;} return isVisible;};maMarkerInstance.prototype.lineWidth = function() { var markerStyle = this.markerStyle();if (markerStyle === null) { return 0;} else { return markerStyle.lineWidth;} };maMarkerInstance.prototype.markerStyle = function() { var markerStyle;if (this.customMarkerStyle === null) { markerStyle = this.map.markerStyles[this.markerStyleId];if (typeof markerStyle == "undefined") markerStyle = null;} else { markerStyle = this.customMarkerStyle;} return markerStyle;};maMarkerInstance.prototype.setBlink = function(howManyTimes) { if (typeof this.blinkIntervalId != "undefined") { clearInterval(this.blinkIntervalId);} if (howManyTimes > 0) { this.blinkIntervalId = setInterval("maClient.map.blinkMarker(" + this.viewId + ");", 50);this.blinkDirection = -1;this.blinkLimit = howManyTimes;} else { this.setBlinkAlpha(1.0);} this.blinkCount = 0;};maMarkerInstance.prototype.setBlinkAlpha = function(alpha) { this.blinkAlpha = alpha;this.map.redrawMarker(this, this.viewId == this.map.selectedViewId);};function maMarkerStyle( id, lineWidth, normalFillColor, normalLineColor, selectedFillColor, selectedLineColor, normalFillColorOpacity, normalLineColorOpacity, selectedFillColorOpacity, selectedLineColorOpacity, normalShapeEffects, selectedShapeEffects) { this.id = id;this.lineWidth = lineWidth;this.normalFillColor = normalFillColor;this.normalLineColor = normalLineColor;this.selectedFillColor = selectedFillColor;this.selectedLineColor = selectedLineColor;this.normalFillColorOpacity = normalFillColorOpacity;this.normalLineColorOpacity = normalLineColorOpacity;this.selectedFillColorOpacity = selectedFillColorOpacity;this.selectedLineColorOpacity = selectedLineColorOpacity;this.normalShapeEffects = normalShapeEffects;this.selectedShapeEffects = selectedShapeEffects;} maMarkerStyle.prototype.cloneMarkerStyle = function() { var markerStyle = new maMarkerStyle( this.id, this.lineWidth, this.normalFillColor, this.normalLineColor, this.selectedFillColor, this.selectedLineColor, this.normalFillColorOpacity, this.normalLineColorOpacity, this.selectedFillColorOpacity, this.selectedLineColorOpacity, this.normalShapeEffects, this.selectedShapeEffects);return markerStyle;};function maRouteDefinition(markerInstance, markerIdList) { this.markerInstance = markerInstance;this.markerIdList = markerIdList;var minX = Number.MAX_VALUE;var maxX = Number.MIN_VALUE;var minY = Number.MAX_VALUE;var maxY = Number.MIN_VALUE;markerIdList = markerIdList + "";var sections = markerIdList.split(";");var coords = new Array();for (var i in sections) { coords.push(-1);coords.push(4);var markers = new Array();if (markerIdList.length > 0) { var list = sections[i].split(",");for (var j in list) { var m = this.markerInstance.map.markerInstance(list[j]);if (m !== null && !m.isRoute) { markers.push(m);} } } for (var k in markers) { var marker = markers[k];coords.push(marker.x);coords.push(marker.y);if (marker.x < minX) minX = marker.x;if (marker.x > maxX) maxX = marker.x;if (marker.y < minY) minY = marker.y;if (marker.y > maxY) maxY = marker.y;} } this.markerInstance.shapeW = maxX - minX;this.markerInstance.maxWidth = this.markerInstance.shapeW;this.markerInstance.shapeH = maxY - minY;this.markerInstance.maxHeight = this.markerInstance.shapeH;this.markerInstance.x = minX + (markerInstance.maxWidth / 2);this.markerInstance.y = minY + (markerInstance.maxHeight / 2);for (var index = 0; index < coords.length; index += 2) { if (coords[index] == -1) continue;coords[index] -= (minX + 0.5);coords[index + 1] -= (minY + 0.5);} var points = coords.join(",");markerInstance.shapeCoords = points;} maClient.Html5.prototype.onClick = function(event) { maClient.map.onTouch(event);var originalViewId = maClient.map.selectedViewId;var clickedViewId = maClient.map.getMarkerUnderMouse();if (clickedViewId === 0) { return;} var markerInstance = maClient.map.markerInstance(clickedViewId);if (markerInstance === null) { return;} if (markerInstance.isDisabled) { return;} if (markerInstance.clickActionTarget.length > 0) { maClient.map.executeClickAction(markerInstance);} if (markerInstance.showContentEvent == maShowContentOnClick) { maClient.map.switchView(markerInstance, false);} if (maTour.usesPopup && (maClient.popupIsPinned || maTour.popup.pinOnClick)) { var pinnedPopupWasClicked = maClient.popupIsPinned && originalViewId == clickedViewId;maClient.map.deselectMarker();maClient.map.switchView(markerInstance, false);if (!pinnedPopupWasClicked && maTour.popup.pinOnClick) { maClient.flashPinnableMarkerClicked();} } };maClient.Html5.prototype.onMapTileImageDataLoaded = function() { maClient.map.mapTileImageDataLoaded = true;};maClient.Html5.prototype.onMouseDown = function(event) { if (!maClient.map.mapIsZoomed()) return;maClient.map.touchStartX = event.pageX;maClient.map.touchStartY = event.pageY;maClient.map.touchDeltaX = 0;maClient.map.touchDeltaY = 0;maClient.map.dragging = true;maClient.map.markerLayer.style.cursor = 'move';};maClient.Html5.prototype.onMouseUp = function(event) { maClient.map.dragging = false;maClient.map.markerLayer.style.cursor = 'auto';};maClient.Html5.prototype.onResize = function(event) { maClient.map.mapLocationInBrowser = maClient.tagLocation(null, "maMarkerLayer");};maClient.Html5.prototype.onSymbolImageDataLoaded = function() { maClient.map.symbolImageDataLoaded = true;};maClient.Html5.prototype.onTouch = function(event) { var map = maClient.map;var js;if (!maClient.mapLoaded) { return;} if (map.dragging) { var deltaX = event.pageX - maClient.map.touchStartX;var deltaY = event.pageY - maClient.map.touchStartY;maClient.map.touchStartX = event.pageX;maClient.map.touchStartY = event.pageY;maClient.map.touchDeltaX = deltaX;maClient.map.touchDeltaY = deltaY;maClient.map.handlePanEvent();return;} if (maClient.isTouchDevice) { map.stopSlideShow();} if (!maClient.isTouchDevice && maClient.popupIsPinned) { return;} if (!map.getMouseLocation()) { return;} var viewId = map.getMarkerUnderMouse();if (map.mapCanZoom) { event.preventDefault();} if (map.ignoreTouch) { return;} if (viewId === 0 && map.selectedViewId === 0) { map.markerLayer.style.cursor = "auto";return;} var selectNewMarker = false;var markerInstance;if (viewId === 0) { var closePopupWhenClickOnMap = false;if (maTour.usesPopup) { if (closePopupWhenClickOnMap || !maClient.isTouchDevice) { map.markerLayer.style.cursor = "auto";map.deselectMarker();maClient.flashMarkerMouseOut();} } else if (!maClient.isTouchDevice && map.mouseIsOverMarker) { markerInstance = map.markerInstance(map.selectedViewId);js = markerInstance.mouseoutAction == maActionCallJavascript ? markerInstance.mouseoutActionTarget : "";if (js.length > 0) { map.mouseIsOverMarker = false;maClient.flashExecuteJavaScript(js);} } } else { map.stopSlideShow();markerInstance = map.markerInstance(viewId);if (!maClient.isTouchDevice && markerInstance.showContentEvent == maShowContentOnClick) { map.showTooltip(markerInstance);return;} if (map.selectedViewId === 0) { map.mouseIsOverMarker = true;selectNewMarker = true;if (!maClient.isTouchDevice && markerInstance.showContentEvent != maShowContentOnMouseover) { map.showTooltip(markerInstance);} } else if (map.selectedViewId !== viewId) { map.deselectMarker();map.mouseIsOverMarker = true;selectNewMarker = true;if (this.popupIsShowing) { maClosePopup();} } else { markerInstance.setBlink(0);if (!map.mouseIsOverMarker) { js = markerInstance.mouseoverAction == maActionCallJavascript ? markerInstance.mouseoverActionTarget : "";if (js.length > 0) { maClient.flashExecuteJavaScript(js);} } map.mouseIsOverMarker = true;if (markerInstance.clickActionTarget.length > 0 && markerInstance.touchPerformsClickAction && maClient.isTouchDevice) { maClient.map.executeClickAction(markerInstance);} else if (markerInstance.doesNotShowContent || !maTour.usesDynamicPopup) { map.showTooltip(markerInstance);} } } map.markerLayer.style.cursor = viewId === 0 ? "auto" : "pointer";if (selectNewMarker && !markerInstance.isDisabled) { markerInstance.setBlink(0);map.switchView(markerInstance, false);} };maClient.Html5.prototype.onGestureStart = function(event) { maClient.map.gestureStarted = true;};maClient.Html5.prototype.onGestureEnd = function(event) { if (maClient.map.mapZoomDelta !== 0) { maClient.map.setMapZoomInOut(maClient.map.mapZoomDelta);maClient.map.startTouchDelay();} maClient.map.gestureChanged = false;};maClient.Html5.prototype.onGestureChange = function(event) { if (maClient.map.mapCanZoom) { event.preventDefault();} if (maClient.map.gestureChanged) { return;} else { maClient.map.gestureChanged = true;if (event.scale < 1.0) { maClient.map.mapZoomDelta = -25;} else if (event.scale > 1.0) { maClient.map.mapZoomDelta = 25;} } };maClient.Html5.prototype.onTouchStart = function(event) { maClient.map.touchStartX = event.touches[0].pageX;maClient.map.touchStartY = event.touches[0].pageY;maClient.map.touchDeltaX = 0;maClient.map.touchDeltaY = 0;};maClient.Html5.prototype.onTouchMove = function(event) { if (maClient.map.mapCanZoom) { event.preventDefault();} if (maClient.map.gestureStarted || !maClient.map.mapIsZoomed()) { return;} var deltaX = event.targetTouches[0].pageX - maClient.map.touchStartX;var deltaY = event.targetTouches[0].pageY - maClient.map.touchStartY;maClient.map.touchStartX = event.targetTouches[0].pageX;maClient.map.touchStartY = event.targetTouches[0].pageY;if (maTour.disableSmoothPanning) { maClient.map.touchDeltaX += deltaX;maClient.map.touchDeltaY += deltaY;} else { maClient.map.touchDeltaX = deltaX;maClient.map.touchDeltaY = deltaY;maClient.map.handlePanEvent();} };maClient.Html5.prototype.onTouchEnd = function(event) { maClient.map.gestureStarted = event.touches.length === 0 ? false : true;if (maTour.disableSmoothPanning) { maClient.map.handlePanEvent();} };maClient.Html5.prototype.onTouchCancel = function(event) { };maClient.Html5.prototype.changeMarkerShapeAppearance = function(viewIdList, selected, lineColor, lineAlpha, fillColor, fillAlpha, effects) { var markers = this.createMarkerArrayFromMarkerIdList(viewIdList);var fillColorCss = this.convertIntegerColorToCss(fillColor);var lineColorCss = this.convertIntegerColorToCss(lineColor);for (index in this.markerInstances) { markerInstance = this.markerInstances[index];var redraw = false;for (var i in markers) { var m = markers[i];if (m.viewId == markerInstance.viewId) { var markerStyle;if (m.customMarkerStyle === null) { markerStyle = m.markerStyle().cloneMarkerStyle();m.customMarkerStyle = markerStyle;} else { markerStyle = m.customMarkerStyle;} if (selected) { markerStyle.selectedFillColor = fillColorCss;markerStyle.selectedFillColorOpacity = fillAlpha;markerStyle.selectedLineColor = lineColorCss;markerStyle.selectedLineColorOpacity = lineAlpha;markerStyle.selectedShapeEffects = effects;} else { markerStyle.normalFillColor = fillColorCss;markerStyle.normalFillColorOpacity = fillAlpha;markerStyle.normalLineColor = lineColorCss;markerStyle.normalLineColorOpacity = lineAlpha;markerStyle.normalShapeEffects = effects;} redraw = true;break;} } if (redraw) { var drawSelected = (markerInstance.viewId == this.selectedViewId && !markerInstance.isStatic) || markerInstance.appearsSelected;this.redrawMarker(markerInstance, drawSelected);} } };maClient.Html5.prototype.convertHexColorToRgb = function(hex) { var r = 0;var g = 0;var b = 0;if (hex.length == 8) { if (hex.substr(0, 2) == "0x") { r = parseInt(hex.substr(2, 2), 16);if (isNaN(r)) r = 0;g = parseInt(hex.substr(4, 2), 16);if (isNaN(g)) g = 0;b = parseInt(hex.substr(6, 2), 16);if (isNaN(b)) b = 0;} } var color = new Object();color.r = r;color.g = g;color.b = b;return color;};maClient.Html5.prototype.convertIntegerColorToHex = function(integerColor) { if ((integerColor + "  ").substr(0, 2).toLowerCase() == "0x") { return integerColor;} integerColor = parseInt(integerColor, 10);var hex = integerColor.toString(16);var pad = "00000";if (hex.length < 6) { hex = pad.substring(0, 6 - hex.length) + hex;} return "0x" + hex;};maClient.Html5.prototype.convertIntegerColorToCss = function(integerColor) { if ((integerColor + " ").substr(0, 1) == "#") { return integerColor;} var hex = this.convertIntegerColorToHex(integerColor);return "#" + hex.substr(2);};maClient.Html5.prototype.createMarkerArrayFromMarkerIdList = function(markerIdList) { markerIdList = markerIdList + "";var markers = new Array();if (markerIdList.length > 0) { var markerInstance;var index;if (markerIdList == "*") { for (index in this.markerInstances) { markerInstance = markerInstances[index];markers.push(markerInstance);} } else { var list = markerIdList.split(",");for (index in list) { markerInstance = this.markerInstance(list[index]);if (markerInstance !== null) { markers.push(markerInstance);} } } } return markers;};maClient.Html5.prototype.createMarkerInstances = function() { this.waitForMarkerImagesAttempts = 0;this.markerInstances = new Array(maTour.markerInstanceTable.length);for (var index = 0; index < maTour.markerInstanceTable.length; index++) { var data = maTour.markerInstanceTable[index].split(',');var viewId = data[0];var markerType = parseInt(data[1], 10);var markerStyleId = parseInt(data[2], 10);var normalSymbolId = parseInt(data[3], 10);var selectedSymbolId = parseInt(data[4], 10);var pctX = parseFloat(data[5]);var pctY = parseFloat(data[6]);var shapeType = parseInt(data[7], 10);var shapeW = parseInt(data[8], 10);var shapeH = parseInt(data[9], 10);var normalSymbolW = parseInt(data[10], 10);var normalSymbolH = parseInt(data[11], 10);var selectedSymbolW = parseInt(data[12], 10);var selectedSymbolH = parseInt(data[13], 10);var symbolLocationX = parseInt(data[14], 10);var symbolLocationY = parseInt(data[15], 10);var anchorX = parseInt(data[16], 10);var anchorY = parseInt(data[17], 10);var rotation = parseInt(data[18], 10);var zoomThreshold = parseInt(data[19], 10);var flags = parseInt(data[20], 10);var tooltip = maClient.lookupString(data[21]);var clickAction = parseInt(data[22], 10);var clickActionTarget = maClient.lookupString(data[23]);var mouseoverAction = parseInt(data[24], 10);var mouseoverActionTarget = maClient.lookupString(data[25]);var mouseoutAction = parseInt(data[26], 10);var mouseoutActionTarget = maClient.lookupString(data[27]);var touchPerformsClickAction = parseInt(data[28], 10);var showContentEvent = parseInt(data[29], 10);var shapeCoords = maClient.lookupString(data[30]);var x = Math.round(this.mapWidth * pctX);var y = Math.round(this.mapHeight * pctY);var markerInstance = new maMarkerInstance( this, viewId, markerType, markerStyleId, normalSymbolId, selectedSymbolId, pctX, pctY, x, y, shapeType, shapeW, shapeH, normalSymbolW, normalSymbolH, selectedSymbolW, selectedSymbolH, symbolLocationX, symbolLocationY, anchorX, anchorY, rotation, zoomThreshold, flags, tooltip, clickAction, clickActionTarget, mouseoverAction, mouseoverActionTarget, mouseoutAction, mouseoutActionTarget, touchPerformsClickAction, showContentEvent, shapeCoords);this.markerInstances[index] = markerInstance;var markerStyle = markerInstance.markerStyle();if (markerStyle !== null) { this.getEffects(markerInstance, markerStyle.normalShapeEffects, null, false);this.getEffects(markerInstance, markerStyle.selectedShapeEffects, null, true);} } };maClient.Html5.prototype.blinkMarker = function(viewId) { var markerInstance = this.markerInstance(viewId);var pulsesPerCycle = 5;var cycle = markerInstance.blinkCount % pulsesPerCycle;if (cycle === 0) { markerInstance.blinkDirection *= -1;if (markerInstance.blinkDirection == -1 && markerInstance.blinkCount / (pulsesPerCycle * 2) >= markerInstance.blinkLimit - 1) { markerInstance.setBlink(0);return;} } if (markerInstance.blinkDirection == -1) cycle = pulsesPerCycle - cycle - 1;var alpha;if (cycle === 0) alpha = 10;else if (cycle == 1) alpha = 20;else if (cycle == 2) alpha = 80;else alpha = 100;markerInstance.setBlinkAlpha(alpha / 100);markerInstance.blinkCount++;};maClient.Html5.prototype.createMarkerStyles = function() { this.markerStyles = new Object();for (index = 0; index < maTour.markerStyleTable.length; index++) { var data = maTour.markerStyleTable[index].split(',');var id = parseInt(data[0], 10);var lineWidth = parseInt(data[1], 10);var normalFillColor = data[2];var normalLineColor = data[3];var selectedFillColor = data[4];var selectedLineColor = data[5];var normalFillColorOpacity = parseInt(data[6], 10);var normalLineColorOpacity = parseInt(data[7], 10);var selectedFillColorOpacity = parseInt(data[8], 10);var selectedLineColorOpacity = parseInt(data[9], 10);var normalShapeEffects = maClient.convertEffects(maClient.lookupString(data[10]));var selectedShapeEffects = maClient.convertEffects(maClient.lookupString(data[11]));var markerStyle = new maMarkerStyle( id, lineWidth, normalFillColor, normalLineColor, selectedFillColor, selectedLineColor, normalFillColorOpacity, normalLineColorOpacity, selectedFillColorOpacity, selectedLineColorOpacity, normalShapeEffects, selectedShapeEffects);this.markerStyles[id] = markerStyle;} };maClient.Html5.prototype.createRgbaFromHexColor = function(hexColor, alpha) { var c = this.convertHexColorToRgb(hexColor);return "rgba(" + c.r + "," + c.g + "," + c.b + "," + alpha + ")";};maClient.Html5.prototype.createRgbaFromIntegerColor = function(integerColor, alpha) { var hexColor = this.convertIntegerColorToHex(integerColor);return this.createRgbaFromHexColor(hexColor, alpha);};maClient.Html5.prototype.deselectMarker = function() { if (this.selectedViewId === 0) return;var markerInstance = this.markerInstance(this.selectedViewId);if (markerInstance === null) { return;} markerInstance.setBlink(0);markerInstance.visited = true;var js = markerInstance.mouseoutAction == maActionCallJavascript ? markerInstance.mouseoutActionTarget : "";if (js.length > 0) { maClient.flashExecuteJavaScript(js);} markerInstance.appearsSelected = false;this.redrawMarker(markerInstance, false);this.selectedViewId = 0;};maClient.Html5.prototype.drawAllMarkers = function() { var viewId;var markerInstance;if (!this.allMarkerImagesLoaded && this.waitForMarkerImagesAttempts < 100) { this.waitForMarkerImagesAttempts++;for (index in this.markerInstances) { markerInstance = this.markerInstances[index];var loadedN = !markerInstance.hasImageN || markerInstance.imgLoadedN;var loadedS = !markerInstance.hasImageS || markerInstance.imgLoadedS;if (!loadedN || !loadedS) { setTimeout("maClient.map.drawAllMarkers();", 50);return;} } this.allMarkerImagesLoaded = true;} this.markerLayerContext.clearRect(0, 0, this.viewPort.w, this.viewPort.h);for (index in this.markerInstances) { markerInstance = this.markerInstances[index];markerInstance.computeMarkerLocationValues();this.drawMarker(markerInstance, markerInstance.viewId == this.selectedViewId);} };maClient.Html5.prototype.drawCircle = function(markerInstance, x, y, radius, ctx, fillAlpha, lineAlpha) { ctx.beginPath();ctx.arc(x, y, radius, 0, Math.PI * 2, true);ctx.closePath();this.markerLayerContext.globalAlpha = fillAlpha;ctx.fill();this.markerLayerContext.globalAlpha = lineAlpha;ctx.stroke();};maClient.Html5.prototype.drawHybridShape = function(markerInstance, ctx, fillAlpha, lineAlpha, lineWidth) { var coord = markerInstance.shapeCoords.split(",");var i = 0;while (i < coord.length) { if (coord[i] == "-1") { var shapeType = coord[i + 1];var isCircle = shapeType == "1";var isRectangle = shapeType == "2";var isPolygon = shapeType == "3";var isLine = shapeType == "4";var drawFill = isRectangle || isCircle || isPolygon;i += 2;if (isCircle) { var x = parseInt(coord[i], 10);var y = parseInt(coord[i + 1], 10);var r = parseInt(coord[i + 2], 10);if (i + 3 >= coord.length || coord[i + 3] == "-1") { if (coord.length > 5) { var offset = lineWidth / 2;x += r + offset;y += r + offset;} i += 3;} else { i += 4;} x += markerInstance.offsetX();y += markerInstance.offsetY();this.drawCircle(markerInstance, x, y, r, ctx, fillAlpha, lineAlpha);} else if (isRectangle) { var x1 = parseInt(coord[i], 10);var y1 = parseInt(coord[i + 1], 10);var x2 = parseInt(coord[i + 2], 10) + 1;var y2 = parseInt(coord[i + 3], 10) + 1;if (lineWidth % 2 == 1) { x2++;y2++;} i += 4;var w = x2 - x1;var h = y2 - y1;x = markerInstance.offsetX() + x1;y = markerInstance.offsetY() + y1;this.drawRectangle(markerInstance, x, y, w, h, ctx, fillAlpha, lineAlpha);} else if (isPolygon || isLine) { var length = this.drawPoints(markerInstance, i, ctx, fillAlpha, lineAlpha, isPolygon);i += length;} } else { return;} } };maClient.Html5.prototype.drawLoadingMessage = function(msg) { if (msg == this.loadingMessage) { return;} this.loadingMessage = msg;this.statusLayerContext.clearRect(0, 0, this.viewPort.w, this.viewPort.h);if (msg === null) { msg = "Loading " + maTour.pageName;} if (msg.length === 0) { return;} var pts = 16;this.statusLayerContext.font = pts + "px sans-serif";this.statusLayerContext.fillStyle = "#cccccc";var textWidth = this.statusLayerContext.measureText(msg).width;var msgX = Math.round((this.viewPort.w / 2) - (textWidth / 2));var msgY = 100;this.statusLayerContext.fillText(msg, msgX, msgY);};maClient.Html5.prototype.drawMap = function() { var mapLevel = this.mapLevels[this.mapIsZoomed() ? 1 : 0];var w = 256;var h = 256;for (var row = 1; row <= mapLevel.lastRow; row++) { for (var column = 1; column <= mapLevel.lastColumn; column++) { index = (((row - 1) * mapLevel.lastColumn) + column) - 1;tile = mapLevel.tiles[index];var x = w * (column - 1);var y = h * (row - 1);x -= this.viewPort.x1;y -= this.viewPort.y1;if (x + w < 0 || x > this.viewPort.w || y + h < 0 || y > this.viewPort.h) { continue;} this.mapLayerContext.drawImage(tile.image, x, y);} } if (this.mapIsZoomed()) { this.drawMapInset();} this.drawAllMarkers();this.showZoomControls();this.drawLoadingMessage("");};maClient.Html5.prototype.drawMapInset = function() { if (maTour.mapInsetLocation === 0) return;var x;var y;var NAV_BORDER_WIDTH = 2;var longDimension = maTour.mapWidth > maTour.mapHeight ? maTour.mapWidth : maTour.mapHeight;var mapInsetScale = maTour.mapInsetSize / longDimension;var mapInsetW = Math.round(maTour.mapWidth * mapInsetScale);var mapInsetH = Math.round(maTour.mapHeight * mapInsetScale);switch (maTour.mapInsetLocation) { case 2: x = this.viewPort.w - (mapInsetW + (NAV_BORDER_WIDTH * 2));y = 4;break;case 3: x = this.viewPort.w - (mapInsetW + (NAV_BORDER_WIDTH * 2));y = this.viewPort.h - (mapInsetH + (NAV_BORDER_WIDTH * 2));break;case 4: x = 4;y = this.viewPort.h - (mapInsetH + (NAV_BORDER_WIDTH * 2));break;default: break;} this.mapLayerContext.save();this.mapLayerContext.drawImage(this.mapInsetImage, x, y);this.mapLayerContext.lineWidth = 1.0;this.mapLayerContext.strokeStyle = "#777777";this.mapLayerContext.strokeRect(x - 0.5, y - 0.5, mapInsetW, mapInsetH);this.mapLayerContext.restore();x += Math.round(-this.mapPanX * mapInsetScale) + 2;y += Math.round(-this.mapPanY * mapInsetScale) + 2;var zoomRegionW = Math.round(this.viewPort.w * mapInsetScale) - 4;var zoomRegionH = Math.round(this.viewPort.h * mapInsetScale) - 4;this.mapLayerContext.save();this.mapLayerContext.lineWidth = 1.0;this.mapLayerContext.globalAlpha = 0.50;this.mapLayerContext.fillStyle = maTour.mapInsetColor;this.mapLayerContext.fillRect(x, y, zoomRegionW, zoomRegionH);this.mapLayerContext.globalAlpha = 1.0;this.mapLayerContext.strokeStyle = "#777777";this.mapLayerContext.strokeRect(x - 0.5, y - 0.5, zoomRegionW, zoomRegionH);this.mapLayerContext.restore();};maClient.Html5.prototype.drawMarker = function(markerInstance, selected) { if (!markerInstance.isVisibleAtCurrentZoomLevel) { return;} if (markerInstance.isRoute && markerInstance.routeDefinition === null) { return;} var x = markerInstance.cornerX;var y = markerInstance.cornerY;var w = markerInstance.drawnMaxWidth;var h = markerInstance.drawnMaxHeight;if (x + w < 0 || x > this.viewPort.w || y + h < 0 || y > this.viewPort.h) { return;} if (markerInstance.isStatic) { selected = false;} if (markerInstance.appearsSelected) { selected = true;} if (markerInstance.markerType != maMarkerType_Symbol) { this.drawMarkerShape(markerInstance, this.markerLayerContext, selected);} if (markerInstance.markerType != maMarkerType_Shape) { this.drawMarkerSymbol(markerInstance, this.markerLayerContext, selected);} };maClient.Html5.prototype.drawMarkerShape = function(markerInstance, ctx, selected) { this.setDrawingSurface(markerInstance);var markerStyle = markerInstance.customMarkerStyle;if (markerStyle === null) { markerStyle = markerInstance.markerStyle();} var fillAlpha = 1.0;var lineAlpha = 1.0;var lineWidth = markerInstance.lineWidth();ctx.lineWidth = lineWidth;var enlargeHitTestArea = ctx == this.hitLayerContext && (this.hitTestPaddingW > 0 || this.hitTestPaddingH > 0);var x = markerInstance.offsetX();var y = markerInstance.offsetY();x -= markerInstance.anchorX;y -= markerInstance.anchorY;if (this.debugDrawing && ctx === null) { ctx = this.markerLayerContext;ctx.fillStyle = "cyan";fillAlpha = 0.1;ctx.strokeStyle = "yellow";lineAlpha = 1.1;} else if (ctx != this.hitLayerContext) { this.markerLayerContext.fillStyle = selected ? markerStyle.selectedFillColor : markerStyle.normalFillColor;this.markerLayerContext.strokeStyle = selected ? markerStyle.selectedLineColor : markerStyle.normalLineColor;fillAlpha = (selected ? markerStyle.selectedFillColorOpacity : markerStyle.normalFillColorOpacity) / 100;lineAlpha = (selected ? markerStyle.selectedLineColorOpacity : markerStyle.normalLineColorOpacity) / 100;if (fillAlpha === 0.0 && lineAlpha === 0.0 && markerInstance.markerType != maMarkerType_Symbol && markerInstance.markerType != maMarkerType_SymbolAndShape) { this.restoreDrawingSurface();return;} if (lineWidth === 0) { lineAlpha = fillAlpha;this.markerLayerContext.strokeStyle = selected ? markerStyle.selectedFillColor : markerStyle.normalFillColor;} var effects = selected ? markerStyle.selectedShapeEffects : markerStyle.normalShapeEffects;this.getEffects(markerInstance, effects, ctx, selected);if (markerInstance.blinkAlpha < 1.0) { fillAlpha *= markerInstance.blinkAlpha;lineAlpha *= markerInstance.blinkAlpha;} else if (markerInstance.visited && this.visitedMarkerAlpha < 1.0) { fillAlpha *= this.visitedMarkerAlpha;lineAlpha *= this.visitedMarkerAlpha;} this.markerLayerContext.globalAlpha = fillAlpha;} if (markerInstance.shapeType == maShapeType_Circle) { var radius = Math.round(markerInstance.shapeW / 2);if (enlargeHitTestArea) { radius = (markerInstance.shapeW + this.hitTestPaddingW) / 2;x -= this.hitTestPaddingW / 2;y -= this.hitTestPaddingH / 2;} this.drawCircle(markerInstance, x + radius, y + radius, radius, ctx, fillAlpha, lineAlpha);} else if (markerInstance.shapeType == maShapeType_Polygon || markerInstance.shapeType == maShapeType_Line) { this.markerLayerContext.lineJoin = "bevel";this.drawPoints(markerInstance, 0, ctx, fillAlpha, lineAlpha, markerInstance.shapeType == maShapeType_Polygon);} else if (markerInstance.shapeType == maShapeType_Hybrid) { this.markerLayerContext.lineJoin = "bevel";this.drawHybridShape(markerInstance, ctx, fillAlpha, lineAlpha, lineWidth);} else if (markerInstance.shapeType == maShapeType_Rectangle || (markerInstance.markerType == maMarkerType_Symbol && ctx == this.hitLayerContext)) { var w = markerInstance.shapeW;var h = markerInstance.shapeH;if (enlargeHitTestArea) { w += this.hitTestPaddingW;h += this.hitTestPaddingH;x -= this.hitTestPaddingW / 2;y -= this.hitTestPaddingH / 2;} this.drawRectangle(markerInstance, x, y, w, h, ctx, fillAlpha, lineAlpha);} this.restoreDrawingSurface();if (ctx != this.hitLayerContext) { markerInstance.blendOnto();} };maClient.Html5.prototype.drawMarkerSymbol = function(markerInstance, ctx, selected) { var hasImage = selected ? markerInstance.hasImageS : markerInstance.hasImageN;if (!hasImage) return;this.setDrawingSurface(markerInstance);var img;var loaded;if (selected) { img = markerInstance.imgS;loaded = markerInstance.imgLoadedS;} else { img = markerInstance.imgN;loaded = markerInstance.imgLoadedN;} if (loaded) { var x;var y;var symbolW = selected ? markerInstance.selectedSymbolW : markerInstance.normalSymbolW;var symbolH = selected ? markerInstance.selectedSymbolH : markerInstance.normalSymbolH;if (markerInstance.markerType == maMarkerType_SymbolAndShape) { var symbolLocationX = markerInstance.symbolLocationX;var symbolLocationY = markerInstance.symbolLocationY;x = -Math.round(symbolW / 2);y = -Math.round(symbolH / 2);if (symbolLocationX >= 0 || symbolLocationY >= 0) { x = markerInstance.offsetX() + x + symbolLocationX;y = markerInstance.offsetY() + y + symbolLocationY;} } else if (markerInstance.markerType == maMarkerType_Symbol) { x = -Math.round(symbolW / 2);y = -Math.round(symbolH / 2);} else { x = markerInstance.offsetX();y = markerInstance.offsetY();var lineWidth = markerInstance.lineWidth();if (lineWidth > 1) { lineWidth = Math.round((lineWidth - 1) / 2);x += lineWidth;y += lineWidth;} } x -= markerInstance.anchorX;y -= markerInstance.anchorY;var globalAlpha = 1.0;if (markerInstance.blinkAlpha < 1.0) { globalAlpha = markerInstance.blinkAlpha;} else if (markerInstance.visited && this.visitedMarkerAlpha < 1.0) { globalAlpha = this.visitedMarkerAlpha;} ctx.globalAlpha = globalAlpha;ctx.drawImage(img, x, y);} this.restoreDrawingSurface();};maClient.Html5.prototype.drawPoints = function(markerInstance, index, ctx, fillAlpha, lineAlpha, isPolygon) { var x;var y;x = -(markerInstance.shapeW / 2);y = -(markerInstance.shapeH / 2);var length = 0;var coords = markerInstance.shapeCoords.split(",");ctx.beginPath();for (var i = index; i < coords.length; i += 2) { var cx = parseInt(coords[i], 10);var cy = parseInt(coords[i + 1], 10);if (cx == -1) { break;} length += 2;cx += x;cy += y;if (i === 0) { ctx.moveTo(cx, cy);} else { ctx.lineTo(cx, cy);} } if (isPolygon) { ctx.globalAlpha = fillAlpha;ctx.closePath();ctx.fill();} ctx.globalAlpha = lineAlpha;ctx.stroke();return length;};maClient.Html5.prototype.drawRectangle = function(markerInstance, x, y, w, h, ctx, fillAlpha, lineAlpha) { this.markerLayerContext.globalAlpha = fillAlpha;ctx.fillRect(x, y, w, h);this.markerLayerContext.globalAlpha = lineAlpha;ctx.strokeRect(x, y, w, h);};maClient.Html5.prototype.drawRouteThroughMarkers = function(viewId, lineWidth, lineColor, lineAlpha, markerIdList, effects) { var lineColorCss = this.convertIntegerColorToCss(lineColor);var markerInstance = this.markerInstance(viewId);if (markerInstance === null) return false;if (markerInstance.routeDefinition !== null) { markerInstance.customMarkerStyle.normalLineColorOpacity = 0;this.redrawMarker(markerInstance, false);} markerInstance.routeDefinition = new maRouteDefinition(markerInstance, markerIdList);markerInstance.customMarkerStyle = new maMarkerStyle( 0, lineWidth, "#000000", lineColorCss, "#000000", lineColorCss, 0, lineAlpha, 0, lineAlpha, effects, effects);markerInstance.computeMarkerLocationValues();this.redrawMarker(markerInstance, false);return true;};maClient.Html5.prototype.executeClickAction = function(markerInstance) { var clickActionTarget = markerInstance.clickActionTarget;if (markerInstance.clickActionTarget.length > 0) { if (markerInstance.clickAction == maActionLinkToUrl || markerInstance.clickAction == maActionLinkToUrlNewWindow) { clickActionTarget = (markerInstance.clickAction == maActionLinkToUrl ? "0" : "1") + clickActionTarget;maClient.flashLinkToUrl(clickActionTarget);} else if (markerInstance.clickAction == maActionGotoPage) { maClient.flashGoToPage(clickActionTarget);} else if (markerInstance.clickAction == maActionCallJavascript) { maClient.flashExecuteJavaScript(clickActionTarget);} } };maClient.Html5.prototype.getBoundingArea = function(markerInstance) { var bounds = new Object();var n = markerInstance.paddingNormal;var s = markerInstance.paddingSelected;var maxW = Math.max(n.w, s.w);var maxH = Math.max(n.h, s.h);if (markerInstance.markerType != maMarkerType_Symbol) { var lineWidth = markerInstance.lineWidth();if (lineWidth > 0) { lineWidth *= 2;maxW = Math.max(maxW, lineWidth);maxH = Math.max(maxH, lineWidth);} } if (markerInstance.markerType == maMarkerType_SymbolAndShape && (markerInstance.symbolLocationX >= 0 || markerInstance.symbolLocationY >= 0)) { maxW += markerInstance.shapeW;maxH += markerInstance.shapeH;} bounds.w = markerInstance.maxWidth + maxW;bounds.h = markerInstance.maxHeight + maxH;if (markerInstance.markerZooms) { bounds.w = Math.round(bounds.w * this.currentMapScale);bounds.h = Math.round(bounds.h * this.currentMapScale);} bounds.x = markerInstance.x;bounds.y = markerInstance.y;if (!markerInstance.isNotAnchored) { bounds.x = Math.round(bounds.x * this.currentMapScale);bounds.y = Math.round(bounds.y * this.currentMapScale);} bounds.x -= Math.round(bounds.w / 2);bounds.y -= Math.round(bounds.h / 2);bounds.x -= markerInstance.anchorScaledX();bounds.y -= markerInstance.anchorScaledY();bounds.x -= this.viewPort.x1;bounds.y -= this.viewPort.y1;return bounds;};maClient.Html5.prototype.getEffectOptions = function(values, index) { var options = new Array();while (index < values.length) { var value = values[index];if (value == "-1") break;options.push(value);index++;} return options;};maClient.Html5.prototype.getEffects = function(markerInstance, effects, ctx, selected) { if (effects.length === 0) { return;} var filters = new Array();var options;var values = effects.split(",");var i = 0;while (i < values.length) { if (values[i] == "-1") { var effectType = values[i + 1];effectType = effectType.split(" ")[0];var isBlend = effectType == "1";var isInnerGlow = effectType == "2";var isOuterGlow = effectType == "3";var isDropShadow = effectType == "4";var blur;var colorRgba;var alpha;i += 2;if (isBlend) { options = this.getEffectOptions(values, i);i += options.length;markerInstance.blendMode = this.getValidBlendMode(this.getOptionText(options, 0, "multiply"));} else if (isInnerGlow || isOuterGlow) { options = this.getEffectOptions(values, i);i += options.length;alpha = this.getOptionAlpha(options, 1, 50);var markerStyle = markerInstance.markerStyle();if (markerStyle === null) markerStyle = markerInstance.customerMarkerStyle;var defaultGlowColor = selected ? markerStyle.selectedLineColor : markerStyle.normalLineColor;defaultGlowColor = "0x" + defaultGlowColor.substr(1);colorRgba = this.getOptionColor(options, 0, defaultGlowColor, alpha);blur = this.getOptionBlur(options, 2, 10);if (ctx !== null) { ctx.shadowBlur = blur;ctx.shadowColor = colorRgba;} blur += 8;var deltaXandY = Math.round(blur / 2) * -1;this.setMarkerClipBounds(markerInstance, selected, deltaXandY, deltaXandY, blur, blur);} else if (isDropShadow) { options = this.getEffectOptions(values, i);i += options.length;var distance = this.getOptionNumber(options, 0, 4);distance *= 2;var angle = this.getOptionNumber(options, 1, 45);alpha = this.getOptionAlpha(options, 3, 40);colorRgba = this.getOptionColor(options, 2, "0x000000", alpha);blur = this.getOptionBlur(options, 4, 10);var dh;var dv;if (angle < 0 || angle > 359) angle = 0;if (angle <= 90) { dh = (90 - angle) / 90;dv = angle / 90;} else if (angle <= 180) { angle -= 90;dh = (angle / 90) * -1;dv = (90 - angle) / 90;} else if (angle <= 270) { angle -= 180;dh = ((90 - angle) / 90) * -1;dv = (angle / 90) * -1;} else { angle -= 270;dh = angle / 90;dv = ((90 - angle) / 90) * -1;} dh = Math.round(dh * distance);dv = Math.round(dv * distance);if (ctx !== null) { ctx.shadowOffsetX = dh;ctx.shadowOffsetY = dv;ctx.shadowBlur = blur;ctx.shadowColor = colorRgba;} dh += dh < 0 ? -blur : blur;dv += dv < 0 ? -blur : blur;if (markerInstance.shapeType == maShapeType_Polygon || markerInstance.shapeType == maShapeType_Line || markerInstance.shapeType == maShapeType_Hybrid) { var extra = (1 / this.mapScale) - 1;extra *= 25;if (extra > 200) extra = 200;else if (extra < 20) extra = 20;dh += extra;dv += extra;} this.setMarkerClipBounds(markerInstance, selected, dh < 0 ? dh : 0, dv < 0 ? dv : 0, Math.abs(dh), Math.abs(dv));} } else { return;} } };maClient.Html5.prototype.getMarkerUnderMouse = function() { var count = this.markerInstances.length;for (var index = count - 1; index >= 0; index--) { var viewIdUnderMouse = 0;var markerInstance = this.markerInstances[index];if (!markerInstance.isVisibleAtCurrentZoomLevel) continue;var x = markerInstance.cornerX;var y = markerInstance.cornerY;var w = markerInstance.drawnMaxWidth;var h = markerInstance.drawnMaxHeight;if (maTour.enlargeHitTestArea && maClient.isTouchDevice) { var minTargetSize = 44;if (w < minTargetSize || h < minTargetSize) { if (w < minTargetSize) { this.hitTestPaddingW = minTargetSize - w;} if (h < minTargetSize) { this.hitTestPaddingH = minTargetSize - h;} w += this.hitTestPaddingW;h += this.hitTestPaddingH;x -= this.hitTestPaddingW / 2;y -= this.hitTestPaddingH / 2;} } var mouseIsInsideMarkerBounds = false;if (this.mouseX >= x && this.mouseX < x + w && this.mouseY >= y && this.mouseY < y + h) { mouseIsInsideMarkerBounds = true;if (this.debugDrawing || this.debugShowTouch) { this.markerLayerContext.save();this.markerLayerContext.strokeStyle = "red";this.markerLayerContext.strokeRect(x - 0.5, y - 0.5, w, h);this.markerLayerContext.restore();} } if (mouseIsInsideMarkerBounds) { var ctx = this.hitLayerContext;ctx.clearRect(0, 0, this.viewPort.w, this.viewPort.h);this.drawMarkerShape(markerInstance, ctx, false);if (this.debugDrawing) { this.drawMarkerShape(markerInstance, null, false);} var imageData;try { imageData = ctx.getImageData(this.mouseX, this.mouseY, 1, 1);} catch (error) { return 0;} if (imageData.data[3] > 0) { viewIdUnderMouse = markerInstance.viewId;} } this.hitTestPaddingW = 0;this.hitTestPaddingH = 0;if (viewIdUnderMouse !== 0) { return viewIdUnderMouse;} } return 0;};maClient.Html5.prototype.getMouseLocation = function() { var x;var y;if (maClient.isTouchDevice) { if (maTour.selectsOnTouchStart) { x = event.touches[0].pageX;y = event.touches[0].pageY;} else { x = this.touchStartX;y = this.touchStartY;} } else { x = maClient.mouseX;y = maClient.mouseY;} x -= this.mapLocationInBrowser.x;y -= this.mapLocationInBrowser.y;if (x < 0 || y < 0 || x >= this.viewPort.w || y >= this.viewPort.h) { return false;} else { if (this.debugHitTesting || this.debugShowTouch) { this.markerLayerContext.fillStyle = "#ff0000";this.markerLayerContext.fillRect(x - 2, y - 2, 4, 4);} this.mouseX = Math.round(x);this.mouseY = Math.round(y);return true;} };maClient.Html5.prototype.getOptionAlpha = function(options, index, defaultValue) { var alpha = this.getOptionNumber(options, index, defaultValue);if (alpha < 0) alpha = 0;if (alpha > 100) alpha = 100;alpha = Math.min(100, Math.round(alpha * 1.3));alpha /= 100;return alpha;};maClient.Html5.prototype.getOptionBlur = function(options, index, defaultValue) { var blurX = this.getOptionNumber(options, index, defaultValue);var blurY = this.getOptionNumber(options, index + 1, defaultValue);var blur = Math.round((blurX + blurY) / 2);return blur;};maClient.Html5.prototype.getOptionColor = function(options, index, defaultValue, alpha) { var rawColor = this.getOptionText(options, index, defaultValue);var hexColor = this.convertIntegerColorToHex(rawColor);return this.createRgbaFromHexColor(hexColor, alpha);};maClient.Html5.prototype.getOptionNumber = function(options, index, defaultValue) { var n = parseInt(this.getOptionText(options, index, defaultValue), 10);if (isNaN(n)) n = defaultValue;return n;};maClient.Html5.prototype.getOptionText = function(options, index, defaultValue) { return options.length > index ? options[index] : defaultValue;};maClient.Html5.prototype.getValidBlendMode = function(mode) { mode = mode.toLowerCase();if (mode == "darken" || mode == "difference" || mode == "hardlight" || mode == "invert" || mode == "lighten" || mode == "multiply" || mode == "normal" || mode == "overlay" || mode == "screen") return mode;else return "multiply";};maClient.Html5.prototype.handlePanEvent = function() { if (this.touchDeltaX !== 0 || this.touchDeltaY !== 0) { this.setMapPan(this.touchDeltaX, this.touchDeltaY);this.startTouchDelay();} };maClient.Html5.prototype.initEventHandlers = function() { var handler;if (maClient.isTouchDevice) { if (maTour.selectsOnTouchStart) { handler = 'touchstart';} else { handler = 'touchend';} this.markerLayer.addEventListener("touchstart", maClient.map.onTouchStart, false);this.markerLayer.addEventListener("touchend", maClient.map.onTouchEnd, false);this.markerLayer.addEventListener("touchcancel", maClient.map.onTouchCancel, false);if (this.mapCanZoom) { this.markerLayer.addEventListener("touchmove", maClient.map.onTouchMove, false);this.markerLayer.addEventListener("gesturechange", maClient.map.onGestureChange, false);this.markerLayer.addEventListener("gesturestart", maClient.map.onGestureStart, false);this.markerLayer.addEventListener("gestureend", maClient.map.onGestureEnd, false);} } else { handler = 'mousemove';this.markerLayer.addEventListener('click', maClient.map.onClick, false);window.addEventListener('resize', maClient.map.onResize, false);this.markerLayer.addEventListener("mousedown", maClient.map.onMouseDown, false);this.markerLayer.addEventListener("mouseup", maClient.map.onMouseUp, false);this.markerLayer.addEventListener("mouseout", maClient.map.onMouseUp, false);} this.markerLayer.addEventListener(handler, maClient.map.onTouch, false);};maClient.Html5.prototype.hideInstructions = function() { document.getElementById('maInstructions').style.visibility = 'hidden';document.getElementById('maInstructionsCloseX').style.visibility = 'hidden';localStorage[this.localStorageId + "userClosedHelpWindow"] = "1";var currentTime = (new Date()).getTime();localStorage[this.localStorageId + "timeLastShown"] = currentTime;};maClient.Html5.prototype.loadMap = function() { this.selectOnClick = false;this.mapIsSvg = false;this.debugClipping = false;this.debugDrawing = false;this.debugHitTesting = false;this.debugShowTouch = maGetQueryStringArg("showtouch") == "1";this.selectedViewId = 0;this.hitTestPaddingW = 0;this.hitTestPaddingH = 0;this.ignoreTouch = false;this.mapPanX = parseInt(maTour.mapPanX, 10);this.mapPanY = parseInt(maTour.mapPanY, 10);this.savedMapPanX = 0;this.savedMapPanY = 0;this.touchStartX = -1;this.touchStartY = -1;this.touchDeltaX = 0;this.touchDeltaY = 0;this.clipBounds = null;this.mouseX = 0;this.mouseY = 0;this.popupIsShowing = false;this.blinkCycle = 0;this.visitedMarkerAlpha = parseInt(maTour.visitedMarkerAlpha, 10) / 100;this.slideShowRunning = false;this.nextSlideShowIndex = 0;this.loadingMessage = "";this.dragging = false;this.localStorageId = "tour" + (maClient.preview ? "_." : ".");this.viewPort = new Object();this.viewPort.w = maTour.stageW;this.viewPort.h = maTour.stageH;this.setViewPortPosition();this.mapWidth = maTour.mapWidth;this.mapHeight = maTour.mapHeight;this.mapScale = parseFloat(maTour.mapAreaScale);this.mapWidthScaled = Math.round(this.mapWidth * this.mapScale);this.mapHeightScaled = Math.round(this.mapHeight * this.mapScale);this.mapInsetImageLoaded = true;this.mapZoomDelta = 0;this.minMaxZoom = 1.0;this.maxMapZoom = this.mapWidthScaled >= this.viewPort.w ? this.mapWidth / this.viewPort.w : this.mapHeight / this.viewPort.h;this.showZoomControl = maTour.mapShowZoomControl && (!maClient.iOS || maTour.showZoomControlOnIOs);this.statusLayer = document.getElementById("maStatusLayer");this.statusLayerContext = this.statusLayer.getContext('2d');this.drawLoadingMessage(null);this.mapLayer = document.getElementById("maMapLayer");this.mapLayerContext = this.mapLayer.getContext('2d');this.mapLayer.width = this.viewPort.w;this.mapLayer.height = this.viewPort.h;this.mapLayer.style.backgroundColor = "transparent";this.markerLayer = document.getElementById("maMarkerLayer");this.markerLayerContext = this.markerLayer.getContext("2d");this.markerLayer.width = this.viewPort.w;this.markerLayer.height = this.viewPort.h;this.markerLayer.style.backgroundColor = "transparent";this.hitLayer = document.createElement('canvas');this.hitLayerContext = this.hitLayer.getContext('2d');this.hitLayer.width = this.viewPort.w;this.hitLayer.height = this.viewPort.h;this.mapLocationInBrowser = maClient.tagLocation(null, "maMarkerLayer");this.mapCanZoom = maTour.mapZoomLevel > 0;this.mapZoom = maTour.mapZoomLevel == 1 || !this.mapCanZoom ? this.minMaxZoom : this.maxMapZoom;this.setCurrentMapScale();this.mapLevels = new Array(this.mapCanZoom ? 2 : 1);this.mapTileImagesLoaded = false;this.waitForMapTileImagesAttempts = 0;this.loadImageData();this.loadImageObjects();this.initEventHandlers();};maClient.Html5.prototype.loadImageData = function() { this.waitForImageDataLoadAttempts = 0;this.mapTileImageDataLoaded = false;this.symbolImageDataLoaded = false;var head = document.getElementsByTagName("head")[0];var mapFileId = maTour.mapFileName.substring(0, maTour.mapFileName.length - 4);var fileLocation = maClient.path + mapFileId + '.js?v=' + maTour.buildId;var script = document.createElement('script');script.type = 'text/javascript';script.onload = maClient.map.onMapTileImageDataLoaded;script.src = fileLocation;head.appendChild(script);fileLocation = maClient.path + "symbols" + maTour.pageNumber + '.js?v=' + maTour.buildId;script = document.createElement('script');script.type = 'text/javascript';script.onload = maClient.map.onSymbolImageDataLoaded;script.src = fileLocation;head.appendChild(script);};maClient.Html5.prototype.loadImageObjects = function() { var delayPeriod = 50;if ((!this.mapTileImageDataLoaded || !this.symbolImageDataLoaded) && this.waitForImageDataLoadAttempts < 400) { this.waitForImageDataLoadAttempts++;setTimeout("maClient.map.loadImageObjects();", delayPeriod);return;} this.loadMapTiles(1);if (this.mapCanZoom) { if (maTour.mapInsetLocation !== 0) { this.mapInsetImageLoaded = false;this.mapInsetImage = new Image();this.mapInsetImage.onload = maOnMapInsetImageLoad;this.mapInsetImage.src = maClient.path + maTour.mapInsetFileName + '?v=' + maTour.buildId;} this.loadMapTiles(2);} this.createMarkerStyles();this.createMarkerInstances();this.drawLoadingMessage(null);this.waitForMapTileImagesToLoad();};maClient.Html5.prototype.loadMapTiles = function(level) { var mapLevel = new Object();this.mapLevels[level - 1] = mapLevel;var tileWidth = 256;var tileHeight = 256;var mapWidth = level == 1 ? this.mapWidthScaled : this.mapWidth;var mapHeight = level == 1 ? this.mapHeightScaled : this.mapHeight;mapLevel.lastColumn = Math.round(mapWidth / tileWidth);mapLevel.lastColumnWidth = mapWidth - (mapLevel.lastColumn * tileWidth);if (mapLevel.lastColumnWidth > 0) mapLevel.lastColumn++;else mapLevel.lastColumnWidth = tileWidth;mapLevel.lastRow = Math.round(mapHeight / tileHeight);mapLevel.lastRowHeight = mapHeight - (mapLevel.lastRow * tileHeight);if (mapLevel.lastRowHeight > 0) mapLevel.lastRow++;else mapLevel.lastRowHeight = tileHeight;if (mapLevel.lastRow < 0) { mapLevel.lastRow = 0;} var tile;var index = 0;var tileCount = mapLevel.lastRow * mapLevel.lastColumn;mapLevel.tiles = new Array(tileCount);for (var row = 1; row <= mapLevel.lastRow; row++) { for (var column = 1; column <= mapLevel.lastColumn; column++) { index = (((row - 1) * mapLevel.lastColumn) + column) - 1;tile = new Object();tile.id = index;tile.level = level;tile.loaded = false;tile.image = new Image();tile.image.tile = tile;tile.image.onload = maOnTileImageLoad;mapLevel.tiles[index] = tile;} } var mapTiles = this.mapTiles();for (index = 0; index < tileCount; index++) { tile = mapLevel.tiles[index];tile.image.src = "data:image/jpg;base64," + mapTiles[level - 1][index];} };function maOnTileImageLoad() { this.tile.loaded = true;} function maOnMapInsetImageLoad() { maClient.map.mapInsetImageLoaded = true;} maClient.Html5.prototype.mapIsZoomed = function() { return this.mapCanZoom && this.mapZoom > this.minMaxZoom;};maClient.Html5.prototype.markerInstance = function(viewId) { for (var index in this.markerInstances) { var markerInstance = this.markerInstances[index];if (markerInstance.viewId == viewId) return markerInstance;} return null;};maClient.Html5.prototype.markerIsInClippingRegion = function(markerInstance, clipX, clipY, clipW, clipH) { var bounds = this.getBoundingArea(markerInstance);var x = bounds.x;var y = bounds.y;var w = bounds.w;var h = bounds.h;if (x + w < clipX) { return false;} else if (x > clipX + clipW) { return false;} else if (y + h < clipY) { return false;} else if (y > clipY + clipH) { return false;} return true;};maClient.Html5.prototype.needToShowHelp = function() { if (!maTour.showInstructions) return false;var buildId = localStorage[this.localStorageId + "buildId"];var firstVisit = buildId != maTour.buildId;var timeLastShown = firstVisit ? 0 : localStorage[this.localStorageId + "timeLastShown"];var currentTime = (new Date()).getTime();var elapsedTime = currentTime - timeLastShown;var HELP_TIMEOUT = 1000 * 60 * 5;  var show = firstVisit || localStorage[this.localStorageId + "userClosedHelpWindow"] != "1" || elapsedTime > HELP_TIMEOUT;localStorage[this.localStorageId + "buildId"] = maTour.buildId;if (show) { localStorage[this.localStorageId + "userClosedHelpWindow"] = "0";} localStorage[this.localStorageId + "timeLastShown"] = currentTime;localStorage[this.localStorageId + "buildId"] = maTour.buildId;return show;};maClient.Html5.prototype.positionMapToShowMarker = function(viewId) { if (!this.mapIsZoomed()) return false;var markerInstance = this.markerInstance(viewId);if (markerInstance === null) return false;var x = this.mapPanX + markerInstance.x;var y = this.mapPanY + markerInstance.y;var pad = 16;var visible = x > pad && x < this.viewPort.w - pad && y > pad && y < this.viewPort.h - pad;if (visible) { return false;} else { var positioned = this.setMapPosition(markerInstance.x, markerInstance.y);this.drawMap();return positioned;} };maClient.Html5.prototype.redrawMarker = function(markerInstance, selected) { if (markerInstance === null) { return;} var bounds = this.getBoundingArea(markerInstance);var x = bounds.x;var y = bounds.y;var w = bounds.w;var h = bounds.h;if (markerInstance.isNotAnchored) { x -= this.mapPanX;y -= this.mapPanY;} this.markerLayerContext.save();this.markerLayerContext.beginPath();this.markerLayerContext.moveTo(x, y);this.markerLayerContext.lineTo(x + w, y);this.markerLayerContext.lineTo(x + w, y + h);this.markerLayerContext.lineTo(x, y + h);this.markerLayerContext.lineTo(x, y);this.markerLayerContext.clip();if (this.debugClipping && (selected || markerInstance.isStatic)) { this.markerLayerContext.fillStyle = "yellow";this.markerLayerContext.fill();} else { this.markerLayerContext.clearRect(x, y, w, h);} var drawSelectedMarkerOnTop = false;for (var index in this.markerInstances) { var m = this.markerInstances[index];if (m.viewId == markerInstance.viewId) { if (!this.isHidden && (!drawSelectedMarkerOnTop || !selected)) { this.drawMarker(m, selected);} } else { if (this.markerIsInClippingRegion(m, x, y, w, h)) { var drawSelected = (m.viewId == this.selectedViewId && !m.isStatic) || m.appearsSelected;this.clipBounds = bounds;this.drawMarker(m, drawSelected);this.clipBounds = null;} } } if (drawSelectedMarkerOnTop && selected) { this.drawMarker(markerInstance, true);} this.markerLayerContext.restore();};maClient.Html5.prototype.restoreDrawingSurface = function() { this.markerLayerContext.restore();this.hitLayerContext.restore();};maClient.Html5.prototype.restoreMarkerShapeAppearance = function(viewIdList, selected) { var markers = this.createMarkerArrayFromMarkerIdList(viewIdList);for (var index in markers) { var markerInstance = markers[index];var custom = markerInstance.customMarkerStyle;if (custom === null) { continue;} var original = this.markerStyles[markerInstance.markerStyleId];if (!original) { continue;} if (selected) { custom.selectedFillColor = original.selectedFillColor;custom.selectedFillColorOpacity = original.selectedFillColorOpacity;custom.selectedLineColor = original.selectedLineColor;custom.selectedLineColorOpacity = original.selectedLineColorOpacity;custom.selectedShapeEffects = original.selectedShapeEffects;} else { custom.normalFillColor = original.normalFillColor;custom.normalFillColorOpacity = original.normalFillColorOpacity;custom.normalLineColor = original.normalLineColor;custom.normalLineColorOpacity = original.normalLineColorOpacity;custom.normalShapeEffects = original.normalShapeEffects;} this.redrawMarker(markerInstance, markerInstance.viewId == this.selectedViewId);} };maClient.Html5.prototype.runSlideShow = function() { if (!maTour.runSlideShow) return;for (index in this.markerInstances) { var markerInstance = this.markerInstances[index];if (markerInstance.viewId == maTour.selectedViewId) { this.nextSlideShowIndex = index;break;} } this.slideShowRunning = true;maClient.flashSlideShowIsRunning(true);this.showNextSlide();this.slideShowIntervalId = setInterval("maClient.map.showNextSlide();", parseInt(maTour.slideShowInterval, 10));};maClient.Html5.prototype.selectMarkerAndShowView = function(viewId, isDirEntry, dontBlink) { this.deselectMarker();markerInstance = this.markerInstance(viewId);this.positionMapToShowMarker(markerInstance.viewId);if (isDirEntry) { if (!dontBlink) { markerInstance.setBlink(parseInt(maTour.blinkCount, 10));} this.stopSlideShow();} this.switchView(markerInstance, isDirEntry);};maClient.Html5.prototype.setCurrentMapScale = function() { this.currentMapScale = this.mapZoom == this.maxMapZoom ? 1.0 : this.mapZoom * this.mapScale;};maClient.Html5.prototype.setDirectoryState = function(showing) { };maClient.Html5.prototype.setDrawingSurface = function(markerInstance) { this.markerLayerContext.save();this.hitLayerContext.save();var x = markerInstance.x;var y = markerInstance.y;if (!markerInstance.isNotAnchored) { x += this.mapPanX;y += this.mapPanY;} if (markerInstance.markerZooms) { var s = this.currentMapScale;this.markerLayerContext.scale(s, s);this.hitLayerContext.scale(s, s);} else if (!markerInstance.isNotAnchored) { x = Math.round(x * this.currentMapScale);y = Math.round(y * this.currentMapScale);} if (markerInstance.isNotAnchored) { if (markerInstance.markerZooms) { x = x / this.currentMapScale;y = y / this.currentMapScale;} } if (markerInstance.markerType == maMarkerType_Shape) { x += 0.5;y += 0.5;} this.markerLayerContext.translate(x, y);this.hitLayerContext.translate(x, y);if (markerInstance.rotation !== 0) { this.markerLayerContext.rotate(markerInstance.rotation);this.hitLayerContext.rotate(markerInstance.rotation);} };maClient.Html5.prototype.setMapPan = function(deltaX, deltaY) { this.shiftMapPanPosition(deltaX, deltaY);this.drawMap();};maClient.Html5.prototype.shiftMapPanPosition = function(deltaX, deltaY) { if (!this.mapIsZoomed()) { this.mapPanX = 0;this.mapPanY = 0;this.setViewPortPosition();return;} var mapWasPanned = false;var currentMapWidth = Math.round(this.mapWidth * this.currentMapScale);var currentMapHeight = Math.round(this.mapHeight * this.currentMapScale);var maxPanRight;var okToPan = true;if (this.viewPort.w > currentMapWidth) maxPanRight = 0;else maxPanRight = -(currentMapWidth - this.viewPort.w);var requestedPanX = this.mapPanX + deltaX;if (requestedPanX > 0) { this.mapPanX = 0;} else if (requestedPanX < maxPanRight) { this.mapPanX = maxPanRight;} else { if (this.mapPanX == requestedPanX && deltaX !== 0) { okToPan = false;} else { this.mapPanX = requestedPanX;} } if (okToPan) { mapWasPanned = true;} var maxPanBottom;okToPan = true;if (this.viewPort.h > currentMapHeight) maxPanBottom = 0;else maxPanBottom = -(currentMapHeight - this.viewPort.h);var requestedPanY = this.mapPanY + deltaY;if (requestedPanY > 0) { this.mapPanY = 0;} else if (requestedPanY < maxPanBottom) { this.mapPanY = maxPanBottom;} else { if (this.mapPanY == requestedPanY && deltaY !== 0) { okToPan = false;} this.mapPanY = requestedPanY;} if (okToPan) { mapWasPanned = true;} if (mapWasPanned && (deltaX !== 0 || deltaY !== 0)) { if (this.popupIsShowing) { this.deselectMarker();maClosePopup();} } this.setViewPortPosition();};maClient.Html5.prototype.setMapPosition = function(centerX, centerY) { if (this.mapIsZoomed()) { var oldMapPanX = this.mapPanX;var oldMapPanY = this.mapPanY;this.mapPanX = Math.round(-centerX + (this.viewPort.w / 2));this.mapPanY = Math.round(-centerY + (this.viewPort.h / 2));this.shiftMapPanPosition(0, 0);return oldMapPanX != this.mapPanX || oldMapPanY != this.mapPanY;} else { return false;} };maClient.Html5.prototype.setMapZoomInOut = function(delta) { if (!this.mapCanZoom) return;var lastSelectedViewId = this.selectedViewId;if (this.popupIsShowing) { maClosePopup();} if (delta > 0 && this.mapZoom == this.maxMapZoom) return;if (delta < 0 && this.mapZoom == this.minMaxZoom) return;if (delta > 0) { this.mapZoom = this.maxMapZoom;} else { this.mapZoom = this.minMaxZoom;this.savedMapPanX = this.mapPanX;this.savedMapPanY = this.mapPanY;this.mapPanX = 0;this.mapPanY = 0;this.setViewPortPosition();} this.setCurrentMapScale();if (lastSelectedViewId !== 0 && this.mapIsZoomed()) { this.selectMarkerAndShowView(lastSelectedViewId, true, true);} this.mapLayerContext.clearRect(0, 0, this.viewPort.w, this.viewPort.h);this.drawMap();};maClient.Html5.prototype.setMapZoomLevel = function(level) { var midLevel = parseInt(maTour.mapZoomMidLevel, 10);this.setMapZoomInOut(level < midLevel ? -1 : 1);};maClient.Html5.prototype.setMarkerAppearanceAsNormalOrSelected = function(viewIdList, selected) { var markers = this.createMarkerArrayFromMarkerIdList(viewIdList);for (index in this.markerInstances) { markerInstance = this.markerInstances[index];var redraw = false;for (var i in markers) { var m = markers[i];if (m.viewId == markerInstance.viewId) { markerInstance.appearsSelected = selected;redraw = true;break;} } if (redraw) { this.redrawMarker(markerInstance, false);} } };maClient.Html5.prototype.setMarkerAppearanceNormal = function(viewIdList) { this.setMarkerAppearanceAsNormalOrSelected(viewIdList, false);};maClient.Html5.prototype.setMarkerAppearanceSelected = function(viewIdList) { this.setMarkerAppearanceAsNormalOrSelected(viewIdList, true);};maClient.Html5.prototype.setMarkerListBlink = function(viewIdList, blinkCount) { var markers = this.createMarkerArrayFromMarkerIdList(viewIdList);for (var index in markers) { var markerInstance = markers[index];markerInstance.setBlink(blinkCount);} };maClient.Html5.prototype.setMarkerClipBounds = function(markerInstance, selected, deltaX, deltaY, deltaW, deltaH) { var padding = selected ? markerInstance.paddingSelected : markerInstance.paddingNormal;padding.x = deltaX;padding.y = deltaY;padding.w = deltaW;padding.h = deltaH;};maClient.Html5.prototype.setMarkerListDisabled = function(viewIdList, isDisabled) { var markers = this.createMarkerArrayFromMarkerIdList(viewIdList);for (var index in markers) { var markerInstance = markers[index];markerInstance.isDisabled = isDisabled === true;} };maClient.Html5.prototype.setMarkerListHidden = function(viewIdList, isHidden) { var markers = this.createMarkerArrayFromMarkerIdList(viewIdList);for (var index in markers) { var markerInstance = markers[index];if (markerInstance.isHidden != isHidden) { markerInstance.isHidden = isHidden === true;markerInstance.isVisibleAtCurrentZoomLevel = markerInstance.isVisibleAtCurrentZoomLevel_();this.redrawMarker(markerInstance, markerInstance.viewId == this.selectedViewId);} } };maClient.Html5.prototype.setMarkerListStatic = function(viewIdList, isStatic) { var markers = this.createMarkerArrayFromMarkerIdList(viewIdList);for (var index in markers) { var markerInstance = markers[index];markerInstance.isStatic = isStatic === true;} };maClient.Html5.prototype.setMarkerOnTop = function(viewId) { var markerInstance = null;var position = -1;for (var index in this.markerInstances) { markerInstance = this.markerInstances[index];if (markerInstance.viewId == viewId) { position = index;break;} } if (position != -1) { this.markerInstances.splice(position, 1);this.markerInstances.push(markerInstance);} this.redrawMarker(markerInstance, markerInstance.viewId == this.selectedViewId);};maClient.Html5.prototype.setMarkerSelectedState = function(viewId) { this.selectedViewId = viewId;};maClient.Html5.prototype.setPopupState = function(viewId, showing, pinned, mouseIsOver) { this.popupIsShowing = showing;if (!showing && this.selectedViewId !== 0) this.deselectMarker();};maClient.Html5.prototype.setViewPortPosition = function() { this.viewPort.x1 = -this.mapPanX;this.viewPort.x2 = this.viewPort.x1 + this.viewPort.w - 1;this.viewPort.y1 = -this.mapPanY;this.viewPort.y2 = this.viewPort.y1 + this.viewPort.h - 1;};maClient.Html5.prototype.showInstructions = function() { if (!this.needToShowHelp()) return;var zoomControlOffset = this.showZoomControl ? 32 : 0;var instructions = document.createElement("div");instructions.setAttribute("id", "maInstructions");instructions.setAttribute("class", "maInstructions");instructions.style.position = "absolute";instructions.style.zIndex = 5000;instructions.style.top = "0px";instructions.style.left = 8 + zoomControlOffset + "px";instructions.style.backgroundColor = maTour.instructions.bgColor;instructions.style.color = maTour.instructions.color;instructions.style.width = maTour.instructions.width - 12 + "px";instructions.onclick = new Function("maClient.map.hideInstructions();");var closeX = document.createElement("img");closeX.setAttribute("id", "maInstructionsCloseX");closeX.style.position = "absolute";closeX.style.zIndex = 5000;closeX.style.top = "4px";closeX.style.left = zoomControlOffset + maTour.instructions.width - 6 + "px";closeX.src = maClient.graphics["closeInstructionsX"].src;closeX.style.width = "12px";closeX.style.height = "12px";closeX.onclick = new Function("maClient.map.hideInstructions();");var maMap = document.getElementById("maMap");maMap.appendChild(instructions);maMap.appendChild(closeX);var text = maTour.instructions.text;var index = text.indexOf("###");if (index != -1) { if (maClient.isTouchDevice) { text = text.substr(index + 3);} else { text = text.substr(0, index);} } instructions.innerHTML = "<div class='maInstructionsTitle'>" + maTour.instructions.title + "</div>" + text;};maClient.Html5.prototype.showMarkerSelected = function(viewId, show) { if (show) this.setMarkerAppearanceSelected(viewId);else this.setMarkerAppearanceNormal(viewId);};maClient.Html5.prototype.showNextSlide = function() { var markerInstance = this.markerInstances[this.nextSlideShowIndex];this.nextSlideShowIndex++;if (this.nextSlideShowIndex >= this.markerInstances.length) { this.nextSlideShowIndex = 0;} this.selectMarkerAndShowView(markerInstance.viewId, false);};maClient.Html5.prototype.showTooltip = function(markerInstance) { if (markerInstance.tooltip.length > 0) { var x = markerInstance.centerX() + this.mapPanX - markerInstance.anchorScaledX();var y = markerInstance.centerY() + this.mapPanY - markerInstance.anchorScaledY();maClient.flashMarkerMouseOver(markerInstance.tooltip, x, y);} };maClient.Html5.prototype.showZoomControls = function() { if (!this.showZoomControl) return;var zoomControl = document.getElementById("maZoomControl");if (!zoomControl) { zoomControl = document.createElement('canvas');zoomControl.setAttribute("id", "maZoomControl");zoomControl.setAttribute("class", "maZoomControl");zoomControl.width = 44;zoomControl.height = 44;var maMap = document.getElementById("maMap");maMap.appendChild(zoomControl);} var ctx = zoomControl.getContext('2d');ctx.save();ctx.clearRect(0, 0, 44, 44);ctx.fillStyle = maTour.mapZoomControlColor;ctx.fillRect(7.5, 7.5, 28, 28);ctx.lineWidth = 1.0;ctx.strokeStyle = "#777777";ctx.strokeRect(7.5, 7.5, 28, 28);ctx.lineWidth = 2.0;ctx.strokeStyle = "#555555";ctx.beginPath();ctx.moveTo(12, 21);ctx.lineTo(30, 21);if (this.mapIsZoomed()) { zoomControl.onclick = new Function("maClient.map.setMapZoomInOut(-10);");} else { ctx.moveTo(21, 12);ctx.lineTo(21, 30);zoomControl.onclick = new Function("maClient.map.setMapZoomInOut(10);");} ctx.stroke();ctx.restore();};maClient.Html5.prototype.startTouchDelay = function() { if (typeof this.ignoreTouchIntervalId != "undefined") { clearInterval(this.ignoreTouchIntervalId);} maClient.map.ignoreTouch = true;ignoreTouchIntervalId = setTimeout("maClient.map.ignoreTouch = false;", 500);};maClient.Html5.prototype.stopSlideShow = function() { if (this.slideShowRunning) { clearInterval(this.slideShowIntervalId);this.slideShowRunning = false;maClient.flashSlideShowIsRunning(false);} };maClient.Html5.prototype.switchView = function(markerInstance, isDirEntry) { if (markerInstance === null) { return;} var transferringToAnotherPage = false;var performClickAction = false;if (!isDirEntry && !this.slideShowRunning) { if (markerInstance.clickActionTarget.length > 0 && markerInstance.touchPerformsClickAction && maClient.isTouchDevice) { transferringToAnotherPage = markerInstance.clickAction != maActionCallJavascript;performClickAction = true;this.executeClickAction(markerInstance);} else { var mouseoverActionTarget = markerInstance.mouseoverActionTarget;if (mouseoverActionTarget.length > 0 && markerInstance.mouseoverAction == maActionCallJavascript) { maClient.flashExecuteJavaScript(mouseoverActionTarget);} } } var x = markerInstance.centerX() + this.mapPanX - markerInstance.anchorScaledX();var y = markerInstance.centerY() + this.mapPanY - markerInstance.anchorScaledY();var w = markerInstance.drawnWidth();var h = markerInstance.drawnHeight();var mouseX = this.mouseX + this.mapLocationInBrowser.x;var mouseY = this.mouseY + this.mapLocationInBrowser.y;if (!markerInstance.doesNotShowContent && !transferringToAnotherPage) { maClient.flashViewChanged(markerInstance.viewId, x, y, w, h, mouseX, mouseY, isDirEntry);} this.selectedViewId = markerInstance.viewId;if (!markerInstance.isStatic) { this.redrawMarker(markerInstance, true);} if (!isDirEntry && !performClickAction && (markerInstance.doesNotShowContent || !maClient.usesHidablePopup)) { if (this.popupIsShowing) { maClosePopup();} this.showTooltip(markerInstance);} };maClient.Html5.prototype.waitForMapTileImagesToLoad = function() { var delayPeriod = 50;var wait = false;for (var level = 0; level < this.mapLevels.length; level++) { var mapLevel = this.mapLevels[level];if (this.waitForMapTileImagesAttempts < 200) { for (var index = 0; index < mapLevel.tiles.length; index++) { var tile = mapLevel.tiles[index];if (!tile.loaded || !this.mapInsetImageLoaded) { wait = true;break;} } if (wait) { this.waitForMapTileImagesAttempts++;break;} } } if (wait) { setTimeout("maClient.map.waitForMapTileImagesToLoad();", delayPeriod);return;} else { this.mapTileImagesLoaded = true;} if (!this.mapTileImagesLoaded) { this.drawLoadingMessage("Could not load map image");return;} this.drawMap();this.showInstructions();this.runSlideShow();maClient.onMapLoaded();};
