var jg_ok,jg_ie,jg_fast,jg_dom,jg_moz;
function chkDHTM(x,i){
x=document.body||null;
jg_ie=x&&typeof x.insertAdjacentHTML!="undefined"&&document.createElement;
jg_dom=(x&&!jg_ie&&typeof x.appendChild!="undefined"&&typeof document.createRange!="undefined"&&typeof (i=document.createRange()).setStartBefore!="undefined"&&typeof i.createContextualFragment!="undefined");
jg_fast=jg_ie&&document.all&&!window.opera;
jg_moz=jg_dom&&typeof x.style.MozOpacity!="undefined";
jg_ok=!!(jg_ie||jg_dom);
}
function pntCnvDom(){
var x=this.wnd.document.createRange();
x.setStartBefore(this.cnv());
x=x.createContextualFragment(jg_fast?this.htmRpc():this.htm);
if(this.cnv()){
this.cnv().appendChild(x);
}
this.htm="";
}
function pntCnvIe(){
if(this.cnv()){
this.cnv().insertAdjacentHTML("BeforeEnd",jg_fast?this.htmRpc():this.htm);
}
this.htm="";
}
function pntDoc(){
this.wnd.document.write(jg_fast?this.htmRpc():this.htm);
this.htm="";
}
function pntN(){
}
function mkDiv(x,y,w,h){
this.htm+="<div style=\"position:absolute;"+"left:"+x+"px;"+"top:"+y+"px;"+"width:"+w+"px;"+"height:"+h+"px;"+"clip:rect(0,"+w+"px,"+h+"px,0);"+"background-color:"+this.color+(!jg_moz?";overflow:hidden":"")+";\"></div>";
}
function mkDivIe(x,y,w,h){
this.htm+="%%"+this.color+";"+x+";"+y+";"+w+";"+h+";";
}
function mkDivPrt(x,y,w,h){
this.htm+="<div style=\"position:absolute;"+"border-left:"+w+"px solid "+this.color+";"+"left:"+x+"px;"+"top:"+y+"px;"+"width:0px;"+"height:"+h+"px;"+"clip:rect(0,"+w+"px,"+h+"px,0);"+"background-color:"+this.color+(!jg_moz?";overflow:hidden":"")+";\"></div>";
}
var regex=/%%([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);/g;
function htmRpc(){
return this.htm.replace(regex,"<div style=\"overflow:hidden;position:absolute;background-color:"+"$1;left:$2;top:$3;width:$4;height:$5\"></div>\n");
}
function htmPrtRpc(){
return this.htm.replace(regex,"<div style=\"overflow:hidden;position:absolute;background-color:"+"$1;left:$2;top:$3;width:$4;height:$5;border-left:$4px solid $1\"></div>\n");
}
function mkLin(x1,y1,x2,y2){
if(x1>x2){
var _x2=x2;
var _y2=y2;
x2=x1;
y2=y1;
x1=_x2;
y1=_y2;
}
var dx=x2-x1,dy=Math.abs(y2-y1),x=x1,y=y1,_1a=(y1>y2)?-1:1;
if(dx>=dy){
var pr=dy<<1,pru=pr-(dx<<1),p=pr-dx,ox=x;
while(dx>0){
--dx;
++x;
if(p>0){
this.mkDiv(ox,y,x-ox,1);
y+=_1a;
p+=pru;
ox=x;
}else{
p+=pr;
}
}
this.mkDiv(ox,y,x2-ox+1,1);
}else{
var pr=dx<<1,pru=pr-(dy<<1),p=pr-dy,oy=y;
if(y2<=y1){
while(dy>0){
--dy;
if(p>0){
this.mkDiv(x++,y,1,oy-y+1);
y+=_1a;
p+=pru;
oy=y;
}else{
y+=_1a;
p+=pr;
}
}
this.mkDiv(x2,y2,1,oy-y2+1);
}else{
while(dy>0){
--dy;
y+=_1a;
if(p>0){
this.mkDiv(x++,oy,1,y-oy);
p+=pru;
oy=y;
}else{
p+=pr;
}
}
this.mkDiv(x2,oy,1,y2-oy+1);
}
}
}
function mkLin2D(x1,y1,x2,y2){
if(x1>x2){
var _x2=x2;
var _y2=y2;
x2=x1;
y2=y1;
x1=_x2;
y1=_y2;
}
var dx=x2-x1,dy=Math.abs(y2-y1),x=x1,y=y1,_2a=(y1>y2)?-1:1;
var s=this.stroke;
if(dx>=dy){
if(dx>0&&s-3>0){
var _s=(s*dx*Math.sqrt(1+dy*dy/(dx*dx))-dx-(s>>1)*dy)/dx;
_s=(!(s-4)?Math.ceil(_s):Math.round(_s))+1;
}else{
var _s=s;
}
var ad=Math.ceil(s/2);
var pr=dy<<1,pru=pr-(dx<<1),p=pr-dx,ox=x;
while(dx>0){
--dx;
++x;
if(p>0){
this.mkDiv(ox,y,x-ox+ad,_s);
y+=_2a;
p+=pru;
ox=x;
}else{
p+=pr;
}
}
this.mkDiv(ox,y,x2-ox+ad+1,_s);
}else{
if(s-3>0){
var _s=(s*dy*Math.sqrt(1+dx*dx/(dy*dy))-(s>>1)*dx-dy)/dy;
_s=(!(s-4)?Math.ceil(_s):Math.round(_s))+1;
}else{
var _s=s;
}
var ad=Math.round(s/2);
var pr=dx<<1,pru=pr-(dy<<1),p=pr-dy,oy=y;
if(y2<=y1){
++ad;
while(dy>0){
--dy;
if(p>0){
this.mkDiv(x++,y,_s,oy-y+ad);
y+=_2a;
p+=pru;
oy=y;
}else{
y+=_2a;
p+=pr;
}
}
this.mkDiv(x2,y2,_s,oy-y2+ad);
}else{
while(dy>0){
--dy;
y+=_2a;
if(p>0){
this.mkDiv(x++,oy,_s,y-oy+ad);
p+=pru;
oy=y;
}else{
p+=pr;
}
}
this.mkDiv(x2,oy,_s,y2-oy+ad+1);
}
}
}
function mkOv(_33,top,_35,_36){
var a=(++_35)>>1,b=(++_36)>>1,wod=_35&1,hod=_36&1,cx=_33+a,cy=top+b,x=0,y=b,ox=0,oy=b,aa2=(a*a)<<1,aa4=aa2<<1,bb2=(b*b)<<1,bb4=bb2<<1,st=(aa2>>1)*(1-(b<<1))+bb2,tt=(bb2>>1)-aa2*((b<<1)-1),w,h;
while(y>0){
if(st<0){
st+=bb2*((x<<1)+3);
tt+=bb4*(++x);
}else{
if(tt<0){
st+=bb2*((x<<1)+3)-aa4*(y-1);
tt+=bb4*(++x)-aa2*(((y--)<<1)-3);
w=x-ox;
h=oy-y;
if((w&2)&&(h&2)){
this.mkOvQds(cx,cy,x-2,y+2,1,1,wod,hod);
this.mkOvQds(cx,cy,x-1,y+1,1,1,wod,hod);
}else{
this.mkOvQds(cx,cy,x-1,oy,w,h,wod,hod);
}
ox=x;
oy=y;
}else{
tt-=aa2*((y<<1)-3);
st-=aa4*(--y);
}
}
}
w=a-ox+1;
h=(oy<<1)+hod;
y=cy-oy;
this.mkDiv(cx-a,y,w,h);
this.mkDiv(cx+ox+wod-1,y,w,h);
}
function mkOv2D(_49,top,_4b,_4c){
var s=this.stroke;
_4b+=s+1;
_4c+=s+1;
var a=_4b>>1,b=_4c>>1,wod=_4b&1,hod=_4c&1,cx=_49+a,cy=top+b,x=0,y=b,aa2=(a*a)<<1,aa4=aa2<<1,bb2=(b*b)<<1,bb4=bb2<<1,st=(aa2>>1)*(1-(b<<1))+bb2,tt=(bb2>>1)-aa2*((b<<1)-1);
if(s-4<0&&(!(s-2)||_4b-51>0&&_4c-51>0)){
var ox=0,oy=b,w,h,pxw;
while(y>0){
if(st<0){
st+=bb2*((x<<1)+3);
tt+=bb4*(++x);
}else{
if(tt<0){
st+=bb2*((x<<1)+3)-aa4*(y-1);
tt+=bb4*(++x)-aa2*(((y--)<<1)-3);
w=x-ox;
h=oy-y;
if(w-1){
pxw=w+1+(s&1);
h=s;
}else{
if(h-1){
pxw=s;
h+=1+(s&1);
}else{
pxw=h=s;
}
}
this.mkOvQds(cx,cy,x-1,oy,pxw,h,wod,hod);
ox=x;
oy=y;
}else{
tt-=aa2*((y<<1)-3);
st-=aa4*(--y);
}
}
}
this.mkDiv(cx-a,cy-oy,s,(oy<<1)+hod);
this.mkDiv(cx+a+wod-s,cy-oy,s,(oy<<1)+hod);
}else{
var _a=(_4b-(s<<1))>>1,_b=(_4c-(s<<1))>>1,_x=0,_y=_b,_65=(_a*_a)<<1,_66=_65<<1,_67=(_b*_b)<<1,_68=_67<<1,_st=(_65>>1)*(1-(_b<<1))+_67,_tt=(_67>>1)-_65*((_b<<1)-1),pxl=new Array(),pxt=new Array(),_6d=new Array();
pxl[0]=0;
pxt[0]=b;
_6d[0]=_b-1;
while(y>0){
if(st<0){
pxl[pxl.length]=x;
pxt[pxt.length]=y;
st+=bb2*((x<<1)+3);
tt+=bb4*(++x);
}else{
if(tt<0){
pxl[pxl.length]=x;
st+=bb2*((x<<1)+3)-aa4*(y-1);
tt+=bb4*(++x)-aa2*(((y--)<<1)-3);
pxt[pxt.length]=y;
}else{
tt-=aa2*((y<<1)-3);
st-=aa4*(--y);
}
}
if(_y>0){
if(_st<0){
_st+=_67*((_x<<1)+3);
_tt+=_68*(++_x);
_6d[_6d.length]=_y-1;
}else{
if(_tt<0){
_st+=_67*((_x<<1)+3)-_66*(_y-1);
_tt+=_68*(++_x)-_65*(((_y--)<<1)-3);
_6d[_6d.length]=_y-1;
}else{
_tt-=_65*((_y<<1)-3);
_st-=_66*(--_y);
_6d[_6d.length-1]--;
}
}
}
}
var ox=-wod,oy=b,_oy=_6d[0],l=pxl.length,w,h;
for(var i=0;i<l;i++){
if(typeof _6d[i]!="undefined"){
if(_6d[i]<_oy||pxt[i]<oy){
x=pxl[i];
this.mkOvQds(cx,cy,x,oy,x-ox,oy-_oy,wod,hod);
ox=x;
oy=pxt[i];
_oy=_6d[i];
}
}else{
x=pxl[i];
this.mkDiv(cx-x,cy-oy,1,(oy<<1)+hod);
this.mkDiv(cx+ox+wod,cy-oy,1,(oy<<1)+hod);
ox=x;
oy=pxt[i];
}
}
this.mkDiv(cx-a,cy-oy,1,(oy<<1)+hod);
this.mkDiv(cx+ox+wod,cy-oy,1,(oy<<1)+hod);
}
}
function mkRect(x,y,w,h){
var s=this.stroke;
this.mkDiv(x,y,w,s);
this.mkDiv(x+w,y,s,h);
this.mkDiv(x,y+h,w+s,s);
this.mkDiv(x,y+s,s,h-s);
}
function jsgFont(){
this.PLAIN="font-weight:normal;";
this.BOLD="font-weight:bold;";
this.ITALIC="font-style:italic;";
this.ITALIC_BOLD=this.ITALIC+this.BOLD;
this.BOLD_ITALIC=this.ITALIC_BOLD;
}
var Font=new jsgFont();
function jsgStroke(){
this.DOTTED=-1;
}
var Stroke=new jsgStroke();
function jsGraphics(cnv,wnd){
this.setColor=new Function("arg","this.color = arg.toLowerCase();");
this.setStroke=function(x){
this.stroke=x;
if(!(x+1)){
}else{
if(x-1>0){
this.drawLine=mkLin2D;
this.mkOv=mkOv2D;
this.drawRect=mkRect;
}else{
this.drawLine=mkLin;
this.mkOv=mkOv;
this.drawRect=mkRect;
}
}
};
this.setPrintable=function(arg){
this.printable=arg;
if(jg_fast){
this.mkDiv=mkDivIe;
this.htmRpc=arg?htmPrtRpc:htmRpc;
}else{
this.mkDiv=arg?mkDivPrt:mkDiv;
}
};
this.setFont=function(fam,sz,sty){
this.ftFam=fam;
this.ftSz=sz;
this.ftSty=sty||Font.PLAIN;
};
this.drawPolyline=this.drawPolyLine=function(x,y){
for(var i=x.length-1;i;){
--i;
this.drawLine(x[i],y[i],x[i+1],y[i+1]);
}
};
this.fillRect=function(x,y,w,h){
this.mkDiv(x,y,w,h);
};
this.drawPolygon=function(x,y){
this.drawPolyline(x,y);
this.drawLine(x[x.length-1],y[x.length-1],x[0],y[0]);
};
this.drawEllipse=this.drawOval=function(x,y,w,h){
this.mkOv(x,y,w,h);
};
this.drawString=function(txt,x,y,_8d,_8e){
this.htm+="<div style=\"position:absolute;white-space:nowrap;"+"left:"+x+"px;"+"top:"+y+"px;"+"font-family:"+this.ftFam+";"+"font-size:"+this.ftSz+";"+"color:"+_8d+";"+"background-color:"+_8e+";"+this.ftSty+"\">"+txt+"</div>";
};
this.drawStringRect=function(txt,x,y,_92,_93){
this.htm+="<div style=\"position:absolute;overflow:hidden;"+"left:"+x+"px;"+"top:"+y+"px;"+"width:"+_92+"px;"+"text-align:"+_93+";"+"font-family:"+this.ftFam+";"+"font-size:"+this.ftSz+";"+"color:"+this.color+";"+this.ftSty+"\">"+txt+"</div>";
};
this.drawImage=function(_94,x,y,w,h,a){
this.htm+="<div style=\"position:absolute;"+"left:"+x+"px;"+"top:"+y+"px;"+"width:"+w+"px;"+"height:"+h+"px;\">"+"<img src=\""+_94+"\" width=\""+w+"\" height=\""+h+"\""+(a?(" "+a):"")+">"+"</div>";
};
this.clear=function(){
this.htm="";
if(this.cnv()){
this.cnv().innerHTML="";
}
};
this.mkOvQds=function(cx,cy,x,y,w,h,wod,hod){
var xl=cx-x,xr=cx+x+wod-w,yt=cy-y,yb=cy+y+hod-h;
if(xr>xl+w){
this.mkDiv(xr,yt,w,h);
this.mkDiv(xr,yb,w,h);
}else{
w=xr-xl+w;
}
this.mkDiv(xl,yt,w,h);
this.mkDiv(xl,yb,w,h);
};
this.setStroke(1);
this.setFont("verdana,geneva,helvetica,sans-serif","12px",Font.PLAIN);
this.color="#000000";
this.htm="";
this.wnd=wnd||window;
this.cnvID=cnv;
if(!jg_ok){
chkDHTM();
}
if(jg_ok){
if(cnv){
if(typeof (cnv)=="string"){
this.cont=document.all?(this.wnd.document.all[cnv]||null):document.getElementById?(this.wnd.document.getElementById(cnv)||null):null;
}else{
if(cnv==window.document){
this.cont=document.getElementsByTagName("body")[0];
}else{
this.cont=cnv;
}
}
this.paint=jg_dom?pntCnvDom:pntCnvIe;
}else{
this.paint=pntDoc;
}
}else{
this.paint=pntN;
}
this.setPrintable(false);
this.cnv=function(){
var _a6=__$(this.cnvID);
var _a7=_a6.getElementsByTagName("DIV");
if(_a7==null){
return _a6;
}
return _a7[0];
};
}
function CompInt(x,y){
return (x-y);
}
function AspMapTools(){
this.MapWidth=400;
this.MapHeight=300;
this.hspc=0;
this.vspc=0;
this.MapCanvas=null;
this.MapID="";
this.TOOL_ZOOMIN="1";
this.TOOL_ZOOMOUT="2";
this.TOOL_CENTER="3";
this.TOOL_PAN="4";
this.TOOL_INFO="5";
this.TOOL_DISTANCE="6";
this.TOOL_POINT="8";
this.TOOL_LINE="9";
this.TOOL_POLYLINE="10";
this.TOOL_RECT="11";
this.TOOL_CIRCLE="12";
this.TOOL_POLYGON="13";
this.isDragging=false;
this.x1=0;
this.y1=0;
this.x2=0;
this.y2=0;
this.Xpts=null;
this.Ypts=null;
this.rleft=0;
this.rright=0;
this.rtop=0;
this.rbottom=0;
this.isOnMoveInited=false;
this.isFF=(navigator.userAgent.indexOf("Firefox")!=-1);
this.isNav=(navigator.appName.indexOf("Netscape")!=-1);
this.SetTool=function(_aa){
this.CancelTool();
this.UpdateCursor(_aa);
this.SetMapTool(_aa);
};
this.GetTool=function(){
return this.GetMapTool();
};
this.UpdateCursor=function(_ab){
if(_ab==this.TOOL_CENTER){
this.setCrossCursor();
}else{
if(_ab==this.TOOL_PAN){
this.setPanCursor();
}else{
if(_ab==this.TOOL_INFO){
this.setInfoCursor();
}else{
this.setDefCursor();
}
}
}
};
this.StartTool=function(x,y){
this.MapCanvas.setStroke(this.LineWidth());
this.MapCanvas.setColor(this.LineColor());
switch(this.GetTool()){
case this.TOOL_POINT:
this.StartPoint(x,y);
break;
case this.TOOL_ZOOMIN:
case this.TOOL_RECT:
this.StartRect(x,y);
break;
case this.TOOL_LINE:
this.StartLine(x,y);
break;
case this.TOOL_PAN:
this.StartPan(x,y);
break;
case this.TOOL_CIRCLE:
this.StartCircle(x,y);
break;
case this.TOOL_DISTANCE:
case this.TOOL_POLYLINE:
this.StartPolyline(x,y);
break;
case this.TOOL_POLYGON:
this.StartPolygon(x,y);
break;
case this.TOOL_ZOOMOUT:
this.StartZoomOut(x,y);
break;
case this.TOOL_CENTER:
this.StartCenter(x,y);
break;
case this.TOOL_INFO:
this.StartInfo(x,y);
break;
}
};
this.DragTool=function(x,y){
switch(this.GetTool()){
case this.TOOL_RECT:
case this.TOOL_ZOOMIN:
this.DrawRect(x,y);
break;
case this.TOOL_LINE:
this.DrawLine(x,y);
break;
case this.TOOL_PAN:
this.DrawPan(x,y);
break;
case this.TOOL_CIRCLE:
this.DrawCircle(x,y);
break;
case this.TOOL_POLYLINE:
this.DrawPolyline(x,y);
break;
case this.TOOL_DISTANCE:
this.DrawDistance(x,y);
break;
case this.TOOL_POLYGON:
this.DrawPolygon(x,y);
break;
}
};
this.StopTool=function(x,y){
switch(this.GetTool()){
case this.TOOL_RECT:
this.StopRect();
break;
case this.TOOL_LINE:
this.StopLine();
break;
case this.TOOL_PAN:
this.StopPan();
break;
case this.TOOL_CIRCLE:
this.StopCircle();
break;
case this.TOOL_ZOOMIN:
this.StopZoomIn();
break;
}
};
this.CancelTool=function(){
this.StopDrag();
this.MapCanvas.clear();
};
this.StopCompTool=function(){
switch(this.GetTool()){
case this.TOOL_POLYLINE:
this.StopPolyline();
break;
case this.TOOL_DISTANCE:
this.StopDistance();
break;
case this.TOOL_POLYGON:
this.StopPolygon();
break;
}
};
this.StartPoint=function(x,y){
this.MapCanvas.clear();
this.OnPointTool(x,y);
};
this.StartZoomOut=function(x,y){
this.MapCanvas.clear();
this.OnZoomOutTool(x,y);
};
this.StartCenter=function(x,y){
this.MapCanvas.clear();
this.OnCenterTool(x,y);
};
this.StartInfo=function(x,y){
this.MapCanvas.clear();
this.OnInfoTool(x,y);
};
this.StopZoomIn=function(){
this.StopDrag();
this.MapCanvas.clear();
this.UpdateRect();
if(this.rright-this.rleft>1){
this.OnZoomInRectTool(this.rleft,this.rtop,this.rright,this.rbottom);
}else{
this.OnZoomInTool(this.x1,this.y1);
}
};
this.StartRect=function(x,y){
this.StartDrag(x,y);
this.UpdateRect();
};
this.DrawRect=function(x,y){
this.MapCanvas.clear();
this.UpdateDrag(x,y);
this.UpdateRect();
this.MapCanvas.drawRect(this.rleft,this.rtop,this.rright-this.rleft,this.rbottom-this.rtop);
this.MapCanvas.paint();
};
this.StopRect=function(){
this.StopDrag();
this.MapCanvas.clear();
this.UpdateRect();
if(this.rright-this.rleft>1){
this.OnRectTool(this.rleft,this.rtop,this.rright,this.rbottom);
}
};
this.UpdateRect=function(){
var _be=this.x1;
var _bf=this.y1;
if(this.x1>this.x2){
this.rright=this.x1;
this.rleft=this.x2;
}else{
this.rleft=this.x1;
this.rright=this.x2;
}
if(this.y1>this.y2){
this.rbottom=this.y1;
this.rtop=this.y2;
}else{
this.rtop=this.y1;
this.rbottom=this.y2;
}
};
this.StartLine=function(x,y){
this.StartDrag(x,y);
};
this.DrawLine=function(x,y){
this.MapCanvas.clear();
this.UpdateDrag(x,y);
this.MapCanvas.drawLine(this.x1,this.y1,this.x2,this.y2);
this.MapCanvas.paint();
};
this.StopLine=function(){
this.StopDrag();
this.MapCanvas.clear();
if(Math.abs(this.x1-this.x2)>1||Math.abs(this.y1-this.y2)>1){
this.OnLineTool(this.x1,this.y1,this.x2,this.y2);
}
};
this.StartPan=function(x,y){
this.StartDrag(x,y);
};
this.DrawPan=function(x,y){
this.UpdateDrag(x,y);
var img=__$(this.MapID+"_Image");
img.style.posLeft=this.x2-this.x1;
img.style.posTop=this.y2-this.y1;
};
this.StopPan=function(){
this.StopDrag();
if(Math.abs(this.x1-this.x2)>1){
this.OnLineTool(this.x1,this.y1,this.x2,this.y2);
}
};
this.StartCircle=function(x,y){
this.StartDrag(x,y);
};
this.DrawCircle=function(x,y){
this.MapCanvas.clear();
this.UpdateDrag(x,y);
var d=this.dist(this.x1,this.y1,this.x2,this.y2);
this.MapCanvas.drawEllipse(this.x1-d,this.y1-d,d*2,d*2);
this.MapCanvas.paint();
};
this.StopCircle=function(){
this.StopDrag();
this.MapCanvas.clear();
if(Math.abs(this.x1-this.x2)>1){
var d=this.dist(this.x1,this.y1,this.x2,this.y2);
this.OnCircleTool(this.x1,this.y1,d);
}
};
this.dist=function(x1,y1,x2,y2){
return Math.round(Math.abs(this.hypot(x1-x2,y1-y2)));
};
this.hypot=function(a,b){
return Math.sqrt((a*a)+(b*b));
};
this.StartPolyline=function(x,y){
if(!this.isDragging){
this.Xpts=new Array();
this.Ypts=new Array();
}
this.StartDrag(x,y);
this.Xpts[this.Xpts.length]=x;
this.Ypts[this.Ypts.length]=y;
};
this.DrawPolyline=function(x,y){
this.MapCanvas.clear();
this.UpdateDrag(x,y);
this.MapCanvas.drawPolyline(this.Xpts,this.Ypts);
this.MapCanvas.drawLine(this.x1,this.y1,this.x2,this.y2);
this.MapCanvas.paint();
};
this.StopPolyline=function(){
this.StopDrag();
this.MapCanvas.clear();
if(this.Xpts.length>1&&this.dist(this.Xpts[0],this.Ypts[0],this.Xpts[1],this.Ypts[1])>1){
this.OnPolylineTool(this.Xpts,this.Ypts);
}
};
this.DrawDistance=function(x,y){
var _db="#000000";
var _dc="#FFFFFF";
this.MapCanvas.clear();
this.UpdateDrag(x,y);
this.MapCanvas.drawPolyline(this.Xpts,this.Ypts);
this.MapCanvas.drawLine(this.x1,this.y1,this.x2,this.y2);
var _dd=0;
for(var i=0;i<this.Xpts.length-1;i++){
_dd+=this.dist(this.Xpts[i],this.Ypts[i],this.Xpts[i+1],this.Ypts[i+1]);
}
_dd+=this.dist(this.x1,this.y1,this.x2,this.y2);
_dd*=this.mpp();
if((_dd/1609.34)>1){
var _df=Math.round(1000*_dd/1609.34)/1000;
this.MapCanvas.drawString(_df+" "+this.miles(),1,1,_db,_dc);
}else{
_df=Math.round(_dd/0.3048);
this.MapCanvas.drawString(_df+" "+this.feet(),1,1,_db,_dc);
}
if((_dd/1000)>1){
_df=Math.round(1000*_dd/1000)/1000;
this.MapCanvas.drawString(_df+" "+this.km(),1,14,_db,_dc);
}else{
this.MapCanvas.drawString((Math.round(10*_dd)/10)+" "+this.meters(),1,14,_db,_dc);
}
this.MapCanvas.paint();
};
this.StopDistance=function(){
this.StopDrag();
this.MapCanvas.clear();
};
this.StartPolygon=function(x,y){
if(!this.isDragging){
this.Xpts=new Array();
this.Ypts=new Array();
}
this.StartDrag(x,y);
this.Xpts[this.Xpts.length]=x;
this.Ypts[this.Ypts.length]=y;
};
this.DrawPolygon=function(x,y){
this.MapCanvas.clear();
this.UpdateDrag(x,y);
var tx=new Array().concat(this.Xpts);
var ty=new Array().concat(this.Ypts);
tx[tx.length]=this.x2;
ty[ty.length]=this.y2;
this.MapCanvas.drawPolygon(tx,ty);
this.MapCanvas.paint();
};
this.StopPolygon=function(){
this.StopDrag();
this.MapCanvas.clear();
if(this.Xpts.length>2&&this.dist(this.Xpts[0],this.Ypts[0],this.Xpts[1],this.Ypts[1])>1){
this.Xpts[this.Xpts.length]=this.Xpts[0];
this.Ypts[this.Ypts.length]=this.Ypts[0];
this.OnPolygonTool(this.Xpts,this.Ypts);
}
};
this.StartDrag=function(x,y){
this.x1=x;
this.y1=y;
this.x2=this.x1+1;
this.y2=this.y1+1;
this.isDragging=true;
};
this.UpdateDrag=function(x,y){
this.x2=x;
this.y2=y;
};
this.StopDrag=function(){
this.isDragging=false;
return true;
};
this.mouseX=0;
this.mouseY=0;
this.IsLeftDown=function(e){
var _eb;
if(e.which==null){
_eb=(e.button<2)?1:((e.button==4)?2:3);
}else{
_eb=(e.which<2)?1:((e.which==2)?2:3);
}
return (_eb==1);
};
this.OnMouseDown=function(e){
if(!this.IsLeftDown(e)){
this.CancelTool();
return;
}
this.OnResize();
this.GetImageXY(e);
if(this.mouseX>=0&&this.mouseX<this.MapWidth&&this.mouseY>=0&&this.mouseY<this.MapHeight){
this.StartTool(this.mouseX,this.mouseY);
return false;
}
return false;
};
function CallOnMouseMove(){
var t=_ee;
if(t.mouseX>t.MapWidth){
t.mouseX=t.MapWidth-1;
}
if(t.mouseY>t.MapHeight){
t.mouseY=t.MapHeight-1;
}
if(t.mouseX<=0){
t.mouseX=1;
}
if(t.mouseY<=0){
t.mouseY=1;
}
if(t.isDragging){
t.DragTool(t.mouseX,t.mouseY);
}
return false;
}
var _ef;
var _f0;
var _f1=0;
var _ee=null;
this.OnMouseMove=function(e){
_ee=this;
if(!this.isDragging){
this.RefreshCursor();
this.OnResize();
}
this.GetImageXY(e);
if(this.isDragging){
clearTimeout(_ef);
_f1++;
_f0=function(){
CallOnMouseMove();
};
if(_f1<=3){
_ef=setTimeout(_f0,80);
}else{
_f0();
_f1=0;
}
}
this.ShowLatLong(true);
return false;
};
this.RefreshCursor=function(){
var _f3=__$(this.MapID+"_rf");
if(_f3==null){
return;
}
if(_f3.value=="1"){
this.UpdateCursor(this.GetTool());
_f3.value="0";
}
};
this.OnMouseLeave=function(e){
this.ShowLatLong(false);
return false;
};
this.ShowLatLong=function(_f5){
var dpp=__$(this.MapID+"_dpp");
if(dpp==null){
return;
}
dpp=parseFloat(dpp.value);
var _f7=__$(this.MapID+"_ld");
if(_f7==null){
return;
}
_f7=parseFloat(_f7.value);
var top=__$(this.MapID+"_td");
if(top==null){
return;
}
top=parseFloat(top.value);
var lng=_f7+this.mouseX*dpp;
var lat=top-this.mouseY*dpp;
try{
map_trackMousePosition(_f5,lat,lng);
}
catch(ex){
}
};
this.OnMouseOver=function(e){
this.RefreshCursor();
return false;
};
this.OnMouseUp=function(e){
if(this.isDragging){
this.StopTool();
}
return false;
};
this.OnDoubleClick=function(e){
if(this.isDragging){
this.StopCompTool();
}
return false;
};
this.OnKeyDown=function(e){
if(e.keyCode==27){
this.CancelTool();
}
};
this.GetImageXY=function(e){
if(this.isNav){
this.mouseX=e.pageX;
this.mouseY=e.pageY;
}else{
if(document.documentElement&&document.documentElement.scrollTop){
this.mouseX=event.clientX+document.documentElement.scrollLeft-2;
this.mouseY=event.clientY+document.documentElement.scrollTop-2;
}else{
this.mouseX=event.clientX+document.body.scrollLeft-2;
this.mouseY=event.clientY+document.body.scrollTop-2;
}
}
this.mouseX=this.mouseX-this.hspc;
this.mouseY=this.mouseY-this.vspc;
};
this.OnResize=function(){
this.vspc=0;
this.hspc=0;
var _100=this.GetMapCanvas();
do{
this.hspc+=_100.offsetLeft;
this.vspc+=_100.offsetTop;
}while((_100=_100.offsetParent));
};
this.GetMapCanvas=function(){
return __$(this.MapID+"_Canvas");
};
this.GetMapImg=function(){
return __$(this.MapID+"_Image");
};
this.Init=function(_101){
var _102=_101+"_Canvas";
this.MapID=_101;
this.MapCanvas=new jsGraphics(_102);
this.MapCanvas.setStroke(1);
this.MapCanvas.setColor("#FF0000");
this.MapCanvas.setFont("verdana,geneva,helvetica,sans-serif","12px","font-weight:bold;");
var _103=this.GetMapCanvas();
this.MapWidth=parseInt(_103.style.width);
this.MapHeight=parseInt(_103.style.height);
this.UpdateCursor();
};
this.OnPointTool=function(x,y){
this.submit(x,y,"");
};
this.OnRectTool=function(x1,y1,x2,y2){
this.submit(this.pack(x1,x2),this.pack(y1,y2),"");
};
this.OnLineTool=function(x1,y1,x2,y2){
this.OnRectTool(x1,y1,x2,y2);
};
this.OnCircleTool=function(x,y,_110){
this.submit(x,y,_110);
};
this.OnPolylineTool=function(_111,_112){
this.submit(_111.join(";"),_112.join(";"),"");
};
this.OnPolygonTool=function(_113,_114){
this.submit(_113.join(";"),_114.join(";"),"");
};
this.OnZoomInTool=function(x,y){
this.submit(x,y,"");
};
this.OnZoomInRectTool=function(x1,y1,x2,y2){
this.OnRectTool(x1,y1,x2,y2);
};
this.OnZoomOutTool=function(x,y){
this.submit(x,y,"");
};
this.OnCenterTool=function(x,y){
this.submit(x,y,"");
};
this.OnInfoTool=function(x,y){
this.submit(x,y,"");
};
this.submit=function(x,y,arg){
__submitMapToolCmd(this.MapID,this.GetTool(),x,y,arg);
};
this.pack=function(a,b){
return (a+";"+b);
};
this.setInfoCursor=function(){
this.GetMapCanvas().style.cursor="help";
};
this.setCrossCursor=function(){
this.GetMapCanvas().style.cursor="crosshair";
};
this.setPanCursor=function(){
this.GetMapCanvas().style.cursor="move";
};
this.setDefCursor=function(){
this.GetMapCanvas().style.cursor="default";
};
this.GetMapTool=function(){
return __$(this.MapID+"_tool").value;
};
this.SetMapTool=function(tool){
__$(this.MapID+"_tool").value=tool;
};
this.mpp=function(){
return parseFloat(__$(this.MapID+"_mpp").value);
};
this.miles=function(){
return __$(this.MapID+"_mis").value;
};
this.feet=function(){
return __$(this.MapID+"_fts").value;
};
this.km=function(){
return __$(this.MapID+"_kms").value;
};
this.meters=function(){
return __$(this.MapID+"_mts").value;
};
this.LineWidth=function(){
return parseInt(__$(this.MapID+"_tlw").value);
};
this.LineColor=function(){
return __$(this.MapID+"_tlc").value;
};
}
function __selectMapTool(_127,_128,_129,arg){
if(_129==null){
return;
}
var _12b=__$(_127+"_prevButtId");
if(_12b==null){
return;
}
var _12c=__$(_12b.value);
if(_12c==null){
return;
}
var _12d=eval(_127+"_tools");
if(_12d==null){
return;
}
_12d.SetTool(_128);
_12c.style.borderStyle=_12c.getAttribute("normbord");
_129.style.borderStyle=_129.getAttribute("selbord");
_12b.value=_129.id;
}
function __$(id){
var elem=document.all?(document.all[id]||null):document.getElementById?(document.getElementById(id)||null):null;
if(elem==null){
var _130=document.getElementsByName(id);
if(_130!=null){
elem=_130[0];
}
}
return elem;
}

