
/*	Google Map Methods
 <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=true"></script>
-----------------------------------------*/

// Map vars
var map, geocoder;
var infowindow = new google.maps.InfoWindow();

var mapUtils = {
	'initialize': function initialize(mapId,initAtLat, initAtLong) {
		// Init options
		var myLatlng = new google.maps.LatLng(initAtLat,initAtLong);
		var myOptions = {
			zoom: 7,
			center: myLatlng,
			mapTypeId: google.maps.MapTypeId.TERRAIN
		}
		map = new google.maps.Map(document.getElementById(mapId), myOptions);
	},
	'initializeAtLocation': function initialize(initAtLat, initAtLong, storeLat, storeLong, markerContent) {
		// Init options
		var myLatlng = new google.maps.LatLng(initAtLat,initAtLong);
		var myOptions = {
			zoom: 12,
			center: myLatlng,
			mapTypeId: google.maps.MapTypeId.TERRAIN
		}

		map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
		
		var latlng = new google.maps.LatLng(storeLat,storeLong);
		var image = new google.maps.MarkerImage('/images/2009/Logo_map_blue.png',
			new google.maps.Size(21, 21),
			new google.maps.Point(0,0),
			new google.maps.Point(0, 21));

		var marker = new google.maps.Marker({
			position: latlng, 
			icon: image,
			map: map,
			title:"",
			visible: true
		});

		mapUtils.attachOverlays(marker, markerContent);

		map.setCenter(latlng);
		map.setZoom(8);
	
	},
	'attachOverlays': function attachOverlays(marker, markerContent) {	
		var contentString = markerContent;
		//listeners			
		var myOptions = {
				 content: '<div id="map_info_window" style="overflow:hidden;width:200px"><div id="map_info_window_t">&nbsp;</div><div id="map_info_window_contents" style="margin-left:0px">' + contentString + '</div><div id="map_info_window_b">&nbsp;</div></div>'
				,disableAutoPan: false
				,maxWidth: 0
				,pixelOffset: new google.maps.Size(-215, -200)
				,zIndex: null
				,boxStyle: { 
				  background: "transparent url() no-repeat"
				  ,width: "200px"
				 }
				,closeBoxMargin: "-2000px 0 0 0"
				,closeBoxURL: "http://www.google.com/intl/en_us/mapfiles/close.gif"
				,infoBoxClearance: new google.maps.Size(1, 1)
				,isHidden: false
				,pane: "floatPane"
				,enableEventPropagation: false
		};

		var ib = new InfoBox(myOptions);
		ib.open(map, marker);
	}
}

