<?php if ($this->element['bounds'][0] && $this->element['bounds'][1] && $this->element['strokeColor'] && $this->element['strokeOpacity'] && $this->element['strokeWeight']['value']) : ?>
    var gmap<?php echo $this->element['id']; ?>_rectangle = new google.maps.Rectangle({
    bounds: new google.maps.LatLngBounds(
    new google.maps.LatLng(<?php echo $this->element['bounds'][0]; ?>),
    new google.maps.LatLng(<?php echo $this->element['bounds'][1]; ?>)
    )
    , strokeColor: "#<?php echo $this->element['strokeColor']; ?>"
    , strokeOpacity: <?php echo $this->element['strokeOpacity']; ?>
    , strokeWeight: <?php echo $this->element['strokeWeight']['value']; ?>
    <?php if($this->element['fillColor'] && $this->element['fillOpacity']) : ?>
        , fillColor: "#<?php echo $this->element['fillColor']; ?>"
        , fillOpacity: <?php echo $this->element['fillOpacity']; ?>
    <?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; ?>
    });
    gmap<?php echo $this->element['id']; ?>_rectangle.setMap(gmap<?php echo $this->map; ?>);
    <?php if($this->element['markerAction'] == 'INFO') : ?>
        var gmap<?php echo $this->element['id']; ?>_infowindow = new google.maps.InfoWindow({
        position: new google.maps.LatLng(<?php echo $this->element['windowPosition']; ?>),
        <?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']; ?></div>'
        });
        google.maps.event.addListener(gmap<?php echo $this->element['id']; ?>_rectangle, 'click', function(event) {
        gmap<?php echo $this->element['id']; ?>_infowindow.setPosition(event.latLng);
        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']; ?>_rectangle, '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; ?>
