(function(){
var _1="http://www.w3.org/TR/SVG11/feature#SVG";
var _2=(document.implementation&&(document.implementation.hasFeature("org.w3c.svg","1.0")||document.implementation.hasFeature(_1,"1.1")));
function SVGCanvas(_3,_4){
var _5=this._element=document.createElementNS(SVGCanvas.xmlns,"svg");
_5.setAttributeNS(null,"width",_3);
_5.setAttributeNS(null,"height",_4);
this._style={strokeColor:"#000000"};
}
SVGCanvas.xmlns="http://www.w3.org/2000/svg";
SVGCanvas.buildStyleString=function(_6){
var _7="fill:"+(_6.fillColor||"none")+";";
if(typeof (_6.fillOpacity)!="undefined"){
_7+="fill-opacity:"+_6.fillOpacity+";";
}
_7+="stroke:"+(_6.strokeColor||"none")+";";
if(typeof (_6.strokeOpacity)!="undefined"){
_7+="stroke-opacity:"+_6.strokeOpacity+";";
}
if(typeof (_6.strokeWidth)!="undefined"){
_7+="stroke-width:"+_6.strokeWidth+";";
}
return _7;
};
SVGCanvas.createPoly=function(_8,_9,_a,_b){
var _c=document.createElementNS(SVGCanvas.xmlns,_a);
var _d="";
for(var i in _8){
_d+=_8[i]+","+_9[i]+" ";
}
_c.setAttributeNS(null,"points",_d);
_c.setAttributeNS(null,"style",SVGCanvas.buildStyleString(_b));
return _c;
};
SVGCanvas.prototype.getElement=function(){
return this._element;
};
SVGCanvas.prototype.setStyle=function(_f){
this._style=_f;
};
SVGCanvas.prototype.drawCircle=function(cx,cy,_12,_13){
_13=_13||this._style;
var _14=document.createElementNS(SVGCanvas.xmlns,"circle");
_14.setAttributeNS(null,"cx",cx);
_14.setAttributeNS(null,"cy",cy);
_14.setAttributeNS(null,"r",_12);
_14.setAttributeNS(null,"style",SVGCanvas.buildStyleString(_13));
this._element.appendChild(_14);
};
SVGCanvas.prototype.drawOval=function(x,y,_17,_18,_19){
_19=_19||this._style;
var _1a=document.createElementNS(SVGCanvas.xmlns,"ellipse");
_1a.setAttributeNS(null,"cx",x+_17/2);
_1a.setAttributeNS(null,"cy",y+_18/2);
_1a.setAttributeNS(null,"rx",_17/2);
_1a.setAttributeNS(null,"ry",_18/2);
_1a.setAttributeNS(null,"style",SVGCanvas.buildStyleString(_19));
this._element.appendChild(_1a);
};
SVGCanvas.prototype.drawPolygon=function(_1b,_1c,_1d){
_1d=_1d||this._style;
this._element.appendChild(SVGCanvas.createPoly(_1b,_1c,"polygon",_1d));
};
SVGCanvas.prototype.drawPolyline=function(_1e,_1f,_20){
_20=_20||this._style;
this._element.appendChild(SVGCanvas.createPoly(_1e,_1f,"polyline",_20));
};
SVGCanvas.prototype.drawRect=function(x,y,_23,_24,_25){
_25=_25||this._style;
var _26=document.createElementNS(SVGCanvas.xmlns,"rect");
_26.setAttributeNS(null,"x",x);
_26.setAttributeNS(null,"y",y);
_26.setAttributeNS(null,"width",_23);
_26.setAttributeNS(null,"height",_24);
if(typeof (_25.cornerRadius)!="undefined"){
var r=(_24>_23)?_23*_25.cornerRadius:_24*_25.cornerRadius;
_26.setAttributeNS(null,"rx",r);
_26.setAttributeNS(null,"ry",r);
}
_26.setAttributeNS(null,"style",SVGCanvas.buildStyleString(_25));
this._element.appendChild(_26);
};
var _28=document.namespaces;
var _29="behavior: url(#default#VML);";
if(_28&&!_2){
document.namespaces.add("v",VMLCanvas.xmlns);
var _2a=document.createStyleSheet();
_2a.addRule("v\\:*",_29);
}
function VMLCanvas(_2b,_2c){
var _2d=this._element=document.createElement("v:group");
_2d.style.position="absolute";
_2d.style.top="0px";
_2d.style.left="0px";
_2d.style.width=_2b+"px";
_2d.style.height=_2c+"px";
_2d.coordsize=_2b+" "+_2c;
_2d.coordorigin="1 1";
this._style={strokeColor:"#000000"};
}
VMLCanvas.xmlns="urn:schemas-microsoft-com:vml";
VMLCanvas.createFillElement=function(_2e){
var _2f=document.createElement("v:fill");
if(typeof (_2e.fillColor)!="undefined"){
_2f.color=_2e.fillColor;
if(typeof (_2e.fillOpacity)!="undefined"){
_2f.opacity=_2e.fillOpacity;
}
}else{
_2f.on=false;
}
return _2f;
};
VMLCanvas.createStrokeElement=function(_30){
var _31=document.createElement("v:stroke");
if(typeof (_30.strokeColor)!="undefined"){
_31.color=_30.strokeColor;
if(typeof (_30.strokeOpacity)!="undefined"){
_31.opacity=_30.strokeOpacity;
}
if(typeof (_30.strokeWidth)!="undefined"){
_31.weight=_30.strokeWidth+"px";
}
}else{
_31.on=false;
}
return _31;
};
VMLCanvas.prototype.getElement=function(){
return this._element;
};
VMLCanvas.prototype.setStyle=function(_32){
this._style=_32;
};
VMLCanvas.prototype.drawCircle=function(cx,cy,_35,_36){
_36=_36||this._style;
this.drawOval(cx-_35,cy-_35,_35*2,_35*2,_36);
};
VMLCanvas.prototype.drawOval=function(x,y,_39,_3a,_3b){
_3b=_3b||this._style;
var _3c=document.createElement("v:oval");
_3c.style.position="absolute";
_3c.style.left=x;
_3c.style.top=y;
_3c.style.width=(_39+1);
_3c.style.height=(_3a+1);
_3c.position="0 0";
_3c.size=_39+" "+_3a;
_3c.appendChild(VMLCanvas.createFillElement(_3b));
_3c.appendChild(VMLCanvas.createStrokeElement(_3b));
this._element.appendChild(_3c);
};
VMLCanvas.prototype.drawPolyline=function(_3d,_3e,_3f){
_3f=_3f||this._style;
var _40=document.createElement("v:polyline");
_40.style.position="absolute";
var _41="";
for(var i in _3d){
_41+=_3d[i]+" "+_3e[i]+" ";
}
_40.points=_41;
_40.appendChild(VMLCanvas.createFillElement(_3f));
var _43=VMLCanvas.createStrokeElement(_3f);
_43.joinstyle="miter";
_40.appendChild(_43);
this._element.appendChild(_40);
};
VMLCanvas.prototype.drawPolygon=function(_44,_45,_46){
var _47=[];
var _48=[];
_47.length=_48.length=_44.length+1;
for(var i in _44){
_47[i]=_44[i];
_48[i]=_45[i];
}
_47[_44.length]=_44[0];
_48[_44.length]=_45[0];
this.drawPolyline(_47,_48,_46);
};
VMLCanvas.prototype.drawRect=function(x,y,_4c,_4d,_4e){
_4e=_4e||this._style;
var _4f=document.createElement("v:roundrect");
_4f.style.position="absolute";
_4f.style.left=x;
_4f.style.top=y;
_4f.style.width=(_4c+1);
_4f.style.height=(_4d+1);
_4f.arcsize=_4e.cornerRadius||0;
_4f.appendChild(VMLCanvas.createFillElement(_4e));
var _50=VMLCanvas.createStrokeElement(_4e);
_50.joinstyle="miter";
_4f.appendChild(_50);
this._element.appendChild(_4f);
};
function CanvasCanvas(_51,_52){
var _53=this._element=document.createElement("canvas");
_53.setAttribute("width",_51);
_53.setAttribute("height",_52);
this._style={strokeColor:"#000000"};
if(_53.getContext){
this._canvas=_53.getContext("2d");
}else{
throw Error("No implementation supported.");
}
}
CanvasCanvas.createPolyPath=function(_54,_55,_56,_57){
_56.beginPath();
_56.moveTo(_54[0],_55[0]);
for(var i=1;i<_54.length;++i){
_56.lineTo(_54[i],_55[i]);
}
if(_57){
_56.closePath();
}
};
CanvasCanvas.drawPoly=function(_59,_5a,_5b,_5c,_5d){
if(typeof (_5c.fillColor)!="undefined"){
CanvasCanvas.createPolyPath(_59,_5a,_5b,_5d);
_5b.fillStyle=_5c.fillColor;
_5b.globalAlpha=(typeof (_5c.fillOpacity)!="undefined")?_5c.fillOpacity:1;
_5b.fill();
}
if(typeof (_5c.strokeColor)!="undefined"){
CanvasCanvas.createPolyPath(_59,_5a,_5b,_5d);
_5b.strokeStyle=_5c.strokeColor;
_5b.globalAlpha=(typeof (_5c.strokeOpacity)!="undefined")?_5c.strokeOpacity:1;
_5b.lineWidth=(typeof (_5c.strokeWidth)!="undefined")?_5c.strokeWidth:1;
_5b.stroke();
}
};
CanvasCanvas.prototype.getElement=function(){
return this._element;
};
CanvasCanvas.prototype.setStyle=function(_5e){
this._style=_5e;
};
CanvasCanvas.prototype.drawCircle=function(cx,cy,_61,_62){
_62=_62||this._style;
var _63=this._canvas;
_63.beginPath();
_63.arc(cx,cy,_61,0,2*Math.PI,true);
if(typeof (_62.fillColor)!="undefined"){
_63.beginPath();
_63.arc(cx,cy,_61,0,2*Math.PI,true);
_63.fillStyle=_62.fillColor;
_63.globalAlpha=(typeof (_62.fillOpacity)!="undefined")?_62.fillOpacity:1;
_63.fill();
}
if(typeof (_62.strokeColor)!="undefined"){
_63.beginPath();
_63.arc(cx,cy,_61,0,2*Math.PI,true);
_63.strokeStyle=_62.strokeColor;
_63.globalAlpha=(typeof (_62.strokeOpacity)!="undefined")?_62.strokeOpacity:1;
_63.lineWidth=(typeof (_62.strokeWidth)!="undefined")?_62.strokeWidth:1;
_63.stroke();
}
};
CanvasCanvas.prototype.drawOval=function(x,y,_66,_67,_68){
var _69=this._canvas;
var cx=x+_66/2;
var cy=(y+_67/2)*_66/_67;
_69.save();
_69.scale(1,_67/_66);
this.drawCircle(cx,cy,_66/2,_68);
_69.restore();
};
CanvasCanvas.prototype.drawPolyline=function(_6c,_6d,_6e){
_6e=_6e||this._style;
var _6f=this._canvas;
CanvasCanvas.drawPoly(_6c,_6d,_6f,_6e,false);
};
CanvasCanvas.prototype.drawPolygon=function(_70,_71,_72){
_72=_72||this._style;
var _73=this._canvas;
CanvasCanvas.drawPoly(_70,_71,_73,_72,true);
};
CanvasCanvas.prototype.drawRect=function(x,y,_76,_77,_78){
_78=_78||this._style;
var _79=this._canvas;
if(typeof (_78.fillColor)!="undefined"){
_79.fillStyle=_78.fillColor;
_79.globalAlpha=(typeof (_78.fillOpacity)!="undefined")?_78.fillOpacity:1;
_79.fillRect(x,y,_76,_77);
}
if(typeof (_78.strokeColor)!="undefined"){
_79.strokeStyle=_78.strokeColor;
_79.globalAlpha=(typeof (_78.strokeOpacity)!="undefined")?_78.strokeOpacity:1;
_79.lineWidth=(typeof (_78.strokeWidth)!="undefined")?_78.strokeWidth:1;
_79.strokeRect(x,y,_76,_77);
}
};
function createCanvas(_7a,_7b,_7c){
if(_7c){
var _7d=_7c.toLowerCase();
if(_7d=="svg"){
return new SVGCanvas(_7a,_7b);
}else{
if(_7d=="vml"){
return new VMLCanvas(_7a,_7b);
}else{
if(_7d=="canvas"){
return new CanvasCanvas(_7a,_7b);
}
}
}
throw Error("No such implementation.");
}else{
if(_2){
return new SVGCanvas(_7a,_7b);
}else{
if(_28){
return new VMLCanvas(_7a,_7b);
}
}
return new CanvasCanvas(_7a,_7b);
}
}
RaveGeoUtils.createCanvas=createCanvas;
})();
RaveGeoUtils.addEvent=function(obj,_7f,fn,_81){
if(obj.addEventListener){
obj.addEventListener(_7f,fn,_81);
}else{
if(obj.attachEvent){
obj.attachEvent("on"+_7f,fn);
}else{
obj["on"+_7f]=fn;
}
}
};
RaveGeoUtils.stopEvent=function(e){
if(e&&e.stopPropagation&&e.preventDefault){
e.stopPropagation();
e.preventDefault();
}else{
if(window.event){
window.event.cancelBubble=true;
window.event.returnValue=false;
}
}
};
RaveGeoUtils.getTarget=function(e){
var _84;
if(!e){
e=window.event;
}
if(e.target){
_84=e.target;
}else{
if(e.srcElement){
_84=e.srcElement;
}
}
return _84;
};
RaveGeoUtils.leftButton=function(e){
if(!e){
e=window.event;
}
if(e.which){
return (e.which==1);
}else{
if(e.button){
return (e.button==0||e.button==1);
}
}
};
RaveGeoUtils.setStyle=function(_86,_87){
if(typeof (_86.style.cssText)!="undefined"){
_86.style.cssText=_87;
}else{
_86.setAttribute("style",_87);
}
};
RaveGeoUtils.isIE=(!window.opera&&navigator.userAgent.indexOf("MSIE")!=-1);
RaveGeoUtils.isSafari=(navigator.vendor&&navigator.vendor.indexOf("Apple")!=-1);
RaveGeoUtils.isImageLoaded=function(_88){
if(typeof (_88.complete)=="undefined"){
var _89=new Image();
_89.src=_88.src;
return _89.complete;
}
return _88.complete;
};
if(RaveGeoUtils.isSafari){
RaveGeoUtils.onImageLoaded=function(_8a,_8b){
_8a.onload=function(){
_8b.apply(_8a);
};
};
}else{
RaveGeoUtils.onImageLoaded=function(_8c,_8d){
_8c.onload=_8d;
};
}
RaveGeoUtils.mouseX=function(e){
var _8f=0;
if(e.pageX){
_8f=e.pageX;
}else{
if(e.clientX){
_8f=e.clientX;
if(RaveGeoUtils.isIE){
if(document.documentElement&&document.documentElement.scrollLeft){
_8f+=document.documentElement.scrollLeft;
}else{
if(document.body&&document.body.scrollLeft){
_8f+=document.body.scrollLeft;
}
}
}
}
}
return _8f;
};
RaveGeoUtils.mouseY=function(e){
var _91=0;
if(e.pageY){
_91=e.pageY;
}else{
if(e.clientY){
_91=e.clientY;
if(RaveGeoUtils.isIE){
if(document.documentElement&&document.documentElement.scrollTop){
_91+=document.documentElement.scrollTop;
}else{
if(document.body&&document.body.scrollTop){
_91+=document.body.scrollTop;
}
}
}
}
}
return _91;
};
RaveGeoUtils.topLeftX=function(obj){
var _93=0;
if(obj.offsetParent){
do{
_93+=obj.offsetLeft;
}while(obj=obj.offsetParent);
}else{
if(obj.x){
_93+=obj.x;
}
}
return _93;
};
RaveGeoUtils.topLeftY=function(obj){
var _95=0;
if(obj.offsetParent){
do{
_95+=obj.offsetTop;
}while(obj=obj.offsetParent);
}else{
if(obj.y){
_95+=obj.y;
}
}
return _95;
};
function RaveGeoTiledMap(_96){
function mouseMoved(e){
if(RaveGeoTiledMap.currentMap){
var _98=e.clientX-RaveGeoTiledMap.startX;
var _99=e.clientY-RaveGeoTiledMap.startY;
if(_98>1||_98<-1||_99>1||_99<-1){
RaveGeoTiledMap.startX=e.clientX;
RaveGeoTiledMap.startY=e.clientY;
RaveGeoTiledMap.currentMap._pixMove(_98,_99);
}
}
}
function mouseUp(e){
var _9b=RaveGeoTiledMap.currentMap;
if(RaveGeoUtils.leftButton(e)&&_9b!==null){
var _9c=e.clientX-RaveGeoTiledMap.startX;
var _9d=e.clientY-RaveGeoTiledMap.startY;
if(_9c!=0||_9d!=0){
RaveGeoTiledMap.currentMap._pixMove(_9c,_9d);
}
RaveGeoTiledMap.currentMap=null;
if(RaveGeoTiledMap.initialX==e.clientX&&RaveGeoTiledMap.initialY==e.clientY){
var _9e=_9b.callback;
if(_9e&&_9e.mapClicked){
var dx=RaveGeoUtils.mouseX(e)-RaveGeoUtils.topLeftX(_9b.outerDiv)-_9b.mapWidth/2;
var dy=RaveGeoUtils.mouseY(e)-RaveGeoUtils.topLeftY(_9b.outerDiv)-_9b.mapHeight/2;
var x=_9b.geoX+dx*(_9b.zoomStepExtents[_9b.zoomStep][0]/_9b.tileWidthPix);
var y=_9b.geoY-dy*(_9b.zoomStepExtents[_9b.zoomStep][1]/_9b.tileHeightPix);
_9e.mapClicked(_9b,x,y);
}
}
_9b._interactionEnded();
}
}
if(!_96.tilesConfiguration){
RaveGeoUtils.asyncJSONReq(_96.url+"GetTilesInfo?name="+_96.name,function(_a3){
if(_a3.error){
_a4._errorOccurred(_a3.error.code,_a3.error.message);
return;
}
_96.tilesConfiguration=_a3;
new RaveGeoTiledMap(_96);
},RaveGeoUtils.getTilesInfoTimeout);
return false;
}
this.url=_96.url;
this.name=_96.name;
this.loadingImageURL=_96.loadingImageURL;
this.callback=_96.callback;
var _a5=this.userDiv=document.getElementById(_96.userDivId);
this._textStyle=_96.textStyle;
if(!this._textStyle){
this._textStyle={};
}
var _a6=this._textStyle;
if(!_a6.borderColor){
_a6.borderColor="black";
}
if(!_a6.backgroundColor){
_a6.backgroundColor="gray";
}
if(!_a6.textColor){
_a6.textColor="white";
}
this._labelStyle=_96.labelStyle;
if(!this._labelStyle){
this._labelStyle={};
}
var _a6=this._labelStyle;
if(!_a6.borderColor){
_a6.borderColor="gray";
}
if(!_a6.backgroundColor){
_a6.backgroundColor="white";
}
if(!_a6.textColor){
_a6.textColor="black";
}
this._highlightColor=_96.highlightColor;
if(!this._highlightColor){
this._highlightColor="#ff0000";
}
this._expireDate=new Date();
this._expireDate.setTime(0);
this._updateExpireDate();
if(typeof _96.interactionDelay!="undefined"){
this.interactionDelay=_96.interactionDelay;
if(this.interactionDelay>RaveGeoUtils.maxInteractionDelay||this.interactionDelay<0){
this.interactionDelay=RaveGeoUtils.maxInteractionDelay;
}
}else{
this.interactionDelay=RaveGeoUtils.defaultInteractionDelay;
}
var _a7=_96.tilesConfiguration;
this.originX=_a7.originX;
this.originY=_a7.originY;
this.nominalToMeter=_a7.nominalToMeter;
this.tileWidthPix=_a7.tileWidthPix;
this.tileHeightPix=_a7.tileHeightPix;
this.zoomStepExtents=_a7.zoomStepExtents;
if(_96.initialViewArea){
var iva=_96.initialViewArea;
var _a9=iva.x;
var _aa=iva.y;
this.zoomStep=this._scale2ClosestZoomStep(iva.scale);
}else{
var _a9=this.originX;
var _aa=this.originY;
this.zoomStep=0;
}
RaveGeoUtils.addEvent(document,"mousemove",mouseMoved,false);
RaveGeoUtils.addEvent(document,"mouseup",mouseUp,false);
this.symbols={};
RaveGeoUtils.removeChildren(_a5);
var _ab=this.outerDiv=document.createElement("div");
RaveGeoUtils.setStyle(_ab,"position:absolute;top:0px;left:0px;overflow:hidden;cursor:move;");
var _ac=this.innerDiv=document.createElement("div");
RaveGeoUtils.setStyle(_ac,"position:absolute;overflow:visible;width:10px;height:10px;");
var _ad=this.symbolDiv=document.createElement("div");
RaveGeoUtils.setStyle(_ad,"position:absolute;z-index:50;");
_ab.appendChild(_ad);
_ab.appendChild(_ac);
var _ae=document.createElement("div");
RaveGeoUtils.setStyle(_ae,"width:100%;height:100%;position:relative;overflow:hidden;");
_ae.appendChild(_ab);
if(_96.copyright){
var _af=document.createElement("div");
_af.innerHTML=_96.copyright;
RaveGeoUtils.setStyle(_af,"color:black;position:absolute;left:4px;bottom:4px;z-index:100;cursor:text;");
_ab.appendChild(_af);
}
this._layout(_a9,_aa);
_a5.appendChild(_ae);
if(_96.initialSymbols){
var _b0=_96.initialSymbols;
for(var id in _b0){
var sym=_b0[id];
this.addSymbol(sym);
}
}
var _a4=this;
if(_96.callback&&_96.callback.mapLoaded){
setTimeout(function(){
_96.callback.mapLoaded(_a4);
},0);
}
}
RaveGeoTiledMap.prototype._layout=function(_b3,_b4){
function RaveGeoTile(_b5,dtx,dty){
this.owner=_b5;
this.dtx=dtx;
this.dty=dty;
var img=this.img=document.createElement("img");
img.style.position="absolute";
img.style.MozUserSelect="none";
img.style.width=_b5.tileWidthPix+"px";
img.style.height=_b5.tileHeightPix+"px";
img.style.left=((_b5.nx/2*_b5.tileWidthPix)+this.dtx*_b5.tileWidthPix)+"px";
img.style.top=((_b5.ny/2*_b5.tileHeightPix)-(this.dty+1)*_b5.tileHeightPix)+"px";
img.oncontextmenu=function(e){
return false;
};
img.tile=this;
RaveGeoUtils.addEvent(img,"mousedown",RaveGeoTiledMap._mouseDown,false);
RaveGeoUtils.addEvent(img,"dragstart",RaveGeoUtils.stopEvent,false);
}
var _ba=this.mapWidth=this.userDiv.clientWidth;
var _bb=this.mapHeight=this.userDiv.clientHeight;
this.nx=Math.ceil(_ba/this.tileWidthPix)+2;
this.ny=Math.ceil(_bb/this.tileHeightPix)+2;
if(this.nx%2==1){
this.nx+=1;
}
if(this.ny%2==1){
this.ny+=1;
}
this.wrapLimitX=(this.tileWidthPix*this.nx-_ba)/2;
this.wrapLimitY=(this.tileHeightPix*this.ny-_bb)/2;
this.outerDiv.style.width=_ba+"px";
this.outerDiv.style.height=_bb+"px";
this.originalLeft=Math.floor(_ba/2);
this.originalTop=Math.floor(_bb/2);
this.tiles=[];
RaveGeoUtils.removeChildren(this.innerDiv);
var _bc=this.nx/2;
var _bd=this.ny/2;
for(var i=-_bc;i<_bc;++i){
for(var j=-_bd;j<_bd;++j){
var _c0=new RaveGeoTile(this,i,j);
this.tiles[this.tiles.length]=_c0;
this.innerDiv.appendChild(_c0.img);
}
}
this._positionAllTiles(_b3,_b4);
};
RaveGeoTiledMap.prototype._updateExpireDate=function(){
if(this._expireDate<new Date()){
var _c1=this;
RaveGeoUtils.asyncJSONReq(this.url+"GetHandle?name="+this.name,function(_c2){
if(_c2.error){
_c1._errorOccurred(_c2.error.code,_c2.error.message);
return;
}
var _c3=_c2.timeout;
_c1._expireDate=new Date();
_c1._expireDate.setTime(_c1._expireDate.getTime()+_c3);
},RaveGeoUtils.getHandleTimeout);
}
};
RaveGeoTiledMap.prototype._errorOccurred=function(_c4,_c5){
this.userDiv.innerHTML="Fatal error: "+_c4+"<br>"+_c5;
if(this.callback&&this.callback.errorOccurred){
this.callback.errorOccurred(_c4,_c5);
}
};
RaveGeoTiledMap.prototype._positionTile=function(_c6){
function onImageLoad(){
var _c7=this.tile;
_c7.img.src=_c7.newImage.src;
_c7.img.onload=null;
}
_c6.img.style.left=(-this.cx+_c6.dtx*this.tileWidthPix+this.dx)+"px";
_c6.img.style.top=(-this.cy+_c6.dty*this.tileHeightPix+this.dy)+"px";
var _c8=this.url;
_c8+="GetTile?name="+this.name;
_c8+="&tx="+(_c6.dtx+this.ctx);
_c8+="&ty="+(-_c6.dty+this.cty);
_c8+="&zoomStep="+this.zoomStep;
if(_c6.newImage){
_c6.newImage.onload=null;
_c6.newImage.src=null;
_c6.newImage.tile=null;
}
_c6.newImage=new Image(5,5);
_c6.newImage.src=_c8;
if(!RaveGeoUtils.isImageLoaded(_c6.newImage)){
_c6.newImage.tile=_c6;
_c6.img.src=this.loadingImageURL;
RaveGeoUtils.onImageLoaded(_c6.newImage,onImageLoad);
}else{
_c6.img.src=_c8;
}
};
RaveGeoTiledMap.prototype._positionAllTiles=function(x,y){
var _cb=this.tileWidthPix/this.zoomStepExtents[this.zoomStep][0];
var _cc=this.tileHeightPix/this.zoomStepExtents[this.zoomStep][1];
var _cd=this.cx=Math.round((this.originX-x)*_cb);
var _ce=this.cy=Math.round((this.originY-y)*_cc);
this.dx=_cd%this.tileWidthPix;
this.dy=-_ce%this.tileHeightPix;
if(_cd<0){
this.ctx=-Math.ceil(this.cx/this.tileWidthPix);
}else{
this.ctx=-Math.floor(this.cx/this.tileWidthPix);
}
if(_ce<0){
this.cty=-Math.ceil(this.cy/this.tileHeightPix)-1;
}else{
this.cty=-Math.floor(this.cy/this.tileHeightPix)-1;
}
for(var i=0;i<this.tiles.length;++i){
this._positionTile(this.tiles[i]);
}
this.innerDiv.style.left=(this.originalLeft+_cd)+"px";
this.innerDiv.style.top=(this.originalTop+_ce)+"px";
this.symbolDiv.left=this.mapWidth/2+_cd;
this.symbolDiv.top=this.mapHeight/2-_ce;
this.symbolDiv.style.left=this.symbolDiv.left+"px";
this.symbolDiv.style.top=this.symbolDiv.top+"px";
this.geoX=x;
this.geoY=y;
this._interactionEnded();
};
RaveGeoTiledMap.prototype._wrapTile=function(_d0,dtx,dty){
var _d3=this.nx/2;
var _d4=this.ny/2;
_d0.dtx+=dtx;
_d0.dty+=dty;
var _d5=false;
if(_d0.dtx<-_d3){
_d0.dtx+=this.nx;
_d5=true;
}else{
if(_d0.dtx>=_d3){
_d0.dtx-=this.nx;
_d5=true;
}
}
if(_d0.dty<-_d4){
_d0.dty+=this.ny;
_d5=true;
}else{
if(_d0.dty>=_d4){
_d0.dty-=this.ny;
_d5=true;
}
}
if(_d5){
this._positionTile(_d0);
}
};
RaveGeoTiledMap.prototype._interactionEnded=function(){
if(this._cbTimeout){
clearTimeout(this._cbTimeout);
}
var _d6=this;
this._cbTimeout=setTimeout(function(){
_d6._updateExpireDate();
if(_d6.callback&&_d6.callback.interactionEnded){
_d6.callback.interactionEnded(_d6);
}
_d6._cbTimeout=null;
},this.interactionDelay);
};
RaveGeoTiledMap.prototype._setGeoCenter=function(x,y,_d9){
var _da=false;
if(typeof (_d9)!="undefined"){
_da=this._changeZoomStep(_d9);
}
if(this.geoX!=x||this.geoY!=y||_da){
this._positionAllTiles(x,y);
}
};
RaveGeoTiledMap.prototype._changeZoomStep=function(zs){
if(zs>=0&&zs<this.zoomStepExtents.length&&zs!=this.zoomStep){
this.zoomStep=zs;
for(var _dc in this.symbols){
this._positionSymbol(this.symbols[_dc]);
}
if(this._highlightedSymbol){
var _dd=this._highlightedSymbol;
var _de=Math.round(_dd.left+_dd.img.width/2);
var _df=Math.round(_dd.top+_dd.img.height/2);
var ow=_dd._highlightOuterWidth;
if(typeof (ow)!="undefined"){
_dd._highlightElement.style.left=Math.round(_de-ow)+"px";
_dd._highlightElement.style.top=(_df-ow)+"px";
}
}
return true;
}
return false;
};
RaveGeoTiledMap.prototype._positionSymbol=function(_e1){
var _e2=this.tileWidthPix/this.zoomStepExtents[this.zoomStep][0];
var _e3=this.tileHeightPix/this.zoomStepExtents[this.zoomStep][1];
var cx=-Math.round((this.originX-_e1.x)*_e2);
var cy=Math.round((this.originY-_e1.y)*_e3);
_e1.left=cx-_e1.img.width/2;
_e1.top=cy-_e1.img.height/2;
_e1.img.style.left=_e1.left+"px";
_e1.img.style.top=_e1.top+"px";
if(_e1.labelDiv){
_e1.labelDiv.style.left=(cx-255)+"px";
_e1.labelDiv.style.top=(cy+_e1.img.height/2)+"px";
}
if(!RaveGeoUtils.isImageLoaded(_e1.img)){
_e1._notYetLoaded=true;
RaveGeoUtils.onImageLoaded(_e1.img,function(){
var map=this.map;
var _e7=map.symbols[this.symId];
delete _e1._notYetLoaded;
map._positionSymbol(_e7);
if(_e7._doHighlight){
map.highlightSymbol(_e7.id,_e7._doHighlight);
delete _e7._doHighlight;
}
});
}
};
RaveGeoTiledMap.prototype._wrap=function(dtx,dty){
this.ctx-=dtx;
this.cty+=dty;
this.dx-=this.tileWidthPix*dtx;
this.dy-=this.tileHeightPix*dty;
for(var i=0;i<this.tiles.length;++i){
this._wrapTile(this.tiles[i],dtx,dty);
}
};
RaveGeoTiledMap.prototype._pixMove=function(x,y){
this.dx+=x;
this.dy+=y;
this.cx+=x;
this.cy+=y;
if(this.dx>this.wrapLimitX||this.dx<-this.wrapLimitX||this.dy>this.wrapLimitY||this.dy<-this.wrapLimitY){
var dtx=0;
if(this.dx<-this.wrapLimitX){
dtx=Math.ceil(this.dx/this.tileWidthPix);
}else{
if(this.dx>this.wrapLimitX){
dtx=Math.floor(this.dx/this.tileWidthPix);
}
}
var dty=0;
if(this.dy<-this.wrapLimitY){
dty=Math.ceil(this.dy/this.tileHeightPix);
}else{
if(this.dy>this.wrapLimitY){
dty=Math.floor(this.dy/this.tileHeightPix);
}
}
this._wrap(dtx,dty);
}
this.innerDiv.style.left=(this.originalLeft+this.cx)+"px";
this.innerDiv.style.top=(this.originalTop+this.cy)+"px";
this.geoX-=x*(this.zoomStepExtents[this.zoomStep][0]/this.tileWidthPix);
this.geoY+=y*(this.zoomStepExtents[this.zoomStep][1]/this.tileHeightPix);
this.symbolDiv.left+=x;
this.symbolDiv.top+=y;
this.symbolDiv.style.left=this.symbolDiv.left+"px";
this.symbolDiv.style.top=this.symbolDiv.top+"px";
};
RaveGeoTiledMap.prototype._zoomStep2Scale=function(zs){
return Math.round(this.zoomStepExtents[zs][1]*this.nominalToMeter/(this.tileHeightPix*0.0003));
};
RaveGeoTiledMap.prototype._scale2ClosestZoomStep=function(_f0){
var _f1=this._zoomStep2Scale(0);
var _f2=0;
for(var i=1;i<this.zoomStepExtents.length;++i){
var _f4=this._zoomStep2Scale(i);
if(Math.abs(_f4-_f0)<Math.abs(_f1-_f0)){
_f1=_f4;
_f2=i;
}else{
break;
}
}
return _f2;
};
RaveGeoTiledMap.prototype._getGeoWidth=function(){
return this.zoomStepExtents[this.zoomStep][0]/this.tileWidthPix*this.mapWidth;
};
RaveGeoTiledMap.prototype._getGeoHeight=function(){
return this.zoomStepExtents[this.zoomStep][1]/this.tileHeightPix*this.mapHeight;
};
RaveGeoTiledMap.prototype.getCenterX=function(){
return this.geoX;
};
RaveGeoTiledMap.prototype.getCenterY=function(){
return this.geoY;
};
RaveGeoTiledMap.prototype.getScale=function(){
return this._zoomStep2Scale(this.zoomStep);
};
RaveGeoTiledMap.prototype.getGeoBounds=function(){
var _f5=this._getGeoWidth();
var _f6=this._getGeoHeight();
return [[this.geoX-_f5/2,this.geoY-_f6/2],[this.geoX+_f5/2,this.geoY+_f6/2]];
};
RaveGeoTiledMap.prototype.getRecommendedScales=function(){
var ret=[];
for(var zs in this.zoomStepExtents){
ret[zs]=this._zoomStep2Scale(zs);
}
return ret;
};
RaveGeoTiledMap.prototype.setViewArea=function(x,y,_fb){
x=parseFloat(x);
y=parseFloat(y);
var _fc=this._scale2ClosestZoomStep(_fb);
this._setGeoCenter(x,y,_fc);
};
RaveGeoTiledMap.prototype.clearSymbols=function(){
for(var _fd in this.symbols){
this.removeSymbol(_fd);
}
};
RaveGeoTiledMap.prototype.addSymbol=function(sym,_ff){
var _100=this.symbols[sym.id];
var opts;
if(_100){
opts={center:"Never"};
if(_100._highlightElement){
opts.showHighlight=true;
}
if(_100._alwaysBalloon){
opts.showText=true;
}
this.removeSymbol(sym.id);
}
this.symbols[sym.id]=sym;
var img=sym.img=document.createElement("img");
img.src=sym.symbol;
img.style.position="absolute";
img.style.zIndex="50";
try{
img.style.cursor="pointer";
}
catch(e){
img.style.cursor="hand";
}
img.symId=sym.id;
img.map=this;
var _103;
if(typeof sym.label!="undefined"){
var _104=sym.innerLabelDiv=document.createElement("span");
_104.innerHTML=sym.label;
RaveGeoUtils.setStyle(_104,"font-family:sans-serif;font-size:small;padding:0px;white-space:pre;border:1px solid;padding:2px 3px 2px 3px;");
_104.style.borderColor=this._labelStyle.borderColor;
_104.style.backgroundColor=this._labelStyle.backgroundColor;
_104.style.color=this._labelStyle.textColor;
_103=sym.labelDiv=document.createElement("div");
RaveGeoUtils.setStyle(_103,"position:absolute;z-index:49;width:500px;text-align:center;padding:5px;margin:1px;");
_103.appendChild(_104);
_104.tile={owner:this};
RaveGeoUtils.addEvent(_104,"mousedown",RaveGeoTiledMap._mouseDown,true);
RaveGeoUtils.addEvent(_104,"dragstart",RaveGeoUtils.stopEvent,false);
_103.tile={owner:this};
RaveGeoUtils.addEvent(_103,"mousedown",RaveGeoTiledMap._mouseDown,true);
RaveGeoUtils.addEvent(_103,"dragstart",RaveGeoUtils.stopEvent,false);
}
this._positionSymbol(sym);
RaveGeoUtils.addEvent(img,"mousedown",RaveGeoTiledMap._symbMouseDown,false);
RaveGeoUtils.addEvent(img,"mouseover",RaveGeoTiledMap._symbMouseOver,false);
RaveGeoUtils.addEvent(img,"mouseout",RaveGeoTiledMap._symbMouseOut,false);
this.symbolDiv.appendChild(img);
if(_103){
this.symbolDiv.appendChild(_103);
}
if(opts){
this.highlightSymbol(sym.id,opts);
}
};
RaveGeoTiledMap.prototype.redraw=function(){
};
RaveGeoTiledMap.prototype.getSymbolIds=function(_105){
var ret=[];
if(_105){
var _107=this.getGeoBounds();
for(var id in this.symbols){
var sym=this.symbols[id];
if(sym.x>=_107[0][0]&&sym.y>=_107[0][1]&&sym.x<=_107[1][0]&&sym.y<=_107[1][1]){
ret[ret.length]=id;
}
}
}else{
for(var id in this.symbols){
ret[ret.length]=id;
}
}
return ret;
};
RaveGeoTiledMap.prototype.getSymbol=function(id){
return this.symbols[id];
};
RaveGeoTiledMap.prototype.removeSymbol=function(id,_10c){
if(id){
var sym=this.symbols[id];
if(sym){
if(sym==this._highlightedSymbol){
this._removeHighlight(sym);
}
this.symbolDiv.removeChild(sym.img);
if(sym.balloon){
this.symbolDiv.removeChild(sym.balloon);
}
if(sym.labelDiv){
sym.labelDiv.tile=null;
sym.innerLabelDiv.tile=null;
this.symbolDiv.removeChild(sym.labelDiv);
}
delete this.symbols[id];
}
}
};
RaveGeoTiledMap.prototype.zoom=function(_10e){
if(_10e<1){
this._setGeoCenter(this.geoX,this.geoY,this.zoomStep-1);
}else{
if(_10e>1){
this._setGeoCenter(this.geoX,this.geoY,this.zoomStep+1);
}
}
};
RaveGeoTiledMap.prototype.zoomTo=function(_10f){
var _110=this._scale2ClosestZoomStep(_10f);
this._setGeoCenter(this.geoX,this.geoY,_110);
};
RaveGeoTiledMap.prototype.pan=function(dx,dy){
var _113=this.zoomStepExtents[this.zoomStep][0]/this.tileWidthPix;
var _114=this.zoomStepExtents[this.zoomStep][1]/this.tileHeightPix;
this._animateTo(this.geoX+_113*this.mapWidth*dx,this.geoY+_113*this.mapHeight*dy);
};
RaveGeoTiledMap.prototype._animateTo=function(x,y){
var _117=this.tileWidthPix/this.zoomStepExtents[this.zoomStep][0];
var _118=this.tileHeightPix/this.zoomStepExtents[this.zoomStep][1];
var dpx=(x-this.geoX)*_117;
var dpy=(y-this.geoY)*_118;
var _11b=Math.sqrt(dpx*dpx+dpy*dpy)*1.25;
if(this._lastTimeout){
clearTimeout(this._lastTimeout);
}
if(_11b<2000&&_11b>25){
if(!this._myAnimatorFunc){
var self=this;
this._myAnimatorFunc=function(){
var _11d=(new Date().getTime()-self._animStart)/self._animTime;
if(_11d>1){
self._interactionEnded();
delete self._lastTimeout;
}else{
var doX=Math.round(self._animDestX*_11d-self._animDoneX);
var doY=Math.round(self._animDestY*_11d-self._animDoneY);
self._animDoneX+=doX;
self._animDoneY+=doY;
self._pixMove(doX,doY);
self._lastTimeout=setTimeout(self._myAnimatorFunc,10);
}
};
}
this._animDestX=-dpx;
this._animDestY=dpy;
this._animDoneX=0;
this._animDoneY=0;
this._animTime=_11b;
this._animStart=new Date().getTime();
this._myAnimatorFunc();
}else{
this._setGeoCenter(x,y);
}
};
RaveGeoTiledMap.prototype.moveTo=function(x,y,_122){
if(this.getScale()==_122){
this._animateTo(x,y);
}else{
this.setViewArea(x,y,_122);
}
};
RaveGeoTiledMap.prototype.showSymbols=function(_123){
var minX=Number.POSITIVE_INFINITY;
var minY=Number.POSITIVE_INFINITY;
var maxX=Number.NEGATIVE_INFINITY;
var maxY=Number.NEGATIVE_INFINITY;
for(var id in this.symbols){
var sym=this.symbols[id];
if(sym.x<minX){
minX=sym.x;
}
if(sym.x>maxX){
maxX=sym.x;
}
if(sym.y<minY){
minY=sym.y;
}
if(sym.y>maxY){
maxY=sym.y;
}
}
var _12a=this._scale2ClosestZoomStep(_123);
if(minX!=Number.POSITIVE_INFINITY){
var _12b=(maxX-minX)*1.15;
var _12c=(maxY-minY)*1.15;
var i;
for(i=0;i<this.zoomStepExtents.length;++i){
var _12e=this.zoomStepExtents[i][0]/this.tileWidthPix*this.mapWidth;
var _12f=this.zoomStepExtents[i][1]/this.tileHeightPix*this.mapHeight;
if(_12e>_12b&&_12f>_12c){
break;
}
}
var _130=minX+(maxX-minX)/2;
var _131=minY+(maxY-minY)/2;
if(i>_12a){
_12a=i;
}
if(_12a!=this.zoomStep){
this._setGeoCenter(_130,_131,_12a);
}else{
this._animateTo(_130,_131);
}
}else{
if(_12a>this.zoomStep){
this._setGeoCenter(this.geoX,this.geoY,_12a);
}
}
};
RaveGeoTiledMap.prototype._removeHighlight=function(_132){
_132.img.style.zIndex="50";
if(_132._highlightElement){
this.symbolDiv.removeChild(_132._highlightElement);
delete _132._highlightOuterWidth;
delete _132._highlightElement;
}
if(_132._alwaysBalloon){
this.symbolDiv.removeChild(_132._alwaysBalloon);
delete _132._alwaysBalloon;
}
delete this._highlightedSymbol;
};
RaveGeoTiledMap.prototype.highlightSymbol=function(id,_134){
var _135=this.symbols[id];
if(!_134){
_134={};
}
if(this._highlightedSymbol){
this._removeHighlight(this._highlightedSymbol);
this._highlightedSymbol=null;
}
if(_135){
if(_135._notYetLoaded){
_135._doHighlight=_134;
}
if(typeof (_134.center)!="string"){
_134.center="";
}
if(!_134.showText){
_134.showText=false;
}
if(!_134.showHighlight){
_134.showHighlight=false;
}
if(_134.showHighlight){
var _136=_135.img.width;
var _137=_135.img.height;
var _138=Math.round(_135.left+_136/2);
var _139=Math.round(_135.top+_137/2);
var _13a=Math.max(_136,_137)/3;
var _13b=(Math.sqrt(_136*_136+_137*_137)/2)+_13a;
var ow=_135._highlightOuterWidth=Math.round(_13b+_13a/2);
var _13d=RaveGeoUtils.createCanvas(ow*2,ow*2);
var _13e=_13d.getElement();
_13e.style.position="absolute";
_13e.style.zIndex="51";
_13e.style.left=Math.round(_138-ow)+"px";
_13e.style.top=(_139-ow)+"px";
this.symbolDiv.appendChild(_13e);
_135._highlightElement=_13e;
var inc=Math.PI/6;
for(var i=0;i<=Math.PI*2;i+=inc){
var x=ow-Math.floor(_13b*Math.cos(i));
var y=ow-Math.floor(_13b*Math.sin(i));
_13d.drawCircle(x,y,_13a/2,{fillColor:this._highlightColor});
}
}
if(_134.showText){
_135._alwaysBalloon=RaveGeoTiledMap._createBalloon(_135,this._textStyle);
this.symbolDiv.appendChild(_135._alwaysBalloon);
}
this._highlightedSymbol=_135;
_135.img.style.zIndex="53";
var _143=_134.center.toLowerCase();
if(_143=="whennotshowing"){
var _144=(this.mapWidth*0.43)*(this.zoomStepExtents[this.zoomStep][0]/this.tileWidthPix);
var _145=(this.mapHeight*0.43)*(this.zoomStepExtents[this.zoomStep][1]/this.tileHeightPix);
var minx=this.geoX-_144;
var miny=this.geoY-_145;
var maxx=this.geoX+_144;
var maxy=this.geoY+_145;
if(_135.x<minx||_135.x>maxx||_135.y<miny||_135.y>maxy){
this._animateTo(_135.x,_135.y);
}
}else{
if(_143!="never"){
this._animateTo(_135.x,_135.y);
}
}
}
};
RaveGeoTiledMap.prototype.resize=function(_14a,_14b){
this.userDiv.style.width=_14a+"px";
this.userDiv.style.height=_14b+"px";
this._layout(this.geoX,this.geoY);
};
RaveGeoTiledMap.currentMap=null;
RaveGeoTiledMap.startX=0;
RaveGeoTiledMap.startY=0;
RaveGeoTiledMap.initiateCreation=function(_14c){
new RaveGeoTiledMap(_14c);
};
RaveGeoTiledMap._mouseDown=function(e){
if(RaveGeoUtils.leftButton(e)){
var _14e=RaveGeoUtils.getTarget(e);
if(_14e.tile){
RaveGeoTiledMap.currentMap=_14e.tile.owner;
if(RaveGeoTiledMap.currentMap._lastTimeout){
clearTimeout(RaveGeoTiledMap.currentMap._lastTimeout);
RaveGeoTiledMap.currentMap._lastTimeout=null;
}
RaveGeoTiledMap.initialX=RaveGeoTiledMap.startX=e.clientX;
RaveGeoTiledMap.initialY=RaveGeoTiledMap.startY=e.clientY;
}
RaveGeoUtils.stopEvent(e);
}
};
RaveGeoTiledMap._symbMouseDown=function(e){
if(RaveGeoUtils.leftButton(e)){
var _150=RaveGeoUtils.getTarget(e);
if(_150.symId){
var _151=_150.map.callback;
if(_151&&_151.symbolClicked){
_151.symbolClicked(_150.map,_150.symId);
}
}
RaveGeoUtils.stopEvent(e);
}
};
RaveGeoTiledMap._symbMouseOver=function(e){
var _153=RaveGeoUtils.getTarget(e);
if(_153.symId){
var _154=_153.map.symbols[_153.symId];
_153.style.border="1px solid gray";
if(!_154._alwaysBalloon){
_154.balloon=RaveGeoTiledMap._createBalloon(_154,_153.map._textStyle);
_153.map.symbolDiv.appendChild(_154.balloon);
}
}
RaveGeoUtils.stopEvent(e);
};
RaveGeoTiledMap._symbMouseOut=function(e){
var _156=RaveGeoUtils.getTarget(e);
if(_156.symId){
var _157=_156.map.symbols[_156.symId];
if(_157.balloon){
_156.map.symbolDiv.removeChild(_157.balloon);
}
_157.balloon=null;
_156.style.border="0px none";
}
RaveGeoUtils.stopEvent(e);
};
RaveGeoTiledMap._createBalloon=function(_158,_159){
var _15a=document.createElement("div");
RaveGeoUtils.setStyle(_15a,"position:absolute;top:0px;left:0px;z-index:53;border:1px solid;cursor:text;padding:3px 5px 3px 5px;white-space:pre;");
_15a.style.borderColor=""+_159.borderColor;
_15a.style.backgroundColor=""+_159.backgroundColor;
_15a.innerHTML+=_158.text;
_15a.style.color=""+_159.textColor;
_15a.style.left=(_158.left+_158.img.width+5)+"px";
_15a.style.top=(_158.top+_158.img.height+5)+"px";
return _15a;
};

