/*e-tecure CustomControls*/
/*Zoom Control*/
function ETZoomControl(){}
ETZoomControl.prototype = new GControl();
ETZoomControl.prototype.positionLeft = 7;
ETZoomControl.prototype.positionTop = "center";
ETZoomControl.prototype.slideAreaMargin = 3;
ETZoomControl.prototype.slideAreaHeight = 145;
ETZoomControl.prototype.buttonStyle = { 
"height" : 20,
"width"  : 20,
"position" : "relative",
"cursor" : "pointer"
};
var agent = navigator.userAgent.toLowerCase();
var isIe = (agent.indexOf("msie") > -1) && (agent.indexOf("opera") < 1) ? true : false;
var isIeVersion = (/MSIE(\w*)(.*);/.exec(navigator.userAgent)) ? parseInt(/MSIE(\w*)(.*);/.exec(navigator.userAgent)[2]) : 0;
 if (isIe&&isIeVersion<7){
 
ETZoomControl.prototype.sliderButtonStyle = { 
"height" : 20,
"width"  : 20,
"position" : "relative",
"filter" : "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/html/common/images/maps/button_zoom.png', sizingMethod='scale')"
}
ETZoomControl.prototype.containerStyle = {
"background" : "url(/html/common/images/maps/bg_zoom_noshadow.gif)",
"backgroundRepeat" : "no-repeat",
"padding" : "2px",
"height" : 190,
"width" : 20
}
}else{
ETZoomControl.prototype.sliderButtonStyle = { 
"height" : 20,
"width"  : 20,
"position" : "relative",
"background" : "url(/html/common/images/maps/button_zoom.png)",
"backgroundRepeat" : "no-repeat",
"backgroundPosition" : "1px 0px"
}
ETZoomControl.prototype.containerStyle = {
"background" : "url(/html/common/images/maps/bg_zoom_shadow.png)",
"backgroundRepeat" : "no-repeat",
"padding" : "2px",
"height" : 190,
"width" : 20
}
}
ETZoomControl.prototype.initialize = function(map) {
this.map = map;
var that = this;
//benoetigte Elemente erzeugen
var container = document.createElement("div");
var zoomInDiv = document.createElement("div");	
var zoomOutDiv = document.createElement("div");
var sliderContainer = document.createElement("div");
this.slideButton = document.createElement("div");
//Standard Styles setzen 
this.addStyleProperty(zoomOutDiv, this.buttonStyle);
this.addStyleProperty(zoomInDiv, this.buttonStyle);
this.addStyleProperty(container, this.containerStyle);
this.addStyleProperty(this.slideButton, this.sliderButtonStyle);
//Container für Slider anpassen
sliderContainer.appendChild(this.slideButton);
sliderContainer.style.position = "relative";
sliderContainer.style.top = this.slideAreaMargin +"px";
sliderContainer.style.height =this.slideAreaHeight+ "px";
//Stylesmodifizieren
zoomOutDiv.style.top = this.slideAreaMargin +"px";
//Buttons zum Container hinzufügen
container.appendChild(zoomInDiv);
container.appendChild(sliderContainer);
container.appendChild(zoomOutDiv);
    
        this.slide = new GDraggableObject(this.slideButton, {container:sliderContainer});
GEvent.addDomListener(zoomInDiv, "click", function() {
map.zoomIn();
});
GEvent.addDomListener(zoomOutDiv, "click", function() {
map.zoomOut();
});
        GEvent.addListener(map, "zoomend", function(a, b) {
that.setSlider(b);
});
        GEvent.addListener(this.slide, "dragend", function() {
that.setZoom();
});
map.getContainer().appendChild(container);
this.setSlider(map.getZoom());
return container;
}
ETZoomControl.prototype.addStyleProperty = function(element, styleObject){
var containerStyleProperty;
for(styleProperty in styleObject){
containerStyleProperty = styleObject[styleProperty];
element.style[styleProperty] = (/^\d*$/.test(containerStyleProperty)) ? containerStyleProperty+"px" : containerStyleProperty;
}
}
ETZoomControl.prototype.getDefaultPosition = function() {
if(this.positionTop === "center"){
var topPosition = Math.round((parseInt(this.map.getContainer().style.height.split("px")[0])-this.containerStyle.height) / 2);
}else{
var topPosition = this.positionTop;
}
return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(this.positionLeft, topPosition));
}
ETZoomControl.prototype.setSlider = function(zoom) {
var sliderLength = this.containerStyle.height - (2 * this.buttonStyle.height);
var top = Math.round(sliderLength/this.buttonStyle.height*zoom);
top = (this.slideAreaHeight -this.sliderButtonStyle.height) - ((top<this.slideAreaHeight-this.sliderButtonStyle.height) ? top : this.slideAreaHeight-this.sliderButtonStyle.height);
this.slide.top = top;
this.slideButton.style.top = top + "px";
}
ETZoomControl.prototype.setZoom = function() {
var z = Math.round(this.slide.top * this.buttonStyle.height / (this.containerStyle.height - (2 * this.buttonStyle.height)));
var a = Math.round((this.slideAreaHeight-this.buttonStyle.height) * this.buttonStyle.height / (this.containerStyle.height - (2 * this.buttonStyle.height)));
z = a - z;
this.map.setZoom(z);
}
/* Control Buttons */
function ETMapTypeControl() {};
ETMapTypeControl.prototype = new GMapTypeControl();
ETMapTypeControl.prototype.buttonStandardStyle = {
"height" : 26,
"position" : "relative", 
"background" : "#ff0000",
"cursor" : "pointer",
"cssFloat" : "left",
"styleFloat" : "left"
}
ETMapTypeControl.prototype.buttonNormalStyle = {
"width" : 53,
"background" : "url(" + imagepath + "bt_map_normal.png)"
}
ETMapTypeControl.prototype.buttonNormalStyleSelected = {
"width" : 53,
"background" : "url(" + imagepath + "bt_map_normal_selected.png)"
}
ETMapTypeControl.prototype.buttonSatellitStyle = {
"width" : 79,
"background" : "url(" + imagepath + "bt_map_satellit.png)"
}
ETMapTypeControl.prototype.buttonSatellitStyleSelected = {
"background" : "url(" + imagepath + "bt_map_satellit_selected.png)"
}
ETMapTypeControl.prototype.buttonHybridStyle = {
"width" : 73,
"background" : "url(" + imagepath + "bt_map_hybrid.png)"
}
ETMapTypeControl.prototype.buttonHybridStyleSelected = {
"background" : "url(" + imagepath + "bt_map_hybrid_selected.png)"
}
ETMapTypeControl.prototype.initialize = function(map){
var that = this;
this.map = map;
var container = document.createElement("div");
var buttonStandard= document.createElement("div");	
var buttonSatellit = document.createElement("div");
var buttonHybrid = document.createElement("div");
this.controlButtons = [buttonStandard, buttonSatellit, buttonHybrid];
this.addStyleProperty(buttonStandard, this.buttonStandardStyle);
this.addStyleProperty(buttonSatellit, this.buttonStandardStyle);
this.addStyleProperty(buttonHybrid, this.buttonStandardStyle);
this.addStyleProperty(buttonStandard, this.buttonNormalStyleSelected);
this.addStyleProperty(buttonSatellit, this.buttonSatellitStyle);
this.addStyleProperty(buttonHybrid, this.buttonHybridStyle);
var containerWidth = 0;
for(var i =0; i<this.controlButtons.length; i++){
containerWidth += parseInt(this.controlButtons[i].style.width.split("px")[0]) || 0;
}
container.style.width = containerWidth + "px";
container.appendChild(buttonStandard);
container.appendChild(buttonSatellit);
container.appendChild(buttonHybrid);
this.setSelected();
GEvent.addDomListener(buttonStandard, "click", function() {
map.setMapType(G_NORMAL_MAP);
that.setSelected();
});
GEvent.addDomListener(buttonSatellit, "click", function() {
map.setMapType(G_SATELLITE_MAP);
that.setSelected();
});
GEvent.addDomListener(buttonHybrid, "click", function() {
map.setMapType(G_HYBRID_MAP);
that.setSelected();
});
map.getContainer().appendChild(container);
return container;
}
ETMapTypeControl.prototype.addStyleProperty = function(element, styleObject){
var containerStyleProperty;
for(styleProperty in styleObject){
containerStyleProperty = styleObject[styleProperty];
element.style[styleProperty] = (/^\d*$/.test(containerStyleProperty)) ? containerStyleProperty+"px" : containerStyleProperty;
}
}
ETMapTypeControl.prototype.setSelected = function(){
switch (this.map.getCurrentMapType()){
case G_NORMAL_MAP:
this.addStyleProperty(this.controlButtons[0], this.buttonNormalStyleSelected);
this.addStyleProperty(this.controlButtons[1], this.buttonSatellitStyle);
this.addStyleProperty(this.controlButtons[2], this.buttonHybridStyle);
break;
case G_SATELLITE_MAP:
this.addStyleProperty(this.controlButtons[0], this.buttonNormalStyle);
this.addStyleProperty(this.controlButtons[1], this.buttonSatellitStyleSelected);
this.addStyleProperty(this.controlButtons[2], this.buttonHybridStyle);
break;
case G_HYBRID_MAP:
this.addStyleProperty(this.controlButtons[0], this.buttonNormalStyle);
this.addStyleProperty(this.controlButtons[1], this.buttonSatellitStyle);
this.addStyleProperty(this.controlButtons[2], this.buttonHybridStyleSelected);
break
}
}
ETMapTypeControl.prototype.getDefaultPosition = function() {
return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 7));
}
/*Info Window*/
ETWindowList = {
windows : [],
closeWindows : function(){
for(var i=0; i<this.windows.length; i++){
this.windows[i].remove();
}
this.windows = [];
},
addWindow : function(windowObjekt){
this.windows[this.windows.length] = windowObjekt;
}
}
function ETInfoWindow(image, topic, text, link, button, date){
that = this;
this.image = image;
this.topic = topic;
this.text = text;
this.link = link;
this.date = date;
this.button = button;
}
ETInfoWindow.prototype = new GOverlay();
ETInfoWindow.prototype.content = {
image : "mini_club_image.jpg",
imagePosition : [20, 62],
imageWidth : 85,
imageHeight: 85,
detailButton : imagepath + "bt_details.png",
detailButtonPosition :  [20, 170],
detailButtonLink : "#",
fontSize : 11,
fontFamily : "Arial",
fontColor : "#000",
topic : "",
text : "",
textPosition : [146, 62],
textWidth : 160,
date : ""
}
ETInfoWindow.prototype.containerStyle = {
"height" : 209,
"width" : 326,
"background" : "url(/html/common/images/maps/background_club_window.jpg) ",
"backgroundRepeat" : "no-repeat"
}
ETInfoWindow.prototype.initialize = function(map){
var that = this;
this.map = map;
ETWindowList.closeWindows();	
ETWindowList.addWindow(that);
//map.setCenter(center, 13);
this.content.image = (this.image) ? this.image : '';
this.content.topic = (this.topic) ? this.topic : '';
this.content.text = (this.text) ? this.text : '';
this.content.detailButtonLink = (this.link) ? this.link : '';
this.content.date = (this.date) ? this.date : '';
this.content.detailButton = (this.button) ? this.button : '';
var container = document.createElement("div");
this.container = container;
container.style.position = "absolute";
container.style.left = Math.round((this.map.getContainer().style.width.split("px")[0]-this.containerStyle.width)/2) + "px";
container.style.top = Math.round((this.map.getContainer().style.height.split("px")[0]-this.containerStyle.height)/2) + "px";
var closeButton = document.createElement("div");
closeButton.style.height = 35 +"px";
closeButton.style.width =  35 +"px";
closeButton.style.cursor = "pointer";
closeButton.style.styleFloat = "right";
closeButton.style.cssFloat = "right";
container.appendChild(closeButton);
if(this.content.image){
var imagecropper = document.createElement("div");
imagecropper.style.width = this.content.imageWidth + "px";
imagecropper.style.height = this.content.imageHeight + "px";
imagecropper.style.position = "absolute";
imagecropper.style.left = this.content.imagePosition[0]+"px";
imagecropper.style.top= this.content.imagePosition[1]+"px";
imagecropper.style.overflow = "hidden";
var image = document.createElement("img");
image.src = this.content.image;
image.style.width = this.content.imageWidth+"px";
imagecropper.appendChild(image);
container.appendChild(imagecropper);
}
var textField = document.createElement("div");
if(this.content.topic){
var topicField = document.createElement("h2")
      topicField.innerHTML = this.content.topic;
      if(this.content.date){
topicField.innerHTML = topicField.innerHTML + "<br />" +this.content.date;
}
topicField.style.fontWeight = "bold";
topicField.style.margin = "0px";
topicField.style.marginBottom = "10px";
topicField.style.fontSize =  this.content.fontSize + "px";
textField.appendChild(topicField);
}
    if(this.content.text) {
  textField.innerHTML = textField.innerHTML + this.content.text;
    }
    textField.style.position = "absolute";
textField.style.fontSize = this.content.fontSize + "px";
textField.style.color = this.content.fontColor;
textField.style.fontFamily =  this.content.fontFamily;
textField.style.left =  this.content.textPosition[0] +  "px";
textField.style.top =  this.content.textPosition[1] +  "px";	
textField.style.width=  this.content.textWidth +  "px";
container.appendChild(textField);
if(this.content.detailButton){
var detailButton = document.createElement("a");
detailButton.href = this.content.detailButtonLink ;
detailButton.style.position = "absolute";
detailButton.style.display = "block";
detailButton.style.left = this.content.detailButtonPosition[0] + "px";
detailButton.style.top = this.content.detailButtonPosition[1] + "px";
detailButton.innerHTML = this.content.detailButton;
container.appendChild(detailButton);
}
this.addStyleProperty(container, this.containerStyle);
GEvent.addDomListener(closeButton, "click", function() {
ETWindowList.closeWindows();	
});
map.getContainer().appendChild(container);
map.getPane(G_MAP_FLOAT_PANE).appendChild(container);
return container;
}
ETInfoWindow.prototype.remove = function() {
this.container.parentNode.removeChild(this.container);
}
ETInfoWindow.prototype.addStyleProperty = function(element, styleObject){
var containerStyleProperty;
for(styleProperty in styleObject){
containerStyleProperty = styleObject[styleProperty];
element.style[styleProperty] = (/^\d*$/.test(containerStyleProperty)) ? containerStyleProperty+"px" : containerStyleProperty;
}
}
ETInfoWindow.prototype.calcBounds = function(){
var bounds = this.map.getBounds();
var southWest = bounds.getSouthWest();
var northEast = bounds.getNorthEast();
var lngDelta = (northEast.lng() - southWest.lng()) / 4;
var latDelta = (northEast.lat() - southWest.lat()) / 4;
var rectBounds = new GLatLngBounds(
new GLatLng(southWest.lat() + latDelta, southWest.lng() + lngDelta),
new GLatLng(northEast.lat() - latDelta, northEast.lng() - lngDelta)
);
return rectBounds;
}
ETInfoWindow.prototype.redraw = function(force) {
if (!force) return;
var bounds = this.calcBounds();
var c1 = this.map.fromLatLngToDivPixel(bounds.getSouthWest());
var c2 = this.map.fromLatLngToDivPixel(bounds.getNorthEast());
this.container.style.left = (Math.min(c2.x, c1.x) - 2) + "px";
this.container.style.top = (Math.min(c2.y, c1.y) - 2) + "px";
}
ClubWindow = function(image, topic, text, link, button){
that = this;
this.image = image;
this.topic = topic;
this.text = text;
this.link = link;
this.button = button;
}
ClubWindow.prototype = new ETInfoWindow;
EventWindow = function(image, topic, text, link, button, date){
that = this;
this.image = image;
this.topic = topic;
this.text = text;
this.link = link;
this.date = date;
this.button = button;
}
EventWindow.prototype = new ETInfoWindow;
PrivateEventWindow = function(image, topic, text, link, button, date){
that = this;
this.image = image;
this.topic = topic;
this.text = text;
this.link = link;
this.date = date;
this.button = button;
}
PrivateEventWindow.prototype = new ETInfoWindow;
 
EventWindow.prototype.content = {
image : "mini_club_image.jpg",
imagePosition : [28, 62],
imageWidth : 85,
imageHeight : 85,
detailButton : "detail_button_event.png",
detailButtonPosition :  [23, 185],
detailButtonLink : "#",
fontSize : 11,
fontFamily : "Arial",
fontColor : "#ffffff",
topic : "MINI Event",
text : "",
textPosition : [146, 62],
textWidth : 160,
date : ""
}
EventWindow.prototype.containerStyle = {
"height" : 229,
"width" : 327,
"background" : "url(/html/common/images/maps/background_event_window.gif) ",
"backgroundRepeat" : "no-repeat"
}
PrivateEventWindow.prototype.content = {
image : "mini_club_image.jpg",
imagePosition : [20, 62],
imageWidth : 85,
imageHeight : 85,
detailButton : imagepath + "bt_details.png",
detailButtonPosition :  [20, 170],
detailButtonLink : "#",
fontSize : 11,
fontFamily : "Arial",
fontColor : "#000",
topic : "Private MINI Event",
text : "",
textPosition : [146, 62],
textWidth : 160,
date : ""
}
PrivateEventWindow.prototype.containerStyle = {
 "height" : 209,
 "width" : 326,
 "background" : "url(/html/common/images/maps/bg_private_event_window.jpg) ",
 "backgroundRepeat" : "no-repeat"
}
/*Maker */
/*Icon Definieren*/
var iconMiniEvent = new GIcon();
iconMiniEvent.image = "/html/common/images/maps/marker_mini_event.png";
iconMiniEvent.iconSize = new GSize(73, 74);
iconMiniEvent.iconAnchor = new GPoint(10,32); 
var iconMiniClub = new GIcon();
iconMiniClub.image = "/html/common/images/maps/marker_mini_club.png";
iconMiniClub.iconSize = new GSize(60, 60);
iconMiniClub.iconAnchor = new GPoint(10,32); 
var iconMiniRed = new GIcon();
iconMiniRed.image = "/html/common/images/maps/marker_red.png";
iconMiniRed.iconSize = new GSize(42, 41);
iconMiniRed.iconAnchor = new GPoint(10,32); 
var iconMiniGrey = new GIcon();
iconMiniGrey.image = "/html/common/images/maps/marker_grey.png";
iconMiniGrey.iconSize = new GSize(42, 41);
iconMiniGrey.iconAnchor = new GPoint(10,32); 
/*Markerfenster */
