// JavaScript Document
// ****************** BEGIN Google Maps API Code ******************************* 

		var map
		function map_initialize(storeLocation, divName, showInfo)
		{
			//alert('showInfo: '+showInfo);
			//alert('divName: '+divName);
			if (storeLocation == 'troy')
			{
				//alert('TROY')
				var latlng = new google.maps.LatLng(42.743905,-73.685044);
				var contentString = 'The Tire Warehouse, Inc.<br>' +
							'631 River Street<br>' +
							'Troy, NY 12190<br>' + 
							'1/4 Mile North of Hoosick Street<br>' +
							'Phone: 518-271-0234 <br>' + 
							'<a target="_blank" href="http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=631+River+St,+Troy,+NY+12180&sll=42.757979,-73.717747&sspn=0.055457,0.110378&ie=UTF8&hq=&hnear=631+River+St,+Troy,+Rensselaer,+New+York+12180&ll=42.743719,-73.685045&spn=0.006934,0.013797&z=16">Get Directions</a>';
				var markerTitle = 'The Tire Warehouse, Troy'
			}
			else if (storeLocation == 'cliftonpark')
			{
				var latlng = new google.maps.LatLng(42.828323,-73.736962);
				var contentString = 'The Tire Warehouse, Inc.<br>' +
								'1430 Halfmoon Parkway (Rt. 9)<br>' +
								'Clifton Park, NY 12065<br>' +
								'Just North of Crescent Bridge on Rt. 9<br>' +
								'Phone: 518-383-0400<br>' +
								'<a target="_blank" href="http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=1430+Rte+9,+Clifton+Park,+NY+12065&sll=42.828323,-73.736962&sspn=0.006924,0.013797&ie=UTF8&hq=&hnear=1430+U.S.+9,+Clifton+Park,+Saratoga,+New+York+12065&z=16">Get Directions</a><br />';
				var markerTitle = 'The Tire Warehouse, Clifton Park'
			}
			else if (storeLocation == 'queensbury')
			{
				var latlng = new google.maps.LatLng(43.331643,-73.64868);
				var contentString = 'The Tire Warehouse, Inc.<br>' +
								'274 Quaker Road<br>' +
								'Queensbury, NY 12804<br>' +
								'Across from Lowes Home Improvement Center<br>' +
								'Phone: 518-798-1056<br>' +
								'<a target="_blank" href="http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=274+Quaker+Rd,+Queensbury,+NY+12804&sll=42.757979,-73.717747&sspn=0.052306,0.175781&ie=UTF8&hq=&hnear=274+Quaker+Rd,+Queensbury,+Warren,+New+York+12804&ll=43.331453,-73.644576&spn=0.006868,0.013797&z=16">Get Directions</a>';
				var markerTitle = 'The Tire Warehouse, Queensbury'
			}
			
			var myOptions = {
			  zoom: 14,
			  center: latlng,
			  mapTypeId: google.maps.MapTypeId.ROADMAP
			};
			
			var map = new google.maps.Map(document.getElementById(divName), myOptions);
			
			var image = 'http://www.thetirewarehouseinc.com/images/mapIconTW.png';
			
			var tireMarker = new google.maps.Marker({
			  position: latlng,
			  title: markerTitle,
			  map: map,
			  icon: image
			});

	
			var infowindow = new google.maps.InfoWindow({
				content: contentString
			});
	
			/*var marker = new google.maps.Marker({
			  position: latlng,
			  title: markerTitle
			});*/
		
			
			if (showInfo > 0)
			{
				//alert('test code 12');
				//display the infoWindow when the map loads
				infowindow.open(map,tireMarker);
			}
			
			// set the click handler for the marker to display the infoWindow
			google.maps.event.addListener(tireMarker, 'click', function() {
				infowindow.open(map,tireMarker);
			});
	
			// To add the marker to the map, call setMap();
			tireMarker.setMap(map); 
			//google.maps.event.trigger(map, "resize");
 
		}
	
    // *******************  END Google Maps API Code ************************************ 
