OpenLayers.ImgPath = '/img/1/';OpenLayers.Events.prototype.BROWSER_EVENTS.push("contextmenu");OpenLayers.LonLat.prototype.toStr=function(p){if(typeof p=="undefined")p=7;p=Math.pow(10,p);return (Math.round(this.lat*p)/p)+","+(Math.round(this.lon*p)/p);};
 OpenLayers.LonLat.prototype.getDistanceM=function(ll){var a=6378137,b=6356752.3142,f=1/298.25722356,l=(ll.lon*Math.PI/180)-(this.lon*Math.PI/180),u1=Math.atan((1-f)*Math.tan(this.lat*Math.PI/180)),u2=Math.atan((1-f)*Math.tan(ll.lat*Math.PI/180)),sinU1=Math.sin(u1),cosU1=Math.cos(u1),sinU2=Math.sin(u2),cosU2=Math.cos(u2),lambda=l,lambdaP=2*Math.PI,itL=20,sinLam,cosLam,sinSig,cosSig,sigma,sinAlp,cosSqAlp,cos2SigM,c,usq,a_,b_,delSig,s;while((Math.abs(lambda-lambdaP)>1e-12)&&(--itL>0)){sinLam=Math.sin(lambda);cosLam=Math.cos(lambda);sinSig=Math.sqrt(Math.pow(cosU2*sinLam,2)+Math.pow(cosU1*sinU2-sinU1*cosU2*cosLam,2));if(sinSig==0)return 0;cosSig=sinU1*sinU2+cosU1*cosU2*cosLam;sigma=Math.atan2(sinSig,cosSig);sinAlp=cosU1*cosU2*sinLam/sinSig;cosSqAlp=1-Math.pow(sinAlp,2);cos2SigM=cosSig-2*sinU1*sinU2/cosSqAlp;c=f/16*cosSqAlp*(4+f*(4-3*cosSqAlp));lambdaP=lambda;lambda=l+(1-c)*f*sinAlp*(sigma+c*sinSig*(cos2SigM+c*cosSig*(-1+2*Math.pow(cos2SigM,2))));}if(itL==0)return null;usq=cosSqAlp*(a*a-b*b)/(b*b);a_=1+usq/16384*(4096+usq*(-768+usq*(320-175*usq)));b_=usq/1024*(256+usq*(-128+usq*(74-47*usq)));delSig=b_*sinSig*(cos2SigM+b_/4*(cosSig*(-1+2*Math.pow(cos2SigM,2))-b_/6*cos2SigM*(-3+4*Math.pow(sinSig,2))*(-3+4*Math.pow(cos2SigM,2))));s=b*a_*(sigma-delSig);return s;};
 OpenLayers.Bounds.prototype.getScaleLngM=function(){var ll=new OpenLayers.LonLat(this.right,this.bottom);return ll.getDistanceM(new OpenLayers.LonLat(this.left,this.bottom));};
 OpenLayers.Bounds.prototype.getScaleLine=function(w,minPx,maxPx,pre){if(!pre)pre=0;var scale=this.getScaleLngM(),minS=minPx/w*scale,maxS=maxPx/w*scale,p10=Math.pow(10,Math.floor(Math.log(maxS-minS)/Math.log(10))-pre),uSc=Math.ceil(minS/p10)*p10,uPx=Math.round(uSc/scale*w);return {sc:uSc,px:uPx};};
 citysam.map = {};
 citysam.map.map = function(o) {var _mapId=o.map,_map,_sI,_decorators={ol:{isInit:false},d:{}},_panD=400,resizeDecorator=null,_baseLayerUndoFunc=null;var _onMoveEnd=function(e){return _this.onmoveend(e);};var _onMoveStart=function(e){return _this.onmovestart(e);};var _onZoomEnd=function(e){return _this.onzoomend(e);};var _onAddLayer=function(e){return _this.onaddlayer(e);};var _onRemoveLayer=function(e){return _this.onremovelayer(e);};var _onChangeLayer=function(e){return _this.onchangelayer(e);};var _this = {init:function(o){_this.navControl=new OpenLayers.Control.Navigation({dragPanOptions:{interval:15}});var m;if(m=$("#"+_mapId+"T"))m.style.width="";_map = new OpenLayers.Map(_mapId,{controls:[_this.navControl],units:"m",maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),maxResolution: 156543.0399,numZoomLevels:19,projection: new OpenLayers.Projection("EPSG:900913"),displayProjection: new OpenLayers.Projection("EPSG:4326"),eventListeners: {"moveend":_onMoveEnd,"movestart":_onMoveStart,"zoomend":_onZoomEnd,"addlayer":_onAddLayer,"removelayer":_onRemoveLayer,"changelayer":_onChangeLayer },theme:false });if (o.supportedMapTypes) {_this.mapTypes.supported=o.supportedMapTypes;_this.mapTypes.initialize.apply(_this.mapTypes,[_this]);}_map.setCenter(new OpenLayers.LonLat((o.lng?o.lng:0),(o.lat?o.lat:0)).transform(new OpenLayers.Projection("EPSG:4326"), _map.getProjectionObject()), (o.zoom?o.zoom:1));if (o.nav) {var obj;if (obj=$("#"+_mapId+"nTL"))citysam.DOM.bindEvent("onclick",obj,_this.panNorthWest);if (obj=$("#"+_mapId+"nT")) citysam.DOM.bindEvent("onclick",obj,_this.panNorth);if (obj=$("#"+_mapId+"nTR"))citysam.DOM.bindEvent("onclick",obj,_this.panNorthEast);if (obj=$("#"+_mapId+"nR")) citysam.DOM.bindEvent("onclick",obj,_this.panEast);if (obj=$("#"+_mapId+"nBR"))citysam.DOM.bindEvent("onclick",obj,_this.panSouthEast);if (obj=$("#"+_mapId+"nB")) citysam.DOM.bindEvent("onclick",obj,_this.panSouth);if (obj=$("#"+_mapId+"nBL"))citysam.DOM.bindEvent("onclick",obj,_this.panSouthWest);if (obj=$("#"+_mapId+"nL")) citysam.DOM.bindEvent("onclick",obj,_this.panWest);}if (o.scaleLine){o.scaleLine.csMap=_this;_map.addControl(o.scaleLine);}},getMap:function(){return _map;},getId:function(){return _mapId;},navControl:null,getContainer:function(){return $("#"+_mapId+"C");},addDecorator:function(d){_decorators.d[d.id]=d;if(d.isOverlay){if(!_decorators.ol.isInit)_this.initOverlays();}_this.onadddecorator(d);},getDecorators:function(){return _decorators.d;},mapTypes:{supported:{},layer:{},map:null,currentType:"",initialize:function(map){this.map=map;var i,mt;for(i in this.supported){mt=this.supported[i];if(mt.type=="Citysam_Hybrid"){this.supported._hybrid={active:false,id:"_hybrid",name:"",type:"Citysam_Street_Hybrid",domains:mt.domains };}if(!mt.active)continue;this.map.setBaseLayer(this.getLayer(mt.id));}},getLayer:function(id){if(!this.layer[id]){this.layer[id]=this.createMapLayer(this.supported[id]);}return this.layer[id];},createMapLayer:function(mt){var newLayer;switch(mt.type){case "Citysam_Street": newLayer=new OpenLayers.Layer.Citysam("Citysam", mt.domains);break;case "Citysam_Street_Hybrid": newLayer=new OpenLayers.Layer.Citysam.Hybrid("Citysam Hybrid", mt.domains);break;case "Citysam_Hybrid": newLayer=function(){var gsat=null,csstr=null,i;for(i in this.supported){if(gsat&&csstr)break;if(!gsat&&this.supported[i].type=="Google_Satelite")gsat=this.getLayer(this.supported[i].id);if(!csstr&&this.supported[i].type=="Citysam_Street_Hybrid")csstr=this.getLayer(this.supported[i].id);}if(!gsat||!csstr)return;this.map.getMap().setBaseLayer(gsat);try{gsat.pane.style.zIndex=1000;}catch(e){}csstr.setIsBaseLayer(false);csstr.setVisibility(true);return function(){csstr.setVisibility(false);csstr.setIsBaseLayer(true);};};break;case "Google_Satelite": newLayer=new OpenLayers.Layer.Google(mt.name,{type:G_SATELLITE_MAP,sphericalMercator:true,numZoomLevels:22});break;case "Google_Street": newLayer=new OpenLayers.Layer.Google(mt.name,{sphericalMercator:true,numZoomLevels:22});break;case "Google_Hybrid": newLayer=new OpenLayers.Layer.Google(mt.name,{type:G_HYBRID_MAP,sphericalMercator:true,numZoomLevels:22});break;case "Google_Physical": newLayer=new OpenLayers.Layer.Google(mt.name,{type:G_PHYSICAL_MAP,sphericalMercator:true,numZoomLevels:22});break;}if(typeof newLayer!="function")this.map.getMap().addLayer(newLayer);return newLayer;},updateCurrentMapType:function(l){var i;for(i in this.layer){if(this.layer[i]==l){this.currentType=this.supported[i].typeAbbr;break;}}}},setBaseLayer:function(l){_this.mapTypes.updateCurrentMapType.apply(_this.mapTypes,[l]);if(_baseLayerUndoFunc){_baseLayerUndoFunc.apply(_this.mapTypes);_baseLayerUndoFunc=null;}if(typeof l=="function"){_baseLayerUndoFunc=l.apply(_this.mapTypes);} else {if(!l.isBaseLayer)l.setIsBaseLayer(true);_map.setBaseLayer(l);}if(l.pane)try{l.pane.style.zIndex=1000;}catch(e){}},initOverlays:function(){_this.overlays.hD=document.createElement("a");_this.overlays.hD.style.position="absolute";_this.overlays.hD.style.cursor="pointer";_this.overlays.hD.style.display="none";_this.overlays.hD.style.zIndex="2000";_this.getContainer().appendChild(_this.overlays.hD);_this.overlays.map=_this;citysam.DOM.bindEvent("onmoveend",_this,_this.redrawOverlays,null,_this.overlays);_this.getMap().events.register("mousemove", _this.overlays, _this.overlays.checkMP);_this.getMap().events.register("movestart", _this.overlays, _this.overlays.hidePopups);_this.getMap().events.register("zoomstart", _this.overlays, _this.overlays.hide);_decorators.ol.isInit=true;},redrawOverlays:function(){_this.overlays.clear();var i,ol=_this.getDecorators();for(i in ol){if(!ol[i].isOverlay)continue;ol[i].redraw();}},overlays:{map:null,qS:30,pos:{},popups:{},lastPopup:null,hD:null,byType:{},timeLastPopupCreated:0,clear:function(){this.pos={};},hidePopups:function(){if(this.lastPopup!=null){this.lastPopup.hide(true);this.lastPopup=null;}},addData:function(data,type){var i;_this.overlays.pos[type]=data;},hide:function(e){var i,d=this.map.getDecorators();for(i in d){if(!d[i].isOverlay)continue;d[i].getLayer().setVisibility(false);}},checkMP:function(e){if(window.opera)e.xy.y-=window.pageYOffset;var r=false,t,f,qX,qY,mS,m=this.map.getMap(),d;if(m.dragging)return;mS=m.getSize();qX=Math.floor(Math.ceil(mS.w/this.qS)/mS.w*e.xy.x);qY=Math.floor(Math.ceil(mS.h/this.qS)/mS.h*e.xy.y);for(t in this.pos){d=this.getOverlayByType(t);if(!d||!d.getVisibility())continue;if(!(r=this.checkQ(qX,qY,e.xy,this.pos[t]))){var oX=((e.xy.x-qX*this.qS)>this.qS/2)?1:-1,oY=((e.xy.y-qY*this.qS)>this.qS/2)?1:-1;if(r=this.checkQ(qX+oX,qY,e.xy,this.pos[t])){}else if(r=this.checkQ(qX,qY+oY,e.xy,this.pos[t])){}else if(r=this.checkQ(qX+oX,qY+oY,e.xy,this.pos[t])){}}if(r){break;}}var bs=document.body.style;if(r){if(this.hD.style.display!="block"||this.hD.style.left!=r.i.x+"px"){this.hD.style.left=r.i.x+"px";this.hD.style.top=r.i.y+"px";this.hD.style.width=r.i.w+"px";this.hD.style.height=r.i.h+"px";this.hD.style.display="block";}if(r.u){this.hD.href=r.u;return;}this.showPopup(t,r);} else {this.hidePopups();if(this.hD.style.display!="none")this.hD.style.display="none";}},checkQ:function(qX,qY,p,data){if(!data.d[qX]||!data.d[qX][qY])return false;var w,h,d=data.d[qX][qY],x,y,r;if (data.i) {w=data.i.w;h=data.i.h;for(x in d){if(x<=p.x&&parseInt(x)+w>=p.x){for(y in d[x]){if(y<=p.y&&parseInt(y)+h>=p.y){r=d[x][y];r.i={x:parseInt(x),y:parseInt(y),h:parseInt(h),w:parseInt(w)};return r;}}}}} else {for(x in d) {for(y in d[x]) {r=d[x][y];w=r.i.w;h=r.i.h;if(x<=p.x&&parseInt(x)+w>=p.x&&y<=p.y&&parseInt(y)+h>=p.y){r.i={x:parseInt(x),y:parseInt(y),h:parseInt(h),w:parseInt(w)};return r;}}}}return false;},showPopup:function(t,r){if(!this.popups[t])this.popups[t]={};if(!this.popups[t][r.id]&&!this.createPopup(t,r))return;if(this.lastPopup!==null&&this.lastPopup!=this.popups[t][r.id])this.lastPopup.hide(true);this.popups[t][r.id].redraw(r.i);this.lastPopup=this.popups[t][r.id];},createPopup:function(t,r){var z=new Date();if(z.getTime()-this.timeLastPopupCreated<500)return false;var d=this.getOverlayByType(t);if(!d)return false;switch(t){case "hotels": this.popups[t][r.id]=new citysam.map.Popup.Hotel({map:this.map,id:r.id,overlay:d});break;case "sights": this.popups[t][r.id]=new citysam.map.Popup.Sight({map:this.map,id:r.id,overlay:d,fId:r.f});break;default: return false;break;}this.timeLastPopupCreated=z.getTime();return this.popups[t][r.id];},getOverlayByType:function(t){if(this.byType[t])return this.byType[t];var i,d=this.map.getDecorators();for(i in d){if(!d[i].isOverlay)continue;if(d[i].getType()==t){this.byType[t]=d[i];return d[i];}}return false;}},toLatLng:function(units){return units.clone().transform(_this.getMap().getProjectionObject(),new OpenLayers.Projection("EPSG:4326"));},fromLatLng:function(latlng){return latlng.clone().transform(new OpenLayers.Projection("EPSG:4326"),_this.getMap().getProjectionObject());},getBounds:function(ll){var m=_this.getMap(),tl = m.getLonLatFromPixel(new OpenLayers.Pixel(0,0)),s=m.getSize(),br=m.getLonLatFromPixel(new OpenLayers.Pixel(s.w,s.h)),b=new OpenLayers.Bounds();if (!ll) {b.extend(_this.toLatLng(tl));b.extend(_this.toLatLng(br));}else{b.extend(tl);b.extend(br);}return b;},getCenter:function(ll,s){var c=_this.getMap().getCenter();if(!ll)c=_this.toLatLng(c);return s?c.toStr():c;},contextMenuEntries:{entries:[],register:function(entry){this.entries.push(entry);}},getSize:function(){return _map.getSize();},panNorthWest:function(){_map.pan(0-_panD,0-_panD);return false;},panNorth:function(){_map.pan(0,0-_panD);return false;},panNorthEast:function(){_map.pan(_panD,0-_panD);return false;},panEast:function(){_map.pan(_panD,0);return false;},panSouthEast:function(){_map.pan(_panD,_panD);return false;},panSouth:function(){_map.pan(0,_panD);return false;},panSouthWest:function(){_map.pan(0-_panD,_panD);return false;},panWest:function(){_map.pan(0-_panD,0);return false;},zoomOut:function(){_map.zoomOut();return false;},zoomIn:function(){_map.zoomIn();return false;},zoomTo:function(z){_map.zoomTo(z);return false;},setResizeDecorator:function(d){resizeDecorator=d;},resize:function(){if(resizeDecorator)resizeDecorator.resize(true);},onmoveend:function(){},onmovestart:function(){},onzoomend:function(){},onadddecorator:function(){},onaddlayer:function(){},onremovelayer:function(){},onchangelayer:function(){}};_this.init(o);return _this;};
 citysam.map.Decorator=OpenLayers.Class({map:null,id:null,options:null,isOverlay:false,name:"",visibility:true,contextMenuTitles:null,initialize:function(options) {this.addOptions(options);this.map.addDecorator(this);},addOptions:function(newOptions){if(this.options==null)this.options={};OpenLayers.Util.extend(this.options,newOptions);OpenLayers.Util.extend(this,newOptions);},getVisibility:function(){return this.visibility;},setVisibility:function(v){this.visibility=v;},CLASS_NAME:"citysam.map.Decorator" }
);citysam.map.Decorator.Overlay=OpenLayers.Class(citysam.map.Decorator,{layer:null,isOverlay:true,cssClassPopupC:"",cssClassPopupM:"",cssClassPopupS:"",tileURL:"",dataURL:"",initialize:function(options){citysam.map.Decorator.prototype.initialize.apply(this,[options]);this.redraw();},redraw:function(){if(!this.getVisibility()){if((layer=this.getLayer(false))&&layer.getVisibility())layer.setVisibility(false);return;} else {if((layer=this.getLayer(false))&&!layer.getVisibility())layer.setVisibility(true);}this.getLayer().redraw();},setVisibility:function(v){citysam.map.Decorator.prototype.setVisibility.apply(this,[v]);this.redraw();},getLayer:function(create){if(create==false||this.layer!=null)return this.layer;this.layer=new citysam.map.OverlayLayer(this);this.map.getMap().addLayer(this.layer);return this.layer;},getType:function(){return this.type;},onLayerReceiveData:function(data){},CLASS_NAME:"citysam.map.Decorator.Overlay" }
);citysam.map.Decorator.Hotels=OpenLayers.Class(citysam.map.Decorator.Overlay,{type:"hotels",form:null,formOptions:"",searchAv:false,waitD:null,geocoder:null,tO:null,initialize:function(options){citysam.map.Decorator.Overlay.prototype.initialize.apply(this,[options]);citysam.DOM.bindEvent("onload",window,this.initForm,null,this);if((typeof GBrowserIsCompatible == "function") && GBrowserIsCompatible()){this.geocoder=new GClientGeocoder();}},redraw:function(){if(this.tO)window.clearTimeout(this.tO);if(this.getVisibility()&&this.searchAv){this.drawWait(true);}citysam.map.Decorator.Overlay.prototype.redraw.apply(this);},getLayerOptionsString:function(){var t=new Date();return this.formOptions + "y;"+t.getTime()+";";},initForm:function(){var o;if (o=$("#mn5ix")){citysam.DOM.bindEvent("onsubmit",o,this.refreshForm,null,this);this.form=o;}},refreshForm:function(){var s="",o,i,v,q,_dS;for(i=0;i<this.form.elements.length;i++){o=this.form.elements[i];if(!o.name)continue;if(o.name=="dsrch"){q=o.value;_dS=o;continue;}if((o.type!="checkbox"&&o.type!="radio")||o.checked){v=o.value;v=v.replace(/#/,"").replace(/\\/,"\\\\").replace(/;/,"\\;");s+=o.name+";"+v+";";}if(o.name=="vfg")this.searchAv=o.checked;}if (_dS)_dS.className="";this.formOptions=s;if(q&&this.geocoder){var _t=this;this.geocoder.getLatLng(q,function(p){if(!p){_dS.className="mn5iz";var f=function(){this.className="";Citysam.DOM.deleteEvents("onkeydown",this,"_dS");Citysam.DOM.deleteEvents("onfocus",this,"_dS");};Citysam.DOM.bindEvent("onkeydown",_dS,f,"_dS");Citysam.DOM.bindEvent("onfocus",_dS,f,"_dS");}else{_t.map.getMap().setCenter(_t.map.fromLatLng(new OpenLayers.LonLat(p.lng(),p.lat())),14);_dS.value="";}});} else {this.map.redrawOverlays();this.map.onchangelayer();}return false;},drawWait:function(visible){if(!this.waitD){this.waitD=OpenLayers.Util.createDiv();this.waitD.className="mn5iy";this.map.getContainer().appendChild(this.waitD);}this.waitD.style.display=visible?"block":"";},onLayerReceiveData:function(data){if(data["r"]){if(this.tO)window.clearTimeout(this.tO);this.tO=window.setTimeout((function(_t){return function(){_t.redraw.apply(_t);};})(this),data["r"]*1000);} else {this.drawWait(false);}},CLASS_NAME:"citysam.map.Decorator.Hotels" }
);citysam.map.Decorator.Sights=OpenLayers.Class(citysam.map.Decorator.Overlay,{type:"sights",minZoom:0,returnSightLinks:0,initialize:function(options){citysam.map.Decorator.Overlay.prototype.initialize.apply(this,[options]);},getLayerOptionsString:function(){var s="";if(!this.baseURLPopup)s+="sL;1;";return s;},getVisibility:function(){return citysam.map.Decorator.Overlay.prototype.getVisibility.apply(this) && (this.map.getMap().getZoom()>=this.minZoom);},CLASS_NAME:"citysam.map.Decorator.Sights" }
);citysam.map.Decorator.Zoom=OpenLayers.Class(citysam.map.Decorator,{maxZoom:18,minZoom:0,barElements:0,barSelElement:0,barClassActive:"",barClassInactive:"",cMEIn:null,cMEOut:null,initialize:function(options){citysam.map.Decorator.prototype.initialize.apply(this,[options]);var o,i,dm;if(o=$("#"+this.id+"ZO"))citysam.DOM.bindEvent("onclick",o,function(){$("#"+this.id+"ZO").blur();return this.map.zoomOut();},null,this);if(o=$("#"+this.id+"ZI"))citysam.DOM.bindEvent("onclick",o,function(){$("#"+this.id+"ZI").blur();return this.map.zoomIn();},null,this);dm=this.barElements / (this.maxZoom-this.minZoom+1);for(i=0;i<this.barElements;i++){if(o=$("#"+this.id+"ZB"+i))citysam.DOM.bindEvent("onclick",o,(function(){var z=i*dm,_o=o;return function(){o.blur();return this.map.zoomTo(z);};})(),null,this);}citysam.DOM.bindEvent("onzoomend",this.map,this.updZB,null,this);if(this.contextMenuTitles){if(this.contextMenuTitles.ZoomIn)this.cMEIn=new citysam.map.ContextMenuEntry({map:this.map,title:this.contextMenuTitles.ZoomIn,onClick:{func:this.map.zoomIn,context:this.map}});if(this.contextMenuTitles.ZoomOut)this.cMEOut=new citysam.map.ContextMenuEntry({map:this.map,title:this.contextMenuTitles.ZoomOut,onClick:{func:this.map.zoomOut,context:this.map}});}},updZB:function(){this.updZBC(this.barClassInactive,this.barSelElement);this.barSelElement=Math.floor(this.map.getMap().getZoom()/(this.maxZoom-this.minZoom+1)*this.barElements);this.updZBC(this.barClassActive,this.barSelElement);},updZBC:function(c,e){var o,cN;if(!(o=$("#"+this.id+"ZB"+e)))return;o.className=(typeof c=="string")?c:c[e];},CLASS_NAME:"citysam.map.Decorator.Zoom" }
);citysam.map.Decorator.Resize=OpenLayers.Class(citysam.map.Decorator,{size:1,div:null,icon:null,cssClass:"",resizeIcons:{},dockingArea:null,origSizes:null,cME:null,rT:null,initialize:function(dockingArea, options){citysam.map.Decorator.prototype.initialize.apply(this,[options]);this.map.setResizeDecorator(this);this.dockingArea=dockingArea;this.div=OpenLayers.Util.createDiv();this.div.className=this.cssClass;this.div.style.position="absolute";this.div.style.visibility="hidden";this.icon=document.createElement("a");this.icon.href="#";this.updateIcon();this.div.appendChild(this.icon);citysam.DOM.bindEvent("onclick",this.icon,function(){this.icon.blur();this.resize(false);return false;},null,this);citysam.DOM.bindEvent("onresize",window,function(){if(this.rT)window.clearTimeout(this.rT);this.rT=window.setTimeout((function(){var t=this;return function(){t.resize(true);};}).apply(this),500);},null,this);dockingArea.appendChild(this.div);this.div.style.visibility="";if(this.contextMenuTitles.ToBig&&this.contextMenuTitles.ToNorm)this.cME=new citysam.map.ContextMenuEntry({map:this.map,title:this.contextMenuTitles.ToBig,onClick:{func:function(){this.resize();return false;},context:this}});},updateIcon:function(f){if(!f)f=this.size;if(!this.resizeIcons[f])return;this.icon.className=this.resizeIcons[f];},resize:function(noChange){this.getOrigSizes();if((this.size==1&&!noChange)||(this.size==2&&noChange)){this.resizeBig();} else {this.resizeNorm();}this.updateIcon();this.resizeNav();this.map.getMap().updateSize();this.redockDecorators();if(this.cME){this.cME.title=this.contextMenuTitles[(this.size==1)?"ToBig":"ToNorm"];this.cME.updateDOM();}},resizeBig:function(){var o,p,s;$("#mn38u").style.width="auto";var mI=this.map.getId();var w=citysam.gui.getWinDim();var omT=this.origSizes.mapT;var mT=$("#"+mI+"T");var bH=mT.offsetTop;var nH=w.h-(2*bH);if(nH>omT.h)mT.style.height=nH+"px";window.scrollTo(0,citysam.gui.getEPosWH(mT).y-bH);if((o=$("#mn390"))&&(p=$("#mn395"))){o.style.width=(citysam.gui.getEWH(o.parentNode).w-citysam.gui.getEWH(p).w-12)+"px";}if(document.all){if(o=$("#"+mI+"C"))o.style.height=nH+"px";}this.size=2;},resizeNorm:function(){$("#mn38u").style.width="";var mI=this.map.getId(),mT=$("#"+mI+"T").style,oS=this.origSizes;mT.height=oS.mapT.h+"px";if((o=$("#mn390"))&&(p=$("#mn395"))){o.style.width=this.origSizes.mWSS.w+"px";}if(document.all){if(o=$("#"+mI+"C"))o.style.height=mT.height;}this.size=1;},resizeNav:function(){if(!document.all)return;if(!this.origSizes.hasNav)return;var mI=this.map.getId(),t=citysam.gui.getEWH($("#"+mI+"T"));$("#"+mI+"nL").style.height=t.h+"px";$("#"+mI+"nR").style.height=t.h+"px";},redockDecorators:function(){var i,d=this.map.getDecorators();for(i in d){if(d[i].redock)d[i].redock(this.size);}},getDecoratorSubtractWidth:function(){var i,d=this.map.getDecorators(),w=0;for(i in d){if(d[i].subtractWidth)w+=d[i].subtractWidth();}return w;},getOrigSizes:function(){if(this.origSizes)return;this.origSizes={};var mI=this.map.getId(),o;this.origSizes.mapT=citysam.gui.getEPosWH($("#"+mI+"T"));this.origSizes.mapC=citysam.gui.getEWH($("#"+mI+"C"));this.origSizes.borderW=this.origSizes.mapT.w-this.origSizes.mapC.w;this.origSizes.borderH=this.origSizes.mapT.h-this.origSizes.mapC.h;this.origSizes.hasNav=!!(o=$("#"+mI+"nTL"));if(this.origSizes.hasNav)this.origSizes.nav=citysam.gui.getEWH(o);this.origSizes.mWSS=(o=$("#mn390"))?citysam.gui.getEWH(o):null;},CLASS_NAME:"citysam.map.Decorator.Resize" }
);citysam.map.Decorator.ContextMenu = OpenLayers.Class(citysam.map.Decorator,{context:null,entries:null,cssClass:"",cssClassSep:"",cssClassEntrySel:"",div:null,divS:null,display:null,CONTEXT_EVENT_TYPES:["click","contextmenu","mouseout","mouseover"],EVENT_TYPES:["mousemove"],contextEvents:null,events:null,hT:null,initialize:function(context,options){citysam.map.Decorator.prototype.initialize.apply(this,[options]);if(this.id==null)this.id=this.CLASS_NAME;this.context=context;this.entries={};this.div=document.createElement("div");this.div.id=this.id;this.div.style.display="none";this.div.style.position="absolute";this.div.className=this.cssClass;this.divS=document.createElement("div");this.divS.style.display="none";this.divS.style.position="absolute";this.divS.style.backgroundColor="black";this.divS.style.zIndex=2000;this.divS.style.opacity=0.3;this.divS.style.filter="Alpha(opacity=30, finishopacity=30, style=2)";this.context.appendChild(this.div);this.context.appendChild(this.divS);this.display=false;this.entries=this.map.contextMenuEntries.entries;this.contextEvents = new OpenLayers.Events(this,  this.context,  this.CONTEXT_EVENT_TYPES,  true,  {includeXY: true});this.contextEvents.register("click",this,this.hide);this.contextEvents.register("contextmenu",this,this.show);this.contextEvents.register("mouseout",this,this.startHide);this.contextEvents.register("mouseover",this,this.stopHide);this.events = new OpenLayers.Events(this,this.div,this.EVENT_TYPES,true );this.events.register("mousemove",this,function(e){OpenLayers.Event.stop(e);});citysam.DOM.bindEvent("oncontextmenu",this.context,function(){return false;});},rebuild:function(){var i,j,byP={},e,l,d;for(i=this.div.childNodes.length-1;i>=0;i--){this.div.removeChild(this.div.childNodes[i]);}for(i=0;i<this.entries.length;i++){e=this.entries[i];if(!byP[e.priority])byP[e.priority]=[];byP[e.priority].push(e);}for(i in byP)for(j=0;j<byP[i].length;j++){if(l&&(l.isGroup||byP[i][j].isGroup)){d=document.createElement("div");d.innerHTML="<div>&nbsp;</div>";d.className=this.cssClassSep;this.div.appendChild(d);}l=byP[i][j];this.div.appendChild(l.getDOM());l.checkSelected(this.setSelected,this);}},setSelected:function(o,s){if(s||o.className){o.className=s?this.cssClassEntrySel:"";}},show:function(e){if(!this.entries.length)return;this.rebuild();this.div.style.visibility="hidden";this.div.style.display="";var x=e.xy.x,y=e.xy.y,p=citysam.gui.getEWH(this.div),xy=citysam.gui.rePos({L:x,R:x,T:y,B:y},p,this.map.getMap().getSize(),3,0);this.div.style.left=xy.x+"px";this.div.style.top =xy.y+"px";this.divS.style.width=p.w+"px";this.divS.style.height=p.h+"px";this.divS.style.left=(xy.x+3)+"px";this.divS.style.top=(xy.y+3)+"px";this.div.style.visibility="";this.divS.style.display="";this.display=true;return false;},hide:function(e){if(!this.display)return;this.div.style.display="none";this.divS.style.display="none";this.display=false;},startHide:function(){this.stopHide();this.hT=window.setTimeout((function(){var t=this;return function(){t.hide();};}).apply(this),1000);},stopHide:function(){if(this.hT)window.clearTimeout(this.hT);},CLASS_NAME:"citysam.map.Decorator.ContextMenu" }
);citysam.map.Decorator.LayerSwitcher = OpenLayers.Class(citysam.map.Decorator,{cssClassLA:"",cssClassLI:"",cssClassLNA:"",cssClassLNI:"",layerDiv:null,cMGO:null,cMGL:null,initialize:function(options){citysam.map.Decorator.prototype.initialize.apply(this,[options]);this.cMGO=new citysam.map.ContextMenuEntry.Group({map:this.map});this.cMGL=new citysam.map.ContextMenuEntry.Group({map:this.map});var i,d=this.map.getDecorators(),l=this.map.mapTypes.supported;for(i in d){this.addOverlay(d[i]);}for(i in l){this.addLayer(l[i]);}citysam.DOM.bindEvent("onadddecorator",this.map,this.addOverlay,null,this);},addOverlay:function(d){if(!d.isOverlay)return;var o=$("#"+this.id+"_"+d.id+"B");this.cMGO.addEntry(new citysam.map.ContextMenuEntry({title:d.name,onClick:{func:function(){this.switchOverlay(d);return false;},context:this},selObj:o,selField:"checked"}));citysam.DOM.bindEvent("onclick",o,function(){this.updateOverlay(d);},null,this);},updateOverlay:function(d){d.setVisibility($("#"+this.id+"_"+d.id+"B").checked);},switchOverlay:function(d){if(o=$("#"+this.id+"_"+d.id+"B")){o.checked=!o.checked;}this.updateOverlay(d);},addLayer:function(l){if(!l.typeAbbr)return;var o=$("#"+this.id+"_"+l.id+"B");if(!o)return;this.cMGL.addEntry(new citysam.map.ContextMenuEntry({title:l.name,onClick:{func:function(){this.showLayer(l);return false;},context:this},selObj:o,selField:"checked"}));citysam.DOM.bindEvent("onclick",o,function(){this.showLayer(l);},null,this);},showLayer:function(l){$("#"+this.id+"_"+l.id+"B").checked=true;this.map.setBaseLayer(this.map.mapTypes.getLayer(l.id));},CLASS_NAME:"citysam.map.Decorator.LayerSwitcher" }
);citysam.map.Decorator.Sidebar = OpenLayers.Class(citysam.map.Decorator,{div:null,scrollDiv:null,scrollContainer:null,wheelListener:null,featureLists:[],scrolling:false,size:1,origSizes:null,cssEL:"",cssEL2:"",cssER:"",divE:"",initialize:function(options){var o;citysam.map.Decorator.prototype.initialize.apply(this,[options]);this.div=$("#"+this.id);this.scrollDiv=$("#"+this.id+"S");this.scrollContainer=$("#"+this.id+"C");this.wheelListener=OpenLayers.Function.bindAsEventListener(this.onWheelEvent,this);var wheelListener=this.wheelListener;OpenLayers.Event.observe(window,"DOMMouseScroll",wheelListener);OpenLayers.Event.observe(window,"mousewheel",wheelListener);OpenLayers.Event.observe(document,"mousewheel",wheelListener);if(o=$("#"+this.id+"NT")){citysam.DOM.bindEvent("onmouseover",o,function(){this.startScroll(20);},null,this);citysam.DOM.bindEvent("onmouseout",o,function(){this.stopScroll();},null,this);citysam.DOM.bindEvent("onclick",o,function(){this.scroll(200);return false;},null,this);}if(o=$("#"+this.id+"NB")){citysam.DOM.bindEvent("onmouseover",o,function(){this.startScroll(-20);},null,this);citysam.DOM.bindEvent("onmouseout",o,function(){this.stopScroll();},null,this);citysam.DOM.bindEvent("onclick",o,function(){this.scroll(-200);return false;},null,this);}citysam.DOM.bindEvent("onclick",$("#"+this.id+"R"),this.resize,null,this);citysam.DOM.bindEvent("onload",window,function(){this.resize(null,true);},null,this);if(this.cssER&&this.cssEL&&this.cssEL2){this.divE=document.createElement("div");this.divE.className=this.cssER;this.divE.style.zIndex=1000;this.div.appendChild(this.divE);citysam.DOM.bindEvent("onclick",this.divE,this.resize,null,this);}},onWheelEvent:function(e){var overScrollDiv=false;elem=OpenLayers.Event.element(e);while((elem!=null)&&!overScrollDiv){overScrollDiv=(elem==this.scrollDiv);elem=elem.parentNode;}if(overScrollDiv){var delta=0;if(!e)e=window.event;if(e.wheelDelta){delta=e.wheelDelta/120;if(window.opera&&window.opera.version()<9.2)delta=-delta;}else if(e.detail){delta=-e.detail/3;}if(delta){this.scroll(delta*40);}OpenLayers.Event.stop(e);}},scroll:function(d){var _t=this.scrollDiv.style.top,t=parseInt(_t.substr(0,_t.length-2)),wh=citysam.gui.getEWH(this.scrollDiv),whC=citysam.gui.getEWH(this.scrollContainer),nt;if(wh.h<=whC.h){nt=0;} else {nt=t+d;if(nt<whC.h-wh.h)nt=whC.h-wh.h;if(nt>0)nt=0;}this.scrollDiv.style.top=nt+"px";},startScroll:function(d){if(this.scrolling)return;this.scrolling=window.setInterval((function(){var _d=d,t=this;return function(){t.scroll(_d);};}).apply(this),100);},stopScroll:function(){if(this.scrolling)window.clearInterval(this.scrolling);this.scrolling=false;},addFeatureList:function(list){this.featureLists.push(list);list.container=this;list.map=this.map;},redock:function(s){var m=this.map,mI=m.getId(),I=this.id,mT=$("#"+mI+"T"),bH=2*mT.offsetTop,whT=citysam.gui.getEWH(mT),whS=citysam.gui.getEWH(this.scrollDiv),nt=$("#"+I+"NT"),nb=$("#"+I+"NB"),ntH=0,nbH=0;whT.h+=bH; this.div.style.height=whT.h+"px";$("#"+I+"I").style.height=(whT.h-2)+"px";if(whS.h>whT.h-2){nt.style.display="block";nb.style.display="block";ntH=citysam.gui.getEWH(nt).h;nbH=citysam.gui.getEWH(nb).h;}else{nt.style.display="none";nb.style.display="none";this.scrollDiv.style.top="0px";}this.scrollContainer.style.height=(whT.h-2-ntH-nbH)+"px";if(s)this.divE.className=(this.size!=1)?this.cssER:this.cssEL2;},subtractWidth:function(){return citysam.gui.getEWH(this.div).w;},resize:function(e,noC){var mW;this.getOrigSizes();if(!(this.size==1)!=!noC){$("#"+this.id+"L").style.display="none";mW=citysam.gui.getEWH($("#"+this.id+"R")).w;this.size=2;}else{$("#"+this.id+"L").style.display="";mW=this.origSizes.div.w;this.size=1;}this.div.style.width=mW+"px";$("#"+this.map.getId()+"T").parentNode.style.marginRight=(parseInt(mW)-((document.all)?3:0))+"px";this.map.resize();},getOrigSizes:function(){if(this.origSizes)return;this.origSizes={div:citysam.gui.getEWH($("#"+this.id))};},CLASS_NAME:"citysam.map.Decorator.Sidebar" }
);citysam.map.Decorator.PermaLink = OpenLayers.Class(citysam.map.Decorator,{cssActive:"",cssInactive:"",divA:null,divC:null,linkC:null,active:false,permaURL:"",cME:null,initialize:function(options){citysam.map.Decorator.prototype.initialize.apply(this,[options]);this.divA=$("#"+this.id+"A");this.divC=$("#"+this.id+"C");this.linkC=$("#"+this.id+"T");citysam.DOM.bindEvent("onclick",this.divA,this.switchActive,null,this);citysam.DOM.bindEvent("onfocus",this.linkC,function(){this.select();});var a=["moveend","addlayer","removelayer","changelayer"],i;for(i in a){citysam.DOM.bindEvent("on"+a[i],this.map,this.refreshLink,null,this);}if(this.contextMenuTitles)this.cME=new citysam.map.ContextMenuEntry({map:this.map,title:this.contextMenuTitles,onClick:{func:this.addBookmark,context:this}});},switchActive:function(){this.active=!this.active;this.refreshLink();this.divC.style.display=this.active?"block":"none";this.divA.className=this.active?this.cssActive:this.cssInactive;this.linkC.select();return false;},getLink:function(){var url=this.permaURL,m=this.map,i,d=m.getDecorators(),o="";url=url.replace(/=_ll/g,"="+m.getCenter(false,true));url=url.replace(/=_z/g,"="+m.getMap().getZoom());url=url.replace(/=_mt/g,"="+m.mapTypes.currentType);for(i in d){if(!d[i].isOverlay||!d[i].getVisibility())continue;o+=d[i].getType()+":"+d[i].getLayerOptionsString()+":";}url=url.replace(/=_ol/g,"="+escape(o));return url;},refreshLink:function(){if(!this.active)return;this.linkC.value=this.getLink();},addBookmark:function(){citysam.gui.addBookmark(this.getLink(),document.title);return false;},CLASS_NAME:"citysam.map.Decorator.PermaLink" }
);citysam.map.Decorator.PrintButton = OpenLayers.Class(citysam.map.Decorator,{printURL:"",linkA:null,linkEA:null,cMEG:null,initialize:function(options){citysam.map.Decorator.prototype.initialize.apply(this,[options]);this.linkA=$("#"+this.id+"A");this.linkEA=$("#"+this.id+"EA");var a=["moveend","addlayer","removelayer","changelayer"],i;for(i in a){citysam.DOM.bindEvent("on"+a[i],this.map,this.refreshLink,null,this);}if(this.contextMenuTitles){this.cMEG=new citysam.map.ContextMenuEntry.Group({map:this.map});if(this.contextMenuTitles.Print)this.cMEG.addEntry(new citysam.map.ContextMenuEntry({title:this.contextMenuTitles.Print,href:this.linkA.href,target:this.linkA.target}));if(this.contextMenuTitles.PrintLayout)this.cMEG.addEntry(new citysam.map.ContextMenuEntry({title:this.contextMenuTitles.PrintLayout,href:this.linkEA.href,target:this.linkEA.target}));}},refreshLink:function(){var url=this.printURL,m=this.map,i,d=m.getDecorators(),o="",s=m.getSize();url=url.replace(/=_ll/g,"="+m.getCenter(false,true));url=url.replace(/=_z/g,"="+m.getMap().getZoom());url=url.replace(/=_mt/g,"="+m.mapTypes.currentType);url=url.replace(/=_ps/g,"="+s.w+"x"+s.h);for(i in d){if(!d[i].isOverlay||!d[i].getVisibility())continue;o+=d[i].getType()+":"+d[i].getLayerOptionsString()+":";}url=url.replace(/=_ol/g,"="+escape(o));this.linkA.href=url.replace(/=_pt/,"=print");this.linkEA.href=url.replace(/=_pt/,"=printconf");},CLASS_NAME:"citysam.map.Decorator.PrintButton" }
);citysam.map.Decorator.SearchHighlights = OpenLayers.Class(citysam.map.Decorator,{highlights:"",layer:null,icon:null,iconSize:null,iconURL:null,marker:null,initialize:function(options){citysam.map.Decorator.prototype.initialize.apply(this,[options]);this.icon=new OpenLayers.Icon(this.iconURL,this.iconSize,new OpenLayers.Pixel(-(this.iconSize.w/2),-(this.iconSize.h/2)));this.layer=new OpenLayers.Layer.Markers();this.map.getMap().addLayer(this.layer);this.layer.div.style.zIndex=999;this.highlight();},highlight:function(){var s=this.highlights.split(","),c=s.length,i;for(i=0;i<c;i+=2){this.layer.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(parseFloat(s[i+1]),parseFloat(s[i])),this.icon.clone()));}},CLASS_NAME:"citysam.map.Decorator.SearchHighlights" }
);citysam.map.ContextMenuEntry = OpenLayers.Class({options:null,map:null,group:null,id:null,priority:0,title:"",onClick:null,href:null,target:"_blank",dom:null,isGroup:false,selObj:null,selField:null,initialize:function(options){this.addOptions(options);if(!this.id)this.id=OpenLayers.Util.createUniqueID("ContextMenuEntry");if(this.map)this.map.contextMenuEntries.register.apply(this.map.contextMenuEntries, [this]);},getMap:function(){return this.group?this.group.getMap():this.map;},addOptions:function(newOptions){if(this.options==null)this.options={};OpenLayers.Util.extend(this.options,newOptions);OpenLayers.Util.extend(this,newOptions);},getDOM:function(){if(this.dom==null){this.dom=document.createElement("a");this.dom.id=this.id;this.updateDOM();}return this.dom;},updateDOM:function(){var d=this.dom;if(!d)return;d.innerHTML=this.title;if(this.href){d.href=this.href;if(this.target)d.target=this.target;} else {d.href="#";citysam.DOM.deleteEvents("onclick",d,this.id);citysam.DOM.bindEvent("onclick",d,this.onClick.func,this.id,this.onClick.context);}},isSelected:function(){return (this.selObj!=null&&this.selField!=null&&this.selObj[this.selField]);},checkSelected:function(f,c){f.apply(c,[this.dom,this.isSelected()]);},CLASS_NAME:"citysam.map.ContextMenuEntry" }
);citysam.map.ContextMenuEntry.SaveMapTile = OpenLayers.Class(citysam.map.ContextMenuEntry,{tileURL:null,initialize:function(options){citysam.map.ContextMenuEntry.prototype.initialize.apply(this,[options]);this.title=this.name;this.onClick={func:this.saveMapTile,context:this};},saveMapTile:function(){var url=this.tileURL,m=this.getMap(),s=m.getMap().getSize();url=url.replace(/:b/g, m.getBounds(true).toArray().toString());url=url.replace(/:z/g, m.getMap().getZoom());url=url.replace(/:t/g, "saveMapTile");url=url.replace(/:s/g, s.w+"x"+s.h);url=url.replace(/:h/g, 0);var i,o="",d=m.getDecorators();for(i in d){if(!d[i].isOverlay||!d[i].getVisibility())continue;o+=d[i].getType()+":"+d[i].getLayerOptionsString()+":";}url=url.replace(/:o/g, o);window.open(url);return false;},CLASS_NAME:"citysam.map.ContextMenuEntry.SaveMapTile" }
);citysam.map.ContextMenuEntry.Group = OpenLayers.Class(citysam.map.ContextMenuEntry,{entries:null,isGroup:true,initialize:function(options){citysam.map.ContextMenuEntry.prototype.initialize.apply(this,[options]);this.entries=[];},addEntry:function(e){e.group=this;this.entries.push(e);},getDOM:function(){if(this.dom==null){this.dom=document.createElement("div");this.dom.id=this.id;var i,c=this.entries.length;for(i=0;i<c;i++){this.dom.appendChild(this.entries[i].getDOM());}}return this.dom;},updateDOM:function(){var e=this.entries,i,c=e.length;for(i=0;i<c;i++){e[i].updateDOM();}},checkSelected:function(f,c){var e=this.entries,i,a=e.length;for(i=0;i<a;i++){e[i].checkSelected(f,c);}},CLASS_NAME:"citysam.map.ContextMenuEntry.Group" }
);citysam.map.FeatureList = OpenLayers.Class({options:null,map:null,id:null,container:null,numFeatures:0,featureData:{},featureEvents:{},initialize:function(options){this.addOptions(options);var i,o,e;for(i=1;i<=this.numFeatures;i++){if(!(o=$("#"+this.id+"_"+i))) continue;for(e in this.featureEvents){citysam.DOM.bindEvent(e,o,(function(){var id=i,f=this.featureEvents[e];return function(){return this[f](id);};}).apply(this),null,this);}}},addOptions:function(newOptions){if(this.options==null)this.options={};OpenLayers.Util.extend(this.options,newOptions);OpenLayers.Util.extend(this,newOptions);},CLASS_NAME:"citysam.map.FeatureList" }
);citysam.map.FeatureList.Favorites = OpenLayers.Class(citysam.map.FeatureList,{featureEvents:{"onclick":"featureClick" },featureClick:function(id){this.map.getMap().zoomToExtent(OpenLayers.Bounds.fromString(this.featureData[id].bounds));return false;},CLASS_NAME:"citysam.map.FeatureList.Favorites" }
);citysam.map.OverlayLayer = OpenLayers.Class(OpenLayers.Layer.Image, {decorator: null,alwaysInRange: true,transitionEffect: null,alpha: false,returnGif: false,tileURL: "",dataURL: "",requestNum: 0,currRID: null,currRIDrN: null,initialize: function(decorator, options) {this.decorator=decorator;this.tileURL=decorator.tileURL,this.dataURL=decorator.dataURL,options = OpenLayers.Util.extend({isBaseLayer: false }, options);var newArguments = [decorator.name, this.getDecoratorURL(this.tileURL), this.getBounds(), this.getSize(), options];OpenLayers.Layer.Image.prototype.initialize.apply(this, newArguments);if(OpenLayers.Util.alphaHack())this.returnGif=true;},getDecoratorURL: function(url) {var s=this.getSize(),z=this.decorator.map.getMap().getZoom();if(z===null)return false;url=url.replace(/:b/g, this.getBounds().toArray().toString());url=url.replace(/:z/g, z);url=url.replace(/:t/g, this.decorator.getType());url=url.replace(/:s/g, s.w+"x"+s.h);url=url.replace(/:i/g, this.getRequestId());url=url.replace(/:h/g, (this.returnGif?1:0));url=url.replace(/:o/g, this.decorator.getLayerOptionsString());return url;},getBounds: function() {return this.decorator.map.getBounds(true);},getSize: function() {return this.decorator.map.getSize();},redraw: function() {this.extent=this.getBounds();if(this.extent.left===null)return;this.moveTo(this.extent);var u=this.getDecoratorURL(this.dataURL);if(u==false)return;this.url=this.getDecoratorURL(this.tileURL);citysam.script.load(u,this.getRequestId(true),this.receiveData,this);return OpenLayers.Layer.Image.prototype.redraw.apply(this);},getRequestId: function(cNew){if(this.currRIDrN!==this.requestNum){this.currRID="citysam_map_OverlayLayer_"+this.decorator.id+"_"+this.requestNum;this.currRIDrN=this.requestNum;}if(cNew===true)++this.requestNum;return this.currRID;},receiveData: function(data, id){if(id!=this.currRID)return;this.decorator.onLayerReceiveData(data);this.decorator.map.overlays.addData(data,this.decorator.type);},CLASS_NAME:"citysam.map.OverlayLayer" }
);citysam.map.Popup = OpenLayers.Class({options:null,id:null,visibility:false,content:null,map:null,overlay:null,divC:null,divM:null,divMs:null,divCs:null,requestNum:0,currRID:null,currRIDrN:null,anchor:null,timeGetContent:0,cssClassC:"",cssClassM:"",cssClassS:"",cssBC:null,cssBW:null,cssBS:null,shadowOffset:5,initialize:function(options){this.addOptions(options);if(this.overlay){if(!this.cssClassC)this.cssClassC=this.overlay.cssClassPopupC;if(!this.cssClassM)this.cssClassM=this.overlay.cssClassPopupM;if(!this.cssClassS)this.cssClassS=this.overlay.cssClassPopupS;if(!this.baseURL)this.baseURL=this.overlay.baseURLPopup;}},addOptions:function(newOptions){if(this.options==null)this.options={};OpenLayers.Util.extend(this.options,newOptions);OpenLayers.Util.extend(this,newOptions);},redraw:function(anchor){if(anchor){this.anchor=anchor;this.visibility=true;}if(this.content==null)return this.getContent();if(!this.visibility)return;this.v("display","");this.reposition();this.v("visibility","");},hide:function(noDelay){if(!this.visibility)return;if(noDelay){this.visibility=false;if(this.divC==null)return;this.v("display","none","visibility","hidden");}},getContent:function(){if(typeof this.getContentURL!="function")return;var d=new Date();if(d.getTime()-this.timeGetContent<5000)return;this.timeGetContent=d.getTime();citysam.script.load(this.getContentURL(),this.getRequestId(true),this.receiveContent,this);},receiveContent:function(data,id){if(id!=this.currRID)return;this.content=data.content;this.timeGetContent=0;if(this.divC==null)this.createDiv();this.divC.innerHTML=this.content;this.redraw();},getRequestId:function(cNew){if(this.currRIDrN!==this.requestNum){this.currRID=this.CLASS_NAME.replace(/\./g, "")+this.id+this.requestNum;this.currRIDrN=this.requestNum;}if(cNew===true)++this.requestNum;return this.currRID;},createDiv:function(){this.divC=OpenLayers.Util.createDiv();this.divC.className=this.cssClassC;this.divM=this.createMDiv();this.divM.className=this.cssClassM;this.divCs=OpenLayers.Util.createDiv();this.divCs.className=this.cssClassS;this.divMs=OpenLayers.Util.createDiv();this.divMs.className=this.cssClassS;this.v("visibility","hidden");var o=this.map.getContainer();o.appendChild(this.divC);o.appendChild(this.divM);o.appendChild(this.divCs);o.appendChild(this.divMs);},createMDiv:function(){return OpenLayers.Util.createDiv();},reposition:function(){if(this.cssBC==null)this.cssBC=citysam.gui.cssProp(this.divM,"borderTopColor");if(this.cssBW==null)this.cssBW=citysam.gui.cssProp(this.divM,"borderTopWidth");if(this.cssBS==null)this.cssBS=citysam.gui.cssProp(this.divM,"borderTopStyle");var m=citysam.gui.getEWH(this.divM),a=this.anchor,mL=a.x-Math.floor((m.w-a.w)/2),mR=mL+m.w,mT=a.y-Math.floor((m.h-a.h)/2),mB=mT+m.h,k=this.map.getMap().getSize(),c=citysam.gui.getEWH(this.divC),s=this.shadowOffset,p=3,q=(this.cssBW)?parseInt(this.cssBW.substr(0,this.cssBW.length-2)):1;var xyb=citysam.gui.rePos({L:mL,R:mR,T:mT,B:mB},c,k,p,q),x=xyb.x,y=xyb.y,b=xyb.b;this.divM.style.left=mL+"px";this.divM.style.top=mT+"px";this.divC.style.left=x+"px";this.divC.style.top=y+"px";var bw=(document.all)?"0px":this.cssBW;this.divM.style.borderTop=this.cssBS+" "+((b==1)?bw+" transparent":this.cssBW+" "+this.cssBC);this.divM.style.borderRight=this.cssBS+" "+((b==2)?bw+" transparent":this.cssBW+" "+this.cssBC);this.divM.style.borderBottom=this.cssBS+" "+((b==3)?bw+" transparent":this.cssBW+" "+this.cssBC);this.divM.style.borderLeft=this.cssBS+" "+((b==4)?bw+" transparent":this.cssBW+" "+this.cssBC);this.divCs.style.left=(x+s)+"px";this.divCs.style.top=(y+s)+"px";this.divCs.style.width=c.w+"px";this.divCs.style.height=c.h+"px";switch(b){case 1:m.h-=q;mT+=q;break;case 2:m.w-=q;break;case 3:m.h-=q;break;case 4:m.w-=q;mL+=q;break;}this.divMs.style.left=(mL+s)+"px";this.divMs.style.top=(mT+s)+"px";this.divMs.style.width=m.w+"px";this.divMs.style.height=m.h+"px";},v:function(){if(this.divC==null)return;var i,p,v;for(i=0;i<arguments.length;i+=2){p=arguments[i];v=arguments[i+1];this.divC.style[p]=v;this.divM.style[p]=v;this.divCs.style[p]=v;this.divMs.style[p]=v;}},CLASS_NAME:"citysam.map.Popup" }
);citysam.map.Popup.Hotel = OpenLayers.Class(citysam.map.Popup, {baseURL:null,getContentURL:function(){var url=this.baseURL;url=url.replace(/=_i/g,"="+this.getRequestId());url=url.replace(/=_o/g,"=id;"+this.id+";");return url;},CLASS_NAME:"citysam.map.Popup.Hotel" }
);citysam.map.Popup.Sight = OpenLayers.Class(citysam.map.Popup, {baseURL:null,fId:null,getContentURL:function(){var url=this.baseURL;url=url.replace(/=_i/g,"="+this.getRequestId());url=url.replace(/=_o/g,"=id;"+this.id+";");return url;},createMDiv:function(){var m=citysam.map.Popup.prototype.createMDiv.apply(this),s=document.createElement("span");s.innerHTML=this.fId;m.appendChild(s);return m;},CLASS_NAME:"citysam.map.Popup.Sight" }
);citysam.map.ScaleLine = OpenLayers.Class(OpenLayers.Control.ScaleLine, {topClass:"",bottomClass:"",csMap:null,maxWidth:150,minWidth:100,draw:function(){OpenLayers.Control.ScaleLine.prototype.draw.apply(this, arguments);if(this.eTop.className!=this.topClass){this.eTop.className=this.topClass;this.eBottom.style.display="none";}return this.div;},update: function() {if(!this.csMap)return;var b=this.csMap.getBounds();if(b.bottom<-85||b.bottom>85){this.eTop.style.display="none";return;}var sl=b.getScaleLine(this.map.getSize().w,this.minWidth,this.maxWidth),scale=sl.sc,u="m";if(scale>=10000){scale/=1000;u="km";}this.eTop.style.width=sl.px+"px";this.eTop.style.display="block";this.eTop.innerHTML=scale+u;},  CLASS_NAME:"citysam.map.ScaleLine" }
);OpenLayers.Util.Citysam={};
 OpenLayers.Util.Citysam.MISSING_TILE_URL = "/img/transparent.png";OpenLayers.Util.onImageLoadError = function() {if (this.src.search(/transparent\.png/)==-1){this.src=OpenLayers.Util.Citysam.MISSING_TILE_URL;}};
 OpenLayers.Layer.Citysam = OpenLayers.Class(OpenLayers.Layer.TMS, {wrapDateLine:true,transitionEffect:"resize",initialize: function(name, url, options) {options = OpenLayers.Util.extend({ numZoomLevels: 19 }, options);var newArguments = [name, url, options];OpenLayers.Layer.TMS.prototype.initialize.apply(this, newArguments);},getURL: function (bounds) {var res = this.map.getResolution();var x = Math.round((bounds.left - this.maxExtent.left) / (res * this.tileSize.w));var y = Math.round((this.maxExtent.top - bounds.top) / (res * this.tileSize.h));var z = this.map.getZoom();var limit = Math.pow(2, z);if (y < 0 || y >= limit){return OpenLayers.Util.Citysam.MISSING_TILE_URL;}else {x = ((x % limit) + limit) % limit;var url = this.url;var path = String.fromCharCode(z+97) + "/" + y + "/" + x + ".png";if (url instanceof Array){url = this.selectUrl(path, url);}return url + path;}},CLASS_NAME: "OpenLayers.Layer.Citysam" }
);OpenLayers.Layer.Citysam.Hybrid = OpenLayers.Class(OpenLayers.Layer.Citysam,{alpha:true,transitionEffect:null,initialize: function(name, url, options) {options = OpenLayers.Util.extend({ numZoomLevels: 19 }, options);var newArguments = [name, url, options];OpenLayers.Layer.TMS.prototype.initialize.apply(this, newArguments);},CLASS_NAME: "OpenLayers.Layer.Citysam.Hybrid" }
);