var geocoder,map,distmks=[],distlines=null,mapjob,rdiv,ux,uy,uz,uzoom,showinfo,tx,ty,crossm;if(top.location!=self.location)top.location=self.location;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"}window.onresize=function(){mapresize()};
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://wide.earthol.com/"),c=encodeURIComponent("Google Earth Online"),d=encodeURIComponent(a);openInfo('<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 gotoeolme(){var a=makeurl("http://a.earthol.me/share.php");top.location=a}
function gotove(){var a=makeurl("http://ve.earthol.com/");top.location=a}function makechinaurl(a){var c=Math.round(1E5*tx)/1E5,d=Math.round(1E5*ty)/1E5;return a+"?x="+c+"&y="+d+"&z="+map.getZoom()}function totop(){window.scrollTo(0,0)}function flyto(a,c,d,e){0<e?map.setCenter(new google.maps.LatLng(c,a),e):map.setCenter(new google.maps.LatLng(c,a));openInfo(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,12);totop()}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}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 openInfo(a){var c=map.getCenter();(new google.maps.InfoWindow({position:c,content:a})).open(map)}
function showaddr(){var a=map.getCenter();geocoder.geocode({latLng:a},function(a,d){d==google.maps.GeocoderStatus.OK?a[0]?openInfo('<div style="width:300px;">\u5f53\u524d\u5730\u56fe\u6240\u5728\u4f4d\u7f6e\u7684\u5730\u5740\u4e3a\uff1a<br /><div class="addrinfo">'+a[0].formatted_address+"<br /></div></div>"):alert("\u6ca1\u6709\u627e\u5230\u6b64\u4f4d\u7f6e\u7684\u5730\u5740\u4fe1\u606f\u3002"):alert("\u51fa\u9519\u5566\uff0c\u9519\u8bef\u4ee3\u7801\uff1a"+d)})}
function gothere(a){geocoder.geocode({address:a},function(a,d){d==google.maps.GeocoderStatus.OK?(map.setCenter(a[0].geometry.location),map.setZoom(13),openInfo(a[0].formatted_address)):alert("\u6ca1\u6709\u627e\u5230\uff0c\u8bf7\u8c03\u6574\u5173\u952e\u5b57\u540e\u91cd\u65b0\u641c\u7d22\u3002")})}function ForDight(a,c){return a=Math.round(a*Math.pow(10,c))/Math.pow(10,c)}
function drawdist(){distlines&&(distlines.setMap(null),distlines=null);if(1<distmks.length){for(var a=[],c=0,d=0;d<distmks.length;d++){var e=distmks[d].getPosition();a.push(e);0<d&&(b=distmks[d-1].getPosition(),e=distab(b.lng(),b.lat(),e.lng(),e.lat()),c+=e)}distlines=new google.maps.Polyline({path:a,strokeColor:"#FF0000",strokeOpacity:1,strokeWeight:2});distlines.setMap(map);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&&(distlines.setMap(null),distlines=null);for(var c=distmks.length-1;0<=c;c--)distmks[c].setMap(null);distmks=[];1!=a?(cjout("",1),mapjob=""):cjout("\u8bf7\u9009\u62e9\u8d77\u59cb\u70b9")}else openInfo('<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\u5de6\u4e0a\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){"distance"==mapjob&&null!=a&&(a=new google.maps.Marker({position:a,map:map,draggable:!0}),distmks.push(a),google.maps.event.addListener(a,"dragend",function(){drawdist()}),drawdist())}
function cjout(a,c){if(map){if(null==rdiv)rdiv=document.createElement("div"),rdiv.style.position="absolute",map.getDiv().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=
"150px";rdiv.style.top="30px"}}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.setPosition(a)}
function load(){mapresize();geocoder=new google.maps.Geocoder;var a=new google.maps.LatLng(uy,ux),c={zoom:uzoom,center:a,scrollwheel:!1,mapTypeId:google.maps.MapTypeId.HYBRID};map=new google.maps.Map(document.getElementById("map"),c);crossm=new google.maps.Marker({position:a,map:map,icon:"http://www.earthol.com/cross.png"});google.maps.event.addListener(map,"click",function(a){mapclick(a.latLng)});google.maps.event.addListener(map,"center_changed",function(){getxy()});1==showinfo&&openInfo('<center>\u6b22\u8fce\u5149\u4e34\u201c\u5730\u7403\u5728\u7ebf\u201d\uff0c\u5f53\u524d\u4e3a\u5bbd\u5c4f\u6a21\u5f0f\u3002<br /><br />\u60a8\u4e5f\u53ef\u4ee5<a href="http://www.earthol.com/">\u70b9\u51fb\u8fd9\u91cc</a>\u8fd4\u56de\u201c\u5730\u7403\u5728\u7ebf\u201d\u9996\u9875\u3002<br />');
getxy()};

