var secra;if(!secra){secra={}}else{if(typeof secra!="object"){throw new Error("secra ist kein Objekt!")}}if(secra.GoogleMaps){throw new Error("secra.GoogleMaps existiert bereits!")}secra.GoogleMaps=function(b,d,a,c){this.compatible=false;this.mode=c||"read";this.cache=null;this.container=document.getElementById(b);this.outputLat=document.getElementById(d)||null;this.outputLon=document.getElementById(a)||null;this.container.that=this;this.inputLat=null;this.inputLon=null;this.submit=null;this.str="";this.plz="";this.ort="";this.kreis="";this.bland="";this.land="Deutschland";this.map=null;this.geocoder=null;this.marker=null;this.markers=null;this.point=null;this.z1=6;this.z2=17;this.adresse="";this.p1=false;this.p2=false;this.p3=false;this.p4=false;this.debug=false;this.geolat=null;this.geolon=null;this.images=null;this.iconimage=null;this.iconshadow=null;this.iconXSize=null;this.iconYSize=null;this.shadowXSize=null;this.shadowYSize=null;this.iconXAnchor=null;this.iconYAnchor=null;this.iconEckpunkte=null};secra.GoogleMaps.prototype.addIcon=function(i,a,h,j,e,b,k,g,f,d){if(this.images===null){this.images=[]}var c={};if(i!==""){c.image=new Image();c.image.src=i}if(a!==""){c.shadow=new Image();c.shadow.src=a}if(h!==""){c.trans=new Image();c.trans.src=h}c.iXSize=j||0;c.iYSize=e||0;c.sXSize=b||0;c.sYSize=k||0;c.iXAnc=g||0;c.iYAnc=f||0;c.iEdges=d||[0,0,0,e,j,e,j,0];this.images.push(c)};secra.GoogleMaps.prototype.showMap=function(){if(this.isCompatible){this.container.onmousewheel=this.wheel;if(this.container.addEventListener){this.container.addEventListener("DOMMouseScroll",this.wheel,false)}this.map=new GMap2(this.container);this.map.setCenter(new GLatLng(50,10),this.z1);this.map.setMapType(G_HYBRID_MAP);this.map.addControl(new GLargeMapControl());this.map.addControl(new GMapTypeControl());this.map.addControl(new GOverviewMapControl());this.map.addControl(new GScaleControl());this.map.enableDoubleClickZoom();this.map.enableContinuousZoom();var a=this;if(this.mode==="write"){var b=this.inputLat!==null?this.inputLat.value:0;var c=this.inputLon!==null?this.inputLon.value:0;if(b!==""){this.callbackPoint(new GLatLng(b,c));this.createMarker(this.point,true);this.showIcon(this.marker,this.point)}else{if(!this.debug&&this.outputLat!==null){this.outputLat.innerHTML+="Suche Adresse, ";this.outputLon.innerHTML+="bitte warten Sie ..."}this.geocoder=new GClientGeocoder();this.geocoder.that=this;this.holePoint(this.str,this.plz,this.ort,"","",this.land)}GEvent.addListener(this.map,"click",function(e,d){a.clickListener(e,d)})}else{this.showMarkers()}}};secra.GoogleMaps.prototype.showSmallMap=function(){if(this.isCompatible){this.container.onmousewheel=this.wheel;if(this.container.addEventListener){this.container.addEventListener("DOMMouseScroll",this.wheel,false)}this.map=new GMap2(this.container);this.map.setCenter(new GLatLng(50,10),this.z1);this.map.setMapType(G_HYBRID_MAP);this.map.addControl(new GLargeMapControl());this.map.addControl(new GMapTypeControl());this.map.addControl(new GScaleControl());this.map.enableDoubleClickZoom();this.map.enableContinuousZoom();var a=this;if(this.mode==="write"){var b=this.inputLat!==null?this.inputLat.value:0;var c=this.inputLon!==null?this.inputLon.value:0;if(b!==""){this.callbackPoint(new GLatLng(b,c));this.createMarker(this.point,true);this.showIcon(this.marker,this.point)}else{if(!this.debug&&this.outputLat!==null){this.outputLat.innerHTML+="Suche Adresse, ";this.outputLon.innerHTML+="bitte warten Sie ..."}this.geocoder=new GClientGeocoder();this.geocoder.that=this;this.holePoint(this.str,this.plz,this.ort,"","",this.land)}GEvent.addListener(this.map,"click",function(e,d){a.clickListener(e,d)})}else{}}};secra.GoogleMaps.prototype.setCache=function(a){this.cache=a;this.markers=[];var d=1;var e=1;for(var b in this.cache){var g=this.cache[b];var c=g.icon>0?g.icon-1:0;if(this.images.length-1<c){c=0}var f=g.text===null||g.text==="NULL"?"":g.text;d=Number(g.sfak);this.addMarker(new GLatLng(g.lat,g.lon),f,c,d)}};secra.GoogleMaps.prototype.showMarkers=function(){var f=null,e=null,a=null;var k=null,h=null,g=null;var b=this.markers[0];this.map.clearOverlays();this.map.addOverlay(this.markers[0]);a=f=e=Number(b.getPoint().lat());g=k=h=Number(b.getPoint().lng());for(var d=1,c=this.markers.length;d<c;d++){b=this.markers[d];a=Number(b.getPoint().lat());g=Number(b.getPoint().lng());if(a<f){f=a}else{if(a>e){e=a}}if(g<k){k=g}else{if(g>h){h=g}}this.map.addOverlay(this.markers[d])}this.map.setCenter(new GLatLng((f+e)*0.5,(k+h)*0.5),this.map.getBoundsZoomLevel(new GLatLngBounds(new GLatLng(f,k),new GLatLng(e,h))))};secra.GoogleMaps.prototype.addMarker=function(a,l,h,d){var e=[],c=this.images[h].iEdges;for(var g=0,f=c.length;g<f;g++){e[g]=c[g]*d}var k=new GIcon();if(this.images[h].image){k.image=this.images[h].image.src;k.transparent=this.images[h].image.src}if(this.images[h].shadow){k.shadow=this.images[h].shadow.src}if(this.images[h].trans){k.transparent=this.images[h].trans.src}k.iconSize=new GSize(this.images[h].iXSize*d,this.images[h].iYSize*d);k.shadowSize=new GSize(this.images[h].sXSize*d,this.images[h].sYSize*d);k.iconAnchor=new GPoint(this.images[h].iXAnc*d,this.images[h].iYAnc*d);k.imageMap=e;k.infoWindowAnchor=new GPoint(16*d,16*d);var b=new GMarker(a,{draggable:false,bouncy:true,icon:k,dragCrossMove:false,bounceGravity:1});if(this.mode==="read"){GEvent.addListener(b,"click",function(){b.openInfoWindowHtml(l,{maxWidth:400})})}this.markers.push(b);return b};secra.GoogleMaps.prototype.createMarker=function(a,l){this.map.clearOverlays();var c=1;var k={draggable:l,bouncy:true,dragCrossMove:false,bounceGravity:1};if(this.images&&this.images[0]){var h=new GIcon();var d=[],b=this.images[0].iEdges;for(var f=0,e=b.length;f<e;f++){d[f]=b[f]*c}if(this.images[0].image){h.image=this.images[0].image.src;h.transparent=this.images[0].image.src}if(this.images[0].shadow){h.shadow=this.images[0].shadow.src}if(this.images[0].trans){h.transparent=this.images[0].trans.src}h.iconSize=new GSize(this.images[0].iXSize*c,this.images[0].iYSize*c);h.shadowSize=new GSize(this.images[0].sXSize*c,this.images[0].sYSize*c);h.iconAnchor=new GPoint(this.images[0].iXAnc*c,this.images[0].iYAnc*c);h.imageMap=d;h.infoWindowAnchor=new GPoint(16*c,16*c);k.icon=h}this.marker=new GMarker(a,k);if(l){var g=this;GEvent.addListener(this.marker,"drag",function(){g.dragListener()});GEvent.addListener(this.marker,"dragend",function(){g.dragendListener()})}this.map.addOverlay(this.marker)};secra.GoogleMaps.prototype.showIcon=function(b,a){if(a){if(this.outputLat!==null){this.outputLat.innerHTML=this.getLatText(a.lat());this.outputLon.innerHTML=this.getLonText(a.lng())}}if(!b){this.createMarker(a,true)}};secra.GoogleMaps.prototype.getBounds=function(){var a=this.map.getBounds();if(!this.debug&&this.outputLat!==null){}return{swlat:a.getSouthWest().lat(),swlng:a.getSouthWest().lng(),nelat:a.getNorthEast().lat(),nelng:a.getNorthEast().lng()}};secra.GoogleMaps.prototype.clickListener=function(b,a){if(a){if(this.outputLat!==null){this.outputLat.innerHTML=this.getLatText(a.lat());this.outputLon.innerHTML=this.getLonText(a.lng())}if(this.inputLat!==null){this.inputLat.value=this.geolat;this.inputLon.value=this.geolon}if(this.submit!==null){this.submit.disabled=false}}if(!b){this.createMarker(a,true)}};secra.GoogleMaps.prototype.zoomendListener=function(b,a){if(a>15){}else{if(a>12){}else{if(a>9){}else{if(a>6){}else{}}}}};secra.GoogleMaps.prototype.dragListener=function(){this.clickListener(this.marker,this.marker.getPoint())};secra.GoogleMaps.prototype.dragendListener=function(){this.dragListener();this.map.setCenter(this.marker.getPoint())};secra.GoogleMaps.prototype.callbackPoint=function(a){if(a){this.point=new GLatLng(a.lat(),a.lng());this.map.setCenter(a,this.z2);if(this.outputLat){this.outputLat.innerHTML=" ";this.outputLon.innerHTML=" "}return}if(!this.p1){this.p1=true;this.z2-=3;this.holePoint("",this.plz,this.ort,"","",this.land);return}if(!this.p2){this.p2=true;this.z2-=0;this.holePoint("",this.plz,"","",this.bland,this.land);return}if(!this.p3){this.p3=true;this.z2-=3;this.holePoint("","","",this.kreis,this.bland,this.land);return}if(!this.p3){this.p3=true;this.z2-=3;this.holePoint("","","","",this.bland,this.land);return}};secra.GoogleMaps.prototype.holePoint=function(f,e,d,b,g,a){this.adresse="";if(f!==""){this.adresse+=f+" "}if(e!==""){this.adresse+=e+" "}if(d!==""){this.adresse+=d+", "}if(b!==""){this.adresse+=b+", "}if(g!==""){this.adresse+=g+", "}this.adresse+=a;if(this.adresse==a){this.z2=5}var c=this;this.geocoder.getLatLng(this.adresse,function(h){c.callbackPoint(h)})};secra.GoogleMaps.prototype.zoomIt=function(a){if(a<0){this.map.zoomOut()}else{this.map.zoomIn()}if(this.mode==="read"){}};secra.GoogleMaps.prototype.wheel=function(a){var b=0;if(!a){a=window.event}if(a.wheelDelta){b=a.wheelDelta/120;if(window.opera){b=-b}}else{if(a.detail){b=-a.detail/3}}if(b){this.that.zoomIt(b)}if(a.preventDefault){a.preventDefault()}a.returnValue=false};secra.GoogleMaps.prototype.isCompatible=function(){if(typeof GBrowserIsCompatible!=="undefined"&&GBrowserIsCompatible()===true){this.compatible=true}return this.compatible};secra.GoogleMaps.prototype.setIcon=function(b,i,h,g,c,a,f,e,d){this.iconimage=b;this.iconshadow=i;this.iconXSize=h;this.iconYSize=g;this.shadowXSize=c;this.shadowYSize=a;this.iconXAnchor=f;this.iconYAnchor=e;this.iconEckpunkte=d};secra.GoogleMaps.prototype.setFormParameterByName=function(b,c,a,d){this.inputLat=document.forms[b].elements[c];this.inputLon=document.forms[b].elements[a];this.submit=document.forms[b].elements[d];this.submit.disabled=true};secra.GoogleMaps.prototype.setFormParameterById=function(c,a,b){this.inputLat=document.getElementById(c)||null;this.inputLon=document.getElementById(a)||null;this.submit=document.getElementById(b);this.submit.disabled=true};secra.GoogleMaps.prototype.setAddress=function(f,e,d,b,c,a){if(f&&f!==""){this.str=f}if(e&&e!==""){this.plz=e}if(d&&d!==""){this.ort=d}if(b&&b!==""){this.kreis=b}if(c&&c!==""){this.bland=c}if(a&&a!==""){this.land=a}};secra.GoogleMaps.prototype.getLatText=function(e){var b="N",f="";if(e<0){b="S"}this.geolat=Math.abs(e);var d=Math.floor(this.geolat);if(d<10){d="0"+d}var a=(this.geolat-d)*60;var c=((a-Math.floor(a))*60).toFixed(2);if(c<10){c="0"+c}else{if(c>=60){c=59.99}}a=Math.floor(a);if(a<10){a="0"+a}f=d+"° "+a+"' "+c+'" '+b;return f};secra.GoogleMaps.prototype.getLonText=function(c){var e="E",d="";if(c<0){e="W"}this.geolon=Math.abs(c);var a=Math.floor(this.geolon);if(a<10){a="0"+a}var b=(this.geolon-a)*60;var f=((b-Math.floor(b))*60).toFixed(2);if(f<10){f="0"+f}else{if(f>=60){f=59.99}}b=Math.floor(b);if(b<10){b="0"+b}d=a+"° "+b+"' "+f+'" '+e;return d};
