google.load("maps", "2.x");
 var map;
 var myPano;
 var panoClient;
 var myPOV = null;
 var currentYaw = 0;
 var currentPitch = 0;
 var timer;
 var marker;
 function initialize() { panoClient = new GStreetviewClient();
 var latlng = new GLatLng(35.725977030410164, 139.71155762672424);
 map = new GMap2(document.getElementById("map"), {draggableCursor: 'crosshair'});
 map.setCenter(latlng, 15);
 map.addMapType(G_PHYSICAL_MAP);
 map.addControl(new GHierarchicalMapTypeControl());
 map.addControl(new GSmallMapControl());
 myPano = new GStreetviewPanorama(document.getElementById("streetview"));
 myPano.setLocationAndPOV(latlng, {yaw: 250.00, pitch: -20.00});
 GEvent.addListener(map, "click", function(overlay,latlng) {
   panoClient.getNearestPanorama(latlng, showPanoData);
 });
 GEvent.addListener(myPano, "initialized", move);
 GEvent.addListener(myPano, "yawchanged", onYawChange);
 panoClient.getNearestPanorama(latlng, showPanoData);
// svOverlay = new GStreetviewOverlay();
// map.addOverlay(svOverlay);
 }
 function showPanoData(panoData) {
   if (panoData.code == 600) {
     alert('ストリートビュー未対応地域です');
   } else {
     var html = "<p><strong>"+panoData.location.description+"<\/strong><br/>"+panoData.location.latlng+"<\/p>";
     map.setCenter(panoData.location.latlng);
     map.openInfoWindowHtml(panoData.location.latlng, html);
     myPano.setLocationAndPOV(panoData.location.latlng, myPOV);
   }
 } 
 function move(panoData) {
   var html = "<p><strong>"+panoData.description+"<\/strong><br/>"+panoData.latlng+"<\/p>";
   map.setCenter(panoData.latlng);
   map.openInfoWindowHtml(panoData.latlng, html);
   poslat = String(panoData.lat);
   poslng = String(panoData.lng);
 }
 function onYawChange(newYaw) {
   if (newYaw < 0) {
     newYaw += 360;
   }
   var pov = myPano.getPOV();
   yawangle = pov.yaw.toFixed(0);
   pitchangle = pov.pitch.toFixed(0);
   zoomvalue = pov.zoom;
 }
 function animate0() { myPano.followLink(0);}
 function animatestart0() {
   clearInterval(timer);
   timer = window.setInterval(animate0, 2000);
 }
 function animate180() {
   myPano.followLink(180);
 }
 function animatestart180() {
   clearInterval(timer);
   timer = window.setInterval(animate180, 2000);
 }
 function rotate() {
   currentYaw += 2;
   myPano.panTo({yaw:currentYaw, pitch:currentPitch});
 }
 function rotatestart() {
   clearInterval(timer);
   timer = window.setInterval(rotate, 200);
 }
 function animatestop() {
   clearInterval(timer);
 } 
 google.setOnLoadCallback(initialize);