var map,tx,ty,crossm,distmks=[],distlines=null,mapjob,rdiv,ispano,ux,uy,uzoom,showinfo,panoLayer;function ForDight(a,c){return a=Math.round(a*Math.pow(10,c))/Math.pow(10,c)}function getArgs(){for(var a={},c=location.search.substring(1).split("&"),d=0;d<c.length;d++){var e=c[d].indexOf("=");if(-1!=e){var f=c[d].substring(0,e),e=c[d].substring(e+1);a[f]=decodeURIComponent(e)}}return a}
function getWindowHeight(){return window.self&&self.innerHeight?self.innerHeight:document.documentElement&&document.documentElement.clientHeight?document.documentElement.clientHeight:0}function mapresize(){th=getWindowHeight()-130;document.getElementById("map").style.height=th+"px"}function makeurl(a){var c=Math.round(1E5*tx)/1E5,d=Math.round(1E5*ty)/1E5;return a+"?x="+c+"&y="+d+"&zoom="+map.getZoom()}
function getmapurl(){var a=makeurl("http://map.earthol.com/"),c=encodeURIComponent("Google Earth Online"),d=encodeURIComponent(a);map.openInfoWindowHtml(map.getCenter(),'<div style="width:333px; word-break:break-all;"><strong>\u901a\u8fc7\u94fe\u63a5\u5206\u4eab\u5f53\u524d\u4f4d\u7f6e\u5730\u56fe\uff1a<br /><a href="'+a+'">'+a+'</a><br /><br />\u8bf7\u590d\u5236\u4e0a\u9762\u7684\u94fe\u63a5\uff0c\u5206\u4eab\u7ed9\u670b\u53cb\u6216\u81ea\u884c\u6536\u85cf\u3002\u4e5f\u53ef\u4ee5\u76f4\u63a5\u5206\u4eab\u5230\uff1a<a href="'+
("http://www.jiathis.com/send/?webid=tsina&url="+d+"&title="+c+"&uid=97625")+'" target="_blank"><img src="http://img.earthol.net/1/tsina.jpg" alt="\u65b0\u6d6a\u5fae\u535a" border="0" /></a> <a href="'+("http://www.jiathis.com/send/?webid=qzone&url="+d+"&title="+c+"&uid=97625")+'" target="_blank"><img src="http://img.earthol.net/1/qzone.jpg" alt="QQ\u7a7a\u95f4" border="0" /></a> <a href="'+("http://www.jiathis.com/send/?webid=renren&url="+d+"&title="+c+"&uid=97625")+'" target="_blank"><img src="http://img.earthol.net/1/renren.jpg" alt="\u4eba\u4eba\u7f51" border="0" /></a> <a href="'+
("http://www.jiathis.com/send/?webid=kaixin001&url="+d+"&title="+c+"&uid=97625")+'" target="_blank"><img src="http://img.earthol.net/1/kaixin.gif" alt="\u5f00\u5fc3\u7f51" border="0" /></a> <a href="'+("http://www.jiathis.com/send/?webid=tqq&url="+d+"&title="+c+"&uid=97625")+'" target="_blank"><img src="http://img.earthol.net/1/tqq.jpg" alt="\u817e\u8baf\u5fae\u535a" border="0" /></a> <a href="'+("http://www.jiathis.com/send/?webid=douban&url="+d+"&title="+c+"&uid=97625")+'" target="_blank"><img src="http://img.earthol.net/1/douban.gif" alt="\u8c46\u74e3\u7f51" border="0" /></a> <a href="'+
("http://www.jiathis.com/send/?webid=baidu&url="+d+"&title="+c+"&uid=97625")+'" target="_blank"><img src="http://img.earthol.net/1/baidu.gif" alt="\u767e\u5ea6\u641c\u85cf" border="0" /></a><br /><br />\u5982\u679c\u60a8\u60f3\u751f\u6210\u5e26\u6587\u5b57\u4ecb\u7ecd\u7684\u5730\u56fe\u7f51\u9875\uff0c\u8bf7<a href="javascript:void(0)" onclick="return gotoeolme()">\u70b9\u6b64\u5236\u4f5c</a></strong></div>')}
function addfav(){var a=makeurl("http://map.earthol.com/");window.external.AddFavorite(a,"\u6211\u6536\u85cf\u7684\u536b\u661f\u5730\u56fe")}function gotowide(){var a=makeurl("http://wide.earthol.com/");top.location=a}function flyto(a,c,d,e){0<e?map.setCenter(new GLatLng(c,a),e):map.setCenter(new GLatLng(c,a));map.openInfoWindowHtml(map.getCenter(),d)}function gotoxy(){var a=document.xyform.x.value,c=document.xyform.y.value;flyto(a,c,"\u7ecf\u5ea6\uff1a"+a+"<br /><br />\u7eac\u5ea6\uff1a"+c,14)}
function gotove(){var a=makeurl("http://ve.earthol.com/");top.location=a}function goto3d(){var a=makeurl("http://3d.earthol.com/");top.location=a}function gotoeolme(){var a=makeurl("http://a.earthol.me/share.php");top.location=a}
function showmore(){map.openInfoWindowHtml(map.getCenter(),'<div class="mapctrl" style="width:300px;"><center><b>\u5176\u4ed6\u64cd\u4f5c\u9009\u9879</b></center><br />>><a href="javascript:void(0)" onclick="return gotowide()" title="\u5207\u6362\u5230\u5bbd\u5c4f\u5730\u56fe\u6a21\u5f0f\u6d4f\u89c8\u5f53\u524d\u5750\u6807\u4f4d\u7f6e">\u5207\u6362\u5230\u5bbd\u5c4f\u89c6\u56fe\u6a21\u5f0f</a><br />>><a href="http://www.ditu6.com/" target="_blank" title="\u5bfc\u822a\u5730\u56fe">\u884c\u8f66/\u5f92\u6b65\u8def\u7ebf-\u5bfc\u822a\u5730\u56fe\u67e5\u8be2</a><br />>><a href="http://www.earthol.org/" target="_blank" title="\u5730\u7403\u5728\u7ebf\u7f51\u53cb\u5708">\u770b\u770b\u54ea\u4e9b\u7f51\u53cb\u4f4f\u5728\u6211\u9644\u8fd1</a><br /></div>')}
window.onresize=function(){mapresize()};if(top.location!=self.location)top.location=self.location;
function drawdist(){distlines&&(map.removeOverlay(distlines),distlines=null);if(1<distmks.length){for(var a=[],c=0,d=0;d<distmks.length;d++){var e=distmks[d].getPoint();a.push(e);0<d&&(b=distmks[d-1].getPoint(),e=distab(b.lng(),b.lat(),e.lng(),e.lat()),c+=e)}distlines=new GPolyline(a);map.addOverlay(distlines);a="";a=1E3<c?"\u5f53\u524d\u957f\u5ea6:"+ForDight(c/1E3,3)+"\u516c\u91cc":"\u5f53\u524d\u957f\u5ea6:"+ForDight(c,0)+"\u7c73";cjout(a)}else 1==distmks.length&&cjout("\u8bf7\u9009\u62e9\u7ed3\u675f\u70b9")}
function distab(a,c,d,e){c=c*Math.PI/180;e=e*Math.PI/180;a=a*Math.PI/180-d*Math.PI/180;a=2*Math.asin(Math.sqrt(Math.pow(Math.sin((c-e)/2),2)+Math.cos(c)*Math.cos(e)*Math.pow(Math.sin(a/2),2)));return a=Math.round(6378137E4*a)/1E4}
function ceju(a){if("distance"==mapjob){distlines&&(map.removeOverlay(distlines),distlines=null);for(var c=distmks.length-1;0<=c;c--)map.removeOverlay(distmks[c]);distmks=[];1!=a?(cjout("",1),mapjob=""):cjout("\u8bf7\u9009\u62e9\u8d77\u59cb\u70b9")}else map.openInfoWindowHtml(map.getCenter(),'<div style="width:339px; word-break:break-all;">\u6d4b\u8ddd\u6a21\u5f0f\u5df2\u5f00\u542f-\u8bf7\u70b9\u51fb\u8d77\u59cb\u70b9\u5f00\u59cb\u6d4b\u8ddd<br /><br />\u652f\u6301\u4e24\u70b9\u6216\u591a\u70b9\u95f4\u7684\u6d4b\u8ddd\uff0c\u6d4b\u91cf\u7ed3\u679c\u663e\u793a\u5728\u5730\u56fe\u7684\u53f3\u4e0b\u89d2\u3002<br />\u60a8\u53ef\u4ee5\u968f\u610f\u62d6\u52a8\u5730\u56fe\u4e0a\u7684\u6d4b\u91cf\u70b9\uff0c\u4fee\u6b63\u540e\u7684\u8ddd\u79bb\u4f1a\u81ea\u52a8\u7ed9\u51fa\u3002</div><br />'),
cjout("\u8bf7\u9009\u62e9\u8d77\u59cb\u70b9"),mapjob="distance"}function mapclick(a,c){if("distance"==mapjob&&null!=c){var d=new GMarker(c,{draggable:!0});distmks.push(d);map.addOverlay(d);GEvent.addListener(d,"dragend",function(){drawdist()});drawdist()}}
function cjout(a,c){if(map){if(null==rdiv)rdiv=document.createElement("div"),rdiv.style.position="absolute",map.getContainer().appendChild(rdiv);rdiv.innerHTML=1!=c?'<span class="distance">'+a+'<br /><a href="javascript:void(0)" onclick="return ceju(1)" title="\u6e05\u9664\u6240\u6709\u6807\u8bb0\uff0c\u8ddd\u79bb\u5f52\u96f6">\u91cd\u7f6e\u5f52\u96f6</a> <a href="javascript:void(0)" onclick="return ceju()" title="\u9000\u51fa\u6d4b\u8ddd\u6a21\u5f0f">\u7ed3\u675f\u6d4b\u8ddd</a></span>':a;rdiv.style.left=
map.getSize().width-160+"px";rdiv.style.top=map.getSize().height-100+"px"}}function showpano(){var a=document.getElementById("spbtn");if(1==ispano){if(map.removeOverlay(panoLayer),ispano=0,a)a.innerHTML="\u663e\u793a\u5b9e\u666f\u7167\u7247"}else if(map.addOverlay(panoLayer),ispano=1,a)a.innerHTML="\u9690\u85cf\u5b9e\u666f\u7167\u7247"}var args=getArgs();args.x&&args.y&&args.zoom?(ux=parseFloat(args.x),uy=parseFloat(args.y),uzoom=parseInt(args.zoom)):(ux=109.77539,uy=33.43144,uzoom=4,showinfo=1);
function showaddr(){var a=map.getCenter();geocoder.getLocations(a,getAddr)}
function getAddr(a){if(!a||200!=a.Status.code)alert("\u6ca1\u6709\u627e\u5230\u6b64\u4f4d\u7f6e\u7684\u5730\u5740\u4fe1\u606f\uff01");else{a=a.Placemark[0];new GLatLng(a.Point.coordinates[1],a.Point.coordinates[0]);var c=" ",d=map.getCenter();if("CN"==a.AddressDetails.Country.CountryNameCode)var c=d.lng()+0.005,e=d.lat(),c='<b>\u5c0f\u63d0\u793a\uff1a\u5982\u679c\u60a8\u60f3\u67e5\u770b\u6b64\u4f4d\u7f6e\u7684\u8be6\u7ec6\u8857\u9053\u5730\u56fe\uff0c<a href="http://china.earthol.com/?x='+c+"&y="+
e+'&z=15&t=s" target="_blank">\u8bf7\u70b9\u6b64\u5207\u6362\u5230\u201c\u4e2d\u56fd\u5927\u9646\u7248\u5730\u56fe\u201d</a>\uff0c\u60a8\u5c06\u83b7\u5f97\u66f4\u597d\u7684\u6d4f\u89c8\u6548\u679c\u3002</b>';map.openInfoWindowHtml(d,'<div style="width:300px;">\u5f53\u524d\u5730\u56fe\u6240\u5728\u4f4d\u7f6e\u7684\u5730\u5740\u4e3a\uff1a<br /><div class="addrinfo">'+a.address+"<br /></div><br />"+c+"</div>")}}
function getxy(){var a=map.getCenter();tx=a.lng();ty=a.lat();var c="\u7ecf\u5ea6:"+tx+"<br />\u7eac\u5ea6:"+ty+"<br />";document.getElementById("xy").innerHTML=c;crossm.setLatLng(a)}
function load(){if(GBrowserIsCompatible()){mapresize();map=new GMap2(document.getElementById("map"));map.addControl(new GLargeMapControl);map.addControl(new GMapTypeControl);map.addControl(new GScaleControl);panoLayer=new GLayer("com.panoramio.all");geocoder=new GClientGeocoder;geocoder.setBaseCountryCode("CN");var a=new GLatLng(uy,ux);map.setCenter(a,uzoom,G_HYBRID_MAP);1==showinfo&&map.openInfoWindowHtml(map.getCenter(),'<div style="width:300px;"><center>\u6b22\u8fce\u5149\u4e34\u201c\u5730\u7403\u5728\u7ebf\u201d\u3002</center><br />\u60a8\u53ef\u4ee5\u4f7f\u7528\u201c\u5730\u6807\u641c\u7d22\u201d\u529f\u80fd\u6765\u67e5\u627e\u60a8\u60f3\u770b\u7684\u5730\u70b9\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8f93\u5165\u7ecf\u7eac\u5ea6\u6765\u5230\u8fbe\u4e16\u754c\u4e0a\u7684\u4efb\u4f55\u5730\u70b9\u3002<br /><br /></div>');
var c=new GIcon;c.image="http://www.earthol.com/cross.png";c.iconSize=new GSize(24,24);c.iconAnchor=new GPoint(10,20);c.infoWindowAnchor=new GPoint(10,10);markerOptions={icon:c};crossm=new GMarker(a,markerOptions);map.addOverlay(crossm);GEvent.addListener(map,"click",function(a,c){mapclick(a,c)});GEvent.addListener(map,"move",function(){getxy()});getxy()}};

