/* last modified 2008-10-15 16:05:00*/
function ZoomInOperation(a)
{
this.base=MapOperation;
this.base();
var _a=a;
this.selectTool=function()
{
var a=_a;
a.selectTool("DRAWRECT",this);
a.setCursor("toolicons/tool02.cur","拖动放大");
};
this.mapWindowCallback=function(a,b)
{
var c=_a;
var d=c.map.zoomLevel;
var e=c.map.spec.numZoomLevels;
if(d<e-1)
{
var f=[],g=[];
var m,n;
for(var i=0;i<b.length;i++)
{
m=c.map.divToBitmapCoordinate(b[i].x,b[i].y);
f.push(m);
n=c.map.spec.getLatLng(m.x,m.y,d);
g.push(n)
}
var bds=new Bounds();
bds.minX=Math.min(g[0].x,g[1].x);
bds.minY=Math.min(g[0].y,g[1].y);
bds.maxX=Math.max(g[0].x,g[1].x);
bds.maxY=Math.max(g[0].y,g[1].y);
var p=c.map.spec.getMeterPerPixel(d);
if((bds.maxX-bds.minX)<10*p.x&&(bds.maxY-bds.minY)<10*p.y)
{
c.map.centerAndZoom(new Point(bds.minX,bds.minY),d+1)
}
else
{
var w=c.map.viewSize.width;
var h=c.map.viewSize.height;
var bw=bds.maxX-bds.minX;
var bh=bds.maxY-bds.minY;
var cx=(bds.maxX+bds.minX)/2;
var cy=(bds.maxY+bds.minY)/2;
var z=c.map.spec.getLowestZoomLevel(new Scope(bw,bh),w,h);
c.map.centerAndZoom(new Point(cx,cy),z);
if(d==c.map.zoomLevel)
{
c.map.zoomTo(d+1)
}
}
c.smoothZoomEffect("IN")
}
else
{
Event.trigger(this,"zoomoverflow",a,b)
}
var fd=new FeatureDesc();
fd.setFeatureDescAsCoordType(g,"LL");
fd.setLinkType("CLOSE");
Event.trigger(this,"mapwindowcallback",fd);
Event.trigger(this,"drawend",a,b)
};
this.mapResultCallback=function(a){};
}

function ZoomOutOperation(a)
{
this.base=MapOperation;
this.base();
var _a=a;
this.selectTool=function()
{
var a=_a;
a.selectTool("DRAWRECT",this);
a.setCursor("toolicons/tool03.cur","拖动缩小")
};
this.mapWindowCallback=function(a,b)
{
var c=_a;
var d=c.map.zoomLevel;
var e=c.map.spec.numZoomLevels;
if(d>0)
{
var f=[],g=[];
var m,n;
for(var i=0;i<b.length;i++)
{
m=c.map.divToBitmapCoordinate(b[i].x,b[i].y);
f.push(m);
n=c.map.spec.getLatLng(m.x,m.y,d);
g.push(n)
}
var bds=new Bounds();
bds.minX=Math.min(g[0].x,g[1].x);
bds.minY=Math.min(g[0].y,g[1].y);
bds.maxX=Math.max(g[0].x,g[1].x);
bds.maxY=Math.max(g[0].y,g[1].y);
if((bds.maxX-bds.minX)<10E-6&&(bds.maxY-bds.minY)<10E-6)
{
c.map.centerAndZoom(new Point(bds.minX,bds.minY),d-1)
}
else
{
var cx=(bds.maxX+bds.minX)/2;
var cy=(bds.maxY+bds.minY)/2;
c.map.centerAndZoom(new Point(cx,cy),d-1);
}
c.smoothZoomEffect("OUT");
}
else
{
Event.trigger(this,"zoomoverflow",a,b)
}
var fd=new FeatureDesc();
fd.setFeatureDescAsCoordType(g,"LL");
fd.setLinkType("CLOSE");
Event.trigger(this,"mapwindowcallback",fd);
Event.trigger(this,"drawend",a,b)
};
this.mapResultCallback=function(a){};
}

function SaveMapOperation(a,b,c)
{
this.base=MapOperation;
this.base();
var _b=a;
var _a="map.SaveMap";
this.engine=b;
this.appId=c;
this.submit=function(a,b,c,d)
{
try
{
var dataEntity=createDataEntityDom(),fs=_b.map.features,ds=[],ps=[],ls=[],rs=[],f=_b.getHbState();
if(!d)d=!f[0]?"1":(f[1]?"3":"2");
for(var i=0;i<fs.length;i++)
{
if(!_b.getBounds().isIntersect(fs[i].bounds)) continue;
if(fs[i].xml.getElementsByTagName("Feature").length==0)
{
fs[i].objectToXML();
}
switch(fs[i].type)
{
case "S":ps.push(fs[i]);break;
case "L":ls.push(fs[i]);break;
case "R":rs.push(fs[i]);break;
}
}
ds=rs.concat(ls,ps);
for(var i=0;i<ds.length;i++)
{
dataEntity.appendChild(ds[i].xml.cloneNode(true));
}
var v,xy,z,u=this.appId;
v=new SaveMapVariant();
v.setAPPID(!u?_b.getAppId():u);
xy=v.centerXY=_b.getCenterX()+","+_b.getCenterY();
z=v.mpLevel=_b.map.spec.mpLevels[_b.getLevelIndex()].id;
v.imageType=(!a?"GIF":a);
v.imageWidth=_b.getMapWidth();
v.imageHeight=_b.getMapHeight();
v.responseType=(!b?"JS":b);
v.mapType=(!d?"1":d)
var dte=dataEntity.xml;
dte=dte.replace(/>\s*?</g,"><");
dte=dte.replace(/[&]/g,"_amp_");
v.data=dte;
if(c!=null) v.saveState=c;
var mq=new MapRequest(_a, v);
_b.submit(mq, this,false,this.engine,null,null,"post");
}
catch(e)
{
e.description=this.getClassName()+".submitSave()::"+e.description;
Log.write(e.description);
}
};
this.mapWindowCallback=function( a,b ){};
this.mapResultCallback=function(a)
{
try
{
var b=a.getResult("ImageURL");
if(b!="")
{
Event.trigger(this,"imageurl",b)
}
Event.trigger(this,"mapresultcallback",a)
}
catch(e)
{
e.description=this.getClassName()+".mapResultCallback()::"+e.description;
Log.write(e.description);
}
};
function createDataEntityDom()
{
var c=''+'<?xml version="1.0" encoding="GB2312"?>'+'<Data xmlns:v="urn:schemas-microsoft-com:vml">'+'</Data>';
var d=_getDomFromString(c);
var e=d.selectSingleNode("Data");
return e;
};
}
function SaveMapVariant()
{
var t=this,a="MUST_BE_VALIDATED";
t.base=WmspVariant;
t.base();
t.centerXY=a;
t.mpLevel=a;
t.imageType=a;
t.imageWidth=a;
t.imageHeight=a;
t.responseType=a;
t.data=a;
t.mapType=a;
t.saveState="OPTIONAL";
}


function smShowCutImage(c)
{
_m.map.closeInfoWindow();
var id="DSM",a=G.saveMapDialog,b,d,e,f,g;
if(!a){
a=new Dialog(id,662,416,300,100);
sz(a.div,9000);
ap(a.title,ct("截图"));
b=ci();
b.className="savemap_ifm";
ap(a.body,b);
a.ifm=b;
G.saveMapDialog=a;
}
a.ifm.src=G.path+"savemap.html?src="+c;
a.show();
}	




function ViewSearch(a,c,d)	//(container,mapclient,mapsearch)
{
var t=this,e,f;
t.m=c;
t.q=d;
t.s=1;
t.ds=[];
t.div=e=cc("VS");
ap(a,e);
t.openSdw=f=cc("openSdw");
ap(e,f);	
t.openPnl=f=cc("openPnl");
ap(e,f);	
t.openBtn=f=ce("img");
f.id="openBtn";
f.src=G.path+"images/pixel.gif";
f.alt=f.title="在当前视野内搜索";
f.className="openBtn1";
f.onclick=function(){t.showMenu()};
ap(e,f);
}
ViewSearch.prototype.init=function()
{
var t=this,e=t.div,f,g,m,v=t.min={};	
t.maxDlg=f=new Dialog("MAX",217,390,-148,21,e);
ap(f.title,ct("在当前视野内查看："));
t.minDlg=f=new Dialog("MIN",217,25,-148,21,e);
v.title=g=cd("span");
g.className="mintitle";
f.titleBar.onclick=function(){t.showMenu()};
ap(f.title,g);
v.key=g=cd("span");
g.className="key";
ap(f.title,g);
m=t.list=ci();
m.className="maxifm";
m.src=G.path+"eye.html";
ap(t.maxDlg.body,m);
t.altDlg=new Dialog("ALT",217,100,-148,21,e);	
ap(t.altDlg.title,ct("在当前视野内查看："));
m=ci();
m.className="altifm";
m.src=G.path+"vsinfo.html";
ap(t.altDlg.body,m);
t.close();
Event.addListener(t.maxDlg,"close",t.eventHandler("close"));
Event.addListener(t.minDlg,"close",t.eventHandler("close"));
Event.addListener(t.altDlg,"close",t.eventHandler("close"));
Event.addListener(t.q,"dom",t.eventHandler("drawResult"));
Event.addListener(t.m,"clearall",t.eventHandler("close"));
Event.addListener(t.m.map,"moveend",t.eventHandler("mapChange"));
Event.addListener(t.m.map,"zoom",t.eventHandler("mapChange"));	
};
ViewSearch.prototype.showMenu=function()
{
var t=this,l;
if(!t.maxDlg)t.init();
l = t.m.getLevelIndex();
if(l>12)
{
window.clearTimeout(t.delay);	
t.minDlg.close(1);	
t.maxDlg.show();				
t.s=2;		
}
else{
t.clear();
t.altDlg.show();
}
d1(t.openSdw);
d1(t.openPnl);
};

ViewSearch.prototype.query=function(a)
{
var t=this;
window.clearTimeout(t.delay);
t.key=a;
t.s=3;	//1按钮;2完整;3缩略
t.min.key.innerHTML=a;
t.delay=t.setTimeout(t.submit,800,a);
};
ViewSearch.prototype.submit=function(a)
{
this.q.eyeshotTypeSubmit(a,'','30,1','','','','','','0','36');
this.minMenu();
};
ViewSearch.prototype.close=function()
{
var t=this;
if(!t.maxDlg) return;
t.pause=false;
t.s=1;
window.clearTimeout(t.delay);
t.clear();
t.maxDlg.close(1);
t.minDlg.close(1);
t.altDlg.close(1);
d0(t.openSdw);
d0(t.openPnl);	
};
ViewSearch.prototype.clear=function()
{
var t=this,b=t.ds,i;	
if(!b) return;
while(b.length>0)
{
i=b.length-1;
if(b[i].element) t.m.map.removeFeature(b[i]);
b.pop()
}
};
ViewSearch.prototype.drawResult=function(a)
{
if(!a) return;
var t=this,c=gt(a,"Feature"),d=t.min;
t.s=3;
t.minMenu();
d.title.innerHTML=(!c?"当前视野内无":"正在查看")+"：";
lf(d.key,!c?100:70);
};
ViewSearch.prototype.minMenu=function()
{
var t=this;
t.maxDlg.close(1);
t.minDlg.show();
d1(t.openSdw);
d1(t.openPnl);
};
ViewSearch.prototype.mapChange=function()
{
var t=this;
if(t.m.getLevelIndex()<13){
if(t.s!=1){
t.close();
if(t.delay){
t.pause=true;
window.clearTimeout(t.delay);
}
t.altDlg.show();
d1(t.openSdw);
d1(t.openPnl);
}
}else{

if(t.s==3){
t.query(t.key);
}
if(t.altDlg.isShow()){
t.altDlg.close(1);
d0(t.openSdw);
d0(t.openPnl);
if(t.pause){
t.query(t.key);
}else{
t.showMenu();
}

}
}
};


function PanBone(a,b){
if(!a)	return;
var bc=a,_this=this,mh,sliding,bcc=bc.map.container,bot=bc.map.container.offsetTop,bol=bc.map.container.offsetLeft,add=Event.addBuiltInListener,ofw=(bcc.offsetHeight-bcc.clientHeight)/2,ofw=ofw?ofw:0,bpot=bc.map.container.offsetParent.offsetTop,level=18,num=8,sw;
if(typeof b=="object"){mh=b.ms?true:false;sliding=b.sliding?true:false;};
lg=function(a){var a=a?a:"";Event.trigger(_this,"panbone",a);};
this.ce=function(o,p){var el=document.createElement(o.tag||'div');var useSet=el.setAttribute?true:false; for(var attr in o){if(attr=="tag"||attr=="children"||attr=="cn"||attr=="html"||attr=="style"||typeof o[attr]=="function") continue;if(attr=="cls"){el.className = o["cls"];}else{if(useSet) el.setAttribute(attr,o[attr]);else el[attr] = o[attr];}}if(o.html){el.innerHTML=o.html;}if(p){p.appendChild(el);}return el;}
this.swMH=function(a,b){if(sw&&sw==a)	return;var cls1,cls2,hy;if(a.id=="$boneMap"){cls1="BoneMap1";cls2="BoneHbd2";hy=false;}else if(a.id=="$boneHybird"){cls1="BoneHbd1";cls2="BoneMap2";hy=true;}a.className=cls1;b.className=cls2;bc.setHyBird(hy);sw=a;cls1=cls2=hy=null;}
this.setEvent=function(a){if(a.setCapture)a.setCapture();if(window.captureEvents)window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);}
this.releaseEvent=function(a){if(a.releaseCapture)a.releaseCapture();if(window.releaseEvents)window.releaseEvents(Event.MOUSEMOVE|Event.MOUSEUP);}
this.isIE=document.all?true:false;
this.getMC=function(e){return _this.isIE?e.clientY+Math.max(document.body.scrollTop,document.documentElement.scrollTop):e.pageY;}
var cre=this.ce;var sc=cre({cls:"Bone"},bcc);
if(mh){var mp=cre({id:"$boneMap",cls:"BoneMap1"},sc);var hb=cre({id:"$boneHybird",cls:"BoneHbd2"},sc);mp.onclick=function(a){_this.swMH(this,hb);};hb.onclick=function(a){_this.swMH(this,mp);};}var n=cre({cls:"BoneN"},sc);var w=cre({cls:"BoneW"},sc);var r=cre({cls:"BoneR"},sc);var e=cre({cls:"BoneE"},sc);var s=cre({cls:"BoneS"},sc);var o=cre({cls:"BoneOut"},sc);if(sliding)var st=cre({cls:"BoneSt"},sc);var i=cre({cls:"BoneIn"},sc);if(sliding){var sl=cre({cls:"BoneSl"},sc);var p=cre({cls:"BonePop2"},sc);}cre=null;
add(n,"click",function(i){bc.map.pan(0,Math.floor(bc.getMapHeight()*0.5));_stopEvent(i);lg("BoneUP");});add(w,"click",function(i){bc.map.pan(Math.floor(bc.getMapWidth()*0.5),0);_stopEvent(i);lg("BoneLEFT");});add(r,"click",function(i){bc.resetMap();_stopEvent(i);lg("BoneReset");});add(e,"click",function(i){bc.map.pan(-Math.floor(bc.getMapWidth()*0.5),0);_stopEvent(i);lg("BoneRIGHT");});add(s,"click",function(i){bc.map.pan(0,Math.floor(-bc.getMapHeight()*0.5));_stopEvent(i);lg("BoneDOWN");});add(o,"click",function(i){var l=bc.getSds().getMplevels();var _top=(bc.getLevelIndex()+1);if(_top<l.length){bc.animateZoomTo(_top);};_stopEvent(i);lg("BoneZOOMOUT");});add(i,"click",function(i){var _top=(bc.getLevelIndex()-1);if(_top>=0){bc.animateZoomTo(_top);};_stopEvent(i);lg("BoneZOOMIN")});
if(sliding){
var x,y,ox,oyt,oyb;
var isDrag=false;
var zb=parseInt(sl.offsetHeight/2+1);
var ovf=_this.isIE?7:5
sl.onmousedown=function(a){
sl.style.position="absolute";
bot=bc.map.container.offsetTop;
bol=bc.map.container.offsetLeft;
bpot=bc.map.container.offsetParent.offsetTop;
isDrag=true;
var d=document;if(!a)a=window.event;
y=a.layerY?a.layerY:a.offsetY;
oyt=st.offsetTop+ofw;
oyb=oyt+st.offsetHeight-sl.offsetHeight;
_this.setEvent(sl);
var zl;
d.onmousemove=function(a){
if(!isDrag)	return;
if(!a)a=window.event;
var mus=_this.getMC(a);
if(!a.pageY)a.pageY=mus;
var ty=a.pageY-y-bot-ofw-bpot-ovf;
if(ty>oyt&&ty<oyb){sl.style.top=ty+"px";zl=(sl.offsetTop-st.offsetTop);}
}
d.onmouseup=function(a){
isDrag=false;
_this.releaseEvent(sl);
sl.onmousemove=null;
sl.onmouseup=null;
d.onselectstart=null;
if(zl){
zl=zl
zl=Math.abs(parseInt(zl/num)-level);
_this.adjustZOOM(zl);
}
x=y=oyt=oyb=zl=za=null
}
d.onselectstart=function(){return false;}
}
st.onclick=function(a){
if(!a)a=window.event;
var py=a.layerY?a.layerY:a.offsetY;
if(!_this.isIE)	py=py-st.offsetTop
py=Math.abs(parseInt(py/num)-level);
_this.adjustZOOM(py);
py=null;
}
st.onmousemove=function(a){
p.style.position="absolute";
if(!a)a=window.event;
var mus=_this.getMC(a);
bpot=bc.map.container.offsetParent.offsetTop;
if(!a.pageY)a.pageY=mus;
var py=a.layerY?a.layerY:a.offsetY;
if(!_this.isIE)	py=py-st.offsetTop
py=Math.abs(parseInt(py/num)-level);
_this.adjustPOP(py);
py=null;
}
st.onmouseout=function(a){p.style.display="none";}
}
this.adjustPOP=function(a,b){
var szHtm="";
var zpop=false;
var tmp=Math.abs(a-level);
var za=(tmp+1)*num;
switch (a){case 17:{szHtm="街";zpop=true;break;}case 14:{szHtm="区";zpop=true;break;}case 11:{szHtm="市";zpop=true;break;}case 8:{szHtm="省";zpop=true;break;}default:{szHtm="";zpop=false;break;}}
if(zpop){p.innerHTML=szHtm;p.style.display="block";p.style.top=(za-zb+st.offsetTop-(p.offsetHeight/2)-2)+"px";}
else{p.style.display="none";}
}
this.adjustSL=function(a){try{var tmp=Math.abs(a-level);var za=(tmp+1)*num;sl.style.top=(za-zb+st.offsetTop)+"px";return a;}catch(e){}}
this.adjustZOOM=function(a){bc.map.zoomTo(parseInt(a));}
this.setHybird=function(a){_this.swMH(hb,mp);}
if(sliding){this.adjustSL(bc.getLevelIndex());Event.addListener(bc,"sdschange",function(a){_this.adjustSL(bc.getLevelIndex());});Event.addListener(bc.map,"zoom",function(a,b){_this.adjustSL(bc.getLevelIndex());});}
}

function RulerOperation(a)
{
this.base=MapOperation;
this.base();
var _a=a,_lastNode;
this.lines=[];
this.selectTool=function()
{
var c=_a,g=[],h=[],m,n,i,k=0,l=new ConvertorLLndMC(),o=this.lines,q,t=this,last=null;
c.selectTool("DRAWPOLYLINE",this);
c.setCursor("toolicons/tool07.cur","单击确定路径，双击结束");
this.addNodeEvent=Event.addListener(c.map.r,"addnode",function(a,b)
{
var u=Global.uniqueId(),v,w,p,d=b[b.length-1],e,f;
e=b.length>1?b[b.length-2]:null;
if(isNaN(d.x)||isNaN(d.y)||(e&&d.x==e.x&&d.y==e.y)) return;
m=c.map.divToBitmapCoordinate(d.x,d.y);
n=c.map.spec.getLatLng(m.x,m.y,c.map.zoomLevel);
g.push(n);
h.push(n);
_lastNode=n;
if(h.length>=2)
{
v=g.length;
for(i=0;i<v-1;i++)
{
k+=l.distanceByMC(g[i],g[i+1])
}
w=l.distanceByMC(g[v-2],g[v-1])
k=Math.round(k);
w=Math.round(w);
q=k>1000?k/1000+"公里":k+"米";
w=w>1000?w/1000+"公里":w+"米";
o.push(c.map.addLine(h,"此段长:"+w,"ruler_l_"+u,"L28",{"on":"true","style":"Label01"}));
p=c.map.addPoint(n.x,n.y,q,"ruler_p_"+u,"S890",{"on":"true","style":"F_24"});
t.distance=k;
h.shift(),k=0;
if(last) {last.element.label.style.visibility="hidden";last.label.on="false"}
if(e&&e.x>d.x)
{
f=p.element.label.texts[0];
f.style.left=(-8-f.offsetWidth)+"px";
}
last=p;
}
else c.map.addPoint(n.x,n.y,"测距起点","ruler_p0_"+u,"S1015",{"on":"false","style":"F_24"});
c.map.r.reDraw([b[b.length-1]]);
});
this.zoomEvent=Event.addListener(a.map,"zoom",function(a,b)
{
var c=_a,d,e;
if(_lastNode)
{
d=c.map.spec.q(_lastNode.y,_lastNode.x,c.map.zoomLevel);
e=c.map.ad(d.x,d.y);
c.map.r.reDraw([e]);
}
});
Event.addListener(a,"clearall",function()
{
c.map.r.reset();
t.destroy();
_a.selectTool("PAN");
});
Event.addListener(a,"selecttool",function()
{
t.destroy();
});
};
this.mapWindowCallback=function(a,b)
{
Event.trigger(this,"ruleresult",this.distance);
this.destroy();
_a.selectTool("PAN");
};
this.destroy=function()
{
if(this.addNodeEvent)Event.removeListener(this.addNodeEvent);
if(this.zoomEvent)Event.removeListener(this.zoomEvent);
this.addNodeEvent=this.zoomEvent=_lastNode=null;
};
this.mapResultCallback=function(a){};
}
function DrapPoint(a)
{
var t=this,m;
t.m=a;
t.f=null;
t.cf=null;
m=t.m.map;
Event.addListener(a.map,"leftdown",t.eventHandler("onLeftDown"));
Event.addBuiltInListener(m.div,"mousemove",t.eventHandler("onMouseMove"));
Event.addBuiltInListener(m.div,"mouseup",t.eventHandler("onMouseUp"));
}
DrapPoint.prototype.onMouseMove=function(a)
{
var t=this,m=t.m.map,c;
if(!a) a=event;
if(t.offset&&t.cf)
{
c=_getRelativeClickPoint(a,m.div);
if(t.cf.element) {t.cf.element.setPosition(c.x-t.offset.x,c.y-t.offset.y);Event.trigger(t,"moving")}
}
};
DrapPoint.prototype.onMouseUp=function(a)
{
var t=this,m=t.m.map,c;
if(!a) a=event;
if(t.offset&&t.f)
{
d=(new Date()).getTime();
if(d-t.stime<500&&(Math.abs(t.spos.x-a.clientX)<=2&&Math.abs(t.spos.y-a.clientY)<=2))
{
Event.trigger(m,"click",t.f)
}
else
{
c=t.f;
c.points[0]=m.getMcXYBySC(a);		
if(c.element)
{
m.setSymbolPosition(c.element,c);
m.setLabelPosition(c);
}
Event.trigger(t,"moveend",c);
Event.trigger(c,"moveend",a)
}
}
if(t.cf) m.removeFeature(t.cf);
t.offset=t.f=t.cf=null;	
};
DrapPoint.prototype.onLeftDown=function(a,b)
{
var t=this,m=t.m.map,c,d,e;
if(a&&a.type=="S"&&a.isMovable)
{
e="DP_"+a.id.replace(/^DP_/g,"");
if(t.cf&&t.cf.id!=e) m.removeFeature(t.cf);		
if(!t.m.getFeatureById(e)) 
{
t.offset=_getRelativeClickPoint(b,a.element.mouseTarget);
t.f=a;	
d=t.cf=a.clone();
d.id=e;
m.addFeature(d);
t.stime=(new Date()).getTime();
t.spos={x:b.clientX,y:b.clientY};
}
m.closeInfoWindow();
_stopEvent(b);
}
};


function SwitchMap(a,b)
{
	var d,e,f,g,h,l,m,n,o=a.getHbState(),p,q,s,t=this;
	t.isBhlb=(o[0]&&!o[1]?0:1);
	function v(w){e.className=w?"s2":"s1";if(w)d1(f);else d0(f)};
	d=cc("SwtM");
	ap(b,d);
	e=cc("s1");
	ap(d,e);
	f=cc("map");
	ap(d,f);
	f.onclick=function(){a.setHyBrid(false);v(0);d0(h);d0(s)	};
	g=cc("hyb");
	ap(d,g);
	g.onclick=function(){a.setHyBrid(true,t.isBhlb);v(1);k()};
	g.onmouseover=function(){k()};
	g.onmouseout=function(){l=window.setTimeout(function(){d0(h);d0(s)},1000)};	
	s=cc("sdw");
	ap(d,s);
	h=cc("dlg");
	ap(d,h);
	h.onmouseover=function(){window.clearTimeout(l);k()};
	h.onmouseout=function(){d0(h);d0(s)};
	m=cc("ckb");
	ap(h,m);
	p=ce("input");
	p.type="checkbox";
	p.id="HbCkb";
	p.onclick=function(){t.isBhlb=this.checked;a.setHyBrid(true,t.isBhlb)};
	ap(m,p);
	q=ce("span");
	q.innerHTML='<label for="HbCkb">显示路网和地标</label>';
	ap(m,q);
	m=cc("tlt");
	m.innerHTML="已提供卫星照片的城市有";	
	ap(h,m);
	d0(h);d0(s);
	v(o[0]);
	function k()
	{
		if(e.className!="s2")return;
		d1(h);d1(s)	;
		p.checked=t.isBhlb;
		if(!n)
		{
			n=ci();		
			n.className="lst";
			n.src=G.path+"hybrid.html";		
			ap(h,n);
		}
	};
	t.change=function(b){v(b);a.setHyBrid(b,b&&t.isBhlb)};
}

function shHotCity(a){try{if (G.hotc){for(var i=0;i<G.hotc.length;i++){var e=G.hotc[i].element;if(!a){if(e.isVisible()) e.hide();}else{e.show();}}}}catch(ex){}}
function initHotCity(){function b(a,b,c,d){G.hotc.push(_m.map.addPoint(a,b,'',a+"_"+b,'S184',{"on":"false"},{"href":"javascript:_m.coordRecenterTo("+a+","+b+","+c+");"},true))}b(12956000,4824875,10,'北京');b(13522000,3641093.75,11,'上海');b(13046000,4714250,12,'天津');b(11862218.75,3426000,12,'重庆');b(13375156.25,3519531.25,12,'杭州');b(11585750,3567500,12,'成都');b(13280515.6250001,2990656.25,13,'福州');b(12531718.75,4533781.25,12,'太原');b(12127500,4039281.25,12,'西安');b(12652718.75,4105531.25,12,'郑州');b(14099375,5708406,12,'哈尔滨');b(12614437.50,2631281.25,12,'广州');b(12722500,3556031.25,12,'武汉');b(13738500,5102500,12,'沈阳');b(13950281.25,5417750,12,'长春');b(13222250,3747750,12,'南京');b(13022000,4366781.25,12,'济南');b(11434031.25,2863156.25,13,'昆明');b(12577125,3257937.5,11,'长沙');b(12431000,4957250,12,'呼和浩特');b(12744531.25,4559750,12,'石家庄');b(11829718.75,4620062.5,12,'银川');b(11554484,4283500,13,'兰州');b(12903718,3314062,12,'南昌');b(11330796,4360375,13,'西宁');b(12283250,2263125,12,'海口');b(9752750,5404250,12,'乌鲁木齐');b(11878812,3051656,13,'贵阳');	b(13055906,3722562,12,'合肥');b(12057250,2594500,11,'南宁');b(10144281,3439781,12,'拉萨');b(13529031,2864218,13,'台湾');b(12711875,2527218,12,'香港');b(12640828,2517687,13,'澳门');var l=_m.getLevelIndex();if(l>8||l<4)shHotCity(false);}

var bone,ruler,zoomin,zoomout,savemap,dp,cm,vsc,cmback,swm;
swm=new SwitchMap(_m,_el("maparea"));
zoomin=new ZoomInOperation(_m);
zoomout=new ZoomOutOperation(_m);
dp=new DrapPoint(_m);
savemap=new SaveMapOperation(_m,G.savemapengine,"2004");
Event.addListener(savemap,"imageurl",smShowCutImage);
bone=new PanBone(_m,{sliding:_getParameter("bone")=="1"});
//vsc=new ViewSearch(_el("maparea"),_m,ls);
ruler=new RulerOperation(_m);
initHotCity();

_el("tools").innerHTML='<span onclick="_m.selectTool(\'PAN\')">漫游</span> | <span onclick="zoomin.selectTool()">拉框放大</span> | <span onclick="zoomout.selectTool()">拉框缩小</span> | <span onclick="ruler.selectTool()">测距</span> | <span onclick="userTip.selectTool()">标临时点</span> | <span onclick="_m.clearAll()">清空</span>';
if(_getParameter("bar")=="0"){d0(_el("tools"))}
