<?php use_javascript('https://maps.google.com/maps?file=api&amp;v=2&amp;key=' . sfConfig::get('app_gmap') . '&sensor=true'); ?>

	<div id="map_canvas" style="width: 730px; height: 580px"></div>

<script type="text/javascript" language="JavaScript">
/* <![CDATA[ */

window.onload = function(){
 if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map_canvas"));
		map.setCenter(new GLatLng(45, 3), 6);
        map.setUIToDefault();

		var myIcon = new GIcon(G_DEFAULT_ICON);
		myIcon.image = 'https://maps.google.com/mapfiles/marker_green.png';
		var markerOptions = { icon: myIcon};

<?php foreach (KataoSupplierPeer::retrieveByPKs(array_keys(KataoSupplierPeer::getAllVisible())) as $katao_supplier): ?>
	<?php $katao_user = $katao_supplier->getFirstKataoUser() ?>
	<?php if (!is_null($katao_user) && '' != $katao_supplier->getGmapLat() && '' != $katao_supplier->getGmapLng()): ?>
		var markerS<?php echo $katao_user->getId(); ?> = new GMarker(new GLatLng(<?php printf('%f,%f', $katao_supplier->getGmapLat(), $katao_supplier->getGmapLng()); ?>), markerOptions);
		GEvent.addListener(markerS<?php echo $katao_user->getId(); ?>, "click", function() {
			markerS<?php echo $katao_user->getId(); ?>.openInfoWindowHtml('<?php echo str_replace(array("\r\n", "\n", "\r"), array('\n', '\n', ''), get_partial('katao/gmap_supplier', array('supplier' => $katao_user, 'popup' => false))); ?>');
		});
		map.addOverlay(markerS<?php echo $katao_user->getId(); ?>);
	<?php endif ?>
<?php endforeach ?>
    }
}

window.onunload = GUnload;

/* ]]> */
</script>