function MDVGadgetBase(mdvMap){if(!mdvMap)
return;this.name='GadgetBase';this.mdvMap=mdvMap;this.mdvMap.registerGadget(this);}
MDVGadgetBase.prototype.stopEvent=function(e){if(!e)
return true;e.cancelBubble=true;e.returnValue=false;if(e.stopPropogation)
e.stopPropogation();if(e.preventDefault)
e.preventDefault();return false;};MDVGadgetBase.prototype.activate=function(){return true;};MDVGadgetBase.prototype.deactivate=function(){return true;};MDVGadgetBase.prototype.ondblclick=function(e){return true;};MDVGadgetBase.prototype.onkeypress=function(e){return true;};MDVGadgetBase.prototype.onmousedown=function(e){return true;};MDVGadgetBase.prototype.onmousemove=function(e){return true;};MDVGadgetBase.prototype.onmouseout=function(e){return true;};MDVGadgetBase.prototype.onmouseover=function(e){return true;};MDVGadgetBase.prototype.onmouseup=function(e){return true;};MDVGadgetBase.prototype.onmousewheel=function(e){return true;};MDVGadgetBase.prototype.oncontextmenu=function(e){return true;};function MDVMapNavigator(mdvMap){if(!mdvMap)
return;this.name='MapNavigator';this.mdvMap=mdvMap;this.mouseDown=false;this.centre;this.mouseLast=new MDVPoint(-1,-1);this.mouseStart=new MDVPoint(-1,-1);this.mdvMap.registerGadget(this);for(var method in MDVGadgetBase.prototype){if(!MDVMapNavigator.prototype[method])
MDVMapNavigator.prototype[method]=MDVGadgetBase.prototype[method];}
this.mdvMap.events.registerEvent(MDVEvent_MAP_INITIALISED,this,this.setDefaultCursor);}
MDVMapNavigator.prototype.setDefaultCursor=function(){if(this.mdvMap.config.get('cursorIdle')){if(document.all)
this.mdvMap.mapper.style.cursor='url(\''+this.mdvMap.config.get('cursorIdle')+'\')';else
this.mdvMap.mapper.style.cursor='-moz-grab';}};MDVMapNavigator.prototype.oncontextmenu=function(e){return false;};MDVMapNavigator.prototype.ondblclick=function(e){var mX=e.pageX||(e.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));var mY=e.pageY||(e.clientY+(document.documentElement.scrollTop||document.body.scrollTop));var offsetL=0;var offsetT=0;var obj=this.mdvMap.viewport;while(obj){offsetL+=obj.offsetLeft;offsetT+=obj.offsetTop;obj=obj.offsetParent;}
mX=mX-(offsetL);mY=mY-(offsetT);var point=new MDVPoint(mX,mY);var newC=this.mdvMap.getCoordinates(point);this.mdvMap.setCentre(newC);if(this.mdvMap.config.get('zoomOnDoubleClick')&&this.mdvMap.config.get('zoomOnDoubleClick')=='true'){var curZoomLevel=parseInt(this.mdvMap.config.getZoomLevelIndex());if(curZoomLevel<5){this.mdvMap.setZoomLevel(5);}
else{var newZoomLevel=this.mdvMap.config.getZoomLevel(parseInt(this.mdvMap.config.getZoomLevelIndex())+1);if(newZoomLevel!=null)
this.mdvMap.setZoomLevel(parseInt(this.mdvMap.config.getZoomLevelIndex())+1);}}
this.mdvMap.update();return false;};MDVMapNavigator.prototype.onmousewheel=function(e){e=e?e:window.event;var wheelDelta=e.wheelDelta?e.wheelDelta:e.detail*-1;if(wheelDelta>0){var zoomLevel=this.mdvMap.config.getZoomLevel(this.mdvMap.config.getZoomLevelIndex()+1);if(zoomLevel!=null){this.mdvMap.setZoomLevel(this.mdvMap.config.getZoomLevelIndex()+1);this.mdvMap.update();}}
else{var zoomLevel=this.mdvMap.config.getZoomLevel(this.mdvMap.config.getZoomLevelIndex()-1);if(zoomLevel!=null){this.mdvMap.setZoomLevel(this.mdvMap.config.getZoomLevelIndex()-1);this.mdvMap.update();}}
this.stopEvent(e);return false;};MDVMapNavigator.prototype.onmousedown=function(e){e=e?e:window.event;if((e.button==0&&!window.event)||(e.button==1&&window.event))
{var mX=e.pageX||(e.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));var mY=e.pageY||(e.clientY+(document.documentElement.scrollTop||document.body.scrollTop));this.mouseLast.x=mX;this.mouseLast.y=mY;this.mouseStart.x=this.mouseLast.x;this.mouseStart.y=this.mouseLast.y;if(!this.mouseDown){if(this.mdvMap.config.get('cursorMove')){if(document.all)
this.mdvMap.mapper.style.cursor='url(\''+this.mdvMap.config.get('cursorMove')+'\')';else
this.mdvMap.mapper.style.cursor='-moz-grabbing';}
else
this.mdvMap.mapper.style.cursor='auto';}
this.centre=new MDVCoordinates(this.mdvMap.getCentre().mapName,this.mdvMap.getCentre().x,this.mdvMap.getCentre().y);this.mouseDown=true;return this.stopEvent(e);}else{return true;}};MDVMapNavigator.prototype.onmouseup=function(e){e=e?e:window.event;if(this.mouseDown){if(this.mdvMap.config.get('cursorIdle')){if(document.all)
this.mdvMap.mapper.style.cursor='url(\''+this.mdvMap.config.get('cursorIdle')+'\')';else
this.mdvMap.mapper.style.cursor='-moz-grab';}
else{this.mdvMap.mapper.style.cursor='auto';}
var centre=this.mdvMap.getCentre();if(this.centre&&(this.centre.x!=centre.x||this.centre.y!=centre.y)){this.mdvMap.events.triggerEvent(MDVEvent_MAP_INITIALISED,'MDVMap tiles have been initialised',this.mdvMap);}}
this.mouseDown=false;fnMap_AppendHistory(this.mdvMap);return false;};MDVMapNavigator.prototype.onmouseout=function(e){return true;};MDVMapNavigator.prototype.onmousemove=function(e){e=e?e:window.event;var mouseX=e.pageX||(e.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));var mouseY=e.pageY||(e.clientY+(document.documentElement.scrollTop||document.body.scrollTop));var offsetL=0;var offsetT=0;var obj=this.mdvMap.viewport;while(obj){offsetL+=obj.offsetLeft;offsetT+=obj.offsetTop;obj=obj.offsetParent;}
mouseX=mouseX-(offsetL);mouseY=mouseY-(offsetT);var centrePoint=new MDVPoint(mouseX,mouseY);var centreCoords=this.mdvMap.getCoordinates(centrePoint);this.mdvMap.events.triggerEvent(MDVEvent_MOUSE_MOVED,'MDVMap noticed a mouse movement.',centreCoords);if(this.mouseDown){if(this.mdvMap.config.get('cursorMove')){if(document.all)
this.mdvMap.mapper.style.cursor='url(\''+this.mdvMap.config.get('cursorMove')+'\')';else
this.mdvMap.mapper.style.cursor='-moz-grabbing';}
else
this.mdvMap.mapper.style.cursor='auto';var mX=e.pageX||(e.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));var mY=e.pageY||(e.clientY+(document.documentElement.scrollTop||document.body.scrollTop));var tl=new MDVPoint(parseInt(this.mdvMap.mapper.style.left),parseInt(this.mdvMap.mapper.style.top));var zoomLevel=this.mdvMap.config.getZoomLevel(this.mdvMap.config.currentZoomLevelIndex);var pxWidthAll=parseInt(zoomLevel.get('tileSizeX'))*parseInt(zoomLevel.get('numberOfTilesX'));var realToPxRatioWidth=parseInt(zoomLevel.get('realWidth'))/pxWidthAll;var pxHeightAll=parseInt(zoomLevel.get('tileSizeY'))*parseInt(zoomLevel.get('numberOfTilesY'));var realToPxRatioHeight=parseInt(zoomLevel.get('realHeight'))/pxHeightAll;var realOffset=new MDVPoint(((mX-this.mouseLast.x)*realToPxRatioWidth),(mY-this.mouseLast.y)*realToPxRatioHeight);var newCentre=new MDVCoordinates(this.mdvMap.config.get('mapName'),this.mdvMap.real.x-realOffset.x,this.mdvMap.real.y-realOffset.y);this.mdvMap.setCentre(newCentre);if(this.mdvMap.getCentre().x==newCentre.x){this.mdvMap.mapper.style.left=(tl.x+(mX-this.mouseLast.x))+'px';}
if(this.mdvMap.getCentre().y==newCentre.y){this.mdvMap.mapper.style.top=(tl.y+(mY-this.mouseLast.y))+'px';}
this.mouseLast.x=mX;this.mouseLast.y=mY;this.mdvMap._checkWrap();return false;}
return true;};function MDVMapCrosshair(mdvMap){if(!mdvMap)
return;this.name='MapCrosshair';this.mdvMap=mdvMap;this.mdvMap.registerGadget(this);for(var method in MDVGadgetBase.prototype){if(!MDVMapCrosshair.prototype[method])
MDVMapCrosshair.prototype[method]=MDVGadgetBase.prototype[method];}
this.mdvMap.events.registerEvent(MDVEvent_MAP_INITIALISED,this,this.execute);}
MDVMapCrosshair.prototype.execute=function(){if(this.mdvMap.config.get('crosshair')){var crosshair=this.mdvMap.config.get('crosshair');var vpMapper=this.mdvMap.mapper;if(!document.getElementById('crosshairLayer')){var div=document.createElement('div');div.id='crosshairLayer';div.style.position='absolute';div.style.top=(this.mdvMap.viewportHeight)/2-parseInt(vpMapper.style.top);div.style.left=(this.mdvMap.viewportWidth)/2-parseInt(vpMapper.style.left);div.style.zIndex=10;var img=new Image();img.src=crosshair;div.appendChild(img);this.mdvMap.mapper.appendChild(div);}else{var div=document.getElementById('crosshairLayer');if(div){div.style.position='absolute';div.style.top=(this.mdvMap.viewportHeight)/2-parseInt(vpMapper.style.top)+'px';div.style.left=(this.mdvMap.viewportWidth)/2-parseInt(vpMapper.style.left)+'px';div.style.zIndex=10;}}}};function MDVMapEFAInfo(mdvMap){this.mdvMap=mdvMap;this.name='MapEFAInfo';this.stops=null;this.poi=null;this.centre=null;this.lastCentre=null;this.lastZoomLevelIdx=null;this.stopImg=new Image();this.stopImg.src='/ib/site/elements/efa/ajaxmap/stop.gif';this.mot1Img=new Image();this.mot1Img.src='/ib/site/elements/efa/ajaxmap/syUBahn.gif';this.mot2Img=new Image();this.mot2Img.src='/ib/site/elements/efa/ajaxmap/sySBahn.gif';this.mot3Img=new Image();this.mot3Img.src='/ib/site/elements/efa/ajaxmap/mot3.gif';this.mot4Img=new Image();this.mot4Img.src='/ib/site/elements/efa/ajaxmap/syTram.gif';this.mot5Img=new Image();this.mot5Img.src='/ib/site/elements/efa/ajaxmap/mot5.gif';this.mot6Img=new Image();this.mot6Img.src='/ib/site/elements/efa/ajaxmap/syRBahn.gif';this.mot7Img=new Image();this.mot7Img.src='/ib/site/elements/efa/ajaxmap/mot7.gif';this.mot8Img=new Image();this.mot8Img.src='/ib/site/elements/efa/ajaxmap/mot8.gif';this.mot9Img=new Image();this.mot9Img.src='/ib/site/elements/efa/ajaxmap/mot9.gif';this.mot10Img=new Image();this.mot10Img.src='/ib/site/elements/efa/ajaxmap/mot10.gif';this.mot11Img=new Image();this.mot11Img.src='/ib/site/elements/efa/ajaxmap/mot11.gif';this.mot12Img=new Image();this.mot12Img.src='/ib/site/elements/efa/ajaxmap/mot12.gif';this.poiImg=new Image();this.poiImg.src='/ib/site/elements/efa/ajaxmap/pin.gif';for(var method in MDVGadgetBase.prototype){if(!MDVMapEFAInfo.prototype[method])
MDVMapEFAInfo.prototype[method]=MDVGadgetBase.prototype[method];}
this.mdvMap.registerGadget(this);this.mdvMap.events.registerEvent(MDVEvent_MAP_INITIALISED,this,this.execute);this.mdvMap.events.registerEvent(MDVEvent_AJAX_CALLBACK,this,this.processPins);}
MDVMapEFAInfo.prototype.createLayers=function(){if(!this.poi){this.poi=this.mdvMap.createLayer('efa_poi');this.poi.setZIndex(1);this.mdvMap.addLayer(this.poi);}
if(!this.stops){this.stops=this.mdvMap.createLayer('efa_stops');this.stops.setZIndex(2);this.mdvMap.addLayer(this.stops);}};MDVMapEFAInfo.prototype.execute=function(){this.createLayers();var zoomLevel=this.mdvMap.config.getZoomLevel(this.mdvMap.config.getZoomLevelIndex());var showStops=zoomLevel.get('showSTOP')=="true"?true:false;var showPOI=zoomLevel.get('showPOI')=="true"?true:false;if(showStops||showPOI){this.fetchPins();}else{this.stops.removeAll();this.poi.removeAll();}};MDVMapEFAInfo.prototype.processPins=function(id,gadName,request){var zoomLevel=this.mdvMap.config.getZoomLevel(this.mdvMap.config.getZoomLevelIndex());var showStops=zoomLevel.get('showSTOP')=="true"?true:false;var showPOI=zoomLevel.get('showPOI')=="true"?true:false;var pins=request.responseXML.getElementsByTagName('itdPinElem');var mapRequest=request.responseXML.getElementsByTagName('itdMapRequest');this.stops.removeAll();this.poi.removeAll();if(mapRequest&&mapRequest.length>0){var reqCoord=new MDVCoordinates(mapRequest[0].getAttribute('mapName'),mapRequest[0].getAttribute('xCenterReal'),mapRequest[0].getAttribute('yCenterReal'));if(!reqCoord.equals(this.mdvMap.getCentre())){return false;}}
var updateStops=false;var updatePOI=false;if(pins.length<=0||mapRequest.length<=0){this.mdvMap.events.triggerEvent(MDVEvent_ERROR,'MDVMap wasn\'t able to get pins from map request.');return false;}
for(var i=pins.length-1;i>=0;i--){var pinName=pins[i].getAttribute('desc');var pinId=pins[i].getAttribute('id');var pinType=pins[i].getAttribute('type');var pinOmc=pins[i].getAttribute('omc');var tmpImg=new Image();var nodeValue=pins[i].getAttribute('mot');if(typeof(nodeValue)!="undefined"&&nodeValue!=null){switch(parseInt(nodeValue)){case 1:tmpImg.src=this.mot1Img.src;break;case 2:tmpImg.src=this.mot2Img.src;break;case 3:tmpImg.src=this.mot3Img.src;break;case 4:tmpImg.src=this.mot4Img.src;break;case 5:tmpImg.src=this.mot5Img.src;break;case 6:tmpImg.src=this.mot6Img.src;break;case 7:tmpImg.src=this.mot7Img.src;break;case 8:tmpImg.src=this.mot8Img.src;break;case 9:tmpImg.src=this.mot9Img.src;break;case 10:tmpImg.src=this.mot10Img.src;break;case 11:tmpImg.src=this.mot11Img.src;break;case 12:tmpImg.src=this.mot12Img.src;break;default:tmpImg.src=this.stopImg.src;break;}}else{if(pinType.toUpperCase()=='POI')
tmpImg.src=this.poiImg.src;else
tmpImg.src=this.stopImg.src;}
var coords=new MDVCoordinates(mapRequest[0].getAttribute('mapName'),parseInt(pins[i].firstChild.getAttribute('x')),parseInt(pins[i].firstChild.getAttribute('y')));var mapPin=this.mdvMap.createMarker(coords,0.5,tmpImg.src);mapPin.objectId={type:pinType,desc:pinName,id:pinId,omc:pinOmc,marker:mapPin};switch(pinType){case'stop':var mapPinTitle=this.mdvMap.createToolTip(pinName);mapPin.setToolTip(mapPinTitle,false);mapPinTitle.objectId=pinId;mapPinTitle.dynamicData={method:roccas_DMToolTipRequest,parameters:{stopId:pinId}};break;case'poi':var content="<div style=\"padding:3px 5px 5px 5px\">"+pinName+"</div>";content+="<div class=\"button_context\" style=\"padding:10px 5px 3px 5px;\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td>";content+="Klicken Sie, um diesen<br>wichtigen Punkt auszuwählen.</td></tr></table></div>";var mapPinTitle=this.mdvMap.createToolTip(content);mapPin.setToolTip(mapPinTitle,false);break;}
switch(pinType){case'poi':if(showPOI){this.poi.addMarker(mapPin,false);updatePOI=true;}
break;default:if(showStops){this.stops.addMarker(mapPin,false);updateStops=true;}
break;}}
if(updateStops)
this.stops.update();if(updatePOI)
this.poi.update();this.centre=new MDVCoordinates(this.mdvMap.getCentre().mapName,this.mdvMap.getCentre().x,this.mdvMap.getCentre().y);return true;};MDVMapEFAInfo.prototype.fetchPins=function(){if(this.mdvMap.config.get('efaURL')){var host=this.mdvMap.config.get('efaURL');var centre=this.mdvMap.getCentre();var zoomLevel=this.mdvMap.config.getZoomLevel(this.mdvMap.config.getZoomLevelIndex());var zoomLevelIdx=this.mdvMap.config.getZoomLevelIndex();if(this.lastCentre&&(this.lastCentre.x==centre.x&&this.lastCentre.y==centre.y&&this.lastZoomLevelIdx==zoomLevelIdx)){this.centre=new MDVCoordinates(this.mdvMap.getCentre().mapName,this.mdvMap.getCentre().x,this.mdvMap.getCentre().y);this.lastZoomLevelIdx=zoomLevelIdx;}
this.lastCentre=new MDVCoordinates(this.mdvMap.getCentre().mapName,this.mdvMap.getCentre().x,this.mdvMap.getCentre().y);this.lastZoomLevelIdx=zoomLevelIdx;var showStops=zoomLevel.get('showSTOP')=="true"?1:0;var showPOI=zoomLevel.get('showPOI')=="true"?1:0;var _params=new Array({xCenterReal:Math.floor(centre.x+0.5),yCenterReal:Math.floor(centre.y+0.5),mapName:centre.mapName,pinTypePOI:showPOI,pinTypeStop:showStops,createImage:'0',realHeight:this.mdvMap.viewportRealHeight,realWidth:this.mdvMap.viewportRealWidth,screenWidth:this.mdvMap.viewportWidth,screenHeight:this.mdvMap.viewportHeight,command:'mapData',hideBannerInfo:'1',itdLPxx_mdvMapName:'mdvMap_'+this.mdvMap.getName(),zoomLevel:this.mdvMap.config.getZoomLevelIndex()});_params=$H(_params[0]);_params=_params.toQueryString();var _ajax=new Ajax.Request(host,{method:'post',parameters:_params,onComplete:MDVMapEFAInfo_onAjaxComplete});}};MDVMapEFAInfo.prototype.onmouseup=function(e){var centre=this.mdvMap.getCentre();if(this.centre&&(this.centre.x!=centre.x||this.centre.y!=centre.y)){}
return true;}
function MDVMapEFAInfo_onAjaxComplete(request){if(request&&request.responseXML)
{var itdLPs=request.responseXML.getElementsByTagName("itdLayoutParam");for(var i=0;i<itdLPs.length;i++){if(itdLPs[i].getAttribute('name')=='mdvMapName'){if(document.mdvMaps[itdLPs[i].getAttribute('value')])
document.mdvMaps[itdLPs[i].getAttribute('value')].events.triggerEvent(MDVEvent_AJAX_CALLBACK,'MapEFAInfo',request);return;}}}}
function MDVMapContextMenu(mdvMap,contMenu){if(!mdvMap)
return;this.name='MapContextMenu';this.mdvMap=mdvMap;this.mdvMap.registerGadget(this);this.mdvMap.events.registerEvent(MDVEvent_ZOOM_CHANGED,this,this.zoomLevelChange);this.contextMenu=contMenu;for(var i=0;i<this.contextMenu.div.childNodes.length;i++){if(this.contextMenu.div.childNodes[i]){this.contextMenu.div.childNodes[i].mdvMap=this.mdvMap;}}
var _clickOnContextMenu=false;document.body.contextMenu=this;this.contextMenu.div.onmousedown=function(){_clickOnContextMenu=true;};document.body.onmousedown=function(e){e=e?e:window.event;if(!_clickOnContextMenu)
this.contextMenu.contextMenu.div.style.display='none';_clickOnContextMenu=false;};this.contextMenu.div.oncontextmenu=function(){return false;};for(var method in MDVGadgetBase.prototype){if(!MDVMapContextMenu.prototype[method])
MDVMapContextMenu.prototype[method]=MDVGadgetBase.prototype[method];}}
MDVMapContextMenu.prototype.oncontextmenu=function(e){e=e?e:window.event;var scrollTop=document.body.scrollTop?document.body.scrollTop:document.documentElement.scrollTop;var scrollLeft=document.body.scrollLeft?document.body.scrollLeft:document.documentElement.scrollLeft;var x=e.clientX+scrollLeft;var y=e.clientY+scrollTop;var mX=e.pageX||(e.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));var mY=e.pageY||(e.clientY+(document.documentElement.scrollTop||document.body.scrollTop));var offsetL=0;var offsetT=0;var obj=this.mdvMap.viewport;while(obj){offsetL+=obj.offsetLeft;offsetT+=obj.offsetTop;obj=obj.offsetParent;}
mX=mX-offsetL-3;mY=mY-offsetT-3;this.contextMenu.div.style.display='none';var mousePoint=new MDVPoint(mX,mY);var mouseCoord=this.mdvMap.getCoordinates(mousePoint);var params={createImage:0,pinTypeStop:0,pinTypePOI:0,pinTypeCrossing:1,xCenterReal:mouseCoord.x,yCenterReal:mouseCoord.y,mapName:'NAV4',screenWidth:50,screenHeight:50,zoomLevel:7};params=$H(params).toQueryString();var _ajax=new Ajax.Request('/efa9/efa96/roccas/XML_MAP_REQUEST',{method:'post',asynchronous:false,parameters:params});var name=_ajax.transport.responseXML.getElementsByTagName('odvNameElem');for(var i=0;i<name.length;i++){if(typeof(name[i].firstChild)!='undefined'&&name[i].firstChild!=null){mouseCoord.pointName=name[i].firstChild.nodeValue;}}
var place=_ajax.transport.responseXML.getElementsByTagName('odvPlaceElem');mouseCoord.pointOMC=0;for(var i=0;i<place.length;i++){if(typeof(place[i].firstChild)!='undefined'&&place[i].firstChild!=null){mouseCoord.pointOMC=place[i].getAttribute('omc');}}
if(typeof(mouseCoord.pointName)=='undefined'||mouseCoord.pointName==null||mouseCoord.pointName==''){return false;}
this.contextMenu.div.style.left=x+'px';this.contextMenu.div.style.top=y+'px';this.contextMenu.div.style.display='block';this.mdvMap.events.triggerEvent(MDVEvent_CONTEXT_MENU,true,mouseCoord);return false;};MDVMapContextMenu.prototype.hideContextMenu=function(){this.contextMenu.div.style.display='none';this.mdvMap.events.triggerEvent(MDVEvent_CONTEXT_MENU,false,null);}
MDVMapContextMenu.prototype.onmousedown=function(e){e=e?e:window.event;if(e==null||e.button!=2){this.hideContextMenu();}
this.stopEvent(e);return false;};MDVMapContextMenu.prototype.zoomLevelChange=function(id,message,zoomLevelIndex){this.onmousedown(null);};function MDVMapMenu(menuItems){this.menuItems=menuItems;var menuoutput=document.createElement("div");menuoutput.className="output";document.body.appendChild(menuoutput);var menu=document.createElement("div");menu.className="mapContextMenu";menuoutput.appendChild(menu);menu.style.cursor='default';for(var i=0;i<this.menuItems.length;i++){if(this.menuItems[i].func){var item=document.createElement("div");item.className="mapContextMenuItem";item.onmouseover=function(){this.className='mapContextMenuItem_active';menu.style.cursor='pointer';};item.onmouseout=function(){this.className='mapContextMenuItem';menu.style.cursor='default';};item.onclick=this.menuItems[i].func;item.onmouseup=hideMenu;var content="<div style=\"float:right\"><img src=\"/ib/site/elements/efa/buttons/bnSend_a.gif\" width=\"11\" height=\"11\" alt=\"\" style=\"vertical-align:bottom;\"></div>";content+=this.menuItems[i].description;content+="<div style=\"clear:both\"></div>";item.innerHTML=content;menu.appendChild(item);}
else{var item=document.createElement("hr");menu.appendChild(item);}}
function hideMenu(){menu.style.display='none';}
this.div=menu;}
function MDVMapMenuItem(description,func){this.description=description;if(func){this.func=func;}}
function MDVMapControl(mdvMap){if(!mdvMap)
return;this.name='MapControl';this.mdvMap=mdvMap;this.origin=null;this.zoomLevel=null;this.images=new Array();this.images['top_normal']=new Image();this.images['top_hover']=new Image();this.images['left_normal']=new Image();this.images['left_hover']=new Image();this.images['centre_normal']=new Image();this.images['centre_hover']=new Image();this.images['right_normal']=new Image();this.images['right_hover']=new Image();this.images['bottom_normal']=new Image();this.images['bottom_hover']=new Image();this.images['zoomIn_normal']=new Image();this.images['zoomIn_hover']=new Image();this.images['zoomOut_normal']=new Image();this.images['zoomOut_hover']=new Image();this.images['zoomLevel_normal']=new Image();this.images['zoomLevel_hover']=new Image();this.images['zoomLevel_active']=new Image();this.images['transparent']=new Image();this.images['spacer']=new Image();this.mapControl=null;this.arrowContainer=null;this.zoomContainer=null;this.mdvMap.registerGadget(this);for(var method in MDVGadgetBase.prototype){if(!MDVMapControl.prototype[method])
MDVMapControl.prototype[method]=MDVGadgetBase.prototype[method];}
this.mdvMap.events.registerEvent(MDVEvent_INITIALISED,this,this.execute);this.mdvMap.events.registerEvent(MDVEvent_ZOOM_CHANGED,this,this.update);}
MDVMapControl.prototype.preloadImgs=function(){var imgPath='/ib/site/elements/efa/ajaxmap/MDVMapControl/';this.images['top_normal'].src=imgPath+'topNormal.gif';this.images['top_normal'].alt="Go north";this.images['top_normal'].title=this.images['top_normal'].alt;this.images['top_hover'].src=imgPath+'topHover.gif';this.images['top_hover'].alt=this.images['top_normal'].alt;this.images['top_hover'].title=this.images['top_normal'].alt;this.images['left_normal'].src=imgPath+'leftNormal.gif';this.images['left_normal'].alt="Go west";this.images['left_normal'].title=this.images['left_normal'].alt;this.images['left_hover'].src=imgPath+'leftHover.gif';this.images['left_hover'].alt=this.images['left_normal'].alt;this.images['left_hover'].title=this.images['left_normal'].alt;this.images['centre_normal'].src=imgPath+'centreNormal.gif';this.images['centre_normal'].alt="Last result";this.images['centre_normal'].title=this.images['centre_normal'].alt;this.images['centre_hover'].src=imgPath+'centreHover.gif';this.images['centre_hover'].alt=this.images['centre_normal'].alt;this.images['centre_hover'].title=this.images['centre_normal'].alt;this.images['right_normal'].src=imgPath+'rightNormal.gif';this.images['right_normal'].alt="Go east";this.images['right_normal'].title=this.images['right_normal'].alt;this.images['right_hover'].src=imgPath+'rightHover.gif';this.images['right_hover'].alt=this.images['right_normal'].alt;this.images['right_hover'].title=this.images['right_normal'].alt;this.images['bottom_normal'].src=imgPath+'bottomNormal.gif';this.images['bottom_normal'].alt="Go south";this.images['bottom_normal'].title=this.images['bottom_normal'].alt;this.images['bottom_hover'].src=imgPath+'bottomHover.gif';this.images['bottom_hover'].alt=this.images['bottom_normal'].alt;this.images['bottom_hover'].title=this.images['bottom_normal'].alt;this.images['zoomIn_normal'].src=imgPath+'zoomInNormal.gif';this.images['zoomIn_normal'].alt="Zoom in";this.images['zoomIn_normal'].title=this.images['zoomIn_normal'].alt;this.images['zoomIn_hover'].src=imgPath+'zoomInHover.gif';this.images['zoomIn_hover'].alt=this.images['zoomIn_normal'].alt;this.images['zoomIn_hover'].title=this.images['zoomIn_normal'].alt;this.images['zoomOut_normal'].src=imgPath+'zoomOutNormal.gif';this.images['zoomOut_normal'].alt="Zoom out";this.images['zoomOut_normal'].title=this.images['zoomOut_normal'].alt;this.images['zoomOut_hover'].src=imgPath+'zoomOutHover.gif';this.images['zoomOut_hover'].alt=this.images['zoomOut_normal'].alt;this.images['zoomOut_hover'].title=this.images['zoomOut_normal'].alt;for(var i=0;i<this.mdvMap.config.getZoomLevels().length;i++){this.images['zoomLevel_normal'+i]=new Image();this.images['zoomLevel_hover'+i]=new Image();this.images['zoomLevel_active'+i]=new Image();this.images['zoomLevel_normal'+i].src=imgPath+'bnZoom_'+i+'_a.gif';this.images['zoomLevel_active'+i].src=imgPath+'bnZoom_'+i+'_s.gif';this.images['zoomLevel_hover'+i].src=imgPath+'bnZoom_'+i+'_o.gif';}
this.images['transparent'].src=imgPath+'transparent.gif';this.images['spacer'].src=imgPath+'spacer.gif';};MDVMapControl.prototype.createDiv=function(){var newDiv=document.createElement('div');return newDiv;};MDVMapControl.prototype.execute=function(){this.preloadImgs();this.origin=new MDVCoordinates(this.mdvMap.config.get('mapName'),parseInt(this.mdvMap.config.get('xCenterReal')),parseInt(this.mdvMap.config.get('yCenterReal')));this.zoomLevel=this.mdvMap.config.get('defaultScale');this.mapControl=document.getElementById("mapControl_"+this.mdvMap.name.substring(7)+"_Zoom");this.arrowContainer=this.createDiv();this.zoomContainer=this.createDiv();this.zoomContainer.className='MDVMapControl_ZoomLevels';this.zoomLevels=new Array();this.mapControl.appendChild(this.arrowContainer);this.mapControl.appendChild(this.zoomContainer);this.populateContainers();this.update();};MDVMapControl.prototype.setZoomLevel=function(zoomLevel){if(this.mdvMap.config.getZoomLevel(zoomLevel)){this.zoomLevel=zoomLevel;return true;}
return false;};MDVMapControl.prototype.setOriginCoords=function(coord){if(coord&&coord.x&&coord.y&&coord.mapName){this.origin=coord;return true;}
return false;};MDVMapControl.prototype.populateContainers=function(){if(!this.arrowContainer||!this.zoomContainer)
return false;var zoomLevels=0;var zoomLevelArr=this.mdvMap.config.getZoomLevels();if(zoomLevelArr)
zoomLevels=zoomLevelArr.length;for(var z=0;z<zoomLevels;z++){var level=zoomLevelArr[z];if(level){tmpZLImg=this.createImage();tmpZLImg.level=level.level;tmpZLImg.hover=this.images['zoomLevel_hover'+z];tmpZLImg.normal=this.images['zoomLevel_normal'+z];tmpZLImg.src=this.images['zoomLevel_normal'+z].src;tmpZLImg.alt="Maßstab 1:"+level.getScale();tmpZLImg.title=tmpZLImg.alt;tmpZLImg.onclick=MDVMapControl_onclick;this.zoomContainer.appendChild(tmpZLImg);this.zoomLevels.push(tmpZLImg);}}
return true;};MDVMapControl.prototype.createImage=function(){var newImage=new Image();newImage.mdvMap=this.mdvMap;newImage.hover=null;newImage.normal=null;newImage.onmouseover=MDVMapControl_onmouseover;newImage.onmouseout=MDVMapControl_onmouseout;newImage.onclick=MDVMapControl_onclick;newImage.ondragstart=new Function([],'var e=e?e:event;e.cancelBubble=true;e.returnValue=false;return false;');return newImage;};MDVMapControl.prototype.update=function(){if(!this.zoomLevels)
return false;var currentZoomLevel=this.mdvMap.config.getZoomLevelIndex();var len=this.zoomLevels.length;for(var i=0;i<len;i++){if(this.zoomLevels[i].level==currentZoomLevel){this.zoomLevels[i].src=this.images['zoomLevel_active'+i].src;this.zoomLevels[i].hover=this.images['zoomLevel_active'+i];this.zoomLevels[i].normal=this.images['zoomLevel_active'+i];}else{this.zoomLevels[i].src=this.images['zoomLevel_normal'+i].src;this.zoomLevels[i].hover=this.images['zoomLevel_hover'+i];this.zoomLevels[i].normal=this.images['zoomLevel_normal'+i];}}
return true;};MDVMapControl.prototype.zoomIn=function(){var zoomLevel=this.mdvMap.config.getZoomLevel(parseInt(this.mdvMap.config.getZoomLevelIndex())+1);if(zoomLevel!=null){this.mdvMap.setZoomLevel(parseInt(this.mdvMap.config.getZoomLevelIndex())+1);this.mdvMap.update();}
return true;};MDVMapControl.prototype.zoomOut=function(){var zoomLevel=this.mdvMap.config.getZoomLevel(parseInt(this.mdvMap.config.getZoomLevelIndex())-1);if(zoomLevel!=null){this.mdvMap.setZoomLevel(parseInt(this.mdvMap.config.getZoomLevelIndex())-1);this.mdvMap.update();}
return true;};MDVMapControl.prototype.goEast=function(){var realWidth=this.mdvMap.viewportRealWidth*0.6;var newCoords=new MDVCoordinates(this.mdvMap.getCentre().mapName,this.mdvMap.getCentre().x,this.mdvMap.getCentre().y);newCoords.x=newCoords.x-Math.floor(realWidth+0.5);this.mdvMap.setCentre(newCoords);this.mdvMap.update();return true;};MDVMapControl.prototype.goWest=function(){var realWidth=this.mdvMap.viewportRealWidth*0.6;var newCoords=new MDVCoordinates(this.mdvMap.getCentre().mapName,this.mdvMap.getCentre().x,this.mdvMap.getCentre().y);newCoords.x=newCoords.x+Math.floor(realWidth+0.5);this.mdvMap.setCentre(newCoords);this.mdvMap.update();return true;};MDVMapControl.prototype.goNorth=function(){var realHeight=this.mdvMap.viewportRealHeight*0.6;var newCoords=new MDVCoordinates(this.mdvMap.getCentre().mapName,this.mdvMap.getCentre().x,this.mdvMap.getCentre().y);newCoords.y=newCoords.y-Math.floor(realHeight+0.5);this.mdvMap.setCentre(newCoords);this.mdvMap.update();return true;};MDVMapControl.prototype.goSouth=function(){var realHeight=this.mdvMap.viewportRealHeight*0.6;var newCoords=new MDVCoordinates(this.mdvMap.getCentre().mapName,this.mdvMap.getCentre().x,this.mdvMap.getCentre().y);newCoords.y=newCoords.y+Math.floor(realHeight+0.5);this.mdvMap.setCentre(newCoords);this.mdvMap.update();return true;};MDVMapControl.prototype.goBack=function(){this.mdvMap.setZoomLevel(this.mapControl.zoomLevel);this.mdvMap.setCentre(this.mapControl.origin);this.mdvMap.update();};function MDVMapControl_onmouseover(e){if(this.hover&&this.hover.src){this.src=this.hover.src;this.style.cursor='pointer';}
return true;}
function MDVMapControl_onmouseout(e){if(this.normal&&this.normal.src){this.src=this.normal.src;this.style.cursor='auto';}
return true;}
function MDVMapControl_onclick(e){if(this.level){var zoomLevel=this.mdvMap.config.getZoomLevel(this.level);if(zoomLevel!=null){this.mdvMap.setZoomLevel(this.level);this.mdvMap.update();}}
return true;}