{% extends widget.get_base_template %}

{% block content %}
<div id="{{ widget.fe_identifier }}-map" class="widget-maplocation-map" style='height:100%;'></div>

<script type='text/javascript' src='http://maps.google.com/maps/api/js?sensor=true&amp;ver=3'></script>
<script type="text/javascript">
//<![CDATA[

(function($) {

	var canvas = $("#{{ widget.fe_identifier }}-map");
	var location = new google.maps.LatLng({{ widget.latitude }}, {{ widget.longitude }});
	var zoom = {{ widget.zoom }};

	map_type = google.maps.MapTypeId.{{ widget.map|upper }};

	var options = { zoom: zoom, center: location, mapTypeId: map_type };
	var map = new google.maps.Map(canvas.get(0), options);
	var marker = new google.maps.Marker({ position: location, map: map });

	{% if widget.title != '' %}
	{% if widget.description == '' %}
	var content = '<b>{{ widget.title }}</b>';
	{% else %}
	var content = '<b>{{ widget.title }}</b><br />{{ widget.description }}';
	{% endif %}
	var infoWindow = new google.maps.InfoWindow({content: content});
	infoWindow.open(map, marker);
	{% endif %}

	var fixMap = function() {
		google.maps.event.trigger(map, "resize");
		map.setCenter(location);
	}
//	alert('j');

//	alert('k');
	setTimeout(fixMap, 2000);

})(jQuery);

//]]>
</script>
{% endblock %}

