function DSRange(A,B){this.low=A;this.high=B}DSRange.prototype.contains=function(A){return A>=this.low&&A<=this.high};DSRange.prototype.limitNumber=function(A){A=Math.max(parseFloat(A),this.low);return Math.min(A,this.high)};function DSCircle(A,B){this.low=A;this.high=B}DSCircle.prototype.limitNumber=function(A){A=parseFloat(A);while(A>this.high){A-=this.high-this.low}while(A<this.low){A+=this.high-this.low}return A};function DSCircleSegment(C,A,B){this.circle=C;this.low=A;this.high=B}DSCircleSegment.prototype.contains=function(A){var B=this.circle.limitNumber(A);if(this.low>this.high){return(B>=this.low&&B<=this.circle.high)||(B>=this.circle.low&&B<=this.high)}else{return B>=this.low&&B<=this.high}};var DSLatitude=new DSRange(-90,90);var DSLongitude=new DSCircle(-180,180);function DSBoundingBox(A,B){this.lower=A;this.upper=B;this.width=new DSCircleSegment(DSLongitude,A.lng,B.lng);this.height=new DSRange(A.lat,B.lat)}DSBoundingBox.prototype.contains=function(A){return this.width.contains(A.lng)&&this.height.contains(A.lat)};function DSMapTileUrlFactory(B,A,E,D,C){this.base=B||"";this.tileSet=A||"";this.extension=E||"";this.map=D;this.locale=D.locale||"";this.suffix=C||"";this.post=this.extension+"?";this.setPre()}DSMapTileUrlFactory.prototype.setPre=function(){this.pre=this.base+(this.locale.length?this.locale+"/":"")};DSMapTileUrlFactory.prototype.getPost=function(){return this.post+"w="+this.map.width+"&h="+this.map.height+this.suffix};DSMapTileUrlFactory.prototype.getUrl=function(A,C,B){return this.pre+B+"/"+A+"/"+C+this.getPost()};DSMapTileUrlFactory.prototype.setLocale=function(A){this.locale=A;this.setPre()};function DSCopyright(E,C,A,B,D){this.text=E;this.boxes=(typeof C.length=="undefined"?[C]:C);this.minzoom=A;this.maxzoom=B;this.tileset=D}DSCopyright.prototype.contains=function(A,D,F){var C=(!F||!this.tileset||(F==this.tileset));var G=(!this.minzoom||D>=this.minzoom)&&(!this.maxzoom||D<=this.maxzoom);var E=false;for(var B=0;B<this.boxes.length;++B){if(this.boxes[B].contains(A)){E=true;break}}return E&&G&&C};function DSCopyrightSet(){this.copyrights=[]}DSCopyrightSet.prototype.getCopyright=function(A,D,E){var C=[];if(A&&D){for(var B=0;B<this.copyrights.length;++B){if(this.copyrights[B].contains(A,D,E)){C.push(this.copyrights[B].text)}}}return C.join(" - ")};DSCopyrightSet.prototype.addCopyright=function(A){this.copyrights.push(A)};function DSMapDecoratorCollection(){this.init()}LMI.Lang.extend(DSMapDecoratorCollection,DSCollection);DSMapDecoratorCollection.prototype.getByType=function(C){var B=new DSIterator(this),A=[],D;while((D=B.next())){if(D.type==C){A.push(D)}}return A};DSMapDecoratorCollection.prototype.getByName=function(A){var B=new DSIterator(this),C;while((C=B.next())){if(C.name==A){return C}}return ret};function DSMapDecorator(D,C,E,B,A){this.init(D,C,E,B,A)}DSMapDecorator.prototype.init=function(D,C,E,B,A){this.map=D;this.element=C;this.position=E;this.type=B;this.name=A;this.updatePosition()};DSMapDecorator.prototype.getElement=function(){return this.element};DSMapDecorator.prototype.getFirstElement=function(){for(i=0,iLen=this.element.childNodes.length;i<iLen;++i){var A=this.element.childNodes[i];if(!LMI.StyleSheet.isClass(A,"skip")){return A}}};DSMapDecorator.prototype.updatePosition=function(){this.element.style.position="absolute";if(typeof this.position.left!="undefined"){this.element.style.left=parseInt(this.position.left,10)+"px"}if(typeof this.position.right!="undefined"){this.element.style.right=parseInt(this.position.right,10)+"px"}if(typeof this.position.top!="undefined"){this.element.style.top=parseInt(this.position.top,10)+"px"}if(typeof this.position.bottom!="undefined"){this.element.style.bottom=parseInt(this.position.bottom,10)+"px"}for(var A in {width:"",height:""}){if(typeof this.position[A]!="undefined"){this.element.style[A]=parseInt(this.position[A],10)+"px"}}if(typeof this.position.zIndex!="undefined"){this.element.style.zIndex=parseInt(this.position.zIndex,10)}};DSMapDecorator.prototype.setPosition=function(B){for(var A in B){this.position[A]=B[A]}this.updatePosition()};DSMapDecorator.prototype.getPosition=function(){return this.position};(function(){function B(){this.name="InvalidLatException"}LMI.Lang.extend(B,TypeError);function A(){this.name="InvalidLngException"}LMI.Lang.extend(A,TypeError);function C(E){return E*(180/Math.PI)}var D=LMI.Lang.getObject("LMI.Mapping",true);D.Point=function(F,E){this.init(F,E)};D.Point.prototype={init:function(H,G){var F=parseFloat(H),E=parseFloat(G);if(F!=H||isNaN(F)){throw new B()}if(E!=G||isNaN(E)){throw new A()}this.lat=Math.round(this.limitLat(F)*100000)/100000;this.lng=Math.round(this.limitLng(E)*100000)/100000},latAsRad:function(){return radians(this.lat)},lngAsRad:function(){return radians(this.lng)},equals:function(E){return E&&this.lat===E.lat&&this.lng===E.lng},limitLat:function(E){return DSLatitude.limitNumber(E)},limitLng:function(E){return DSLongitude.limitNumber(E)},toString:function(){return"LMI.Mapping.Point("+this.lat+","+this.lng+")"}};D.Point.fromRadians=function(F,E){return new D.Point(C(F),C(E))}})();function DSMapObject(B,C,D,E,A){this.init(B,C,D,E,A)}DSMapObject.prototype={init:function(B,C,D,E,A){this.setPoint(B);this.element=C;this.xOffset=(D?D:0);this.yOffset=(E?E:0);this.zOffset=(A?A:0);this.properties={};this.initEventListeners()},setPoint:function(A){this.point=A},setProperty:function(A,B){return this.properties[A]=B},setProperties:function(){for(var A=0;A<arguments.length;A++){this.properties[arguments[A]]=arguments[++A]}return this},getProperty:function(A){return(A&&A in this.properties?this.properties[A]:"")},getXOffset:function(){return this.xOffset},getYoffset:function(){return this.yOffset},getZOffset:function(){return this.zOffset},getWidth:function(){return this.element.offsetWidth},getHeight:function(){return this.element.offsetHeight},isIncludedInBestFit:function(){return !this.getProperty("excludeFromBestFit")},update:function(){},remove:function(){},initEventListeners:function(){this.initEvents("click","mouseout","mouseover")}};LMI.Lang.importFunctions(DSMapObject,LMI.Event);DSMapObject.prototype._addEventListener=DSMapObject.prototype.addEventListener;DSMapObject.prototype.addEventListener=function(B,D){var C=this,A;switch(B){case"click":LMI.StyleSheet.setCursor(this.element,"pointer");case"mouseout":case"mouseover":if(this.getListeners(B).length==0){A=function(E){var F=new LMI.BrowserEventObject(E,window.event,this);C.triggerEvent(B,F,C)};this["_"+B+"Listener"]=A;LMI.BrowserEvent.addListener(this.element,B,A)}break}this._addEventListener(B,D)};DSMapObject.prototype._removeEventListener=DSMapObject.prototype.removeEventListener;DSMapObject.prototype.removeEventListener=function(A,B){this._removeEventListener(A,B);if(A=="click"||A=="mouseout"||A=="mouseover"){if(this.getListeners(A).length==0){LMI.BrowserEvent.removeListener(this.element,A,this["_"+A+"Listener"]);delete this["_"+A+"Listener"]}}};DSMapObject.prototype.bindEvent=function(B,E,C,A){var D=function(F,G){C.call(E,F,G,A)};return this.addEventListener(B,D)};function DSMapObject_Iterator(A,B){this.coll=A;this.pos=(B?B:0)}function DSMapObject_HasNext(){if(this.coll&&(this.pos+1)<=this.coll.order.length){return true}this.pos=0;return false}function DSMapObject_Next(){return(this.coll.objects[this.coll.order[this.pos++]])}function DSMapObject_GetId(){return this.coll.order[this.pos-1]}function DSMapObject_SetIteratorOffset(A){this.pos=A}function DSMapObject_GetIteratorOffset(){return this.pos}function DSMapObject_Add(A){this.objects[this.currIdx]=A;this.order.push(this.currIdx);return this.currIdx++}function DSMapObject_Remove(B){if(this.objects[B]){delete this.objects[B];for(var A=0;A<this.order.length;++A){if(this.order[A]==B){this.order.splice(A,1)}}return true}return false}function DSMapObject_RemoveAll(){this.objects={};this.order=[];this.currPos=this.currIdx=0}function DSMapObject_GetByIndex(A){return this.objects[this.order[A]]}function DSMapObject_GetById(A){return this.objects[A]?this.objects[A]:null}function DSMapObject_Size(){return this.order.length}function DSMapObject_GetByProperty(A,C){for(var B=0;B<this.order.length;++B){if(this.objects[this.order[B]].getProperty(A)==C){return this.objects[this.order[B]]}}return null}function DSMapObject_GetIdsByProperty(A,D){var C=[];for(var B=0;B<this.order.length;++B){if(this.objects[this.order[B]].getProperty(A)==D){C.push(this.order[B])}}return C}function DSMapObject_Collection(){this.objects={};this.order=[];this.currPos=this.currIdx=0}DSMapObject_Collection.prototype.add=DSMapObject_Add;DSMapObject_Collection.prototype.remove=DSMapObject_Remove;DSMapObject_Collection.prototype.getById=DSMapObject_GetById;DSMapObject_Collection.prototype.getByIndex=DSMapObject_GetByIndex;DSMapObject_Collection.prototype.size=DSMapObject_Size;DSMapObject_Collection.prototype.getByProperty=DSMapObject_GetByProperty;DSMapObject_Collection.prototype.getIdsByProperty=DSMapObject_GetIdsByProperty;DSMapObject_Collection.prototype.removeAll=DSMapObject_RemoveAll;DSMapObject_Iterator.prototype.next=DSMapObject_Next;DSMapObject_Iterator.prototype.getId=DSMapObject_GetId;DSMapObject_Iterator.prototype.hasNext=DSMapObject_HasNext;DSMapObject_Iterator.prototype.setOffset=DSMapObject_SetIteratorOffset;DSMapObject_Iterator.prototype.getOffset=DSMapObject_GetIteratorOffset;function DSIcon(B,C,D,E,A){this.init(B,C,D,E,A)}LMI.Lang.extend(DSIcon,DSMapObject);DSIcon.prototype.init=function(B,C,E,F,A){var D=this.getIcon(C);DSIcon.superclass.init.call(this,B,D,E,F,A)};DSIcon.prototype.initEventListeners=function(){LMI.BrowserEvent.addListener(this.element,"error",DSIcon.ImageError);DSIcon.superclass.initEventListeners.call(this)};DSIcon.prototype.getIcon=function(A){return LMI.Element.createImage(A)};DSIcon.ImageError=function(A){var C=new LMI.BrowserEventObject(A,window.event,this),B=C.getCurrentTarget(),D=LMI.Urls.getImg("map_icon_blank.png");if(!LMI.Element.getImageSrc(B).match(D)){LMI.Element.setImageSrc(B,D)}};function DSOutline(B,C,A){this.init(B,C,A)}LMI.Lang.extend(DSOutline,DSMapObject);DSOutline.prototype.init=function(B,C,A){var E=LMI.Element.create("div",null);var D=LMI.Element.create("div",E);LMI.StyleSheet.addClass(E,"outline");LMI.StyleSheet.addClass(D,"fill");LMI.StyleSheet.setOpacity(E,60);LMI.StyleSheet.setOpacity(D,25);DSOutline.superclass.init.call(this,B,E);this.setWidth(C);this.setHeight(A)};DSOutline.prototype.setWidth=function(A){this.element.style.width=A+"px"};DSOutline.prototype.setHeight=function(A){this.element.style.height=A+"px"};function DSPolyLine(D,B,A,C){this.init(D,B,A,C)}LMI.Lang.extend(DSPolyLine,DSMapObject);DSPolyLine.prototype.init=function(E,B,A,D){this.eventsInited=false;this.shapePoints=E;this.routeArea=A;this.routeRect=null;this.setVisibleArea(D);this.timeout=null;var C;if(B){C=document.createElement("img");LMI.BrowserEvent.addListener(C,"load",DSPolyLine.ImageLoad);DSPolyLine.superclass.init.call(this,this.point,C,0,0,-1);this.setLineUrl(B);this.url=B}else{alert("TODO: create poly line element");C=LMI.Element.create("div",null);DSPolyLine.superclass.init.call(this,this.point,C,0,0,-1)}};DSPolyLine.prototype.updateCallback=function(A){if(A.routeUrl){this.setLineUrl(A.routeUrl);this.setVisibleArea(A.visibleRouteArea);this.map.positionObject(this)}};DSPolyLine.prototype.doUpdateLine=function(A){if(this.timeout){window.clearTimeout(this.timeout)}var B=this;this.timeout=window.setTimeout(function(){B.timeout=null;B.element.style.display="none";var E=A.getMapLayerURPoint();var D=A.getMapLayerLLPoint();var C=[D.lng,D.lat,E.lng,E.lat];this.center=A.getCenterPoint();LMI.AjaxController.getRouteImageUrl(function(F){B.updateCallback(F)},B.shapePoints,B.routeArea,C,A.zoomLevel)},250)};DSPolyLine.prototype.updateLine=function(G,F){if(!this.center&&G.previousCenter){this.center=G.previousCenter}if(G.eventType=="zoom"&&G.previousZoomLevel!=F.zoomLevel){this.routeRect=null;this.doUpdateLine(F)}else{if(G.eventType=="recenter"){var A=this.center;var B=F.getCenterPoint();var J=F.gridSystem.getUL(B.lng,B.lat,this.map.width,this.map.height);var I=F.gridSystem.getLR(B.lng,B.lat,this.map.width,this.map.height);var D=new Rectangle(J.y,J.x,I.y,I.x);if(!this.routeRect){this.routeRect=this.calculateRect(this.routeArea,F)}if(!this.visibleRect){this.visibleRect=this.calculateRect(this.visibleArea,F)}var E=D.intersection(this.routeRect);var C=D.intersection(this.visibleRect);var H=E.intersection(C);if(!E.equals(H)){this.doUpdateLine(F)}}}};DSPolyLine.prototype.calculateRect=function(C,D){var A=D.gridSystem.toXY(C[0],C[3]);var B=D.gridSystem.toXY(C[2],C[1]);return new Rectangle(A.y,A.x,B.y,B.x)};DSPolyLine.prototype.update=function(B){if(!this.eventsInited){this.eventsInited=true;this.map=B;var A=this;this.updateFunc=function(D,C){A.updateLine(D,C)};B.addEventListener("zoom",this.updateFunc);B.addEventListener("recenter",this.updateFunc)}};DSPolyLine.prototype.remove=function(){if(this.eventsInited){this.eventsInited=false;this.map.removeEventListener("zoom",this.updateFunc);this.map.removeEventListener("recenter",this.updateFunc)}};DSPolyLine.prototype.setVisibleArea=function(A){this.visibleArea=A;this.point=new LMI.Mapping.Point(A[3],A[0]);this.visibleRect=null};DSPolyLine.prototype.setLineUrl=function(B){this.url=B;if(LMI.Browser.browser==="Explorer"&&LMI.Browser.version<7){var C=this.element;var A=B.split("?",2);LMI.Element.setAlphaImageLoader(C,A[0]+"?"+A[1].replace(/%/g,"%25"))}else{this.element.src=B}};DSPolyLine.ImageLoad=function(A){var C=new LMI.BrowserEventObject(A,window.event,this);var B=C.getCurrentTarget();B.style.display="block";B.style.height="auto";B.style.width="auto"};function Rectangle(D,C,A,B){this.top=D;this.left=C;this.bottom=A;this.right=B}Rectangle.prototype.intersection=function(F,C){var B=Math.max(this.left,F.left);var E=Math.max(this.top,F.top);var A=Math.min(this.right,F.right);var D=Math.min(this.bottom,F.bottom);if(!C){C=new Rectangle()}C.top=E;C.left=B;C.bottom=D;C.right=A;return C};Rectangle.prototype.equals=function(A){return this.left==A.left&&this.top==A.top&&this.right==A.right&&this.bottom==A.bottom};var EQUITORIAL_EARTH_RADIUS_MEAN_METERS=6378245;var HALF_PI=Math.PI/2;(function(){var A=LMI.Lang.getObject("LMI.Mapping"),B=EQUITORIAL_EARTH_RADIUS_MEAN_METERS*0.000621371192;A.getDistance=function(I,G){if(I.equals(G)){return 0}var H=I.latAsRad(),F=G.latAsRad(),E=I.lngAsRad(),D=G.lngAsRad(),J=Math.cos,C=Math.sin;return Math.acos(J(H)*J(E)*J(F)*J(D)+J(H)*C(E)*J(F)*C(D)+C(H)*C(F))*B}})();function coord(A,B){this.x=A;this.y=B}coord.prototype.toString=function(){return"coord("+this.x+","+this.y+")"};function radians(A){return A*(Math.PI/180)}LMI.Mapping.Grid=function(G,D,B,C,H,A,F,E){this._P=G;this._x_grid_size=D;this._y_grid_size=B;this._x_upg=C;this._y_upg=H;this._invert_y=A;this._origin_lon=radians(F);this._origin_lat=radians(E);this.reset()};LMI.Mapping.Grid.prototype=(function(){return{reset:function(){var A=this._P.forward(this._origin_lon,this._origin_lat);this._x_translation=-A.x;this._y_translation=-A.y;this._x_scale=(this._x_upg/this._x_grid_size);this._y_scale=(this._y_upg/this._y_grid_size)*(this._invert_y?-1:1)},getXScale:function(){return this._x_scale},getYScale:function(){return this._y_scale},gridX:function(A){return Math.floor(A/this._x_upg)},gridY:function(A){return Math.floor(A/this._y_upg)},grid:function(A,C){if(arguments.length===1){var B=A;return new coord(this.gridX(B.x),this.gridY(B.y))}else{return new coord(this.gridX(A),this.gridY(C))}},offsetX:function(A){return A%this._x_upg},offsetY:function(A){return A%this._y_upg},offset:function(A,C){if(arguments.length===1){var B=A;return new coord(this.offsetX(B.x),this.offsetY(B.y))}else{return new coord(this.offsetX(A),this.offsetY(C))}},toX:function(A){var B=(arguments.length==2?arguments[1]:0);return(A*this._x_upg)+B},toY:function(A){var B=(arguments.length==2?arguments[1]:0);return(A*this._y_upg)+B},toXY:function(B,A,G,F){if(arguments.length==2){var E=B;var D=A;var C=this._P.forward(radians(E),radians(D));return new coord((C.x+this._x_translation)*this._x_scale,(C.y+this._y_translation)*this._y_scale)}else{return new coord(this.toX(B,A),this.toY(G,F))}},toLL:function(A,B){if(arguments.length==1){B=arguments[0].y;A=arguments[0].x}return this._P.inverse((A/this._x_scale)-this._x_translation,(B/this._y_scale)-this._y_translation)},getUL:function(C,B,D,A){var E=this.toXY(C,B);if(this._invert_y){return new coord(E.x-(D/2),E.y-(A/2))}else{return new coord(E.x-(D/2),E.y+(A/2))}},getLR:function(C,B,D,A){var E=this.toXY(C,B);if(this._invert_y){return new coord(E.x+(D/2),E.y+(A/2))}else{return new coord(E.x+(D/2),E.y-(A/2))}},getLL:function(C,B,D,A){var E=this.toXY(C,B);if(this._invert_y){return new coord(E.x-(D/2),E.y+(A/2))}else{return new coord(E.x-(D/2),E.y-(A/2))}},getUR:function(C,B,D,A){var E=this.toXY(C,B);if(this._invert_y){return new coord(E.x+(D/2),E.y-(A/2))}else{return new coord(E.x+(D/2),E.y+(A/2))}}}})();LMI.Mapping.Grid.newInstance=function(D,B,C,A,E){return new LMI.Mapping.Grid(new EquiRectangularMapProjection(radians(0),radians(E)),D,B,C,A,true,-180,90)};function EquiRectangularMapProjection(B,A){this._center_lon=B;this._center_lat=A;this._cos_center_lat=Math.cos(A);this._R=EQUITORIAL_EARTH_RADIUS_MEAN_METERS}function adjust_lon(A){if(A<-Math.PI){return A-(Math.floor(A/Math.PI)*Math.PI)}else{if(A>Math.PI){return -(Math.PI-A+(Math.floor(A/Math.PI)*Math.PI))}}return A}EquiRectangularMapProjection.prototype.forward=function(B,A){return new coord(this._R*adjust_lon(B-this._center_lon)*this._cos_center_lat,this._R*A)};EquiRectangularMapProjection.prototype.inverse=function(A,B){return LMI.Mapping.Point.fromRadians(Math.min(B/this._R,HALF_PI),adjust_lon(this._center_lon+A/(this._R*this._cos_center_lat)))};(function(){var D=LMI.Lang.getObject("LMI.Mapping",true),C=[1.7021276,3.4042553,6.80851064,13.61702128,27.23404256,54.46808512,108.93617024,217.87234048,435.74468096,871.48936192,1742.97872384,3485.95744768,6971.9148953,13943.82979072],B=[],A=false;D.Map=function(E,F){this.init(E,F)};D.Map.prototype={setZoomLevel:function(F,E){this.prepareEventObject();if(F<1){F=1}else{if(F>C.length){F=C.length}}if(this.zoomSlider&&this.zoomSlider.shown){this.zoomSlider.setPosition(((F-1)/(C.length-1)))}if(E&&!E.equals(this.getCenterPoint())){this.setCenterPoint(E)}this.zoomLevel=F;this.setScale();this.loadTiles();this.triggerEvent("zoom",this.getEventObject(),this)},bestFit:function(O,M){if(typeof O==="number"){this.factor=O}else{if(typeof this.factor==="number"){O=this.factor}else{this.factor=O=0.9}}M=M||this.objects;var J,G,T,H=null,E=null,I=new DSMapObject_Iterator(M);P=this.gridSystem._P;while(I.hasNext()){G=I.next();if(!G.isIncludedInBestFit()){continue}if(H===null){H=P.forward(G.point.lngAsRad(),G.point.latAsRad())}if(E===null){E=new coord(H.x,H.y)}T=P.forward(G.point.lngAsRad(),G.point.latAsRad());if(T.x<E.x){E.x=T.x}if(T.x>H.x){H.x=T.x}if(T.y<E.y){E.y=T.y}if(T.y>H.y){H.y=T.y}}if(H===null){if(this.getOption("defaultLat")&&this.getOption("defaultLng")&&this.getOption("emptyZoom")){this.centerAndZoom(new D.Point(this.getOption("defaultLat"),this.getOption("defaultLng")),this.getOption("emptyZoom"))}}else{if(E.x===H.x&&E.y===H.y){var Q=P.inverse(E.x,E.y);this.centerAndZoom(Q,this.getOption("singleZoom"))}else{var N=P.inverse((E.x+H.x)/2,(E.y+H.y)/2);var F=this.width*O;var R=this.height*O;var L=H.x-E.x;var K=H.y-E.y;L*=F/R;for(J=0;J<C.length;++J){if(L<=(F/B[J].getXScale())&&K<=Math.abs(R/B[J].getYScale())){break}}var S=Math.min(J,C.length-1);this.centerAndZoom(N,S+1)}}},centerOnPoint:function(E){if(!E.equals(this.getCenterPoint())){this.prepareEventObject();this.setCenterPoint(new D.Point(E.lat,E.lng));this.loadTiles();var F=this.getEventObject();this.triggerEvent("recenter",F,this)}},centerAndZoom:function(E,G){this.prepareEventObject();this.setZoomLevel(G,E);var F=this.getEventObject();this.triggerEvent("recenter",F,this)},init:function(E,G){var F=(typeof E==="string")?F=LMI.Element.getOne(E):E;if(!F){throw ('Map: unable to find container: "'+E+'"')}this.container=F;LMI.StyleSheet.addClass(F,"dsMap");this.initOptions(G);this.decorators=new DSMapDecoratorCollection();this.centerPoint=null;this.zoomLevel=C.length;this.locale=this.getOption("defaultLocale");if(!A){for(var H=0;H<C.length;++H){B[H]=LMI.Mapping.Grid.newInstance(C[H]*this.getOption("tileWidth"),C[H]*this.getOption("tileHeight"),this.getOption("tileWidth"),this.getOption("tileHeight"),this.getOption("standardParallel"))}A=true}var I=new Date().getYear();if(I<1000){I+=1900}this.copyrightTxt="\xa9"+I+" Local Matters, Inc.";this.copyrightSet=DSMapCopyrightSet;this.setScale();this.setGridLeft(null);this.setGridTop(null);this.columns=this.rows=0;this.initContainer();this.tileUrlFactory=new DSMapTileUrlFactory(this.getOption("tileBase"),"",this.getOption("tileExtension"),this,this.getOption("tileSuffix"));this.objects=new DSMapObject_Collection();this.initEvents("zoom","recenter","resize")},initOptions:function(E){this.options=LMI.Mapping.Map.Defaults;if(typeof E!="undefined"){for(var F in E){this.options[F]=E[F]}}},setLocale:function(E){this.locale=E;this.tileUrlFactory.setLocale(E)},setOption:function(E,F){this.options[E]=F},getOption:function(E){return this.options[E]||""},addDecorator:function(E){this.decorators.push(E);this.decoratorLayer.appendChild(E.getElement())},removeDecorator:function(G){var E=this.decorators.getLength();for(var F=0;F<E;++F){if(this.decorators.getByIndex(F)===G){this.decorators.remove(F);this.decoratorLayer.removeChild(G.getElement());return }}},positionTile:function(F){var E=this.tiles[F];E.setLeft(((F%this.columns)*E.getWidth()+this.mlOffsetLeft)+"px");E.setTop((Math.floor(F/this.columns)*E.getHeight()+this.mlOffsetTop)+"px")},prepareEventObject:function(){this.beforeEvent={previousZoomLevel:this.zoomLevel,previousCenter:this.getCenterPoint()}},getEventObject:function(){var E=this.beforeEvent;this.beforeEvent={};E.zoomLevel=this.zoomLevel;E.center=this.getCenterPoint();return E},setCopyright:function(E){this.copyright.getElement().firstChild.nodeValue=this.copyrightTxt=E},setGridLeft:function(E){return(this.gridLeft=E)},getGridLeft:function(){return this.gridLeft},setGridTop:function(E){return(this.gridTop=E)},getGridTop:function(){return this.gridTop},getScale:function(E){if(typeof E=="number"){return C[E-1]}return this.scale},setScale:function(){this.scale=C[this.zoomLevel-1];this.gridSystem=B[this.zoomLevel-1]},positionMap:function(){var E=this.getMapLayerXYByPoint(this.getCenterPoint());this.mapLayer.style.left=Math.round((this.width/2)-E.x)+"px";this.mapLayer.style.top=Math.round((this.height/2)-E.y)+"px"},updateTiles:function(){for(var E=0;E<this.tiles.length;++E){this.tiles[E].setSize(this.getOption("tileWidth"),this.getOption("tileHeight"));this.positionTile(E)}this.updateDataCopyright()},updateMap:function(){this.updateTiles()},calculateGridPosition:function(){var F=this.getCenterPoint();var E=this.gridSystem.getUL(F.lng,F.lat,this.mapLayerWidth,this.mapLayerHeight);var G=this.gridSystem.grid(E);this.setGridLeft(G.x);this.setGridTop(G.y)},loadTiles:function(){this.mlOffsetTop=this.mlOffsetLeft=0;var G=0;this.calculateGridPosition();for(var F=this.getGridTop();F<this.getGridTop()+this.rows;++F){for(var E=this.getGridLeft();E<this.getGridLeft()+this.columns;++E){this.tiles[G++].setUrl(this.tileUrlFactory.getUrl(E,F,this.zoomLevel))}}this.updateMap();this.positionMap();this.updateObjects()},updateObjects:function(){for(var E=new DSMapObject_Iterator(this.objects);E.hasNext();){this.positionObject(E.next())}},getMapLayerULXY:function(){var E=this.mapLayer.style;return new coord(parseInt(E.left,10),parseInt(E.top,10))},getMapLayerXYByPoint:function(G){if(this.getGridLeft()!==null&&this.getGridTop()!==null){var E=this.gridSystem.toX(this.getGridLeft());var H=this.gridSystem.toY(this.getGridTop());var F=this.gridSystem.toXY(G.lng,G.lat);return new coord(Math.round(F.x-E),Math.round(F.y-H))}return null},getXYByPoint:function(F){var E=this.getMapLayerXYByPoint(F);if(E){E.x+=this.getMapLeft();E.y+=this.getMapTop()}return E},getPointByMapLayerXY:function(E,F){if(this.getGridLeft()!==null&&this.getGridTop()!==null){return this.gridSystem.toLL(this.gridSystem.toXY(this.getGridLeft(),E-this.mlOffsetLeft,this.getGridTop(),F-this.mlOffsetTop))}return null},getPointByXY:function(E,F){return this.getPointByMapLayerXY(E-this.getMapLeft(true),F-this.getMapTop(true))},setCenterPoint:function(E){this.centerPoint=E},getCenterPoint:function(){return this.centerPoint},getMapLayerCenterXY:function(){return new coord((this.width/2)-this.getMapLeft(),(this.height/2)-this.getMapTop())},getULPoint:function(){return this.getPointByXY(0,0)},getBRPoint:function(){return this.getPointByXY(this.width,this.height)},getURPoint:function(){return this.getPointByXY(this.width,0)},getBLPoint:function(){return this.getPointByXY(0,this.height)},calculateCenterPoint:function(){return this.getPointByXY(Math.floor(this.width/2),Math.floor(this.height/2))},recalculateCenterPoint:function(){this.setCenterPoint(this.calculateCenterPoint())},getMapLayerLLPoint:function(){var F=this.getCenterPoint();var E=this.gridSystem.getLL(F.lng,F.lat,this.mapLayerWidth,this.mapLayerHeight);return this.gridSystem.toLL(E.x,E.y)},getMapLayerURPoint:function(){var F=this.getCenterPoint();var E=this.gridSystem.getUR(F.lng,F.lat,this.mapLayerWidth,this.mapLayerHeight);return this.gridSystem.toLL(E.x,E.y)},positionObject:function(G,E){if(typeof E!="undefined"){G.setPoint(E)}var F=this.getMapLayerXYByPoint(G.point);if(F){G.element.style.left=(F.x-G.xOffset+this.mlOffsetLeft)+"px";G.element.style.top=(F.y-G.yOffset+this.mlOffsetTop)+"px"}G.update(this)},addObject:function(E){var F=this.objects.add(E);E.element.style.position="absolute";E.z=5+E.zOffset;E.element.style.zIndex=E.z;this.positionObject(E);this.mapLayer.appendChild(E.element);return F},removeObject:function(H){var I=-1;if(typeof H==="object"){for(var F=new DSMapObject_Iterator(this.objects);F.hasNext();){var E=F.next();if(E===H){I=F.getId();break}}}else{I=H}var G=this.objects.getById(I);if(G){G.remove(this);this.mapLayer.removeChild(G.element);this.objects.remove(I)}},removeAll:function(){var F;for(var E=new DSMapObject_Iterator(this.objects);E.hasNext();){F=E.next();F.remove(this);F.element.parentNode.removeChild(F.element)}this.objects.removeAll()},updateDataCopyright:function(){if(!this.dataCopyright){var F=LMI.Element.create("div",null,{textValue:" ",className:"dataCopyright"});var E={zIndex:100,bottom:0};if(this.width>=250){E.right=0}else{E.left=0}this.dataCopyright=new DSMapDecorator(this,F,E,"copyright","data copyright");this.addDecorator(this.dataCopyright)}this.dataCopyright.getElement().firstChild.nodeValue=this.copyrightSet.getCopyright(this.getCenterPoint(),this.zoomLevel)},addCopyright:function(){var E=LMI.Element.create("div",null,{textValue:this.copyrightTxt});LMI.StyleSheet.addClass(E,"copyright");this.copyright=new DSMapDecorator(this,E,{bottom:this.width>=250?0:10},"copyright","main copyright");this.addDecorator(this.copyright);this.updateDataCopyright()},sizeLayers:function(){this.width=parseInt(this.container.clientWidth,10);this.height=parseInt(this.container.clientHeight,10);this.desiredRows=Math.ceil(this.height/this.getOption("tileHeight"))+2;this.desiredColumns=Math.ceil(this.width/this.getOption("tileWidth"))+2;this.mapLayerWidth=this.desiredColumns*this.getOption("tileWidth");this.mapLayerHeight=this.desiredRows*this.getOption("tileHeight");this.mapLayer.style.height=this.mapLayerHeight+"px";this.mapLayer.style.width=this.mapLayerWidth+"px";this.viewport.style.height=this.height+"px";this.viewport.style.width=this.width+"px";this.decoratorLayer.style.height=this.height+"px";this.decoratorLayer.style.width=this.width+"px"},initContainer:function(){this.decoratorLayer=LMI.Element.create("div",this.container,{"class":"decLayer"});this.viewport=LMI.Element.create("div",this.decoratorLayer,{"class":"viewport"});this.mapLayer=LMI.Element.create("div",this.viewport,{"class":"mapLayer"});this.tileLayer=LMI.Element.create("div",this.mapLayer,{"class":"tileLayer"});if(!this.getOption("controlBuffer")){this.setOption("controlBuffer",0)}this.sizeLayers();this.tiles=[];for(var F=0;F<this.desiredRows;++F){for(var E=0;E<this.desiredColumns;++E){this.tiles.push(new D.Tile(this,this.tileLayer))}}this.rows=this.desiredRows;this.columns=this.desiredColumns;this.mlOffsetTop=this.mlOffsetLeft=0;this.addCopyright()},getMapLeft:function(F){var E=parseInt(this.mapLayer.offsetLeft,10);if(!F){E+=this.mlOffsetLeft}return E},getMapTop:function(E){var F=parseInt(this.mapLayer.offsetTop,10);if(!E){F+=this.mlOffsetTop}return F}};LMI.Lang.importFunctions(D.Map,LMI.Event);D.Map.setScales=function(E){C=E};D.Map.getScales=function(){return C}})();LMI.Mapping.Map.Defaults={singleZoom:3,emptyZoom:14,defaultLat:39.73926,defaultLng:-104.98478,defaultLocale:"",imageBase:"img/",pixelUrl:"img/pixel_trans.gif",brokenUrl:"img/map_unavailable.gif",tileBase:"http://localhost/tiles/",tileExtension:".png",tileSuffix:"",tileWidth:256,tileHeight:256,tileAttempts:1,standardParallel:40};(function(){var B={};LMI.Mapping.Tile=function(D,C){this.map=D;this.img=LMI.Element.create("img",C,{src:D.getOption("pixelUrl"),style:"position: absolute;",galleryImg:"no"});LMI.StyleSheet.setOpacity(this.img,0);LMI.BrowserEvent.bind(this.img,"load",this,this.load);LMI.BrowserEvent.bind(this.img,"error",this,this.error)};LMI.Mapping.Tile.prototype={error:function(){var E=this.img,D=this.map.getOption("tileAttempts"),G=this.map.getOption("brokenUrl"),C=this.map.getOption("pixelUrl");if(!B[E.src]){B[E.src]=1}if(B[E.src]++<D){var F=E.src;E.src=C;E.src=F}else{if(!E.src.match(G)){E.src=G}}},load:function(D){var C;if("Animation" in LMI){C=new LMI.Animation.Fade(this.img,0,100);C.setDuration(0.75);if(LMI.Browser.browser=="Explorer"){C.bindEvent("end",this,function(){this.img.style.filter=""})}C.start()}else{LMI.StyleSheet.setOpacity(this.img,100)}},removeFromDom:function(){LMI.Element.destroy(this.img)},setSize:function(D,C){this.width=this.img.width=D;this.height=this.img.height=C},getWidth:function(){return this.width},getHeight:function(){return this.height},setLeft:function(C){this.img.style.left=C},setTop:function(C){this.img.style.top=C},setUrl:function(C){if(this.loadTimeout){window.clearTimeout(this.loadTimeout);this.loadTimeout=null}if(typeof this.img.complete!="undefined"&&!this.img.complete){var D=this;this.loadTimeout=window.setTimeout(function(){D.loadTimeout=null;D.setUrl(C)},1000);return }if(C){if(this.img.src!=C){LMI.StyleSheet.setOpacity(this.img,1);A(this.img,C)}}else{A(this.img,this.map.getOption("brokenUrl"))}}};function A(C,D){window.setTimeout(function(){C.src=D},0)}})();var DSMapCopyrightSet=new DSCopyrightSet();(function(){var D=new Date().getYear(),E=LMI.Mapping.Point;if(D<1000){D+=1900}var C=new DSCopyright("\xa9"+D+" NAVTEQ",[new DSBoundingBox(new E(10,-135),new E(70,-60)),new DSBoundingBox(new E(48,-180),new E(75,-124)),new DSBoundingBox(new E(16.860777,-161.283172),new E(24.219651,-153.424705)),new DSBoundingBox(new E(12.5,-78.6),new E(33,-50))]);var B=new DSCopyright("\xa9"+D+" TeleAtlas",[new DSBoundingBox(new E(48.478825,1.322422),new E(52.521175,7.677558)),new DSBoundingBox(new E(31,-10),new E(44,5)),new DSBoundingBox(new E(48,-0.6),new E(56,11.5)),new DSBoundingBox(new E(46,-20),new E(61,4.7))]);var A="\xa9"+D+" Terralink Intl Ltd";DSMapCopyrightSet.addCopyright(C);DSMapCopyrightSet.addCopyright(B);DSMapCopyrightSet.addCopyright(new DSCopyright(A,new DSBoundingBox(new E(-70,133),new E(-11,180))))})();if(DWREngine==null){var DWREngine={}}DWREngine.setErrorHandler=function(A){DWREngine._errorHandler=A};DWREngine.setWarningHandler=function(A){DWREngine._warningHandler=A};DWREngine.setTimeout=function(A){DWREngine._timeout=A};DWREngine.setPreHook=function(A){DWREngine._preHook=A};DWREngine.setPostHook=function(A){DWREngine._postHook=A};DWREngine.XMLHttpRequest=1;DWREngine.IFrame=2;DWREngine.setMethod=function(A){if(A!=DWREngine.XMLHttpRequest&&A!=DWREngine.IFrame){DWREngine._handleError("Remoting method must be one of DWREngine.XMLHttpRequest or DWREngine.IFrame");return }DWREngine._method=A};DWREngine.setVerb=function(A){if(A!="GET"&&A!="POST"){DWREngine._handleError("Remoting verb must be one of GET or POST");return }DWREngine._verb=A};DWREngine.setOrdered=function(A){DWREngine._ordered=A};DWREngine.setAsync=function(A){DWREngine._async=A};DWREngine.setTextHtmlHandler=function(A){DWREngine._textHtmlHandler=A};DWREngine.defaultMessageHandler=function(A){if(typeof A=="object"&&A.name=="Error"&&A.description){alert("Error: "+A.description)}else{if(A.toString().indexOf("0x80040111")==-1){alert(A)}}};DWREngine.beginBatch=function(){if(DWREngine._batch){DWREngine._handleError("Batch already started.");return }DWREngine._batch={map:{callCount:0},paramCount:0,ids:[],preHooks:[],postHooks:[]}};DWREngine.endBatch=function(B){var A=DWREngine._batch;if(A==null){DWREngine._handleError("No batch in progress.");return }if(B&&B.preHook){A.preHooks.unshift(B.preHook)}if(B&&B.postHook){A.postHooks.push(B.postHook)}if(DWREngine._preHook){A.preHooks.unshift(DWREngine._preHook)}if(DWREngine._postHook){A.postHooks.push(DWREngine._postHook)}if(A.method==null){A.method=DWREngine._method}if(A.verb==null){A.verb=DWREngine._verb}if(A.async==null){A.async=DWREngine._async}if(A.timeout==null){A.timeout=DWREngine._timeout}A.completed=false;DWREngine._batch=null;if(!DWREngine._ordered){DWREngine._sendData(A);DWREngine._batches[DWREngine._batches.length]=A}else{if(DWREngine._batches.length==0){DWREngine._sendData(A);DWREngine._batches[DWREngine._batches.length]=A}else{DWREngine._batchQueue[DWREngine._batchQueue.length]=A}}};DWREngine._errorHandler=DWREngine.defaultMessageHandler;DWREngine._warningHandler=null;DWREngine._preHook=null;DWREngine._postHook=null;DWREngine._batches=[];DWREngine._batchQueue=[];DWREngine._handlersMap={};DWREngine._method=DWREngine.XMLHttpRequest;DWREngine._verb="POST";DWREngine._ordered=false;DWREngine._async=true;DWREngine._batch=null;DWREngine._timeout=0;DWREngine._DOMDocument=["Msxml2.DOMDocument.6.0","Msxml2.DOMDocument.5.0","Msxml2.DOMDocument.4.0","Msxml2.DOMDocument.3.0","MSXML2.DOMDocument","MSXML.DOMDocument","Microsoft.XMLDOM"];DWREngine._XMLHTTP=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.5.0","Msxml2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];DWREngine._execute=function(N,D,L,K){var H=false;if(DWREngine._batch==null){DWREngine.beginBatch();H=true}var J=[];for(var G=0;G<arguments.length-3;G++){J[G]=arguments[G+3]}if(DWREngine._batch.path==null){DWREngine._batch.path=N}else{if(DWREngine._batch.path!=N){DWREngine._handleError("Can't batch requests to multiple DWR Servlets.");return }}var F;var C;var E=J[0];var M=J[J.length-1];if(typeof E=="function"){C={callback:J.shift()};F=J}else{if(typeof M=="function"){C={callback:J.pop()};F=J}else{if(M!=null&&typeof M=="object"&&M.callback!=null&&typeof M.callback=="function"){C=J.pop();F=J}else{if(E==null){if(M==null&&J.length>2){DWREngine._handleError("Ambiguous nulls at start and end of parameter list. Which is the callback function?")}C={callback:J.shift()};F=J}else{if(M==null){C={callback:J.pop()};F=J}else{DWREngine._handleError("Missing callback function or metadata object.");return }}}}}var B=Math.floor(Math.random()*10001);var A=(B+"_"+new Date().getTime()).toString();var I="c"+DWREngine._batch.map.callCount+"-";DWREngine._batch.ids.push(A);if(C.method!=null){DWREngine._batch.method=C.method;delete C.method}if(C.verb!=null){DWREngine._batch.verb=C.verb;delete C.verb}if(C.async!=null){DWREngine._batch.async=C.async;delete C.async}if(C.timeout!=null){DWREngine._batch.timeout=C.timeout;delete C.timeout}if(C.preHook!=null){DWREngine._batch.preHooks.unshift(C.preHook);delete C.preHook}if(C.postHook!=null){DWREngine._batch.postHooks.push(C.postHook);delete C.postHook}if(C.errorHandler==null){C.errorHandler=DWREngine._errorHandler}if(C.warningHandler==null){C.warningHandler=DWREngine._warningHandler}DWREngine._handlersMap[A]=C;DWREngine._batch.map[I+"scriptName"]=D;DWREngine._batch.map[I+"methodName"]=L;DWREngine._batch.map[I+"id"]=A;for(G=0;G<F.length;G++){DWREngine._serializeAll(DWREngine._batch,[],F[G],I+"param"+G)}DWREngine._batch.map.callCount++;if(H){DWREngine.endBatch()}};DWREngine._sendData=function(F){if(F.map.callCount==0){return }for(var E=0;E<F.preHooks.length;E++){F.preHooks[E]()}F.preHooks=null;if(F.timeout&&F.timeout!=0){F.interval=setInterval(function(){DWREngine._abortRequest(F)},F.timeout)}var H;if(F.map.callCount==1){H=F.map["c0-scriptName"]+"."+F.map["c0-methodName"]+".dwr"}else{H="Multiple."+F.map.callCount+".dwr"}if(F.method==DWREngine.XMLHttpRequest){if(window.XMLHttpRequest){F.req=new XMLHttpRequest()}else{if(window.ActiveXObject&&!(navigator.userAgent.indexOf("Mac")>=0&&navigator.userAgent.indexOf("MSIE")>=0)){F.req=DWREngine._newActiveXObject(DWREngine._XMLHTTP)}}}var K="";var A;if(F.req){F.map.xml="true";if(F.async){F.req.onreadystatechange=function(){DWREngine._stateChange(F)}}var B=navigator.userAgent.indexOf("Safari/");if(B>=0){var I=navigator.userAgent.substring(B+7);if(parseInt(I,10)<400){F.verb=="GET"}}if(F.verb=="GET"){F.map.callCount=""+F.map.callCount;for(A in F.map){var D=encodeURIComponent(A);var L=encodeURIComponent(F.map[A]);if(L==""){DWREngine._handleError("Found empty qval for qkey="+D)}K+=D+"="+L+"&"}try{var C=F.path;if(C.indexOf(";")>=0){C=C.replace(/(;.*)/,"/exec/"+H+"?"+K+"$1")}else{C+="/exec/"+H+"?"+K}F.req.open("GET",C,F.async);F.req.send(null);if(!F.async){DWREngine._stateChange(F)}}catch(J){DWREngine._handleMetaDataError(null,J)}}else{for(A in F.map){if(typeof F.map[A]!="function"){K+=A+"="+F.map[A]+"\n"}}var C=F.path;if(C.indexOf(";")>=0){C=C.replace(/(;.*)/,"/exec/"+H+"$1")}else{C+="/exec/"+H}try{F.req.open("POST",C,F.async);F.req.setRequestHeader("Content-Type","text/plain");F.req.send(K);if(!F.async){DWREngine._stateChange(F)}}catch(J){DWREngine._handleMetaDataError(null,J)}}}else{F.map.xml="false";var G="dwr-if-"+F.map["c0-id"];F.div=document.createElement("div");F.div.innerHTML="<iframe src='javascript:void(0)' frameborder='0' width='0' height='0' id='"+G+"' name='"+G+"'></iframe>";document.body.appendChild(F.div);F.iframe=document.getElementById(G);F.iframe.setAttribute("style","width:0px; height:0px; border:0px;");if(F.verb=="GET"){for(A in F.map){if(typeof F.map[A]!="function"){K+=encodeURIComponent(A)+"="+encodeURIComponent(F.map[A])+"&"}}K=K.substring(0,K.length-1);F.iframe.setAttribute("src",F.path+"/exec/"+H+"?"+K);document.body.appendChild(F.iframe)}else{F.form=document.createElement("form");F.form.setAttribute("id","dwr-form");F.form.setAttribute("action",F.path+"/exec"+H);F.form.setAttribute("target",G);F.form.target=G;F.form.setAttribute("method","POST");for(A in F.map){var M=document.createElement("input");M.setAttribute("type","hidden");M.setAttribute("name",A);M.setAttribute("value",F.map[A]);F.form.appendChild(M)}document.body.appendChild(F.form);F.form.submit()}}};DWREngine._stateChange=function(batch){if(!batch.completed&&batch.req.readyState==4){try{var reply=batch.req.responseText;if(reply==null||reply==""){DWREngine._handleMetaDataWarning(null,"No data received from server")}else{var contentType=batch.req.getResponseHeader("Content-Type");if(!contentType.match(/^text\/plain/)&&!contentType.match(/^text\/javascript/)){if(DWREngine._textHtmlHandler&&contentType.match(/^text\/html/)){DWREngine._textHtmlHandler()}else{DWREngine._handleMetaDataWarning(null,"Invalid content type from server: '"+contentType+"'")}}else{if(reply.search("DWREngine._handle")==-1){DWREngine._handleMetaDataWarning(null,"Invalid reply from server")}else{eval(reply)}}}DWREngine._clearUp(batch)}catch(ex){if(ex==null){ex="Unknown error occured"}DWREngine._handleMetaDataWarning(null,ex)}finally{if(DWREngine._batchQueue.length!=0){var sendbatch=DWREngine._batchQueue.shift();DWREngine._sendData(sendbatch);DWREngine._batches[DWREngine._batches.length]=sendbatch}}}};DWREngine._handleResponse=function(E,D){var A=DWREngine._handlersMap[E];DWREngine._handlersMap[E]=null;if(A){try{if(A.callback){A.callback(D)}}catch(C){DWREngine._handleMetaDataError(A,C)}}if(DWREngine._method==DWREngine.IFrame){var B=DWREngine._batches[DWREngine._batches.length-1];if(B.map["c"+(B.map.callCount-1)+"-id"]==E){DWREngine._clearUp(B)}}};DWREngine._handleServerError=function(C,B){var A=DWREngine._handlersMap[C];DWREngine._handlersMap[C]=null;if(B.message){DWREngine._handleMetaDataError(A,B.message,B)}else{DWREngine._handleMetaDataError(A,B)}};DWREngine._eval=function(script){return eval(script)};DWREngine._abortRequest=function(B){if(B&&!B.completed){clearInterval(B.interval);DWREngine._clearUp(B);if(B.req){B.req.abort()}var A;for(var C=0;C<B.ids.length;C++){A=DWREngine._handlersMap[B.ids[C]];DWREngine._handleMetaDataError(A,"Timeout")}}};DWREngine._clearUp=function(A){if(A.completed){DWREngine._handleError("Double complete");return }if(A.div){A.div.parentNode.removeChild(A.div)}if(A.iframe){A.iframe.parentNode.removeChild(A.iframe)}if(A.form){A.form.parentNode.removeChild(A.form)}if(A.req){delete A.req}for(var B=0;B<A.postHooks.length;B++){A.postHooks[B]()}A.postHooks=null;for(var B=0;B<DWREngine._batches.length;B++){if(DWREngine._batches[B]==A){DWREngine._batches.splice(B,1);break}}A.completed=true};DWREngine._handleError=function(B,A){if(DWREngine._errorHandler){DWREngine._errorHandler(B,A)}};DWREngine._handleWarning=function(B,A){if(DWREngine._warningHandler){DWREngine._warningHandler(B,A)}};DWREngine._handleMetaDataError=function(A,C,B){if(A&&typeof A.errorHandler=="function"){A.errorHandler(C,B)}else{DWREngine._handleError(C,B)}};DWREngine._handleMetaDataWarning=function(A,C,B){if(A&&typeof A.warningHandler=="function"){A.warningHandler(C,B)}else{DWREngine._handleWarning(C,B)}};DWREngine._serializeAll=function(B,D,C,A){if(C==null){B.map[A]="null:null";return }switch(typeof C){case"boolean":B.map[A]="boolean:"+C;break;case"number":B.map[A]="number:"+C;break;case"string":B.map[A]="string:"+encodeURIComponent(C);break;case"object":if(C instanceof String){B.map[A]="String:"+encodeURIComponent(C)}else{if(C instanceof Boolean){B.map[A]="Boolean:"+C}else{if(C instanceof Number){B.map[A]="Number:"+C}else{if(C instanceof Date){B.map[A]="Date:"+C.getTime()}else{if(C instanceof Array){B.map[A]=DWREngine._serializeArray(B,D,C,A)}else{B.map[A]=DWREngine._serializeObject(B,D,C,A)}}}}}break;case"function":break;default:DWREngine._handleWarning("Unexpected type: "+typeof C+", attempting default converter.");B.map[A]="default:"+C;break}};DWREngine._lookup=function(E,C,A){var D;for(var B=0;B<E.length;B++){if(E[B].data==C){D=E[B];break}}if(D){return"reference:"+D.name}E.push({data:C,name:A});return null};DWREngine._serializeObject=function(C,H,G,B){var F=DWREngine._lookup(H,G,B);if(F){return F}if(G.nodeName&&G.nodeType){return DWREngine._serializeXml(C,H,G,B)}var E="Object:{";var D;for(D in G){C.paramCount++;var A="c"+DWREngine._batch.map.callCount+"-e"+C.paramCount;DWREngine._serializeAll(C,H,G[D],A);E+=encodeURIComponent(D)+":reference:"+A+", "}if(E.substring(E.length-2)==", "){E=E.substring(0,E.length-2)}E+="}";return E};DWREngine._serializeXml=function(C,F,E,B){var D=DWREngine._lookup(F,E,B);if(D){return D}var A;if(window.XMLSerializer){A=new XMLSerializer().serializeToString(E)}else{A=E.toXml}return"XML:"+encodeURIComponent(A)};DWREngine._serializeArray=function(C,H,G,B){var F=DWREngine._lookup(H,G,B);if(F){return F}var E="Array:[";for(var D=0;D<G.length;D++){if(D!=0){E+=","}C.paramCount++;var A="c"+DWREngine._batch.map.callCount+"-e"+C.paramCount;DWREngine._serializeAll(C,H,G[D],A);E+="reference:";E+=A}E+="]";return E};DWREngine._unserializeDocument=function(A){var C;if(window.DOMParser){var E=new DOMParser();C=E.parseFromString(A,"text/xml");if(!C.documentElement||C.documentElement.tagName=="parsererror"){var B=C.documentElement.firstChild.data;B+="\n"+C.documentElement.firstChild.nextSibling.firstChild.data;throw B}return C}else{if(window.ActiveXObject){C=DWREngine._newActiveXObject(DWREngine._DOMDocument);C.loadXML(A);return C}else{var D=document.createElement("div");D.innerHTML=A;return D}}};DWREngine._newActiveXObject=function(A){var D;for(var C=0;C<A.length;C++){try{D=new ActiveXObject(A[C]);break}catch(B){}}return D};if(typeof window.encodeURIComponent==="undefined"){DWREngine._utf8=function(B){B=""+B;var E;var D;var A="";var C=0;while(C<B.length){E=B.charCodeAt(C++);if(E>=56320&&E<57344){continue}if(E>=55296&&E<56320){if(C>=B.length){continue}D=B.charCodeAt(C++);if(D<56320||E>=56832){continue}E=((E-55296)<<10)+(D-56320)+65536}if(E<128){A+=String.fromCharCode(E)}else{if(E<2048){A+=String.fromCharCode(192+(E>>6),128+(E&63))}else{if(E<65536){A+=String.fromCharCode(224+(E>>12),128+(E>>6&63),128+(E&63))}else{A+=String.fromCharCode(240+(E>>18),128+(E>>12&63),128+(E>>6&63),128+(E&63))}}}}return A};DWREngine._hexchars="0123456789ABCDEF";DWREngine._toHex=function(A){return DWREngine._hexchars.charAt(A>>4)+DWREngine._hexchars.charAt(A&15)};DWREngine._okURIchars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-";window.encodeURIComponent=function(C){C=DWREngine._utf8(C);var D;var A="";for(var B=0;B<C.length;B++){if(DWREngine._okURIchars.indexOf(C.charAt(B))==-1){A+="%"+DWREngine._toHex(C.charCodeAt(B))}else{A+=C.charAt(B)}}return A}}if(typeof Array.prototype.splice==="undefined"){Array.prototype.splice=function(C,B){if(arguments.length==0){return C}if(typeof C!="number"){C=0}if(C<0){C=Math.max(0,this.length+C)}if(C>this.length){if(arguments.length>2){C=this.length}else{return[]}}if(arguments.length<2){B=this.length-C}B=(typeof B=="number")?Math.max(0,B):0;removeArray=this.slice(C,C+B);endArray=this.slice(C+B);this.length=C;for(var A=2;A<arguments.length;A++){this[this.length]=arguments[A]}for(A=0;A<endArray.length;A++){this[this.length]=endArray[A]}return removeArray}}if(typeof Array.prototype.shift==="undefined"){Array.prototype.shift=function(C){var B=this[0];for(var A=1;A<this.length;++A){this[A-1]=this[A]}this.length--;return B}}if(typeof Array.prototype.unshift==="undefined"){Array.prototype.unshift=function(){var B=unshift.arguments.length;for(var A=this.length-1;A>=0;--A){this[A+B]=this[A]}for(A=0;A<B;++A){this[A]=unshift.arguments[A]}}}if(typeof Array.prototype.push==="undefined"){Array.prototype.push=function(){var B=this.length;for(var A=0;A<push.arguments.length;++A){this[B]=push.arguments[A];B++}}}if(typeof Array.prototype.pop==="undefined"){Array.prototype.pop=function(){var A=this[this.length-1];this.length--;return A}}LMI.AjaxController=(function(){function G(I,H){if(typeof D==="function"){D.apply(this,arguments)}}var F,B,E,D,C="mapping",A={getNearestRouteSegment:function(J,H,I){DWREngine._execute(F,C,"getNearestRouteSegment",J,H.lat,H.lng,I,B,E)},editListingNote:function(J,I,H){DWREngine._execute(F,C,"editListingNote",J,I,H,B,E)},saveSavedLocation:function(L,K,I,H,J){DWREngine._execute(F,C,"saveSavedLocation",L,K,I,H,J,B,E)},saveSavedLocationLatLng:function(N,M,J,H,L,I,K){DWREngine._execute(F,C,"saveSavedLocation",N,M,J,H,L,I,K,B,E)},getSearchCount:function(M,J,L,H,K,I){DWREngine._execute(F,C,"getSearchCount",M,J,L,H,K,I,B,E)},addToMyList:function(J,H,I){DWREngine._execute(F,C,"addToMyList",J,H,I,B,E)},getLocations:function(K,M,I,L,J,H){if(K==="poi"){A.getPois(M,I,L,J,H)}else{if(K==="myplaces"){A.getNearbySavedLocations(M,L,J,H)}}},getPois:function(L,I,K,J,H){DWREngine._execute(F,C,"getPois",L,I,K,J,H,B,E)},getNearbySavedLocations:function(K,J,I,H){DWREngine._execute(F,C,"getNearbySavedLocations",K,J,I,H,B,E)},getRouteImageUrl:function(L,J,I,H,K){DWREngine._execute(F,C,"getRouteImageUrl",L,J,I,H,K,B,E,"png")},getPrintRouteImageUrl:function(L,J,I,H,K){DWREngine._execute(F,C,"getRouteImageUrl",L,J,I,H,K,B,E,"gif")},removeSavedLocations:function(I,H){DWREngine._execute(F,C,"removeSavedLocations",I,H,B,E)},getAdvertiserPois:function(M,I,J,L,H,K){DWREngine._execute(F,C,"getAdvertiserPois",M,I,J,L,H,K.llLat,K.llLng,K.urLat,K.urLng,K.width,K.height,K.zoomLevel,B,E)},getPath:function(){return F},getClassName:function(){return C},setMessageHandler:function(H){D=H}};LMI.Init.addFunction(function(){F=LMI.Urls.get("dwr");B=LMI.Lang.getObject("LMI.Data.state.visitorVO.uid");E=LMI.Lang.getObject("LMI.Data.state.visitorVO.passwordToken");DWREngine.setErrorHandler(G);DWREngine.setWarningHandler(G)});return A})();function DSControls(){}LMI.Lang.importFunctions(DSControls,LMI.Event);DSControls.DSSlider=function(B,A){this.slider=B;this.thumb=A;this.initEvents("startSlide","slide","endSlide");LMI.BrowserEvent.preventEvent(this.slider,"dblclick");LMI.BrowserEvent.preventEvent(this.thumb,"dblclick");var C={lockX:true};this.thumbDragger=new DSInteraction.Drag(this.thumb,C);this.thumbDragger.bindEvent("startDrag",this,this.startSlide);this.thumbDragger.bindEvent("endDrag",this,this.endSlide);this.thumbDragger.bindEvent("drag",this,this.slide);LMI.BrowserEvent.bind(this.slider,"mousedown",this,this.sliderClick)};LMI.Lang.extend(DSControls.DSSlider,DSControls);DSControls.DSSlider.prototype.initHeights=function(){if(!this.usableHeight){this.usableHeight=this.slider.height-this.thumb.height;this.top=parseInt(this.slider.style.top);this.thumbDragger.options.minY=this.top;this.thumbDragger.options.maxY=this.top+this.usableHeight}};DSControls.DSSlider.prototype.getPosition=function(){this.initHeights();var A=(parseInt(this.thumb.style.top)-this.top)/this.usableHeight;return A};DSControls.DSSlider.prototype.setPosition=function(A){this.initHeights();this.thumb.style.top=this.top+Math.round(A*this.usableHeight)+"px";return A};DSControls.DSSlider.prototype.startSlide=function(){this.triggerEvent("startSlide",{position:this.getPosition()},this)};DSControls.DSSlider.prototype.endSlide=function(){this.triggerEvent("endSlide",{position:this.getPosition()},this)};DSControls.DSSlider.prototype.slide=function(){this.triggerEvent("slide",{position:this.getPosition()},this)};DSControls.DSSlider.prototype.sliderClick=function(A){if(A.getMouseButton()===0){if(!this.offsetTop){this.offsetTop=LMI.Element.getOffsets(this.slider.parentNode).y}var B=A.getPageY();this.thumb.style.top=(B-this.offsetTop-(this.thumb.height/2))+"px";this.thumbDragger.startDrag(A)}};function DSCollection(){this.init()}DSCollection.prototype.init=function(){this.collection=[]};DSCollection.prototype.getLength=function(){return this.collection.length};DSCollection.prototype.getByIndex=function(A){return this.collection[A]};DSCollection.prototype.push=function(){for(var A=0;A<arguments.length;++A){this.collection.push(arguments[A])}};DSCollection.prototype.remove=function(A){this.collection.splice(A,1)};function DSIterator(A){this.pos=0;this.collection=A}DSIterator.prototype.hasNext=function(){return this.pos<this.collection.getLength()};DSIterator.prototype.next=function(){if(this.hasNext()){return this.collection.getByIndex(this.pos++)}var A;return A};function DSInteraction(){}DSInteraction.Drag=function(B,A){this.init(B,A)};LMI.Lang.importFunctions(DSInteraction.Drag,LMI.Event);DSInteraction.Drag.prototype.init=function(B,A){this.element=B;this.options=A||{};if(LMI.Browser.browser=="Explorer"){document.body.ondrag=function(){return false}}this.handle=this.options.handle||this.element;this.initEvents("startDrag","drag","endDrag");this.elStartLeft=this.elStartTop=null;this.startX=0;this.startY=0;if(!this.options.disable){this.enable()}};DSInteraction.Drag.prototype.enable=function(){if(!this.mousedown){this.mousedown=LMI.BrowserEvent.bind(this.handle,"mousedown",this,this.startDrag)}};DSInteraction.Drag.prototype.disable=function(){if(this.mousedown){LMI.BrowserEvent.remove(this.mousedown);this.mousedown=null}};DSInteraction.Drag.prototype.getEventObject=function(){return{clickStartPosition:{x:this.startX,y:this.startY},elementCurrentPosition:{x:this.getElementLeft(),y:this.getElementTop()},elementStartPosition:{x:this.elStartLeft,y:this.elStartTop}}};DSInteraction.Drag.prototype.getElementLeft=function(){return parseInt(LMI.StyleSheet.getStyle(this.element,"left"))};DSInteraction.Drag.prototype.getElementTop=function(){return parseInt(LMI.StyleSheet.getStyle(this.element,"top"))};DSInteraction.Drag.prototype.startDrag=function(B){if(B.getMouseButton()==0){this.startX=B.getPageX();this.startY=B.getPageY();this.originalPos=LMI.StyleSheet.getStyle(this.element,"position");if(this.originalPos!="absolute"){var A=LMI.Element.getOffsets(this.element);this.element.style.position="absolute";this.element.style.top=A.y+"px";this.element.style.left=A.x+"px"}this.elStartLeft=this.getElementLeft();this.elStartTop=this.getElementTop();if(this.mousemove){LMI.BrowserEvent.remove(this.mousemove)}if(this.mouseup){LMI.BrowserEvent.remove(this.mouseup)}this.mousemove=LMI.BrowserEvent.bind(document,"mousemove",this,this.drag);this.mouseup=LMI.BrowserEvent.bind(document,"mouseup",this,this.endDrag);this.windowout=LMI.BrowserEvent.bind(window,"mouseout",this,this.endDrag);this.triggerEvent("startDrag",this.getEventObject(),this);B.preventDefault();B.stopPropagation()}};DSInteraction.Drag.prototype.endDrag=function(A){if(A.getType()!="mouseout"||!A.getRelatedTarget()){LMI.BrowserEvent.remove(this.mousemove);LMI.BrowserEvent.remove(this.mouseup);LMI.BrowserEvent.remove(this.windowout);var B=this.getEventObject();B.clickEndPosition={x:A.getPageX(),y:A.getPageY()};B.elementEndPosition={x:this.getElementLeft(),y:this.getElementTop()};this.startX=0;this.startY=0;this.mousemove=this.mouseup=null;if(this.originalPos!="absolute"){this.element.style.position=this.originalPos}this.triggerEvent("endDrag",B,this)}};DSInteraction.Drag.prototype.drag=function(B){if(!this.options.lockX){var A=B.getPageX();var E=this.elStartLeft-(this.startX-A);if(this.options.maxX&&E>this.options.maxX){E=this.options.maxX}else{if(this.options.minX&&E<this.options.minX){E=this.options.minX}}this.element.style.left=E+"px"}if(!this.options.lockY){var D=B.getPageY();var C=this.elStartTop-(this.startY-D);if(this.options.maxY&&C>this.options.maxY){C=this.options.maxY}else{if(this.options.minY&&C<this.options.minY){C=this.options.minY}}this.element.style.top=C+"px"}this.triggerEvent("drag",this.getEventObject(),this);B.stopPropagation();B.preventDefault()};(function(){var A=LMI.AjaxController,E,C,B,D;A.addListingsToItinerary=function(H,F,G){DWREngine._execute(E,C,"addListingsToItinerary",H,F,G,B,D)};A.reorderItineraryPlaces=function(G,F){DWREngine._execute(E,C,"reorderItineraryPlaces",G,F,B,D)};A.setVisitorPreference=function(H,F,G){DWREngine._execute(E,C,"setVisitorPreference",H,B,D,F,G)};A.getSearchResults=function(R,N,J,K,O,Q,H,S,L,M,I,G,F){DWREngine._execute(A.getPath(),A.getClassName(),"getSearchResults",R,N,J,K,O,Q,H,S,L,D,B,M,I,G,F)};A.getListingDetails=function(H,G,F){DWREngine._execute(A.getPath(),A.getClassName(),"getListingDetails",H,G,D,B,F)};A.getMapSearchCount=function(K,I,H,F,J,G){DWREngine._execute(A.getPath(),A.getClassName(),"getMapSearchCount",K,I,H,F,J,G,D,B)};A.saveSavedMapLocation=function(J,F,I,G,H){DWREngine._execute(A.getPath(),A.getClassName(),"saveSavedLocationGeoPrecision",J,F,I,G,H,B,D)};A.submitReview=function(G,F){DWREngine._execute(E,C,"submitReview",G,F,B,D)};LMI.Init.addFunction(function(){E=A.getPath();C=A.getClassName();B=LMI.Lang.getObject("LMI.Data.state.visitorVO.uid");D=LMI.Lang.getObject("LMI.Data.state.visitorVO.passwordToken")})})();