<?php if ($this->element['singleCoords'] && $this->element['markerType']) : ?>
    var gmap<?php echo $this->element['id']; ?>_marker = new google.maps.Marker({
    position: new google.maps.LatLng(<?php echo $this->element['singleCoords']; ?>)
    , map: gmap<?php echo $this->map; ?>
    <?php if($this->element['markerType']=='ICON') : ?>
        <?php if($this->element['iconSRC'] && $this->element['iconSize'][0] && $this->element['iconSize'][1]) : ?>
            , icon: new google.maps.MarkerImage(
            '<?php echo $this->element['iconSRC']; ?>'
            , new google.maps.Size(<?php echo $this->element['iconSize'][0].','.$this->element['iconSize'][1]; ?>)
            , new google.maps.Point(0,0)
            , new google.maps.Point(<?php echo $this->element['iconAnchor'][0].','.$this->element['iconAnchor'][1]; ?>)
            , new google.maps.Size(<?php echo $this->element['iconSize'][0].','.$this->element['iconSize'][1]; ?>)
            )
        <?php endif; ?>
        <?php if($this->element['shadowSRC'] && $this->element['shadowSize'][0] && $this->element['shadowSize'][1]) : ?>
            , shadow: new google.maps.MarkerImage(
            '<?php echo $this->element['shadowSRC']; ?>'
            , new google.maps.Size(<?php echo $this->element['shadowSize'][0].','.$this->element['shadowSize'][1]; ?>)
            , new google.maps.Point(0,0)
            , new google.maps.Point(<?php echo $this->element['iconAnchor'][0].','.$this->element['iconAnchor'][1]; ?>)
            , new google.maps.Size(<?php echo $this->element['shadowSize'][0].','.$this->element['shadowSize'][1]; ?>)
            )
        <?php endif; ?>
    <?php elseif($this->element['fillColor']): ?>
        , icon: new google.maps.MarkerImage('<?php echo (\Environment::get('ssl') ? 'https://chart.googleapis.com' : 'http://chart.apis.google.com'); ?>/chart?chst=d_map_pin_letter&chld=%E2%80%A2|<?php echo $this->element['fillColor']; ?>'
        , new google.maps.Size(21,34)
        , new google.maps.Point(0,0)
        , new google.maps.Point(10,34))
        , shadow: new google.maps.MarkerImage('<?php echo (\Environment::get('ssl') ? 'https://chart.googleapis.com' : 'http://chart.apis.google.com'); ?>/chart?chst=d_map_pin_shadow'
        , new google.maps.Size(40,37)
        , new google.maps.Point(0,0)
        , new google.maps.Point(12,35))
    <?php endif; ?>
    <?php if($this->element['markerAction'] == 'LINK' && $this->element['linkTitle']) : ?>
        , title:"<?php echo $this->element['linkTitle']; ?>"
    <?php elseif ($this->element['markerShowTitle']) : ?>
        , title:"<?php echo $this->element['title']; ?>"
    <?php endif; ?>
    <?php if ($this->element['zIndex']) : ?>
        , zIndex: <?php echo $this->element['zIndex']; ?>
    <?php endif; ?>
    <?php if ($this->element['parameter']) : ?>
        , <?php echo $this->element['parameter']; ?>
    <?php endif; ?>
    });
    if(typeof gmap<?php echo $this->map; ?>_markers === 'undefined'){
        var gmap<?php echo $this->map; ?>_markers = [];
    }
    gmap<?php echo $this->map; ?>_markers.push(gmap<?php echo $this->element['id']; ?>_marker);
    <?php if($this->element['markerAction'] == 'INFO') : ?>
        <?php if($this->element['useRouting']) {
            $routingPoint = ($this->element['routingAddress'] ? $this->element['routingAddress'] : $this->element['singleCoords']);
            $routingLink = '<div class="routinglink">' . str_replace('?','<a href="https://www.google.com/maps/preview?saddr=&daddr=' . urlencode($routingPoint) . '&ie=UTF8&hl=' . $GLOBALS['TL_LANGUAGE'] . '" onclick="window.open(this.href); return false;">' . str_replace(' ','[nbsp]',$this->element['labels']['routingLink']) . '</a>', str_replace(' ','[nbsp]',$this->element['labels']['routingLabel'])) . '<br><form action="https://maps.google.com/maps" method="get" target="_new"><input type="hidden" name="daddr" value="' . $routingPoint . '"><input type="hidden" name="ie" value="UTF8"><input type="hidden" name="hl" value="' . $GLOBALS['TL_LANGUAGE'] . '"><input type="text" class="text" name="saddr" /><input type="submit" class="submit" value="' . $this->element['labels']['routingSubmit'] . '" /></form></div>';
        } else {
            $routingLink = '';
        } ?>
        var gmap<?php echo $this->element['id']; ?>_infowindow = new google.maps.InfoWindow({
        position: new google.maps.LatLng(<?php echo $this->element['singleCoords']; ?>),
        <?php if ($this->element['infoWindowAnchor'][0]!=0 || $this->element['infoWindowAnchor'][1]!=0) : ?>
            pixelOffset: new google.maps.Size(<?php echo $this->element['infoWindowAnchor'][0].','.$this->element['infoWindowAnchor'][1]; ?>),
        <?php endif; ?>
        content: '<div<?php echo $this->element['infoWindowSize']; ?>><?php echo $this->element['infoWindow'].$routingLink; ?></div>'
        });
        google.maps.event.addListener(gmap<?php echo $this->element['id']; ?>_marker, 'click', function() {
        gmap<?php echo $this->element['id']; ?>_infowindow.open(gmap<?php echo $this->map; ?>);
        });
        <?php if($this->element['popupInfoWindow']) : ?>
            gmap<?php echo $this->element['id']; ?>_infowindow.open(gmap<?php echo $this->map; ?>);
        <?php endif; ?>
    <?php elseif($this->element['markerAction'] == 'LINK') : ?>
        google.maps.event.addListener(gmap<?php echo $this->element['id']; ?>_marker, 'click', function() {
        <?php if($this->element['target']) : ?>
            window.open('<?php echo $this->element['url']; ?>','_blank','resizable=yes,scrollbars=yes,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes');
        <?php else :?>
            window.location.href='<?php echo $this->element['url']; ?>';
        <?php endif; ?>
        });
    <?php endif; ?>
<?php endif; ?>