/**
 * This code was written by Mike Moore November 2009 and is the property of OnNowTV.com Broadcasting Association...Copyright 2008
 * This code MAY NOT BE USED without the expressed written consent of 
 * OnNowTV.com Broadcasting Association - all rights reserved.
 
 * File name:     googlemap_netowner_control.js
 * Description:   define common global variables below:
 * History:       
 *   mm/dd/yyyy - Name - brief description of changes 
 * 12/21/2010 - added geocoding function Peter Kahuria
 */
 
var geocoder;
var map;

function initialize(lat, long, title) {
	geocoder = new google.maps.Geocoder();
	var latlng = new google.maps.LatLng(lat, long);
	var myOptions = {
		zoom: 15,
		center: latlng,
		mapTypeId: google.maps.MapTypeId.ROADMAP
	};
	map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
	var marker = new google.maps.Marker({
		position: latlng, 
		map: map, 
		title: title
	});
}

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

