 //<![CDATA[
var marker;
var map;
var latlng;
var client;

function setupMap() {
		if (GBrowserIsCompatible()) {
				client = new GStreetviewClient();
				
				latlng = new GLatLng(33.402963888463674, -111.90914154052734);
				map = new GMap2(document.getElementById("map"));
				map.addControl(new GLargeMapControl());
				map.setCenter(latlng, 15);
				map.enableInfoWindow();
				map.disableDoubleClickZoom();
				map.disableContinuousZoom();
				map.disableGoogleBar();
				map.disableScrollWheelZoom();
			
			/*var icon = new GIcon();
				icon.image = 'http://gmaps-samples.googlecode.com/svn/trunk/markers/circular/greencirclemarker.png';
				icon.iconSize = new GSize(32, 32);
				icon.iconAnchor = new GPoint(16, 16);
				icon.infoWindowAnchor = new GPoint(25, 7);
			*/
			
			opts = { 
				//"icon": icon,
				"icon": G_DEFAULT_ICON,
				"clickable": true,
				"title": "2242 S. McClintock Ste 1, Tempe, AZ 85282",
				"labelText": "2242 S. McClintock Ste 1, Tempe, AZ 85282",
				"labelOffset": new GSize(-6, -10)
			};
			marker = new GMarker(latlng, opts);
			
			GEvent.addListener(marker, "click", function() {
				//map.enableDragging();
				//map.setCenter(latlng, 15);
				marker.openInfoWindowHtml("<b>Gold Dust Dental Lab</b><br />2242 S. McClintock Ste 1<br />Tempe, AZ 85282");
				//openPanoramaBubble()
				//map.disableDragging();
			});
			
			GEvent.addListener(map, "click", function() {
				marker.openInfoWindowHtml("<b>Gold Dust Dental Lab</b><br />2242 S. McClintock Ste 1<br />Tempe, AZ 85282");
				//openPanoramaBubble()
			});
			
			map.addOverlay(marker);
			marker.openInfoWindowHtml("<b>Gold Dust Dental Lab</b><br />2242 S. McClintock Ste 1<br />Tempe, AZ 85282");
			//openPanoramaBubble()
			map.disableDragging();
		}
    }
	
function openPanoramaBubble() {
  /*var contentNode = document.createElement('div');
  contentNode.style.textAlign = 'center';
  contentNode.style.width = '100px';
  contentNode.style.height = '100px';
  contentNode.innerHTML = 'Loading panorama';*/

  var smallNode = document.createElement('div');
  smallNode.style.width = '205px';
  smallNode.style.height = '205px';
  smallNode.id = 'pano';
  marker.openInfoWindow(smallNode);
  //marker.openInfoWindow(smallNode, {maxContent: contentNode, maxTitle: "Full screen"});
  panorama = new GStreetviewPanorama(smallNode);
  panorama.setLocationAndPOV(marker.getLatLng(), null);
  GEvent.addListener(panorama, "newpano", onNewLocation);
  GEvent.addListener(panorama, "yawchanged", onYawChange); 
  GEvent.addListener(panorama, "error", handleNoFlash);
	
  //var iw = map.getInfoWindow();
  
  /*GEvent.addListener(iw, "maximizeend", function() {
    panorama.setContainer(contentNode);  
    window.setTimeout("panorama.checkResize()", 5);
  });*/
}	

function onYawChange(newYaw) {
  var GUY_NUM_ICONS = 16;
  var GUY_ANGULAR_RES = 360/GUY_NUM_ICONS;
  if (newYaw < 0) {
    newYaw += 360;
  }
  //guyImageNum = Math.round(newYaw/GUY_ANGULAR_RES) % GUY_NUM_ICONS;
  //guyImageUrl = "http://maps.google.com/intl/en_us/mapfiles/cb/man_arrow-" + guyImageNum + ".png";
  //marker.setImage(guyImageUrl);
}

function onNewLocation(lat, lng) {
  latlng2 = new GLatLng(lat, lng);
  marker.setLatLng(latlng2);
}

function handleNoFlash(errorCode) {  
	if (errorCode == FLASH_UNAVAILABLE) {   marker.openInfoWindowHtml("<b>Gold Dust Dental Lab</b><br />2242 S. McClintock Ste 1<br />Tempe, AZ 85282");    return;  }
}  

google.load("maps", "2.x");
	//]]>

