var krpanoplugin=function(){function mapkey_setter(a){webmapkey=a}function mapkey_getter(){return webmapkey}function bemarked_setter(){return!1}function bemarked_getter(){return bemarked}function setcenter(a,b){MapisReady&&(ActivePosition=new BMap.Point(a,b),webmap.panTo(ActivePosition)),krpano.trace(1,a+";"+b)}function addmarker(a,b,c,d){if(MapisReady){var a=new BMap.Marker(new BMap.Point(b,c));a.enableMassClear=!0,webmap.addOverlay(a),a.addEventListener("click",function(){krpano.call(d)}),bemarked=!0}krpano.trace(1,a+";"+b+";"+c+";"+bemarked)}function clearoverlays(){MapisReady&&webmap.clearOverlays(),krpano.trace(1,"clearOverlays OK!")}function addallmarker(){var request=new XMLHttpRequest,jsonurl=getLocalBaseDir();jsonurl+="scene/SceneList_Gps.json",krpano.trace(1,jsonurl),request.open("GET",jsonurl),request.onreadystatechange=function(){var jsondata,i,lng,lat,strclickevent;if(krpano.trace(1,request.status),4==request.readyState&&200==request.status){jsondata=eval(request.responseText);for(i in jsondata)lng=jsondata[i].gps_lon,lat=jsondata[i].gps_lat,strclickevent="VRM_LoadScene("+jsondata[i].group+"/"+jsondata[i].name+")",""!=lng&&addmarker(jsondata[i].name,lng,lat,strclickevent)}},request.send(null)}function getLocalBaseDir(){var a=window.location,b=a.pathname.split("/")[1],c=a.protocol+"//"+a.host+"/"+b;return c}var loadScript,local=this,krpano=null,plugin=null,pluginpath=null,plugincanvas=null,plugincanvascontext=null,ActivePosition=null,MapisReady=!1,webmapkey="",bemarked=!1;initialize=function(){webmap=new BMap.Map("webmapdiv"),webmap.centerAndZoom(new BMap.Point(116.404,39.915),12),webmap.addControl(new BMap.NavigationControl({anchor:BMAP_ANCHOR_TOP_RIGHT})),MapisReady=!0},loadScript=function(){var a=document.createElement("script");a.src="http://api.map.baidu.com/api?v=2.0&ak="+webmapkey+"&callback=initialize",document.body.appendChild(a)},local.registerplugin=function(a,b,c){krpano=a,plugin=c,pluginpath=b,plugin.registerattribute("webmapkey","",mapkey_setter,mapkey_getter),plugin.registerattribute("bemarked","",bemarked_setter,bemarked_getter),plugin.setcenter=setcenter,plugin.clearoverlays=clearoverlays,plugin.addmarker=addmarker,plugin.addallmarker=addallmarker;var d=!0;d&&(plugin.registercontentsize(258,258),plugincanvas=document.createElement("div"),plugincanvas.id="webmapdiv",plugincanvas.width=258,plugincanvas.height=258,plugincanvas.style.width="100%",plugincanvas.style.height="100%",plugincanvas.onselectstart=function(){return!1},plugin.sprite.appendChild(plugincanvas),webmapkey=krpano.get("webmapkey"),krpano.trace(1,webmapkey),loadScript())},local.unloadplugin=function(){plugin=null,krpano=null},local.hittest=function(a,b){return plugincanvascontext?plugincanvascontext.isPointInPath(a,b):!1},local.onresize=function(){return!1}};