if(typeof gAJSMAPBASECLASS=="undefined"){var gAJSMAPBASECLASS="defined";if(Prototype.Version<"1.6"){Hash.prototype=Object.extend({set:function(a,b){this[a]=b},get:function(a){return this[a]},unset:function(a){return this.remove()}},Hash.prototype)}function browserCheck(d,c){var e=navigator.userAgent.indexOf(d);if(e!=-1){if(typeof c=="undefined"){return true}for(var b=1;b<2;++b){var a=parseFloat(navigator.userAgent.substring(e+(d).length+b));if(a!=NaN){return(a>=c)}}}return false}gBrowserCanvasAvailable=browserCheck("MSIE",6)||browserCheck("Firefox",1.5)||browserCheck("Opera",9)||browserCheck("Safari",300);var AJSMapBaseClass=Class.create();AJSMapBaseClass.prototype={initialize:function(){},addElem:function(a,e,d,b){if(document.getElementById(e)){alert('Element with id="'+e+'" already existing')}else{var c;if(a=="inputbutton"){c=document.createElement("input");c.type="button"}else{c=document.createElement(a)}c.id=e;Object.extend(c.style,d);if(a=="canvas"){c.width=parseInt(d.width);c.height=parseInt(d.height);c.appendChild(document.createTextNode("CANVAS NOT AVAILABLE"));b.appendChild(c);if(typeof G_vmlCanvasManager!="undefined"){G_vmlCanvasManager.initElement(c)}}else{b.appendChild(c)}return document.getElementById(e)}},clone_contentparams:function(c){var a=Object.clone(c);if(typeof c.coord!="undefined"){a.coord=c.coord.clone()}if(typeof c.hotspot!="undefined"){a.hotspot={x:c.hotspot.x,y:c.hotspot.y}}if(typeof c.coords!="undefined"){a.coords=new Array;for(var b=0;b<c.coords.length;b++){a.coords[b]=c.coords[b].clone()}}return a},decode:function(a){var b=a.replace(/&ouml;/g,"ö");b=b.replace(/&auml;/g,"ä");b=b.replace(/&uuml;/g,"ü");b=b.replace(/&Auml;/g,"Ä");b=b.replace(/&Uuml;/g,"Ü");b=b.replace(/&Ouml;/g,"Ö");b=b.replace(/&#252;/g,"ü");b=b.replace(/&#246;/g,"ö");b=b.replace(/&#228;/g,"ä");b=b.replace(/&#226;/g,"â");b=b.replace(/&#223;/g,"ß");b=b.replace(/&#196;/g,"Ä");b=b.replace(/&#214;/g,"Ö");b=b.replace(/&#220;/g,"Ü");b=b.replace(/&#248;/g,"ø");b=b.replace(/&#216;/g,"Ø");b=b.replace(/&#229;/g,"å");b=b.replace(/&#197;/g,"Å");b=b.replace(/&#230;/g,"æ");b=b.replace(/&#198;/g,"Æ");b=b.replace(/&#233;/g,"é");b=b.replace(/&#232;/g,"è");b=b.replace(/&#156;/g,"œ");b=b.replace(/&#140;/g,"Œ");b=b.replace(/&#/g,"");return b}}}if(typeof gCCoord=="undefined"){var gCCoord="defined";var CCoord=Class.create();CCoord.prototype=Object.extend(new AJSMapBaseClass(),{initialize:function(a){if(typeof a.lon!="undefined"){this.lon=a.lon}else{if(typeof a.longitude!="undefined"){this.lon=a.longitude}else{if(typeof a.x!="undefined"){this.lon=a.x}}}if(typeof a.swissx!="undefined"){this.swissx=a.swissx}if(typeof a.lat!="undefined"){this.lat=a.lat}else{if(typeof a.latitude!="undefined"){this.lat=a.latitude}else{if(typeof a.y!="undefined"){this.lat=a.y}}}if(typeof a.swissy!="undefined"){this.swissy=a.swissy}},clone:function(){return new CCoord(this)},getLat:function(){if(typeof this.lat=="undefined"&&typeof this.swissy!="undefined"&&typeof this.swissx!="undefined"){this.swiss2wgs84()}return this.lat},getLon:function(){if(typeof this.lon=="undefined"&&typeof this.swissy!="undefined"&&typeof this.swissx!="undefined"){this.swiss2wgs84()}return this.lon},getSwissX:function(){if(typeof this.swissx=="undefined"&&typeof this.lat!="undefined"&&typeof this.lon!="undefined"){this.wgs842swiss()}return this.swissx},getSwissY:function(){if(typeof this.swissy=="undefined"&&typeof this.lat!="undefined"&&typeof this.lon!="undefined"){this.wgs842swiss()}return this.swissy},swiss2wgs84:function(){var c=(this.swissx-600000)/1000000;var d=(this.swissy-200000)/1000000;var a=2.6779094+4.728982*c+0.791484*d*c+0.1306*c*d*d-0.0436*c*c*c;var b=16.9023892+3.238272*d-0.270978*c*c-0.002528*d*d-0.0447*c*c*d-0.014*d*d*d;this.lat=Math.round(b*100000000/36);this.lon=Math.round(a*100000000/36)},wgs842swiss:function(){var b=(this.lat*3600/1000000-169028.66)/10000;var a=(this.lon*3600/1000000-26782.5)/10000;this.swissy=Math.round(200147.07+308807.95*b+3745.25*a*a+76.63*b*b+119.79*b*b*b-194.56*a*a*b);this.swissx=Math.round(600072.37+211455.93*a-10938.51*a*b-0.36*a*b*b-44.54*a*a*a)}})}if(typeof gAAJAXMAP=="undefined"){var gAAJAXMAP="defined";var AAjaxMap=Class.create();AAjaxMap.prototype=Object.extend(new AJSMapBaseClass(),{mincenterzoom:100000,initialize:function(b,a){},show:function(){},scr2geo:function(a){return null},geo2scr:function(a){return null},centerToGeo:function(a){},setZoom:function(a){},createContent:function(a){return null},showContent:function(a){},hideContent:function(a){},removeContent:function(a){},centerToContent:function(a){},contentToTop:function(a){},contentToBottom:function(a){},setMinCenterZoom:function(a){this.mincenterzoom=a}})}if(typeof gAOWNAJAXMAP=="undefined"){var gAOWNAJAXMAP="defined";var AOwnAjaxMap=Class.create();AOwnAjaxMap.prototype=Object.extend(new AAjaxMap(),{initialize:function(){},initOwnAjaxMap:function(b,a){if(typeof a.maxzoom!="undefined"){this.maxzoom=Math.max(this.minzoom,Math.min(this.maxzoom,a.maxzoom))}if(typeof a.minzoom!="undefined"){this.minzoom=Math.max(this.minzoom,Math.min(this.maxzoom,a.minzoom))}if(typeof a.zoomonclick=="undefined"){a.zoomonclick=true}if(typeof a.centeronclick=="undefined"){a.centeronclick=true}this.debug=false;this.divcontainer=$(b);this.divcontainer.style.overflow="hidden";this.mapParams=a;this.width=this.divcontainer.clientWidth;this.height=this.divcontainer.clientHeight;this.mapwidth=this.width;this.mapheight=this.height;this.currentset=Math.min(Math.max(0,this.minzoom),this.maxzoom);this.contcount=0;this.content=new Hash()},show:function(){this.initDivs();this.centerMapInternal(this.mapParams.coord);this.drawControls();this.showMap();if(typeof this.mapParams.onshow!="undefined"){this.mapParams.onshow()}},createContent:function(a){if(typeof a.type=="undefined"){return null}this.contcount++;var b=this.contcount.toString();this.content.set(b,this.clone_contentparams(a));this.content.get(b).show=false;switch(a.type){case"location":this.createLocationDiv(b,this.content.get(b));break;case"container":this.createContainerDiv(b,this.content.get(b));break;case"polyline":case"route":this.createPolylineDiv(b,this.content.get(b));break;case"circle":this.createCircleDiv(b,this.content.get(b));break;default:return null}return b},showContent:function(a){var b=this.content.get(a);if(typeof b!="undefined"){b.show=true;b.div.each(function(c){if(typeof c!="undefined"){c.style.display="block"}})}},hideContent:function(a){var b=this.content.get(a);if(typeof b!="undefined"){b.show=false;b.div.each(function(c){if(typeof c!="undefined"){c.style.display="none"}})}},removeContent:function(a){var d=this.content.get(a);if(typeof d!="undefined"){for(var b=this.minzoom;b<=this.maxzoom;b++){this.removeChild(this.contentdiv[b],d.div[b])}this.content.unset(a)}},centerToGeo:function(a){this.centerMap(a)},getGeoBoundingBox:function(c){var f=180000000;var e=90000000;var b=-180000000;var a=-90000000;for(var d=0;d<c.length;d++){f=Math.min(f,c[d].getLon());b=Math.max(b,c[d].getLon());e=Math.min(e,c[d].getLat());a=Math.max(a,c[d].getLat())}return{min:new CCoord({lon:f,lat:e}),max:new CCoord({lon:b,lat:a})}},getCenterOfGeoBoundingBox:function(c){var a=this.geo2map(c.min,this.currentset);var b=this.geo2map(c.max,this.currentset);return this.map2geo({x:(b.x+a.x)/2,y:(b.y+a.y)/2},this.currentset)},getZoomForGeoBouningBox:function(d){for(var c=this.minzoom;c<=this.maxzoom;c++){var a=this.geo2map(d.min,c);var b=this.geo2map(d.max,c);if(Math.abs(b.x-a.x)>=this.mapwidth||Math.abs(b.y-a.y)>=this.mapheight){return Math.max(c-1,this.minzoom)}}return this.maxzoom},centerToGeos:function(a){var d=this.getGeoBoundingBox(a);var e=this.getCenterOfGeoBoundingBox(d);var b=this.getZoomForGeoBouningBox(d);this.setZoomInternal(b);this.centerMapInternal(e);this.showMap()},centerToContent:function(b){if(typeof b=="undefined"){return null}var a=this.content.get(b);if(typeof a=="undefined"){return null}if(typeof a.type=="undefined"){return null}switch(a.type){case"location":case"container":case"circle":this.centerToGeo(a.coord);return;case"polyline":case"route":this.centerToGeos(a.coords);return}},contentToTop:function(b){for(var d=this.minzoom;d<=this.maxzoom;d++){var e=this.content.get(b).div[d];if(typeof e=="undefined"){continue}var a=this.contentdiv[d];if(typeof a=="undefined"){continue}if(typeof e.nextSibling!="undefined"&&e.nextSibling!=null){a.removeChild(e);a.appendChild(e)}}},contentToBottom:function(b){for(var d=this.minzoom;d<=this.maxzoom;d++){var e=this.content.get(b).div[d];if(typeof e=="undefined"){continue}var a=this.contentdiv[d];if(typeof a=="undefined"){continue}if(e==a.firstChild){continue}a.removeChild(e);if(typeof a.firstChild=="undefined"){a.appendChild(e)}else{a.insertBefore(e,a.firstChild)}}},setGeometry:function(d,e,b,c,a){this.width=parseInt(d);this.height=parseInt(e);this.mapwidth=parseInt(b);this.mapheight=parseInt(c);this.centerMapInternal(this.centerg);this.showMap()},movePixel:function(b){var a=this.geo2map(this.centerg,this.currentset);a.x+=b.x;a.y+=b.y;this.centerMapInternal(this.map2geo(a,this.currentset));this.showMap()},centerMap:function(a){this.centerMapInternal(a);this.showMap()},increaseZoom:function(){if(this.getZoom()<this.maxzoom){this.setZoom(this.getZoom()+1)}},increaseZoomInternal:function(){if(this.getZoom()<this.maxzoom){this.setZoomInternal(this.getZoom()+1)}},decreaseZoom:function(){if(this.getZoom()>this.minzoom){this.setZoom(this.getZoom()-1)}},getZoom:function(){return this.currentset},setZoom:function(a){a=Math.min(Math.max(a,this.minzoom),this.maxzoom);if(a!=this.getZoom()){this.setZoomInternal(a);this.showMap()}},setZoomInternal:function(a){if(a>=this.minzoom&&a<=this.maxzoom&&a!=this.getZoom()){this.currentset=a;this.centerMapInternal(this.centerg);for(var b=this.minzoom;b<=this.maxzoom;b++){this.contentdiv[b].style.display=(b==this.getZoom())?"block":"none"}}},centerMapInternal:function(b){this.centerg=b;var d=this.geo2map(this.centerg,this.currentset);this.minmx=d.x-0.5*this.mapwidth;this.maxmx=d.x+0.5*this.mapwidth;this.minmy=d.y-0.5*this.mapheight;this.maxmy=d.y+0.5*this.mapheight;var a=this.tileset[this.currentset].width;var c=this.tileset[this.currentset].height;if(this.maxmx-this.minmx>a){this.minmx=0.5*(a-(this.maxmx-this.minmx));this.maxmx=a-this.minmx}else{if(this.minmx<0){this.minmx=0;this.maxmx=this.mapwidth}else{if(this.maxmx>a){this.maxmx=a;this.minmx=a-this.mapwidth}}}if(this.maxmy-this.minmy>c){this.minmy=0.5*(c-(this.maxmy-this.minmy));this.maxmy=c-this.minmy}else{if(this.minmy<0){this.minmy=0;this.maxmy=this.mapheight}else{if(this.maxmy>c){this.maxmy=c;this.minmy=c-this.mapheight}}}this.centerg=this.map2geo({x:0.5*(this.minmx+this.maxmx),y:0.5*(this.minmy+this.maxmy)},this.currentset);this.contentdiv[this.getZoom()].style.top=(-this.minmy).toString()+"px";this.contentdiv[this.getZoom()].style.left=(-this.minmx).toString()+"px"},initDivs:function(){this.mapdrawdiv=this.addDivElem("mapdrawdiv",this.divcontainer);if(browserCheck("MSIE")){this.mapdrawdiv.onclick=this.contentonclick.bind(this)}this.contentdiv=new Array;for(var a=this.minzoom;a<=this.maxzoom;a++){this.contentdiv[a]=this.addElem("div","contentdiv_"+a,{position:"absolute",display:(a==this.getZoom())?"block":"none",left:"0px",top:"0px",width:this.tileset[a].width+"px",height:this.tileset[a].height+"px",overflow:"hidden"},this.divcontainer);if(!browserCheck("MSIE")){this.contentdiv[a].onclick=this.contentonclick.bind(this)}}this.controldiv=this.addDivElem("controldiv",this.divcontainer);this.controldiv.style.width="0px";this.controldiv.style.height="0px";this.controldiv.style.overflow="visible"},contentonclick:function(b){if(!b){b=window.event}else{if(typeof b.currentTarget!="undefined"&&typeof b.target!="undefined"&&b.currentTarget!=b.target&&b.target.tagName!="CANVAS"){return}}this.finishedevent=b;var e=d(this.divcontainer);var a=Event.pointerX(b)-e.x;var f=Event.pointerY(b)-e.y;var c=this.scr2geo({x:a,y:f});if(this.mapParams.zoomonclick&&this.getZoom()<this.maxzoom){this.increaseZoomInternal()}if(this.mapParams.centeronclick){this.centerMap(c)}function d(h){var g=0;var i=0;while(h){g+=h.offsetLeft;i+=h.offsetTop;h=h.offsetParent}return{x:g,y:i}}},controlbuttonsize:20,drawControl:function(g,a,e,j,b){var f=this.controlbuttonsize.toString();var h=this.addElem("div",g+"div",{position:"absolute",display:"block",left:a+"px",top:e+"px",width:f+"px",height:f+"px"},this.controldiv);var c=this.addElem("img",g+"img",{width:f+"px",height:f+"px"},h);this.setElemOpacity(c,40);c.src=this.imagePath+j;Event.observe(c,"click",function(d){b(d);d.stop()}.bindAsEventListener(this));c.onmouseover=this.setElemOpacity.bind(this,c,100);c.onmouseout=this.setElemOpacity.bind(this,c,40)},setElemOpacity:function(b,a){b.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity="+a+")";b.style.opacity=a/100},drawControls:function(){var b=this.controlbuttonsize;var e=Math.round(b/3);var d=Math.round(b/6);var c=Math.round(b/12);var a=Math.round(b/2);this.drawControl("zoomin",e+a+c,e+3*b+3*d+c,"button_plus.gif",this.increaseZoom.bind(this));this.drawControl("zoomout",e+a+c,e+4*b+4*d+c,"button_minus.gif",this.decreaseZoom.bind(this));this.drawControl("left",e,e+b+d,"button_left.gif",this.movePixel.bind(this,{x:-this.mapwidth/3,y:0}));this.drawControl("right",e+b+d,e+b+d,"button_right.gif",this.movePixel.bind(this,{x:+this.mapwidth/3,y:0}));this.drawControl("up",e+a+c,e,"button_up.gif",this.movePixel.bind(this,{x:0,y:-this.mapheight/3}));this.drawControl("down",e+a+c,e+2*b+2*d,"button_down.gif",this.movePixel.bind(this,{x:0,y:this.mapheight/3}))},createLocationDiv:function(e,c){c.div=new Array;for(var i=this.minzoom;i<=this.maxzoom;i++){var a=this.geo2map(c.coord,i);a.x-=c.hotspot.x;a.y-=c.hotspot.y;var b=Math.max(c.imagewidth,typeof c.shadowwidth!="undefined"?c.shadowwidth:0);var d=Math.max(c.imageheight,typeof c.shadowheight!="undefined"?c.shadowheight:0);c.div[i]=this.addElem("div","imgdiv_"+i+"_"+e,{position:"absolute",display:"none",left:a.x+"px",top:a.y+"px",width:b+"px",height:d+"px",zIndex:"2"},this.contentdiv[i]);if(typeof c.shadowurl!="undefined"){var g=this.addElem("img","shad_"+i+"_"+e,{position:"absolute",display:"block",left:"0px",top:"0px",width:c.shadowwidth+"px",height:c.shadowheight+"px"},c.div[i]);g.src=c.shadowurl}var f=this.addElem("img","img_"+i+"_"+e,{position:"absolute",display:"block",left:"0px",top:"0px",width:c.imagewidth+"px",height:c.imageheight+"px"},c.div[i]);f.src=c.imageurl;f.title=c.text;if(typeof c.onclick!="undefined"){f.onclick=c.onclick}if(typeof c.onmousedown!="undefined"){f.onmousedown=c.onmousedown}if(typeof c.onmouseup!="undefined"){f.onmouseup=c.onmouseup}if(typeof c.onmouseover!="undefined"){f.onmouseover=c.onmouseover}if(typeof c.onmouseout!="undefined"){f.onmouseout=c.onmouseout}if(typeof c.oncontextmenu!="undefined"){f.oncontextmenu=c.oncontextmenu}if(typeof c.draggable!="undefined"&&c.draggable){c.draggableobject=new Draggable(c.div[i],{endeffect:false,onEnd:this.onDragLocationEnd.bind(this)});c.draggableobject.objid=e;c.draggableobject.zoom=i}}},onDragLocationEnd:function(c,e){if(typeof this.finishedevent!="undefined"&&this.finishedevent==e){return}var b=this.content.get(c.objid);var h=c.zoom;var d=this.map2geo({x:parseInt(b.div[h].style.left)+b.hotspot.x,y:parseInt(b.div[h].style.top)+b.hotspot.y},h);b.coord=d.clone();for(var f=this.minzoom;f<=this.maxzoom;f++){var a=this.geo2map(d,f);b.div[f].style.left=(a.x-b.hotspot.x).toString()+"px";b.div[f].style.top=(a.y-b.hotspot.y).toString()+"px"}if(typeof b.ondragend!="undefined"){b.ondragend(c.objid,d)}this.finishedevent=e},createContainerDiv:function(c,b){b.div=new Array;for(var d=this.minzoom;d<=this.maxzoom;d++){var a=this.geo2map(b.coord,d);a.x-=b.hotspot.x;a.y-=b.hotspot.y;b.div[d]=this.addElem("div","containerdiv_"+d+"_"+c,{position:"absolute",display:"none",left:a.x+"px",top:a.y+"px",zIndex:"2"},this.contentdiv[d]);b.div[d].innerHTML=b.content;if(typeof b.onclick!="undefined"){b.div[d].onclick=b.onclick}if(typeof b.onmousedown!="undefined"){b.div[d].onmousedown=b.onmousedown}if(typeof b.onmouseup!="undefined"){b.div[d].onmouseup=b.onmouseup}if(typeof b.onmouseover!="undefined"){b.div[d].onmouseover=b.onmouseover}if(typeof b.onmouseout!="undefined"){b.div[d].onmouseout=b.onmouseout}}},createPolylineDiv:function(n,j){if(gBrowserCanvasAvailable){j.div=new Array;j.m=new Array;for(var a=this.minzoom;a<=this.maxzoom;a++){var q=this.tileset[a].width;var d=0;var m=this.tileset[a].height;var b=0;j.m[a]=new Array;for(var e=0;e<j.coords.length;e++){j.m[a][e]=this.geo2map(j.coords[e],a);q=Math.min(q,j.m[a][e].x);d=Math.max(d,j.m[a][e].x);m=Math.min(m,j.m[a][e].y);b=Math.max(b,j.m[a][e].y)}q-=j.width/2;d+=j.width/2;m-=j.width/2;b+=j.width/2;var k=(d-q).toString()+"px";var f=(b-m).toString()+"px";j.div[a]=this.addElem("div","canvasdiv_"+a+"_"+n,{position:"absolute",display:"none",left:q+"px",top:m+"px",width:k,height:f,zIndex:"1"},this.contentdiv[a]);var g=this.addElem("canvas","canvas_"+a+"_"+n,{position:"absolute",display:"block",left:"0px",top:"0px",width:k,height:f},j.div[a]);if(g.getContext){var r=g.getContext("2d");r.lineWidth=j.width;r.strokeStyle=this.getRGBA(j.color,j.opacity);var o=j.m[a][0];var l;for(var e=1;e<j.coords.length;e++){l=j.m[a][e];this.drawLine(r,o.x-q,o.y-m,l.x-q,l.y-m);o=j.m[a][e]}}}}},createCircleDiv:function(m,i){if(gBrowserCanvasAvailable){i.div=new Array;for(var a=this.minzoom;a<=this.maxzoom;a++){var e=this.geo2map(new CCoord({swissx:i.coord.getSwissX()-i.radius,swissy:i.coord.getSwissY()+i.radius}),a);var b=this.geo2map(new CCoord({swissx:i.coord.getSwissX()+i.radius,swissy:i.coord.getSwissY()-i.radius}),a);var k=this.geo2map(i.coord,a);var j=(i.width+b.x-e.x+1).toString()+"px";var f=(i.width+b.y-e.y+1).toString()+"px";var d=e.x-i.width/2;var o=e.y-i.width/2;i.div[a]=this.addElem("div","canvasdiv_"+a+"_"+m,{position:"absolute",display:"none",left:d+"px",top:o+"px",width:j,height:f,zIndex:"1"},this.contentdiv[a]);var g=this.addElem("canvas","canvas_"+a+"_"+m,{position:"absolute",display:"block",left:"0px",top:"0px",width:j,height:f},i.div[a]);if(g.getContext){var n=g.getContext("2d");n.beginPath();n.lineWidth=i.width;n.strokeStyle=this.getRGBA(i.color,i.opacity);n.arc(k.x-d,k.y-o,b.x-k.x,0,2*Math.PI,true);n.stroke()}}}},drawLine:function(b,e,g,c,f,a,d){b.beginPath();b.moveTo(e,g);b.lineTo(c,f);b.stroke()},getRGBA:function(b,a){if(typeof a=="undefined"){a=1}if(typeof b=="undefined"){b="red"}switch(b){case"red":return"rgba(255,0,0,"+a+")";case"green":return"rgba(0,255,0,"+a+")";case"blue":return"rgba(0,0,255,"+a+")";case"yellow":return"rgba(255,255,0,"+a+")";case"cyan":return"rgba(0,255,255,"+a+")";case"purple":return"rgba(255,0,255,"+a+")";case"white":return"rgba(255,255,255,"+a+")";case"black":return"rgba(0,0,0,"+a+")";case"grey":return"rgba(128,128,128,"+a+")";default:return"rgba(255,0,0,"+a+")"}},hide:function(a){var b=a.firstChild;while(b){a.removeChild(b);b=a.firstChild}},removeChild:function(a,b){var c=a.firstChild;while(c){if(c==b){a.removeChild(c);return}c=c.nextSibling}},scr2map:function(b){var a=new Object;a.x=this.minmx+(this.maxmx-this.minmx)*b.x/this.mapwidth;a.y=this.minmy+(this.maxmy-this.minmy)*b.y/this.mapheight;return a},scr2geo:function(b){var a=this.scr2map(b);return this.map2geo(a,this.currentset)},map2scr:function(a){var b=new Object;b.x=this.mapwidth*(a.x-this.minmx)/(this.maxmx-this.minmx);b.y=this.mapheight*(a.y-this.minmy)/(this.maxmy-this.minmy);return b},geo2scr:function(a){return this.map2scr(this.geo2map(a,this.currentset))},showMap:function(){if(typeof this.mapimg=="undefined"){this.mapimg=new Array}for(var c=this.minzoom;c<=this.maxzoom;c++){if(c==this.currentset){if(typeof this.mapimg[c]=="undefined"){this.mapimg[c]=new Array(this.tileset[c].rows)}for(var d=0;d<this.tileset[c].rows;++d){if(typeof this.mapimg[c][d]=="undefined"){this.mapimg[c][d]=new Array(this.tileset[c].cols)}for(var b=0;b<this.tileset[c].cols;++b){if(typeof this.mapimg[c][d][b]=="undefined"){this.mapimg[c][d][b]=new Object}var a=this.mapimg[c][d][b];if(this.calcdrawparameter(a,b,d,c)){if(typeof a.img=="undefined"){a.img=this.addElem("img","tile_"+c+"_"+d+"_"+b,{position:"absolute",display:"block",left:(a.kdx-a.ksx).toString()+"px",top:(a.kdy-a.ksy).toString()+"px",width:this.tileset[c].tilewidth+"px",height:this.tileset[c].tileheight+"px"},this.mapdrawdiv);a.img.src=this.tileset[c].prefix+((d<10)?"0":"")+d+((b<10)?"_0":"_")+b+this.tileset[c].postfix}else{a.img.style.left=(a.kdx-a.ksx).toString()+"px";a.img.style.top=(a.kdy-a.ksy).toString()+"px";a.img.style.display="block"}}else{if(typeof a.img!="undefined"){a.img.style.left=(a.kdx-a.ksx).toString()+"px";a.img.style.top=(a.kdy-a.ksy).toString()+"px"}}}}}else{if(typeof this.mapimg[c]!="undefined"){this.mapimg[c].each(function(e){e.each(function(f){if(typeof f.img!="undefined"&&typeof f.img.style!="undefined"){f.img.style.display="none"}})})}}}},calcdrawparameter:function(v,s,q,h){var g=Math.round(this.minmx);var f=Math.round(this.minmy);var n=Math.round(this.maxmx-this.minmx);var l=Math.round(this.maxmy-this.minmy);var d=0;var c=0;var r=this.mapwidth;var j=this.mapheight;var o=g-s*this.tileset[h].tilewidth;var t=n;var m=f-q*this.tileset[h].tileheight;var b=l;var k=d;var u=r;var i=c;var a=j;if(o<0){var e=(t+o)/t;k+=u-u*e;u*=e;t+=o;o=0}if(o+t>=this.tileset[h].tilewidth){u=u*((this.tileset[h].tilewidth-o)/t);t=this.tileset[h].tilewidth-o}if(m<0){var e=(b+m)/b;i+=a-a*e;a*=e;b+=m;m=0}if(m+b>=this.tileset[h].tileheight){a=a*((this.tileset[h].tileheight-m)/b);b=this.tileset[h].tileheight-m}u=Math.round(u+k)-Math.round(k);k=Math.round(k);a=Math.round(a+i)-Math.round(i);i=Math.round(i);v.ksx=o;v.ksy=m;v.kswidth=t;v.ksheight=b;v.kdx=k;v.kdy=i;v.kdwidth=u;v.kdheight=a;if(t>0&&b>0){return true}return false},addCanvasElem:function(c,a){if(document.getElementById(c)){alert('Element with id="'+c+'" already existing')}else{var b=document.createElement("canvas");b.id=c;b.style.position="absolute";b.style.display="block";b.style.left="0px";b.style.top="0px";b.style.width=this.mapwidth+"px";b.style.height=this.mapheight+"px";b.appendChild(document.createTextNode("CANVAS NOT AVAILABLE"));a.appendChild(b);if(typeof G_vmlCanvasManager!="undefined"){G_vmlCanvasManager.initElement(b)}return document.getElementById(c)}},addDivElem:function(b,a){return this.addElem("div",b,{position:"absolute",display:"block",left:"0px",top:"0px",width:this.mapwidth+"px",border:"solid 1px #AAA",height:this.mapheight+"px",overflow:"hidden"},a)}})}if(typeof gCSBBJsMap=="undefined"){var gCSBBJsMap="defined";var CSBBMap=Class.create();CSBBMap.prototype=Object.extend(new AOwnAjaxMap(),{initialize:function(b,a){this.imagePath=gJSMapImagePath+"sbbmap/";this.maxzoom=3;this.minzoom=0;this.tileset=new Array({mingx:473602.4519,mingy:312372.746,normfactor:0.5/470,width:395,height:277.5,tilewidth:50,tileheight:50,prefix:this.imagePath+"sbb_1_",postfix:".png",cols:8,rows:6},{mingx:473602.4519,mingy:312372.746,normfactor:1/470,width:790,height:555,tilewidth:790,tileheight:555,prefix:this.imagePath+"sbb_1__",postfix:".png",cols:1,rows:1},{mingx:430612.6142,mingy:306434.3416,normfactor:1/146.316,width:3160,height:1665,tilewidth:100,tileheight:100,prefix:this.imagePath+"sbb_2_",postfix:".png",cols:32,rows:17},{mingx:430612.6142,mingy:306434.3416,normfactor:2/146.316,width:6320,height:3330,tilewidth:200,tileheight:200,prefix:this.imagePath+"sbb_2_",postfix:".png",cols:32,rows:17});this.initOwnAjaxMap(b,a)},geo2map:function(b,c){var a=new Object;a.y=-this.tileset[c].normfactor*(b.getSwissY()-this.tileset[c].mingy);a.x=this.tileset[c].normfactor*(b.getSwissX()-this.tileset[c].mingx);return a},map2geo:function(a,b){return new CCoord({swissx:this.tileset[b].mingx+a.x/this.tileset[b].normfactor,swissy:this.tileset[b].mingy-a.y/this.tileset[b].normfactor})}})};
