function GoogleMapAdvanced(){
	this.getMap = function(id1, id2, longitude, latitude, imgPath){
		window.onload = function(){
			var fenway = new google.maps.LatLng(longitude, latitude);
			var mapOptions = {center: fenway, zoom: 16, mapTypeId: google.maps.MapTypeId.ROADMAP, streetViewControl: true};
			var map = new google.maps.Map(document.getElementById(id1), mapOptions);
			var image = imgPath;
			var myLatLng = new google.maps.LatLng(longitude, latitude);
			var beachMarker = new google.maps.Marker({position: myLatLng, map: map, icon: image});
			var panoramaOptions = {position: fenway, pov: {heading: 34, pitch: 10, zoom: 1}};
			var panorama = new  google.maps.StreetViewPanorama(document.getElementById(id2),panoramaOptions);
			map.setStreetView(panorama);
		};  
	}
}
var googleMapAdvanced = new GoogleMapAdvanced();

function GoogleMap(){
	this.getMap = function(id, title, longitude, latitude, imgPath, str){
		window.onload = function(){  
			var map;
			var myLatlng = new google.maps.LatLng(longitude, latitude);
			var myOptions = {
				zoom: 17,
				center: myLatlng,
				mapTypeId: google.maps.MapTypeId.ROADMAP,
				streetViewControl: true
			}
			
			map = new google.maps.Map(document.getElementById(id), myOptions);
			var image = imgPath;
			var location = new google.maps.LatLng(longitude, latitude);
			var marker1 = new google.maps.Marker({
				position: location, 
				icon: image,
				map: map
			});

			var infowindow1 = new google.maps.InfoWindow({
				content: str
			});

			var marker1 = new google.maps.Marker({
				position: location,
				icon: image,
				map: map,
				title: title
			});

			google.maps.event.addListener(marker1, 'click', function() {
				infowindow1.open(map,marker1);
			});
		}; 
	}
		
	this.getGoogleMap = function(id, title, longitude, latitude, imgPath, str){
		$(document).ready(function() {
/*
			var map;
			var myLatlng = new google.maps.LatLng(longitude, latitude);
			var myOptions = {
				zoom: 17,
				center: myLatlng,
				mapTypeId: google.maps.MapTypeId.ROADMAP,
				streetViewControl: true,
				infowindows: false,                     // do not use infoWindow
				infobox: true, 
			
			}
			
			map = new google.maps.Map(document.getElementById(id), myOptions);
			var image = imgPath;
			var location = new google.maps.LatLng(longitude, latitude);
			var marker1 = new google.maps.Marker({
				position: location, 
				icon: image,
				map: map
			});

			var infowindow1 = new google.maps.InfoWindow({
				content: str
			});
			
			var marker1 = new google.maps.Marker({
				position: location,
				icon: image,
				map: map,
				title: title
			});

			
			//	google.maps.event.addListener(marker1, 'click', function() {
			//		infowindow1.open(map,marker1);
			//	});
		
			
			infowindow1.open(map,marker1);
			*/
			
			var secheltLoc = new google.maps.LatLng(longitude, latitude);
			var myMapOptions = {
				streetViewControl: true,
				zoom: 18,
				center: secheltLoc,
				mapTypeId: google.maps.MapTypeId.ROADMAP
			};
			
			var theMap = new google.maps.Map(document.getElementById(id), myMapOptions);
			var marker = new google.maps.Marker({
				map: theMap,
				draggable: true,
				position: new google.maps.LatLng(longitude, latitude),
				mapTypeId: google.maps.MapTypeId.ROADMAP,
				streetViewControl: true
			});
	 
			var boxText = document.createElement("div");
			boxText.style.cssText = "border: 1px solid black; margin-top: 8px; background: #F7EEFB; padding: 5px;";
			boxText.innerHTML = str;
	 
			var myOptions = {
				 content: boxText
				,disableAutoPan: false
				,maxWidth: 0
				,pixelOffset: new google.maps.Size(-140, 0)
				,zIndex: null
				,boxStyle: { 
				   background: "url('tipbox.gif') no-repeat"
				  ,opacity: 0.75
				  ,width: "280px"
				 }
				,closeBoxMargin: "10px 2px 2px 2px"
				,closeBoxURL: "http://www.google.com/intl/en_us/mapfiles/close.gif"
				,infoBoxClearance: new google.maps.Size(1, 1)
				,isHidden: false
				,pane: "floatPane"
				,enableEventPropagation: false
			};
	 
			google.maps.event.addListener(marker, "click", function (e) {
				ib.open(theMap, this);
			});
	 
			var ib = new InfoBox(myOptions);
			ib.open(theMap, marker);	
		});	
	}	
}
var googleMap = new GoogleMap();
