jQuery(document).ready(function() {
								
if(jQuery("#map").html()!=null){

  jQuery("#map").css({
		height: 500,
		width: 682
	});
  
  window.onload = function(e){
		MYMAP.placeMarkers('/markers2.xml');
  };
  
	var myLatLng = new google.maps.LatLng(40.06732, 83.11089);
  MYMAP.init('#map', myLatLng, 10);
  
}
  
 
});

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

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

MYMAP.placeMarkers = function(filename) {
	jQuery.get(filename, function(xml){
		jQuery(xml).find("marker").each(function(){
			var name = jQuery(this).find('name').text();
			var comname = jQuery(this).find('comname').text();
			var address = jQuery(this).find('address').text();
			
			// create a new LatLng point for the marker
			var lat = jQuery(this).find('lat').text();
			var lng = jQuery(this).find('lng').text();
			var phonenum = jQuery(this).find('phonenum').text();
			var fax = jQuery(this).find('fax').text();
			var point = new google.maps.LatLng(parseFloat(lat),parseFloat(lng));
			
			// extend the bounds to include the new point
			MYMAP.bounds.extend(point);
			
			var marker = new google.maps.Marker({
				position: point,
				map: MYMAP.map,
				icon:'/images/yree.png'
			});
			
			var infoWindow = new google.maps.InfoWindow();
			var html='<strong>'+name+'</strong.><br /><strong>'+comname+'</strong.><br />'+address+'<br />'+phonenum+'<br />'+'Fax:'+fax;
			google.maps.event.addListener(marker, 'click', function() {
				infoWindow.setContent(html);
				infoWindow.open(MYMAP.map, marker);
			});
			MYMAP.map.fitBounds(MYMAP.bounds);
		});
	});
}
