StreetView={};StreetView.initialize=function(a){this.map=a;this.svClient=new google.maps.StreetViewService();this.streetview=this.createStreetViewPanorama();this.map.setStreetView(this.streetview);this.streetViewContainer=document.getElementById("streetview_canvas");google.maps.event.addListener(this.streetview,"visible_changed",EventBinder.bind(this,this.onVisibilityChanged));this.hideView()};StreetView.onVisibilityChanged=function(){if(this.streetview.getVisible()==true){$(this.streetViewContainer).show()}else{$(this.streetViewContainer).hide()}};StreetView.onStreetViewContainerResized=function(){google.maps.event.trigger(this.streetview,"resize")};StreetView.showStreetView=function(d,c,b){this.pointTowards=c;var a=100;this.svClient.getPanoramaByLocation(d,a,function(f,e){StreetView.onPanoramaLocated.call(StreetView,f,e,c,b)})};StreetView.showView=function(){this.streetview.setVisible(true)};StreetView.hideView=function(){this.streetview.setVisible(false)};StreetView.onPanoramaLocated=function(c,a,f,d){var e;if(a!=google.maps.StreetViewStatus.OK){if(d==null){this.hideView();return}else{e=d}}else{e=c.location.latLng}if(this.streetview.getVisible()==false){this.showView()}var b=this.getBearing(e,f);this.streetview.setPosition(e);this.streetview.setPov({zoom:0,pitch:0,heading:b})};StreetView.getBearing=function(e,d){var h=e.lat()*Math.PI/180;var g=d.lat()*Math.PI/180;var f=(d.lng()-e.lng())*Math.PI/180;var i=Math.sin(f)*Math.cos(g);var c=Math.cos(h)*Math.sin(g)-Math.sin(h)*Math.cos(g)*Math.cos(f);return((Math.atan2(i,c)*180/Math.PI)+360)%360};StreetView.createStreetViewPanorama=function(){var b=document.getElementById("streetview_canvas");b.parentNode.removeChild(b);document.getElementById("map_canvas").appendChild(b);var a={enableCloseButton:true};return new google.maps.StreetViewPanorama(document.getElementById("streetview_canvas"),a)};
