<patTemplate:tmpl name="pageoutput" unusedvars="strip">
<script type="text/javascript">
<!--
var geocoder;
var map;
var latLng;


jomresJquery(document).ready(function(){
	init_map_{RANDOM_IDENTIFIER}();
	});

{UPDATEMARKERPOSITION}


function init_map_{RANDOM_IDENTIFIER}()
	{
	geocoder = new google.maps.Geocoder();
	latLng = new google.maps.LatLng({LAT}, {LONG});
	var options_{RANDOM_IDENTIFIER} = {
		center: latLng,
		zoom: {ZOOMLEVEL},
		{DISABLE_UI}
		mapTypeId: google.maps.MapTypeId.{MAPTYPE}{SUPPRESS_POIS}
		};
	
	var map = new google.maps.Map(document.getElementById("map_{RANDOM_IDENTIFIER}"),
		options_{RANDOM_IDENTIFIER});
	var marker = new google.maps.Marker({
		position: latLng{DRAGABLE}
		});
	marker.setMap(map);

	{TRANSIT_LAYER}
	
	{DRAG_LISTENER}
	}
	
function build_address()
	{
	var property_name = document.getElementById('property_name').value;
	var property_street = document.getElementById('property_street').value;
	var property_town = document.getElementById('property_town').value;
	var region = jomresJquery("#region :selected").text();
	var country = jomresJquery("#country :selected").text();
	var postcode = document.getElementById('property_postcode').value;
	
	var address = "";
	//if ( property_name != 'undefined' && property_street != 'undefined' && property_town != 'undefined' && region != 'undefined' && country != 'undefined' && postcode != 'undefined' ) {
		address = property_name + "," +property_street + "," +property_town + "," +region + "," +country + "," +postcode ;
	//	}
	return address;
	}
	
function codeAddress(address) {
    geocoder.geocode( { 'address': address}, function(results, status) {
        if (status == google.maps.GeocoderStatus.OK) {
			
			var options_{RANDOM_IDENTIFIER} = {
				center: results[0].geometry.location,
				zoom: 12,
				mapTypeId: google.maps.MapTypeId.ROADMAP{SUPPRESS_POIS}
				};
			var map = new google.maps.Map(document.getElementById("map_{RANDOM_IDENTIFIER}"),options_{RANDOM_IDENTIFIER});
			
            var marker = new google.maps.Marker({ map: map, position: results[0].geometry.location{DRAGABLE}});
			
			google.maps.event.addListener(marker, 'drag', function() {
			updateMarkerPosition(marker.getPosition());
			});
			google.maps.event.addListener(marker, 'dragend', function() {
			map.setCenter(marker.getPosition());
			});
			
			updateMarkerPosition(marker.getPosition());
        }
    });
}

jomresJquery(document).ready(function() {
	jomresJquery('body').on('shown','#mapTab', function (e) {
		init_map_{RANDOM_IDENTIFIER}();
		});
	});
//-->
</script>
	<div id="map_canvas">
		<div id="map_{RANDOM_IDENTIFIER}" class="row-fluid form-horizontal" style="height:{MAP_HEIGHT}px;"></div>
	</div>
	<!-- do not set these sizes to 100% or anything with percentages in, the map will not show if you do. I wasted ages figuring that out. -->
</patTemplate:tmpl>