var __jsparam = new Array();
var __jsparam_array = new Array();
__jsparam_array['app'] = new Array();
__jsparam_array['app'][0] = 'JsMaps';
__jsparam['app'] = 'JsMaps';
__jsparam_array['v'] = new Array();
__jsparam_array['v'][0] = '1.5';
__jsparam['v'] = '1.5';
__jsparam_array['key'] = new Array();
__jsparam_array['key'][0] = 'excite';
__jsparam['key'] = 'excite';
//build 2007/10/25  9:04:55.93 

var _ANALYTICS_IMAGE_PATH=function(scriptNodes){var hostName;for(var i=0;i<scriptNodes.length;i++){var scriptNode=scriptNodes[i];if(scriptNode.src&&scriptNode.src.match(/(.*)map\/uc\/MapsApi\?(.*)?app=JsMaps/)){hostName=RegExp.$1;break;}}
return hostName||"";}(document.getElementsByTagName("script"))+"analytics/";var _autoScrollLog=true;var _analyzeGroup="-";var _analyzeOptions=[];var _analyzeCm=null;var _analyzeCommonParams=[];_analyzeCommonParams.clone=function(){return Array.apply(null,this);};function mapionTracker(target,options){if(_analyzeCommonParams.length==0){_analyzePushParams();}
var params=_analyzeCommonParams.clone();if(options){for(var i=0;i<options.length;i++){params.push(options[i]);}}
params.push('random='+Math.round(Math.random()*2147483647));var paramTarget='target=';if(target){if(target.charAt(0)=='/')target=target.substring(1);paramTarget=encodeURI(target);params.push('ispv=false');}else{return;}
var analyticsImage=new Image(1,1);analyticsImage.src=_ANALYTICS_IMAGE_PATH+paramTarget+'?'+params.join('&');analyticsImage.onload=function(){};return;};mapionTracker.SCROLL="/map/map/scroll";mapionTracker.POICLICK="/map/map/poi/click";mapionTracker.POIOPEN="/map/map/poi/open";function _analyzePushParams(){_analyzeCommonParams.push('grp='+_analyzeGroup);_analyzeCommonParams.push('mode=track');for(var i=0;i<_analyzeOptions.length;i++){if(_analyzeOptions[i]=='title'){_analyzeCommonParams.push('title='+encodeURI(document.title));}
if(_analyzeOptions[i]=='charset'){var paramCharset='charset=';if(document.characterSet){paramCharset+=document.characterSet;}else if(document.charset){paramCharset+=document.charset;}else{paramCharset+='-';}
_analyzeCommonParams.push(paramCharset);}
if(_analyzeOptions[i]=='screen'){_analyzeCommonParams.push('screen='+screen.width+'x'+screen.height);}
if(_analyzeOptions[i]=='screenColor'){_analyzeCommonParams.push('screenColor='+screen.colorDepth+'-bit');}
if(_analyzeOptions[i]=='language'){var paramLanguage='language=';var n=navigator;if(n.language){paramLanguage+=n.language.toLowerCase();}else if(n.browserLanguage){paramLanguage+=n.browserLanguage.toLowerCase();}else{paramLanguage+='-';}
_analyzeCommonParams.push(paramLanguage);}
if(_analyzeOptions[i]=='referrer'){var paramReferrer=document.referrer?document.referrer:'-';_analyzeCommonParams.push('referrer='+encodeURI(paramReferrer));}}};
//build Mon Jul 14 10:00:43 2008
//version 1.5.17
 function adapterMapion(url,grp){
 this.name="adapterMapion";
 this.tilew=300;
 this.tileh=300;
 this.OrgLon=139.8;
 this.OrgLat=35.6;
 this.convZID=[26000000
,5000000
,3000000
,1000000
,500000
,250000
,70000
,25000
,10000
,5000
,5000
,5000
,5000
,5000
,5000
,5000
,5000
 ];
 if(url){
 if(url.indexOf("http://",0)==-1){
 url="http://"+url;
}
 this.MapURL=url;
}else{
 this.MapURL=adapterMapion.MAPURL;
}
 this.grp=grp?grp:adapterMapion.GRP;
 
 this.ppry=[new b([1])
,new b([1])
,new b([1])
,new b([1])
,new b([1])
,new b([1])
,new b([1])
,new b([1])
,new b([1])
,new b([6220.1885,-214.690805642647905])
,new b([6261.1896,-210.690805642647905])
,new b([6300.1885,0.000005642647905])
,new b([6400.1885,0.000005642647905])
,new b([6405.8885,0.000005502647905])
,new b([6260.0000,0.000005502647905])
,new b([6350.0000,0.000005642647905])
,new b([6350.0000,0.000005642647905])
 ];
 
 this.pprx=[new b([1])
,new b([1])
,new b([1])
,new b([1])
,new b([1])
,new b([1])
,new b([1])
,new b([1])
,new b([1])
,new b([-502.39,251393.1148429322])
,new b([-498.09,251393.1148429322])
,new b([-502.39,251393.1148429322])
,new b([-502.39,251393.1148429322])
,new b([-500.59,250993.1148429322])
,new b([-510.50,250993.1148429322])
,new b([-505.00,251393.1148429322])
,new b([-505.00,251393.1148429322])
 ];
 
 this.bboxes=[new MBox(90,10,180,90)
,new MBox(90,10,180,90)
,new MBox(90,10,180,90)
,new MBox(90,10,180,90)
,new MBox(90,10,180,90)
,new MBox(90,10,180,90)
,new MBox(90,10,180,90)
,new MBox(90,10,180,90)
,new MBox(90,10,180,90)
,new MBox(139.661,35.600,139.999,35.800)
,new MBox(139.600,35.430,139.660,35.500)
,new MBox(136.800,35.100,137.000,35.300)
,new MBox(135.400,34.600,135.600,34.800)
,new MBox(135.100,34.600,135.300,34.800)
,new MBox(136.700,35.390,136.800,35.440)
,new MBox(135.750,34.980,135.800,35.010)
,new MBox(135.820,34.670,135.840,34.690)
 ];
 
 this.zoomtbl=[[0]
,[1]
,[2]
,[3]
,[4]
,[5]
,[6]
,[7]
,[8]
,[9,10,11,12,13,14,15,16]
 ];
 
 this.zoomRatio=[2600,500,300,100,50,25,7,2.5,1,0.5];
 this.zoomInMax=9;
 this.xCoe=[0.0003120
,0.0016220
,0.0026970
,0.0081000
,0.0161700
,0.0323500
,0.1159000
,0.3243500
,0.8100501
,1.0000000
,1.0000000
,1.0000000
,1.0000000
,1.0000000
,1.0000000
,1.0000000
,1.0000000
 ];
 this.yCoe=[0.0003101
,0.0016153
,0.0026970
,0.0080900
,0.0162385
,0.0323600
,0.1153710
,0.3230010
,0.81004715
,1.0000000
,1.0000000
,1.0000000
,1.0000000
,1.0000000
,1.0000000
,1.0000000
,1.0000000
 ];
 this.R=6370300.00;
 this.A=6377397.15;
 this.B=6356078.96;
 this.E=0.081819474;
 this.K=0.9996;
 
}
 adapterMapion.MAPURL="http://labs.mapion.co.jp/m/k";
 adapterMapion.GRP="plain";
 adapterMapion.prototype=new _b();
 adapterMapion.prototype.getMapURL=function(_tile,_z){
 var _el=l10tol60(_tile.rc().x);
 var _nl=l10tol60(_tile.rc().y);
 return this.MapURL+"?uc=1&grp="+this.grp+"&scl="+this.convZID[_z]+"&el="+_el+"&size="+this.tilew+"%2C"+this.tileh+"&nl="+_nl+"&edge=2";
};
 adapterMapion.prototype.r2p=function(r,z){
 if(z<=8){
 var x=this.r2pX(r.x,z);
 var ox=this.r2pX(this.OrgLon,z);
 var y=this.r2pY(r.y,z);
 var oy=this.r2pY(this.OrgLat,z);
}else{
 return new MPoint(this.nDimr2pX(r.x,z),this.nDimr2pY(r.y,z));
}
 return new MPoint(x-ox,y-oy);
};
 adapterMapion.prototype.r2pX=function(rx,z){
 var x=(this.R*this.xCoe[z])*(rx)*(Math.PI/180);
 return Math.round(x);
};
 adapterMapion.prototype.r2pY=function(ry,z){
 var y=(this.R*this.yCoe[z])*Math.log(Math.tan((45.0+ry/2.0)*Math.PI/180));
 return Math.round(-y);
};
 adapterMapion.prototype.p2r=function(p,z){
 if(z<=8){
 var ox=this.r2pX(this.OrgLon,z);
 var oy=this.r2pY(this.OrgLat,z);
 var rx=this.p2rX(ox+p.x,z);
 var ry=this.p2rY(oy+p.y,z);
}else{
 return new MPoint(this.nDimp2rX(p.x,z),this.nDimp2rY(p.y,z));
}
 return new MPoint(rx,ry);
};
 adapterMapion.prototype.p2rX=function(px,z){
 var el=px/(this.R*this.xCoe[z])*180/Math.PI;
 return el;
};
 adapterMapion.prototype.p2rY=function(py,z){
 var nl=(2*Math.atan(Math.pow(Math.E,py/(this.R*this.yCoe[z])))*180/Math.PI)-90;
 return-nl;
};
 
 
 
 function l60tol10(_l60){
 var _l10=0.0;
 var div=1;
 var _l60a=_l60.split("/");
 for(var i=0;i<_l60a.length;i++){
 _l10=_l10+parseFloat(_l60a[i])/div;
 div=div*60.0;
}
 return new Number(parseFloat(_l10.toFixed(5)));
};
 
 function l10tol60(_l10){
 var _l60=new Array(0.0,0.0,0.0);
 _l60[0]=parseInt(_l10);
 _l60[1]=Math.floor((_l10-_l60[0])*60);
 _l60[2]=3600*(_l10-_l60[0]-_l60[1]/60);
 if(_l60[2].toFixed(3)>=60.0){
 _l60[2]=60.0-_l60[2];
 _l60[1]=_l60[1]+1.0;
}
 return _l60[0]+"/"+_l60[1]+"/"+_l60[2].toFixed(3);
};
 
 function b(k){
 this.k=k;
};
 b.prototype.F=function(x){
 var val=0;var len=this.k.length-1;
 for(var i=0;i<=len;i++){val+=this.k[i]*Math.pow(x,len-i);}
 return val;
};
 b.prototype.f=function(x){
 var val=0;var len=this.k.length-1;
 for(var i=0;i<=len;i++){val+=(len-i)*this.k[i]*Math.pow(x,len-i-1);}
 return val;
};
 b.prototype.FF=function(x){
 var val=0;var len=this.k.length-1;
 for(var i=0;i<=len;i++){val+=this.k[i]*Math.pow(x,len-i+1)/(len-i+1);}
 return val;
};
 b.prototype.S=function(x1,x2){
 return this.FF(x1)-this.FF(x2);
};
 
 function _b(){
 this.lastX=135.5;
 this.lastY=35.6;
};
 
 _b.prototype.nDimr2pX=function(rx,z){
 return this.pprx[z].S(rx,this.OrgLon);
};
 _b.prototype.nDimr2pY=function(ry,z){
 return this.ppry[z].S(this.OrgLat,ry);
};
 _b.prototype.nDimp2rX=function(px,z){
 var len=this.pprx[z].k.length-1;
 var ka=new Array();
 for(var i=0;i<=len;i++){ka[i]=this.pprx[z].k[i]/(len+1-i);}
 ka[i]=-this.pprx[z].FF(this.OrgLon)-px;
 var fnc2=new b(ka);
 this.lastX=this.solveNDimFunc(fnc2,this.lastX);
 return this.lastX;
};
 _b.prototype.nDimp2rY=function(py,z){
 var len=this.ppry[z].k.length-1;
 var ka=new Array();
 for(var i=0;i<=len;i++){ka[i]=this.ppry[z].k[i]/(len+1-i);}
 ka[i]=-this.ppry[z].FF(this.OrgLat)+py;
 var fnc2=new b(ka);
 this.lastY=this.solveNDimFunc(fnc2,this.lastY);
 return this.lastY;
};
 
 _b.prototype.r2pX=function(rx,z){
 return this.pprx[z].S(rx,this.OrgLon);
};
 _b.prototype.r2pY=function(ry,z){
 return this.ppry[z].S(this.OrgLat,ry);
};
 _b.prototype.p2rX=function(px,z){
 var len=this.pprx[z].k.length-1;
 var ka=new Array();
 for(var i=0;i<=len;i++){ka[i]=this.pprx[z].k[i]/(len+1-i);}
 ka[i]=-this.pprx[z].FF(this.OrgLon)-px;
 var fnc2=new b(ka);
 this.lastX=this.solveNDimFunc(fnc2,this.lastX);
 return this.lastX;
};
 _b.prototype.p2rY=function(py,z){
 var len=this.ppry[z].k.length-1;
 var ka=new Array();
 for(var i=0;i<=len;i++){ka[i]=this.ppry[z].k[i]/(len+1-i);}
 ka[i]=-this.ppry[z].FF(this.OrgLat)+py;
 var fnc2=new b(ka);
 this.lastY=this.solveNDimFunc(fnc2,this.lastY);
 return this.lastY;
};
 
 _b.prototype.solveNDimFunc=function(f,s){
 var xp=s;var xn=0;
 for(var i=0;i<15;i++){
 xn=xp-f.F(xp)/f.f(xp);
 var v=xp-xn;
 if((v<0?-v:v)<=0.00001)break;
 xp=xn;
}
 return xp;
};
 function adapterMapion2(url,grp){
 this.name="adapterMapion2";
 this.tilew=300;
 this.tileh=300;
 this.OrgLon=139.8;
 this.OrgLat=35.6;
 this.convZID=[26000000,5000000,3000000,1000000,500000,250000,70000,25000,25000,10000,10000,10000,10000,5000,5000,5000,5000,5000];
 if(url){
 if(url.indexOf("http://",0)==-1){
 url="http://"+url;
}
 this.MapURL=url;
}else{
 this.MapURL=adapterMapion2.MAPURL;
}
 this.grp=grp?grp:adapterMapion2.GRP;
 
 this.ppry=[new b([0.000544177429085552,-0.0475664642237018,1.76578929956147,15.189286835693])
,new b([0.00178500197408585,-0.117956209529998,4.4006605222734,133.001987231028])
,new b([0.00286771207015658,-0.183184941136752,6.8066268944266,228.52161378663])
,new b([0.00148258767612588,-0.205087915667709,10.8344280004083,-244.690003214089,2960.07976763869])
,new b([0.000541061487042891,-0.0950904669679005,6.63558587125345,-229.101336067611,3927.13325110912,-24825.4587116699])
,new b([0.00423467880800893,-0.574599071446451,30.1972653693638,-674.970502325128,9310.41111987426])
,new b([0.143662715687742,-10.3621697576589,383.296226876032,8784.059375])
,new b([-0.0831533775453633,12.3547434452678,-666.199536849057,15996.8815410728,-104861.957537407])
,new b([-0.0830133775453633,12.3777434452678,-666.199536849057,15996.8815410728,-104861.957537407])
,new b([-89.5323911682,6200.337625267689,-1000.4392310620799])
,new b([-62.2423911682,5200.337625267689,3500.4392310620799])
,new b([-38.9823911682,4490.237625267689,128.4392310620799])
,new b([-26.5123911682,4101.337625267689,-4299.7992310620799])
,new b([6220.1885,-210.690805642647905])
,new b([6261.1896,-210.690805642647905])
,new b([6300.1885,0.000005642647905])
,new b([6400.1885,0.000005642647905])
,new b([6405.8885,0.000005502647905])
 ];
 
 this.pprx=[new b([34.62661429275831])
,new b([-0.0161431733795994,182.406557800901])
,new b([-0.1503051095381565,320.631443347977])
,new b([900.0])
,new b([1802.0])
,new b([3599.0])
,new b([4.10165815929642,12297.2703220517])
,new b([36101.1])
,new b([36101.1])
,new b([89901.51])
,new b([89901.51])
,new b([89901.51])
,new b([89901.51])
,new b([-502.39,251393.1148429322])
,new b([-498.09,251393.1148429322])
,new b([-502.39,251393.1148429322])
,new b([-502.39,251393.1148429322])
,new b([-500.59,250993.1148429322])
 ];
 
 this.bboxes=[new MBox(90,10,180,90)
,new MBox(90,10,180,90)
,new MBox(90,10,180,90)
,new MBox(90,10,180,90)
,new MBox(90,10,180,90)
,new MBox(90,10,180,90)
,new MBox(90,10,180,90)
,new MBox(90,25.300,180,90)
,new MBox(90,10,180,25.299)
,new MBox(90,10.000,180,26.999)
,new MBox(90,27.000,180,34.399)
,new MBox(90,34.400,180,38.499)
,new MBox(90,38.500,180,90.000)
,new MBox(139.661,35.600,139.999,35.800)
,new MBox(139.600,35.440,139.640,35.500)
,new MBox(136.800,35.100,137.000,35.300)
,new MBox(135.400,34.600,135.600,34.800)
,new MBox(135.100,34.600,135.300,34.800)
 ];
 
 this.zoomtbl=[[0]
,[1]
,[2]
,[3]
,[4]
,[5]
,[6]
,[7,8]
,[9,10,11,12]
,[13,14,15,16,17]
 ];
 
 this.zoomRatio=[2600,500,300,100,50,25,7,2.5,1,0.5];
 this.zoomInMax=9;
}
 adapterMapion2.MAPURL="http://labs.mapion.co.jp/m/k";
 adapterMapion2.GRP="plain";
 adapterMapion2.prototype=new _b();
 adapterMapion2.prototype.getMapURL=function(_tile,_z){
 var _el=l10tol60(_tile.rc().x);var _nl=l10tol60(_tile.rc().y);
 if(false){
}else{
 return this.MapURL+"?uc=1&grp="+this.grp+"&scl="+this.convZID[_z]+"&el="+_el+"&size="+this.tilew+"%2C"+this.tileh+"&nl="+_nl+"&edge=2";
}
};
 
 
 
 
 function MTile(pp,map,adpz){
 this.map=map;
 
 this.adpzid=adpz;
 
 this.tp=new MPoint(Math.floor(pp.x/(this.map.adp.tilew*1))
,Math.floor(pp.y/(this.map.adp.tileh*1)));
};
 MTile.prototype.toString=function(){
 return this.tp.x+"_"+this.tp.y;
};
 MTile.prototype.rc=function(){
 var p=new MPoint(this.tp.x*this.map.adp.tilew+this.map.adp.tilew/2.0 
,this.tp.y*this.map.adp.tileh+this.map.adp.tileh/2.0);
 return this.p2r(p);
};
 MTile.sub=function(a,b){
 for(var i in b){
 if(!b.hasOwnProperty(i))continue;
 delete a[i];
}
 return a;
};
 MTile.toArray=function(a){
 var reta=new Array();
 for(var i in a){
 if(!a.hasOwnProperty(i))continue;
 if(i.indexOf("_")>0)reta.push(i);
}
 return reta;
};
 MTile.prototype.setTP=function(tp){this.tp=tp;};
 MTile.prototype.p2r=function(p){
 return this.map.adp.p2r(p,this.adpzid);
};
 
 
 
 function MBox(x1,y1,x2,y2){
 this.x1=x1;
 this.y1=y1;
 this.x2=x2;
 this.y2=y2;
};
 MBox.prototype.toString=function(){
 return "("+this.x1+","+this.y1+")-("+this.x2+","+this.y2+")";
};
 MBox.prototype.contains=function(p){
 if(!p)MDEBUG.trace("************ERRORP:"+p);
 if(!p.x)MDEBUG.trace("************ERRORP:"+p);
 if((this.x1<=p.x)&&(p.x<=this.x2)&&(this.y1<=p.y)&&(p.y<=this.y2))
 return true;
 else 
 return false;
};
 
 
 function MBounds(minX,minY,maxX,maxY){
 this.minX=minX;
 this.minY=minY;
 this.maxX=maxX;
 this.maxY=maxY;
 this.x1=minX;
 this.y1=minY;
 this.x2=maxX;
 this.y2=maxY;
}
 
 
 function MRange(start,end){
 this.start=start;
 this.end=end;
};
 MRange.prototype.toString=function(){
 return "("+this.start+"->"+this.end+")";
};
 
 function MPoint(x,y){
 this.x=x;
 this.y=y;
};
 MPoint.prototype.add=function(dx,dy){this.x+=dx;this.y+=dy;return this;};
 MPoint.prototype.toString=function(){return this.x+","+this.y;};
 
 
 function MPolyline(points,color,width,opacity){
 this.id="polyline"+MPolyline.ID++;
 this.rpos=null;
 this.points=points;
 this.map=null;
 this.div=document.createElement("DIV");
 this.div.oP=this;
 this.div.id=this.id;
 this.div.style.position="absolute";
 this.div.unselectable="on";
 this.div.onselectstart=function(){return false;};
 this.color=color;
 this.opacity=(opacity!=null)?opacity:1.0;
 this.width=(width!=null)?width:6;
 this.drawing=null;
};
 MPolyline.ID=0;
 
 function MFillPolygon(points,color,width,opacity,fillcolor,fillopacity){
 this.id="fillpolygon"+MFillPolygon.ID++;
 this.rlt=null;
 this.rrb=null;
 this.points=points;
 this.map=null;
 this.div=document.createElement("DIV");
 this.div.oP=this;
 this.div.id=this.id;
 this.div.style.position="absolute";
 this.div.unselectable="on";
 this.div.onselectstart=function(){return false;};
 this.color=color;
 this.opacity=(opacity!=null)?opacity:0.7;
 this.width=(width!=null)?width:6;
 this.fillcolor=(fillcolor!=null)?fillcolor:"#FF0000";
 this.fillopacity=(fillopacity!=null)?fillopacity:0.7;
 this.drawing=null;
};
 MFillPolygon.ID=0;
 
 function MPolyCircle(point,r,color,width,opacity,fillcolor,fillopacity){
 this.id="polycircle"+MPolyCircle.ID++;
 this.point=point;
 this.r=r;
 this.map=null;
 this.div=document.createElement("DIV");
 this.div.oP=this;
 this.div.id=this.id;
 this.div.style.position="absolute";
 this.div.unselectable="on";
 this.div.onselectstart=function(){return false;};
 this.color=color;
 this.opacity=(opacity!=null)?opacity:0.7;
 this.width=(width!=null)?width:6;
 this.fillcolor=(fillcolor!=null)?fillcolor:"#FF0000";
 this.fillopacity=(fillopacity!=null)?fillopacity:0.7;
 this.drawing=null;
};
 MPolyCircle.ID=0;
 
 
 function MapTypes(){};
 MapTypes.typeDef=
 [{name:"M_MAP_TYPE",adapter:"adapterMapion"}
,{name:"G_MAP_TYPE",adapter:"adapterMapion"}
 ];
 MapTypes.types=new Array();
 MapTypes.syncTypes=function(){
 for(var i=0;i<MapTypes.typeDef.length;i++){
 MapTypes.types[i]=MapTypes.typeDef[i].name;
 eval(MapTypes.typeDef[i].name+"="+i);
}
};
 MapTypes.syncTypes();
 MapTypes.addMapType=function(maptype){
 for(var i=0;i<MapTypes.typeDef.length;i++){
 if(MapTypes.typeDef[i].name==maptype.name)return;
}
 MapTypes.typeDef[MapTypes.typeDef.length]=maptype;
 MapTypes.syncTypes();
};
 MapTypes.getDefaultType=function(){return MapTypes.typeDef[0].name;};
 MapTypes.getAdapterName=function(name){
 for(var i=0;i<MapTypes.typeDef.length;i++){
 if(MapTypes.typeDef[i].name==name)return MapTypes.typeDef[i].adapter;
}
 return "";
};
 function MapType(name,adapter){
 this.name=name;this.adapter=adapter;
};
 
 function MSize(w,h){
 this.width=w;
 this.height=h;
};
 MSize.prototype.toString=function(){
 return"("+this.width+","+this.height+")";
};
 MSize.prototype.equals=function(pos){
 if(this.w==pos.x && this.h==pos.y){
 return true;
}else{
 return false;
}
};
 
 function MMap(div,param){
 MBrowser.init();
 
 var adp=null;
 if(param){
 if(param["adapter"]){
 adp=param["adapter"];
}
 if(param["imgPath"]){
 MMap.IMGPATH=param["imgPath"];
}
}
 
 MMap.BLANKIMG=MMap.IMGPATH+"img/blank.png";
 
 this.blankimg=new Image();
 this.blankimg.src=MMap.BLANKIMG;
 
 this.id='mmap'+MMap.ID++;
 this.rpos=new MPoint(135.5,35.6);
 this.zid=0;
 this.adpzid=0;
 
 this.smoothzoomval=1.0;
 this.smoothzoomtid=null;
 this.smoothzoomby=0;
 
 this.controls=new Object();
 
 this.tbuff=-10;
 
 this.adp=adp?adp:new adapterMapion();
 
 this.mapTypeName=MapTypes.getDefaultType();
 this.adpName=MapTypes.getAdapterName(this.mapTypeName);
 
 this.nT=new Object();
 this.To=new Object();
 this.tT=new Object();
 
 this.aT=new Array();
 this.deltiles=new Array();
 
 this.minT=null;
 this.maxT=null;
 
 this.Ls=null;
 this.Lb=null;
 
 this.aa=new Array();
 this.aR=3;
 
 this.moving=false;
 this.smoothmovetid=null;
 
 this.autoScroll=false;
 this.keyoperation=true;
 
 this.div=div;
 div.style.position="relative";
 
 this.offsetMapX=null;
 this.offsetMapY=null;
 this.getMapOffset();
 
 this.focusdiv=document.createElement("DIV");
 this.focusdiv.style.position="absolute";
 this.focusdiv.style.width="10px";
 this.focusdiv.style.height="10px";
 div.appendChild(this.focusdiv);
 this.focuselem=document.createElement("input");
 this.focuselem.type="text";
 this.focuselem.style.position="absolute";
 this.focuselem.style.width="1px";
 this.focuselem.style.height="1px";
 this.focuselem.readOnly=true;
 this.focuselem.size=1;
 this.focusdiv.appendChild(this.focuselem);
 
 var focuselem=this.focuselem;
 var focusdiv=this.focusdiv;
 var mmap=this;
 this.focuselem.onfocus=function(e){
 if(mmap.keyoperation)MKeyManager.Enable(focuselem,mmap);
};
 this.focuselem.onblur=function(e){
 focusdiv.style.left="0px";
 focusdiv.style.top="10px";
 if(mmap.keyoperation){
 MKeyManager.Disable(focuselem);
}
};
 this.clipdiv=document.createElement("DIV");
 this.clipdiv.style.position="absolute";
 this.clipdiv.style.overflow="hidden";
 this.clipdiv.style.top="0px";
 this.clipdiv.style.left="0px";
 this.clipdiv.style.width="100%";
 this.clipdiv.style.height="100%";
 div.appendChild(this.clipdiv);
 
 this.clipdiv.onmousedown=function(e){
 if(!e)e=window.event;
 focusdiv.style.left=(mmap.div.offsetWidth/2)+"px";
 focusdiv.style.top=(mmap.div.offsetHeight/2)+"px";
 focuselem.focus();
};
 
 this.basediv=document.createElement("DIV");
 this.basediv.style.position="absolute";
 this.basediv.style.overflow="hidden";
 this.basediv.style.width="100%";
 this.basediv.style.height="100%";
 this.basediv.style.left="0px";
 this.basediv.style.top="0px";
 this.clipdiv.appendChild(this.basediv);
 
 this.mapdiv=new mb(this);
 this.mapdiv.style.zIndex=10;
 if(MBrowser.ie5up)this.mapdiv.style.textAlign="left";
 
 this.draggable=true;
 
 this.canvasdiv=document.createElement("DIV");
 this.canvasdiv.id="canvasdiv"+this.id;
 this.canvasdiv.style.position="absolute";
 this.canvasdiv.style.zIndex=3000;
 this.mapdiv.appendChild(this.canvasdiv);
 
 this.infodiv=document.createElement("DIV");
 this.infodiv.id="infodiv"+this.id;
 this.infodiv.style.position="absolute";
 this.infodiv.style.zIndex=3100;
 this.mapdiv.appendChild(this.infodiv);
 
 this.linearray=new Array();
 this.centerMarkShowFlg=true;
 
 this.sc=null;
 this.setMapBox();
 
 this.intervalTime=15;
 this.totalTime=150;
 this.loop=0;
 this.dpx=0.0;
 this.dpy=0.0;
 this.cur_x=0;
 this.cur_y=0;
 this.smove_timerID=null;
 this.TIME_PITCH=25;
 this.MOVE_TIME=500;
 
 this.preloadtiles=new Array();
 
 this.markerArray=new Object();
 
 this.figureArray=new Object();
 
 this.enableinfowindow=true;
 this.infowindow=new MInfoWindowG(this);
 this.infowindowOpened=false;
 
 this.appendingTiles=false;
 
 this.moveendCenterAndZoom=false;
 
 this.infoWindowAppearableDivisionMarginTop=0;
 this.infoWindowAppearableDivisionMarginLeft=0;
 this.infoWindowAppearableDivisionMarginRight=0;
 this.infoWindowAppearableDivisionMarginBottom=0;
 
 this.MOUSEOVER_CURSOR_DRAGGABLE="auto";
 this.DRAGGING_CURSOR_DRAGGABLE="move";
 this.MOUSEOVER_CURSOR_DRAGGDISABLE="auto";
 this.DRAGGING_CURSOR_DRAGGDISABLE="auto";
 
 var mmapIns=this;
 div.onmouseover=function(e){
 if(mmapIns.mapdiv.oP.mdownpos&&MMap.CurrentMap){
 if(mmapIns.draggable){
 mmapIns.mapdiv.style.cursor=mmapIns.DRAGGING_CURSOR_DRAGGABLE;
}else{
 mmapIns.mapdiv.style.cursor=mmapIns.DRAGGING_CURSOR_DRAGGDISABLE;
}
}else{
 if(mmapIns.draggable){
 mmapIns.mapdiv.style.cursor=mmapIns.MOUSEOVER_CURSOR_DRAGGABLE;
}else{
 mmapIns.mapdiv.style.cursor=mmapIns.MOUSEOVER_CURSOR_DRAGGDISABLE;
}
}
}
 div.onmouseout=function(e){
 mmapIns.mapdiv.style.cursor="auto";
}
 
 if(div.style.width.indexOf("%")>0 || div.style.width.indexOf("%")>0){
 function resizeWinListener(){
 mmapIns.setMapBox();
 mmapIns.refreshMapAll();
}
 if(document.all&&document.bgColor){
 window.attachEvent('onresize',resizeWinListener);
}else{
 window.addEventListener('resize',resizeWinListener,false);
}
}
 
 if(MMap.extendFunc){
 MMap.extendFunc.call(this);
}
 
};
 MMap.ID=0;
 MMap.IMGPATH="http://labs.mapion.co.jp/labs3d/";
 MMap.BLANKIMG=null;
 
 MMap.extendFunc=function(){};
 
 MMap.getScrollTop=function(){
 var _t1=document.body.scrollTop;
 var _t2=document.documentElement.scrollTop;
 if((_t2!=0)&&(_t1==0))_t1=_t2;
 return _t1;
};
 MMap.getScrollLeft=function(){
 var _t1=document.body.scrollLeft;
 var _t2=document.documentElement.scrollLeft;
 if((_t2!=0)&&(_t1==0))_t1=_t2;
 return _t1;
};
 MMap.getClientX=function(e){
 if(MBrowser.safari2)return(parseInt(e.clientX)-MMap.getScrollLeft());
 else return parseInt(e.clientX);
};
 MMap.getClientY=function(e){
 if(MBrowser.safari2)return(parseInt(e.clientY)-MMap.getScrollTop());
 else return parseInt(e.clientY);
};
 
 
 MMap.prototype.updateCenterRP=function(){
 this.rpos=this.s2r(this.sc,this.zid);
 return this.rpos;
};
 MMap.prototype.setMapBox=function(){
 this.sc=new MPoint(Math.round(parseInt(this.div.offsetWidth)/2)-1,Math.round(parseInt(this.div.offsetHeight)/2)-1);
 this.mapBox=new MBox(this.tbuff,this.tbuff 
,parseInt(this.div.offsetWidth)-this.tbuff,parseInt(this.div.offsetHeight)-this.tbuff);
 if(this.centerMarkShowFlg){
 for(var i=0;i<this.linearray.length;i++){
 this.basediv.removeChild(this.linearray[i]);
}
 this.linearray=new Array();
 var cx=parseInt(this.div.offsetWidth)/2;
 var cy=parseInt(this.div.offsetHeight)/2 
 this.drawLine(cx-7,cy-2,12,'yoko');
 this.drawLine(cx-2,cy-7,12,'tate');
}
};
 
 MMap.prototype.refreshMapDivSize=function(){
 this.setMapBox();
 this.refreshMapAll();
};
 
 MMap.prototype.createMap=function(){
 var _b=this.mapBox;
 this.minT=new MTile(this.s2p(new MPoint(Math.min(_b.x1,_b.x2)
,Math.min(_b.y1,_b.y2)))
,this,this.adpzid);
 this.maxT=new MTile(this.s2p(new MPoint(Math.max(_b.x1,_b.x2)
,Math.max(_b.y1,_b.y2)))
,this,this.adpzid);
 
 if((this.minT.toString()==this.Ls)
 &&(this.maxT.toString()==this.Lb))return false;
 
 this.Ls=this.minT.toString();
 this.Lb=this.maxT.toString();
 
 this.nT=new Object();
 this.tT=new Object();
 var tilexcnt=this.maxT.tp.x-this.minT.tp.x+2;
 var tileycnt=this.maxT.tp.y-this.minT.tp.y+2;
 
 if((this.aa.length<=0)){
 for(var i=0;i<parseInt(tilexcnt*tileycnt*this.aR);i++){
 this.aa.push(
 new tileImg(i+"_"+this.id 
,0
,0
,this.mapdiv 
,MMap.BLANKIMG 
,this.adp.tilew
,this.adp.tileh
,"tilegrp"+this.id 
 )
 );
}
 var im=document.createElement("IMG");
 document.body.appendChild(im);
 im.src=MMap.BLANKIMG;
 im.style.position="absolute";
 im.style.left="-100px";
 im.style.top="-100px";
 im.style.width=10+"px";
 im.style.height=10+"px";
 this.preloadtiles.push(im);
}
 
 for(var yy=this.minT.tp.y;yy<=this.maxT.tp.y;yy++){
 for(var _xx=this.minT.tp.x;_xx<=this.maxT.tp.x;_xx++){
 this.nT[_xx+"_"+yy]="";
 this.tT[_xx+"_"+yy]="";
}
}
 
 this.nT=MTile.sub(this.nT,this.To);
 this.To=MTile.sub(this.To,this.tT);
 
 for(var tmptile in this.nT){
 if(!this.nT.hasOwnProperty(tmptile))continue;
 tmptile=tmptile.split("_");
 this.aT.push(new MPoint(tmptile[0],tmptile[1]));
}
 
 var cntTx=Math.round((this.maxT.tp.x+this.minT.tp.x)/2);
 var cntTy=Math.round((this.maxT.tp.y+this.minT.tp.y)/2);
 this.aT.sort(
 function(_a,_b){
 var ax=_a.x-cntTx;
 var ay=_a.y-cntTy;
 var bx=_b.x-cntTx;
 var by=_b.y-cntTy;
 return((bx<0?-bx:bx)+(by<0?-by:by)-(ax<0?-ax:ax)-(ay<0?-ay:ay));
}
 );
 
 for(var tmptile in this.To){
 if(!this.To.hasOwnProperty(tmptile))continue;
 tmptile=tmptile.split("_");
 var _d=null;
 if(_d=document.getElementById("ti_"+tmptile[0]+"_"+tmptile[1]+"_"+this.id))
 this.deltiles.push(_d);
}
 
 this.To=new Object();
 for(var i in this.tT){
 if(!this.tT.hasOwnProperty(i))continue;
 this.To[i+""]="";
}
 return true;
};
 
 MMap.prototype.showMap=function(){
 this.deleteTiles();
 this.appendTiles();
};
 MMap.prototype.deleteTiles=function(){
 var _d=null;
 while(_d=this.deltiles.pop()){
 this.mapdiv.removeChild(_d);
 _d.src=MMap.BLANKIMG;
 this.aa.unshift(_d);
}
};
 
 MMap.prototype.appendTiles=function(){
 this.appendingTiles=true;
 while(tilep=this.aT.pop()){
 this.appendTile(tilep);
}
 this.appendingTiles=false;
 return;
};
 
 MMap.prototype.appendTile=function(t,retry){
 var tile=new MTile(new MPoint(0,0),this,this.adpzid);
 tile.setTP(t);
 var im=null;
 var is=null;
 if(im=this.aa.pop()){
 im.id="ti_"+t.x+"_"+t.y+"_"+this.id;
 this.mapdiv.appendChild(im);
 is=im.style;
 is.left=(this.adp.tilew*t.x)+"px";is.top=(this.adp.tileh*t.y)+"px";
 is.width=this.adp.tilew+"px";is.height=this.adp.tileh+"px";
 im.src=this.adp.getMapURL(tile,this.adpzid);
}
};
 
 MMap.prototype.redrawMap=function(){
 if(this.redrawingMap)return;
 if(this.createMap()){
 this.redrawingMap=true;
 this.showMap();
 this.redrawingMap=false;
}
};
 
 MMap.prototype.moveBy=function(l,t){
 this.setMapdivLT((this.getMapdivL()+l),(this.getMapdivT()+t));
};
 
 MMap.prototype.setMapdivLT=function(_l,_t){
 var d=this.mapdiv.style;
 d.left=_l+"px";
 d.top=_t+"px";
 this.mapdiv.operaleft=_l;
 this.mapdiv.operatop=_t;
}
 
 MMap.prototype.getMapdivL=function(){
 if(MBrowser.ie5up)
 return this.mapdiv.offsetLeft;
 else 
 return this.mapdiv.operaleft;
}
 MMap.prototype.getMapdivT=function(){
 if(MBrowser.ie5up)
 return this.mapdiv.offsetTop;
 else 
 return this.mapdiv.operatop;
}
 
 
 MMap.prototype.p2r=function(p,z){
 return this.adp.p2r(p,this.adpzid);
};
 MMap.prototype.r2p=function(r,z){
 return this.adp.r2p(r,this.adpzid);
};
 
 MMap.prototype.s2r=function(s,z){
 return this.p2r(this.s2p(s),z);
};
 
 MMap.prototype.r2s=function(r,z){
 return this.p2s(this.r2p(r,z));
};
 MMap.prototype.s2p=function(sp){
 return new MPoint(sp.x-this.getMapdivL(),sp.y-this.getMapdivT());
};
 MMap.prototype.p2s=function(p){
 return new MPoint(p.x+this.getMapdivL(),p.y+this.getMapdivT());
};
 
 
 MMap.CurrentMap=null;
 
 MMap.prototype.setMarkerPos=function(overlay){
 var pp=this.r2p(overlay.rpos,this.zid);
 overlay.div.style.left=(pp.x-overlay.icon.offsetX)+"px";
 overlay.div.style.top=(pp.y-overlay.icon.offsetY)+"px";
 if(MBrowser.opera){
 if(pp.x-overlay.icon.offsetX<-60000 || pp.y-overlay.icon.offsetY<-60000){
 overlay.div.style.left="";
 overlay.div.style.top="";
 overlay.div.style.zIndex="";
 overlay.div.style.visibility="hidden";
}
}
};
 
 MMap.prototype.smoveToPPoint=function(pp){
 var pc=this.s2p(this.sc,this.zid);
 var pm=pp;
 this.startSmoothMove(pc,pm);
};
 MMap.prototype.smoveToRPoint=function(rp){
 var pc=this.s2p(this.sc,this.zid);
 var pm=this.r2p(rp,this.zid);
 this.startSmoothMove(pc,pm,rp);
};
 MMap.prototype.startSmoothMove=function(fromPP,toPP,toRP){
 if(this.moving || this.smoothzoomby !=0)return;
 var cb=null;
 if(cb=MEvent.hash[this.id+"movestart"]){
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].apply(this);
}
}
 this.moving=true;
 
 this.cur_x=this.getMapdivL();
 this.cur_y=this.getMapdivT();
 
 this.toRP=toRP;
 
 var mmap=this;
 
 var xabs=(-toPP.x+fromPP.x)<0.0 ?-1.0 : 1.0;
 var yabs=(-toPP.y+fromPP.y)<0.0 ?-1.0 : 1.0;
 var func_x=Math.sqrt((-toPP.x+fromPP.x)*xabs);
 var func_y=Math.sqrt((-toPP.y+fromPP.y)*yabs);
 var TIME_PITCH=this.TIME_PITCH;
 var MOVE_TIME=this.MOVE_TIME;
 var x_x_pitch=func_x/(MOVE_TIME/TIME_PITCH);
 var y_x_pitch=func_y/(MOVE_TIME/TIME_PITCH);
 var count=0;
 
 if(mmap.smove_timerID)clearInterval(mmap.smove_timerID);
 mmap.smove_timerID=setInterval(
 function(){
 count++;
 if(count>(MOVE_TIME/TIME_PITCH)){
 clearInterval(mmap.smove_timerID);
 mmap.smove_timerID=null;
 mmap.cur_x=toPP.x;
 mmap.cur_y=toPP.y;
 mmap.updateCenterRP();
 if(mmap.toRP)mmap.rpos=mmap.toRP;
 mmap.redrawMap();
 mmap.moving=false;
 if(cb=MEvent.hash[mmap.id+"moveend"]){
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].apply(mmap);
}
}
 return;
}
 mmap.cur_x=mmap.cur_x+xabs*(Math.pow(func_x,2)-Math.pow(func_x-x_x_pitch,2));
 mmap.cur_y=mmap.cur_y+yabs*(Math.pow(func_y,2)-Math.pow(func_y-y_x_pitch,2));
 mmap.setMapdivLT(Math.round(mmap.cur_x),Math.round(mmap.cur_y));
 mmap.updateCenterRP();
 func_x-=x_x_pitch;
 func_y-=y_x_pitch;
 if(mmap.autoScroll)mmap.redrawMap();
 if(cb=MEvent.hash[mmap.id+"move"]){
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].apply(mmap);
}
}
}
,TIME_PITCH 
 );
};
 MMap.prototype.startSmoothMove_old=function(fromPP,toPP,toRP){
 if(this.moving || this.smoothzoomby !=0)return;
 this.intervalTime=20;
 this.totalTime=180;
 this.loop=0;
 this.dpx=(-toPP.x+fromPP.x)/(this.totalTime/this.intervalTime);
 this.dpy=(-toPP.y+fromPP.y)/(this.totalTime/this.intervalTime);
 
 var cb=null;
 if(cb=MEvent.hash[this.id+"movestart"]){
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].apply(this);
}
}
 
 this.moving=true;
 
 this.cur_x=this.getMapdivL();
 this.cur_y=this.getMapdivT();
 this.toRP=toRP;
 
 var mmap=this;
 this.smoothmovetid=setInterval(function(){mmap.smoothmove(mmap);},mmap.intervalTime);
};
 
 MMap.prototype.smoothmove=function(mmap){
 mmap.loop++;
 if(mmap.loop>(mmap.totalTime/mmap.intervalTime)){
 clearInterval(mmap.smoothmovetid);
 mmap.smoothmovetid=null;
 mmap.updateCenterRP();
 if(this.toRP)
 mmap.rpos=this.toRP;
 if(!mmap.autoScroll)mmap.redrawMap();
 var cb=null;
 mmap.moving=false;
 if(cb=MEvent.hash[this.id+"moveend"]){
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].apply(this);
}
}
}else{
 mmap.cur_x=mmap.cur_x+mmap.dpx;
 mmap.cur_y=mmap.cur_y+mmap.dpy;
 mmap.setMapdivLT(Math.round(mmap.cur_x),Math.round(mmap.cur_y));
 mmap.updateCenterRP();
 if(mmap.autoScroll)mmap.redrawMap();
 var cb=null;
 if(cb=MEvent.hash[this.id+"move"]){
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].apply(this);
}
}
}
};
 MMap.prototype.refreshMapAll=function(){
 for(var deltp in this.To){
 if(!this.To.hasOwnProperty(deltp))continue;
 var delt=deltp.split("_");
 this.deltiles.push(document.getElementById("ti_"+delt[0]+"_"+delt[1]+"_"+this.id));
}
 if(this.deltiles.length>0)this.deleteTiles();
 this.To=new Array();
 this.Ls=null;
 this.Lb=null;
 this.centerAtLatLng(this.rpos);
 
};
 
 MMap.prototype.relocateAllMarkers=function(){
 for(var i in this.markerArray){
 if(!this.markerArray.hasOwnProperty(i))continue;
 this.setMarkerPos(this.markerArray[i]);
}
};
 
 MMap.prototype.relocateAllFigs=function(){
 for(var i in this.figureArray){
 if(!this.figureArray.hasOwnProperty(i))continue;
 this.drawFig(this.figureArray[i]);
}
};
 
 MMap.prototype.deleteAllOverlays=function(){
 this.canvasdiv.innerHTML="";
 this.markerArray=new Object();
};
 
 
 MMap.prototype.changeZoom=function(zid){
 if(this.zid==zid || this.mapdiv.oP.mdownpos !=null || this.moving || this.smoothzoomby !=0)return;
 
 var cb=null;
 if(cb=MEvent.hash[this.id+"zoomstart"]){
 var argZ=zid-this.zid;
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 if(cb[i].call(this,argZ)==false){
 for(var i in this.controls){
 if(!this.controls.hasOwnProperty(i))continue;
 this.controls[i].zoomUpdate();
}
 return;
}
}
}
 
 var oldzoom=this.zid;
 this.setZoomId(zid);
 this.refreshMapAll();
 
 if(cb=MEvent.hash[this.id+"zoom"]){
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].call(this,oldzoom,this.zid);
}
}
};
 MMap.prototype.setZoomId=function(zid){
 if(this.mapdiv.oP.mdownpos==null && !this.moving && this.smoothzoomby==0){
 this.zid=this.validateZID(zid);
 this.adpzid=this.getAdpZid(this.zid);
 this.updateAdpOrgPoint();
}
};
 MMap.prototype.validateZID=function(zid){
 zid=Number(zid);
 if(zid<0)zid=0;
 else if(zid>this.adp.zoomInMax)zid=this.adp.zoomInMax;
 return zid;
};
 
 MMap.prototype.getAdpZid=function(zid){
 var adpzid=this.adp.convZID.length-1;
 var ztb=this.adp.zoomtbl[zid];
 for(var i=0;i<ztb.length;i++){
 var bb=this.adp.bboxes[ztb[i]];
 var tf=bb.contains(this.rpos);
 if(this.adp.bboxes[ztb[i]].contains(this.rpos)){adpzid=ztb[i];i=ztb.length;}
}
 return adpzid;
};
 
 MMap.prototype.updateAdpOrgPoint=function(){
 if(this.adp.OrgFixed)return;
 if(!MBrowser.opera && !MBrowser.safari)return;
 
 var gridSize=10.0/this.adp.zoomRatio[this.zid];
 this.adp.OrgLon=Math.floor(this.rpos.x*gridSize)/gridSize;
 this.adp.OrgLat=Math.floor(this.rpos.y*gridSize)/gridSize;
};
 MMap.prototype.smoothzoomin=function(z){
 if(this.smoothzoomby !=0)return;
 this.smoothzoomby=+1*z;
 this.smoothzoomstart();
};
 MMap.prototype.smoothzoomout=function(z){
 if(this.smoothzoomby !=0)return;
 this.smoothzoomby=-1*z;
 this.smoothzoomstart();
};
 
 MMap.prototype.smoothzoomstart=function(){
 var nextz=this.zid+this.smoothzoomby;
 nextz=this.validateZID(nextz);
 
 if(this.zid==nextz || this.mapdiv.oP.mdownpos !=null || this.moving){this.smoothzoomby=0;return;}
 var nextadpzid=this.getAdpZid(nextz);
 
 var cb=null;
 if(cb=MEvent.hash[this.id+"zoomstart"]){
 var argZ=zid-this.zid;
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 if(cb[i].call(this,argZ)==false){
 for(var i in this.controls){
 if(!this.controls.hasOwnProperty(i))continue;
 this.controls[i].zoomUpdate();
}
 this.smoothzoomby=0;
 return;
}
}
}
 
 this.canvasdiv.style.visibility="hidden";
 this.infowindow.div.style.visibility="hidden";
 
 var offleft=this.getMapdivL();
 var offtop=this.getMapdivT();
 
 var _b=this.mapBox;
 this.minT=new MTile((new MPoint(Math.min(_b.x1,_b.x2)-offleft 
,Math.min(_b.y1,_b.y2)-offtop))
,this,nextadpzid);
 this.maxT=new MTile((new MPoint(Math.max(_b.x1,_b.x2)-offleft 
,Math.max(_b.y1,_b.y2)-offtop))
,this,nextadpzid);
 
 var i=0;
 for(var yy=this.minT.tp.y;yy<=this.maxT.tp.y;yy++){
 for(var xx=this.minT.tp.x;xx<=this.maxT.tp.x;xx++){
 var tile=new MTile(new MPoint(0,0),this,nextadpzid);
 var tilep=new MPoint(xx,yy);
 tile.setTP(tilep);
 i=i+1;
}
}
 
 var ims=this.getCurrentTiles();
 for(var i=0;i<ims.length;i++){
 ims[i].orgleft=ims[i].style.left;
 ims[i].orgtop=ims[i].style.top;
}
 this.smoothzoom();
};
 
 MMap.prototype.smoothzoom=function(){
 var dz=(this.adp.zoomRatio[this.zid+this.smoothzoomby]/this.adp.zoomRatio[this.zid]-1)/10;
 this.smoothzoomval=this.smoothzoomval+dz;
 var z=this.smoothzoomval;
 
 if(this.smoothzoomby*(z-this.adp.zoomRatio[this.zid+this.smoothzoomby]/this.adp.zoomRatio[this.zid])>0){
 var ims=this.getCurrentTiles();
 var pcenter=this.r2p(this.rpos,this.zid);
 for(var i=0;i<ims.length;i++){
 ims[i].style.width=Math.ceil(this.adp.tilew/z)+"px";
 ims[i].style.height=Math.ceil(this.adp.tileh/z)+"px";
 var sax=(parseInt(ims[i].orgleft)-pcenter.x)/z;
 var say=(parseInt(ims[i].orgtop)-pcenter.y)/z;
 ims[i].style.left=parseInt(Math.round(pcenter.x+sax))+"px";
 ims[i].style.top=parseInt(Math.round(pcenter.y+say))+"px";
}
 clearInterval(this.smoothzoomtid);
 var mmap=this;
 this.smoothzoomtid=setTimeout(function(){mmap.smoothzoom.call(mmap);},50);
}else{
 clearInterval(this.smoothzoomtid);
 var szby=this.smoothzoomby;
 this.smoothzoomby=0.0;
 this.smoothzoomval=1.0;
 var ims=this.getCurrentTiles();
 this.updateAdpOrgPoint();
 
 var zid=this.zid+szby;
 var oldzoom=this.zid;
 this.setZoomId(zid);
 this.refreshMapAll();
 if(cb=MEvent.hash[this.id+"zoom"]){
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].call(this,oldzoom,this.zid);
}
}
 
 for(var i=0;i<ims.length;i++){
 ims[i].style.width=this.adp.tilew+"px";
 ims[i].style.height=this.adp.tileh+"px";
}
 
 this.relocateAllMarkers();
 this.relocateAllFigs();
 this.canvasdiv.style.visibility="visible";
 
}
};
 MMap.prototype.getCurrentTiles=function(){
 var ims=new Array();
 for(var tmptile in this.To){
 if(!this.To.hasOwnProperty(tmptile))continue;
 tmptile=tmptile.split("_");
 var elm=null;
 if(elm=document.getElementById("ti_"+tmptile[0]+"_"+tmptile[1]+"_"+this.id))
 ims.push(elm);
}
 return ims;
};
 
 MMap.prototype.drawBoxByBox=function(b){
 this.drawLine(b.x1,b.y1,Math.abs(b.x1-b.x2),'yoko');
 this.drawLine(b.x1,b.y2,Math.abs(b.x1-b.x2)+2,'yoko');
 this.drawLine(b.x1,b.y1,Math.abs(b.y1-b.y2),'tate');
 this.drawLine(b.x2,b.y1,Math.abs(b.y1-b.y2)+2,'tate');
};
 MMap.prototype.drawLine=function(sx,sy,len,type){
 var line=document.createElement("DIV");
 this.linearray[this.linearray.length]=line;
 line.style.position="absolute";
 line.style.left=sx+"px";
 line.style.top=sy+"px";
 line.style.zIndex=120;
 if(type=='yoko'){line.style.width=len+"px";line.style.height=2+"px";}
 else{line.style.width=2+"px";line.style.height=len+"px";}
 line.style.backgroundColor="#FF0000";
 line.style.fontSize="1px";
 this.basediv.appendChild(line);
};
 
 function tileImg(_id,_l,_t,_pa,_src,_w,_h,_name){
 var ti=document.createElement("img");
 if(_src)ti.src=_src;
 ti.id=_id;
 ti.name=_name;
 ti.style.position="absolute";
 ti.style.left=Math.round(_l)+"px";
 ti.style.top=Math.round(_t)+"px";
 ti.style.border="0px";
 ti.style.MozUserSelect="none";
 ti.unselectable="on";
 ti.onselectstart=function(){return false;};
 ti.galleryImg=false;
 
 ti.orgleft=_l;
 ti.orgtop=_t;
 
 if(_w&&_h){
 ti.style.width=_w+"px";
 ti.style.height=_h+"px";
}
 return ti;
};
 
 MMap.prototype.addOverlay=function(overlay){
 if(overlay instanceof MMarker){
 this.markerArray[overlay.id]=overlay;
 overlay.map=this;
 this.canvasdiv.appendChild(overlay.div);
 this.canvasdiv.zIndex=10001;
 this.setMarkerPos(overlay);
 var cb;
 if(cb=MEvent.hash[this.id+"addoverlay"]){
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].call(this,overlay);
}
}
}else 
 if((overlay instanceof MPolyline)
 ||(overlay instanceof MFillPolygon)
 ||(overlay instanceof MPolyCircle)){
 this.figureArray[overlay.id]=overlay;
 overlay.map=this;
 this.canvasdiv.appendChild(overlay.div);
 this.canvasdiv.zindex=10000;
 this.drawFig(overlay);
 var cb;
 if(cb=MEvent.hash[this.id+"addoverlay"]){
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].call(this,overlay);
}
}
}
};
 MMap.prototype.removeOverlay=function(overlay){
 if(overlay instanceof MMarker){
 this.canvasdiv.removeChild(overlay.div);
 overlay.map=null;
 delete this.markerArray[overlay.id];
 var cb=null;
 if(cb=MEvent.hash[this.id+"removeoverlay"]){
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].call(this,overlay);
}
}
}
 if((overlay instanceof MPolyline)||(overlay instanceof MFillPolygon)||(overlay instanceof MPolyCircle)){
 this.canvasdiv.removeChild(overlay.div);
 overlay.map=null;
 delete this.figureArray[overlay.id];
 var cb=null;
 if(cb=MEvent.hash[this.id+"removeoverlay"]){
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].call(this,overlay);
}
}
}
};
 MMap.prototype.clearOverlays=function(){
 this.canvasdiv.innerHTML="";
 this.markerArray=new Object();
 this.figureArray=new Object();
 var cb=null;
 if(cb=MEvent.hash[this.id+"clearoverlays"]){
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].call(this);
}
}
};
 MMap.prototype.setFigPos=function(overlay){
 var pp=this.r2p(overlay.rlt,this.zid);
 overlay.div.style.left=(pp.x-Math.ceil(overlay.width/2))+"px";
 overlay.div.style.top=(pp.y-Math.ceil(overlay.width/2))+"px";
};
 
 MMap.prototype.drawFig=function(overlay){
 if(!overlay.drawing){
 overlay.drawing=new d_(window,overlay.div,300,300);
 if(MBrowser.safari){
 var df=this;
 setTimeout(function(){df.drawFig(overlay);},10);
 return;
}
}else{
 overlay.drawing.clear();
}
 if((overlay instanceof MPolyline)||(overlay instanceof MFillPolygon)){
 overlay.rlt=new MPoint(overlay.points[0].x,overlay.points[0].y);
 overlay.rrb=new MPoint(overlay.points[0].x,overlay.points[0].y);
 var lx1=new Array();var ly1=new Array();
 var len=overlay.points.length;
 
 for(var i=0;i<len;i++){
 var lr1=new MPoint(overlay.points[i].x,overlay.points[i].y);
 overlay.rlt.x=Math.min(overlay.rlt.x,lr1.x);overlay.rlt.y=Math.max(overlay.rlt.y,lr1.y);
 overlay.rrb.x=Math.max(overlay.rrb.x,lr1.x);overlay.rrb.y=Math.min(overlay.rrb.y,lr1.y);
 var lp1=this.r2p(lr1);
 lx1.push(lp1.x);ly1.push(lp1.y);
}
 this.setFigPos(overlay);
 
 var plt=this.r2p(overlay.rlt);prb=this.r2p(overlay.rrb);
 plt.x=plt.x-overlay.width;
 plt.y=plt.y-overlay.width;
 var ll=new Array();
 for(var i=0;i<len;i++){
 ll[ll.length]=new MPoint(lx1[i]-plt.x,ly1[i]-plt.y);
}
 
 var lines=overlay.drawing;
 lines.set$CSize(Math.round(Math.abs(plt.x-prb.x)+overlay.width*2)
,Math.round(Math.abs(plt.y-prb.y)+overlay.width*2));
 lines.setLineColor(overlay.color);
 lines.setLineWidth(overlay.width);
 lines.setLineOpacity(overlay.opacity);
 
 lines.setFillOpacity(overlay.fillopacity);
 lines.setFillColor(overlay.fillcolor);
 
 
 if(overlay instanceof MPolyline){
 lines.polyline(ll);
}else{
 lines.polygon(ll);
}
}else{
 var pp=this.r2p(overlay.point);
 if(typeof(overlay.r)=="string"){
 overlay.r=overlay.r.toLowerCase();
 if(overlay.r.indexOf("px")>-1){
 var cpp=this.r2p(overlay.point);
 var vpp=new MPoint(cpp.x+parseFloat(overlay.r),cpp.y);
 var dst=MGlobal.distance(overlay.point,this.p2r(vpp));
 overlay.r=dst*0.001;
}else if(overlay.r.indexOf("km")>-1){
 overlay.r=parseFloat(overlay.r);
}else if(overlay.r.indexOf("m")>-1){
 overlay.r=parseFloat(overlay.r)*0.001;
}
}
 var dlng=overlay.r*180/(20000*(Math.cos((overlay.point.y*Math.PI)/180)));
 var drp=new MPoint(overlay.point.x+dlng,overlay.point.y);
 var dpp=this.r2p(drp,this.zid);
 var dpx=Math.abs(Math.round(pp.x-dpp.x));
 var w=overlay.width;
 overlay.div.style.left=(pp.x-dpx-w)+"px";
 overlay.div.style.top=(pp.y-dpx-w)+"px";
 var lines=overlay.drawing;
 lines.set$CSize((dpx+w)*2,(dpx+w)*2);
 lines.setLineColor(overlay.color);
 lines.setLineWidth(overlay.width);
 lines.setLineOpacity(overlay.opacity);
 lines.setFillOpacity(overlay.fillopacity);
 lines.setFillColor(overlay.fillcolor);
 lines.circle(dpx+w,dpx+w,dpx);
}
 
};
 MMap.prototype.getMapOffset=function(){
 this.div.style.padding="0px";
 var tempDiv=document.createElement("DIV");
 tempDiv.oP=this;
 tempDiv.style.zIndex=9999;
 tempDiv.style.margin="0px";
 tempDiv.style.padding="0px";
 tempDiv.style.position="absolute";
 tempDiv.style.left="0px";
 tempDiv.style.top="0px";
 this.div.style.overflow="hidden";
 tempDiv.style.width=screen.width+"px";
 tempDiv.style.height=screen.height+"px";
 if(MBrowser.ie5up){
 tempDiv.style.backgroundImage="url("+MMap.BLANKIMG+")";
}
 this.div.appendChild(tempDiv);
 var offsetMapX;
 var offsetMapY;
 tempDiv.onmousemove=function(e){
 if(!e)e=window.event;
 if(MBrowser.ie5up || window.opera){
 this.oP.offsetMapX=e.clientX+MMap.getScrollLeft()-e.offsetX;
 this.oP.offsetMapY=e.clientY+MMap.getScrollTop()-e.offsetY;
}else if(MBrowser.safari2){
 this.oP.offsetMapX=e.clientX-e.layerX;
 this.oP.offsetMapY=e.clientY-e.layerY;
}else if(document.layers||document.getElementById){
 this.oP.offsetMapX=e.clientX+MMap.getScrollLeft()-e.layerX;
 this.oP.offsetMapY=e.clientY+MMap.getScrollTop()-e.layerY;
}
 this.onmousemove=null;
 this.oP.div.removeChild(this);
}
}
 
 MMap.prototype.addControl=function(cnt,pos){
 cnt.map=this;
 cnt.show();
 if(pos){
 cnt.setPosition(pos);
}
 this.controls[cnt.id]=cnt;
};
 
 MMap.prototype.setControllerLocation=function(cnt,x,y){
 cnt.div.style.left=l+"px";
 cnt.div.style.top=t+"px";
 cnt.div.style.right=null;
 cnt.div.style.bottom=null;
};
 
 MMap.prototype.removeControl=function(cnt){
 if(cnt==null)return;
 this.basediv.removeChild(cnt.div);
 delete this.controls[cnt.id];
 return;
}
 
 MMap.prototype.centerMarkHide=function(){
 this.centerMarkShowFlg=false;
 for(var i=0;i<this.linearray.length;i++){
 this.linearray[i].style.visibility="hidden";
}
}
 MMap.prototype.centerMarkShow=function(){
 this.centerMarkShowFlg=true;
 for(var i=0;i<this.linearray.length;i++){
 this.linearray[i].style.visibility="visible";
}
}
 
 MMap.prototype.getTileImgTag=function(x,y){
 var _d=document.getElementById("ti_"+x+"_"+y+"_"+this.id);
 if(_d)return _d;
 else return null;
}
 
 function MBrowser(){};
 MBrowser.ie5up=document.all&&document.bgColor?true:false;
 MBrowser.ie7up=null;
 MBrowser.firefox3 = navigator.userAgent.indexOf("Firefox/3")>0;
 MBrowser.gecko=!document.all&&(!window.showModalDialog||MBrowser.firefox3)?true:false;
 MBrowser.opera=window.opera?true:false;
 MBrowser.opera92up=MBrowser.opera && 9.2<=navigator.userAgent.match(/^Opera\/([\d\.]*)\s.*$/)[1];
 MBrowser.opera95up=MBrowser.opera && 9.5<=navigator.userAgent.match(/^Opera\/([\d\.]*)\s.*$/)[1];
 MBrowser.safari=navigator.userAgent.indexOf("Safari")>0;
 MBrowser.safari2=MBrowser.safari && navigator.userAgent.indexOf("Version")==-1;
 MBrowser.safari3=MBrowser.safari && navigator.userAgent.indexOf("Version/3")>0;
 
 MBrowser.init=function(){
 MBrowser.ie7up=MBrowser.ie5up&&typeof document.body.style.maxHeight!="undefined"?true:false;
}
 
 if(!Object.hasOwnProperty){
 Object.prototype.hasOwnProperty=function(it){
 if(typeof(this[it])!="undefined" && typeof(this.constructor.prototype[it])=="undefined")return true;
 else return false;
}
}
 function mb(map){
 this.id='mmapdiv'+mb.ID++;
 
 this.map=map;
 
 this.div=document.createElement("DIV");
 this.div.oP=this;
 this.div.style.position="absolute";
 this.div.style.left=0+"px";
 this.div.style.top=0+"px";
 
 this.div.operaleft=0;
 this.div.operatop=0;
 
 this.div.onmousedown=this.mdown;
 this.div.onmouseup=this.mup;
 
 var mmapdivins=this;
 MEvent.mouseOutOfWindowFuncs.push(new callbackFunc(mmapdivins.div,mmapdivins.div.onmouseup));
 
 this.div.onclick=this.mclick;
 this.div.clickflg=false;
 
 if(this.div.attachEvent){
 this.div.onmousewheel=this.mwheel;
}else if(this.div.addEventListener){
 this.div.addEventListener("DOMMouseScroll",this.mwheel,false);
}
 if(MBrowser.safari){
 this.div.onmousewheel=this.mwheel;
}
 
 this.div.oncontextmenu=function(e){mmapdivins.mrclick.call(mmapdivins.div,e);return false;}
 
 this.mdownpos=null;
 this.mdownDivpos=null;
 this.allowClickPix=2;
 
 this.map.basediv.appendChild(this.div);
 return this.div;
};
 
 function callbackFunc(obj,call){
 this.obj=obj;this.callback=call;
};
 
 mb.ID=0;
 
 mb.DefaultDocumentMouseMove=function(e){
 if(MMap.CurrentMap==null)return;
 MMap.CurrentMap.mmove.call(MMap.CurrentMap.div,e);
};
 
 mb.prototype.mmove=function(e){
 var _po=this.oP;
 
 var cb=null;
 if(cb=MEvent.hash[_po.map.id+"mousemove"]){
 if(!e)e=window.event;
 var x=MMap.getClientX(e)-parseInt(_po.map.offsetMapX)+MMap.getScrollLeft();
 var y=MMap.getClientY(e)-parseInt(_po.map.offsetMapY)+MMap.getScrollTop();
 var rpm=_po.map.s2r(new MPoint(x,y),_po.map.zid);
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].call(_po.map,null,rpm);
}
}
 
 if(!_po.map.draggable)return;
 if(_po.mdownpos==null || _po.map.moving)return;
 if(MEvent.EventMDownQueue.length!=0)return;
 
 if(!e)e=window.event;
 
 if(!MBrowser.ie5up){
 _po.map.setMapdivLT(Math.round(MMap.getClientX(e)-_po.mdownpos.x)
,Math.round(MMap.getClientY(e)-_po.mdownpos.y));
}else{
 _po.div.style.left=Math.round(MMap.getClientX(e)-_po.mdownpos.x)+"px";
 _po.div.style.top=Math.round(MMap.getClientY(e)-_po.mdownpos.y)+"px";
}
 
 if(window.event){
 window.event.cancelBuble=true;
 window.event.returnValue=false;
}
 
 _po.map.updateCenterRP();
 
 if(this.clickflg){
 var xabs=_po.mdownDivpos.x-parseInt(_po.div.style.left);
 var yabs=_po.mdownDivpos.y-parseInt(_po.div.style.top);
 if((xabs<0?-xabs:xabs)>=_po.allowClickPix 
 ||(yabs<0?-yabs:yabs)>=_po.allowClickPix){
 this.clickflg=false;
 this.mousemoved=true;
}
}
 
 if(_po.map.autoScroll)_po.map.redrawMap();
 
 var cb=null;
 if(cb=MEvent.hash[_po.map.id+"move"]){
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].apply(_po.map);
}
}
};
 
 mb.prototype.mdown=function(e){
 var map=this.oP.map;
 if(this.oP.map.smoothzoomby !=0)return;
 
 if(!e)e=window.event;
 
 MMap.CurrentMap=this.oP;
 
 if(map.draggable){
 this.oP.div.style.cursor=map.DRAGGING_CURSOR_DRAGGABLE;
}else{
 this.oP.div.style.cursor=map.DRAGGING_CURSOR_DRAGGDISABLE;
}
 
 this.oP.mdownpos=new MPoint(MMap.getClientX(e)-parseInt(this.oP.map.getMapdivL())
,MMap.getClientY(e)-parseInt(this.oP.map.getMapdivT()));
 this.oP.mdownDivpos=new MPoint(parseInt(this.oP.map.getMapdivL()),parseInt(this.oP.map.getMapdivT()));
 
 this.clickflg=true;
 
 var cb=null;
 if(!MEvent.EventMDownQueue["PmDf"]){
 if(cb=MEvent.hash[this.oP.map.id+"mousedown"]){
 if(!e)e=window.event;
 var x=MMap.getClientX(e)-parseInt(this.oP.map.offsetMapX)+MMap.getScrollLeft();
 var y=MMap.getClientY(e)-parseInt(this.oP.map.offsetMapY)+MMap.getScrollTop();
 var rpm=this.oP.map.s2r(new MPoint(x,y),this.oP.map.zid);
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].call(this.oP.map,null,rpm);
}
}
}
};
 
 mb.prototype.mup=function(e){
 if(!e)e=window.event;
 
 var map=this.oP.map;
 
 if(this.mousemoved){
 this.oP.map.updateCenterRP();
 if(!this.oP.map.autoScroll)this.oP.map.redrawMap();
 this.mousemoved=false;
}
 
 
 if(map.draggable){
 this.oP.div.style.cursor=map.MOUSEOVER_CURSOR_DRAGGABLE;
}else{
 this.oP.div.style.cursor=map.MOUSEOVER_CURSOR_DRAGGDISABLE;
}
 
 var cb=null;
 var tempMdownpos=this.oP.mdownpos;
 if((!this.clickflg)&&(this.oP.mdownpos!=null)&&(cb=MEvent.hash[this.oP.map.id+"moveend"])){
 this.oP.mdownpos=null;
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].apply(this.oP.map);
}
 this.oP.mdownpos=tempMdownpos;
}
 
 if(MMap.CurrentMap&&this.oP.mdownpos){
 var cb=null;
 if(cb=MEvent.hash[this.oP.map.id+"mouseup"]){
 this.oP.mdownpos=null;
 if(!e)e=window.event;
 var x=MMap.getClientX(e)-parseInt(this.oP.map.offsetMapX)+MMap.getScrollLeft();
 var y=MMap.getClientY(e)-parseInt(this.oP.map.offsetMapY)+MMap.getScrollTop();
 var rpm=this.oP.map.s2r(new MPoint(x,y),this.oP.map.zid);
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].call(this.oP.map,null,rpm);
}
}
}
 
 this.oP.mdownpos=null;
 
};
 
 mb.prototype.mrclick=function(e){
 if(!this.clickflg || this.oP.map.smoothzoomby !=0)return;
 
 if(MEvent.EventMClickQueue["PmDf"]){
 MEvent.EventMClickQueue=new Array();
 return;
}
 
 var cb=null;
 if(cb=MEvent.hash[this.oP.map.id+"rclick"]){
 if(!e)e=window.event;
 var x=MMap.getClientX(e)-parseInt(this.oP.map.offsetMapX)+MMap.getScrollLeft();
 var y=MMap.getClientY(e)-parseInt(this.oP.map.offsetMapY)+MMap.getScrollTop();
 var rpm=this.oP.map.s2r(new MPoint(x,y),this.oP.map.zid);
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].call(this.oP.map,MEvent.clickedOverlay,rpm);
}
 MEvent.clickedOverlay=null;
}
};
 
 mb.prototype.mclick=function(e,right){
 if(!this.clickflg || this.oP.map.smoothzoomby !=0)return;
 
 if(MEvent.EventMClickQueue["PmDf"]){
 MEvent.EventMClickQueue=new Array();
 return;
}
 
 var cb=null;
 if(cb=MEvent.hash[this.oP.map.id+"click"]){
 if(!e)e=window.event;
 var x=MMap.getClientX(e)-parseInt(this.oP.map.offsetMapX)+MMap.getScrollLeft();
 var y=MMap.getClientY(e)-parseInt(this.oP.map.offsetMapY)+MMap.getScrollTop();
 var rpm=this.oP.map.s2r(new MPoint(x,y),this.oP.map.zid);
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].call(this.oP.map,MEvent.clickedOverlay,rpm);
}
 MEvent.clickedOverlay=null;
}
};
 
 mb.prototype.mwheel=function(e){
 var mapdiv=this;
 
 var cb=null;
 if(cb=MEvent.hash[mapdiv.oP.map.id+"wheel"]){
 if(!e)e=window.event;
 var rollcount;
 if(MBrowser.safari3 && e.wheelDelta==0){
 rollcount=0;
}else{
 if(e.wheelDelta){
 rollcount=e.wheelDelta/120;
 if(MBrowser.safari)rollcount=e.wheelDelta/12;
 if(MBrowser.opera && !MBrowser.opera92up)rollcount=-rollcount;
}else if(e.detail){
 rollcount=e.detail/(-3);
}
 if(rollcount>0){
 rollcount=1;
}else{
 rollcount=-1;
}
}
 
 if(e.preventDefault)e.preventDefault();
 e.returnValue=false;
 
 if(rollcount==0){
 return;
}
 
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].call(mapdiv.oP.map,rollcount);
}
}
};
 function MEvent(){};
 MEvent.hash=new Array();
 MEvent.documentMMoveReturnCode=true;
 MEvent.documentMUpReturnCode=true;
 MEvent.documentMDownReturnCode=true;
 MEvent.addListener=function(obj,type,callback){
 if(!MEvent.hash[obj.id+type])MEvent.hash[obj.id+type]=new Array();
 var funcAry=MEvent.hash[obj.id+type];
 var idx=funcAry.length;
 funcAry[idx]=callback;
 var tokun=obj.id+type+"_"+idx;
 if(obj instanceof MMarker){
 var mobj=null;
 if(MBrowser.ie5up){
 mobj=obj.div;
}else{
 if(obj.ia_){
 mobj=obj.ia_;
}else{
 mobj=obj.div;
}
}
 if(type=="mousedown"){
 mobj.onmousedown=function(e){
 if(obj.draggable){
 obj.dragstart();
}else{
 MEvent.EventMDownQueue["PmDf"]=1;
 var cb=MEvent.hash[obj.id+type];
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 obj.eventRedirect.call(this,cb[i],obj);
}
}
}
}else{
 mobj["on"+type]=function(){
 if(type!="mouseover" && type!="mouseout" && type!="mouseup"){
 MEvent.EventMClickQueue["PmDf"]=1;
}
 var cb=MEvent.hash[obj.id+type];
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 obj.eventRedirect.call(this,cb[i],obj);
}
}
 if(!mobj.onmousedown){
 mobj.onmousedown=function(e){
 MEvent.EventMDownQueue["PmDf"]=1;
}
}
}
}
 return tokun;
};
 MEvent.clearListener=function(obj,type){
 delete MEvent.hash[obj.id+type];
};
 MEvent.clearListeners=function(obj,type){
 delete MEvent.hash[obj.id+type];
};
 MEvent.removeListener=function(listener){
 if(typeof(listener)!=typeof("s"))return;
 var key=listener.split("_");
 delete MEvent.hash[key[0]][parseInt(key[1])];
};
 MEvent.trigger=function(obj,type){
 var args=new Array();
 for(var i=2;i<arguments.length;i++)args[i-2]=arguments[i];
 if(obj instanceof MMap){
 var cb=null;
 if(cb=MEvent.hash[obj.id+type]){
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].apply(this,args);
}
}
}
 if(obj instanceof MMarker){
 var cb=null;
 if(cb=MEvent.hash[obj.id+type]){
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 obj.eventRedirect.call(obj.div,cb[i],obj,args);
}
}
}
};
 MEvent.bind=function(srcobj,type,destobj,method){
 MEvent.addListener(srcobj,type,method);
};
 
 MEvent.DocumentAddListener=function(type,callback){
 switch(type){
 case "mousemove": 
 document.onmousemove=function(e){
 MEvent.DefaultDocumentMouseMoveHandler.call(this,e);
 callback.call(this,e);
 return MEvent.documentMMoveReturnCode;
};
 break;
 case "mousedown": 
 break;
 case "mouseup": 
 break;
}
};
 
 MEvent.EventMDownQueue=new Array();
 MEvent.EventMClickQueue=new Array();
 
 MEvent.clickedOverlay=null;
 
 MEvent.EventMUpQueue=new Array();
 
 MEvent.mouseOutOfWindowFuncs=new Array();
 
 
 document.onmousemove=function(e){MEvent.DefaultDocumentMouseMoveHandler.call(this,e);return MEvent.documentMMoveReturnCode;};
 document.onmouseup=function(e){MEvent.DefaultDocumentMouseUpHandler.call(this,e);return MEvent.documentMUpReturnCode;};
 document.onmousedown=function(e){MEvent.DefaultDocumentMouseDownHandler.call(this,e);return MEvent.documentMDownReturnCode;};
 
 document.onmouseout=function(e){
 if(!e)e=window.event;
 var x=MMap.getClientX(e);
 var y=MMap.getClientY(e);
 
 var mx=window.innerWidth;
 var my=window.innerHeight;
 
 if(x<0 || y<0 || x>=mx || y>=my){
 MEvent.DefaultDocumentMouseUpHandler.call(this,e);
}
 
 if(!document.all && e.relatedTarget==null){
 MEvent.DefaultDocumentMouseUpHandler.call(this,e);
}
};
 
 
 function getWindowX(){
 return(window.screenX)?window.screenX:window.screenLeft;
};
 function getWindowY(){
 return(window.screenY)?window.screenY:window.screenTop;
};
 
 
 
 MEvent.DefaultDocumentMouseMoveHandler=null;
 MEvent.DefaultDocumentMouseDownHandler=null;
 MEvent.DefaultDocumentMouseUpHandler=null;
 
 MEvent.DefaultDocumentMouseMoveHandler=mb.DefaultDocumentMouseMove;
 
 MEvent.DefaultDocumentMouseDownHandler=
 function(e){
 if(!e)e=window.event;
 if(MEvent.EventMDownQueue["PmDf"]){
 MMap.CurrentMap.div.style.cursor="auto";
 MMap.CurrentMap=null;
}else if(MMap.CurrentMap){
 if(e.preventDefault)e.preventDefault();
}
 MEvent.EventMDownQueue=new Array();
};
 
 MEvent.DefaultDocumentMouseUpHandler=
 function(e){
 try{
 for(var i=0;i<MEvent.mouseOutOfWindowFuncs.length;i++){
 MEvent.mouseOutOfWindowFuncs[i].callback.call(MEvent.mouseOutOfWindowFuncs[i].obj,e);
}
 MEvent.EventMUpQueue=new Array();
 MMap.CurrentMap=null;
}catch(e){/*alert(e);*/}
};
 
 function cancelBubble(e){
 if(window.event){window.event.cancelBubble=true}
 else{
 e.cancelBubble=true;
 e.stopPropagation();
}
};
 
 function MDEBUG(){};
 MDEBUG.trace=function(_s,_w,_h){
 if(!MDEBUG.enable)return;
 if(MDEBUG.DIV==null){
 if(!_w)_w="450px";
 if(!_h)_h="600px";
 MDEBUG.DIV=document.createElement("DIV");
 MDEBUG.DIV.id="kdrivedebugwin";
 var s=MDEBUG.DIV.style;
 s.position="absolute";
 s.right="0px";
 s.top="0px";
 s.border="3px solid #000000";
 s.width=_w;
 s.height=_h;
 s.zIndex=9999;
 s.overflow="hidden";
 s.fontSize="small";
 document.body.appendChild(MDEBUG.DIV);
 
 var headerDiv=document.createElement("DIV");
 headerDiv.innerHTML="*KDrive DEBUG MESSAGES<a href='javascript:void(0);' onclick='MDEBUG.clear();return false;'>[CLEAR]</a><BR>";
 var s=headerDiv.style;
 s.backgroundColor=MDEBUG.c1;
 s.border="1px solid #000000";
 MDEBUG.DIV.appendChild(headerDiv);
 
 MDEBUG.AREA=document.createElement("DIV");
 s=MDEBUG.AREA.style;
 s.height="100%";
 s.backgroundColor="#FFFFFF";
 s.overflow="scroll";
 MDEBUG.DIV.appendChild(MDEBUG.AREA);
 
 var flg=0;
 headerDiv.onclick=function(e){
 var n=flg%2;
 if(MBrowser.ie5up){
 if(n==0){
 MDEBUG.DIV.style.height=_h;
}else if(n==1){
 MDEBUG.DIV.style.height=headerDiv.offsetHeight+"px";
}
}else{
 if(n==0){
 MDEBUG.DIV.style.height=_h;
}else if(n==1){
 MDEBUG.DIV.style.height=headerDiv.offsetHeight+"px";
}
}
 flg++;
 if(e.preventDefault)e.preventDefault();
 e.returnValue=false;
}
 headerDiv.onmousedown=function(e){return false;}
 var mdx=null;var mdy=null;var dvr=null;var dvt=null;
 MDEBUG.DIV.onmousedown=function(e){
 if(!e)e=window.event;
 mdx=e.clientX;
 mdy=e.clientY;
 dvr=parseInt(MDEBUG.DIV.style.right);
 dvt=parseInt(MDEBUG.DIV.style.top);
}
 MDEBUG.DIV.onmousemove=function(e){
 if(mdx&&false){
 if(!e)e=window.event;
 var vx=mdx-e.clientX;
 var vy=mdy-e.clientY;
 MDEBUG.DIV.style.right=(dvr+vx)+"px";
 MDEBUG.DIV.style.top=(dvt-vy)+"px";
 mdx=e.clientX;
 mdy=e.clientY;
 dvr=parseInt(MDEBUG.DIV.style.right);
 dvt=parseInt(MDEBUG.DIV.style.top);
}
}
 MDEBUG.DIV.onmouseup=function(e){
 mdx=null;
}
}
 var color="";
 if(MDEBUG.cols%2==0){color=MDEBUG.c2;}else{color=MDEBUG.c3;}
 MDEBUG.cols++;
 var str=MDEBUG.cols+':'+_s;
 var col='<div style="border-bottom:1px dotted #000000;background-color:'+color+';">'+str+'</div>';
 MDEBUG.AREA.innerHTML=MDEBUG.AREA.innerHTML+col;
 MDEBUG.AREA.scrollTop=9999;
};
 MDEBUG.clear=function(){
 MDEBUG.AREA.innerHTML="";
 return false;
};
 MDEBUG.DIV=null;
 MDEBUG.enable=false;
 MDEBUG.cols=0;
 
 MDEBUG.c1="#CCCCFF";
 MDEBUG.c2="#FFFFCC";
 MDEBUG.c3="#CCFFFF";
 MDEBUG.funcName="";
 MDEBUG.time=0;
 MDEBUG.call=0;
 MDEBUG.sum=0;
 MDEBUG.avg=0;
 MDEBUG.min=9999;
 MDEBUG.max=0;
 MDEBUG.tableH="<table border=1 bgcolor="+MDEBUG.c1+">";
 MDEBUG.tableT="<tr><td>name</td><td>time</td><td>calls</td><td>sumTime</td><td>avgTime</td><td>minTime</td><td>maxTime</td></tr>";
 MDEBUG.tableB="";
 MDEBUG.tableF="</table>";
 MDEBUG.profileFunc=function(obj,func){
 MDEBUG.initProfileFunc();
 MDEBUG.funcName=func;
 if(obj){
 var entry=obj[func];
 obj[func]=function(){
 var st=new Date().getTime();
 entry.apply(obj,arguments);
 var et=new Date().getTime();
 MDEBUG.traceProfileFunc(st,et);
}
}else{
 var entry=window[func];
 window[func]=function(){
 var st=new Date().getTime();
 entry.apply(window,arguments);
 var et=new Date().getTime();
 MDEBUG.traceProfileFunc(st,et);
}
}
}
 MDEBUG.initProfileFunc=function(){
 MDEBUG.enable=true;
 MDEBUG.trace("");
 MDEBUG.AREA.innerHTML="";
 MDEBUG.cols=0;
}
 MDEBUG.traceProfileFunc=function(st,et){
 MDEBUG.time=et-st;
 MDEBUG.call++;
 MDEBUG.sum+=MDEBUG.time;
 MDEBUG.avg=(MDEBUG.sum/MDEBUG.call).toFixed(2);
 MDEBUG.min=MDEBUG.min>MDEBUG.time?MDEBUG.time:MDEBUG.min;
 MDEBUG.max=MDEBUG.max<MDEBUG.time?MDEBUG.time:MDEBUG.max;
 var color="";
 if(MDEBUG.cols%2==0){color=MDEBUG.c2;}else{color=MDEBUG.c3;}
 var rec="<tr bgcolor="+color+">" 
+"<td>"+MDEBUG.funcName+"</td>" 
+"<td>"+MDEBUG.time+"</td>" 
+"<td>"+MDEBUG.call+"</td>" 
+"<td>"+MDEBUG.sum+"</td>" 
+"<td>"+MDEBUG.avg+"</td>" 
+"<td>"+MDEBUG.min+"</td>" 
+"<td>"+MDEBUG.max+"</td>" 
+"</tr>";
 if(MDEBUG.cols%10==0){
 MDEBUG.tableB=MDEBUG.tableB+MDEBUG.tableT+rec;
}else{
 MDEBUG.tableB=MDEBUG.tableB+rec;
}
 MDEBUG.cols++;
 MDEBUG.AREA.innerHTML=MDEBUG.tableH+MDEBUG.tableB+MDEBUG.tableF;
 MDEBUG.AREA.scrollTop=9999;
}
 M_ANCHOR_TOP_LEFT=0;
 M_ANCHOR_TOP_RIGHT=1;
 M_ANCHOR_BOTTOM_LEFT=2;
 M_ANCHOR_BOTTOM_RIGHT=3;
 
 
 
 function MLargeMapControl(){
 this.id="lmctr"+MLargeMapControl.ID++;
 this.map=null;
 this.div=null;
 this.scaleImg=["scale_26000000.gif","scale_5000000.gif","scale_3000000.gif","scale_1000000.gif","scale_500000.gif","scale_250000.gif","scale_70000.gif","scale_25000.gif","scale_10000.gif","scale_5000.gif"];
 var preLoader=new Array(10);
 for(i=0;i<preLoader.length;i++){
 preLoader[i]=new Image();
 preLoader[i].src=MMap.IMGPATH+"img/mcontrol/"+this.scaleImg[i];
}
 this.scale_list=null;
};
 MLargeMapControl.ID=0;
 MLargeMapControl.prototype.show=function(){
 this.div=document.createElement("DIV");
 this.div.oP=this;
 this.div.style.position="absolute";
 this.div.style.left="10px";
 this.div.style.top="10px";
 this.div.id=this.id+"div";
 this.div.style.zIndex=200;
 var _mmap=this.map;
 this.div.onmouseup=function(){_mmap.focuselem.focus();};
 this.map.basediv.appendChild(this.div);
 this.smoothZoom=false;
 this.autoScaleSmooth=true;
 
 var s="";
 s+="<table border=0 cellpadding=0 cellspacing=2 id=cntarea"+this.id+">";
 s+="<tr>";
 s+="<td>";
 s+="<div id=moveleftup"+this.id+" style='font-size:1px;'>";
 s+="<img src='"+MMap.IMGPATH+"img/mcontrol/mvlu.png' style='vertical-align:bottom;'>";
 s+="</div>";
 s+="</td>";
 s+="<td>";
 s+="<div id=moveup"+this.id+" style='font-size:1px;'>";
 s+="<img src='"+MMap.IMGPATH+"img/mcontrol/mvu.png' style='vertical-align:bottom;'>";
 s+="</div>";
 s+="</td>";
 s+="<td>";
 s+="<div id=moverightup"+this.id+" style='font-size:1px;'>";
 s+="<img src='"+MMap.IMGPATH+"img/mcontrol/mvru.png' style='vertical-align:bottom;'>";
 s+="</div>";
 s+="</td>";
 s+="</tr>";
 s+="<tr>";
 s+="<td>";
 s+="<div id=moveleft"+this.id+" style='font-size:1px;'>";
 s+="<img src='"+MMap.IMGPATH+"img/mcontrol/mvl.png' style='vertical-align:bottom;'>";
 s+="</div>";
 s+="</td>";
 s+="<td>";
 s+="<div id=movecenter"+this.id+" style='font-size:1px;'>";
 s+="<img src='"+MMap.IMGPATH+"img/mcontrol/mvc.png' style='vertical-align:bottom;'>";
 s+="</div>";
 s+="</td>";
 s+="<td>";
 s+="<div id=moveright"+this.id+" style='font-size:1px;'>";
 s+="<img src='"+MMap.IMGPATH+"img/mcontrol/mvr.png' style='vertical-align:bottom;'>";
 s+="</div>";
 s+="</td>";
 s+="</tr>";
 s+="<tr>";
 s+="<td>";
 s+="<div id=moveleftdown"+this.id+" style='font-size:1px;'>";
 s+="<img src='"+MMap.IMGPATH+"img/mcontrol/mvld.png' style='vertical-align:bottom;'>";
 s+="</div>";
 s+="</td>";
 s+="<td>";
 s+="<div id=movedown"+this.id+" style='font-size:1px;'>";
 s+="<img src='"+MMap.IMGPATH+"img/mcontrol/mvd.png' style='vertical-align:bottom;'>";
 s+="</div>";
 s+="</td>";
 s+="<td>";
 s+="<div id=moverightdown"+this.id+" style='font-size:1px;'>";
 s+="<img src='"+MMap.IMGPATH+"img/mcontrol/mvrd.png' style='vertical-align:bottom;'>";
 s+="</div>";
 s+="</td>";
 s+="</tr>";
 s+="<tr height='8'>";
 s+="<td colspan='3'>";
 s+="</td>";
 s+="</tr>";
 s+="<tr>";
 s+="<td colspan='3' align='center'>";
 s+="<table border=0 cellpadding=0 cellspacing=0>";
 s+="<tr>";
 s+="<td align='center'>";
 s+="<div style='font-size:1px;'>";
 s+="<img src='"+MMap.IMGPATH+"img/mcontrol/scroll_bar_up.png' id=zoomin"+this.id+" style='vertical-align:bottom;'>";
 s+="</div>";
 s+="</td>";
 s+="</tr>";
 s+="<tr>";
 s+="<td align='center'>";
 s+="<div id=zoomarea"+this.id+" style='font-size:1px;'>";
 s+="<table border=0 cellpadding=0 cellspacing=0>";
 s+="<tr>";
 s+="<td align='center' style='font-size:1px'>";
 s+="<img src='"+MMap.IMGPATH+"img/mcontrol/scroll_bar_bar1.png' id=zoombar"+this.id+" style='vertical-align:bottom;'>";
 s+="<div id=zbar"+this.id+" style='font-size:1px;'>";
 s+="</div>";
 s+="</td>";
 s+="</tr>";
 s+="</table>";
 s+="</div>";
 s+="</td>";
 s+="</tr>";
 s+="<tr>";
 s+="<td align='center'>";
 s+="<div style='font-size:1px;'>";
 s+="<img src='"+MMap.IMGPATH+"img/mcontrol/scroll_bar_down.png' id=zoomout"+this.id+" style='vertical-align:bottom;'>";
 s+="</div>";
 s+="</td>";
 s+="</tr>";
 s+="</table>";
 s+="</td>";
 s+="</tr>";
 s+="</table>";
 this.div.innerHTML=s;
 
 this.zoomdiv=document.getElementById("zoomarea"+this.id);
 this.zoomcur=document.createElement("IMG");
 this.zoomcur.src=MMap.IMGPATH+"img/mcontrol/scroll_btn.png";
 this.zoomdiv.appendChild(this.zoomcur);
 this.zoomdiv.style.position="relative";
 this.zoomcur.id="zoomcur"+this.id;
 this.zoomcur.style.position="absolute";
 this.zoomcur.style.left=0+"px";
 this.zoomcur.style.top=0+"px";
 this.zbar=document.getElementById("zbar"+this.id);
 
 if(!this.maxzoomlevel){
 this.setMaxZoomLevel(9);
}
 
 this.z_=document.createElement("DIV");
 this.z_.id="zoomlevel"+this.id;
 this.z_.style.position="absolute";
 this.z_.style.left=24+"px";
 this.z_img=document.createElement("IMG");
 this.z_.appendChild(this.z_img);
 this.zoomdiv.appendChild(this.z_);
 this.z_img.src=MMap.IMGPATH+"img/mcontrol/scale.png";
 this.z_img.style.position="absolute";
 this.z_img.style.left=0+"px";
 this.z_img.style.top=0+"px";
 this.z_.style.display="none";
 this.zoomcur.oP=this;
 this.zoomcur.onmouseover=this.visibleZoomLevel;
 this.zoomcur.onmouseout=this.hiddenZoomLevel;
 this.zoombar=document.getElementById("zoombar"+this.id);
 this.zoombar.oP=false;
 
 
 this.zlu=document.getElementById("moveleftup"+this.id);
 this.zlu.oP=this;
 this.zlu.onmousedown=this.moveLeftUp;
 
 this.zu=document.getElementById("moveup"+this.id);
 this.zu.oP=this;
 this.zu.onmousedown=this.moveUp;
 
 this.zru=document.getElementById("moverightup"+this.id);
 this.zru.oP=this;
 this.zru.onmousedown=this.moveRightUp;
 
 this.zl=document.getElementById("moveleft"+this.id);
 this.zl.oP=this;
 this.zl.onmousedown=this.moveLeft;
 
 this.zc=document.getElementById("movecenter"+this.id);
 this.zc.oP=this;
 this.zc.onmousedown=null;
 
 this.zr=document.getElementById("moveright"+this.id);
 this.zr.oP=this;
 this.zr.onmousedown=this.moveRight;
 
 this.zld=document.getElementById("moveleftdown"+this.id);
 this.zld.oP=this;
 this.zld.onmousedown=this.moveLeftDown;
 
 this.zd=document.getElementById("movedown"+this.id);
 this.zd.oP=this;
 this.zd.onmousedown=this.moveDown;
 
 this.zrd=document.getElementById("moverightdown"+this.id);
 this.zrd.oP=this;
 this.zrd.onmousedown=this.moveRightDown;
 
 this.zi=document.getElementById("zoomin"+this.id);
 this.zi.oP=this;
 this.zi.onmousedown=this.zoomIn;
 
 this.zo=document.getElementById("zoomout"+this.id);
 this.zo.oP=this;
 this.zo.onmousedown=this.zoomOut;
 
 this.zb=document.getElementById("zoomarea"+this.id);
 this.zb.oP=this;
 this.zb.flag=0;
 this.zb.onmousedown=this.zoomMove;
 
 this.setZoomLevel(this.div.oP.map.zid);
};
 
 MLargeMapControl.prototype.setPosition=function(pos){
 pos.apply(this.div);
};
 MLargeMapControl.prototype.moveLeftUp=function(){
 var vx=-300;var vy=-300;
 var mmap=this.oP.map;
 var curpp=mmap.r2p(mmap.updateCenterRP(),mmap.zid);
 mmap.smoveToPPoint(curpp.add(vx,vy));
};
 MLargeMapControl.prototype.moveUp=function(){
 var vx=0;var vy=-300;
 var mmap=this.oP.map;
 var curpp=mmap.r2p(mmap.updateCenterRP(),mmap.zid);
 mmap.smoveToPPoint(curpp.add(vx,vy));
};
 MLargeMapControl.prototype.moveRightUp=function(){
 var vx=300;var vy=-300;
 var mmap=this.oP.map;
 var curpp=mmap.r2p(mmap.updateCenterRP(),mmap.zid);
 mmap.smoveToPPoint(curpp.add(vx,vy));
};
 MLargeMapControl.prototype.moveLeft=function(){
 var vx=-300;var vy=0;
 var mmap=this.oP.map;
 var curpp=mmap.r2p(mmap.updateCenterRP(),mmap.zid);
 mmap.smoveToPPoint(curpp.add(vx,vy));
};
 MLargeMapControl.prototype.moveCenter=function(){
 this.oP.map.recenterOrPanToLatLng(this.oP.map.startlatlng);
};
 MLargeMapControl.prototype.moveRight=function(){
 var vx=300;var vy=0;
 var mmap=this.oP.map;
 var curpp=mmap.r2p(mmap.updateCenterRP(),mmap.zid);
 mmap.smoveToPPoint(curpp.add(vx,vy));
};
 MLargeMapControl.prototype.moveLeftDown=function(){
 var vx=-300;var vy=300;
 var mmap=this.oP.map;
 var curpp=mmap.r2p(mmap.updateCenterRP(),mmap.zid);
 mmap.smoveToPPoint(curpp.add(vx,vy));
};
 MLargeMapControl.prototype.moveDown=function(){
 var vx=0;var vy=300;
 var mmap=this.oP.map;
 var curpp=mmap.r2p(mmap.updateCenterRP(),mmap.zid);
 mmap.smoveToPPoint(curpp.add(vx,vy));
};
 MLargeMapControl.prototype.moveRightDown=function(){
 var vx=300;var vy=300;
 var mmap=this.oP.map;
 var curpp=mmap.r2p(mmap.updateCenterRP(),mmap.zid);
 mmap.smoveToPPoint(curpp.add(vx,vy));
};
 MLargeMapControl.prototype.zoomIn=function(){
 if(!this.oP.map.moving){
 var zl=this.oP.map.zid+1;
 if(zl>this.oP.maxzoomlevel)zl=this.oP.maxzoomlevel;
 this.oP.setZoomLevel(zl);
 if(this.oP.smoothZoom){
 this.oP.map.smoothzoomin(1);
}
}
};
 MLargeMapControl.prototype.zoomOut=function(){
 if(!this.oP.map.moving){
 var zl=this.oP.map.zid-1;
 if(zl<0)zl=0;
 this.oP.setZoomLevel(zl);
 if(this.oP.smoothZoom){
 this.oP.map.smoothzoomout(1);
}
}
};
 MLargeMapControl.prototype.visibleZoomLevel=function(){
 var zl=this.oP.z_;
 zl.style.display="block";
};
 MLargeMapControl.prototype.hiddenZoomLevel=function(){
 var zl=this.oP.z_;
 zl.style.display="none";
};
 MLargeMapControl.prototype.getZoomLevel=function(){
 var zbb=document.getElementById("zoombar"+this.id);
 var zbc=this.zoomcur;
 var zbbheight=zbb.height*(this.maxzoomlevel+1);
 var heightv=zbbheight;
 var topv=Number(zbc.style.top.substring(0,zbc.style.top.length-2));
 var selectv=this.maxzoomlevel-Math.round(topv/(heightv/(this.maxzoomlevel+1)));
 return selectv;
};
 MLargeMapControl.prototype.setBarPosition=function(value){
 var zbb=document.getElementById("zoombar"+this.id);
 var zbc=this.zoomcur;
 var zbl=this.z_;
 var zbbheight=zbb.height*(this.maxzoomlevel+1);
 zbbheight=13*(this.maxzoomlevel+1);
 var heightv=zbbheight;
 var topv=Number(zbc.style.top.substring(0,zbc.style.top.length-2));
 var setv=Math.round((this.maxzoomlevel-value)*(heightv/(this.maxzoomlevel+1)))+1;
 zbc.style.top=setv+"px";
 zbl.style.top=(setv-3)+"px";
 this.z_img.src=MMap.IMGPATH+"img/mcontrol/"+this.scaleImg[value];
};
 MLargeMapControl.prototype.setZoomLevel=function(value){
 this.setBarPosition(value);
 if(!this.smoothZoom){
 this.map.changeZoom(value);
}
};
 MLargeMapControl.prototype.setMaxZoomLevel=function(value){
 if(this.getZoomLevel()>value){
 this.setZoomLevel(value);
}
 this.maxzoomlevel=value;
 this.zbar=document.getElementById("zbar"+this.id);
 var zbs="";
 for(i=0;i<this.maxzoomlevel;i++){
 zbs+="<table border=0 cellpadding=0 cellspacing=0>";
 zbs+="<tr>";
 zbs+="<td align='center' style='font-size:1px'>";
 zbs+="<img src='"+MMap.IMGPATH+"img/mcontrol/scroll_bar_bar1.png' style='vertical-align:bottom;'>";
 zbs+="</td>";
 zbs+="</tr>";
 zbs+="</table>";
}
 this.zbar.innerHTML=zbs;
};
 MLargeMapControl.prototype.zoomMove=function(e){
 var pobj=this.oP;
 var zba=pobj.div;
 var zbb=document.getElementById("zoombar"+pobj.id);
 var zbc=pobj.zoomcur;
 var zbl=pobj.z_;
 var zbt=pobj.z_img;
 var zbbheight=zbb.height*(pobj.maxzoomlevel+1);
 var offsetMapY=pobj.map.offsetMapY;
 var cmove=function(e){
 if(!e)e=window.event;
 if(MBrowser.safari2)
 var posy=e.clientY;
 else 
 var posy=e.clientY+MMap.getScrollTop();
 var barpos=posy-offsetMapY-parseInt(zba.style.top)-103;
 if(barpos<0){
 barpos=0;
}
 if(barpos>zbbheight-zbc.height){
 barpos=zbbheight-zbc.height;
}
 zbc.style.top=barpos+"px";
 zbl.style.top=(barpos-3)+"px";
 var zlv=pobj.getZoomLevel();
 zbt.src=MMap.IMGPATH+"img/mcontrol/"+pobj.scaleImg[zlv];
 try{
 e.preventDefault();
}catch(err){
 event.returnValue=false;
}
};
 
 var zbaobj=zba;
 zba.onmousemove=function(e){
 cmove(e);
};
 
 zba.onmouseup=function(e){
 zbaobj.onmousemove=null;
 zbaobj.onmouseup=null;
 var value=pobj.getZoomLevel();
 pobj.setZoomLevel(value);
 if(this.oP.smoothZoom){
 pobj.map.changeZoom(value);
}
};
 cmove(e);
};
 MLargeMapControl.prototype.setSmoothZoom=function(value){
 this.smoothZoom=value;
};
 MLargeMapControl.prototype.disable=function(){
 var s=this.getScaleList();
 var maxzoomlevel=this.map.adp.zoomInMax;
 for(c=0;c<s.length;c++){
 if(s[c]!=null){
 maxzoomlevel=c;
 this.map.adp.zoomInMax=c;
}
}
 var lid=this.map.zid;
 if(maxzoomlevel<lid){
 zl=lid-1;
 if(zl<=0){
 zl=0;
}
 if(this.autoScaleSmooth){
 this.map.smoothzoomout(1);
}else{
 this.setZoomLevel(zl);
}
}
};
 MLargeMapControl.prototype.setScaleList=function(_scale_list){
 this.scale_list=_scale_list;
};
 MLargeMapControl.prototype.getScaleList=function(){
 return this.scale_list;
};
 MLargeMapControl.prototype.zoomUpdate=function(){
 this.setBarPosition(this.map.getZoomLevel());
};
 
 function MSmallMapControl(){
 this.id="smctr"+MSmallMapControl.ID++;
 this.map=null;
 this.div=null;
 this.scale_list=null;
};
 MSmallMapControl.ID=0;
 MSmallMapControl.prototype.show=function(){
 this.div=document.createElement("DIV");
 this.div.oP=this;
 this.div.style.position="absolute";
 this.div.style.left="10px";
 this.div.style.top="10px";
 this.div.id=this.id+"div";
 this.div.style.zIndex=200;
 var _mmap=this.map;
 this.div.onmouseup=function(){_mmap.focuselem.focus();};
 
 this.map.basediv.appendChild(this.div);
 this.smoothZoom=false;
 this.autoScaleSmooth=true;
 
 var s="";
 s+="<table border=0 cellpadding=0 cellspacing=4>";
 s+="<tr>";
 s+="<td colspan='2' align='center'>";
 s+="<div id=moveup"+this.id+" style='font-size:1px;'>";
 s+="<img src='"+MMap.IMGPATH+"img/mcontrol/mvu.png' style='vertical-align:bottom;'>";
 s+="</div>";
 s+="</td>";
 s+="</tr>";
 s+="<tr>";
 s+="<td>";
 s+="<div id=moveleft"+this.id+" style='font-size:1px;'>";
 s+="<img src='"+MMap.IMGPATH+"img/mcontrol/mvl.png' style='vertical-align:bottom;'>";
 s+="</div>";
 s+="</td>";
 s+="<td>";
 s+="<div id=moveright"+this.id+" style='font-size:1px;'>";
 s+="<img src='"+MMap.IMGPATH+"img/mcontrol/mvr.png' style='vertical-align:bottom;'>";
 s+="</div>";
 s+="</td>";
 s+="</tr>";
 s+="<tr>";
 s+="<td colspan='2' align='center'>";
 s+="<div id=movedown"+this.id+" style='font-size:1px;'>";
 s+="<img src='"+MMap.IMGPATH+"img/mcontrol/mvd.png' style='vertical-align:bottom;'>";
 s+="</div>";
 s+="</td>";
 s+="</tr>";
 s+="<tr height='8'>";
 s+="<td>";
 s+="</td>";
 s+="</tr>";
 s+="<tr>";
 s+="<td colspan='2' align='center'>";
 s+="<div id=zoomin"+this.id+" style='font-size:1px;'>";
 s+="<img src='"+MMap.IMGPATH+"img/mcontrol/mvup.png' style='vertical-align:bottom;'>";
 s+="</div>";
 s+="</td>";
 s+="</tr>";
 s+="<tr>";
 s+="<td colspan='2' align='center'>";
 s+="<div id=zoomout"+this.id+" style='font-size:1px;'>";
 s+="<img src='"+MMap.IMGPATH+"img/mcontrol/mvdown.png' style='vertical-align:bottom;'>";
 s+="</div>";
 s+="</td>";
 s+="</tr>";
 s+="</table>";
 this.div.innerHTML=s;
 
 this.zu=document.getElementById("moveup"+this.id);
 this.zu.oP=this;
 this.zu.onmousedown=this.moveUp;
 
 this.zl=document.getElementById("moveleft"+this.id);
 this.zl.oP=this;
 this.zl.onmousedown=this.moveLeft;
 
 this.zr=document.getElementById("moveright"+this.id);
 this.zr.oP=this;
 this.zr.onmousedown=this.moveRight;
 
 this.zd=document.getElementById("movedown"+this.id);
 this.zd.oP=this;
 this.zd.onmousedown=this.moveDown;
 this.zd.onfocus=this.moveFocus;
 
 this.zi=document.getElementById("zoomin"+this.id);
 this.zi.oP=this;
 this.zi.onmousedown=this.zoomIn;
 
 this.zo=document.getElementById("zoomout"+this.id);
 this.zo.oP=this;
 this.zo.onmousedown=this.zoomOut;
};
 MSmallMapControl.prototype.setPosition=function(pos){
 pos.apply(this.div);
};
 MSmallMapControl.prototype.moveUp=function(){
 var vx=0;var vy=-300;
 var mmap=this.oP.map;
 var curpp=mmap.r2p(mmap.updateCenterRP(),mmap.zid);
 mmap.smoveToPPoint(curpp.add(vx,vy));
};
 MSmallMapControl.prototype.moveLeft=function(){
 var vx=-300;var vy=0;
 var mmap=this.oP.map;
 var curpp=mmap.r2p(mmap.updateCenterRP(),mmap.zid);
 mmap.smoveToPPoint(curpp.add(vx,vy));
};
 MSmallMapControl.prototype.moveRight=function(){
 var vx=300;var vy=0;
 var mmap=this.oP.map;
 var curpp=mmap.r2p(mmap.updateCenterRP(),mmap.zid);
 mmap.smoveToPPoint(curpp.add(vx,vy));
};
 MSmallMapControl.prototype.moveDown=function(){
 var vx=0;var vy=300;
 var mmap=this.oP.map;
 var curpp=mmap.r2p(mmap.updateCenterRP(),mmap.zid);
 mmap.smoveToPPoint(curpp.add(vx,vy));
};
 MSmallMapControl.prototype.moveFocus=function(){
 this.oP.map.focuselem.focus();
};
 MSmallMapControl.prototype.zoomIn=function(){
 if(!this.oP.map.moving){
 if(this.oP.smoothZoom){
 this.oP.map.smoothzoomin(1);
}else{
 this.oP.map.changeZoom(this.oP.map.zid+1);
}
}
};
 MSmallMapControl.prototype.zoomOut=function(){
 if(!this.oP.map.moving){
 if(this.oP.smoothZoom){
 this.oP.map.smoothzoomout(1);
}else{
 this.oP.map.changeZoom(this.oP.map.zid-1);
}
}
};
 MSmallMapControl.prototype.setSmoothZoom=function(value){
 this.smoothZoom=value;
};
 MSmallMapControl.prototype.disable=function(){
 var s=this.getScaleList();
 var maxzoomlevel=this.map.adp.zoomInMax;
 for(c=0;c<s.length;c++){
 if(s[c]!=null){
 maxzoomlevel=c;
 this.map.adp.zoomInMax=c;
}
}
 var lid=this.map.zid;
 if(maxzoomlevel<lid){
 zl=lid-1;
 if(zl<=0){
 zl=0;
}
 if(this.autoScaleSmooth){
 this.map.smoothzoomout(1);
}else{
 this.setZoomLevel(zl);
}
}
};
 MSmallMapControl.prototype.setScaleList=function(_scale_list){
 this.scale_list=_scale_list;
};
 MSmallMapControl.prototype.getScaleList=function(){
 return this.scale_list;
};
 MSmallMapControl.prototype.zoomUpdate=function(){
}
 
 function MSmallZoomControl(){
 this.id="szctr"+MSmallZoomControl.ID++;
 this.map=null;
 this.div=null;
 this.scale_list=null;
};
 MSmallZoomControl.ID=0;
 MSmallZoomControl.prototype.show=function(){
 this.div=document.createElement("DIV");
 this.div.oP=this;
 this.div.style.position="absolute";
 this.div.style.left="10px";
 this.div.style.top="10px";
 this.div.id=this.id+"div";
 this.div.style.zIndex=200;
 var _mmap=this.map;
 this.div.onmouseup=function(){_mmap.focuselem.focus();};
 
 this.map.basediv.appendChild(this.div);
 this.smoothZoom=false;
 this.autoScaleSmooth=true;
 
 var s="";
 s+="<table border=0 cellpadding=0 cellspacing=4>";
 s+="<tr>";
 s+="<td>";
 s+="<div id=zoomin"+this.id+" style='font-size:1px;'>";
 s+="<img src='"+MMap.IMGPATH+"img/mcontrol/mvup.png' style='vertical-align:bottom;'>";
 s+="</div>";
 s+="</td>";
 s+="</tr>";
 s+="<tr>";
 s+="<td>";
 s+="<div id=zoomout"+this.id+" style='font-size:1px;'>";
 s+="<img src='"+MMap.IMGPATH+"img/mcontrol/mvdown.png' style='vertical-align:bottom;'>";
 s+="</div>";
 s+="</td>";
 s+="</tr>";
 s+="</table>";
 this.div.innerHTML=s;
 
 
 this.zi=document.getElementById("zoomin"+this.id);
 this.zi.oP=this;
 this.zi.onmousedown=this.zoomIn;
 
 this.zo=document.getElementById("zoomout"+this.id);
 this.zo.oP=this;
 this.zo.onmousedown=this.zoomOut;
};
 MSmallZoomControl.prototype.setPosition=function(pos){
 pos.apply(this.div);
};
 MSmallZoomControl.prototype.zoomIn=function(){
 if(!this.oP.map.moving){
 if(this.oP.smoothZoom){
 this.oP.map.smoothzoomin(1);
}else{
 this.oP.map.changeZoom(this.oP.map.zid+1);
}
}
};
 MSmallZoomControl.prototype.zoomOut=function(){
 if(!this.oP.map.moving){
 if(this.oP.smoothZoom){
 this.oP.map.smoothzoomout(1);
}else{
 this.oP.map.changeZoom(this.oP.map.zid-1);
}
}
};
 MSmallZoomControl.prototype.setSmoothZoom=function(value){
 this.smoothZoom=value;
};
 MSmallZoomControl.prototype.disable=function(){
 var s=this.getScaleList();
 var maxzoomlevel=this.map.adp.zoomInMax;
 for(c=0;c<s.length;c++){
 if(s[c]!=null){
 maxzoomlevel=c;
 this.map.adp.zoomInMax=c;
}
}
 var lid=this.map.zid;
 if(maxzoomlevel<lid){
 zl=lid-1;
 if(zl<=0){
 zl=0;
}
 if(this.autoScaleSmooth){
 this.map.smoothzoomout(1);
}else{
 this.setZoomLevel(zl);
}
}
};
 MSmallZoomControl.prototype.setScaleList=function(_scale_list){
 this.scale_list=_scale_list;
};
 MSmallZoomControl.prototype.getScaleList=function(){
 return this.scale_list;
};
 MSmallZoomControl.prototype.zoomUpdate=function(){
}
 
 function MScaleControl(){
 this.id="scctr"+MScaleControl.ID++;
 this.map=null;
 this.div=null;
};
 MScaleControl.ID=0;
 MScaleControl.prototype.show=function(){
 this.div=document.createElement("DIV");
 this.div.oP=this;
 this.div.style.position="absolute";
 this.div.style.left="10px";
 this.div.style.top="10px";
 this.div.id=this.id+"div";
 this.div.style.zIndex=200;
 var _mmap=this.map;
 this.div.onmouseup=function(){_mmap.focuselem.focus();};
 this.map.basediv.appendChild(this.div);
 
 var s="";
 s+="<table border=0 cellpadding=0>";
 s+="<tr>";
 s+="<td>";
 s+="<div id=scale"+this.id+">";
 s+="</div>";
 s+="</td>";
 s+="</tr>";
 s+="</table>";
 this.div.innerHTML=s;
 
 this.setZoomLevel(this.map.zid);
 
};
 MScaleControl.prototype.setZoomLevel=function(value){
 ruler=[MMap.IMGPATH+"img/mcontrol/ruler_26000000.png",MMap.IMGPATH+"img/mcontrol/ruler_5000000.png",MMap.IMGPATH+"img/mcontrol/ruler_3000000.png",MMap.IMGPATH+"img/mcontrol/ruler_1000000.png",MMap.IMGPATH+"img/mcontrol/ruler_500000.png",
 MMap.IMGPATH+"img/mcontrol/ruler_250000.png",MMap.IMGPATH+"img/mcontrol/ruler_70000.png",MMap.IMGPATH+"img/mcontrol/ruler_25000.png",MMap.IMGPATH+"img/mcontrol/ruler_10000.png",MMap.IMGPATH+"img/mcontrol/ruler_5000.png"];
 this.s=document.getElementById("scale"+this.id);
 this.s.innerHTML="<img src='"+ruler[value]+"'>";
};
 MScaleControl.prototype.setPosition=function(pos){
 pos.apply(this.div);
};
 MScaleControl.prototype.zoomUpdate=function(){
 this.setZoomLevel(this.map.getZoomLevel());
}
 
 function MMapTypeControl(){
 this.id="mtctr"+MScaleControl.ID++;
 this.map=null;
 this.div=null;
};
 MMapTypeControl.ID=0;
 MMapTypeControl.prototype.show=function(){
 this.div=document.createElement("DIV");
 this.div.oP=this;
 this.div.style.position="absolute";
 this.div.style.left="10px";
 this.div.style.top="10px";
 this.div.id=this.id+"div";
 this.div.style.zIndex=200;
 this.map.basediv.appendChild(this.div);
 
 var s="";
 s+="<table border=0 cellpadding=0 cellspacing=4>";
 s+="<tr>";
 s+="<td>";
 s+="<div id=typemap"+this.id+">";
 s+="<img src='"+MMap.IMGPATH+"img/mcontrol/mvmap.png'>";
 s+="</div>";
 s+="</td>";
 s+="<td>";
 s+="<div id=typesat"+this.id+">";
 s+="<img src='"+MMap.IMGPATH+"img/mcontrol/mvsat.png'>";
 s+="</div>";
 s+="</td>";
 s+="</tr>";
 s+="</table>";
 this.div.innerHTML=s;
 
 
 this.zi=document.getElementById("typemap"+this.id);
 this.zi.oP=this;
 this.zi.onmousedown=this.typeMap;
 
 this.zs=document.getElementById("typesat"+this.id);
 this.zs.oP=this;
 this.zs.onmousedown=this.typeSat;
};
 MMapTypeControl.prototype.setPosition=function(pos){
 pos.apply(this.div);
};
 MMapTypeControl.prototype.typeMap=function(){
 this.oP.map.setMapType(M_MAP_TYPE);
};
 MMapTypeControl.prototype.typeSat=function(){
 this.oP.map.setMapType(IPC_SATELLITE_TYPE);
};
 MMapTypeControl.prototype.zoomUpdate=function(){
}
 
 function MControlPosition(anc,x,y){
 if(y){
 this.anchor=anc;
 this.offsetWidth=x;
 this.offsetHeight=y;
}else{
 this.anchor=anc;
 this.offsetWidth=x.width;
 this.offsetHeight=x.height;
}
};
 MControlPosition.prototype.apply=function(anc){
 if(this.anchor==M_ANCHOR_TOP_LEFT){
 anc.style.left=this.offsetWidth+"px";
 anc.style.right="";
 anc.style.top=this.offsetHeight+"px";
 anc.style.bottom="";
 anc.style.textAlign="left";
 anc.style.verticalAlign="top";
}
 if(this.anchor==M_ANCHOR_TOP_RIGHT){
 anc.style.left="";
 anc.style.right=this.offsetWidth+"px";
 anc.style.top=this.offsetHeight+"px";
 anc.style.bottom="";
 anc.style.textAlign="right";
 anc.style.verticalAlign="top";
}
 if(this.anchor==M_ANCHOR_BOTTOM_LEFT){
 anc.style.left=this.offsetWidth+"px";
 anc.style.right="";
 anc.style.top="";
 anc.style.bottom=this.offsetHeight+"px";
 anc.style.textAlign="left";
 anc.style.verticalAlign="bottom";
}
 if(this.anchor==M_ANCHOR_BOTTOM_RIGHT){
 anc.style.left="";
 anc.style.right=this.offsetWidth+"px";
 anc.style.top="";
 anc.style.bottom=this.offsetHeight+"px";
 anc.style.textAlign="right";
 anc.style.verticalAlign="bottom";
}
};
 
 
 
 function MControl(){
 this.id=null;
 this.map=null;
 this.div=null;
 this.scale_list=null;
 this.autoScaleSmooth=true;
};
 MControl.prototype.show=function(){};
 MControl.prototype.setPosition=function(pos){
 pos.apply(this.div);
};
 MControl.prototype.disable=function(){
 if(!this.map)return;
 var s=this.getScaleList();
 var maxzoomlevel=this.map.adp.zoomInMax;
 for(c=0;c<s.length;c++){
 if(s[c]!=null){
 maxzoomlevel=c;
 this.map.adp.zoomInMax=c;
}
}
 var lid=this.map.zid;
 if(maxzoomlevel<lid){
 zl=lid-1;
 if(zl<=0){
 zl=0;
}
 if(this.autoScaleSmooth){
 this.map.smoothzoomout(1);
}else{
 this.map.changeZoom(value);
}
}
};
 MControl.prototype.setScaleList=function(_scale_list){
 this.scale_list=_scale_list;
};
 MControl.prototype.getScaleList=function(){
 return this.scale_list;
};
 MControl.prototype.zoomUpdate=function(){};
 
 function MCustomMapControl(){
 this.id='cusctr'+MCustomMapControl.ID++;
};
 MCustomMapControl.ID=0;
 MCustomMapControl.prototype=new MControl();
 MCustomMapControl.prototype.show=function(){
 this.div=this.initialize(this.map);
 this.div.oP=this;
 this.div.style.position='absolute';
 this.div.style.left='10px';
 this.div.style.top='10px';
 this.div.id=this.id+'div';
 this.div.style.zIndex=200;
 this.map.basediv.appendChild(this.div);
};
 MCustomMapControl.prototype.initialize=function(map){
 var container=document.createElement('div');
 return container;
};
 
 
 function MSliderControl(useScaleList,_f_close){
 this.id="slctr"+MSliderControl.ID++;
 this.map=null;
 this.div=null;
 this.scale_list=null;
 this.useScaleList=useScaleList;
 this.f_closed=_f_close;
};
 MSliderControl.ID=0;
 MSliderControl.prototype.show=function(){
 this.div=document.createElement("DIV");
 this.div.oP=this;
 this.div.style.position="absolute";
 this.div.style.left="10px";
 this.div.style.top="10px";
 this.div.style.width="60px";
 this.div.style.height="202px";
 this.div.id=this.id+"div";
 this.div.style.zIndex=200;
 var mmap=this.map;
 this.div.onmouseup=function(){mmap.focuselem.focus();};
 this.map.basediv.appendChild(this.div);
 this.smoothZoom=false;
 this.autoScaleSmooth=true;
 
 this.ps=new Array(148,132,116,100,84,68,52,36,20,4);
 this.pr=new Array(164,148,132,116,100,84,68,52,36,20);
 
 this.es;
 this.ers;
 this.ers2;
 this.ers3;
 this.ers4;
 this.zi;
 this.zi2;
 this.zo;
 this.zo2;
 this.esh;
 this.erf;
 this.ep;
 this.sc;
 this.so;
 this.f_switch=null;
 this.s_offsetY;
 this.y;
 this.cursor;
 if(!this.scale_list){
 this.minzoomlevel=0;
 this.maxzoomlevel=9;
}
 
 try{
 if(MBrowser.ie5up)this.cursor="hand";
 else this.cursor="pointer";
}catch(e){}
 
 var path=MMap.IMGPATH+"img/mcontrol/";
 this.es=this.createDiv(path+"scale_bar2.gif",2,17,0,10,168,false);
 this.ers=this.createDiv(path+"scale_main01.gif",2,20,11,43,161,false);
 this.ers2=this.createDiv(path+"scale_main02.gif",2,20,11,43,161,false);
 this.ers3=this.createDiv(path+"scale_main03.gif",2,20,11,43,161,false);
 this.ers4=this.createDiv(path+"spacer.gif",4,20,11,43,161,true);
 this.zi=this.createDiv(path+"scale_pl01.gif",2,0,11,43,20,true);
 this.zi2=this.createDiv(path+"scale_pl02.gif",2,0,11,43,20,false);
 this.zo=this.createDiv(path+"scale_mn01.gif",2,181,11,43,20,true);
 this.zo2=this.createDiv(path+"scale_mn02.gif",2,181,11,43,20,false);
 this.esh=this.createDiv(path+"scale_btn2.gif",2,this.getSwitchPos(),-4,15,16,true);
 this.erf=this.createImg(path+"scale_waku.gif",3,this.getRedFramePos(),2+11,false);
 this.ep=this.createDiv(path+"scale_pop.gif",2,37,54,43,143,false);
 this.sc=this.createDiv(path+"scale_close.gif",2,0,-4,15,15,true);
 this.so=this.createDiv(path+"scale_open.gif",3,0,-4,15,15,true);
 
 this.zi2.style.display="none";
 this.zo2.style.display="none";
 this.ers2.style.display="none";
 this.ers3.style.display="none";
 this.ep.style.display="none";
 this.so.style.display="none";
 
 if(this.f_closed){
 this.so.style.display="block";
 this.esh.style.display="none";
 this.es.style.display="none";
 this.erf.style.display="none";
 this.ers4.style.display="none";
 this.zo.style.top=36+1+"px";
 this.zo2.style.top=36+1+"px";
 this.ers.style.height=16+1+"px";
 this.ers2.style.height=16+1+"px";
 this.ers3.style.height=16+1+"px";
 var lid=this.map.zid;
 this.closeMove(lid);
}
 
 this.div.appendChild(this.es);
 this.div.appendChild(this.ers);
 this.div.appendChild(this.ers2);
 this.div.appendChild(this.ers3);
 this.div.appendChild(this.ers4);
 this.div.appendChild(this.zi);
 this.div.appendChild(this.zi2);
 this.div.appendChild(this.zo);
 this.div.appendChild(this.zo2);
 this.es.appendChild(this.esh);
 this.div.appendChild(this.erf);
 this.div.appendChild(this.ep);
 this.div.appendChild(this.so);
 this.div.appendChild(this.sc);
 
 this.zi.oP=this;
 this.zi.onmousedown=this.zoomIn;
 this.zo.oP=this;
 this.zo.onmousedown=this.zoomOut;
 
 this.ers4.oP=this;
 this.ers4.onmouseover=this.rover;
 this.ers4.onmousemove=this.rmove;
 this.ers4.onmouseout=this.rout;
 this.ers4.onmouseup=this.rclick;
 
 var cntIns=this;
 this.esh.onmousedown=function(e){
 cntIns.sdown.call(cntIns,e);
 cntIns.smove.call(cntIns,e);
 return false;
}
 MEvent.DocumentAddListener("mousemove",function(e){
 if(cntIns.f_switch){
 cntIns.smove.call(cntIns,e);
}
 return false;
});
 MEvent.mouseOutOfWindowFuncs.push(new callbackFunc(cntIns,cntIns.sup));
 
 this.so.oP=this;
 this.so.onclick=this.soclick;
 this.sc.oP=this;
 this.sc.onclick=this.scclick;
 
}
 
 MSliderControl.prototype.setPosition=function(pos){
 pos.apply(this.div);
};
 
 MSliderControl.prototype.createDiv=function(path,zindex,top,left,width,height,cursor){
 var div=document.createElement("div");
 div.style.position="absolute";
 div.style.top=top+"px";
 div.style.left=left+"px";
 div.style.backgroundImage="url("+path+")";
 div.style.backgroundRepeat="no-repeat";
 div.style.width=width+"px";
 div.style.height=height+"px";
 div.style.zIndex=zindex;
 try{
 if(cursor)div.style.cursor=this.cursor;
}catch(e){}
 return div;
}
 
 MSliderControl.prototype.createImg=function(path,zindex,top,left,cursor){
 var img=document.createElement("img");
 img.src=path;
 img.style.position="absolute";
 img.style.top=top+"px";
 img.style.left=left+"px";
 img.style.zIndex=zindex;
 try{
 if(cursor)img.style.cursor=this.cursor;
}catch(e){}
 return img;
}
 MSliderControl.prototype.zoomIn=function(){
 if(!this.oP.map.moving){
 var zl=this.oP.map.zid+1;
 if(zl>this.oP.maxzoomlevel){
 return;
}
 if(this.oP.smoothZoom){
 this.oP.map.smoothzoomin(1);
}else{
 this.oP.map.changeZoom(zl);
}
}
};
 
 MSliderControl.prototype.zoomOut=function(){
 if(!this.oP.map.moving){
 var zl=this.oP.map.zid-1;
 if(zl<this.oP.minzoomlevel){
 return;
}
 if(this.oP.smoothZoom){
 this.oP.map.smoothzoomout(1);
}else{
 this.oP.map.changeZoom(zl);
}
}
};
 
 MSliderControl.prototype.rover=function(){
 this.oP.ep.style.display="block";
};
 
 MSliderControl.prototype.rout=function(){
 this.oP.erf.style.top=this.oP.getRedFramePos()+"px";
 this.oP.ep.style.display="none";
};
 
 MSliderControl.prototype.rmove=function(e){
 var s=this.oP;
 if(!s.f_switch){
 var y;
 if(document.all)y=event.offsetY+this.style.posTop;
 else y=e.layerY+parseInt(this.style.top);
 if(MBrowser.opera95up)y=event.offsetY+this.style.posTop;
 for(var i=0;i<s.pr.length;i++){
 if(y>s.pr[i]&& y<=s.pr[i]+16){
 var t=i;
 if(i>s.maxzoomlevel)t=s.maxzoomlevel;
 s.erf.style.top=s.pr[t]+2+"px";
 break;
}
}
}
 return false;
};
 
 MSliderControl.prototype.rclick=function(e){
 var s=this.oP;
 if(!s.map.moving){
 if(!s.f_switch){
 var y;
 if(document.all)y=event.offsetY+this.style.posTop;
 else y=e.layerY+parseInt(this.style.top);
 if(MBrowser.opera95up)y=event.offsetY+this.style.posTop;
 for(var i=0;i<s.pr.length;i++){
 if(y>s.pr[i]&& y<=s.pr[i]+16){
 var t=i;
 if(i>s.maxzoomlevel)t=s.maxzoomlevel;
 s.erf.style.top=s.pr[t]+2+"px";
 var lid=i;
 break;
}
}
}
 if(lid<=s.maxzoomlevel){
 this.oP.map.changeZoom(lid);
}
}
};
 
 MSliderControl.prototype.sdown=function(e){
 var s=this;
 if(!s.map.moving){
 MEvent.documentMMoveReturnCode=false;
 s.f_switch=true;
 if(document.all)s.s_offsetY=event.clientY+document.body.scrollTop-s.esh.style.posTop;
 else s.s_offsetY=e.pageY-parseInt(s.esh.style.top);
 s.ep.style.display="block";
 return false;
}
};
 
 MSliderControl.prototype.smove=function(e){
 var s=this;
 if(s.f_switch){
 if(document.all)s.y=event.clientY+document.body.scrollTop-s.s_offsetY;
 else s.y=e.pageY-s.s_offsetY;
 
 var t=0;
 if(s.maxzoomlevel<9)t=16*(9-s.maxzoomlevel)+4+1;
 if(s.y<t-(16/2))s.y=t-(16/2);
 if(s.y>168-(16/2))s.y=168-(16/2);
 s.esh.style.top=s.y+"px";
 
 return false;
}
};
 
 MSliderControl.prototype.sup=function(e){
 var s=this;
 if(s.f_switch){
 MEvent.documentMMoveReturnCode=true;
 s.f_switch=null;
 var lid;
 if(s.y>=s.ps[0]-8){
 s.esh.style.top=s.ps[0]+"px";
 lid=0;
}else if(s.y<=s.ps[s.ps.length-1]+8){
 s.esh.style.top=s.ps[s.ps.length-1]+"px";
 lid=s.ps.length-1;
}else{
 for(var i=1;i<s.ps.length-1;i++){
 if(s.y>=s.ps[i]-8 && s.y<s.ps[i]+8){
 s.esh.style.top=s.ps[i]+"px";
 lid=i;
 break;
}
}
}
 s.ep.style.display="none";
 s.map.changeZoom(lid);
 return false;
}
};
 
 MSliderControl.prototype.soclick=function(){
 var s=this.oP;
 s.f_closed=false;
 s.so.style.display="none";
 s.esh.style.display="block";
 s.es.style.display="block";
 s.erf.style.display="block";
 s.ers4.style.display="block";
 s.zo.style.top=181+"px";
 s.zo2.style.top=181+"px";
 s.ers.style.height=161+"px";
 s.ers2.style.height=161+"px";
 s.ers3.style.height=161+"px";
 s.closeMove(9);
};
 
 MSliderControl.prototype.scclick=function(){
 var s=this.oP;
 s.f_closed=true;
 s.so.style.display="block";
 s.esh.style.display="none";
 s.es.style.display="none";
 s.erf.style.display="none";
 s.ers4.style.display="none";
 s.zo.style.top=36+1+"px";
 s.zo2.style.top=36+1+"px";
 s.ers.style.height=16+1+"px";
 s.ers2.style.height=16+1+"px";
 s.ers3.style.height=16+1+"px";
 var lid=this.oP.map.zid;
 s.closeMove(lid);
};
 
 MSliderControl.prototype.closeMove=function(lid){
 var pos=(lid*16)-144;
 this.ers.style.backgroundPosition="0px "+pos+"px";
 this.ers2.style.backgroundPosition="0px "+pos+"px";
 this.ers3.style.backgroundPosition="0px "+pos+"px";
};
 
 MSliderControl.prototype.getSwitchPos=function(){
 return this.ps[this.div.oP.map.zid];
}
 
 MSliderControl.prototype.getRedFramePos=function(){
 return this.pr[this.div.oP.map.zid]+2;
}
 
 MSliderControl.prototype.disable=function(){
 var s=this.getScaleList();
 this.minzoomlevel=0;
 for(c=0;c<s.length;c++){
 if(s[c]!=null){
 this.maxzoomlevel=c;
 this.map.adp.zoomInMax=c;
}
}
 
 var lid=this.map.zid;
 if(this.maxzoomlevel<lid){
 zl=lid-1;
 if(zl<=0){
 zl=0;
}
 if(this.autoScaleSmooth){
 this.map.smoothzoomout(1);
}else{
 this.setZoomLevel(zl);
}
}
 
 if(this.maxzoomlevel>lid)this.zi2.style.display="none";
 else this.zi2.style.display="block";
 
 if(this.minzoomlevel<lid)this.zo2.style.display="none";
 else this.zo2.style.display="block";
 
 if(this.maxzoomlevel==7){
 this.ers3.style.display="block";
}else if(this.maxzoomlevel==8){
 this.ers3.style.display="none";
 this.ers2.style.display="block";
}else if(this.maxzoomlevel==9){
 this.ers2.style.display="none";
 this.ers3.style.display="none";
}else{
 this.ers3.style.display="block";
}
}
 
 MSliderControl.prototype.setScaleList=function(_scale_list){
 this.scale_list=_scale_list;
}
 
 MSliderControl.prototype.getScaleList=function(){
 return this.scale_list;
}
 
 MSliderControl.prototype.zoomUpdate=function(){
 this.esh.style.top=this.getSwitchPos()+"px";
 this.erf.style.top=this.getRedFramePos()+"px";
 if(this.f_closed){
 var lid=this.div.oP.map.zid;
 this.closeMove(lid);
}
 if(this.useScaleList)this.disable();
};
 
 
 
 
 function MMoveControl(vmove){
 this.constructor_super=MControl;
 this.constructor_super();
 if(vmove)this.vmove=vmove 
 else this.vmove=300;
 this.id="mvctr"+MMoveControl.ID++;
};
 MMoveControl.prototype=MControl.prototype;
 MMoveControl.ID=0;
 MMoveControl.prototype.show=function(){
 this.div=document.createElement("DIV");
 this.div.style.position="absolute";
 this.div.style.left="10px";
 this.div.style.top="10px";
 this.div.id=this.id+"div";
 this.div.style.zIndex=200;
 var _mmap=this.map;
 this.div.onmouseup=function(){_mmap.focuselem.focus();};
 this.map.basediv.appendChild(this.div);
 this.autoScaleSmooth=true;
 
 var s="";
 s+="<table border=0 cellpadding=0 cellspacing=2 id=cntarea"+this.id+"><tr><td>";
 s+="<div id=moveleftup"+this.id+" style='font-size:1px;'><img src='"+MMap.IMGPATH+"img/mcontrol/mvlu.png' style='vertical-align:bottom;'></div></td><td>";
 s+="<div id=moveup"+this.id+" style='font-size:1px;'><img src='"+MMap.IMGPATH+"img/mcontrol/mvu.png' style='vertical-align:bottom;'></div></td><td>";
 s+="<div id=moverightup"+this.id+" style='font-size:1px;'><img src='"+MMap.IMGPATH+"img/mcontrol/mvru.png' style='vertical-align:bottom;'></div></td></tr>";
 s+="<tr><td>";
 s+="<div id=moveleft"+this.id+" style='font-size:1px;'><img src='"+MMap.IMGPATH+"img/mcontrol/mvl.png' style='vertical-align:bottom;'></div></td><td>";
 s+="<div id=movecenter"+this.id+" style='font-size:1px;'><img src='"+MMap.IMGPATH+"img/mcontrol/mvc.png' style='vertical-align:bottom;'></div></td><td>";
 s+="<div id=moveright"+this.id+" style='font-size:1px;'><img src='"+MMap.IMGPATH+"img/mcontrol/mvr.png' style='vertical-align:bottom;'></div></td></tr>";
 s+="<tr><td>";
 s+="<div id=moveleftdown"+this.id+" style='font-size:1px;'><img src='"+MMap.IMGPATH+"img/mcontrol/mvld.png' style='vertical-align:bottom;'></div></td><td>";
 s+="<div id=movedown"+this.id+" style='font-size:1px;'><img src='"+MMap.IMGPATH+"img/mcontrol/mvd.png' style='vertical-align:bottom;'></div></td><td>";
 s+="<div id=moverightdown"+this.id+" style='font-size:1px;'><img src='"+MMap.IMGPATH+"img/mcontrol/mvrd.png' style='vertical-align:bottom;'></div></td></tr></table>";
 this.div.innerHTML=s;
 
 this.zlu=document.getElementById("moveleftup"+this.id);
 this.zlu.onmousedown=this.getMouseDownFunc(-1,-1);
 this.zu=document.getElementById("moveup"+this.id);
 this.zu.onmousedown=this.getMouseDownFunc(0,-1);
 this.zru=document.getElementById("moverightup"+this.id);
 this.zru.onmousedown=this.getMouseDownFunc(1,-1);
 this.zl=document.getElementById("moveleft"+this.id);
 this.zl.onmousedown=this.getMouseDownFunc(-1,0);
 
 
 this.zr=document.getElementById("moveright"+this.id);
 this.zr.onmousedown=this.getMouseDownFunc(1,0);
 this.zld=document.getElementById("moveleftdown"+this.id);
 this.zld.onmousedown=this.getMouseDownFunc(-1,1);
 this.zd=document.getElementById("movedown"+this.id);
 this.zd.onmousedown=this.getMouseDownFunc(0,1);
 this.zrd=document.getElementById("moverightdown"+this.id);
 this.zrd.onmousedown=this.getMouseDownFunc(1,1);
};
 
 MMoveControl.prototype.getMouseDownFunc=function(dir_x,dir_y){
 var mmap=this.map;
 var temp_v=this.vmove;
 var vx=300;
 var vy=300;
 var flg=false;
 if(typeof(temp_v)=="number"){
 vx=temp_v;
 vy=temp_v;
}else{
 if(typeof(temp_v)=="string"){
 if(!isNaN(parseInt(temp_v))){
 vx=parseInt(temp_v);
 vy=parseInt(temp_v);
 if(temp_v.indexOf("%")>-1){
 flg=true;
}
}
}
}
 return function(){
 var x=vx;
 var y=vy;
 if(flg){
 x=mmap.div.offsetWidth*vx/100;
 y=mmap.div.offsetHeight*vy/100;
}
 var curpp=mmap.r2p(mmap.updateCenterRP(),mmap.zid);
 mmap.smoveToPPoint(curpp.add(x*dir_x,y*dir_y));
}
};
 function MKeyManager(){
};
 MKeyManager.MMap=null;
 MKeyManager.KeyStatus=new MKeyStatus();
 MKeyManager.Enable=function(div,mmap){
 MKeyManager.MMap=mmap;
 div.onkeydown=MKeyManager.OnKeyDown;
 div.onkeyup=MKeyManager.OnKeyUp;
};
 MKeyManager.Disable=function(div){
 MKeyManager.MMap=null;
 div.onkeydown=function(){};
 div.onkeyup=function(){};
 if(MKeyboardHandler.timerId){
 MKeyboardHandler.disable();
}
};
 MKeyManager.OnKeyDown=function(e){
 if(!e)e=window.event;
 MKeyManager.KeyStatus.put(e.keyCode,1);
 if(kdf=MKeyManager.DefaultKeyDownFunc)kdf.call(this,e);
};
 MKeyManager.OnKeyUp=function(e){
 if(!e)e=window.event;
 MKeyManager.KeyStatus.del(e.keyCode);
 var kuf=null;
 if(kuf=MKeyManager.DefaultKeyUpFunc)kuf.call(this,e);
};
 MKeyManager.DefaultKeyDownFunc=null;
 MKeyManager.DefaultKeyUpFunc=null;
 
 function MKeyStatus(){
 this.keylist=new Array();
 this.length=0;
}
 MKeyStatus.prototype.put=function(key,val){
 if(!this.keylist["_"+key]){this.keylist["_"+key]=val;this.length++;}
};
 MKeyStatus.prototype.del=function(key){
 if(this.keylist["_"+key]){delete this.keylist["_"+key];this.length--;}
};
 MKeyStatus.prototype.get=function(key){
 return this.keylist["_"+key];
};
 
 function MKeyboardHandler(map){
 MKeyboardHandler.map=map;
 MKeyboardHandler.addKeyboardEvent(map.div);
 MKeyboardHandler.nowKeyDirection=new Array();
 MKeyboardHandler.moveCount=0;
 MKeyboardHandler.timerId=null;
};
 MKeyboardHandler.allowZoomChange=false;
 MKeyboardHandler.moveKeyCodes=[37,38,39,40];
 MKeyboardHandler.moveKeyDirection={38:[0,1],40:[0,-1],37:[1,0],39:[-1,0]};
 MKeyboardHandler.TIMER_INTERVAL=10;
 MKeyboardHandler.MOVE_INTERVAL=1.0;
 MKeyboardHandler.timerId=null;
 
 MKeyboardHandler.addKeyboardEvent=function(target){
 MKeyManager.DefaultKeyDownFunc=MKeyboardHandler.onKeyDown;
 MKeyManager.DefaultKeyUpFunc=MKeyboardHandler.onKeyUp;
};
 MKeyboardHandler.onKeyDown=function(e){
 var map=MKeyboardHandler.map;
 switch(e.keyCode){
 case 37:
 case 38:
 case 39:
 case 40:
 MKeyboardHandler.nowKeyDirection[e.keyCode]=1;
 
 if(e.keyCode==37)MKeyboardHandler.nowKeyDirection[39]=null;
 if(e.keyCode==38)MKeyboardHandler.nowKeyDirection[40]=null;
 if(e.keyCode==39)MKeyboardHandler.nowKeyDirection[37]=null;
 if(e.keyCode==40)MKeyboardHandler.nowKeyDirection[38]=null;
 
 if(MKeyboardHandler.timerId !=null)return;
 if(MKeyboardHandler.map.moving)return;
 MKeyboardHandler.startMove();
 break;
 case 36:
 if(!map.moving){
 var cp=map.r2p(map.rpos);
 var pp=cp.add(-map.div.offsetWidth*2/3,0);
 map.smoveToPPoint(pp);
}
 break;
 case 35:
 if(!map.moving){
 var cp=map.r2p(map.rpos);
 var pp=cp.add(map.div.offsetWidth*2/3,0);
 map.smoveToPPoint(pp);
}
 break;
 case 33:
 if(!map.moving){
 var cp=map.r2p(map.rpos);
 var pp=cp.add(0,-map.div.offsetHeight*2/3);
 map.smoveToPPoint(pp);
}
 break;
 case 34:
 if(!map.moving){
 var cp=map.r2p(map.rpos);
 var pp=cp.add(0,map.div.offsetHeight*2/3);
 map.smoveToPPoint(pp);
}
 break;
 case 107:
 if(MKeyboardHandler.allowZoomChange&&!map.moving){
 map.zoomTo(map.getZoomLevel()+1);
}
 break;
 case 109:
 if(MKeyboardHandler.allowZoomChange&&!map.moving){
 map.zoomTo(map.getZoomLevel()-1);
}
 break;
};
 if(MBrowser.opera){
 if(e.keyCode==43){
 if(MKeyboardHandler.allowZoomChange&&!map.moving){
 map.zoomTo(map.getZoomLevel()+1);
}
}
 if(e.keyCode==45){
 if(MKeyboardHandler.allowZoomChange&&!map.moving){
 map.zoomTo(map.getZoomLevel()-1);
}
}
}
};
 MKeyboardHandler.onKeyUp=function(e){
 switch(e.keyCode){
 case 38: case 40: case 37: case 39: 
 MKeyboardHandler.nowKeyDirection[e.keyCode]=null;
 break;
};
};
 MKeyboardHandler.startMove=function(){
 MKeyboardHandler.map.moving=true;
 MKeyboardHandler.map.cur_x=MKeyboardHandler.map.getMapdivL();
 MKeyboardHandler.map.cur_y=MKeyboardHandler.map.getMapdivT();
 
 var self=MKeyboardHandler;
 var kei=MKeyboardHandler.MOVE_INTERVAL;
 if(MBrowser.ie5up)kei*=0.4;
 MKeyboardHandler.timerId=setInterval(
 function(){
 var d=self.nowKeyDirection;
 var b=0;
 var c=0;
 var isKeyDown=false;
 for(var i=0;i<MKeyboardHandler.moveKeyCodes.length;i++){
 if(d[MKeyboardHandler.moveKeyCodes[i]]){
 var f=MKeyboardHandler.moveKeyDirection[MKeyboardHandler.moveKeyCodes[i]];
 b+=f[0];
 c+=f[1];
 isKeyDown=true;
}
}
 var g=self.map;
 if(isKeyDown){
 if(self.moveCount<1){
 self.moveCount+=8;
}else if(self.moveCount<9){
 self.moveCount+=6;
}else if(self.moveCount<20){
 self.moveCount+=3;
}else if(self.moveCount<50){
 self.moveCount++;
}
 g.cur_x=g.cur_x+(self.moveCount*kei*b);
 g.cur_y=g.cur_y+(self.moveCount*kei*c);
 g.setMapdivLT(Math.round(g.cur_x),Math.round(g.cur_y));
 g.updateCenterRP();
 g.redrawMap();
 if(cb=MEvent.hash[g.id+"move"]){
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].apply(g.id);
}
}
}else{
 self.disable();
}
}
,MKeyboardHandler.MOVE_INTERVAL 
 );
};
 
 MKeyboardHandler.disable=function(){
 clearInterval(MKeyboardHandler.timerId);
 MKeyboardHandler.timerId=null;
 MKeyboardHandler.moveCount=0;
 MKeyboardHandler.nowKeyDirection=new Array();
 MKeyboardHandler.map.moving=false;
 if(cb=MEvent.hash[MKeyboardHandler.map.id+"moveend"]){
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].apply(MKeyboardHandler.map);
}
}
}
 function MMarker(p,icon,usemap){
 if(!MMarker.defaultIcon){
 MMarker.defaultIcon=MMap.IMGPATH+"img/pin_body_blue02.png";
 MMarker.defaultPinMarkShadow=MMap.IMGPATH+"img/pin_mark_shadow.png";
}
 
 this.id='marker'+MMarker.ID++;
 if(!icon){
 icon=new MIcon();
}else{
 icon=new MIcon(icon);
}
 this.icon=icon;
 if(this.icon.iconAnchor){
 this.icon.offsetX=this.icon.iconAnchor.x;
 this.icon.offsetY=this.icon.iconAnchor.y;
}
 this.rpos=p;
 this.map=null;
 this.draggable=false;
 this.dragFixCursor=false;
 this.div=document.createElement("DIV");
 this.offsetDiv=document.createElement("DIV");
 if(usemap!=null){
 this.useimagemap=usemap;
}else{
 this.useimagemap=true;
}
 this.div.oP=this;
 this.div.style.position="absolute";
 this.div.style.width=this.icon.width+"px";
 this.div.style.height=this.icon.height+"px";
 this.div.appendChild(this.offsetDiv);
 this.div.style.zIndex=200;
 this.offsetDiv.style.position="absolute";
 this.offsetDiv.style.top="0px";
 this.offsetDiv.style.left="0px";
 this.offsetDiv.style.width=this.icon.width+"px";
 this.offsetDiv.style.height=this.icon.height+"px";
 this.offsetDiv.style.zIndex=220;
 this.offsetDiv.innerHTML=this.icon.getHTML(this.useimagemap);
 if(this.icon.imageMap==""){
 if(this.icon.image==MMarker.defaultIcon){
 this.icon.imageMap=[7,0,2,3,1,5,1,15,3,17,0,26,1,31,5,31,5,28,11,20,15,19,19,15,19,14,20,13,20,5,16,1,15,1,14,0,7,0];
}else{
 this.icon.imageMap=[0,0,0,icon.height,icon.width,icon.height,icon.width,0,0,0];
}
}
 if(this.useimagemap){
 this.div.appendChild(this.icon.i_);
 this.ia_=this.icon.ia_;
 this.icon.ia_.coords=this.icon.getOffsetCoords(0,0);
}else{
 this.icon.imageMap=[0,0,0,icon.height,icon.width,icon.height,icon.width,0,0,0];
}
 
 this.pinMarkShadow=null;
 this.tid=null;
 this.iniTop=0;
 
 if(!icon.shadowAnchor)icon.shadowAnchor=new MPoint(0,0);
 if(!icon.shadow){
 icon.shadow=MMarker.defaultPinMarkShadow;
 icon.shadowWidth=21;
 icon.shadowHeight=13;
 icon.shadowAnchor=new MPoint(9,5);
}
 
 if(MBrowser.ie5up && !MBrowser.ie7up){
 this.pinMarkShadow=document.createElement("div");
 this.pinMarkShadow.innerHTML="<div style='width:"+icon.shadowWidth+"px;height:"+icon.shadowHeight+"px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="+icon.shadow+");'></div>";
}else{
 this.pinMarkShadow=document.createElement("img");
 this.pinMarkShadow.src=icon.shadow;
 this.pinMarkShadow.style.width=icon.shadowWidth+"px";
 this.pinMarkShadow.style.height=icon.shadowHeight+"px";
}
 this.pinMarkShadow.style.position="absolute";
 this.pinMarkShadow.style.left=(this.icon.offsetX-icon.shadowAnchor.x)+"px";
 this.pinMarkShadow.style.top=(this.icon.offsetY-icon.shadowAnchor.y)+"px";
 this.pinMarkShadow.style.zIndex=210;
 this.pinMarkShadow.style.display="none";
 this.div.appendChild(this.pinMarkShadow);
 this.UPPX=-16;
 this.VUPPX=-3;
 this.UPVAL=15;
 var mobj=null;
 if(MBrowser.ie5up){
 mobj=this.div;
}else{
 if(this.ia_){
 mobj=this.ia_;
}else{
 mobj=this.div;
}
}
 var obj=this;
 mobj.onmousedown=function(e){
 if(obj.draggable){
 obj.dragstart();
}
}
};
 
 MMarker.ID=0;
 MMarker.defaultIcon=null;
 MMarker.defaultPinMarkShadow=null;
 
 MMarker.prototype.openInfoWindowHtml=function(html){
 if(this.map.enableinfowindow)
 this.map.openInfoWindowHtml(this.rpos,html,new MSize(this.icon.infoWindowAnchor.x,-this.icon.infoWindowAnchor.y));
};
 
 MMarker.prototype.eventRedirect=function(callback,obj){
 MEvent.clickedOverlay=obj;
 callback.call(this,obj);
};
 
 MMarker.prototype.liftUp=function(callback){
 var obj=this;
 if(obj.tid){
 window.clearInterval(obj.tid);
 obj.tid=null;
}
 obj.tid=window.setInterval(function(){
 obj.iniTop+=obj.VUPPX;
 obj.offsetDiv.style.top=obj.iniTop+"px";
 if(obj.iniTop<obj.UPPX){
 window.clearInterval(obj.tid);
 obj.tid=null;
 if(callback)callback.call();
}
},obj.UPVAL);
 obj.pinMarkShadow.style.display="block";
}
 MMarker.prototype.liftDown=function(callback){
 var obj=this;
 if(obj.tid){
 window.clearInterval(obj.tid);
 obj.tid=null;
}
 obj.tid=window.setInterval(function(){
 obj.iniTop-=obj.VUPPX;
 obj.offsetDiv.style.top=obj.iniTop+"px";
 if(obj.iniTop>=0){
 obj.offsetDiv.style.top="0px";
 window.clearInterval(obj.tid);
 obj.tid=null;
 if(callback)callback.call();
}
},obj.UPVAL);
 obj.pinMarkShadow.style.display="none";
}
 
 MMarker.prototype.dragstart=function(){
 var obj=this;
 var map=this.map;
 var draggingEnabled=this.map.draggingEnabled();
 
 MEvent.documentMDownReturnCode=false;
 MEvent.documentMMoveReturnCode=false;
 
 var dragged=false;
 var offsetPosX=null;
 var offsetPosY=null;
 
 map.disableDragging();
 var mousemoveToken=MEvent.addListener(map,"mousemove",function(ov,rp){
 if(!dragged){
 dragged=true;
 obj.liftUp();
 offsetPosX=obj.rpos.x-rp.x;
 offsetPosY=obj.rpos.y-rp.y;
 var cb=null;
 if(cb=MEvent.hash[obj.id+"dragstart"]){
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].call(obj,obj);
}
}
}else{
 if(obj.dragFixCursor){
 obj.rpos=rp;
}else{
 obj.rpos=new MPoint(rp.x+offsetPosX,rp.y+offsetPosY)
}
 map.setMarkerPos(obj);
}
});
 var mouseupToken=MEvent.addListener(map,"mouseup",function(ov,rp){
 if(dragged){
 obj.liftDown(function(){
 var cb=null;
 if(cb=MEvent.hash[obj.id+"dragend"]){
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].call(obj,obj);
}
}
});
}
 obj.pinMarkShadow.style.display="none";
 if(draggingEnabled)map.enableDragging();
 MEvent.removeListener(mousemoveToken);
 MEvent.removeListener(mouseupToken);
 MEvent.documentMDownReturnCode=true;
 MEvent.documentMMoveReturnCode=true;
});
}
 MMarker.prototype.setPosByMapDivCoord=function(_p,_map){
 var map=null;
 if(_map){
 map=_map 
}else if(this.map){
 map=this.map;
}
 if(map){
 this.rpos=map.s2r(_p);
 map.setMarkerPos(this);
}
}
 
 MMarker.prototype.getLatLng=function(){
 return this.rpos;
}
 
 function MIcon(icon){
 if(!MMarker.defaultIcon){
 MMarker.defaultIcon=MMap.IMGPATH+"img/pin_body_blue02.png";
 MMarker.defaultPinMarkShadow=MMap.IMGPATH+"img/pin_mark_shadow.png";
}
 
 if(icon){
 for(var i in icon){
 this[i]=icon[i];
}
}else{
 this.image=MMarker.defaultIcon;
 this.width=21;
 this.height=28;
 this.offsetX=0;
 this.offsetY=28;
 this.iconAnchor=null;
 this.infoWindowAnchor=new MPoint(10,-14);
 this.shadow=MMarker.defaultPinMarkShadow;
 this.shadowWidth=21;
 this.shadowHeight=13;
 this.shadowAnchor=new MPoint(9,5);
}
 this.id='icon'+MIcon.ID++;
 this.icon=icon;
 this.coords=this.getOffsetCoords(0,0);
 this.i_=document.createElement("MAP");
 this.i_.id="i_"+this.id;
 this.i_.name="i_"+this.id;
 this.ia_=document.createElement("AREA");
 this.ia_.id="ia_"+this.id;
 this.ia_.shape="poly";
 this.ia_.coords=this.getOffsetCoords(1,1);
 this.i_.appendChild(this.ia_);
};
 
 MIcon.ID=0;
 MIcon.prototype.getHTML=function(useMapFlag){
 var useAIL=false;
 if(MBrowser.ie5up && !MBrowser.ie7up){
 useAIL=true;
 if(this.image.indexOf(".gif")!=-1)useAIL=false;
}
 if(useAIL){
 html="<span style='width:"+this.width+"px;height:"+this.height+"px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="+this.image+");display:block;'></span>";
}else{
 if(useMapFlag){
 html="<img src="+this.image+" usemap='#"+this.i_.name+"' border=0 width="+this.width+" height="+this.height+">";
}else{
 html="<img src="+this.image+" border=0 width="+this.width+" height="+this.height+">";
}
}
 return html;
};
 
 MIcon.prototype.imageMap="";
 MIcon.prototype.getOffsetCoords=function(offsetx,offsety){
 var offsetcoords="";
 for(var i=0;i<this.imageMap.length;i++){
 if(i % 2==0){
 offsetcoords+=(offsetx+Number(this.imageMap[i]));
}else{
 offsetcoords+=(offsety+Number(this.imageMap[i]));
}
 if(i !=(this.imageMap.length-1)){
 offsetcoords+=",";
}
}
 return offsetcoords;
};
 
 function MInfoWindow(map){
 this.map=map;
 this.rpos=new MPoint(0,0);
 this.onOpenFn=null;
 this.onCloseFn=null;
 this.offset=0;
 this.move=false;
 
 this.div=document.createElement("DIV");
 this.div.id="SingleInfowindow"+MInfoWindow.ID++;
 this.div.oP=this;
 
 this.div.innerHTML=''+
 
 '<div id=window'+this.div.id+'>'+
 '<img id=winlt'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindow/infowlt.png">'+
 '<img id=wint'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindow/infowt.png">'+
 '<img id=winrt'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindow/infowrt.png">'+
 '<img id=winl'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindow/infowl.png">'+
 '<div id=divarea'+this.div.id+' style="background-image: url('+MMap.IMGPATH+'img/minfowindow/infowc.png)"></div>'+
 '<img id=winr'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindow/infowr.png">'+
 '<img id=winlb'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindow/infowlb.png">'+
 '<img id=winb'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindow/infowb.png">'+
 '<img id=winrb'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindow/infowrb.png">'+
 '<img id=winclose'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindow/close.png">'+
 '</div>'+
 '<div id=shadow'+this.div.id+'>'+
 '<img id=shalt'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindow/shadowlt.png">'+
 '<img id=shat'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindow/shadowt.png">'+
 '<img id=shart'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindow/shadowrt.png">'+
 '<img id=shal'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindow/shadowl.png">'+
 '<img id=shac'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindow/shadowc.png">'+
 '<img id=shar'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindow/shadowr.png">'+
 '<img id=shalb'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindow/shadowlb.png">'+
 '<img id=shab'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindow/shadowb.png">'+
 '<img id=shaar'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindow/shadowar.png">'+
 '<img id=sharb'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindow/shadowrb.png">'+
 '</div>'+
 '<div id="farea'+this.div.id+'">'+
 '<img id="fukidashi'+this.div.id+'" border=0 src="'+MMap.IMGPATH+'img/minfowindow/infowar.png"></div>'+
 '</div>';
 
 this.div.style.position="absolute";
 this.div.style.visibility="hidden";
 this.map.infodiv.appendChild(this.div);
 
 this.closediv=document.getElementById("winclose"+this.div.id);
 this.closediv.oP=this.div;
 this.closediv.onclick=this.close;
 this.farea=document.getElementById("farea"+this.div.id);
 thisobj=this;
 this.farea.style.position="absolute";
 this.ar=document.getElementById("fukidashi"+this.div.id);
 this.ar.style.position="absolute";
};
 MInfoWindow.ID=0;
 MInfoWindow.prototype.close=function(){
 MEvent.EventMClickQueue["PmDf"]=1;
 pobj=this.oP.oP;
 if(pobj.siarea){
 pobj.div.removeChild(pobj.siarea);
 pobj.siarea=null;
}
 if(pobj.simap){
 pobj.div.removeChild(pobj.simap);
 pobj.simap=null;
}
 if(pobj.aimap){
 for(var i in pobj.aimap){
 if(!pobj.aimap.hasOwnProperty(i))continue;
 pobj.fn.removeChild(pobj.aimap[i]);
}
}
 pobj.aimap=new Object();
 this.oP.style.visibility="hidden";
 pobj.map.infowindowOpened=false;
 if(pobj.onCloseFn)pobj.onCloseFn.call();
 pobj.infowindowOpened=false;
 
 if(cb=MEvent.hash[this.oP.oP.map.id+"infowindowclose"]){
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].apply(this.oP.oP.map);
}
}
};
 
 MInfoWindow.prototype.show=function(rp,html,offset,onOpenFn,onCloseFn){
 this.rpos=rp;
 this.html=html;
 this.offset=offset;
 this.onOpenFn=onOpenFn;
 this.onCloseFn=onCloseFn;
 this.move=true;
 this.draw();
};
 MInfoWindow.prototype.draw=function(){
 this.div.style.visibility="hidden";
 if(!this.map.infowindowOpened)return;
 
 if(this.siarea){
 this.div.removeChild(this.siarea);
}
 if(this.simap){
 this.div.removeChild(this.simap);
}
 if(this.aimap){
 if(this.aimap.length !=0){
 for(var i in this.aimap){
 if(!this.aimap.hasOwnProperty(i))continue;
 this.fn.removeChild(this.aimap[i]);
}
}
}
 this.aimap=new Object();
 
 
 
 wlt=document.getElementById("winlt"+this.div.id);
 wt=document.getElementById("wint"+this.div.id);
 wrt=document.getElementById("winrt"+this.div.id);
 wl=document.getElementById("winl"+this.div.id);
 wr=document.getElementById("winr"+this.div.id);
 wlb=document.getElementById("winlb"+this.div.id);
 wb=document.getElementById("winb"+this.div.id);
 wrb=document.getElementById("winrb"+this.div.id);
 slt=document.getElementById("shalt"+this.div.id);
 st=document.getElementById("shat"+this.div.id);
 srt=document.getElementById("shart"+this.div.id);
 sl=document.getElementById("shal"+this.div.id);
 slimg=document.getElementById("shalimg"+this.div.id);
 sc=document.getElementById("shac"+this.div.id);
 sr=document.getElementById("shar"+this.div.id);
 srimg=document.getElementById("sharimg"+this.div.id);
 slb=document.getElementById("shalb"+this.div.id);
 sb=document.getElementById("shab"+this.div.id);
 srb=document.getElementById("sharb"+this.div.id);
 sar=document.getElementById("shaar"+this.div.id);
 
 darea=document.getElementById("divarea"+this.div.id);
 darea.style.width="0px";
 darea.style.height=null;
 darea.style.overflowX="visible";
 darea.style.overflowY="visible";
 darea.innerHTML=this.html;//+"<pre>"+tmpstr+"</pre>";
 if(darea.offsetWidth<200){
 darea.style.width="200px";
}
 else if(darea.offsetWidth>400){
 darea.style.width="400px";
 darea.style.overflowX="scroll";
}
 if(darea.offsetHeight<16){
 darea.style.height="16px";
}
 else if(darea.offsetHeight>400){
 darea.style.height="400px";
 darea.style.overflowY="scroll";
}
 
 miw=this;
 win=document.getElementById("window"+this.div.id);
 sha=document.getElementById("shadow"+this.div.id);
 sha.style.position="absolute";
 
 win.onclick=function(){
 MEvent.EventMClickQueue["PmDf"]=1;
};
 win.onmousedown=function(e){
 MEvent.EventMDownQueue["PmDf"]=1;
};
 
 
 wlt.style.position="absolute";
 wlt.style.left="0px";
 wlt.style.top="0px";
 wlt.style.zIndex=5;
 wt.style.position="absolute";
 wt.style.left=(wlt.offsetLeft+wlt.offsetWidth)+"px";
 wt.style.top=wlt.style.top;
 wt.style.width=darea.offsetWidth+"px";
 wt.style.height=wlt.offsetHeight+"px";
 wt.style.zIndex=5;
 wrt.style.position="absolute";
 wrt.style.left=(wlt.offsetLeft+wlt.offsetWidth+darea.offsetWidth)+"px";
 wrt.style.top=wt.style.top;
 wrt.style.zIndex=5;
 wl.style.position="absolute";
 wl.style.left=wlt.style.left;
 wl.style.top=(wlt.offsetTop+wlt.offsetHeight)+"px";
 wl.style.width=wlt.offsetWidth+"px";
 wl.style.height=darea.offsetHeight+"px";
 wl.style.zIndex=5;
 darea.style.position="absolute";
 darea.style.left=wt.style.left;
 darea.style.top=(wt.offsetTop+wt.offsetHeight)+"px";
 darea.style.Height=(darea.offsetHeight+1);
 darea.style.zIndex=6;
 wr.style.position="absolute";
 wr.style.left=wrt.style.left;
 wr.style.top=darea.style.top;
 wr.style.width=wrt.offsetWidth+"px";
 wr.style.height=darea.offsetHeight+"px";
 wr.style.zIndex=5;
 wlb.style.position="absolute";
 wlb.style.left=wl.style.left;
 wlb.style.top=(wlt.offsetTop+wlt.offsetHeight+wl.offsetHeight)+"px";
 wlb.style.zIndex=5;
 wb.style.position="absolute";
 wb.style.left=darea.style.left;
 wb.style.top=(wlt.offsetTop+wlt.offsetHeight+wl.offsetHeight-1)+"px";
 wb.style.width=darea.offsetWidth+"px";
 wb.style.height=(wlb.offsetHeight+1)+"px";
 wb.style.zIndex=3;
 wrb.style.position="absolute";
 wrb.style.left=wr.style.left;
 wrb.style.top=wlb.style.top;
 wrb.style.zIndex=5;
 
 fa=document.getElementById("farea"+this.div.id);
 ar=document.getElementById("fukidashi"+miw.div.id);
 infodiv=document.getElementById("winlb"+miw.div.id);
 fa.style.position="absolute";
 ar.style.position="absolute";
 ar.style.top=(infodiv.offsetTop+infodiv.offsetHeight-8)+"px";
 ar.style.left=((wlt.offsetWidth+wt.offsetWidth+wrt.offsetWidth)/2)+"px";
 fa.style.zIndex=4;
 ar.style.zIndex=6;
 
 ci=document.getElementById("winclose"+miw.div.id);
 cp=document.getElementById("winrt"+miw.div.id);
 ci.style.position="absolute";
 ci.style.left=(cp.offsetLeft-11)+"px";
 ci.style.top=(cp.offsetTop+13)+"px";
 ci.style.zIndex=7;
 
 slt.style.position="absolute";
 slt.style.left=wlt.style.left;
 slt.style.top=wlt.style.top;
 slt.style.zIndex=1;
 st.style.position="absolute";
 st.style.left=wt.style.left;
 st.style.top=wt.style.top;
 st.style.width=wt.style.width;
 st.style.height=wt.style.height;
 st.style.zIndex=1;
 srt.style.position="absolute";
 srt.style.left=wrt.style.left;
 srt.style.top=wrt.style.top;
 srt.style.zIndex=1;
 sl.style.position="absolute";
 sl.style.left=wl.style.left;
 sl.style.top=wl.style.top;
 sl.style.width=wl.style.width;
 sl.style.height=wl.style.height;
 sl.style.zIndex=1;
 sc.style.position="absolute";
 sc.style.left=darea.style.left;
 sc.style.top=darea.style.top;
 sc.style.zIndex=1;
 sr.style.position="absolute";
 sr.style.left=wr.style.left;
 sr.style.top=wr.style.top;
 sr.style.width=wr.style.width;
 sr.style.height=wr.style.height;
 sr.style.zIndex=1;
 slb.style.position="absolute";
 slb.style.left=wlb.style.left;
 slb.style.top=wlb.style.top;
 slb.style.zIndex=1;
 sb.style.position="absolute";
 sb.style.left=wb.style.left;
 sb.style.top=wb.style.top;
 sb.style.width=wb.style.width;
 sb.style.height=wb.style.height;
 sb.style.zIndex=1;
 srb.style.position="absolute";
 srb.style.left=wrb.style.left;
 srb.style.top=wrb.style.top;
 srb.style.zIndex=1;
 sar.style.position="absolute";
 sar.style.left=ar.style.left;
 sar.style.top=ar.offsetTop;
 sar.style.zIndex=1;
 
 if(MBrowser.ie5up){
 bwidth=wlt.width;bheight=wlt.height;
 wlt.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+MMap.IMGPATH+"img/minfowindow/infowlt.png',sizingMethod='scale')";
 wlt.src=MMap.BLANKIMG;
 wlt.width=bwidth;wlt.height=bheight;
 bwidth=wt.width;bheight=wt.height;
 wt.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+MMap.IMGPATH+"img/minfowindow/infowt.png',sizingMethod='scale')";
 wt.src=MMap.BLANKIMG;
 wt.width=bwidth;st.height=bheight;
 bwidth=wrt.width;bheight=wrt.height;
 wrt.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+MMap.IMGPATH+"img/minfowindow/infowrt.png',sizingMethod='scale')";
 wrt.src=MMap.BLANKIMG;
 wrt.width=bwidth;wrt.height=bheight;
 bwidth=wl.width;bheight=wl.height;
 wl.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+MMap.IMGPATH+"img/minfowindow/infowl.png',sizingMethod='scale')";
 wl.src=MMap.BLANKIMG;
 wl.width=bwidth;wl.height=bheight;
 bwidth=darea.width;bheight=darea.height;
 darea.width=bwidth;sc.height=bheight;
 bwidth=sr.width;bheight=sr.height;
 wr.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+MMap.IMGPATH+"img/minfowindow/infowr.png',sizingMethod='scale')";
 wr.src=MMap.BLANKIMG;
 wr.width=bwidth;wr.height=bheight;
 bwidth=wrb.width;bheight=wrb.height;
 wrb.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+MMap.IMGPATH+"img/minfowindow/infowrb.png',sizingMethod='scale')";
 wrb.src=MMap.BLANKIMG;
 wrb.width=bwidth;wrb.height=bheight;
 bwidth=wb.width;bheight=wb.height;
 wb.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+MMap.IMGPATH+"img/minfowindow/infowb.png',sizingMethod='scale')";
 wb.src=MMap.BLANKIMG;
 wb.width=bwidth;wb.height=bheight;
 bwidth=wlb.width;bheight=wlb.height;
 wlb.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+MMap.IMGPATH+"img/minfowindow/infowlb.png',sizingMethod='scale')";
 wlb.src=MMap.BLANKIMG;
 wlb.width=bwidth;wlb.height=bheight;
 bwidth=ar.width;bheight=ar.height;
 ar.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+MMap.IMGPATH+"img/minfowindow/infowar.png',sizingMethod='scale')";
 ar.src=MMap.BLANKIMG;
 ar.width=bwidth;ar.height=bheight;
 bwidth=slt.width;bheight=slt.height;
 slt.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+MMap.IMGPATH+"img/minfowindow/shadowlt.png',sizingMethod='scale')";
 slt.src=MMap.BLANKIMG;
 slt.width=bwidth;slt.height=bheight;
 bwidth=st.width;bheight=st.height;
 st.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+MMap.IMGPATH+"img/minfowindow/shadowt.png',sizingMethod='scale')";
 st.src=MMap.BLANKIMG;
 st.width=bwidth;st.height=bheight;
 bwidth=srt.width;bheight=srt.height;
 srt.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+MMap.IMGPATH+"img/minfowindow/shadowrt.png',sizingMethod='scale')";
 srt.src=MMap.BLANKIMG;
 srt.width=bwidth;srt.height=bheight;
 bwidth=sl.width;bheight=sl.height;
 sl.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+MMap.IMGPATH+"img/minfowindow/shadowl.png',sizingMethod='scale')";
 sl.src=MMap.BLANKIMG;
 sl.width=bwidth;sl.height=bheight;
 bwidth=sc.width;bheight=sc.height;
 sc.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+MMap.IMGPATH+"img/minfowindow/shadowc.png',sizingMethod='scale')";
 sc.src=MMap.BLANKIMG;
 sc.width=bwidth;sc.height=bheight;
 bwidth=sr.width;bheight=sr.height;
 sr.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+MMap.IMGPATH+"img/minfowindow/shadowr.png',sizingMethod='scale')";
 sr.src=MMap.BLANKIMG;
 sr.width=bwidth;sr.height=bheight;
 bwidth=srb.width;bheight=srb.height;
 srb.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+MMap.IMGPATH+"img/minfowindow/shadowrb.png',sizingMethod='scale')";
 srb.src=MMap.BLANKIMG;
 srb.width=bwidth;srb.height=bheight;
 bwidth=sb.width;bheight=sb.height;
 sb.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+MMap.IMGPATH+"img/minfowindow/shadowb.png',sizingMethod='scale')";
 sb.src=MMap.BLANKIMG;
 sb.width=bwidth;sb.height=bheight;
 bwidth=slb.width;bheight=slb.height;
 slb.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+MMap.IMGPATH+"img/minfowindow/shadowlb.png',sizingMethod='scale')";
 slb.src=MMap.BLANKIMG;
 slb.width=bwidth;slb.height=bheight;
 bwidth=sar.width;bheight=sar.height;
 sar.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+MMap.IMGPATH+"img/minfowindow/shadowar.png',sizingMethod='scale')";
 sar.src=MMap.BLANKIMG;
 sar.width=bwidth;sar.height=bheight;
}
 
 darea.onclick=function(){
 MEvent.EventMClickQueue["PmDf"]=1;
};
 darea.onmousedown=function(e){
 MEvent.EventMDownQueue["PmDf"]=1;
};
 
 miw.div.style.width=(wlt.offsetWidth+wt.offsetWidth+wrt.offsetWidth)+"px";
 miw.div.style.height=(wlt.offsetHeight+wl.offsetHeight+wlb.offsetHeight+ar.offsetHeight-10)+"px";
 pp=miw.map.r2p(miw.rpos,miw.map.zid);
 miw.div.style.left=(miw.offset.width+pp.x-((wlt.offsetWidth+wt.offsetWidth+wrt.offsetWidth)/2)-3)+"px";
 miw.div.style.top=(pp.y-(miw.offset.height+miw.div.offsetHeight))+"px";
 miw.div.style.zIndex=300;
 if(miw.onOpenFn)miw.onOpenFn.call();
 miw.div.style.visibility="visible";
 
 if(this.move==true){
 dp=new MPoint(this.div.offsetLeft,this.div.offsetTop);
 dsp=this.map.p2s(dp);
 if(dsp.y<0 && dsp.x<0){
 var pc=this.map.s2p(this.map.sc,this.map.zid);
 var sp=new MPoint(this.map.sc.x+dsp.x-2,this.map.sc.y+dsp.y-2);
 var pm=this.map.s2p(sp,this.map.zid);
 this.map.smoveToRPoint(this.map.p2r(pm));
}
 else if(dsp.y<0 && this.map.div.offsetWidth<dsp.x+miw.div.offsetWidth){
 var pc=this.map.s2p(this.map.sc,this.map.zid);
 var sp=new MPoint(this.map.sc.x+(dsp.x+miw.div.offsetWidth-this.map.div.offsetWidth)+2,this.map.sc.y+dsp.y-2);
 var pm=this.map.s2p(sp,this.map.zid);
 this.map.smoveToRPoint(this.map.p2r(pm));
}
 else if(dsp.y<0){
 var pc=this.map.s2p(this.map.sc,this.map.zid);
 var sp=new MPoint(this.map.sc.x,this.map.sc.y+dsp.y-2);
 var pm=this.map.s2p(sp,this.map.zid);
 this.map.smoveToRPoint(this.map.p2r(pm));
}
 else if(dsp.x<0){
 var pc=this.map.s2p(this.map.sc,this.map.zid);
 var sp=new MPoint(this.map.sc.x+dsp.x-2,this.map.sc.y);
 var pm=this.map.s2p(sp,this.map.zid);
 this.map.smoveToRPoint(this.map.p2r(pm));
}
 else if(this.map.div.offsetWidth<dsp.x+miw.div.offsetWidth){
 var pc=this.map.s2p(this.map.sc,this.map.zid);
 var sp=new MPoint(this.map.sc.x+(dsp.x+miw.div.offsetWidth-this.map.div.offsetWidth)+2,this.map.sc.y);
 var pm=this.map.s2p(sp,this.map.zid);
 this.map.smoveToRPoint(this.map.p2r(pm));
}
 this.move=false;
}
 
 
 x1=this.div.offsetLeft+wlt.offsetLeft;
 y1=this.div.offsetTop+wlt.offsetTop;
 x2=this.div.offsetLeft+srt.offsetLeft+srt.offsetWidth;
 y2=this.div.offsetTop+sar.offsetTop+sar.offsetHeight;
 p1=new MPoint(x1,y1);
 p2=new MPoint(x2,y2);
 
 wx1=this.div.offsetLeft+wlt.offsetLeft;
 wy1=this.div.offsetTop+wlt.offsetTop;
 wx2=this.div.offsetLeft+wrb.offsetLeft+wrb.offsetWidth;
 wy2=this.div.offsetTop+wrb.offsetTop+wrb.offsetHeight;
 wp1=new MPoint(wx1,wy1);
 wp2=new MPoint(wx2,wy2);
 
 marray=this.map.markerArray;
 
 isimg=document.createElement("IMG");
 isimg.src=MMap.BLANKIMG;
 this.div.appendChild(isimg);
 this.siarea=isimg;
 isimg.style.position="absolute";
 isimg.style.left=0+"px";
 isimg.style.top=0+"px";
 isimg.style.width=(x2-x1)+"px";
 isimg.style.height=(y2-y1)+"px";
 isimg.style.zIndex=4;
 isimg.border=0;
 i_=document.createElement("MAP");
 i_.id="map"+this.div.id;
 i_.name="map"+this.div.id;
 this.div.appendChild(i_);
 isimg.useMap="#"+i_.name;
 this.simap=i_;
 
 ma=new Array();
 for(var ai in marray){
 if(!marray.hasOwnProperty(ai))continue;
 ma.push(marray[ai]);
}
 
 fx=ar.offsetLeft;
 fy=ar.offsetTop;
 ia_=document.createElement("AREA");
 ia_.shape="poly";
 ia_.coords=(24+fx)+","+(0+fy)+","+(7+fx)+","+(6+fy)+","+(32+fx)+","+(18+fy)+","+(7+fx)+","+(45+fy)+","+(49+fx)+","+(15+fy)+","+(27+fx)+","+(5+fy)+","+(34+fx)+","+(0+fy)+","+(12+fx)+","+(0+fy);
 ia_.onmousedown=function(e){
 MEvent.EventMDownQueue["PmDf"]=1;
};
 i_.appendChild(ia_);
 ia_.oP=this.div;
 ia_.onclick=this.close;
 wbx=wb.offsetLeft;
 wby=wb.offsetTop;
 wbw=wb.offsetWidth;
 wbh=wb.offsetHeight;
 ia_=document.createElement("AREA");
 ia_.shape="poly";
 ia_.coords=wbx+","+wby+","+wbx+","+(wby+wbh)+","+(wbx+wbw)+","+(wby+wbh)+","+(wbx+wbw)+","+wby+","+wbx+","+wby;
 ia_.onmousedown=function(e){
 MEvent.EventMDownQueue["PmDf"]=1;
};
 ia_.onclick=function(e){
 MEvent.EventMClickQueue["PmDf"]=1;
};
 i_.appendChild(ia_);
 
 for(var i=ma.length-1;i>=0;i--){
 bp=this.map.r2p(ma[i].rpos);
 bp.x-=ma[i].icon.offsetX;
 bp.y-=ma[i].icon.offsetY;
 box=new MBox(p1.x-ma[i].icon.width,p1.y-ma[i].icon.height,p2.x,p2.y);
 wbox=new MBox(wp1.x,wp1.y,wp2.x-ma[i].icon.width,wp2.y-ma[i].icon.heigh);
 if(box.contains(bp)&& !wbox.contains(bp)){
 ia_=document.createElement("AREA");
 ia_.shape="poly";
 ia_.coords=ma[i].icon.getOffsetCoords(ma[i].div.offsetLeft-x1,ma[i].div.offsetTop-y1);
 i_.appendChild(ia_);
 if(ma[i].div.onclick)ia_.onclick=ma[i].div.onclick;
 if(ma[i].div.ondblclick)ia_.ondblcklick=ma[i].div.ondblclick;
 if(ma[i].div.onmousedown)ia_.onmousedown=ma[i].div.onmousedown;
 if(ma[i].div.onmouseup)ia_.onmouseup=ma[i].div.onmouseup;
 if(ma[i].div.onmouseover)ia_.onmouseover=ma[i].div.onmouseover;
 if(ma[i].div.onmouseoot)ia_.onmouseout=ma[i].div.onmouseoot;
 if(ma[i].div.onmousemove)ia_.onmousemove=ma[i].div.onmousemove;
 if(ma[i].ia_ && ma[i].ia_.onclick)ia_.onclick=ma[i].ia_.onclick;
 if(ma[i].ia_ && ma[i].ia_.ondblclick)ia_.ondblcklick=ma[i].ia_.ondblclick;
 if(ma[i].ia_ && ma[i].ia_.onmousedown)ia_.onmousedown=ma[i].ia_.onmousedown;
 if(ma[i].ia_ && ma[i].ia_.onmouseup)ia_.onmouseup=ma[i].ia_.onmouseup;
 if(ma[i].ia_ && ma[i].ia_.onmouseover)ia_.onmouseover=ma[i].ia_.onmouseover;
 if(ma[i].ia_ && ma[i].ia_.onmouseoot)ia_.onmouseout=ma[i].ia_.onmouseoot;
 if(ma[i].ia_ && ma[i].ia_.onmousemove)ia_.onmousemove=ma[i].ia_.onmousemove;
}
}
};
 
 MInfoWindow.prototype.adjust=function(){
 harea.style.width=harea.offsetWidth<200?(200+"px"):(harea.offsetWidth>400?400:harea.offsetWidth)+"px";
 harea.style.height=harea.offsetHeight+"px";
 
 ar=document.getElementById("fukidashi"+this.div.id);
 infodiv=document.getElementById("winlb"+this.div.id);
 ar.style.top=(infodiv.offsetTop+infodiv.offsetHeight-2)+"px";
 ar.innerHTML="<img src="+MMap.IMGPATH+"img/minfowindow/infowar.png height=64>";
 ci=document.getElementById("winclose"+this.div.id);
 cp=document.getElementById("winrt"+this.div.id);
 ci.style.position="absolute";
 ci.style.left=cp.offsetLeft-6+"px";
 
 
 pp=this.map.r2p(this.rpos,this.map.zid);
 this.div.style.left=(pp.x)+"px";
 this.div.style.top=(pp.y-(this.offset.height+this.div.offsetHeight))+"px";
 this.div.style.zIndex=300;
 if(this.onOpenFn)this.onOpenFn.call();
};
 
 
 
 function MInfoWindowG(map){
 this.map=map;
 this.rpos=new MPoint(0,0);
 this.onOpenFn=null;
 this.onCloseFn=null;
 this.offset=null;
 this.move=false;
 
 this.div=document.createElement("DIV");
 this.div.id="SingleInfowindow"+MInfoWindowG.ID++;
 this.div.oP=this;
 
 this.div.innerHTML=''+
 
 '<div id=window'+this.div.id+'>'+
 '<img id=winlt'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindowg/infowlt.png">'+
 '<img id=wint'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindowg/infowt.png">'+
 '<img id=winrt'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindowg/infowrt.png">'+
 '<img id=winl'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindowg/infowl.png">'+
 '<div id=divarea'+this.div.id+' style="background-image: url('+MMap.IMGPATH+'img/minfowindowg/infowc.png);">Default</div>'+
 '<img id=winr'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindowg/infowr.png">'+
 '<img id=winlb'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindowg/infowlb.png">'+
 '<img id=winb'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindowg/infowb.png">'+
 '<img id=winrb'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindowg/infowrb.png">'+
 '<img id=winclose'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindowg/close.gif">'+
 '</div>'+
 '<div id=shadow'+this.div.id+' style="text-align:left;left:0px;top:0px;" align="left">'+
 '<img id=shalt'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindowg/shadowlt.png">'+
 '<img id=shat'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindowg/shadowt.png">'+
 '<img id=shart'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindowg/shadowrt.png">'+
 '<div id=shal'+this.div.id+'><img id=shalimg'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindowg/shadowl.png"></div>'+
 '<img id=shac'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindowg/shadowc.png">'+
 '<div id=shar'+this.div.id+'><img id=sharimg'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindowg/shadowr.png"></div>'+
 '<img id=shalb'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindowg/shadowlb.png">'+
 '<img id=shab1'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindowg/shadowb.png">'+
 '<img id=shaar'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindowg/shadowar.png">'+
 '<img id=shab2'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindowg/shadowb.png">'+
 '<img id=sharb'+this.div.id+' src="'+MMap.IMGPATH+'img/minfowindowg/shadowrb.png">'+
 '</div>'+
 '<div id="farea'+this.div.id+'" style="text-align:left;left:0px;top:0px;" align="left">'+
 '<img id="fukidashi'+this.div.id+'" border=0 src="'+MMap.IMGPATH+'img/minfowindowg/infowar.png"></div>'+
 '</div>';
 
 this.div.style.position="absolute";
 this.div.style.visibility="hidden";
 this.map.infodiv.appendChild(this.div);
 
 this.divArea=document.getElementById("divarea"+this.div.id);
 this.divArea.style.position="absolute";
 if(this.divArea.offsetWidth==0){
 this.divArea.style.position=null;
}
 if(this.divArea.attachEvent){
 this.divArea.onmousewheel=cancelBubble;
}else if(this.divArea.addEventListener){
 this.divArea.addEventListener("DOMMouseScroll",cancelBubble,false);
}
 if(MBrowser.safari){
 this.divArea.onmousewheel=cancelBubble;
}
 
 this.tID=null;
 
 this.closediv=document.getElementById("winclose"+this.div.id);
 this.closediv.oP=this.div;
 this.closediv.onclick=this.close;
 this.farea=document.getElementById("farea"+this.div.id);
 thisobj=this;
 this.farea.style.position="absolute";
 this.ar=document.getElementById("fukidashi"+this.div.id);
 this.ar.style.position="absolute";
 
};
 MInfoWindowG.ID=0;
 MInfoWindowG.prototype.close=function(){
 MEvent.EventMClickQueue["PmDf"]=1;
 var pobj=this.oP.oP;
 if(pobj.siarea){
 pobj.div.removeChild(pobj.siarea);
 pobj.siarea=null;
}
 if(pobj.simap){
 pobj.div.removeChild(pobj.simap);
 pobj.simap=null;
}
 if(pobj.aimap){
 for(var i in pobj.aimap){
 if(!pobj.aimap.hasOwnProperty(i))continue;
 pobj.fn.removeChild(pobj.aimap[i]);
}
}
 pobj.aimap=new Object();
 this.oP.style.visibility="hidden";
 pobj.map.infowindowOpened=false;
 if(pobj.onCloseFn)pobj.onCloseFn.call();
 pobj.infowindowOpened=false;
 
 var cb=null;
 if(cb=MEvent.hash[this.oP.oP.map.id+"infowindowclose"]){
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].apply(this.oP.oP.map);
}
}
 
};
 MInfoWindowG.prototype.show=function(rp,html,offset,onOpenFn,onCloseFn){
 this.rpos=rp;
 this.html=html;
 offset?this.offset=offset:this.offset=new MSize(0,0);
 this.onOpenFn=onOpenFn;
 this.onCloseFn=onCloseFn;
 this.move=true;
 this.draw();
};
 MInfoWindowG.prototype.draw=function(){
 this.div.style.visibility="hidden";
 if(!this.map.infowindowOpened)return;
 
 if(this.tID){
 clearInterval(this.tID);
 this.tID=null;
}
 
 this.divArea.innerHTML="";
 this.divArea.style.width=null;
 this.divArea.style.height=null;
 
 this.divArea.innerHTML=this.html;
 var infoW=this;
 var i=0;
 this.tID=setTimeout(function(){
 clearInterval(infoW.tID);
 infoW.drawing();
 infoW.tID=null;
},10);
}
 MInfoWindowG.prototype.drawing=function(){
 if(!this.map.infowindowOpened)return;
 var tempW=this.divArea.offsetWidth;
 var tempH=this.divArea.offsetHeight;
 
 if(this.siarea){
 this.div.removeChild(this.siarea);
}
 if(this.simap){
 this.div.removeChild(this.simap);
}
 if(this.aimap){
 if(this.aimap.length !=0){
 for(var i in this.aimap){
 if(!this.aimap.hasOwnProperty(i))continue;
 this.fn.removeChild(this.aimap[i]);
}
}
}
 this.aimap=new Object();
 
 
 
 var wlt=document.getElementById("winlt"+this.div.id);
 var wt=document.getElementById("wint"+this.div.id);
 var wrt=document.getElementById("winrt"+this.div.id);
 var wl=document.getElementById("winl"+this.div.id);
 var wr=document.getElementById("winr"+this.div.id);
 var wlb=document.getElementById("winlb"+this.div.id);
 var wb=document.getElementById("winb"+this.div.id);
 var wrb=document.getElementById("winrb"+this.div.id);
 var slt=document.getElementById("shalt"+this.div.id);
 var st=document.getElementById("shat"+this.div.id);
 var srt=document.getElementById("shart"+this.div.id);
 var sl=document.getElementById("shal"+this.div.id);
 var slimg=document.getElementById("shalimg"+this.div.id);
 var sc=document.getElementById("shac"+this.div.id);
 var sr=document.getElementById("shar"+this.div.id);
 var srimg=document.getElementById("sharimg"+this.div.id);
 var slb=document.getElementById("shalb"+this.div.id);
 var sb1=document.getElementById("shab1"+this.div.id);
 var sar=document.getElementById("shaar"+this.div.id);
 var sb2=document.getElementById("shab2"+this.div.id);
 var srb=document.getElementById("sharb"+this.div.id);
 
 var darea=this.divArea;
 darea.style.width=tempW+"px";
 darea.style.height=tempH+"px";
 darea.style.overflowX="visible";
 darea.style.overflowY="visible";
 if(darea.offsetWidth<250){
 darea.style.width="250px";
}
 if(darea.offsetHeight<32){
 darea.style.height="32px";
}
 
 var miw=this;
 var win=document.getElementById("window"+this.div.id);
 var sha=document.getElementById("shadow"+this.div.id);
 sha.style.position="absolute";
 
 win.onclick=function(){
 MEvent.EventMClickQueue["PmDf"]=1;
};
 win.onmousedown=function(e){
 MEvent.EventMDownQueue["PmDf"]=1;
};
 
 
 wlt.style.position="absolute";
 wlt.style.left="0px";
 wlt.style.top="0px";
 win.style.zIndex=5;
 wt.style.position="absolute";
 wt.style.left=wlt.offsetWidth+"px";
 wt.style.top=wlt.style.top;
 wt.style.width=darea.offsetWidth+"px";
 wt.style.height=wlt.offsetHeight+"px";
 wt.style.zIndex=5;
 wrt.style.position="absolute";
 wrt.style.left=(wlt.offsetWidth+darea.offsetWidth)+"px";
 wrt.style.top=wt.style.top;
 wrt.style.zIndex=5;
 wl.style.position="absolute";
 wl.style.left=wlt.style.left;
 wl.style.top=(wlt.offsetTop+wlt.offsetHeight)+"px";
 wl.style.width=wlt.offsetWidth+"px";
 wl.style.height=darea.offsetHeight+"px";
 wl.style.zIndex=5;
 darea.style.position="absolute";
 darea.style.left=wt.style.left;
 darea.style.top=(wt.offsetTop+wt.offsetHeight)+"px";
 darea.style.zIndex=6;
 wr.style.position="absolute";
 wr.style.left=wrt.style.left;
 wr.style.top=darea.style.top;
 wr.style.width=wrt.offsetWidth+"px";
 wr.style.height=darea.offsetHeight+"px";
 wr.style.zIndex=5;
 wlb.style.position="absolute";
 wlb.style.left=wl.style.left;
 wlb.style.top=(wlt.offsetTop+wlt.offsetHeight+wl.offsetHeight)+"px";
 wlb.style.zIndex=5;
 wb.style.position="absolute";
 wb.style.left=darea.style.left;
 wb.style.top=(wlt.offsetTop+wlt.offsetHeight+wl.offsetHeight-1)+"px";
 wb.style.width=darea.offsetWidth+"px";
 wb.style.height=(wlb.offsetHeight+1)+"px";
 wb.style.zIndex=2;
 wrb.style.position="absolute";
 wrb.style.left=wr.style.left;
 wrb.style.top=wb.style.top;
 wrb.style.zIndex=5;
 
 var fa=document.getElementById("farea"+this.div.id);
 var ar=document.getElementById("fukidashi"+miw.div.id);
 infodiv=document.getElementById("winlb"+miw.div.id);
 fa.style.position="absolute";
 ar.style.position="absolute";
 ar.style.top=(infodiv.offsetTop+infodiv.offsetHeight-2)+"px";
 ar.style.left=((wlt.offsetWidth+wt.offsetWidth+wrt.offsetWidth)/2)+"px";
 fa.style.zIndex=3;
 
 var ci=document.getElementById("winclose"+miw.div.id);
 var cp=document.getElementById("winrt"+miw.div.id);
 ci.style.position="absolute";
 ci.style.left=(cp.offsetLeft-6)+"px";
 ci.style.top=(cp.offsetTop+6)+"px";
 ci.style.zIndex=7;
 
 var daheight=Math.floor((darea.offsetHeight-slt.offsetHeight-slb.offsetHeight/2)/2);
 if(daheight<0)daheight=0;
 var wheight=ar.offsetTop+ar.offsetHeight-wt.offsetTop;
 sl.style.height=daheight+"px";
 slt.style.position="absolute";
 slt.style.left=Math.floor(sar.offsetWidth/2+daheight)+"px";
 slt.style.top=(wheight-daheight-slt.offsetHeight-slb.offsetHeight)+"px";
 slt.style.zIndex=0;
 st.style.position="absolute";
 st.style.left=(slt.offsetWidth+slt.offsetLeft)+"px";
 st.style.top=slt.style.top;
 st.style.width=Math.floor((darea.offsetWidth-slt.offsetWidth-srt.offsetWidth)*1.5)+"px";
 st.style.height=slt.offsetHeight+"px";
 st.style.zIndex=0;
 srt.style.position="absolute";
 srt.style.left=(st.offsetLeft+st.offsetWidth)+"px";
 srt.style.top=st.style.top;
 srt.style.zIndex=0;
 sl.style.overflow="hidden";
 sl.style.position="absolute";
 if(MBrowser.ie5up){
 sl.style.width=Math.floor((sl.offsetHeight)*(slimg.offsetWidth/slimg.offsetHeight)+19)+"px";
}else{
 sl.style.width=Math.floor((sl.offsetHeight)*(slimg.offsetWidth/slimg.offsetHeight)+15)+"px";
}
 sl.style.top=(slt.offsetTop+slt.offsetHeight)+"px";
 sl.style.left=(slt.offsetLeft-sl.offsetWidth+24)+"px";
 sl.style.zIndex=0;
 slimg.style.position="absolute";
 slimg.style.right="-56px";
 sr.style.overflow="hidden";
 sr.style.position="absolute";
 sr.style.height=(sl.offsetHeight)+"px";
 sr.style.width=Math.floor((sr.offsetHeight)*(srimg.offsetWidth/srimg.offsetHeight)+15)+"px";
 sr.style.zIndex=0;
 sc.style.position="absolute";
 sc.style.left=(sl.offsetLeft+sl.offsetWidth)+"px";
 sc.style.top=(slt.offsetTop+st.offsetHeight)+"px";
 sc.style.zIndex=0;
 if((st.offsetWidth+slt.offsetWidth-sr.offsetWidth+36)<0){
 sc.style.width="36px";
}else{
 sc.style.width=(st.offsetWidth+slt.offsetWidth-sr.offsetWidth+36)+"px";
}
 sc.style.height=(sl.offsetHeight)+"px";
 sr.style.left=(sc.offsetLeft+sc.offsetWidth)+"px";
 sr.style.top=sc.style.top;
 sr.style.zIndex=0;
 srimg.style.position="absolute";
 srimg.style.right="-6px";
 slb.style.position="absolute";
 if(MBrowser.ie5up){
 slb.style.left=(sc.offsetLeft-Math.floor((sl.offsetWidth+1)*0.78)-39)+"px";
}else{
 slb.style.left=(sc.offsetLeft-Math.floor(sl.offsetWidth*0.78)-43)+"px";
}
 slb.style.top=(slt.offsetTop+slt.offsetHeight+sl.offsetHeight)+"px";
 slb.style.zIndex=0;
 sar.style.position="absolute";
 sar.style.left=ar.style.left;
 sar.style.top=slb.style.top;
 sar.style.zIndex=0;
 sb1.style.position="absolute";
 sb1.style.left=(slb.offsetLeft+slb.offsetWidth)+"px";
 sb1.style.top=(slt.offsetTop+slt.offsetHeight+sl.offsetHeight)+"px";
 sb1.style.width=(sar.offsetLeft-(slb.offsetLeft+slb.offsetWidth))+"px";
 sb1.style.height=(slb.offsetHeight)+"px";
 sb1.style.zIndex=0;
 sb2.style.position="absolute";
 sb2.style.height=(slb.offsetHeight)+"px";
 sb2.style.left=(sar.offsetLeft+sar.offsetWidth)+"px";
 sb2.style.top=(slt.offsetTop+slt.offsetHeight+sl.offsetHeight)+"px";
 sb2.style.zIndex=0;
 var w=slt.offsetWidth+st.offsetWidth+slt.offsetWidth-srb.offsetWidth-sar.offsetWidth-sb1.offsetWidth-slb.offsetWidth;
 if(w<0)w=0;
 sb2.style.width=(w+30)+"px";
 srb.style.position="absolute";
 srb.style.left=(sb2.offsetLeft+sb2.offsetWidth)+"px";
 srb.style.top=slb.style.top;
 
 if(MBrowser.ie5up){
 sl.style.width=Math.floor((sl.offsetHeight)*(slimg.offsetWidth/slimg.offsetHeight)+19)+"px";
}else{
 sl.style.width=Math.floor((sl.offsetHeight)*(slimg.offsetWidth/slimg.offsetHeight)+15)+"px";
}
 sr.style.left=(sc.offsetLeft+sc.offsetWidth)+"px";
 sr.style.top=sc.style.top;
 sr.style.zIndex=0;
 srimg.style.right="-6px";
 if(MBrowser.ie5up){
 slb.style.left=(sc.offsetLeft-Math.floor((sl.offsetWidth+1)*0.78)-39)+"px";
}else{
 slb.style.left=(sc.offsetLeft-Math.floor(sl.offsetWidth*0.78)-43)+"px";
}
 slb.style.top=(slt.offsetTop+slt.offsetHeight+sl.offsetHeight)+"px";
 sb1.style.left=(slb.offsetLeft+slb.offsetWidth)+"px";
 sb1.style.top=(slt.offsetTop+slt.offsetHeight+sl.offsetHeight)+"px";
 sb1.style.width=(sar.offsetLeft-(slb.offsetLeft+slb.offsetWidth))+"px";
 sb1.style.height=(slb.offsetHeight)+"px";
 sb2.style.height=(slb.offsetHeight)+"px";
 sb2.style.left=(sar.offsetLeft+sar.offsetWidth)+"px";
 sb2.style.top=(slt.offsetTop+slt.offsetHeight+sl.offsetHeight)+"px";
 w=slt.offsetWidth+st.offsetWidth+slt.offsetWidth-srb.offsetWidth-sar.offsetWidth-sb1.offsetWidth-slb.offsetWidth;
 if(w<0)w=0;
 sb2.style.width=(w+30)+"px";
 srb.style.left=(sb2.offsetLeft+sb2.offsetWidth)+"px";
 srb.style.top=slb.style.top;
 
 if(MBrowser.ie5up){
 var bwidth=slt.width;bheight=slt.height;
 slt.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+MMap.IMGPATH+"img/minfowindowg/shadowlt.png',sizingMethod='scale')";
 slt.src=MMap.BLANKIMG;
 slt.width=bwidth;slt.height=bheight;
 bwidth=st.width;bheight=st.height;
 st.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+MMap.IMGPATH+"img/minfowindowg/shadowt.png',sizingMethod='scale')";
 st.src=MMap.BLANKIMG;
 st.width=bwidth;st.height=bheight;
 bwidth=srt.width;bheight=srt.height;
 srt.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+MMap.IMGPATH+"img/minfowindowg/shadowrt.png',sizingMethod='scale')";
 srt.src=MMap.BLANKIMG;
 srt.width=bwidth;srt.height=bheight;
 bwidth=slimg.width;bheight=slimg.height;
 slimg.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+MMap.IMGPATH+"img/minfowindowg/shadowl.png',sizingMethod='scale')";
 slimg.src=MMap.BLANKIMG;
 slimg.width=bwidth;slimg.height=bheight;
 bwidth=sc.width;bheight=sc.height;
 sc.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+MMap.IMGPATH+"img/minfowindowg/shadowc.png',sizingMethod='scale')";
 sc.src=MMap.BLANKIMG;
 sc.width=bwidth;sc.height=bheight;
 bwidth=srimg.width;bheight=srimg.height;
 srimg.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+MMap.IMGPATH+"img/minfowindowg/shadowr.png',sizingMethod='scale')";
 srimg.src=MMap.BLANKIMG;
 srimg.width=bwidth;srimg.height=bheight;
 bwidth=srb.width;bheight=srb.height;
 srb.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+MMap.IMGPATH+"img/minfowindowg/shadowrb.png',sizingMethod='scale')";
 srb.src=MMap.BLANKIMG;
 srb.width=bwidth;srb.height=bheight;
 bwidth=sb1.width;bheight=sb1.height;
 sb1.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+MMap.IMGPATH+"img/minfowindowg/shadowb.png',sizingMethod='scale')";
 sb1.src=MMap.BLANKIMG;
 sb1.width=bwidth;sb1.height=bheight;
 bwidth=sb2.width;bheight=sb2.height;
 sb2.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+MMap.IMGPATH+"img/minfowindowg/shadowb.png',sizingMethod='scale')";
 sb2.src=MMap.BLANKIMG;
 sb2.width=bwidth;sb2.height=bheight;
 bwidth=slb.width;bheight=slb.height;
 slb.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+MMap.IMGPATH+"img/minfowindowg/shadowlb.png',sizingMethod='scale')";
 slb.src=MMap.BLANKIMG;
 slb.width=bwidth;slb.height=bheight;
 bwidth=sar.width;bheight=sar.height;
 sar.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+MMap.IMGPATH+"img/minfowindowg/shadowar.png',sizingMethod='scale')";
 sar.src=MMap.BLANKIMG;
 sar.width=bwidth;sar.height=bheight;
}
 
 miw.div.style.width=(wlt.offsetWidth+wt.offsetWidth+wrt.offsetWidth)+"px";
 miw.div.style.height=(wlt.offsetHeight+wl.offsetHeight+wlb.offsetHeight+ar.offsetHeight)+"px";
 pp=miw.map.r2p(miw.rpos,miw.map.zid);
 miw.div.style.left=(pp.x+miw.offset.width-((wlt.offsetWidth+wt.offsetWidth+wrt.offsetWidth)/2))+"px";
 miw.div.style.top=(pp.y-(miw.offset.height+miw.div.offsetHeight))+"px";
 miw.div.style.zIndex=300;
 if(miw.onOpenFn)miw.onOpenFn.call();
 miw.div.style.visibility="visible";
 
 if(this.move==true){
 var mtop=this.map.infoWindowAppearableDivisionMarginTop;
 var mleft=this.map.infoWindowAppearableDivisionMarginLeft;
 var mright=this.map.infoWindowAppearableDivisionMarginRight;
 var mbottom=this.map.infoWindowAppearableDivisionMarginBottom;
 
 var dp=new MPoint(this.div.offsetLeft,this.div.offsetTop);
 var dsp=this.map.p2s(dp);
 if(dsp.y<mtop && dsp.x<mleft){
 var sp=new MPoint(this.map.sc.x+dsp.x-2-mleft,this.map.sc.y+dsp.y-2-mtop);
 var pm=this.map.s2p(sp,this.map.zid);
 this.map.smoveToRPoint(this.map.p2r(pm));
}
 else if(dsp.y<mtop && this.map.div.offsetWidth<dsp.x+miw.div.offsetWidth+mright){
 var sp=new MPoint(this.map.sc.x+(dsp.x+miw.div.offsetWidth-this.map.div.offsetWidth)+2+mright,this.map.sc.y+dsp.y-2-mtop);
 var pm=this.map.s2p(sp,this.map.zid);
 this.map.smoveToRPoint(this.map.p2r(pm));
}
 else if(this.map.div.offsetHeight<dsp.y+miw.div.offsetHeight+mbottom && dsp.x<mleft){
 var sp=new MPoint(this.map.sc.x+dsp.x-2-mleft,this.map.sc.y+(dsp.y+miw.div.offsetHeight-this.map.div.offsetHeight)+2+mbottom);
 var pm=this.map.s2p(sp,this.map.zid);
 this.map.smoveToRPoint(this.map.p2r(pm));
}
 else if(this.map.div.offsetHeight<dsp.y+miw.div.offsetHeight+mbottom && this.map.div.offsetWidth<dsp.x+miw.div.offsetWidth+mright){
 var sp=new MPoint(this.map.sc.x+(dsp.x+miw.div.offsetWidth-this.map.div.offsetWidth)+2+mright,this.map.sc.y+(dsp.y+miw.div.offsetHeight-this.map.div.offsetHeight)+2+mbottom);
 var pm=this.map.s2p(sp,this.map.zid);
 this.map.smoveToRPoint(this.map.p2r(pm));
}
 else if(dsp.y<mtop){
 var sp=new MPoint(this.map.sc.x,this.map.sc.y+dsp.y-2-mtop);
 var pm=this.map.s2p(sp,this.map.zid);
 this.map.smoveToRPoint(this.map.p2r(pm));
}
 else if(dsp.x<mleft){
 var sp=new MPoint(this.map.sc.x+dsp.x-2-mleft,this.map.sc.y);
 var pm=this.map.s2p(sp,this.map.zid);
 this.map.smoveToRPoint(this.map.p2r(pm));
}
 else if(this.map.div.offsetWidth<dsp.x+miw.div.offsetWidth+mright){
 var sp=new MPoint(this.map.sc.x+(dsp.x+miw.div.offsetWidth-this.map.div.offsetWidth)+2+mright,this.map.sc.y);
 var pm=this.map.s2p(sp,this.map.zid);
 this.map.smoveToRPoint(this.map.p2r(pm));
}
 else if(this.map.div.offsetHeight<dsp.y+miw.div.offsetHeight+mbottom){
 var sp=new MPoint(this.map.sc.x,this.map.sc.y+(dsp.y+miw.div.offsetHeight-this.map.div.offsetHeight)+2+mbottom);
 var pm=this.map.s2p(sp,this.map.zid);
 this.map.smoveToRPoint(this.map.p2r(pm));
}
 this.move=false;
}
 
 
 var x1=this.div.offsetLeft+wlt.offsetLeft;
 var y1=this.div.offsetTop+wlt.offsetTop;
 var x2=this.div.offsetLeft+srt.offsetLeft+srt.offsetWidth;
 var y2=this.div.offsetTop+sar.offsetTop+sar.offsetHeight;
 var p1=new MPoint(x1,y1);
 var p2=new MPoint(x2,y2);
 
 var wx1=this.div.offsetLeft+wlt.offsetLeft;
 var wy1=this.div.offsetTop+wlt.offsetTop;
 var wx2=this.div.offsetLeft+wrb.offsetLeft+wrb.offsetWidth;
 var wy2=this.div.offsetTop+wrb.offsetTop+wrb.offsetHeight;
 var wp1=new MPoint(wx1,wy1);
 var wp2=new MPoint(wx2,wy2);
 
 var marray=this.map.markerArray;
 
 var isimg=document.createElement("IMG");
 isimg.src=MMap.BLANKIMG;
 this.div.appendChild(isimg);
 this.siarea=isimg;
 isimg.style.position="absolute";
 isimg.style.left=0+"px";
 isimg.style.top=0+"px";
 isimg.style.width=(x2-x1)+"px";
 isimg.style.height=(y2-y1)+"px";
 isimg.style.zIndex=4;
 isimg.border=0;
 var i_=document.createElement("MAP");
 i_.id="map"+this.div.id;
 i_.name="map"+this.div.id;
 this.div.appendChild(i_);
 isimg.useMap="#"+i_.name;
 this.simap=i_;
 
 var ma=new Array();
 for(var ai in marray){
 if(!marray.hasOwnProperty(ai))continue;
 ma.push(marray[ai]);
}
 
 var fx=ar.offsetLeft;
 var fy=ar.offsetTop;
 var ia_=document.createElement("AREA");
 ia_.shape="poly";
 ia_.coords=(32+fx)+","+fy+","+fx+","+(63+fy)+","+(63+fx)+","+fy+","+(32+fx)+","+fy;
 ia_.onmousedown=function(e){
 MEvent.EventMDownQueue["PmDf"]=1;
};
 i_.appendChild(ia_);
 ia_.oP=this.div;
 ia_.onclick=this.close;
 var wbx=wb.offsetLeft;
 var wby=wb.offsetTop;
 var wbw=wb.offsetWidth;
 var wbh=wb.offsetHeight;
 ia_=document.createElement("AREA");
 ia_.shape="poly";
 ia_.coords=wbx+","+wby+","+wbx+","+(wby+wbh)+","+(wbx+wbw)+","+(wby+wbh)+","+(wbx+wbw)+","+wby+","+wbx+","+wby;
 ia_.onmousedown=function(e){
 MEvent.EventMDownQueue["PmDf"]=1;
};
 i_.appendChild(ia_);
 
 for(var i=ma.length-1;i>=0;i--){
 var bp=this.map.r2p(ma[i].rpos);
 bp.x-=ma[i].icon.offsetX;
 bp.y-=ma[i].icon.offsetY;
 var box=new MBox(p1.x-ma[i].icon.width,p1.y-ma[i].icon.height,p2.x,p2.y);
 var wbox=new MBox(wp1.x,wp1.y,wp2.x-ma[i].icon.width,wp2.y-ma[i].icon.heigh);
 if(box.contains(bp)&& !wbox.contains(bp)){
 ia_=document.createElement("AREA");
 ia_.shape="poly";
 ia_.coords=ma[i].icon.getOffsetCoords(ma[i].div.offsetLeft-x1,ma[i].div.offsetTop-y1);
 i_.appendChild(ia_);
 if(ma[i].div.onclick)ia_.onclick=ma[i].div.onclick;
 if(ma[i].div.ondblclick)ia_.ondblcklick=ma[i].div.ondblclick;
 if(ma[i].div.onmousedown)ia_.onmousedown=ma[i].div.onmousedown;
 if(ma[i].div.onmouseup)ia_.onmouseup=ma[i].div.onmouseup;
 if(ma[i].div.onmouseover)ia_.onmouseover=ma[i].div.onmouseover;
 if(ma[i].div.onmouseoot)ia_.onmouseout=ma[i].div.onmouseoot;
 if(ma[i].div.onmousemove)ia_.onmousemove=ma[i].div.onmousemove;
 if(ma[i].ia_ && ma[i].ia_.onclick)ia_.onclick=ma[i].ia_.onclick;
 if(ma[i].ia_ && ma[i].ia_.ondblclick)ia_.ondblcklick=ma[i].ia_.ondblclick;
 if(ma[i].ia_ && ma[i].ia_.onmousedown)ia_.onmousedown=ma[i].ia_.onmousedown;
 if(ma[i].ia_ && ma[i].ia_.onmouseup)ia_.onmouseup=ma[i].ia_.onmouseup;
 if(ma[i].ia_ && ma[i].ia_.onmouseover)ia_.onmouseover=ma[i].ia_.onmouseover;
 if(ma[i].ia_ && ma[i].ia_.onmouseoot)ia_.onmouseout=ma[i].ia_.onmouseoot;
 if(ma[i].ia_ && ma[i].ia_.onmousemove)ia_.onmousemove=ma[i].ia_.onmousemove;
}
}
 
};
 
 MInfoWindowG.prototype.adjust=function(){
 harea.style.width=harea.offsetWidth<200?(200+"px"):(harea.offsetWidth>400?400:harea.offsetWidth)+"px";
 harea.style.height=harea.offsetHeight+"px";
 
 var ar=document.getElementById("fukidashi"+this.div.id);
 var infodiv=document.getElementById("winlb"+this.div.id);
 ar.style.top=(infodiv.offsetTop+infodiv.offsetHeight-2)+"px";
 ar.innerHTML="<img src="+MMap.IMGPATH+"img/minfowindowg/infowar.png height=64>";
 var ci=document.getElementById("winclose"+this.div.id);
 var cp=document.getElementById("winrt"+this.div.id);
 ci.style.position="absolute";
 ci.style.left=cp.offsetLeft-6+"px";
 
 
 var pp=this.map.r2p(this.rpos,this.map.zid);
 alert("adjust");
 this.div.style.left=(pp.x+this.offset.width)+"px";
 this.div.style.top=(pp.y-(this.offset.height+this.div.offsetHeight))+"px";
 this.div.style.zIndex=300;
 if(this.onOpenFn)this.onOpenFn.call();
};
 
 
 
 
 MMap.prototype.centerAndZoom=function(rp,z){
 this.moveendCenterAndZoom=true;
 var oldrp=this.rpos;
 var cb=null;
 
 this.rpos=rp;
 if(z==this.zid){
 this.centerAtLatLng(rp);
 if(oldrp.toString()!=this.rpos.toString()){
 if(cb=MEvent.hash[this.id+"moveend_centerAndZoom"]){
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].apply(this);
}
}
}
}else{
 var oldzoom=this.zid;
 var zflg=true;
 if(cb=MEvent.hash[this.id+"zoomstart_centerAndZoom"]){
 var argZ=z-this.zid;
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 if(cb[i].call(this,argZ)==false){
 for(var i in this.controls){
 if(!this.controls.hasOwnProperty(i))continue;
 this.controls[i].zoomUpdate();
}
 zflg=false;
}
}
}
 
 if(zflg)this.setZoomId(z);
 this.refreshMapAll();
 
 if(oldrp.toString()!=this.rpos.toString()){
 if(cb=MEvent.hash[this.id+"moveend_centerAndZoom"]){
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].apply(this);
}
}
}
 if(cb=MEvent.hash[this.id+"zoom_centerAndZoom"]){
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].call(this,oldzoom,this.zid);
}
}
}
 this.moveendCenterAndZoom=false;
};
 
 MMap.prototype.centerAtLatLng=function(rp){
 var oldrp=this.rpos;
 this.rpos=rp;
 this.updateAdpOrgPoint();
 
 var pp=this.r2p(rp,this.zid);
 var pc=this.s2p(this.sc,this.zid);
 this.moveBy(-Math.round(pp.x-pc.x),-Math.round(pp.y-pc.y));
 this.redrawMap();
 
 this.relocateAllMarkers();
 this.relocateAllFigs();
 
 this.infowindow.draw();
 this.infowindow.draw();
 
 for(var i in this.controls){
 if(!this.controls.hasOwnProperty(i))continue;
 this.controls[i].zoomUpdate();
}
 
 if(!this.moveendCenterAndZoom){
 var cb=null;
 if(oldrp.toString()!=this.rpos.toString()){
 if(cb=MEvent.hash[this.id+"moveend_centerAtLatLng"]){
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].apply(this);
}
}
}
}
};
 
 MMap.prototype.zoomTo=function(_z){
 this.changeZoom(_z);
};
 MMap.prototype.smoothZoomTo=function(z){
 var oz=this.getZoomLevel();
 var vz=oz-z;
 if(vz>0){
 this.smoothzoomout(vz);
}else if(vz<0){
 this.smoothzoomin(-vz);
}
};
 
 MMap.prototype.enableDragging=function(){
 this.draggable=true;
};
 
 MMap.prototype.disableDragging=function(){
 this.draggable=false;
};
 
 MMap.prototype.draggingEnabled=function(){
 return this.draggable;
};
 
 MMap.prototype.enableInfoWindow=function(){this.enableinfowindow=true;};
 MMap.prototype.disableInfoWindow=function(){this.enableinfowindow=false;};
 MMap.prototype.infoWindowEnabled=function(){return this.enableinfowindow;};
 
 MMap.prototype.getCenterLatLng=function(){
 return this.rpos;
};
 
 MMap.prototype.getPBBox=function(){
 var pcenter=this.r2p(this.rpos);
 
 var plt=new MPoint(pcenter.x-this.div.offsetWidth/2,pcenter.y-this.div.offsetHeight/2);
 
 var prb=new MPoint(pcenter.x+this.div.offsetWidth/2,pcenter.y+this.div.offsetHeight/2);
 
 return new MBox(plt.x,plt.y,prb.x,prb.y);
};
 MMap.prototype.getRBBox=function(){
 var pcenter=this.r2p(this.rpos);
 
 var plt=new MPoint(pcenter.x-this.div.offsetWidth/2,pcenter.y-this.div.offsetHeight/2);
 var rlt=this.p2r(plt);
 
 var prb=new MPoint(pcenter.x+this.div.offsetWidth/2,pcenter.y+this.div.offsetHeight/2);
 var rrb=this.p2r(prb);
 
 return new MBox(rlt.x,rlt.y,rrb.x,rrb.y);
};
 
 MMap.prototype.getBoundsLatLng=function(){
 var mb=this.getRBBox();
 var mbounds=new MBounds(mb.x1,mb.y2,mb.x2,mb.y1);
 return mbounds;
};
 MMap.prototype.getSpanLatLng=function(){
 var _b=this.getBoundsLatLng();
 var ms=new MSize(Math.abs(_b.x1-_b.x2),Math.abs(_b.y1-_b.y2));
 
 ms.x=ms.width;
 ms.y=ms.height;
 
 return ms;
};
 MMap.prototype.getZoomLevel=function(){
 return this.zid;
};
 
 MMap.prototype.recenterOrPanToLatLng=function(rp){
 this.smoveToRPoint(rp);
};
 
 MMap.prototype.getCurrentMapType=function(){
 return this.mapTypeName;
};
 
 MMap.prototype.getMapTypes=function(){
 return MapTypes.types;
};
 
 MMap.prototype.setMapType=function(maptype){
 this.mapTypeName=MapTypes.typeDef[maptype].name;
 this.adpName=MapTypes.getAdapterName(this.mapTypeName);
 eval("this.adp=new "+this.adpName+"();");
 this.refreshMapAll();
 
 var cb=null;
 if(cb=MEvent.hash[this.id+"maptypechanged"]){
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].call(this);
}
}
};
 
 MMap.prototype.setMapAdapter=function(adp){
 this.adp=adp;
 if(this.adp.zoomInMax<this.zid){
 this.zid=this.adp.zoomInMax;
 this.adpzid=this.zid;
}
 this.refreshMapAll();
 
 var cb=null;
 if(cb=MEvent.hash[this.id+"maptypechanged"]){
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].call(this);
}
}
};
 
 MMap.prototype.openInfoWindowHtml=function(latLng,htmlStr,pixelOffset,onOpenFn,onCloseFn){
 if(!this.enableinfowindow)return;
 
 this.infowindowOpened=true;
 this.infowindow.show(latLng,htmlStr,pixelOffset,onOpenFn,onCloseFn);
 
 var cb=null;
 if(cb=MEvent.hash[this.id+"infowindowopen"]){
 for(var i in cb){
 if(!cb.hasOwnProperty(i))continue;
 cb[i].apply(this);
}
}
};
 
 MMap.prototype.closeInfoWindow=function(){
 this.infowindow.close.call(this.infowindow.closediv);
 MEvent.EventMClickQueue=new Array();
};
 
 MMap.prototype.getOptimZoomLevel=function(_ary,_pos,_size,_maxzl,_minzl,_returnFlg){
 var i;
 var ary=new Array();
 if(_ary==null){
 for(i in this.markerArray){
 if(!this.markerArray.hasOwnProperty(i))continue;
 ary.push(this.markerArray[i].rpos);
}
}else{
 if(_ary instanceof MMarker){
 ary.push(_ary.rpos);
}else if(_ary instanceof MPoint){
 ary.push(_ary);
}else if(_ary instanceof Array){
 for(i=0;i<_ary.length;i++){
 if(_ary[i]instanceof MMarker){
 ary.push(_ary[i].rpos);
}else if(_ary[i]instanceof MPoint){
 ary.push(_ary[i]);
}else{
 return null;
}
}
}else{
 return null;
}
}
 if(ary.length==0)return null;
 var minX=maxX=ary[0].x;
 var minY=maxY=ary[0].y;
 for(i=1;i<ary.length;i++){
 var p=ary[i];
 if(p.x<minX)minX=p.x;
 if(p.x>maxX)maxX=p.x;
 if(p.y<minY)minY=p.y;
 if(p.y>maxY)maxY=p.y;
}
 
 var pos;
 if(_pos==null){
 pos=this.getCenterLatLng();
}else{
 if(!_pos instanceof MPoint)return null;
 pos=_pos;
}
 
 var size;
 if(_size==null){
 size=new MSize(this.div.offsetWidth,this.div.offsetHeight);
}else{
 if(!_size instanceof MSize)return null;
 size=_size;
}
 var halfW=size.width/2;
 var halfH=size.height/2;
 
 var maxzl,minzl;
 if(_maxzl==null)maxzl=this.adp.zoomInMax;
 else maxzl=_maxzl;
 if(_minzl==null)minzl=0;
 else minzl=_minzl;
 
 var returnFlg;
 if(_returnFlg==null)returnFlg=true;
 else returnFlg=_returnFlg;
 
 for(i=maxzl;i>=minzl;i--){
 
 var adpzid=this.adp.convZID.length-1;
 var ztb=this.adp.zoomtbl[i];
 for(var j=0;j<ztb.length;j++){
 var bb=this.adp.bboxes[ztb[j]];
 var tf=bb.contains(pos);
 if(this.adp.bboxes[ztb[j]].contains(pos)){adpzid=ztb[j];j=ztb.length;}
}
 
 var pp=this.adp.r2p(pos,adpzid);
 var prt=new MPoint(pp.x+halfW,pp.y-halfH);
 var plb=new MPoint(pp.x-halfW,pp.y+halfH);
 var rrt=this.adp.p2r(prt,adpzid);
 var rlb=this.adp.p2r(plb,adpzid);
 if(rlb.x<=minX && rlb.y<=minY && maxX<=rrt.x && maxY<=rrt.y)return i;
}
 if(returnFlg)return minzl;
 else return null;
};
 
 MMap.prototype.getCenterOfMarkerArray=function(_ary){
 var i;
 var ary=new Array();
 if(_ary==null){
 for(i in this.markerArray){
 if(!this.markerArray.hasOwnProperty(i))continue;
 ary.push(this.markerArray[i].rpos);
}
}else{
 if(_ary instanceof MMarker){
 ary.push(_ary.rpos);
}else if(_ary instanceof MPoint){
 ary.push(_ary);
}else if(_ary instanceof Array){
 for(i=0;i<_ary.length;i++){
 if(_ary[i]instanceof MMarker){
 ary.push(_ary[i].rpos);
}else if(_ary[i]instanceof MPoint){
 ary.push(_ary[i]);
}else{
 return null;
}
}
}else{
 return null;
}
}
 if(ary.length==0)return null;
 var minX=maxX=ary[0].x;
 var minY=maxY=ary[0].y;
 for(i=1;i<ary.length;i++){
 var p=ary[i];
 if(p.x<minX)minX=p.x;
 if(p.x>maxX)maxX=p.x;
 if(p.y<minY)minY=p.y;
 if(p.y>maxY)maxY=p.y;
}
 return new MPoint((maxX+minX)/2,(maxY+minY)/2);
}
 
 MMap.prototype.offsetCenterAtLatLng=function(rpos,offset){
 var ppos=this.r2p(rpos);
 var cppos=ppos.add(-offset.x,-offset.y);
 var crpos=this.p2r(cppos);
 this.recenterOrPanToLatLng(crpos);
}
 
 MMap.prototype.setInfoWindowAppearableDivisionMargin=function(_top,_left,_right,_bottom){
 if(!_left&&!_right&&!_bottom){
 _left=_top;
 _right=_top;
 _bottom=_top;
}else if(!_right&&!_bottom){
 _right=_left;
 _bottom=_top;
}else if(!_bottom){
 _bottom=_right;
 _right=_left;
}
 if(typeof(_top)=="number"&&typeof(_left)=="number"&&typeof(_right)=="number"&&typeof(_bottom)=="number"){
 this.infoWindowAppearableDivisionMarginTop=_top;
 this.infoWindowAppearableDivisionMarginLeft=_left;
 this.infoWindowAppearableDivisionMarginRight=_right;
 this.infoWindowAppearableDivisionMarginBottom=_bottom;
}
}
 
 
 
 var browser="MSIE";
 var backend="$CS";
 function Point(_x,_y){
 this.x=_x;
 this.y=_y;
}
 
 function C$C(_type,_x1,_y1,_x2,_y2,_w,_h,_r,_points,_linecolor,_linewidth,_lineopacity,_fillcolor,_fillopacity){
 this.type=_type;
 this.x1=_x1;
 this.y1=_y1;
 this.x2=_x2;
 this.y2=_y2;
 this.w=_w;
 this.h=_h;
 this.r=_r;
 this.points=_points;
 this.linecolor=_linecolor;
 this.linewidth=_linewidth;
 this.lineopacity=_lineopacity;
 this.fillcolor=_fillcolor;
 this.fillopacity=_fillopacity;
}
 
 
 function s_(parent_if,parent_div,width,height){
 if(!parent_if)throw new Error("No frame!");
 if(!parent_div)throw new Error("No canvas parent!");
 if(!width)width=parent_div.clientWidth;
 if(!height)height=parent_div.clientHeight;
 
 this.parent_if=parent_if;
 this.parent_div=parent_div;
 this.width=width;
 this.height=height;
 this._bgColor="none";
 this._lineColor="#000000";
 this._lineWidth=2;
 this._lineOpacity=1.0;
 this._fillColor="#ffffff";
 this._fillOpacity=0.5;
 
 this._stack=[];
 this._stackData=[];
 this._stackTop=-1;
 this._refreshFlg=false;
 
 var svg=parent_if.document.createElementNS(this._XMLNS_SVG,"svg");
 svg.setAttribute("width",width);
 svg.setAttribute("height",height);
 
 var container=parent_if.document.createElementNS("http://www.w3.org/1999/xhtml","div");
 container.setAttribute("style","width: "+width+"px;" 
+"height: "+height+"px;" 
+"vertical-align: bottom;");
 
 container.appendChild(svg);
 parent_div.appendChild(container);
 
 this.container=container;
 this._svgRoot=svg;
}
 
 s_.prototype={
 _XMLNS_SVG: "http://www.w3.org/2000/svg",
 
 setBgColor : function(color){
 this._bgColor=(color=="transparent")? "none" : color;
 this._refresh();
},
 
 set$CSize : function(w,h){
 this.width=w;
 this.height=h;
 this._svgRoot.setAttribute("width",w);
 this._svgRoot.setAttribute("height",h);
 this.container.style.width=w+"px";
 this.container.style.height=h+"px";
},
 
 setLineColor : function(color){
 this._lineColor=color;
},
 
 setLineWidth : function(width){
 this._lineWidth=width;
},
 
 setFillColor : function(color){
 this._fillColor=color;
},
 
 setFillOpacity : function(opacity){
 this._fillOpacity=opacity;
},
 
 setLineOpacity : function(opacity){
 this._lineOpacity=opacity;
},
 
 rect : function(x,y,w,h){
 var rect=this.parent_if.document.createElementNS(this._XMLNS_SVG,"path");
 var line="M "+x+" "+y+" " 
+"L "+(eval(x)+eval(w))+","+y+" " 
+(eval(x)+eval(w))+" "+(eval(y)+eval(h))+" " 
+x+" "+(eval(y)+eval(h))+" Z";
 rect.setAttribute("d",line);
 rect.setAttribute("stroke-opacity",this._lineOpacity);
 rect.setAttribute("stroke",this._lineColor);
 rect.setAttribute("stroke-width",this._lineWidth);
 
 rect.setAttribute("fill",this._fillColor);
 rect.setAttribute("fill-opacity",this._fillOpacity);
 
 this._svgRoot.appendChild(rect);
 
 this._pushStack(rect,new C$C("rect",x,y,null,null,w,h,null,null,this._lineColor,this._lineWidth,this._lineOpacity,this._fillColor,this._fillOpacity));
},
 
 circle : function(cx,cy,cr){
 var circle=this.parent_if.document.createElementNS(this._XMLNS_SVG,"circle");
 circle.setAttribute("cx",cx);
 circle.setAttribute("cy",cy);
 circle.setAttribute("r",cr);
 circle.setAttribute("stroke-opacity",this._lineOpacity);
 circle.setAttribute("stroke",this._lineColor);
 circle.setAttribute("stroke-width",this._lineWidth);
 
 circle.setAttribute("fill",this._fillColor);
 circle.setAttribute("fill-opacity",this._fillOpacity);
 
 this._svgRoot.appendChild(circle);
 
 this._pushStack(circle,new C$C("circle",cx,cy,null,null,null,null,cr,null,this._lineColor,this._lineWidth,this._lineOpacity,this._fillColor,this._fillOpacity));
},
 
 line : function(x1,y1,x2,y2){
 var line=this.parent_if.document.createElementNS(this._XMLNS_SVG,"line");
 line.setAttribute("x1",x1);
 line.setAttribute("y1",y1);
 line.setAttribute("x2",x2);
 line.setAttribute("y2",y2);
 line.setAttribute("stroke-opacity",this._lineOpacity);
 line.setAttribute("stroke",this._lineColor);
 line.setAttribute("stroke-width",this._lineWidth);
 line.setAttribute("id","fig"+(this._stackTop+1));
 
 this._svgRoot.appendChild(line);
 
 this._pushStack(line,new C$C("line",x1,y1,x2,y2,null,null,null,null,this._lineColor,this._lineWidth,this._lineOpacity,null,this._fillOpacity));
},
 
 polyline : function(points){
 var polyline=this.parent_if.document.createElementNS(this._XMLNS_SVG,"polyline");
 var line="";
 for(var cnt=0;cnt<points.length;cnt++){
 if(cnt==0)line=points[cnt].x+","+points[cnt].y;
 else line+=" "+points[cnt].x+","+points[cnt].y;
}
 polyline.setAttribute("points",line);
 polyline.setAttribute("fill","none");
 polyline.setAttribute("stroke-opacity",this._lineOpacity);
 polyline.setAttribute("stroke",this._lineColor);
 polyline.setAttribute("stroke-width",this._lineWidth);
 
 this._svgRoot.appendChild(polyline);
 
 this._pushStack(polyline,new C$C("polyline",null,null,null,null,null,null,null,points,this._lineColor,this._lineWidth,null,null,this._fillOpacity));
},
 
 polygon : function(points){
 var polygon=this.parent_if.document.createElementNS(this._XMLNS_SVG,"polygon");
 var line="";
 for(var cnt=0;cnt<points.length;cnt++){
 if(cnt==0)line=points[cnt].x+","+points[cnt].y;
 else line+=" "+points[cnt].x+","+points[cnt].y;
}
 polygon.setAttribute("points",line);
 polygon.setAttribute("stroke-opacity",this._lineOpacity);
 polygon.setAttribute("stroke",this._lineColor);
 polygon.setAttribute("stroke-width",this._lineWidth);
 
 polygon.setAttribute("fill",this._fillColor);
 polygon.setAttribute("fill-opacity",this._fillOpacity);
 
 this._svgRoot.appendChild(polygon);
 
 this._pushStack(polygon,new C$C("polygon",null,null,null,null,null,null,null,points,this._lineColor,this._lineWidth,this._lineOpacity,null,this._fillOpacity));
},
 
 undo : function(){
 if(this._stackTop<0){
 return false;
}
 this._svgRoot.removeChild(this._stack[this._stackTop--]);
 this._refresh();
 return true;
},
 
 redo : function(){
 if(this._stackTop>=this._stack.length-1){
 return false;
}
 this._svgRoot.appendChild(this._stack[++this._stackTop]);
 this._refresh();
 return true;
},
 
 clear : function(){
 for(var cnt=this._stackTop;cnt>=0;cnt--){
 this._svgRoot.removeChild(this._stack[cnt]);
}
 this._refresh();
 this._stack.length=0;
 this._stackTop=-1;
},
 
 _refresh : function(){
},
 
 _pushStack : function(shape,shapeData){
 if(++this._stackTop+1<this._stack.length){
 this._stack.length=this._stackTop+1;
}
 this._stack[this._stackTop]=shape;
 this._stackData[this._stackTop]=shapeData;
}
 
};
 
 
 function v_(parent_if,parent_div,width,height){
 if(!parent_if)throw new Error("Not frame!");
 if(!parent_if.document.namespaces)throw new Error("Not supported!");
 if(!parent_if.document.namespaces.v){
 parent_if.document.namespaces.add("v","urn:schemas-microsoft-com:vml");
 parent_if.document.createStyleSheet().addRule("v\\:*","behavior: url(#default#VML);");
}
 
 this.parent_if=parent_if;
 if(!parent_div)throw new Error("No canvas parent_div!");
 if(!width)width=parent_div.clientWidth;
 if(!height)height=parent_div.clientHeight;
 
 this.parent_div=parent_div;
 this.width=width;
 this.height=height;
 this._bgColor="none";
 this._lineColor="#000000";
 this._lineWidth=2;
 this._lineOpacity=0.5;
 this._fillColor="#ffffff";
 this._fillOpacity=0.5;
 
 this._stack=[];
 this._stackData=[];
 this._stackTop=-1;
 
 var container=parent_if.document.createElement("div");
 container.id="vml_canvas"+v_.ID++;
 container.style.cssText="position : relative;" 
+"width : "+width+"px;" 
+"height : "+height+"px;" 
+"overflow : hidden;";
 
 parent_div.appendChild(container);
 this.container=container;
}
 v_.ID=0;
 
 v_.prototype={
 set$CSize : function(w,h){
 this.container.style.width=w+"px";
 this.container.style.height=h+"px";
},
 
 setBgColor : function(color){
 this.container.style.backgroundColor=this._bgColor=color;
},
 
 setLineColor : function(color){
 this._lineColor=color;
},
 
 setLineWidth : function(width){
 this._lineWidth=width;
},
 
 setFillColor : function(color){
 this._fillColor=color;
},
 
 setFillOpacity : function(opacity){
 this._fillOpacity=opacity;
},
 
 setLineOpacity : function(opacity){
 this._lineOpacity=opacity;
},
 
 rect : function(x,y,w,h){
 var rect=this.parent_if.document.createElement("v:rect");
 rect.strokecolor=this._lineColor;
 rect.strokeweight=this._lineWidth+"px";
 rect.fillcolor=this._fillColor;
 rect.style.cssText="position: absolute;" 
+"top: "+y+";" 
+"left: "+x+";" 
+"width: "+w+";" 
+"height: "+h+";";
 
 var fill=this.parent_if.document.createElement("v:fill");
 fill.type="pattern";
 fill.opacity=this._fillOpacity;
 
 var stroke=this.parent_if.document.createElement("v:stroke");
 stroke.opacity=this._lineOpacity;
 
 rect.appendChild(fill);
 rect.appendChild(stroke);
 
 this.container.appendChild(rect);
 
 this._pushStack(rect);
},
 
 circle : function(cx,cy,cr){
 var circle=this.parent_if.document.createElement("v:oval");
 circle.strokecolor=this._lineColor;
 circle.strokeweight=this._lineWidth+"px";
 circle.fillcolor=this._fillColor;
 circle.style.cssText="position: absolute;" 
+"top: "+(cy-cr)+";" 
+"left: "+(cx-cr)+";" 
+"width: "+(cr*2)+";" 
+"height: "+(cr*2)+";";
 
 var fill=this.parent_if.document.createElement("v:fill");
 fill.type="pattern";
 fill.opacity=this._fillOpacity;
 
 var stroke=this.parent_if.document.createElement("v:stroke");
 stroke.opacity=this._lineOpacity;
 
 circle.appendChild(fill);
 circle.appendChild(stroke);
 
 this.container.appendChild(circle);
 
 this._pushStack(circle);
},
 
 line : function(x1,y1,x2,y2){
 var line=this.parent_if.document.createElement("v:line");
 line.strokecolor=this._lineColor;
 line.strokeweight=this._lineWidth+"px";
 line.style.cssText="position: absolute;";
 line.from=x1+","+y1;
 line.to=x2+","+y2;
 line.id="fig"+(this.container.id);
 
 var stroke=this.parent_if.document.createElement("v:stroke");
 stroke.opacity=this._lineOpacity;
 
 line.appendChild(stroke);
 
 this.container.appendChild(line);
 
 this._pushStack(line);
},
 
 polyline : function(points){
 var polyline=this.parent_if.document.createElement("v:polyline");
 polyline.id="fig"+(this.container.id);
 polyline.strokecolor=this._lineColor;
 polyline.strokeweight=this._lineWidth+"px";
 polyline.style.cssText="position: absolute;opacity:"+this._lineOpacity;
 var line="";
 for(var cnt=0;cnt<points.length;cnt++){
 if(cnt==0)line=points[cnt].x+","+points[cnt].y;
 else line+=" "+points[cnt].x+","+points[cnt].y;
}
 polyline.points=line;
 
 var fill=this.parent_if.document.createElement("v:fill");
 fill.type="pattern";
 fill.color=this._fillColor;
 fill.opacity="0.0";
 
 var stroke=this.parent_if.document.createElement("v:stroke");
 stroke.opacity=this._lineOpacity;
 
 polyline.appendChild(fill);
 polyline.appendChild(stroke);
 
 this.container.appendChild(polyline);
 
 this._pushStack(polyline);
},
 
 polygon : function(points){
 var polygon=this.parent_if.document.createElement("v:polyline");
 polygon.id="fig"+(this.container.id);
 polygon.strokecolor=this._lineColor;
 polygon.strokeweight=this._lineWidth;
 polygon.style.cssText="position: absolute;";
 polygon.print=true;
 var line="";
 for(var cnt=0;cnt<points.length;cnt++){
 if(cnt==0)line=points[cnt].x+","+points[cnt].y;
 else line+=" "+points[cnt].x+","+points[cnt].y;
}
 line+=" "+points[0].x+","+points[0].y;
 polygon.points=line;
 
 var fill=this.parent_if.document.createElement("v:fill");
 fill.type="pattern";
 fill.color=this._fillColor;
 fill.opacity=this._fillOpacity;
 
 var stroke=this.parent_if.document.createElement("v:stroke");
 stroke.opacity=this._lineOpacity;
 
 polygon.appendChild(fill);
 polygon.appendChild(stroke);
 
 this.container.appendChild(polygon);
 
 this._pushStack(polygon);
},
 
 undo : function(){
 if(this._stackTop<0){
 return false;
}
 this._stack[this._stackTop--].style.visibility="hidden";
 return true;
},
 
 redo : function(){
 if(this._stackTop>=this._stack.length-1){
 return false;
}
 this._stack[++this._stackTop].style.visibility="visible";
 return true;
},
 
 clear : function(){
 this.container.innerHTML="";
/*
 for(var cnt=this._stack.length;cnt--;){
 this.container.removeChild(this._stack[cnt]);
}
*/
 this._stack.length=0;
 this._stackTop=-1;
},
 
 _pushStack : function(shape){
 var stackLength=this._stack.length;
 if(++this._stackTop<stackLength){
 for(var cnt=this.stackTop;cnt<stackLength;cnt++){
 this.container.removeChild(this._stack[cnt]);
}
 this._stack.length=this._stackTop+1;
}
 this._stack[this._stackTop]=shape;
}
 
};
 
 
 function c_(parent_if,parent_div,width,height){
 if(!parent_if)throw new Error("No frame!");
 if(!parent_div)throw new Error("No canvas parent!");
 if(!width)width=parent_div.clientWidth;
 if(!height)height=parent_div.clientHeight;
 
 this.parent_if=parent_if;
 this.parent_div=parent_div;
 this.width=width;
 this.height=height;
 this._bgColor="transparent";
 this._lineColor="#000000";
 this._lineWidth=2;
 this._lineOpacity=1.0;
 this._fillColor="#ffffff";
 this._fillOpacity=0.5;
 
 this._stack=[];
 this._stackTop=-1;
 this._refreshFlg=false;
 
 var canvas=this.parent_if.document.createElement("canvas");
 canvas.setAttribute("width",200);
 canvas.setAttribute("height",200);
 canvas.setAttribute("id","canvasarea");
 
 var container=this.parent_if.document.createElement("div");
 container.setAttribute("style","width:"+width+"px;" 
+"height:"+height+"px;" 
+"position: absolute;" 
+"top: 0px;" 
+"left: 0px;" 
+"vertical-align: bottom;");
 
 container.setAttribute("width",200);
 container.setAttribute("height",200);
 
 container.appendChild(canvas);
 this.parent_div.appendChild(container);
 
 
 var context=canvas.getContext("2d");
 context.lineCap="round";
 context.lineJoin="round";
 
 this.container=container;
 this.canvas=canvas;
 this._context=context;
}
 
 c_.prototype={
 set$CSize : function(w,h){
 this.canvas.setAttribute("width",w);
 this.canvas.setAttribute("height",h);
},
 
 setBgColor : function(color){
},
 
 setLineColor : function(color){
 this._lineColor=color;
},
 
 setLineWidth : function(width){
 this._lineWidth=width;
},
 
 setFillColor : function(color){
 this._fillColor=color;
},
 
 setFillOpacity : function(opacity){
 this._fillOpacity=opacity;
},
 
 setLineOpacity : function(opacity){
 this._lineOpacity=opacity;
},
 
 rect : function(x,y,w,h){
 var x2=eval(x)+eval(w);
 var y2=eval(y)+eval(h);
 this._context.beginPath();
 
 this._context.strokeStyle=this._lineColor;
 this._context.globalAlpha=this._lineOpacity;
 this._context.lineWidth=this._lineWidth;
 this._context.beginPath();
 this._context.moveTo(x,y);
 this._context.lineTo(x,y2);
 this._context.lineTo(x2,y2);
 this._context.lineTo(x2,y);
 this._context.closePath();
 this._context.stroke();
 
 this._context.fillStyle=this._fillColor;
 this._context.globalAlpha=this._fillOpacity;
 this._context.beginPath();
 this._context.fillRect(x,y,w,h);
 this._context.closePath();
 this._context.fill();
},
 
 circle : function(cx,cy,cr){
 this._context.beginPath();
 this._context.fillStyle=this._fillColor;
 this._context.globalAlpha=this._fillOpacity;
 this._context.arc(cx,cy,cr,0,Math.PI*2,true);
 this._context.fill();
 
 this._context.beginPath();
 this._context.strokeStyle=this._lineColor;
 this._context.globalAlpha=this._lineOpacity;
 this._context.lineWidth=this._lineWidth;
 this._context.arc(cx,cy,cr,0,Math.PI*2,true);
 this._context.stroke();
},
 
 line : function(x1,y1,x2,y2){
 this._context.beginPath();
 this._context.strokeStyle=this._lineColor;
 this._context.globalAlpha=this._lineOpacity;
 this._context.lineWidth=this._lineWidth;
 this._context.moveTo(x1,y1);
 this._context.lineTo(x2,y2);
 this._context.stroke();
},
 
 polyline : function(points){
 this._context.beginPath();
 this._context.strokeStyle=this._lineColor;
 this._context.globalAlpha=this._lineOpacity;
 this._context.lineWidth=this._lineWidth;
 this._context.moveTo(points[0].x,points[0].y);
 for(var cnt=1;cnt<points.length;cnt++){
 this._context.lineTo(points[cnt].x,points[cnt].y);
}
 this._context.stroke();
},
 
 polygon : function(points){
 this._context.beginPath();
 this._context.strokeStyle=this._lineColor;
 this._context.globalAlpha=this._lineOpacity;
 this._context.lineWidth=this._lineWidth;
 this._context.moveTo(points[0].x,points[0].y);
 for(var cnt=1;cnt<points.length;cnt++){
 this._context.lineTo(points[cnt].x,points[cnt].y);
}
 this._context.closePath();
 this._context.stroke();
 
 this._context.fillStyle=this._fillColor;
 this._context.globalAlpha=this._fillOpacity;
 this._context.moveTo(points[0].x,points[0].y);
 for(var cnt=1;cnt<points.length;cnt++){
 this._context.lineTo(points[cnt].x,points[cnt].y);
}
 this._context.fill();
},
 
 undo : function(){
},
 
 redo : function(){
},
 
 clear : function(){
 this.container.innerHTML="";
 this.container.appendChild(this.canvas);
},
 
 _pushStack: function(shape){
},
 
 _refresh: function(){
},
 
 _toDecimal : function(str){
 var hex=str.toUpperCase();
 var ans=0;
 var n=0;
 for(var cnt=0;cnt<hex.length;cnt++){
 var c=hex.charAt(cnt);
 switch(c){
 case 'A': 
 c="10";
 break;
 case 'B': 
 c="11";
 break;
 case 'C': 
 c="12";
 break;
 case 'D': 
 c="13";
 break;
 case 'E': 
 c="14";
 break;
 case 'F': 
 c="15";
 break;
}
 n=parseInt(c)*Math.pow(16,(hex.length-1-eval(cnt)));
 ans+=n;
}
 return ans;
}
 
};
 
 
 function cs_(parent_if,parent_div,width,height){
 if(!parent_if)throw new Error("No frame!");
 if(!parent_div)throw new Error("No canvas parent!");
 if(!width)width=parent_div.clientWidth;
 if(!height)height=parent_div.clientHeight;
 
 this.parent_if=parent_if;
 this.parent_div=parent_div;
 this.width=width;
 this.height=height;
 this._bgColor="transparent";
 this._lineColor="#000000";
 this._lineWidth=2;
 this._lineOpacity=1.0;
 this._fillColor="#ffffff";
 this._fillOpacity=0.5;
 
 this._stack=[];
 this._stackData=[];
 this._stackTop=-1;
 this._refreshFlg=false;
 this._currentShape=null;
 
 var container=parent_if.document.createElement("div");
 container.id="drawcanvas"+cs_.ID++;
 var containerStyle="background-color: "+this._bgColor+";"+
 "position: absolute;" ;
 if(this._useCssText){
 container.style.cssText=containerStyle;
}else{
 container.setAttribute("style",containerStyle);
}
 
 parent_div.appendChild(container);
 this.container=container;
 
}
 cs_.ID=0;
 
 cs_.prototype={
 setBgColor : function(color){
 this.container.style.backgroundColor=this._bgColor=color;
},
 
 set$CSize : function(w,h){
 this.container.style.width=w+"px";
 this.container.style.height=h+"px";
},
 
 setLineColor : function(color){
 this._lineColor=color;
},
 
 setLineWidth : function(width){
 this._lineWidth=width;
},
 
 setFillColor : function(color){
 this._fillColor=color;
},
 
 setFillOpacity : function(opacity){
 this._fillOpacity=opacity;
},
 
 setLineOpacity : function(opacity){
 this._lineOpacity=opacity;
},
 
 rect : function(x,y,w,h){
 var rectlayer=this.parent_if.document.createElement("div");
 this._mkDiv(x,y,w,this._lineWidth,this._lineColor,this._lineOpacity,rectlayer);
 this._mkDiv(x+w-this._lineWidth,y+this._lineWidth,this._lineWidth,h-this._lineWidth*2,this._lineColor,this._lineOpacity,rectlayer);
 this._mkDiv(x,y+h-this._lineWidth,w,this._lineWidth,this._lineColor,this._lineOpacity,rectlayer);
 this._mkDiv(x,y+this._lineWidth,this._lineWidth,h-this._lineWidth*2,this._lineColor,this._lineOpacity,rectlayer);
 
 this._mkDiv(x+this._lineWidth,y+this._lineWidth,w-this._lineWidth*2,h-this._lineWidth*2,this._fillColor,this._fillOpacity,rectlayer);
 
 this.container.appendChild(rectlayer);
 
 this._pushStack(rectlayer);
},
 
 circle : function(cx,cy,cr){
 var circlelayer=this.parent_if.document.createElement("div");
 
 this._circle(cx-cr,cy-cr,cr*2,cr*2,circlelayer);
 
 var s=this._lineWidth;
 this._circlefill(cx-cr+this._lineWidth,cy-cr+this._lineWidth,cr*2-s,cr*2-s,circlelayer);
 
 this.container.appendChild(circlelayer);
 
 this._pushStack(circlelayer);
},
 
 line : function(x1,y1,x2,y2){
 var linelayer=this.parent_if.document.createElement("div");
 linelayer.style.zIndex=1000;
 
 this._dotline(x1,y1,x2,y2,linelayer);
 
 this.container.appendChild(linelayer);
 
 this._pushStack(linelayer);
},
 
 polyline : function(points){
 var polylinelayer=this.parent_if.document.createElement("div");
 
 for(var cnt=1;cnt<points.length;cnt++){
 this._dotline(points[cnt-1].x,points[cnt-1].y,points[cnt].x,points[cnt].y,polylinelayer);
}
 
 this.container.appendChild(polylinelayer);
 
 this._pushStack(polylinelayer);
},
 
 polygon : function(points){
 var polygonlayer=this.parent_if.document.createElement("div");
 
 for(var cnt=1;cnt<points.length;cnt++){
 this._line(points[cnt-1].x,points[cnt-1].y,points[cnt].x,points[cnt].y,polygonlayer);
}
 this._line(points[points.length-1].x,points[points.length-1].y,points[0].x,points[0].y,polygonlayer);
 
 this._polygonfill(points,polygonlayer);
 
 this.container.appendChild(polygonlayer);
 
 this._pushStack(polygonlayer);
},
 
 undo : function(){
 if(this._stackTop<0){
 return false;
}
 this.container.removeChild(this._stack[this._stackTop--]);
 return true;
},
 
 redo : function(){
 if(this._stackTop>=this._stack.length-1){
 return false;
}
 this.container.appendChild(this._stack[++this._stackTop]);
 return true;
},
 
 clear : function(){
 for(var cnt=this._stackTop;cnt>=0;cnt--){
 this.container.removeChild(this._stack[cnt]);
}
 this._stack.length=0;
 this._stackTop=-1;
},
 
 _pushStack: function(shape){
 if(++this._stackTop+1<this._stack.length){
 this._stack.length=this._stackTop+1;
}
 this._stack[this._stackTop]=shape;
},
 
 _mkDiv: function(x,y,w,h,color,opacity,layer){
 if(window.opera){
 var make_div='<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 : '+color+';' 
+'filter:alpha(opacity='+(opacity*100)+');' 
+'-moz-opacity: '+opacity+';' 
+'opacity: '+opacity+';' 
+'overflow : hidden;"></div>';
 layer.insertAdjacentHTML("BeforeEnd",make_div);
}else{
 var make_div=this.parent_if.document.createElement("div");
 make_div.style.cssText="position : absolute;" 
+"left : "+x+"px;" 
+"top : "+y+"px;" 
+"width : "+w+"px;" 
+"height : "+h+"px;" 
+"clip:rect(0,"+w+"px,"+h+"px,0);" 
+"background-color : "+color+";" 
+"filter:alpha(opacity="+(opacity*100)+");" 
+"-moz-opacity: "+opacity+";" 
+"opacity: "+opacity+";" 
+"overflow : hidden;";
+"z-index : 1000;";
 layer.appendChild(make_div);
}
},
 
 _circle : function(left,top,width,height,layer){
 var s=this._lineWidth;
 width+=s-1;
 height+=s-1;
 var a=width>>1;
 var b=height>>1;
 var wod=width&1;
 var hod=(height&1)+1;
 var cx=left+a;
 var cy=top+b;
 var x=0;
 var y=b;
 var aa=(a*a)<<1;
 var bb=(b*b)<<1;
 var st=(aa>>1)*(1-(b<<1))+bb;
 var tt=(bb>>1)-aa*((b<<1)-1);
 
 if(s-4<0 &&(!(s-2)|| width-51>0 && height-51>0)){
 var ox=0,oy=b,w,h,pxl,pxr,pxt,pxb,pxw;
 while(y>0){
 if(st<0){
 st+=bb*((x<<1)+3);
 tt+=(bb<<1)*(++x);
}else if(tt<0){
 st+=bb*((x<<1)+3)-(aa<<1)*(y-1);
 tt+=(bb<<1)*(++x)-aa*(((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._mkDiv(ox-pxw+w+wod+cx,-oy+cy,pxw,h,this._lineColor,this._lineOpacity,layer);
 this._mkDiv(ox-pxw+w+wod+cx,-h+oy+hod+cy,pxw,h,this._lineColor,this._lineOpacity,layer);
 this._mkDiv(-x+1+cx,-h+oy+hod+cy,pxw,h,this._lineColor,this._lineOpacity,layer);
 this._mkDiv(-x+1+cx,-oy+cy,pxw,h,this._lineColor,this._lineOpacity,layer);
 ox=x;
 oy=y;
}else{
 tt-=aa*((y<<1)-3);
 st-=(aa<<1)*(--y);
}
}
 this._mkDiv(cx-a,cy-oy,s,(oy<<1)+hod,this._lineColor,this._lineOpacity,layer);
 this._mkDiv(cx+a+wod-s+1,cy-oy,s,(oy<<1)+hod,this._lineColor,this._lineOpacity,layer);
}else{
 var _a=(width-((s-1)<<1))>>1;
 var _b=(height-((s-1)<<1))>>1;
 var _x=0;
 var _y=_b;
 var _aa=(_a*_a)<<1;
 var _bb=(_b*_b)<<1;
 var _st=(_aa>>1)*(1-(_b<<1))+_bb;
 var _tt=(_bb>>1)-_aa*((_b<<1)-1);
 
 var pxl=new Array();
 var pxt=new Array();
 var _pxb=new Array();
 pxl[0]=0;
 pxt[0]=b;
 _pxb[0]=_b-1;
 while(y>0){
 if(st<0){
 st+=bb*((x<<1)+3);
 tt+=(bb<<1)*(++x);
 pxl[pxl.length]=x;
 pxt[pxt.length]=y;
}else if(tt<0){
 st+=bb*((x<<1)+3)-(aa<<1)*(y-1);
 tt+=(bb<<1)*(++x)-aa*(((y--)<<1)-3);
 pxl[pxl.length]=x;
 pxt[pxt.length]=y;
}else{
 tt-=aa*((y<<1)-3);
 st-=(aa<<1)*(--y);
}
 
 if(_y>0){
 if(_st<0){
 _st+=_bb*((_x<<1)+3);
 _tt+=(_bb<<1)*(++_x);
 _pxb[_pxb.length]=_y-1;
}else if(_tt<0){
 _st+=_bb*((_x<<1)+3)-(_aa<<1)*(_y-1);
 _tt+=(_bb<<1)*(++_x)-_aa*(((_y--)<<1)-3);
 _pxb[_pxb.length]=_y-1;
}else{
 _tt-=_aa*((_y<<1)-3);
 _st-=(_aa<<1)*(--_y);
 _pxb[_pxb.length-1]--;
}
}
}
 
 var ox=0,oy=b,_oy=_pxb[0],l=pxl.length,w,h;
 for(var i=0;i<l;i++){
 if(typeof _pxb[i]!="undefined"){
 if(_pxb[i]<_oy || pxt[i]<oy){
 x=pxl[i];
 this._mkDiv(ox+wod+cx,-oy+cy,x-ox,oy-_oy,this._lineColor,this._lineOpacity,layer);
 this._mkDiv(ox+wod+cx,_oy+hod+cy,x-ox,oy-_oy,this._lineColor,this._lineOpacity,layer);
 this._mkDiv(-x+1+cx,_oy+hod+cy,x-ox,oy-_oy,this._lineColor,this._lineOpacity,layer);
 this._mkDiv(-x+1+cx,-oy+cy,x-ox,oy-_oy,this._lineColor,this._lineOpacity,layer);
 ox=x;
 oy=pxt[i];
 _oy=_pxb[i];
}
}else{
 x=pxl[i];
 this._mkDiv(cx-x+1,cy-oy,1,(oy<<1)+hod,this._lineColor,this._lineOpacity,layer);
 this._mkDiv(cx+ox+wod,cy-oy,1,(oy<<1)+hod,this._lineColor,this._lineOpacity,layer);
 ox=x;
 oy=pxt[i];
}
}
 this._mkDiv(cx-a,cy-oy,1,(oy<<1)+hod,this._lineColor,this._lineOpacity,layer);
 this._mkDiv(cx+ox+wod,cy-oy,1,(oy<<1)+hod,this._lineColor,this._lineOpacity,layer);
}
},
 
 _circlefill: function(left,top,w,h,layer){
 var a=(w-=1)>>1;
 var b=(h-=1)>>1;
 var wod=(w&1)+1;
 var hod=(h&1)+1;
 var cx=left+a;
 var cy=top+b;
 var x=0;
 var y=b;
 var ox=0;
 var oy=b;
 var aa2=(a*a)<<1;
 var aa4=aa2<<1;
 var bb=(b*b)<<1;
 var st=(aa2>>1)*(1-(b<<1))+bb;
 var tt=(bb>>1)-aa2*((b<<1)-1);
 var pxl,dw,dh;
 if(w+1){
 while(y>0){
 if(st<0){
 st+=bb*((x<<1)+3);
 tt+=(bb<<1)*(++x);
}else if(tt<0){
 st+=bb*((x<<1)+3)-aa4*(y-1);
 pxl=cx-x;
 dw=(x<<1)+wod;
 tt+=(bb<<1)*(++x)-aa2*(((y--)<<1)-3);
 dh=oy-y;
 this._mkDiv(pxl,cy-oy,dw,dh,this._fillColor,this._fillOpacity,layer);
 this._mkDiv(pxl,cy+y+hod,dw,dh,this._fillColor,this._fillOpacity,layer);
 ox=x;
 oy=y;
}else{
 tt-=aa2*((y<<1)-3);
 st-=aa4*(--y);
}
}
}
 this._mkDiv(cx-a,cy-oy,w+1,(oy<<1)+hod,this._fillColor,this._fillOpacity,layer);
},
 
 _dotline: function(x1,y1,x2,y2,layer){
 this._mkDiv(x1,y1,this._lineWidth,this._lineWidth,this._lineColor,this._lineOpacity,layer);
 this._mkDiv(x2,y2,this._lineWidth,this._lineWidth,this._lineColor,this._lineOpacity,layer);
 dx=x2-x1;
 dy=y2-y1;
 
 var dist=Math.sqrt(dx*dx+dy*dy);
 
 var dot=this._lineWidth*2;
 for(var cnt=dot;cnt<dist;cnt+=dot){
 this._mkDiv(x1+cnt*dx/dist,y1+cnt*dy/dist,this._lineWidth,this._lineWidth,this._lineColor,this._lineOpacity,layer);
}
 
},
 
 _line: function(x1,y1,x2,y2,layer){
 if(x1>x2){
 var _x2=x2;
 var _y2=y2;
 x2=x1;
 y2=y1;
 x1=_x2;
 y1=_y2;
}
 var dx=x2-x1;
 var dy=Math.abs(y2-y1);
 var x=x1;
 var y=y1;
 var yIncr=(y1>y2)?-1 : 1;
 var s=this._lineWidth;
 
 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;
 var pru=pr-(dx<<1);
 var p=pr-dx;
 var ox=x;
 while((dx--)>0){
++x;
 if(p>0){
 this._mkDiv(ox,y,x-ox+ad,_s,this._lineColor,this._lineOpacity,layer);
 y+=yIncr;
 p+=pru;
 ox=x;
}else{
 p+=pr;
}
}
 this._mkDiv(ox,y,x2-ox+ad+1,_s,this._lineColor,this._lineOpacity,layer);
}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){
 if(p>0){
 this._mkDiv(x++,y,_s,oy-y+ad,this._lineColor,this._lineOpacity,layer);
 y+=yIncr;
 p+=pru;
 oy=y;
}else{
 y+=yIncr;
 p+=pr;
}
}
 this._mkDiv(x2,y2,_s,oy-y2+ad,this._lineColor,this._lineOpacity,layer);
}else{
 while((dy--)>0){
 y+=yIncr;
 if(p>0){
 this._mkDiv(x++,oy,_s,y-oy+ad,this._lineColor,this._lineOpacity,layer);
 p+=pru;
 oy=y;
}
 else p+=pr;
}
 this._mkDiv(x2,oy,_s,y2-oy+ad+1,this._lineColor,this._lineOpacity,layer);
}
}
},
 
 _polygonfill: function(points,layer){
 var cnt;
 var y;
 var miny,maxy;
 var x1,y1;
 var x2,y2;
 var ind1,ind2;
 var ints;
 var n=points.length;
 
 if(!n)return false;
 
 miny=points[0].y;
 maxy=points[0].y;
 for(var cnt=1;cnt<n;cnt++){
 if(points[cnt].y<miny){
 miny=points[cnt].y;
}
 if(points[cnt].y>maxy){
 maxy=points[cnt].y;
}
}
 for(y=miny;y<=maxy;y+=2){
 var polyInts=new Array();
 ints=0;
 for(cnt=0;cnt<n;cnt++){
 if(!cnt){
 ind1=eval(n)-1;
 ind2=0;
 
}else{
 ind1=eval(cnt)-1;
 ind2=eval(cnt);
 
}
 y1=points[ind1].y;
 y2=points[ind2].y;
 if(y1<y2){
 x1=points[ind1].x;
 x2=points[ind2].x;
 
}else if(y1>y2){
 x1=points[ind2].x;
 x2=points[ind1].x;
 y1=points[ind2].y;
 y2=points[ind1].y;
 
}else{
 continue;
}
 if((y>=y1)&&(y<y2)){
 polyInts[ints++]=Math.round((y-y1)*(x2-x1)/(y2-y1)+x1);
 
}else if((y==maxy)&&(y>y1)&&(y<=y2)){
 polyInts[ints++]=Math.round((y-y1)*(x2-x1)/(y2-y1)+x1);
 
}
}
 polyInts.sort(integer_compare);
 for(cnt=0;cnt<ints;cnt+=2){
 this._mkDiv(polyInts[cnt],y,(polyInts[cnt+1]-polyInts[cnt]+1),1,this._fillColor,this._fillOpacity,layer);
}
}
}
 
};
 
 function integer_compare(x,y)
{
 return(x<y)?-1 :((x>y)*1);
}
 
 
 function d_(){
 if(document.namespaces && document.namespaces.add){
 backend="VML";
}
 try{
 if(document.createElement("canvas").getContext){
 backend="$C";
}
}catch(e){
}
 if(document.createElementNS){
 if(document.implementation.hasFeature("org.w3c.svg",null)){
 backend="$S";
}
 if(window.opera){
 var ua=navigator.userAgent;
 var index=ua.indexOf("Opera");
 if(index>=0 && parseInt(ua.substring(index+6))>=9){
 backend="$S";
}
}
}
 
 switch(backend){
 case "$S": 
 d_=s_;
 break;
 case "$C": 
 d_=c_;
 break;
 case "$CS": 
 d_=cs_;
 break;
 case "VML": 
 d_=v_;
 break;
 case "Batik": 
}
 d_.backend=backend;
 d_.prototype.constructor=d_;
}
 d_();
 function MGlobal(){}
 MGlobal.R=6370000;
 MGlobal.R1=6370291.09;
 MGlobal.R2=6370289.51;
 MGlobal.R3=6370283.15;
 
 MGlobal.A=6377397.15;
 MGlobal.B=6356078.96;
 MGlobal.E=0.081819474;
 MGlobal.distance=function(_sp,_ep){
 var s_lmd=_sp.x;
 var s_phi=_sp.y;
 var e_lmd=_ep.x;
 var e_phi=_ep.y;
 return Math.round(MGlobal.R*
 Math.acos((Math.cos((s_lmd*Math.PI)/180)*Math.cos((s_phi*Math.PI)/180))*(Math.cos((e_lmd*Math.PI)/180)*Math.cos((e_phi*Math.PI)/180))
+(Math.sin((s_lmd*Math.PI)/180)*Math.cos((s_phi*Math.PI)/180))*(Math.sin((e_lmd*Math.PI)/180)*Math.cos((e_phi*Math.PI)/180))
+(Math.sin((s_phi*Math.PI)/180))*(Math.sin((e_phi*Math.PI)/180))
 )
 );
}
 MGlobal.J2W=function(_j){
 var _lmd=_j.x;
 var _phi=_j.y;
 var lmd=_lmd-_phi*0.000046038-_lmd*0.000083043+0.010040;
 var phi=_phi-_phi*0.00010695+_lmd*0.000017464+0.0046017;
 return new MPoint(lmd,phi);
}
 
 MGlobal.W2J=function(_w){
 var _lmd=_w.x;
 var _phi=_w.y;
 var phi=_phi+0.000106960*_phi-0.000017467*_lmd-0.0046020;
 var lmd=_lmd+0.000046047*_phi+0.000083049*_lmd-0.010040;
 return new MPoint(lmd,phi);
}
 
//build 2008/06/16 15:03:05.48 

var __cacheServerURL=new Array("http://mc00.mapion.co.jp/m/k","http://mc01.mapion.co.jp/m/k");var __cacheServerByGrp=new Array();__cacheServerByGrp['default']=__cacheServerURL[1];__cacheServerByGrp['jtb']=__cacheServerURL[1];__cacheServerByGrp['oz']=__cacheServerURL[1];MMap.IMGPATH='http://bap.mapion.co.jp/api_images/';var ScaleToZoom=new Array(10);ScaleToZoom['26000000']=0;ScaleToZoom['5000000']=1;ScaleToZoom['3000000']=2;ScaleToZoom['1000000']=3;ScaleToZoom['500000']=4;ScaleToZoom['250000']=5;ScaleToZoom['70000']=6;ScaleToZoom['25000']=7;ScaleToZoom['10000']=8;ScaleToZoom['5000']=9;var ZoomToScale=new Array(10);ZoomToScale[0]=26000000;ZoomToScale[1]=5000000;ZoomToScale[2]=3000000;ZoomToScale[3]=1000000;ZoomToScale[4]=500000;ZoomToScale[5]=250000;ZoomToScale[6]=70000;ZoomToScale[7]=25000;ZoomToScale[8]=10000;ZoomToScale[9]=5000;function JSONscriptRequest(_url,_charset){this.url=_url;this.noCacheIE='&noCacheIE='+(new Date()).getTime();this.headLoc=document.getElementsByTagName("head").item(0);this.scriptId='JscriptId'+JSONscriptRequest.scriptCounter++;this.charset=(_charset==null||_charset=='')?"utf-8":_charset;};JSONscriptRequest.scriptCounter=1;JSONscriptRequest.prototype.buildScriptTag=function(){this.scriptObj=document.createElement("script");this.scriptObj.setAttribute("type","text/javascript");this.scriptObj.setAttribute("charset",this.charset);this.scriptObj.setAttribute("src",this.url+this.noCacheIE);this.scriptObj.setAttribute("id",this.scriptId);};JSONscriptRequest.prototype.removeScriptTag=function(){try{this.headLoc.removeChild(this.scriptObj);}catch(e){return;}};JSONscriptRequest.prototype.addScriptTag=function(){this.headLoc.appendChild(this.scriptObj);};function MLargeMapionControl(){MLargeMapControl.call();this._scale=new MMapionScale(this.onLoadScaleList,this);};MLargeMapionControl.prototype=new MLargeMapControl();MLargeMapionControl.prototype.constructor=MLargeMapionControl;MLargeMapionControl.prototype.zoomIn=function(){if(this.map.moving)return;zl=this.map.zid+1;if(zl>this.maxzoomlevel){zl=this.maxzoomlevel;return;}
this.setZoomLevel(zl);if(this.smoothZoom){this.map.smoothzoomin(1);}};MLargeMapionControl.prototype.zoomOut=function(){if(this.map.moving)return;zl=this.map.zid-1;if(zl<0){zl=0;return;}
this.setZoomLevel(zl);if(this.smoothZoom){this.map.smoothzoomout(1);}};MLargeMapionControl.prototype.show=function(){MLargeMapControl.prototype.show.call(this);var self=this;this.zi.onmousedown=function(){self.zoomIn();};this.zo.onmousedown=function(){self.zoomOut();}
MEvent.addListener(this.map,"wheel",function(rollcount){if(rollcount>0){self.zoomIn();}else{self.zoomOut();}});this.refreshScaleList();this.startlatlng=this.map.getCenterLatLng();};MLargeMapionControl.prototype.refreshScaleList=function(){this.update(this.map.getCenterLatLng());};MLargeMapionControl.prototype.update=function(point){this._scale.update(point);};MLargeMapionControl.prototype.onLoadScaleList=function(){this.setMaxZoomLevel(this._scale.getMaxZoomLevel());this.setZoomLevel(this.map.getZoomLevel());if(this._scale.getMaxZoomLevel()<this.map.getZoomLevel()){this.map.smoothzoomout(this.map.getZoomLevel()-this._scale.getMaxZoomLevel());this.setZoomLevel(this._scale.getMaxZoomLevel());}};function MSmallMapionControl(){MSmallMapControl.call();this._scale=new MMapionScale(this.onLoadScaleList,this);};MSmallMapionControl.prototype=new MSmallMapControl();MSmallMapionControl.prototype.constructor=MSmallMapionControl;MSmallMapionControl.prototype.setMaxZoomLevel=function(value){this.maxzoomlevel=value;};MSmallMapionControl.prototype.zoomIn=function(){if(this.map.moving)return;if(this.map.getZoomLevel()+1>this.maxzoomlevel)return;if(this.smoothZoom){this.map.smoothzoomin(1);}else{this.map.changeZoom(this.map.zid+1);}};MSmallMapionControl.prototype.zoomOut=function(){if(this.map.moving)return;if(this.map.getZoomLevel()==0)return;if(this.smoothZoom){this.map.smoothzoomout(1);}else{this.map.changeZoom(this.map.zid-1);}};MSmallMapionControl.prototype.show=function(){MSmallMapControl.prototype.show.call(this);var self=this;this.zi.onmousedown=function(){self.zoomIn();};this.zo.onmousedown=function(){self.zoomOut();}
MEvent.addListener(this.map,"wheel",function(rollcount){if(rollcount>0){self.zoomIn();}else{self.zoomOut();}});this.refreshScaleList();this.startlatlng=this.map.getCenterLatLng();};MSmallMapionControl.prototype.refreshScaleList=function(){this.update(this.map.getCenterLatLng());};MSmallMapionControl.prototype.update=function(point){this._scale.update(point);};MSmallMapionControl.prototype.onLoadScaleList=function(){this.setMaxZoomLevel(this._scale.getMaxZoomLevel());if(this._scale.getMaxZoomLevel()<this.map.getZoomLevel()){this.map.smoothzoomout(this.map.getZoomLevel()-this._scale.getMaxZoomLevel());}};function MSliderMapionControl(){MSliderControl.call();this._scale=new MMapionScale(this.onLoadScaleList,this);};MSliderMapionControl.prototype=new MSliderControl();MSliderMapionControl.prototype.constructor=MSliderMapionControl;MSliderMapionControl.prototype.setMaxZoomLevel=function(value){this.maxzoomlevel=value;};MSliderMapionControl.prototype.zoomIn=function(){if(this.map.moving)return;if(this.map.getZoomLevel()+1>this.maxzoomlevel)return;if(this.smoothZoom){this.map.smoothzoomin(1);}else{this.map.changeZoom(this.map.zid+1);}};MSliderMapionControl.prototype.zoomOut=function(){if(this.map.moving)return;if(this.map.getZoomLevel()==0)return;if(this.smoothZoom){this.map.smoothzoomout(1);}else{this.map.changeZoom(this.map.zid-1);}};MSliderMapionControl.prototype.show=function(){MSliderControl.prototype.show.call(this);var self=this;this.zi.onmousedown=function(){self.zoomIn();};this.zo.onmousedown=function(){self.zoomOut();}
MEvent.addListener(this.map,"wheel",function(rollcount){if(rollcount>0){self.zoomIn();}else{self.zoomOut();}});this.refreshScaleList();this.startlatlng=this.map.getCenterLatLng();};MSliderMapionControl.prototype.refreshScaleList=function(){this.update(this.map.getCenterLatLng());};MSliderMapionControl.prototype.update=function(point){this._scale.update(point);};MSliderMapionControl.prototype.onLoadScaleList=function(){this.setMaxZoomLevel(this._scale.getMaxZoomLevel());if(this._scale.getMaxZoomLevel()<this.map.getZoomLevel()){this.map.smoothzoomout(this.map.getZoomLevel()-this._scale.getMaxZoomLevel());}
this.disable();};MSliderMapionControl.prototype.zoomUpdate=function(){this.esh.style.top=this.getSwitchPos()+"px";this.erf.style.top=this.getRedFramePos()+"px";if(this.f_closed){var lid=this.map.zid;this.closeMove(lid);}
this.disable();}
MSliderMapionControl.prototype.disable=function(){var lid=this.map.zid;if(this.maxzoomlevel>lid)this.zi2.style.display="none";else this.zi2.style.display="block";if(this.minzoomlevel<lid)this.zo2.style.display="none";else this.zo2.style.display="block";if(this.maxzoomlevel==7){this.ers3.style.display="block";}else if(this.maxzoomlevel==8){this.ers3.style.display="none";this.ers2.style.display="block";}else if(this.maxzoomlevel==9){this.ers2.style.display="none";this.ers3.style.display="none";}else{this.ers3.style.display="block";}};_analyzeGroup=__jsparam['key'];var __func_tmp1=MMap.prototype.smoothmove;MMap.prototype.smoothmove=function(mmap){__func_tmp1.apply(this,arguments);if(_autoScrollLog){mapionTracker(mapionTracker.SCROLL);}};var __func_tmp2=MMap.prototype.startSmoothMove;MMap.prototype.startSmoothMove=function(fromPP,toPP,toRP){__func_tmp2.apply(this,arguments);if(_autoScrollLog){mapionTracker(mapionTracker.SCROLL);}};var __func_tmp3=mb.prototype.mup;mb.prototype.mup=function(e){if((!this.clickflg)&&(this.oP.mdownpos!=null)&&this.mousemoved){if(_autoScrollLog){mapionTracker(mapionTracker.SCROLL);}}
__func_tmp3.apply(this,arguments);};MMap.prototype.setCopyrightPosition=function(p){if(this.cpdiv==null)return;switch(p){case M_ANCHOR_TOP_LEFT:this.cpdiv.style.bottom='';this.cpdiv.style.top='5px';this.cpdiv.style.right='';this.cpdiv.style.left='5px';break;case M_ANCHOR_TOP_RIGHT:this.cpdiv.style.bottom='';this.cpdiv.style.top='5px';this.cpdiv.style.left='';this.cpdiv.style.right='5px';break;case M_ANCHOR_BOTTOM_LEFT:this.cpdiv.style.top='';this.cpdiv.style.bottom='5px';this.cpdiv.style.right='';this.cpdiv.style.left='5px';break;case M_ANCHOR_BOTTOM_RIGHT:this.cpdiv.style.top='';this.cpdiv.style.bottom='5px';this.cpdiv.style.left='';this.cpdiv.style.right='5px';break;};};MMap.extendFunc=function(){if(this.id!='mmap0'){this.cpdiv=null;return;}
var cp=document.createElement("img");cp.src=MMap.IMGPATH+'copyright3.gif';cp.style.position='absolute';cp.style.left='5px';cp.style.bottom='5px';cp.style.zIndex=9999;var mapdiv=this.mapdiv;var mdown=function(e){if(!e)e=window.evnet;mapdiv.onmousedown.call(mapdiv,e);cp.style.cursor="auto";}
var mup=function(e){if(!e)e=window.event;mapdiv.onmouseup.call(mapdiv,e);cp.style.cursor="auto";};var mclick=function(e){if(!e)e=window.event;mapdiv.onclick.call(mapdiv,e);};var mmove=function(e){if(mapdiv.oP.mdownpos){cp.style.cursor="move";}else{cp.style.cursor="auto";}}
var mwheel=function(e){if(!e)e=window.event;mapdiv.oP.mwheel.call(mapdiv,e);}
cp.onmousedown=mdown;cp.onmouseup=mup;cp.onclick=mclick;cp.onmousemove=mmove;if(cp.attachEvent||MBrowser.safari){cp.onmousewheel=mwheel;}else if(cp.addEventListener){cp.addEventListener("DOMMouseScroll",mwheel,false);}
this.div.appendChild(cp);this.cpdiv=cp;};var __url=__cacheServerByGrp[__jsparam['key']];adapterMapion.MAPURL=__url!=null?__url:__cacheServerByGrp['default'];adapterMapion.GRP='plain';function getMapsizeOfAnotherScale(_mmap,_diff){var frameLevel=_mmap.getZoomLevel()+_diff;if(frameLevel<0||frameLevel>9){return null;}
var bounds=_mmap.getBoundsLatLng();if(_mmap.getZoomLevel()==1&&_diff==2){var min=_mmap.adp.r2p(new MPoint(bounds.minX,bounds.minY),_mmap.getAdpZid(0));var max=_mmap.adp.r2p(new MPoint(bounds.maxX,bounds.maxY),_mmap.getAdpZid(0));return new MBounds(min.x,min.y,max.x,max.y);}
var p1=_mmap.adp.r2p(new MPoint(bounds.minX,bounds.minY),_mmap.getAdpZid(_mmap.getZoomLevel()));var p2=_mmap.adp.r2p(new MPoint(bounds.maxX,bounds.maxY),_mmap.getAdpZid(_mmap.getZoomLevel()));var r1=_mmap.adp.p2r(p1,_mmap.getAdpZid(frameLevel));var r2=_mmap.adp.p2r(p2,_mmap.getAdpZid(frameLevel));var pp1=_mmap.adp.r2p(r1,_mmap.getAdpZid(_mmap.getZoomLevel()));var pp2=_mmap.adp.r2p(r2,_mmap.getAdpZid(_mmap.getZoomLevel()));return new MBounds(pp1.x,pp1.y,pp2.x,pp2.y);};function MMapionScale(func,scope){this.cb=func;this.sc=scope;this.address='';this.scaleList=new Array();};MMapionScale__onLoadScaleList=function(){MMapionScale.nowRequestInstance.onLoadScaleList();};MMapionScale.pageEncoding=null;MMapionScale.prototype.update=function(point){var url='http://mc01.mapion.co.jp/m/j?grp=MapionBB&scl=25000&el='+l10tol60(point.x)+'&size=300%2C300&nl='+l10tol60(point.y)+'&varname=meta1&callback=MMapionScale__onLoadScaleList&script=false'+(MMapionScale.pageEncoding?('&enc='+MMapionScale.pageEncoding):"");MMapionScale.nowRequestInstance=this;this.jsonRequest=new JSONscriptRequest(url,"euc-jp");this.jsonRequest.buildScriptTag();this.jsonRequest.addScriptTag();};MMapionScale.prototype.onLoadScaleList=function(){this.jsonRequest.removeScriptTag();this.address=meta1.adna2+meta1.adna3+meta1.adna4;this.scaleList=new Array(meta1.scds.length);for(var i=0;i<meta1.scds.length;i++)this.scaleList[i]=meta1.scds[i];if(this.cb){if(this.sc)this.cb.call(this.sc);else this.cb.call();}};MMapionScale.prototype.getAddress=function(){return this.address;};MMapionScale.prototype.getMaxZoomLevel=function(){return ScaleToZoom[this.scaleList[0]];};var scaleListUpdaterForControl={update:function(point){scaleListUpdaterForControl.controlIdMap[this.id]=this;var url='http://mc01.mapion.co.jp/m/j?grp=MapionBB&scl=25000&el='+l10tol60(point.x)+'&size=300%2C300&nl='+l10tol60(point.y)+'&varname=kdriveControlId="'+this.id+'";kdriveScaleList&callback=MapionControl2%5Fcallback&script=false'+'&enc='+this.encoding;this.jsonRequest=new JSONscriptRequest(url,"utf-8");this.jsonRequest.buildScriptTag();this.jsonRequest.addScriptTag();},controlIdMap:{}};var MapionControl2_callback=function(){var length=kdriveScaleList.scds.length;var scaleList=[];for(var i=length-1;0<=i;i--){var scale=kdriveScaleList.scds[i];scaleList.push(ScaleToZoom[scale]);}
var control=scaleListUpdaterForControl.controlIdMap[kdriveControlId];control.setScaleList(scaleList);control.disable();control.jsonRequest.removeScriptTag();control.onLoadUpdate();};function MLargeMapionControl2(encoding){this.id="lmapictr"+MLargeMapionControl2.ID++;this.jsonRequest=null;this.encoding=encoding||"utf-8";this.scale_list=[0,1,2,3,4,5,6,7];}
MLargeMapionControl2.ID=0;MLargeMapionControl2.prototype=new MLargeMapControl;MLargeMapionControl2.prototype.update=scaleListUpdaterForControl.update;MLargeMapionControl2.prototype.onLoadUpdate=function(){var scaleList=this.scale_list;var maxScale=scaleList[scaleList.length-1];var currentScale=this.map.getZoomLevel();this.setMaxZoomLevel(maxScale);this.setZoomLevel(currentScale);};function MSmallMapionControl2(encoding){this.id="smapictr"+MSmallMapionControl2.ID++;this.jsonRequest=null;this.encoding=encoding||"utf-8";this.scale_list=[0,1,2,3,4,5,6,7];}
MSmallMapionControl2.ID=0;MSmallMapionControl2.prototype=new MSmallMapControl;MSmallMapionControl2.prototype.update=scaleListUpdaterForControl.update;MSmallMapionControl2.prototype.onLoadUpdate=function(){};function MSliderMapionControl2(f_close,encoding){MSliderControl.apply(this,[true,f_close]);this.id="slmapictr"+MSliderMapionControl2.ID++;this.jsonRequest=null;this.encoding=encoding||"utf-8";this.scale_list=[0,1,2,3,4,5,6,7];}
MSliderMapionControl2.ID=0;MSliderMapionControl2.prototype=new MSliderControl;MSliderMapionControl2.prototype.update=scaleListUpdaterForControl.update;MSliderMapionControl2.prototype.onLoadUpdate=function(){};function MMoveMapionControl(vmove,encoding){MMoveControl.apply(this,[vmove]);this.id="mvmapictr"+MMoveMapionControl.ID++;this.jsonRequest=null;this.encoding=encoding||"utf-8";this.scale_list=[0,1,2,3,4,5,6,7];}
MMoveMapionControl.ID=0;MMoveMapionControl.prototype=new MMoveControl;MMoveMapionControl.prototype.update=scaleListUpdaterForControl.update;MMoveMapionControl.prototype.onLoadUpdate=function(){};function MMoveMapionControl2(vmove,encoding){MMoveControl.apply(this,[vmove]);this.id="mvmapictr"+MMoveMapionControl2.ID++;this.jsonRequest=null;this.encoding=encoding||"utf-8";this.scale_list=[0,1,2,3,4,5,6,7];}
MMoveMapionControl2.ID=0;MMoveMapionControl2.prototype=new MMoveControl;MMoveMapionControl2.prototype.update=scaleListUpdaterForControl.update;MMoveMapionControl2.prototype.onLoadUpdate=function(){};
