function uAutoMove(MapPT,sMapBase)
{cpt=MapPT;var TimeMove=function()
{var centerX=sMapBase.getCenterX();var centerY=sMapBase.getCenterY();if(sMapBase.FromMapDistX(Math.abs(centerX-cpt.X))<5&&sMapBase.FromMapDistY(Math.abs(centerY-cpt.Y))<5)
{sMapBase.MoveMapTo(cpt.X,cpt.Y);sMapBase.RefreshMap(true,true);PoiLayer.style.top=0;PoiLayer.style.left=0
CreateTrafficPoi();SELayer.style.top=0;SELayer.style.left=0;CreateSEPoi();tFunc=null;}
else
{sMapBase.MoveMapTo((centerX+cpt.X)/2,(centerY+cpt.Y)/2);sMapBase.RefreshMap(true,true);tFunc=setTimeout(TimeMove,100);}}
TimeMove();}
function BEyeView(oMapBase,eImgWidth,eImgHeight,mapwidth,mapheight,dicScale,eyeopen)
{var movedir=0;var timeoutMapAutoMove;var m_scrollspeed=10;eveDiv=document.createElement("div");eveDiv.id='divBEyeView';eveDiv.style.position="absolute";eveDiv.style.right=0;eveDiv.style.bottom=0;eveDiv.style.backgroundColor='white';eveDiv.style.borderColor='white';eveDiv.style.width=mapwidth;eveDiv.style.height=mapheight;eveDiv.style.border="inset 1px";eveDiv.zIndex=99999;document.body.appendChild(eveDiv);mapDiv=document.createElement("div");mapDiv.id='mapdiv';mapDiv.style.position="absolute";mapDiv.style.right=0;mapDiv.style.bottom=0;mapDiv.style.width=mapwidth-10;mapDiv.style.height=mapheight-10;mapDiv.style.border="solid 1px";mapDiv.style.borderColor="#797979";mapDiv.zIndex=9999;eveDiv.appendChild(mapDiv);document.body.onresize=function()
{oMapBase.RefreshMap(true,true);SetCuboidSize(oMapBase.ToMapPoint(0,0),oMapBase.ToMapPoint(oMapBase.getClientWidth(),oMapBase.getClientHeight()));}
eMapBase=new MapBase(mapdiv,0,0,parseInt(mapDiv.style.width)-parseInt(mapDiv.style.borderWidth)*2,parseInt(mapDiv.style.height)-parseInt(mapDiv.style.borderWidth)*2,eImgWidth,eImgHeight,1);eMapBase.putMapLevel(4);eMapBase.RefreshMap(true,true);if(MapMove&&MapMove.InitialMapBase)
{MapMove.InitialMapBase(eMapBase);}
eMapBase.SelectMapTool(new MapMove);var hObj=eMapBase.getHPackage();var MouseCurX;var MouseCurY;m_hObj=hObj.ownerDocument.createElement("div");hObj.appendChild(m_hObj);m_hObj.style.position="absolute";m_hObj.style.overflow="hidden";m_hObj.style.width=40;m_hObj.style.height=40;m_hObj.style.left=15;m_hObj.style.top=15;m_hObj.style.border="inset 2px blue";c_hObj=m_hObj.ownerDocument.createElement("div");m_hObj.appendChild(c_hObj);c_hObj.style.filter='Alpha(Opacity=15)';c_hObj.style.backgroundColor='blue';c_hObj.style.width='100%';c_hObj.style.height='100%';eMapBase.AddElement(m_hObj);EyeAreaToCenter();var pMouseMove=FuncAdapter(this,function(tEvent)
{var ox=tEvent.screenX-MouseCurX;var oy=tEvent.screenY-MouseCurY;MouseCurX=tEvent.screenX;MouseCurY=tEvent.screenY;var tX=parseInt(m_hObj.style.left)+ox;var tY=parseInt(m_hObj.style.top)+oy;m_hObj.style.left=tX;m_hObj.style.top=tY;outMapAutoMove();});AttachEvent(m_hObj,"mousedown",FuncAdapter(this,function(tEvent)
{MouseCurX=tEvent.screenX;MouseCurY=tEvent.screenY;AttachEvent(m_hObj,"mousemove",pMouseMove,true);}),false);AttachEvent(m_hObj,"mouseup",FuncAdapter(this,function(tEvent)
{try
{clearInterval(timeoutMapAutoMove);}
catch(E)
{}
eMapBase.RefreshMap(true,true);DetachEvent(m_hObj,"mousemove",pMouseMove,true);eAutoMove(eMapBase.ToMapPoint(parseInt(m_hObj.style.left)+(parseInt(m_hObj.style.width)/2),parseInt(m_hObj.style.top)+(parseInt(m_hObj.style.height)/2)));}),false);this.CenterX=function(){return eMapBase.getCenterX();}
this.CenterY=function(){return eMapBase.getCenterY();}
this.CenterXY=function(){return new MapPoint(eMapBase.getCenterX(),eMapBase.getCenterY());}
this.SelectAreaHide=function(){m_hObj.style.visibility="hidden";}
this.SelectAreaShow=function(){m_hObj.style.visibility="visible";}
this.ScrollSpeed=function(spd){m_scrollspeed=spd;}
function EyeAreaToCenter()
{var cx=eMapBase.getClientWidth()/2
var cy=eMapBase.getClientHeight()/2
m_hObj.style.left=cx-(parseInt(m_hObj.style.width)/2);m_hObj.style.top=cy-(parseInt(m_hObj.style.height)/2);}
this.MoveMapTo=function(cx,cy)
{mpt=new MapPoint(cx,cy);mAutoMove(mpt,eMapBase);}
this.MapTo=function(cx,cy)
{eMapBase.MoveMapTo(cx,cy);eMapBase.RefreshMap(true,true);}
this.BothMapTo=function(cx,cy)
{eMapBase.MoveMapTo(cx,cy);eMapBase.RefreshMap(true,true);oMapBase.MoveMapTo(cx,cy);oMapBase.RefreshMap(true,true);}
this.SetCuboidSize=function(coor,coor1,HideOut)
{loc=eMapBase.FromMapPoint(coor.X,coor.Y);loc1=eMapBase.FromMapPoint(coor1.X,coor1.Y);if(HideOut)
{if(loc.X>0&&loc.Y>0)
{m_hObj.style.visibility="visible"
m_hObj.style.left=loc.X;m_hObj.style.top=loc.Y;m_hObj.style.width=Math.abs(loc1.X-Math.abs(loc.X));m_hObj.style.height=Math.abs(loc1.Y-Math.abs(loc.Y));}
else
{m_hObj.style.visibility="hidden";}}
else
{}}
this.CurrentScale=function()
{return eMapBase.getMapLevel();}
this.EyeScale=function(lv)
{var e_Scale=lv-dicScale;if(e_Scale<=0)
{e_Scale=1;}
if(e_Scale!=eMapBase.getMapLevel())
{eMapBase.putMapLevel(e_Scale);eMapBase.RefreshMap(true,true);}}
this.MapMoveToEyeArea=function(dx,dy,w,h)
{var pw=eMapBase.getClientWidth()/w;var ph=eMapBase.getClientHeight()/h;m_hObj.style.top=parseInt(m_hObj.style.top)-((ph*dy)*0.0001);window.status=(pw*dx)*0.0008+','+(ph*dy)*0.0008;}
ObjDBMap=document.createElement("img");ObjDBMap.id='eyeimg';ObjDBMap.style.position="absolute";ObjDBMap.src='images/eyeclose.gif';ObjDBMap.style.right=0;ObjDBMap.style.bottom=0;ObjDBMap.alt='';if(eyeopen)
{ObjDBMap.alt='Close';ObjDBMap.src='images/eyeclose.gif';eveDiv.style.bottom=0;eveDiv.style.right=0;}
else
{ObjDBMap.alt='Open';ObjDBMap.src='images/eyeopen.gif';eveDiv.style.bottom=0-parseInt(eveDiv.style.height);eveDiv.style.right=0-parseInt(eveDiv.style.width);}
ObjDBMap.onclick=function()
{eveDiv=document.getElementById('divBEyeView');ObjDBMap=document.getElementById('eyeimg');var eyeopen;if(ObjDBMap.alt=='Open')
{ObjDBMap.alt='Close';ObjDBMap.src='images/eyeclose.gif';eveDivOpen();}
else
{ObjDBMap.alt='Open';ObjDBMap.src='images/eyeopen.gif';eveDivClose();}
function eveDivOpen()
{divbottom=parseInt(eveDiv.style.bottom);divright=parseInt(eveDiv.style.right);divwidth=parseInt(eveDiv.style.width);divheight=parseInt(eveDiv.style.height);function imove()
{if(Math.abs(divheight)<5)
{eveDiv.style.bottom=0;eveDiv.style.right=0;}
else
{divheight=divheight/2;divwidth=divwidth/2;eveDiv.style.bottom=0-divheight;eveDiv.style.right=0-divwidth;tMove=setTimeout(imove,50);}}
imove();}
function eveDivClose()
{divwidth=parseInt(eveDiv.style.width);divheight=parseInt(eveDiv.style.height);divwidth2=parseInt(eveDiv.style.width);divheight2=parseInt(eveDiv.style.height);function imove()
{if(Math.abs(divheight)<5)
{eveDiv.style.bottom=0-divheight2;eveDiv.style.right=0-divwidth2;}
else
{divheight=divheight/2;divwidth=divwidth/2;eveDiv.style.bottom=parseInt(eveDiv.style.bottom)+(0-divheight);eveDiv.style.right=parseInt(eveDiv.style.right)+(0-divwidth);tMove=setTimeout(imove,50);}}
imove();}}
document.body.appendChild(ObjDBMap);function SetCuboidSize(coor,coor1)
{loc=eMapBase.FromMapPoint(coor.X,coor.Y);loc1=eMapBase.FromMapPoint(coor1.X,coor1.Y);if(loc.X>0&&loc.Y>0)
{m_hObj.style.visibility="visible";m_hObj.style.left=loc.X;m_hObj.style.top=loc.Y;m_hObj.style.width=loc1.X-loc.X;m_hObj.style.height=loc1.Y-loc.Y;}
else
{m_hObj.style.visibility="hidden";}}
function eAutoMove(MapPT)
{cpt=MapPT;var eTimeMove=function()
{var centerX=eMapBase.getCenterX();var centerY=eMapBase.getCenterY();if(eMapBase.FromMapDistX(Math.abs(centerX-cpt.X))<5&&eMapBase.FromMapDistY(Math.abs(centerY-cpt.Y))<5)
{eMapBase.MoveMapTo(cpt.X,cpt.Y);m_hObjP=eMapBase.FromMapPoint(cpt.X,cpt.Y);m_hObj.style.left=m_hObjP.X-(parseInt(m_hObj.style.width)/2);m_hObj.style.top=m_hObjP.Y-(parseInt(m_hObj.style.height)/2);gMapBase.RefreshMap(true,true);eMapBase.RefreshMap(true,true);tFunc=null;}
else
{eMapBase.MoveMapTo((centerX+cpt.X)/2,(centerY+cpt.Y)/2);m_hObjP=eMapBase.FromMapPoint(cpt.X,cpt.Y);m_hObj.style.left=m_hObjP.X-(parseInt(m_hObj.style.width)/2);m_hObj.style.top=m_hObjP.Y-(parseInt(m_hObj.style.height)/2);eMapBase.RefreshMap(true,true);tFunc=setTimeout(eTimeMove,100);}}
var TimeMove=function()
{var centerX=gMapBase.getCenterX();var centerY=gMapBase.getCenterY();if(gMapBase.FromMapDistX(Math.abs(centerX-cpt.X))<5&&gMapBase.FromMapDistY(Math.abs(centerY-cpt.Y))<5)
{gMapBase.MoveMapTo(cpt.X,cpt.Y);gMapBase.RefreshMap(true,true);tFunc=null;}
else
{gMapBase.MoveMapTo((centerX+cpt.X)/2,(centerY+cpt.Y)/2);gMapBase.RefreshMap(true,true);tFunc=setTimeout(TimeMove,100);}}
TimeMove();eTimeMove();}
function mAutoMove(MapPT,sMapBase)
{cpt=MapPT;var TimeMove=function()
{var centerX=sMapBase.getCenterX();var centerY=sMapBase.getCenterY();if(sMapBase.FromMapDistX(Math.abs(centerX-cpt.X))<5&&sMapBase.FromMapDistY(Math.abs(centerY-cpt.Y))<5)
{sMapBase.MoveMapTo(cpt.X,cpt.Y);m_hObjP=eMapBase.FromMapPoint(cpt.X,cpt.Y);m_hObj.style.left=m_hObjP.X-(parseInt(m_hObj.style.width)/2);m_hObj.style.top=m_hObjP.Y-(parseInt(m_hObj.style.height)/2);sMapBase.RefreshMap(true,true);tFunc=null;}
else
{sMapBase.MoveMapTo((centerX+cpt.X)/2,(centerY+cpt.Y)/2);m_hObjP=eMapBase.FromMapPoint(cpt.X,cpt.Y);m_hObj.style.left=m_hObjP.X-(parseInt(m_hObj.style.width)/2);m_hObj.style.top=m_hObjP.Y-(parseInt(m_hObj.style.height)/2);sMapBase.RefreshMap(true,true);tFunc=setTimeout(TimeMove,100);}}
TimeMove();}
function uAutoMove(MapPT,sMapBase)
{cpt=MapPT;var TimeMove=function()
{var centerX=sMapBase.getCenterX();var centerY=sMapBase.getCenterY();if(sMapBase.FromMapDistX(Math.abs(centerX-cpt.X))<5&&sMapBase.FromMapDistY(Math.abs(centerY-cpt.Y))<5)
{sMapBase.MoveMapTo(cpt.X,cpt.Y);sMapBase.RefreshMap(true,true);tFunc=null;}
else
{sMapBase.MoveMapTo((centerX+cpt.X)/2,(centerY+cpt.Y)/2);sMapBase.RefreshMap(true,true);tFunc=setTimeout(TimeMove,100);}}
TimeMove();}
function outMapAutoMove()
{var m_movedir=0;var cv=new objarea(mapDiv);var ch=new Cuboid(m_hObj);if(ch.top>0&&ch.left>0&&ch.bottom<cv.height&&ch.right<cv.width)
{m_movedir=0;}
else if(ch.top<0&&ch.left>0&&ch.bottom<cv.height&&ch.right<cv.width)
{m_movedir=1;}
else if(ch.top<0&&ch.left>0&&ch.bottom<cv.height&&ch.right>cv.width)
{m_movedir=2;}
else if(ch.top>0&&ch.left>0&&ch.bottom<cv.height&&ch.right>cv.width)
{m_movedir=3;}
else if(ch.top>0&&ch.left>0&&ch.bottom>cv.height&&ch.right>cv.width)
{m_movedir=4;}
else if(ch.top>0&&ch.left>0&&ch.bottom>cv.height&&ch.right<cv.width)
{m_movedir=5;}
else if(ch.top>0&&ch.left<0&&ch.bottom>cv.height&&ch.right<cv.width)
{m_movedir=6;}
else if(ch.top>0&&ch.left<0&&ch.bottom<cv.height&&ch.right<cv.width)
{m_movedir=7;}
else if(ch.top<0&&ch.left<0&&ch.bottom<cv.height&&ch.right<cv.width)
{m_movedir=8;}
var TimeMove=function()
{var centerX=eMapBase.getCenterX();var centerY=eMapBase.getCenterY();var mx=0;var my=0;switch(movedir)
{case 1:mx=centerX;my=centerY-((eMapBase.getCenterY()-eMapBase.ToMapPoint(0,0).Y)/m_scrollspeed);break;case 2:mx=centerX+((centerX-eMapBase.ToMapPoint(0,0).X)/m_scrollspeed);my=centerY-((centerY-eMapBase.ToMapPoint(0,0).Y)/m_scrollspeed);break;case 3:mx=centerX+((centerX-eMapBase.ToMapPoint(0,0).X)/m_scrollspeed);my=centerY
break;case 4:mx=centerX+((centerX-eMapBase.ToMapPoint(0,0).X)/m_scrollspeed);my=centerY+((centerY-eMapBase.ToMapPoint(0,0).Y)/m_scrollspeed);break;case 5:mx=centerX;my=centerY+((eMapBase.getCenterY()-eMapBase.ToMapPoint(0,0).Y)/m_scrollspeed);break;case 6:mx=centerX-((centerX-eMapBase.ToMapPoint(0,0).X)/m_scrollspeed);my=centerY+((centerY-eMapBase.ToMapPoint(0,0).Y)/m_scrollspeed);break;case 7:mx=centerX-((centerX-eMapBase.ToMapPoint(0,0).X)/m_scrollspeed);my=centerY;break;case 8:mx=centerX-((centerX-eMapBase.ToMapPoint(0,0).X)/m_scrollspeed);my=centerY-((centerY-eMapBase.ToMapPoint(0,0).Y)/m_scrollspeed);break;}
eMapBase.MoveMapTo(mx,my);eMapBase.RefreshMap(true,true);}
if(m_movedir!=movedir)
{clearInterval(timeoutMapAutoMove);movedir=m_movedir;timeoutMapAutoMove=null;if(movedir!=0)
{timeoutMapAutoMove=setInterval(TimeMove,100);}}}
function objarea(obj)
{this.top=parseInt(obj.style.top);this.left=parseInt(obj.style.left);this.bottom=parseInt(obj.style.bottom);this.right=parseInt(obj.style.right);this.height=parseInt(obj.style.height);this.width=parseInt(obj.style.width);}
function Cuboid(obj)
{this.top=parseInt(obj.style.top);this.left=parseInt(obj.style.left);this.bottom=parseInt(obj.style.top)+parseInt(obj.style.height);this.right=parseInt(obj.style.left)+parseInt(obj.style.width);this.height=parseInt(obj.style.height);this.width=parseInt(obj.style.width);}}
