var googlemap = {
  map: null,
	bounds: null
}

googlemap.init = function(selector, latLng, zoom) {
	
	var myOptions = {
		zoom:zoom,
		center: latLng,
		mapTypeId: google.maps.MapTypeId.ROADMAP
	}
	this.map = new google.maps.Map($(selector)[0], myOptions);
	this.bounds = new google.maps.LatLngBounds();
}

googlemap.placeMarkers = function(filename) {
	$.get(filename, function(xml){
		$(xml).find("marker").each(function(){
			var name 	= $(this).find('name').text();
			var address = $(this).find('address').text();
			var city 	= $(this).find('city').text();
			var street 	= $(this).find('street').text();
			var functie	= $(this).find('function').text();
			
			// create a new LatLng point for the marker
			var lat = $(this).find('lat').text();
			var lng = $(this).find('lng').text();
			var point = new google.maps.LatLng(parseFloat(lat),parseFloat(lng));
			
			var infowindow = new google.maps.InfoWindow({
				content: name
            });
            
			var marker = new google.maps.Marker({
				position: point,
				map: googlemap.map
			});
			
			// extend the bounds to include the new point
			//googlemap.bounds = googlemap.bounds.extend(marker.position);
			//googlemap.map.fitBounds(googlemap.bounds);
			

		});
	});
}
