var geocoder;
var footerMap;
var dbaddress;

$(document).ready(function () {

	var height = $('#content #columns').height();
	$('#content #columns .column1').height(height);
	$('#content #columns .column2').height(height);
	$('#content #columns .column3').height(height);
	
	initFooterMap();			
});

function initFooterMap()
{
	dbaddress = $("#map-address").val();
	geocoder = new google.maps.Geocoder();
    var latlng = new google.maps.LatLng(0, 0);
    var myOptions = 
    {
		zoom: 14,
		center: latlng,
		panControl: false,
		zoomControl: true,
		mapTypeControl: false,
		scaleControl: false,
		streetViewControl: false,
		mapTypeId: google.maps.MapTypeId.ROADMAP
    }
	
	footerMap = new google.maps.Map(document.getElementById("map-canvas-footer"), myOptions);
	codeAddress(footerMap, dbaddress);
}

function codeAddress(canvas, address) 
{
	geocoder.geocode( { 'address': address}, function(results, status) 
	{
		if (status == google.maps.GeocoderStatus.OK) 
		{
			canvas.setCenter(results[0].geometry.location);
			var marker = new google.maps.Marker(
			{
				map: canvas, 
				position: results[0].geometry.location
			});
		} 
		else 
		{
			alert("Geocode was not successful for the following reason: " + status);
		}
	});
}
