<?php

	/**
	 * Template für die Anzeige der Kundenkarte innerhalb des Statistikmoduls
	 */

?> 
<script type="text/javascript">/* <![CDATA[ */
	
	function wpsg_mod_statistics_initialize() 
	{
		
    	var mapOptions = {
      		center: new google.maps.LatLng(-34.397, 150.644),
      		zoom: 5,
      		mapTypeId: google.maps.MapTypeId.ROADMAP
    	};

    	var map = new google.maps.Map(document.getElementById("wpsg_mod_statistics_map"), mapOptions);
    	var bounds = new google.maps.LatLngBounds();
     	
    	<?php $i = 1; foreach ($this->view['wpsg_mod_statistics']['marker'] as $m) { ?>
    	var marker<?php echo $i; ?> = new google.maps.Marker({
			position: new google.maps.LatLng(<?php echo $m['long']; ?>, <?php echo $m['lat']; ?>),
			map: map
    	} );    	
    	google.maps.event.addListener(marker<?php echo $i; ?>, 'click', function() {
			location.href = '<?php echo WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Customer&action=edit&edit_id='.$m['customer']['id']; ?>';
    	} );    	  
    	bounds.extend(marker<?php echo $i; ?>.getPosition());  	
    	<?php $i ++; } ?>

    	map.fitBounds(bounds);
    	map.setZoom(15);
    	
  	} // function wpsg_mod_statistics_initialize() 

	google.maps.event.addDomListener(window, 'load', wpsg_mod_statistics_initialize);
 
/* ]]> */</script>

<div style="" id="wpsg_mod_customermap_layer">
	<div class="postbox" id="wpsg_modcustomermap">
		<div style="height:500px;">
			<div style="width:100%; height:100%" id="wpsg_mod_statistics_map"></div>	
		</div>
	</div>
</div>