// JavaScript Document\

var GoogleMap = {
	
		addProperies : function(lat, long, text, title){
			GoogleMap.lat = lat;
			GoogleMap.long = long;
			GoogleMap.markerText = text;
			GoogleMap.title = title;
						
		},
		
		
		init : function(){
			
			var latlng = new google.maps.LatLng(GoogleMap.lat, GoogleMap.long);// middle of Surrey?
			var myOptions = {
				zoom: 15,
				center: latlng,
				mapTypeId: google.maps.MapTypeId.ROADMAP
			}
			map = new google.maps.Map(document.getElementById("map"), myOptions);
			
			var marker = new google.maps.Marker({
				position: latlng,
				title:GoogleMap.title
			});
			
			marker.setMap(map);
			
			var contentString = GoogleMap.markerText;
			
			var infowindow = new google.maps.InfoWindow({
				content: contentString
			});
			
			google.maps.event.addListener(marker, 'click', function() {
				infowindow.open(map,marker);
			});
		}
	 	
		
}
$(function(){
	if ($('#map').length) {
		GoogleMap.init();
	}
});
