 var MYMAP = {
	  bounds: null,
	  map: null
	}
	MYMAP.init = function(latLng, selector) {
	}
	MYMAP.placeMarkers = function(filename) {
	}
	
	MYMAP.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();
	}

	MYMAP.placeMarkers = function(filename) {
	  $.get(filename, function(xml){
		$(xml).find("marker").each(function(){
		  var name1 = $(this).find('name1').text();
		  var address1 = $(this).find('address1').text();
		  var address2 = $(this).find('address2').text();
		  var phone = $(this).find('phone').text();
		  var tf = $(this).find('tf').text();
		  var fax = $(this).find('fax').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 imgurl = 'images/map_icon.png';
		  // extend the bounds to include the new point
		  MYMAP.bounds.extend(point);
		  //define icon image
		  var image = new google.maps.MarkerImage(imgurl,
			  // This marker is 20 pixels wide by 32 pixels tall.
			  new google.maps.Size(45, 31),
			  // The origin for this image is 0,0.
			  new google.maps.Point(0,0),
			  // The anchor for this image is the base of the flagpole at 0,32.
			  new google.maps.Point(12, 31));

		  // add the marker itself
		  var marker = new google.maps.Marker({
			position: point,
			map: MYMAP.map,
			//icon: image
		  });
		  // create the tooltip and its text
		  var infoWindow = new google.maps.InfoWindow({
				maxWidth: 150
			});
		  var html='<div style="padding:0 10px 10px 10px; font-size:.9em;"><p><strong>'+name1+'</strong></p><p>'+address1+'<br />'+address2+'<br />'+phone+'<br />'+tf+'<br />'+fax+'</p></div>';
		  // add a listener to open the tooltip when a user clicks on one of the markers
		  google.maps.event.addListener(marker, 'click', function() {
			MYMAP.map.setZoom(13);
			infoWindow.setContent(html);
			infoWindow.open(MYMAP.map, marker);
		  });
		});
		// Fit the map around the markers we added:
		MYMAP.map.fitBounds(MYMAP.bounds);
	  });
	}
	
	
	MYMAP.menulink = function(filename){
	
	$.get(filename, function(xml){
		$(xml).find("marker").each(function(){
			var name1 = $(this).find('name1').text();
		  var address1 = $(this).find('address1').text();
		  var address2 = $(this).find('address2').text();
		  var phone = $(this).find('phone').text();
		  var tf = $(this).find('tf').text();
		  var fax = $(this).find('fax').text();
		  var url = $(this).find('url').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 imgurl = 'images/map_icon.png';
			//MYMAP.bounds.extend(point);
			var image = new google.maps.MarkerImage(imgurl,
				  // This marker is 20 pixels wide by 32 pixels tall.
				  new google.maps.Size(45, 31),
				  // The origin for this image is 0,0.
				  new google.maps.Point(0,0),
				  // The anchor for this image is the base of the flagpole at 0,32.
				  new google.maps.Point(12, 31));
		// add the marker itself
		  var marker = new google.maps.Marker({
			position: point,
			map: MYMAP.map,
			//icon: image
		  });
		  // create the tooltip and its text
		  var infoWindow = new google.maps.InfoWindow({
				maxWidth: 150
			});
		  var html='<div style="padding:0 10px 10px 10px; font-size:.9em;"><p><strong>'+name1+'</strong></p><p>'+address1+'<br />'+address2+'<br />'+phone+'<br />'+tf+'<br />'+fax+'</p></div>';
		 	// add a listener to open the tooltip when a user clicks on one of the markers
		  google.maps.event.addListener(marker, 'click', function() {
			MYMAP.map.setZoom(13);
			infoWindow.setContent(html);
			infoWindow.open(MYMAP.map, marker);
		  });
		});
		// Fit the map around the markers we added:
		//MYMAP.map.fitBounds(MYMAP.bounds);
	  });
	}

	
	//place all markers on document.ready
	$(document).ready(function() {
	  $("#map_canvas").css({
		height: 335,
		width: 425
	  });
	  var myLatLng = new google.maps.LatLng(41.3981, -97.7344);
	  MYMAP.init('#map_canvas', myLatLng, 3);
	  $(document).ready(function(e){
		MYMAP.placeMarkers('locations/locs.xml');
	  });
	});
	
	//refresh map screen
	$(document).ready(function() {
	  var myLatLng = new google.maps.LatLng(41.3981, -97.7344);
	  $('#showmarkers').click(function(e){
		MYMAP.placeMarkers('locations/locs.xml');
	  });
	});// JavaScript Document
