/*
Copyright 2006 NAVITIME JAPAN CO.,LTD. All Rights Reserved.
Auther by myoshida@navitime.co.jp
Version1.2.2
*/
(function() {
var Ls = new Image(450,340);
var Bx = document;
var Jn = '+VzBW8wAgZi1lh3k+-/+T09Ty5b7XeU-/+Vv1XH1cwdAaWYg-';
var Lb = '+ACY-copy+ADsAIA-2007+ACA-NAVTEQ';
function $() {
var elements = new Array();
for (var i = 0; i < arguments.length; i++) {
var element = arguments[i];
if (typeof element == 'string')
element = Bx.getElementById(element);
if (arguments.length == 1)
return element;
elements.push(element);
}
return elements;
}
function Pe(e){
if(NTUserAgent.type==1){
return e.x;
}else if(NTUserAgent.type==4){
return e.offsetX;
}else if(NTUserAgent.type==3){
return e.offsetX - s(e.target,"left");
}else{
if(e.target.x!=null){
return e.layerX - e.target.x;
}else{
return e.layerX;
}
}
};
function By(e){
if(NTUserAgent.type==1){
return e.y;
}else if(NTUserAgent.type==4){
return e.offsetY;
}else if(NTUserAgent.type==3){
return e.offsetY - s(e.target,"top");
}else{
if(e.target.y!=null){
return e.layerY - e.target.y;
}else{
return e.layerY;
}
}
};
function Na(e){
if(NTUserAgent.type==1){
return e.target.className;
}else if(NTUserAgent.type==3){
return e.target.className;
}else{
return e.target.className;
}
};
function Ef(a, b) {
window[a] = b;
}
function s(a,b,c){
var r = $(a).style[b];
if(r != "" && r.indexOf("px")!= -1 && r.indexOf("px") == r.length-2){
r=r.substr(0,r.indexOf("px"));
}
if(r != "" && r.indexOf("pt") != -1 && r.indexOf("pt") == r.length-2){
r=r.substr(0,r.indexOf("pt"));
}
return isNaN(r)?r:new Number(r);
}
function Vc(a,b,c,d){
var r = Bx.createElement("DIV");
if(!a || a==""){
do{
a = "div" + Math.floor(Math.random() * 1000000000);
}while($(a) != null);
}
r.id=a;
var s = r.style;
if(b!=null){s.position=b;}
if(c!=null){s.left = isNaN(c)?c:c+'px';}
if(d!=null){s.top = isNaN(d)?d:d+'px';}
return r;
}
function Fy(u,w,h){
var r = Bx.createElement("img");
if(u!=null && u!="")r.src = u;
if(w!=null){r.width = w; r.style.width = w + "px";}
if(h!=null){r.height = h; r.style.height = h + "px";}
return r;
}
function Nv(a){
if(!a) return;
var b = a.parentNode;
var l = b.childNodes.length;
for(var i=0; i<l; i++){
if(b.childNodes[i]==a){
b.removeChild(b.childNodes[i]);
break;
}
}
}
function Pp(a){
if(!a) return;
var l = a.childNodes.length;
for(var i=l; i>=0; i--){
var cl = 0;
try{
cl = a.childNodes[i].childNodes['length'];
if(cl> 0){
Pp(a.childNodes[i]);
}
a.removeChild(a.childNodes[i]);
}catch(e){
continue;
}
}
}
function CancelBubble(e){
if(NTUserAgent.type==1){
window.event.cancelBubble=true;
window.event.returnValue=false;
}else{
e.cancelBubble=true;
if(e.preventDefault){
e.preventDefault();
}
if(e.stopPropagation){
e.stopPropagation();
}
}
}
function EmptyFunction(){};
var eventHandler = function(a){
var i=this;
return function(e){
if(!e){
e=window.event;
}
if(e&&!e.target){
e.target=e.srcElement;
}
i[a](e);
}
};
var methodHandler = function(a){
var i=this;
return function(){
var args = new Array(arguments.length);
for(var b=0; b<arguments.length; b++){
args[b] = arguments[b];
}
i[a].apply(i,args);
}
};
var _timeoutCounter=0;
function Uf(a){
a.prototype.setTimeout=function(timeoutHandler,elapseTime){
var Ie="tempVar"+_timeoutCounter;
_timeoutCounter++;
eval(Ie+" = this;");
var oi=timeoutHandler.replace(/\\/g,"\\\\").replace(/\"/g,'\\"');
return window.setTimeout(Ie+'._setTimeoutDispatcher("'+oi+'");'+Ie+" = null;",elapseTime);
};
a.prototype._setTimeoutDispatcher=function(He){
eval(He);
};
}
function scrollbar(a){
if(Bx.body){
Bx.body.scroll=a?"auto":"no"
if(window.innerHeight){
var s = Bx.body.style;
s.height=a?"auto":window.innerHeight-32
s.width=a?"auto":window.innerWidth-32
s.overflow=a?"visible":"hidden"
}
}else if(Bx.height){
if(a && Bx._height){
Bx.height=Bx._height
delete Bx._height
Bx.width=Bx._width
delete Bx._width
window.onresize=window._resize
}
if(!a){
if(!Bx._height){
Bx._height=Bx.height
Bx._width=Bx.width
window._resize=window.onresize
window.onresize=new Function("if(window._resize)_resize();scrollbar(false)")
}
Bx.height=window.innerHeight
Bx.width=window.innerWidth
}
}
}
var E = [
function(a,b){(window["onMapLoad"] || EmptyFunction)(a,b);},
function(a,b){(window["onMapMove"] || EmptyFunction)(a,b);},
function(a,b){(window["onMapZoom"] || EmptyFunction)(a,b);},
function(a,b,c){(window["onMapContext"] || EmptyFunction)(a,b,c);}
];
Array.prototype.push = function(a){
this[this.length] = a;
};
function setAlpha(a,b){
var s = a.style;
s.MozOpacity = b/100;
s.opacity = b/100;
if(s.filter && s.filter.length>0){
if(s.filter.indexOf("progid:DXImageTransform.Microsoft.Alpha(") > -1){
s.filter.match(/(.*progid:DXImageTransform.Microsoft.Alpha\(opacity=)\d+(\).*)/);
s.filter = RegExp.$1 + b + RegExp.$2;
}else{
return;
}
}else{
s.filter='progid:DXImageTransform.Microsoft.alpha(opacity='+b+')';
}
}
function Uc(b,w,h,p,c){
var a;
if(NTUserAgent.type==1 && NTUserAgent.version<7){
a = Vc(null,p ? "relative" : "absolute", 0, 0);
var s = a.style;
if(w) s.width = w+"px";
if(h) s.height = h+"px";
s.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="+b+")";
}else{
a = Fy(b,w,h);
a.style.position="absolute";
}
if(c) a.className = c;
return a;
}
function Hk(u,x,y,w,h,p,c){
var a=Vc("",p ? "relative" : "absolute", 0, 0);
a.style.overflow = "hidden";
Uu(a,w,h);
var b=Uc(u,Ls.width, Ls.height, false, c);
a.appendChild(b);
Gm(b,-x, -y);
if(c) a.className = c;
return a;
}
function Gm(a,b,c){
var s = a.style;
s.left = isNaN(b)?b:b+'px';
s.top= isNaN(c)?c:c+'px';
}
function Uu(a,b,c){
var s = a.style;
s.width= isNaN(b)?b:b+'px';
s.height = isNaN(c)?c:c+'px';
}
function Oz(a){
var Zt = document.createElement(a.tagName);
for(var i in a.style){
try{Zt.style[i] = a.style[i];}catch(e){}
}
var l = a.childNodes.length;
for(var i=0; i<l; i++){
var copyObject = Oz(a.childNodes[i]);
Zt.appendChild(copyObject);
}
if(a.innerHTML) Zt.innerHTML = a.innerHTML;
return Zt;
}
var NTHashMap = function(){
this.Jd = new Array();
};
NTHashMap.prototype = {
put: function(a,b){
var i = 0;
for (; i < this.Jd.length; i++) {
if (this.Jd[i].key == a) break;
}
this.Jd[i] = {key:a, value:b};
},
get: function(a){
for (var i = 0; i < this.Jd.length; i++) {
if (this.Jd[i].key == a) return this.Jd[i].value;
}
return null;
},
remove: function(a){
var exists = false;
var i = 0;
for (; i < this.Jd.length; i++) {
if (this.Jd[i].key == a) {
exists = true;
break;
}
}
if (exists) this.Jd.splice(i, 1);
},
size: function(a){
return this.Jd.length;
},
containsKey:function(a){
for (var i = 0; i < this.Jd.length; i++) {
if (this.Jd[i].key == a) return true;
}
return false;
},
toArray: function(a){
return this.Jd;
},
toString: function(){
if(this.size()==0){
return "";
}
var ret="{";
for (var i = 0; i < this.Jd.length; i++) {
if(ret.length > 1) ret += ",";
var a = this.Jd[i];
if(a.value != null) ret += a.key + ":" + a.value;
}
return ret + "}";
}
}
/* Copyright (C) 2006 NAVITIME JAPAN CO.,LTD. All Rights Reserved. */
var NTLatLng = function(a,b) {
this.Latitude = parseDms(a);
this.Longitude = parseDms(b);
};
NTLatLng.parse = function(a){
return new this(a.split(",")[0], a.split(",")[1]);
};
NTLatLng.prototype.getLongitude = function(){
return this.Longitude;
};
NTLatLng.prototype.getLatitude = function(){
return this.Latitude;
};
NTLatLng.prototype.getDmsLongitude = function(){
return changeDms(this.Longitude);
}
NTLatLng.prototype.getDmsLatitude = function(){
return changeDms(this.Latitude);
}
function changeDms(milsec){
var m= milsec<0?"-":"";
milsec = Math.abs(milsec);
var degree=(milsec-milsec%3600000)/3600000;
var minute=((milsec-degree*3600000)-(milsec-degree*3600000)%60000)/60000;
var second=((milsec-degree*3600000-minute*60000)-((milsec-degree*3600000-minute*60000)%1000))/1000;
var milliSecond=milsec-degree*3600000-minute*60000-second*1000;
return m + degree + "." + minute + "." + second + "." + milliSecond;
}
function parseDms(a){
var b = new String(a);
if(b.match(/[^0-9\-]/i)) {
var dms = new Array(4);
var m="", r=0 ,ret=0;
for(var i=0; i<b.length; i++){
if(b.substring(i,i+1).match(/[^0-9]/i)){
if(b.substring(i,i+1).match(/\-/i)){
m = "-";
}else{
r++;
}
continue;
}
if(dms[r]==null) dms[r] = "";
dms[r] += b.substring(i,i+1);
}
ret += new Number(dms[0]!=null ? dms[0]*3600000:0);
ret += new Number(dms[1]!=null ? dms[1]*60000:0);
ret += new Number(dms[2]!=null ? dms[2]*1000:0);
ret += new Number(dms[3]!=null ? dms[3]:0);
return m + ret;
}else{
return a;
}
}
function Ey(a,b,c){
if(b!=null){
a=Zz(a,b)
}
if(c!=null){
a=Py(a,c)
}
return a
}
function Dh(a,b,c){
while(a>c){
a-=c-b
}
while(a<b){
a+=c-b
}
return a
}
function Py(a,b){
return Math.min(a,b)
}
function Zz(a,b){
return Math.max(a,b)
}
function Yi(a){
return a*Math.PI/180
}
NTLatLng.prototype.latRadians=function(){
return Yi(Ey(this.Latitude/3600000,-90,90))
};
NTLatLng.prototype.lngRadians=function(){
return Yi(Dh(this.Longitude/3600000,-180,180))
};
NTLatLng.prototype.distanceFrom=function(a){
var b=this.latRadians();
var c=a.latRadians();
var d=b-c;
var e=this.lngRadians()-a.lngRadians();
var f=2*Math.asin(Math.sqrt(Math.pow(Math.sin(d/2),2)+Math.cos(b)*Math.cos(c)*Math.pow(Math.sin(e/2),2)));
return f*6378137
};
NTLatLng.DEFAULT = new NTLatLng(128390426,502963993);
/* Copyright (C) 2006 NAVITIME JAPAN CO.,LTD. All Rights Reserved. */
var NTPoint = function(x, y) {};
NTPoint.prototype.alert=function(){
};
/* Copyright (C) 2006 NAVITIME JAPAN CO.,LTD. All Rights Reserved. */
var NTColor = function(a,b,c) {
this.r=a;
this.g=b;
this.b=c;
};
NTColor.prototype.getWebCode = function(){
var r = new Number(this.r);
var g = new Number(this.g);
var b = new Number(this.b);
return r.toString(16) + g.toString(16) + b.toString(16);
};
NTColor.DEFAULT = new NTColor(0,0,150);
/* Copyright (C) 2006 NAVITIME JAPAN CO.,LTD. All Rights Reserved. */
var NTSize = function(a, b) {
this.x = Math.round(a);
this.y = Math.round(b);
};
NTSize.parse = function(a){
return new this(a.offsetWidth, a.offsetHeight);
}
/* Copyright (C) 2006 NAVITIME JAPAN CO.,LTD. All Rights Reserved. */
var NTMapStatus = function(a,b,c,d,e) {
this._ll = a;
this._size = b;
this._angle = c;
this._scale = d;
this._zoom = e;
this._route = new Array();
this._palette = "";
this._params = new NTHashMap();
};
NTMapStatus.prototype.setPos = function(a){
this._ll = a;
};
NTMapStatus.prototype.getPos = function(){
return this._ll;
};
NTMapStatus.prototype.setSize = function(a){
this._size = a;
};
NTMapStatus.prototype.getSize = function(){
return (this._size || new NTSize(-1,-1));
};
NTMapStatus.prototype.setAngle = function(a){
this._angle = a;
};
NTMapStatus.prototype.getAngle = function(){
return this._angle;
};
NTMapStatus.prototype.setScale = function(a){
this._scale = a;
};
NTMapStatus.prototype.getScale = function(){
return this._scale;
};
NTMapStatus.prototype.setZoom = function(a){
this._zoom = a;
};
NTMapStatus.prototype.getZoom = function(){
return this._zoom;
};
NTMapStatus.prototype.addRoute = function(a){
this._route[this._route.length] = a;
};
NTMapStatus.prototype.getRoute = function(){
return this._route;
};
NTMapStatus.prototype.removeRoute = function(a){
if(a==null) return;
var b = this._route;
var r = false;
for(var i=0; i<b.length; i++){
if(a == b[i]){
b[i] =null;
r = true;
}
}
var c = new Array();
for(var i=0; i<b.length; i++){
if(b[i]==null) continue;
c[c.length]=b[i];
}
this._route = c;
return r;
};
NTMapStatus.prototype.clearRoute = function(){
this._route = new Array();
};
NTMapStatus.prototype.setPalette = function(a){
this._palette = a;
};
NTMapStatus.prototype.getPalette = function(){
return this._palette;
};
NTMapStatus.prototype.addParam = function(a,b){
this._params.put(a,b);
};
NTMapStatus.prototype.removeParam = function(a){
this._params.remove(a);
};
NTMapStatus.prototype.getParam = function(){
return this._params.toArray();
};
NTMapStatus.DEFAULT = new NTMapStatus(new NTSize(400,400),0,3,5);
NTZoomToolbar.Mode = function() {
};
NTZoomToolbar.Mode.PC = "PC";
NTZoomToolbar.Mode.MOBILE = "MOBILE";
function NTZoomToolbar(){
this.Qt = new Array();
for (var i=arguments.length-1, j=0; i >0 ; i-=2, j++) {
this.Qt[j] = new Qj(arguments[i-1],arguments[i]);
}
this.Yh = Bx.body;
this.Ll = null;
this.Rv= eventHandler.apply(this, ["onMouseDown"]);
this.Lg= eventHandler.apply(this, ["onMouseMove"]);
this.fE= eventHandler.apply(this, ["onMouseUp"]);
this.iY= eventHandler.apply(this, ["onMouseOver"]);
this.Kk= eventHandler.apply(this, ["onMouseOut"]);
this.Ue= eventHandler.apply(this, ["onPlusClick"]);
this.Zf= eventHandler.apply(this, ["onMinusClick"]);
this.Fv= eventHandler.apply(this, ["onRailClick"]);
this.Mt= false;
this.changedFunc = null;
this.Hf = 9;
this.Ok = 0;
this.fZ = 10;
this.Et= 20;
this.Ql = NTZoomToolbar.Mode.PC;
this.Ew = undefined;
this.Id = undefined;
}
NTZoomToolbar.DEFAULT = new NTZoomToolbar(0,2,0,5,0,12,1,5,1,8,1,16,2,3,3,2,3,5,4,2,4,4,4,8);
NTZoomToolbar.prototype.addZoom = function(a,b){
this.Qt[this.Qt.length] = new Qj(a,b);
};
NTZoomToolbar.prototype.setParent = function(a){
this.Yh = a;
};
NTZoomToolbar.prototype.onChange = function(a){
this.changedFunc = a;
};
NTZoomToolbar.prototype.setStatus = function(a){
this.Ll = a;
for(var i=0; i<this.Qt.length; i++){
var z = this.Qt[i];
if(a.getScale()==z.getScale() && a.getZoom()==z.getZoom()){
this.Ok = i;
break;
}
}
if(this.Ok != 0){
this.scrollTo(this.Ok * this.Hf + 1);
}
};
NTZoomToolbar.prototype.setScaleByPoi = function(a,b){
if(a==null || a.poi==null || a.poi.length==0) return;
var Mr=0,Lm=0,Fn=0,Tx=0,Fp,Wv;
for(var i=0; i<a.poi.length; i++){
if(a.poi[i]==null){continue;}
if(a.center == null){
if(Mr == 0 || Mr < a.poi[i].getLongitude()){ Mr=a.poi[i].getLongitude();}
if(Lm == 0 || Lm > a.poi[i].getLongitude()){ Lm=a.poi[i].getLongitude();}
if(Fn == 0 || Fn < a.poi[i].getLatitude()){ Fn=a.poi[i].getLatitude();}
if(Tx == 0 || Tx > a.poi[i].getLatitude()){ Tx=a.poi[i].getLatitude();}
}else{
if(Mr == 0 || Mr < Math.abs(a.poi[i].getLongitude() - a.center.getLongitude())){
Mr = Math.abs(a.poi[i].getLongitude() - a.center.getLongitude());
}
if(Fn == 0 || Fn < Math.abs(a.poi[i].getLatitude() - a.center.getLatitude())){
Fn = Math.abs(a.poi[i].getLatitude() - a.center.getLatitude());
}
}
}
if(a.center == null){
Fp = Math.abs(Mr - Lm)*1.1;
Wv = Math.abs(Fn - Tx)*1.1;
}else{
Fp = Mr * 2 *1.1;
Wv = Fn * 2 *1.1;
}
var processed = false;
for(var i=0; i < this.Qt.length; i++){
var s = new NTMapStatus(this.Ll.getPos(),this.Ll.getSize(),0,this.Qt[i].getScale(),this.Qt[i].getZoom());
var pxOfLon = Math.ceil(NTGeoUtil.getLonFactor(s));
var pxOfLat = Math.ceil(NTGeoUtil.getLatFactor(s));
if(this.Ll.getSize().x * pxOfLon > Fp && this.Ll.getSize().y * pxOfLat > Wv){
this.scrollTo(i * this.Hf + 1, true);
processed = true;
break;
}
}
if (!processed && b != null && b) {
this.scrollTo(this.Qt.length * this.Hf, true);
}
if(a.center==null){
return new NTLatLng(Math.round(new Number(Tx) + new Number(Fn-Tx)/2) , Math.round(new Number(Lm) + new Number(Mr - Lm)/2));
}else{
return a.center;
}
};
NTZoomToolbar.prototype.onMouseDown = function(e){
this.Ai.onMouseDown(e);
this.Mt = true;
}
NTZoomToolbar.prototype.onMouseMove = function(e){
this.Ai.onMouseMove(e);
}
NTZoomToolbar.prototype.onMouseUp = function(e){
CancelBubble(e);
if(!this.Mt) return;
var a = this.Ai.onMouseUp(e);
this.scrollTo(s(this.Vf,"top")+1);
this.Mt = false;
}
NTZoomToolbar.prototype.onRailClick = function(e){
if(e.target.parentNode != this.Qb){
return false;
}
var Kh = By(e);
if(NTUserAgent.type==2) Kh -=104;
if(NTUserAgent.type==4) Kh += e.target.offsetTop;
this.scrollTo(Kh);
};
NTZoomToolbar.prototype.scrollTo = function(a,b){
if(b==null) b=false;
var idx = Math.floor((a-1) / this.Hf);
if(idx >= this.Qt.length){
return false;
}
var ztv = this.Qt[idx];
if(this.Vf) this.Vf.style.top = idx * this.Hf + 1 + "px";
if(this.changedFunc != null){
this.changedFunc(ztv.getScale(), ztv.getZoom(),b);
}
};
NTZoomToolbar.prototype.load = function(){
var style;
this.Mw = Vc("zoomToolbar","relative",this.fZ+"px",this.Et+"px");
style = this.Mw.style;
style.zIndex=901;
style.width = "26px";
style.padding = "2px";
this.Yh.appendChild(this.Mw);
if (this.Ew) {
this.Ze = Hk(Ls.src, this.Ew.left, this.Ew.top, this.Ew.width, this.Ew.height, 'relative', '');
}
else {
this.Ze = Hk(Ls.src, 75, 75, 25, 25, 'relative', '');
}
style = this.Ze.style;
style.left = '3px';
style.top = '2px';
this.Mw.appendChild(this.Ze);
this.Qb = Hk(Ls.src, 100, 50, 25, this.Qt.length * this.Hf, 'relative', '');
style = this.Qb.style;
style.left = '3px';
style.top = '0px';
if (this.Ql != NTZoomToolbar.Mode.MOBILE) {
this.Mw.appendChild(this.Qb);
}
if (this.Id) {
this.Ri = Hk(Ls.src, this.Id.left, this.Id.top, this.Id.width, this.Id.height, 'relative', '');
}
else {
this.Ri = Hk(Ls.src, 75, 50, 25, 25, 'relative', '');
}
style = this.Ri.style;
style.left = '3px';
style.top = '0px';
this.Mw.appendChild(this.Ri);
this.Vf = Hk(Ls.src, 75, 100, 25, 9, 'absolute', '');
style = this.Vf.style;
style.top = '1px';
this.Qb.appendChild(this.Vf);
var Lv = this.Vf.setCapture?this.Vf:window;
NTEvent.add(this.Vf,'mousedown',this.Rv);
NTEvent.add(Lv,'mousemove',this.Lg);
NTEvent.add(Lv,'mouseup',this.fE);
NTEvent.add(this.Qb, 'click', this.Fv);
NTEvent.add(this.Ze,'mouseover',this.iY);
NTEvent.add(this.Ri,'mouseover',this.iY);
NTEvent.add(this.Vf,'mouseover',this.iY);
NTEvent.add(this.Qb,'mouseover',this.iY);
NTEvent.add(this.Ze,'mouseout',this.Kk);
NTEvent.add(this.Ri,'mouseout',this.Kk);
NTEvent.add(this.Vf,'mouseout',this.Kk);
NTEvent.add(this.Qb,'mouseout',this.Kk);
NTEvent.add(this.Ze,'click',this.Ue);
NTEvent.add(this.Ri,'click',this.Zf);
this.Ai = new NTMover({src:this.Vf, move:this.Vf});
this.Ai.downTarget=this.Vf;
this.Ai.setAvailableArea(new NTSize(0,1), new NTSize(0,(s(this.Qb,"height")-s(this.Vf,"height"))));
if(this.Ok != 0){
this.scrollTo(this.Ok * this.Hf + 1);
}
};
NTZoomToolbar.prototype.onMouseOver = function(e){
if(NTUserAgent.type==1 && NTUserAgent.version==5) return false;
e.target.style.cursor = "pointer";
};
NTZoomToolbar.prototype.onMouseOut = function(e){
if(NTUserAgent.type==1 && NTUserAgent.version==5) return false;
e.target.style.cursor = "default";
};
NTZoomToolbar.prototype.onMinusClick = function(e){
if(s(this.Vf,"top") >= this.Qt.length * this.Hf + 1){
return false;
}
this.scrollTo(s(this.Vf,"top") + this.Hf, true);
};
NTZoomToolbar.prototype.onPlusClick = function(e){
if(s(this.Vf,"top") <= 1){
return false;
}
this.scrollTo(s(this.Vf,"top") - this.Hf, true);
};
NTZoomToolbar.prototype.changeZoom = function(n) {
var a = Math.abs(n);
if(n > 0) {
if(s(this.Vf,"top") <= 1){
return false;
}
while ((s(this.Vf,"top") - this.Hf * a) < 1) {
a--;
}
this.scrollTo(s(this.Vf,"top") - this.Hf * a, true);
}
if (n < 0) {
if(s(this.Vf,"top") >= this.Qt.length * this.Hf + 1){
return false;
}
while ((s(this.Vf,"top") + this.Hf * a) >= this.Qt.length * this.Hf + 1) {
a--;
}
this.scrollTo(s(this.Vf,"top") + this.Hf * a, true);
}
}
NTZoomToolbar.prototype.getContent = function(){
return this.Mw;
};
NTZoomToolbar.prototype.setZoomImage = function(a,b) {
this.Ew = a;
this.Id = b;
};
NTZoomToolbar.prototype.setPosition = function(a, b){
this.fZ = a;
this.Et = b;
};
NTZoomToolbar.prototype.setMode = function(a) {
this.Ql = a;
};
function Qj(a,b){
this.scale = a;
this.zoom = b;
}
Qj.prototype.getScale = function(){
return this.scale;
};
Qj.prototype.getZoom = function(){
return this.zoom;
};
function NTScaler(a,b,c){
this.Kw = b;
var top = this.Kw ? s(a, "height") - 37: s(a,"height")-45;
var bottom = (c != null && c.bottom) ? c.bottom : null;
if (bottom == null) {
this._sc = Vc('NTScale',"absolute","10px",top+"px");
} else {
this._sc = Vc('NTScale',"absolute","10px");
}
var stl;
stl = this._sc.style;
stl.zIndex = 910;
stl.font = "0px Arial";
stl.backgroundColor = "#FFF";
stl.height =!this.Kw ? "30px" : "18px";
if (bottom != null) {
stl.bottom = bottom + "px";
}
setAlpha(this._sc,60);
a.appendChild(this._sc);
if (!this.Kw) {
if (bottom == null) {
this._barMile = Vc('NTScaleBarMile',"absolute","12px", top+5+"px");
} else {
this._barMile = Vc('NTScaleBarMile',"absolute","12px");
}
stl = this._barMile.style;
stl.zIndex = 911;
stl.border = "1px #000 solid";
stl.width = "0px";
stl.height = "6px";
stl.backgroundColor = "#FFF";
stl.fontSize = "0px";
if (bottom != null) {
stl.bottom = (bottom + 17) + "px";
}
a.appendChild(this._barMile);
if (bottom == null) {
this._textMile = Vc('NTScaleTextMile',"absolute","0px",top+2+"px");
} else {
this._textMile = Vc('NTScaleTextMile',"absolute","0px");
}
stl = this._textMile.style;
stl.zIndex = 912;
stl.color = "#555";
stl.font = "bold 10px Arial";
if (bottom != null) {
stl.bottom = (bottom + 15) + "px";
}
a.appendChild(this._textMile);
}
if (bottom == null) {
if (this.Kw) {
top -= 10;
}
this._barMeter = Vc('NTScaleBarMeter',"absolute","12px", top+17+"px");
} else {
this._barMeter = Vc('NTScaleBarMeter',"absolute","12px");
}
stl = this._barMeter.style;
stl.zIndex = 911;
stl.border = "1px #000 solid";
stl.width = "0px";
stl.height = "6px";
stl.backgroundColor = "#FFF";
stl.fontSize = "0px";
if (bottom != null) {
stl.bottom = (bottom + 5) + "px";
}
a.appendChild(this._barMeter);
if (bottom == null) {
this._textMeter = Vc('NTScaleTextMeter',"absolute","0px",top+14+"px");
} else {
this._textMeter = Vc('NTScaleTextMeter',"absolute","0px");
}
stl = this._textMeter.style;
stl.zIndex = 912;
stl.color = "#555";
stl.font = "bold 10px Arial";
if (bottom != null) {
stl.bottom = (bottom + 3) + "px";
}
a.appendChild(this._textMeter);
}
NTScaler.prototype.getRange = function(a){
return Math.floor(NTGeoUtil.getLonFactor(a) * 5);
}
NTScaler.prototype.set = function(a){
var b = a.getPos();
var c = new NTLatLng(new Number(b.getLatitude()), new Number(b.getLongitude()) + this.getRange(a));
var d = b.distanceFrom(c);
var e = d*12.5;
var meter=this.of(e/1000,"Km",e,"m",1);
if (!this.Kw) {
var mile=this.of(e/1609.344,"mi.",e/0.3048,"ft.",10);
this._barMile.style.width = mile.length + "px";
this._textMile.style.left = mile.length + 17 + "px";
this._textMile.innerHTML = mile.display;
}
this._barMeter.style.width = meter.length + "px";
this._textMeter.style.left = meter.length + 17 + "px";
this._textMeter.innerHTML = meter.display;
var m;
if (!this.Kw) {
m = Math.max(meter.length,mile.length);
} else {
m = meter.length;
}
var n;
if (!this.Kw) {
n =Math.max(this._textMile.offsetWidth,this._textMeter.offsetWidth);
} else {
n = this._textMeter.offsetWidth;
}
this._sc.style.width = m + 17 + n + "px";
};
function Sy(a){
var b=a;
if(b>1){
var c=0;
while(b>=10){
b=b/10;
c=c+1
}
if(b>=5){
b=5
}else if(b>=2){
b=2
}else{
b=1
}
while(c>0){
b=b*10;
c=c-1
}
}
return b
};
NTScaler.prototype.of=function(a,b,c,d,x){
var e=a*x;
var f=b;
var m=true;
if(e<1){
e=c;
f=d;
m=false;
}
var g=Sy(e);
var h=Math.round(125*g/(2*e));
return{
length:h,display:g+" "+f
}
};
var NTPopup = function(a,b){
this.closeClickHandler = eventHandler.apply(this, ["onCloseClick"]);
this.Ev = a;
this.Wr = new Array();
this.Jf = new NTPopupFactor();
this.spaceX = 8;
this.spaceY = 24;
this.Vr = false;
this.rW = 0;
this.Rl = 0;
this.Qx = 0;
this.kO = "#FFF";
this.Ju = "#949494";
if(b){
if(b.max){
this.Rl = b.max.x;
this.Qx = b.max.y;
}
if(b.bgcolor) this.kO = b.bgcolor;
if(b.bordercolor) this.Ju = b.bordercolor;
}
};
NTPopup.prototype = {
createDocument: function(a){
this.Yh = a;
this.Fq = Vc("","relative",0,0);
var s = this.Fq.style;
s.cursor = "default";
s.visibility = "hidden";
this.Jf.top = qF(25, 0, 220-(25-this.spaceX)*2, 25, 1, 0, 0, 0, this.kO,true, this.Ju );
this.Jf.middle = qF(0, 0, 240+20, 50-20, 0, 1, 1, 0, this.kO,true, this.Ju );
this.Jf.bottom = qF(25, 0, 220-(25-this.spaceX)*2, 25, 0, 0, 0, 1, this.kO,true, this.Ju );
this.Jf.tail = Hg(Ls.src,50,0,100,50,0,-1,false,"static");
this.Jf.tail.style.visibility = "hidden";
this.Jf.topleft = Hg(Ls.src,0,0,25,25,0,0,false,"object");
this.Jf.topright = Hg(Ls.src,25,0,25,25,0,0,false,"object");
this.Jf.bottomleft = Hg(Ls.src,0,25,25,25,0,0,false,"object");
this.Jf.bottomright = Hg(Ls.src,25,25,25,25,0,0,false,"object");
this.Jf.shadow = Hg(Ls.src,150,0,300,150,0,0,false,"static");
this.Jf.shadow.style.visibility = "hidden";
this.Jf.close = Hg(Ls.src,0,50,15,15,0,0,false,"object");
this.Jf.close.style.cursor = "pointer";
NTEvent.add(this.Jf.close, 'click', this.closeClickHandler);
var bg = this.Jf.getFactor();
for(var i=0; i< bg.length; i++){
this.Fq.appendChild(bg[i]);
}
this.Fq.style.position = "absolute";
this.Yh.appendChild(this.Fq);
this.Yh.appendChild(this.Jf.tail);
this.Yh.appendChild(this.Jf.shadow);
for(var o=0; o<this.rW; o++){
this.Yh.appendChild(this.Wr[o].body);
}
this.setDepth();
this.resize();
return this.getDocument();
},
getDocument: function(){
return {base: this.Fq, shadow: this.Jf.shadow, tail: this.Jf.tail};
},
getPos: function(){
return this.Ev;
},
setPos: function(a){
this.Ev = a;
},
addContent: function(a,b){
b.className = "object";
var style = b.style;
style.display = "block";
style.visibility = "hidden";
style.position = "absolute";
style.cursor = "default";
var wE = {title:a, body:b};
this.Wr.push(wE);
this.rW++;
},
getContent: function(){
return this.Wr;
},
setClassName: function(tagName,cName,o){
var inputs = o.getElementsByTagName(tagName);
if(inputs){
for(var i in inputs){
inputs[i].className=cName;
}
}
},
replaceContent: function(a){
for(var o=0; o<this.rW; o++){
this.Wr[o].body.style.display="none";
this.Wr[o].body.style.visibility="hidden";
var len = this.Wr[o].body.childNodes.length;
for(var i=len - 1; i>=0; i--){
this.Wr[o].body.removeChild(this.Wr[o].body.childNodes[i]);
}
}
this.Wr = new Array();
this.rW = 0;
this.setClassName('input','innerPopup',a.body);
this.setClassName('button','innerPopup',a.body);
this.addContent(a.title, a.body);
for(var o=0; o<this.rW; o++){
this.Yh.appendChild(this.Wr[o].body);
}
this.setDepth();
this.resize();
},
resize: function(a,b){
var No;
if(!a && !b){
if(this.rW == 0) return;
var Rl=130, Qx=50;
for(var i=0; i<this.rW; i++){
Zs = this.Wr[i].body;
No = Zs.style;
No.position = "relative";
if(Zs.offsetWidth > Rl){
if(this.Rl > 0 && Zs.offsetWidth > this.Rl){
Rl = this.Rl<130?130:this.Rl;
No.width = this.Rl + "px";
}else{
Rl = Zs.offsetWidth<150?150:Zs.offsetWidth;
No.width = Rl+"px";
}
}else{
No.width = Rl+"px";
}
if(Zs.offsetHeight > Qx){
if(this.Qx>0 && Zs.offsetHeight > this.Qx){
Qx = this.Qx;
No.height = this.Qx - this.spaceY + "px";
No.overflow = "auto";
}else{
Qx = Zs.offsetHeight;
No.height = Qx+"px";
}
}
No.position = "absolute";
}
a = Rl;
b = Qx;
}
Uu(this.Jf.middle, a+(this.spaceX*2)-2, b-(25-this.spaceY/2));
Uu(this.Jf.top, a-(25-this.spaceX)*2, 24);
Uu(this.Jf.bottom, a-(25-this.spaceX)*2,24);
Gm(this.Jf.topright, a + this.spaceX -(25 - this.spaceX), 0);
Gm(this.Jf.bottomleft, 0, b+(this.spaceY/2));
Gm(this.Jf.bottomright, a + this.spaceX -(25 - this.spaceX), b+(this.spaceY/2));
Gm(this.Jf.tail, (a-100)/2+this.spaceX,-1);
Gm(this.Jf.shadow, Rl/2 - 50, this.Fq.offsetHeight - this.Jf.shadow.offsetHeight);
Gm(this.Jf.close, Rl+this.spaceX-this.Jf.close.offsetWidth, 5);
No = this.Fq.style;
No.width = a + this.spaceX * 2 + "px";
No.height = this.Jf.top.offsetHeight + this.Jf.middle.offsetHeight + this.Jf.bottom.offsetHeight + "px";
No.overflow = "hidden";
},
setDepth: function(a){
this.Fq.style.zIndex = (a||460);
this.Jf.tail.style.zIndex = (a||460)+20;
this.Jf.shadow.style.zIndex = (a||400)-200;
for(var o=0; o<this.rW; o++){
this.Wr[o].body.style.zIndex = (a||400)+60;
}
},
open: function(){
this.Fq.style.visibility = "visible";
this.Jf.tail.style.visibility = "visible";
this.Jf.shadow.style.visibility = "visible";
this.Vr = true;
if(this.rW>0) this.Wr[0].body.style.visibility = "visible";
},
close: function(){
this.Fq.style.visibility = "hidden";
this.Jf.tail.style.visibility = "hidden";
this.Jf.shadow.style.visibility = "hidden";
this.Vr = false;
for(var i=0; i<this.rW; i++){
this.Wr[i].body.style.visibility = "hidden";
}
},
foreground: function(){
this.Fq.style.zIndex |= 100;
var bg = this.Jf.getFactor();
for(var i=0; i< bg.length; i++){
bg[i].style.zIndex |= 100;
}
for(var i=0; i<this.rW; i++){
this.Wr[i].body.style.zIndex|=100;
}
},
back: function(){
this.Fq.style.zIndex &=~ 100;
var bg = this.Jf.getFactor();
for(var i=0; i< bg.length; i++){
bg[i].style.zIndex &=~ 100;
}
for(var i=0; i<this.rW; i++){
this.Wr[i].body.style.zIndex &=~ 100;
}
},
remove: function(){
if(this.Jf.tail) Nv(this.Jf.tail);
if(this.Jf.shadow) Nv(this.Jf.shadow);
this.Ev = null;
this.Wr = null;
this.rW = 0;
this.Rl = null;
this.Qx = null;
this.kO = null;
this.Ju = null;
this.Vr = null;
this.Jf.remove();
this.Jf = null;
if(this.Fq) Nv(this.Fq);
this.Fq = null;
},
onCloseClick: function(){
this.close();
},
hide: function(){
if(this.Vr){
this.Fq.style.visibility = "hidden";
this.Jf.tail.style.visibility = "hidden";
this.Jf.shadow.style.visibility = "hidden";
for(var i=0; i<this.rW; i++){
this.Wr[i].body.style.visibility = "hidden";
}
}
},
visible: function(){
if(this.Vr){
this.Fq.style.visibility = "visible";
this.Jf.tail.style.visibility = "visible";
this.Jf.shadow.style.visibility = "visible";
for(var i=0; i<this.rW; i++){
this.Wr[i].body.style.visibility = "visible";
}
}
},
isAvalable: function(){
return (this.Fq != null);
},
decorate: function(Ii){
if(Ii.border){
this.Jf.top.style.borderColor = Ii.border;
this.Jf.middle.style.borderColor = Ii.border;
this.Jf.bottom.style.borderColor = Ii.border;
}
if(Ii.color){
this.Jf.top.style.backgroundColor = Ii.color;
this.Jf.middle.style.backgroundColor = Ii.color;
this.Jf.bottom.style.backgroundColor = Ii.color;
}
if(Ii.max){
this.Rl = Ii.max.x;
this.Qx = Ii.max.y;
}
},
moveTo: function(a){
Gm(this.Fq, a.x - this.Fq.offsetWidth/2 - s(this.Yh, "left"), a.y - this.Fq.offsetHeight - this.Jf.tail.offsetHeight - s(this.Yh,"top")+1);
Gm(this.Jf.tail, a.x - 50 - s(this.Yh, "left"), a.y - this.Jf.tail.offsetHeight - s(this.Yh, "top"));
Gm(this.Jf.shadow, a.x - 50 - s(this.Yh, "left"), a.y - this.Jf.shadow.offsetHeight - s(this.Yh, "top"));
for(var i=0; i<this.rW; i++){
Gm(this.Wr[i].body, a.x - this.Fq.offsetWidth/2 - s(this.Yh,"left") + this.spaceX, a.y - this.Fq.offsetHeight - this.Jf.tail.offsetHeight - s(this.Yh,"top") + this.spaceY);
}
}
};
function Hg(u,Bn,aN,w,h,x,y,p,c){
var t = Hk(u, Bn, aN, w, h, p, c);
var stl = t.style;
if(x) stl.left = x + "px";
if(y) stl.top = y + "px";
return t;
};
function qF(x,y,w,h,Pm,Ss,Dl,Aw,c,Xa,Nr){
var t = Vc("", Xa ? "relative" : "absolute", x ,y);
var stl = t.style;
stl.fontSize = "0";
if(Pm && Pm>0){
stl.borderTop = Pm + "px " + Nr + " solid";
h -= 1;
}
if(Ss && Ss>0){
stl.borderLeft = Ss + "px " + Nr + " solid";
w -= 1;
}
if(Dl && Dl>0){
stl.borderRight = Dl + "px " + Nr + " solid";
w -= 1;
}
if(Aw && Aw>0){
stl.borderBottom = Aw + "px " + Nr + " solid";
h -=1 ;
}
Uu(t,w,h);
stl.backgroundColor = c;
t.className = "object";
return t;
};
var NTPopupFactor = function(){
this.topleft =Vc('',"absolute", 0, 0);
this.topright =Vc('',"absolute", 0, 0);
this.bottomleft =Vc('',"absolute", 0, 0);
this.bottomright =Vc('',"absolute", 0, 0);
this.top =Vc('',"relative", 0, 0);
this.middle =Vc('',"relative", 0, 0);
this.bottom =Vc('',"relative", 0, 0);
this.tail =Vc('',"absolute", 0, 0);
this.shadow =Vc('',"absolute", 0, 0);
this.close =Vc('',"absolute", 0, 0);
};
NTPopupFactor.prototype.getFactor = function(){
return [this.top, this.middle, this.bottom,this.topleft, this.topright, this.bottomleft, this.bottomright, this.close];
};
NTPopupFactor.prototype.remove = function(){
this.topleft = null;
this.topright = null;
this.bottomleft = null;
this.bottomright = null;
this.top = null;
this.middle = null;
this.bottom = null;
this.tail = null;
this.shadow = null;
this.close = null;
};
var NTEvent = function(){};
NTEvent.observers = [];
NTEvent.add = function(element, name, observer, useCapture){
var element = $(element);
useCapture = useCapture || false;
if (name == 'keypress' && (navigator.appVersion.match(/Konqueror|Safari|KHTML/) || element.attachEvent)){
name = 'keydown';
}
var hundler = function(e){
if(!e){
e=window.event;
}
if(e&&!e.target){
e.target=e.srcElement;
}
observer.call(element,e);
};
this._observeAndCache(element, name, hundler, useCapture);
};
NTEvent._observeAndCache = function(element, name, observer, useCapture) {
if (!this.observers){
this.observers = [];
}
if (element.addEventListener) {
this.observers.push([element, name, observer, useCapture]);
element.addEventListener(name, observer, useCapture);
} else if (element.attachEvent) {
this.observers.push([element, name, observer, useCapture]);
element.attachEvent('on' + name, observer);
}
};
NTEvent.unloadCache = function() {
if (!NTEvent.observers){
return;
}
for (var i = 0; i < NTEvent.observers.length; i++){
NTEvent.stopObserving.apply(this, NTEvent.observers[i]);
NTEvent.observers[i][0] = null;
}
NTEvent.observers = false;
};
NTEvent.remove = function(element, name){
if (!NTEvent.observers){
return;
}
var newObservers = [];
for (var i = 0; i < NTEvent.observers.length; i++){
if(NTEvent.observers[i][0] == element && (!name || (name && NTEvent.observers[i][1] == name))){
NTEvent.stopObserving.apply(this, NTEvent.observers[i]);
NTEvent.observers[i][0] = null;
}else{
newObservers[newObservers.length] = NTEvent.observers[i];
}
}
NTEvent.observers = newObservers;
};
NTEvent.stopObserving = function(element, name, observer, useCapture) {
var element = $(element);
useCapture = useCapture || false;
if (name == 'keypress' && (navigator.appVersion.match(/Konqueror|Safari|KHTML/) || element.detachEvent)){
name = 'keydown';
}
if (element.removeEventListener) {
element.removeEventListener(name, observer, useCapture);
} else if (element.detachEvent) {
element.detachEvent('on' + name, observer);
}
}
NTEvent.add(window, 'unload', NTEvent.unloadCache);
var NTUserAgent = function(){}
NTUserAgent.type="";
NTUserAgent.version="";
NTUserAgent.os="";
NTUserAgent.subtype="";
NTUserAgent.minorVersion="";
(function(){
var type=0;
var version=0;
var subtype=null;
var os=null;
var ua=navigator.userAgent.toLowerCase();
if(ua.indexOf("opera")!=-1){
type=4;
version=9;
if(ua.indexOf("opera/7")!=-1||ua.indexOf("opera 7")!=-1){
version=7;
}else if(ua.indexOf("opera/8")!=-1||ua.indexOf("opera 8")!=-1){
version=8;
}else if(ua.indexOf("opera/9")!=-1||ua.indexOf("opera 9")!=-1){
version=9;
var uaStr = new String(ua);
NTUserAgent.minorVersion = uaStr.substring(ua.indexOf("opera") + "opera".length + 3,ua.indexOf("opera") + "opera".length + 5);
if(NTUserAgent.minorVersion.substring(1) == " "){
NTUserAgent.minorVersion = NTUserAgent.minorVersion.substring(0,1) + "0";
}
}
}else if(ua.indexOf("msie")!=-1&&document.all){
type=1;
version=6;
if(ua.indexOf("msie 5")!=-1){
version=5;
}
}else if(ua.indexOf("safari")!=-1){
type=3;
}else if(ua.indexOf("mozilla")!=-1){
type=2;
if(ua.indexOf("firefox")!=-1){
subtype=1;
version=1.5;
if(ua.indexOf("firefox/1.0")!=-1){
version=1.0;
}
}else if(ua.indexOf("netscape")!=-1){
subtype=2;
}else if(ua.indexOf("seamonkey")!=-1){
subtype=4;
}else{
subtype=3;
version=1.8;
if(ua.indexOf("rv:1.7")!=-1){
version=1.7;
}
}
}
if(ua.indexOf("x11;")!=-1){
os=1;
}else if(ua.indexOf("macintosh")!=-1){
os=2;
}
NTUserAgent.type=type;
NTUserAgent.version=version;
NTUserAgent.os=os;
NTUserAgent.subtype=subtype;
})();
var NTMapCtrl = function(a){
this.src = a;
this.moveX = s(a, "left");
this.moveY = s(a, "top");
this.reachX = 0;
this.reachY = 0;
this.timeoutId = "";
this.endFunction;
};
NTMapCtrl.prototype.autoScrollTo=function(x,y,func){
if(x!=null) this.reachX = Math.round(x);
if(y!=null) this.reachY = Math.round(y);
if(func!=null){
this.endFunction = func;
}
var speed = (NTUserAgent.type==4 || NTUserAgent.type==2)?2:3;
var x1 = new Number(s(this.src,"left"));
var x2 = new Number(this.reachX)-x1;
var x3 = Math.abs(x2/speed)<1? (x2>0)?1:-1 : x2/speed;
var y1 = new Number(s(this.src, "top"));
var y2 = new Number(this.reachY)-y1;
var y3 = Math.abs(y2/speed)<1? (y2>0)?1:-1 : y2/speed;
if(Math.abs(x2) <= 1){
this.src.style.left = this.reachX + "px";
}else{
this.src.style.left = Math.round(x1 + x3)+ "px";
}
if(Math.abs(y2) <= 1){
this.src.style.top = this.reachY + "px";
}else{
this.src.style.top = Math.ceil(y1 + y3) + "px";
}
if(s(this.src,"left")==this.reachX && s(this.src,"top")==this.reachY){
clearTimeout(this.timeoutId);
if(this.endFunction) this.endFunction();
return false;
}
this.timeoutId = this.setTimeout("this.autoScrollTo()",10);
};
NTMapCtrl.prototype.autoMove = function(){
};
var NTMapScaleCtrl = function(a){
this.src = a;
this.startPos = new NTSize(s(a, "left"), s(a, "top"));
this.startSiz = new NTSize(a.offsetWidth, a.offsetHeight);
var stl = a.style;
stl.width = this.startSiz.x + "px";
stl.height = this.startSiz.y + "px";
this.endPos = null;
this.endSiz = null;
this.alpha = 100;
this.timeoutId = "";
this.endFunction;
};
NTMapScaleCtrl.prototype = {
autoChangeScale: function(a,c,z,func){
var speed = NTUserAgent.type==1?5:3;
if(a != null && c != null && z != null){
var Zx = new NTSize(NTGeoUtil.getLonFactor(a) , NTGeoUtil.getLatFactor(a));
a.setScale(c);
a.setZoom(z);
var Bh = new NTSize(NTGeoUtil.getLonFactor(a) , NTGeoUtil.getLatFactor(a));
var Rn = Zx.x/Bh.x;
var Of = Zx.y/Bh.y;
if(Rn > 5 || Rn < 0.2){
if(this.endFunction) this.endFunction();
return;
}
this.endSiz = new NTSize(Math.floor(this.startSiz.x * Rn),Math.floor(this.startSiz.y * Of));
this.endPos = new NTSize(this.startPos.x - (Math.floor(this.startSiz.x * Rn)-this.startSiz.x)/2 , this.startPos.y - (Math.floor(this.startSiz.y * Of)-this.startSiz.y)/2);
}
if(func!=null){
this.endFunction = func;
}
var x1 = new Number(s(this.src, "left"));
var x2 = new Number(this.endPos.x)-x1;
var x3 = Math.abs(x2/speed)<1? (x2>0)?1:-1 : x2 / speed;
var y1 = new Number(s(this.src, "top"));
var y2 = new Number(this.endPos.y)-y1;
var y3 = Math.abs(y2/speed)<1? (y2>0)?1:-1 : y2/speed;
var w1 = new Number(s(this.src, "width"));
var w2 = new Number(this.endSiz.x) - this.src.offsetWidth;
var w3 = Math.abs(w2/speed)<1? (w2>0)?1:-1 : w2/speed;
var h1 = new Number(s(this.src, "height"));
var h2 = new Number(this.endSiz.y) - this.src.offsetHeight;
var h3 = Math.abs(h2/speed)<1? (h2>0)?1:-1 : h2/speed;
var stl = this.src.style;
if(Math.abs(x2) <= 1){
stl.left = this.endPos.x + "px";
}else{
stl.left = Math.round(x1 + x3)+ "px";
}
if(Math.abs(y2) <= 1){
stl.top = this.endPos.y + "px";
}else{
stl.top = Math.ceil(y1 + y3) + "px";
}
if(Math.abs(w2) <= 1){
stl.width = this.endSiz.x + "px";
}else{
stl.width = Math.round(w1 + w3)+ "px";
}
if(Math.abs(h2) <= 1){
stl.height = this.endSiz.y + "px";
}else{
stl.height = Math.ceil(h1 + h3) + "px";
}
this.alpha -= 3;
setAlpha(this.src, this.alpha);
if(s(this.src, "left")==this.endPos.x && s(this.src, "top")==this.endPos.y){
this.stop();
return;
}
this.timeoutId = this.setTimeout("this.autoChangeScale()",10);
},
iswork: function(){
return (this.timeoutId!="");
},
stop: function(){
clearTimeout(this.timeoutId);
this.timeoutId = "";
if(this.endFunction) this.endFunction();
}
}
var NTResizer = function(a){
this.src = a;
this.reachW = 0;
this.reachH = 0;
this.timeoutId = "";
this.endFunction;
};
NTResizer.prototype.autoResize=function(initw,inith,endw,endh,func){
var stl = this.src.style;
if(initw) stl.width = initw + "px";
if(inith) stl.height = inith + "px";
if(endw) this.reachW = Math.round(endw);
if(endw) this.reachH = Math.round(endh);
if(func!=null){
this.endFunction = func;
}
var x1 = new Number(s(this.src,"width"));
var x2 = new Number(this.reachW)-x1;
var x3 = Math.abs(x2/5)<1? (x2>0)?1:-1 : x2/5;
var y1 = new Number(s(this.src,"height"));
var y2 = new Number(this.reachH)-y1;
var y3 = Math.abs(y2/5)<1? (y2>0)?1:-1 : y2/5;
if(Math.abs(x2) <= 1){
stl.width = this.reachW + "px";
}else{
stl.width = Math.round(x1 + x3)+ "px";
}
if(Math.abs(y2) <= 1){
stl.height = this.reachH + "px";
}else{
stl.height = Math.ceil(y1 + y3) + "px";
}
if(s(this.src,"width")==this.reachW && s(this.src,"height")==this.reachH){
clearTimeout(this.timeoutId);
if(this.endFunction) this.endFunction();
return false;
}
this.timeoutId = this.setTimeout("this.autoResize()",10);
};
/* Copyright (C) 2006 NAVITIME JAPAN CO.,LTD. All Rights Reserved. */
var NTMapIcon = function(a,b,c,d) {
this.Ev=a;
this.Fg = b;
this.Fz = d;
this.Sl = c;
this.eP;
this.Qr;
this.Cs;
this.Ly = new Array();
this.Cp = 7;
this.Initialize();
};
NTMapIcon.prototype = {
Initialize: function(){
this.eP = Uc(this.Fg.src, this.Fg.width,this.Fg.height);
this.eP.className = (this.Sl !=null && this.Sl != "") ? "object" : "static";
this.eP.style.visibility = "hidden";
if(this.Fz){
this.Qr = Uc(this.Fz.src, this.Fz.width,this.Fz.height);
this.Qr.className = "static";
this.Qr.style.visibility = "hidden";
}
},
addDocument: function(a,b){
this._parent = a;
this._zindex = b;
this.eP.style.zIndex=this._zindex;
this._parent.appendChild(this.eP);
this.lR = document.createElement("div");
this.lR.className="object";
this.lR.style.position = "absolute";
this.lR.style.width = this.eP.offsetWidth+"px";
this.lR.style.height = this.eP.offsetHeight+"px";
this.lR.style.zIndex = 440;
this._parent.appendChild(this.lR);
for(var e = 0; e < this.Ly.length; e++){
NTEvent.add(this.lR, this.Ly[e].type, this.Ly[e].func);
}
if(this.Qr){
this.Qr.style.zIndex=this._zindex-200;
this._parent.appendChild(this.Qr);
}
},
addEvent: function(a,b){
this.Ly.push({type:a, func:b});
},
removeEvent: function(){
},
getEvent: function(a){
if(a!=null){
for(e in this.Ly){
if(e.type == a) return e.func;
}
return function(){};
}
return this.Ly;
},
getId: function(){return this.Sl;},
getImage: function(){return this.eP;},
getCather: function(){return this.lR;},
getShadow: function(){return this.Qr;},
getPos: function(){return this.Ev;},
remove: function(){
var len = this._parent.childNodes.length;
for(var i=0; i<len; i++){
if(this._parent.childNodes[i]==this.eP){
this._parent.removeChild(this._parent.childNodes[i]);
}
if(this.Qr != null && this._parent.childNodes[i]==this.Qr){
this._parent.removeChild(this._parent.childNodes[i]);
}
}
if (this.lR) {
this._parent.removeChild(this.lR);
}
this.eP = null;
this.Qr = null;
},
rebuild: function(){
this.Initialize();
this.addDocument(this._parent,this._zindex);
},
hide: function(){
if(!this.eP) return;
this.eP.style.visibility = "hidden";
if(this.Qr) this.Qr.style.visibility = "hidden";
},
visible: function(){
if(!this.eP) return;
this.eP.style.visibility = "visible";
if(this.Qr) this.Qr.style.visibility = "visible";
},
setGroup: function(a){
this.Cs = a;
},
getGroup: function(){
return this.Cs;
},
setIconPosition: function(a){
this.Cp = a;
},
getIconPosition: function(){
return this.Cp;
}
}
/* Copyright (C) 2006 NAVITIME JAPAN CO.,LTD. All Rights Reserved. */
var NTImage = function(a,b,c) {
this.src=a;
this.width=b;
this.height=c;
};
NTImage.prototype.getImage = function(){
return Fy(this.src,this.width,this.height);
}
/* Copyright (C) 2006 NAVITIME JAPAN CO.,LTD. All Rights Reserved. */
var NTGeoUtil = function() {};
NTGeoUtil.JP = function(a){
if(a.getLongitude() > 441230691 && a.getLatitude() > 86737111 && a.getLongitude() < 525430675 && a.getLatitude() < 165297104){
return true;
}
return false;
}
NTGeoUtil.getLonFactor = function(a){
var b = new Array(200000,33333.3,2727.27,818.181,163.636);
return b[a.getScale()]/a.getZoom();
};
NTGeoUtil.getLatFactor = function(a){
if(NTGeoUtil.JP(a.getPos())){
var b = new Array(160000,26666.6,2222.22,666.666,133.333);
return b[a.getScale()]/a.getZoom();
}
var wmesh = 0;
wmesh = this.getWorldMesh(a.getPos().getLatitude());
return this.getCurvature(a.getScale(),wmesh)/a.getZoom();
};
NTGeoUtil.pixel2LonLat = function(size,status){
var moveX,x1,x2,x2_1,x2_2;
var moveY,y1,y2,y2_1,y2_2;
if(status.getAngle() == 0){
moveX = size.x;
}else{
if(status.getAngle() < 90){
x1 = size.y; x2 = -size.x;
}else if(status.getAngle() < 180){
x1 = -size.x; x2 = -size.y;
}else if(status.getAngle() < 270){
x1 = -size.y; x2 = size.x;
}else{
x1 = size.x; x2 = size.y;
}
r = (status.getAngle() % 90) * (3.14/180);
x2_1 = x1 * Math.tan(r);
x2_2 = x2 - x2_1;
moveX = -Math.round(x2_2 * Math.cos(r) );
}
var lon = Math.round(moveX * this.getLonFactor(status));
if(status.getAngle() == 0){
moveY = size.y;
}else{
if(status.getAngle() < 90){
y1 = size.y; y2 = -size.x;
}else if(status.getAngle() < 180){
y1 = -size.x; y2 = -size.y;
}else if(status.getAngle() < 270){
y1 = -size.y; y2 = size.x;
}else{
y1 = size.x; y2 = size.y;
}
r = (status.getAngle() % 90) * (3.14/180);
y2_1 = y1 * Math.tan(r);
y2_2 = y2 - y2_1;
moveY = Math.round(y1 / Math.cos(r) + (y2_2 * Math.sin(r)) );
}
var lat = Math.round(moveY * this.getLatFactor(status));
return new NTLatLng(new Number(status.getPos().getLatitude()) - new Number(lat), new Number(status.getPos().getLongitude()) + new Number(lon));
};
NTGeoUtil.LonLat2Pixel = function(a,b){
var s = b.getSize();
var p = b.getPos();
var xx = this.pixel2LonLat(new NTSize(s.x,s.y/2),b).getLongitude()-p.getLongitude();
var yx = a.getLongitude() - p.getLongitude();
var zx = Math.round((yx/xx) * s.x + (s.x/2));
var xy = p.getLatitude() - this.pixel2LonLat(new NTSize(s.x/2,s.y),b).getLatitude();
var yy = p.getLatitude() - a.getLatitude();
var zy = Math.round((yy/xy) * s.y + (s.y/2));
return new NTSize(zx,zy);
};
NTGeoUtil.getWorldMesh = function(a){
/*
for(var i=169; i<=270; i++){
if((81600000 + (i-168) * 2400000) > a){
return i;
}
}
return -1;
*/
return Math.round((a/3600000) * 3/2) + 134;
};
NTGeoUtil.CURVATURE = [0,0,0,0,0,0,0,0,1220,1220,1220,1220,1159,1098,1035,961,895,833,775,720,659,610,565,542,520,499,482,466,451,438,426,412,399,389,377,366,357,349,342,336,329,323,317,311,305,299,293,287,281,275,265,261,257,254,250,248,245,242,239,235,232,229,226,222,218,216,214,211,209,206,205,204,201,200,199,198,195,194,193,192,189,187,185,184,182,181,178,176,173,171,168,167,166,165,163,162,161,160,159,157,156,155,153,153,153,153,153,153,151,151,151,151,151,151,151,149,149,149,149,149,149,149,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,148,148,148,148,148,148,149,149,149,149,149,149,150,150,150,150,150,150,151,151,151,151,151,151,153,153,153,153,153,153,155,156,157,159,160,161,162,163,165,166,167,168,171,173,176,178,181,182,184,185,187,189,192,193,194,195,198,199,200,201,204,205,206,209,211,214,216,218,222,226,229,232,235,239,242,245,248,250,254,257,261,265,275,281,287,293,299,305,311,317,323,329,336,342,349,357,366,377,389,399,412,426,438,451,466,482,499,520,542,565,610,659,720,775,833,895,961,1035,1098,1159,1220,1220,1220,1220];
NTGeoUtil.getCurvature = function(a,b){
var c = Math.floor(this.CURVATURE[b]/4);
c = a<2?Math.floor(c/3):c;
switch(a){
case 0:
return 2400000/c;
case 1:
return 400000/c;
case 2:
return 100000/c;
case 3:
return 30000/c;
case 4:
return 6000/c;
default:
return 0;
}
};
/* Copyright (C) 2006 NAVITIME JAPAN CO.,LTD. All Rights Reserved. */
var NTScale = function() {
};
NTScale.getScale = function(a){
};
/* Copyright (C) 2006 NAVITIME JAPAN CO.,LTD. All Rights Reserved. */
var NTUrl = function() {};
NTUrl.Fq = "http://www.navitime.co.jp/mapimage.jsp";
NTUrl.create = function(a,b){
var c=this.Fq;
if(b!=null&&b.length>0){
c=b;
}
c += "?MapCenterX=" + a.getPos().getLongitude() + 
"&MapCenterY=" + a.getPos().getLatitude() + 
"&MapWidth=" + a.getSize().x + 
"&MapHeight=" + a.getSize().y + 
"&MapScale=" + a.getScale() + 
"&MapZoom=" + a.getZoom() + 
"&MapAngle=" + a.getAngle() + 
"&DrawTarget=0&DrawDirection=0&DrawScale=0" +
"&Palette=" + a.getPalette();
for (var i = 0; i < a.getParam().length; i++) {
var o = a.getParam()[i];
if(o.value == null) continue;
c += "&" + o.key + "=" + o.value;
}
var route = a.getRoute();
var rid = 0;
var iconid = 0;
var cache = new Array();
if(route != null){
for(var i=0; i<route.length; i++){
if(!route[i].isAvailable) continue;
var oi=NTUrlUtil.isExist(cache,route[i].orv);
var di=NTUrlUtil.isExist(cache,route[i].dnv);
if(oi!=-1){
route[i].setOrvId(oi)
cache[oi].icon = NTRouteIcon.OTHER;
}else{
if(route[i].sImg == null){
cache[cache.length] = new NTRouteIcon(cache.length,route[i].orv,NTRouteIcon.START,route[i].orvtf,"");
}else{
cache[cache.length] = new NTRouteIcon(cache.length,route[i].orv,NTRouteIcon.USER_DEF,route[i].orvtf,route[i].sImg);
}
route[i].setOrvId(cache.length-1);
}
if(di!=-1){
route[i].setDnvId(di);
cache[di].icon = NTRouteIcon.OTHER;
}else{
if(route[i].gImg == null){
cache[cache.length] = new NTRouteIcon(cache.length,route[i].dnv,NTRouteIcon.END,route[i].dnvtf,"");
}else{
cache[cache.length] = new NTRouteIcon(cache.length,route[i].dnv,NTRouteIcon.USER_DEF,route[i].dnvtf,route[i].gImg);
}
route[i].setDnvId(cache.length-1);
}
}
for(var i=0; i<cache.length; i++){
c += NTUrlUtil.getIconUrl(cache[i]);
}
for(var i=0; i<route.length; i++){
if(!route[i].isAvailable) continue;
c += NTUrlUtil.getRouteUrl(route[i],i);
}
for(var i=0; i<route.length; i++){
if(route[i].tollroad == null || route[i].tollroad.length == 0) continue;
if(route[i].tollroad == 8 || route[i].tollroad == 16 || route[i].tollroad == 32){
c += "&Tollroad=" + route[i].tollroad; 
break;
}else{
c += "&Tollroad=" + 0; 
break;
}
}
c+= "&rnd=" + Math.ceil(Math.random(10000)*10000);
}
return c;
};
var NTUrlUtil = function(){};
NTUrlUtil.isExist=function(a,b){
for(var c=0; c<a.length; c++){
if(a[c].pos.getLongitude() == b.getLongitude() && a[c].pos.getLatitude() == b.getLatitude()){
return c;
}
}
return -1;
};
NTUrlUtil.getIconUrl=function(a){
var r = "&Icon"+a.id + "=" + a.icon + "," + a.pos.getLongitude() + "," + a.pos.getLatitude() + ",," + a.iconUrl + ",1,0,4,";
r += a.toll==null?"-1":a.toll;
return r;
};
NTUrlUtil.getRouteUrl=function(a,b){
var r = "&Route"+ b + "=" + a.oid + ",,," + a.did + ",,,,,,," + a.method + ",," + a.color.r + "," + a.color.g + "," + a.color.b;
return r;
};
var NTRouteIcon = function(a,b,c,d,e){
this.id=a;
this.pos=b;
this.icon=c;
this.toll=d;
this.iconUrl=e;
};
NTRouteIcon.START = "10001";
NTRouteIcon.END = "10002";
NTRouteIcon.OTHER = "10003";
NTRouteIcon.USER_DEF = "0";
/* Copyright (C) 2006 NAVITIME JAPAN CO.,LTD. All Rights Reserved. */
var NTMover = function(target) {
this.srcElement = target.src;
this.moveElement= target.move;
this.downTarget;
this.mouseDownPos;
this.defaultPos = new NTSize(s(target.move,"left"),s(target.move, "top"));
this.isMouseDown=false;
this.differencialX;
this.differencialY;
this.movedX;
this.movedY;
this.dummy = Vc('',"absolute",0,0);
this.minPos = null;
this.maxPos = null;
};
NTMover.prototype.setAvailableArea = function(a,b){
this.minPos = a;
this.maxPos = b;
};
NTMover.prototype.onMouseDown = function(e){
if(e.button!=0 && e.button!=1){
CancelBubble(e);
return false;
}
if(this.srcElement.setCapture) this.srcElement.setCapture();
this.differencialX = e.clientX - Pe(e);
this.differencialY = e.clientY - By(e);
this.defaultPos = new NTSize(s(this.moveElement, "left"),s(this.moveElement, "top"));
this.mouseDownPos = new NTSize(Pe(e), By(e));
this.isMouseDown = true;
this.movedX = 0;
this.movedY = 0;
CancelBubble(e);
};
NTMover.prototype.onMouseMove = function(e){
var stl = this.moveElement.style;
if(this.isMouseDown){
if(NTUserAgent.type!=1 && NTUserAgent.version!=5){
stl.cursor = "move";
}
var x,y;
x=e.clientX + this.defaultPos.x - this.mouseDownPos.x - this.differencialX;
y=e.clientY + this.defaultPos.y - this.mouseDownPos.y - this.differencialY;
if(this.minPos !=null){
if(this.minPos.x >= x){
stl.left = this.minPos.x + "px";
this.movedX = this.minPos.x-this.defaultPos.x;
}else if(this.maxPos.x < x){
stl.left = this.maxPos.x + "px";
this.movedX = this.maxPos.x-this.defaultPos.x;
}else{
stl.left = x + "px";
this.movedX = x-this.defaultPos.x;
}
}else{
stl.left = x + "px";
this.movedX = x-this.defaultPos.x;
}
if(this.maxPos != null){
if(this.minPos.y > y){
stl.top = this.minPos.y + "px";
this.movedY = this.minPos.y-this.defaultPos.y;
}else if(this.maxPos.y < y){
stl.top = this.maxPos.y + "px";
this.movedY = this.maxPos.y-this.defaultPos.y;
}else{
stl.top = y + "px";
this.movedY = y-this.defaultPos.y;
}
}else{
stl.top = y + "px";
this.movedY = y-this.defaultPos.y;
}
}else{
CancelBubble(e);
}
};
NTMover.prototype.onMouseUp = function(e){
if(e.button!=0&&e.button!=1||this.isMouseDown==false){
CancelBubble(e);
return false;
}
this.mouseDownPos = null;
this.isMouseDown = false;
if(this.dummy.setCapture) this.dummy.setCapture();
if(this.movedX == 0 && this.movedY == 0){
return false;
}
if(NTUserAgent.type!=1 && NTUserAgent.version!=5){
this.srcElement.style.cursor = "pointer";
}
this.defaultPos = new NTSize(s(this.srcElement, "left"),s(this.srcElement, "top"));
return new NTSize(-this.movedX,-this.movedY);
};
/* Copyright (C) 2006 NAVITIME JAPAN CO.,LTD. All Rights Reserved. */
var NTRoute = function(a,b,c,d,e,f,g){
this.orv = a;
this.dnv = b;
this.color = (c==null) ? NTColor.DEFAULT : c;
this.method = d;
this.orvtf = e;
this.dnvtf = f;
this.tollroad = g;
this.oid;
this.did;
this.isAvailable = true;
this.sImg = null;
this.gImg = null;
};
NTRoute.prototype.setColor = function(a){
this.color = a;
};
NTRoute.prototype.setImage = function(a,b){
this.sImg = a;
this.gImg = b;
};
NTRoute.prototype.setOrvId = function(a){
this.oid=a;
};
NTRoute.prototype.setDnvId = function(a){
this.did=a;
};
NTRoute.prototype.remove = function(){
this.isAvailable = false;
}
EscapeUTF7=function(str){
var B="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),
E=function(s){
var c=s.charCodeAt(0);
return B[c>>10]+B[c>>4&63]+B[(c&15)<<2|(c=s.charCodeAt(1))>>14]+(0<=c?B[c>>8&63]+B[c>>2&63]+B[(c&3)<<4|(c=s.charCodeAt(2))>>12]+(0<=c?B[c>>6&63]+B[c&63]:""):"")
},
re=new RegExp;re.compile("[^+]{1,3}","g");
return (str+"g").replace(/[^*+.-9A-Z_a-z-]+[*+.-9A-Z_a-z-]|[+]/g,function(s){
if("+"==s)return "+-";
var l=s.length-1,w=s.charAt(l);
return "+"+s.substring(0,l).replace(re,E)+("+"==w?"-+-":"*"==w||"."==w||"_"==w?w:"-"+w)
}).slice(0,-1)
};
UnescapeUTF7=function(str){
var i=0,B={};
while(i<64)B["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(i)]=i++;
return str.replace(RegExp("[+][+/-9A-Za-z]*-?","g"),function(s){
if("+-"==s)return "+";
var b=B[s.charAt(1)],c,i=1,t="";
while(0<=b){
if((c=i&7)<6)c=c<3?b<<10|B[s.charAt(++i)]<<4|(b=B[s.charAt(++i)])>>2:(b&3)<<14|B[s.charAt(++i)]<<8|B[s.charAt(++i)]<<2|(b=B[s.charAt(++i)])>>4;
else{c=(b&15)<<12|B[s.charAt(++i)]<<6|B[s.charAt(++i)];b=B[s.charAt(++i)]}
if(c)t+=String.fromCharCode(c)
}
return t
})
};
var NTMap = function(a,b) {
this.Cq = false;
this.Ut = false;
this.lD = $(a);
this.Sl = a;
var s;
this.Ll = new NTMapStatus(NTLatLng.parse(this.lD.innerHTML),NTSize.parse(this.lD),0,3,3);
this.lD.innerHTML="";
s = this.lD.style
s.textAlign="left";
s.overflow="hidden";
s.position="relative";
this.Vb = Vc("MovingContainer","relative", "0px", "0px");
s = this.Vb.style;
s.position = "absolute";
s.zIndex = 12;
this.Vb.className = "container";
this.lD.appendChild(this.Vb);
this.Ox = Vc("IconContainer","absolute","0px","0px");
this.Ox.style.zIndex = 100;
this.Ox.className = "container";
this.Vb.appendChild(this.Ox);
this.wA = new Array();
this.Jl = 0;
this.Hv = 6;
this.Vv = (b && b.load=="manual")?false:true;
this.Kt = (b && b.mouse!=null)?b.mouse:2;
Ls.src = (b.image||"item1.2.png");
if(b && b.url) this.Uq = b.url;
this.Bc = false;
this.lS = false;
this.Gh = null;
this.Bo = new Array();
this.Bl = new Array();
if(b && b.popup!="multi"){
this.yF = new NTPopup(this.Ll.getPos());
this.yF.createDocument(this.Vb);
this.Bl[0] = this.yF;
}
this.oB= eventHandler.apply(this, ["Dy"]);
this.gH= eventHandler.apply(this, ["Uy"]);
this.iY= eventHandler.apply(this, ["Pr"]);
this.Kk= eventHandler.apply(this, ["Vo"]);
this.Sg= eventHandler.apply(this, ["Oa"]);
this.Rv= eventHandler.apply(this, ["Jz"]);
this.Lg= eventHandler.apply(this, ["Nk"]);
this.fE= eventHandler.apply(this, ["Tt"]);
this.Wg= eventHandler.apply(this, ["Oj"]);
this.Hd= eventHandler.apply(this, ["Ib"]);
this.Lt= methodHandler.apply(this, ["Pi"]);
this.Ow= methodHandler.apply(this, ["setZoom"]);
this.Zw= eventHandler.apply(this, ["Ba"]);
this.Zi= eventHandler.apply(this, ["Op"]);
this.Pv= eventHandler.apply(this, ["Ab"]);
NTEvent.add(window, 'load', this.oB);
NTEvent.add(window, 'unload', this.gH);
this.Os = b.copyrightInfo ? b.copyrightInfo : null;
this.Pz= new NTMap.El();
if (b.palette) {
this.setPalette(b.palette);
}
if (b.zoom) {
var zoom = b.zoom.split(",");
this.setZoom(new Number(zoom[0]), new Number(zoom[1]));
}
if (b.param) {
for (var p in b.param) {
this.addParam(p, b.param[p]);
}
}
this.Qn = (b.beforeOnLoad != undefined && b.beforeOnLoad == true);
if (this.Qn) {
this.Ck = new NTMover({src:this.lD, move:this.Vb});
this.Ck.downTarget = this.lD;
}
if(this.Vv && this.Qn){
this.Cq = true;
this.Ll.setSize(NTSize.parse(this.lD));
Uu(this.Ox, this.Ll.getSize().x, this.Ll.getSize().y);
this.reload();
}
};
NTMap.El=function() {
this.delta = 0;
this.zoomable = true;
this.zoomTool = null;
};
NTMap.El.prototype={
cancel:function() {
this.zoomable = false;
},
set:function(a) {
this.zoomTool = a;
},
add:function(a) {
this.delta += a;
this.zoomable = true;
this.setTimeout("this.changeZoom()", 200);
},
changeZoom:function(){
if (this.delta == 0) {
return;
}
if (this.zoomable && this.zoomTool != null) {
this.zoomable = false;
this.zoomTool.changeZoom(this.delta);
this.delta = 0;
this.zoomable = true;
}
}
};
NTMap.prototype.getId = function() {
return this.Sl;
};
NTMap.prototype.Dy = function(){
this.Ll.setSize(NTSize.parse(this.lD));
Uu(this.Ox, this.Ll.getSize().x, this.Ll.getSize().y);
if(this.center!=null){
Gm(this.center, Math.round(this.Ll.getSize().x/2-this.center.offsetWidth/2), Math.round(this.Ll.getSize().y/2-this.center.offsetHeight/2));
this.center.style.visibility = "visible";
}
if(this.Rt!=null){
this.Rt.style.visibility = "visible";
}
var Lv = this.lD.setCapture?this.lD:window;
if (!this.Qn) {
this.Ck = new NTMover({src:this.lD, move:this.Vb});
this.Ck.downTarget = this.lD;
}
if(this.Kt >= 2){
NTEvent.add(this.lD, 'dblclick',this.Sg);
}else if(this.Kt == 1){
NTEvent.add(this.lD, 'click',this.Sg);
}
if(this.Kt >= 2){
NTEvent.add(this.lD,'mousedown',this.Rv);
NTEvent.add(Lv,'mousemove',this.Lg);
NTEvent.add(Lv,'mouseup',this.fE);
}
if(this.Kt >= 1){
NTEvent.add(this.lD, 'DOMMouseScroll', this.Zw);
NTEvent.add(this.lD, 'mousewheel', this.Zw);
NTEvent.add(Bx,'keypress',this.Zi);
NTEvent.add(this.lD, 'mouseover', this.iY); 
NTEvent.add(this.lD, 'mouseout',this.Kk); 
}
NTEvent.add(window,'mouseout',this.Wg);
NTEvent.add(this.lD,'contextmenu', this.Pv);
this.Cq=true;
var cpid = (this.Os != null && this.Os.id) ? this.Os.id : 'cp';
var tM = Vc(cpid,'absolute');
this.lD.appendChild(tM);
var Nz = tM.style;
Nz.fontSize = '10px';
Nz.color = '#000';
Nz.padding = '1px';
if (this.Os == null) {
tM.innerHTML = UnescapeUTF7(NTGeoUtil.JP(this.Ll.getPos())?Jn:Lb);
Nz.left = "5px";
Nz.top = this.Ll.getSize().y - tM.offsetHeight -3+"px";
}
else {
if (this.Os.text) {
tM.innerHTML = this.Os.text;
}
else {
tM.innerHTML = UnescapeUTF7(NTGeoUtil.JP(this.Ll.getPos())?Jn:Lb);
}
if (!this.Os.right && !this.Os.left) {
Nz.left = "5px";
}
if (!this.Os.top && !this.Os.bottom) {
Nz.top = this.Ll.getSize().y - tM.offsetHeight -3+"px";
}
if (this.Os.left) {
Nz.left = this.Os.left + "px";
}
if (this.Os.right) {
Nz.right = this.Os.right + "px";
}
if (this.Os.top) {
Nz.top = this.Os.top + "px";
}
if (this.Os.bottom) {
Nz.bottom = this.Os.bottom + "px";
}
if (this.Os.height) {
Nz.height = this.Os.height + "px";
}
if (this.Os.width) {
Nz.width = this.Os.width + "px";
}
if (this.Os.textAlign) {
Nz.textAlign = this.Os.textAlign;
}
}
Nz.zIndex = 902;
if(this.Vv && !this.Qn){
this.reload();
}else{
this.Fh=true;
}
};
NTMap.prototype.Uy = function(e){
this.clearMap();
this.wA = null;
this.Bo = null;
this.Bl = null;
Ls = null;
Pp(this.lD);
};
NTMap.prototype.Ab = function(e){
if (Na(e) == 'object' && e.target != this.center) {
return;
}
var size = this.Dm(e);
var a = size.x;
var c = size.y;
a -=this.Ll.getSize().x/2;
c -=this.Ll.getSize().y/2;
var f =new NTSize(a,c);
var pos = e.target == this.center ? this.getPos() : NTGeoUtil.pixel2LonLat(f,this.Ll);
size = e.target == this.center ? new NTSize(this.lD.offsetWidth / 2, this.lD.offsetHeight / 2) : size;
E[3](pos,size,this);
CancelBubble(e);
return false;
};
NTMap.prototype.Pr = function(e){
if(NTUserAgent.type==1 && NTUserAgent.version==5) return false;
this.Vb.style.cursor = "pointer";
};
NTMap.prototype.Vo = function(e){
if (this.Iy) {
var a = this.Dm(e);
if(NTUserAgent.type==2||NTUserAgent.type==3){
var posX = e.pageX;
var posY = e.pageY;
for (var p=this.lD; p; p=p.offsetParent) {
posX -= p.offsetLeft;
posY -= p.offsetTop;
}
a = new NTSize(posX, posY);
}
var x = a.x;
var y = a.y;
if (x <= 5 || y <= 5 || x >= this.Ll.getSize().x - 5 || y >= this.Ll.getSize().y - 5) {
this.closeContext();
}
}
if(NTUserAgent.type==1 && NTUserAgent.version==5) return false;
this.Vb.style.cursor = "default";
};
NTMap.prototype.Oa = function(e){
if(!this.Fh) return false;
var Iq = e.target;
while(Iq.parentNode!=null){
if(Iq.className=="object") return;
Iq = Iq.parentNode;
}
if(NTUserAgent.type!=1 && NTUserAgent.version!=5){
this.Vb.style.cursor = "wait";
}
var size = this.Dm(e);
var a = size.x;
var c = size.y;
a -=this.Ll.getSize().x/2;
c -=this.Ll.getSize().y/2;
CancelBubble(e);
var f=new NTSize(a,c);
E[1](NTGeoUtil.pixel2LonLat(f,this.Ll),this);
this.moveTo(NTGeoUtil.pixel2LonLat(f,this.Ll));
};
NTMap.prototype.Jz = function(e){
var contextMenu = false;
for (var ele=e.target; ele; ele=ele.parentNode) {
if (ele == this.Iy) {
contextMenu = true;
}
}
if (!contextMenu) {
this.closeContext();
}
if(!this.Fh) return false;
if(e.target.className=="object"){
return;
}else if(e.target.className=="innerPopup"){
return;
}
this.Ck.onMouseDown(e);
};
NTMap.prototype.Nk = function(e){
if(!this.Fh) return false;
if(e.target.className=="object"){
return;
}else if(e.target.className=="innerPopup"){
return;
}
this.Ck.onMouseMove(e);
};
NTMap.prototype.Tt = function(e){
if(!this.Fh) return false;
if(e.target.className=="object"){
return;
}else if(e.target.className=="innerPopup"){
return;
}
var a = this.Ck.onMouseUp(e);
if(a){
this.Ll.setPos(NTGeoUtil.pixel2LonLat(a,this.Ll));
E[1](this.Ll.getPos(),this);
this.reload();
}
CancelBubble(e);
};
NTMap.prototype.Dm = function(e){
var a = Pe(e);
var c = By(e);
if(Na(e) == "static"){
if(NTUserAgent.type==2){
a += e.target.x;
c += e.target.y;
var p=e.target;
while(true){
if(p.className.indexOf("container")!=-1) break;
a += s(p,"left");
c += s(p,"top");
p = p.parentNode;
}
a += s(this.Vb, "left");
c += s(this.Vb, "top");
}
if(NTUserAgent.type==4){
var p=e.target;
while(true){
if(p.className.indexOf("container")!=-1) break;
a += s(p,"left");
c += s(p,"top");
p = p.parentNode;
}
a += s(this.Vb, "left");
c += s(this.Vb, "top");
}
}else{
if(NTUserAgent.type==2 || NTUserAgent.type==3){
if(e.target == this.Ox){
a += s(this.Vb, "left");
}else{
a -= s(this.Vb, "left");
}
}
if(NTUserAgent.type==2 || NTUserAgent.type==3){
if(e.target == this.Ox){
c += s(this.Vb, "top");
}else{
c -= s(this.Vb, "top");
}
}
}
return new NTSize(a,c);
};
NTMap.prototype.Ba = function(e){
if(this.Gh==null || !this.Fh){
CancelBubble(e);
return;
}
var delta = 0;
if (e.wheelDelta) {
delta = e.wheelDelta/120;
if (NTUserAgent.type==4 && (NTUserAgent.version<9 || (NTUserAgent.version == 9 && new Number(NTUserAgent.minorVersion) < 20))) delta = -delta;
} else if (e.detail) {
delta = -e.detail/3;
}
this.Pz.cancel();
this.Pz.add(delta);
CancelBubble(e);
};
NTMap.prototype.Op = function(e){
this.closeContext();
if(e.target.tagName == "INPUT" || e.target.tagName == "TEXTAREA") return;
if(e.target != Bx)
var lon = this.Ll.getPos().getLongitude();
var lat = this.Ll.getPos().getLatitude();
if(e.keyCode==37){
E[1](NTGeoUtil.pixel2LonLat(new NTSize(-this.Ll.getSize().x/2,0), this.Ll),this);
this.moveTo(NTGeoUtil.pixel2LonLat(new NTSize(-this.Ll.getSize().x/2,0), this.Ll));
CancelBubble(e);
}
if(e.keyCode==38){
E[1](NTGeoUtil.pixel2LonLat(new NTSize(0,-this.Ll.getSize().y/2), this.Ll),this);
this.moveTo(NTGeoUtil.pixel2LonLat(new NTSize(0,-this.Ll.getSize().y/2), this.Ll));
CancelBubble(e);
}
if(e.keyCode==39){
E[1](NTGeoUtil.pixel2LonLat(new NTSize(this.Ll.getSize().x/2,0), this.Ll),this)
this.moveTo(NTGeoUtil.pixel2LonLat(new NTSize(this.Ll.getSize().x/2,0), this.Ll));
CancelBubble(e);
}
if(e.keyCode==40){
E[1](NTGeoUtil.pixel2LonLat(new NTSize(0,this.Ll.getSize().y/2), this.Ll),this);
this.moveTo(NTGeoUtil.pixel2LonLat(new NTSize(0,this.Ll.getSize().y/2), this.Ll));
CancelBubble(e);
}
if(e.keyCode==187 || e.keyCode==107 || e.charCode == 43){
if(!this.Gh) return;
this.Gh.onMinusClick();
CancelBubble(e);
}
if(e.keyCode==189 || e.keyCode==109 || e.charCode == 45 || e.charCode == 61){
if(!this.Gh) return;
this.Gh.onPlusClick();
CancelBubble(e);
}
};
NTMap.prototype.Ib = function(e){
/* kamitsubo
if (this.Ck.isMouseDown) {
return;
}
*/
if(this.center!=null){
Gm(this.center, Math.round(this.Ll.getSize().x/2-this.center.offsetWidth/2), Math.round(this.Ll.getSize().y/2-this.center.offsetHeight/2));
this.center.style.visibility = "visible";
}
var i=this.Jl % this.Hv;
if(!this.lS){
Gm(this.wA[i], -s(this.Vb, "left") , -s(this.Vb,"top"));
this.wA[i].style.visibility = "visible";
this.buildIcon();
this.Kj();
}
if(NTUserAgent.type!=1 && NTUserAgent.version!=5){
this.Vb.style.cursor = "pointer";
}
for(var x=0,y=i,z=this.Hv+50; x<this.Hv; x++,y++,z--){
if(y >= this.Hv){
y=0;
}
if(this.wA[y]==null || y==i){
continue;
}
this.wA[y].style.zIndex = z;
}
if(this.Bc){
this.clearMap();
this.Bc = false;
}
for(var i=0; i<this.Bo.length; i++){
this.Bo[i].visible();
}
for(var i=0; i<this.Bl.length; i++){
this.Bl[i].visible();
}
E[0](this.Ll.getPos(),this);
if(this.Aj!=null) this.Aj.set(this.Ll);
this.Ut = true;
if(!this.lS){
this.Fh = true;
}
};
NTMap.prototype.Oj=function(e){
if(!e.relatedTarget){
this.Tt(e);
}
};
NTMap.prototype.moveTo = function(a){
if(arguments.length==0 && a==null) return false;
if(!this.Cq){
this.Ll.setPos(a);
}
if(!this.Fh) return false;
this.Fh = false;
var b = NTGeoUtil.LonLat2Pixel(a,this.Ll);
var mx = s(this.Vb, "left") - (b.x-this.Ll.getSize().x/2);
var my = s(this.Vb, "top") - (b.y-this.Ll.getSize().y/2);
if(Math.abs(s(this.Vb, "left") - mx) > 5000 || Math.abs(s(this.Vb, "top") - my) > 5000){
this.Ll.setPos(a);
this.Bc = true;
this.reload();
}else{
this.lS = true;
this.Ll.setPos(a);
this.makeMapImage();
var m = new NTMapCtrl(this.Vb);
m.autoScrollTo(mx,my,this.Lt);
}
};
NTMap.prototype.Pi = function(a){
this.lS = false;
var i=this.Jl % this.Hv;
Gm(this.wA[i], -s(this.Vb, "left"), -s(this.Vb, "top"));
this.buildIcon();
this.Kj();
if(this.Ut){
this.wA[i].style.visibility = "visible";
this.Fh = true;
}
};
NTMap.prototype.reload = function(){
this.Ll.setSize(NTSize.parse(this.lD));
if(!this.Cq && !this.Fh) return false;
return this.makeMapImage()? true: false;
};
NTMap.prototype.makeMapImage = function(){
this.Fh = false;
this.Ut = false;
this.Jl = ++this.Jl % this.Hv;
var stl, i=this.Jl;
if(this.wA[i]==null){
this.wA[i] = Fy("", this.Ll.getSize().x, this.Ll.getSize().y);
stl = this.wA[i].style;
stl.position = "absolute";
NTEvent.add(this.wA[i],'load',this.Hd);
this.Vb.appendChild(this.wA[i]);
}else{
stl = this.wA[i].style;
stl.width = this.Ll.getSize().x + "px";
stl.height = this.Ll.getSize().y + "px";
setAlpha(this.wA[i],100);
}
stl.visibility = "hidden";
stl.zIndex=this.Hv+50;
this.wA[i].src = NTUrl.create(this.Ll,(this.Uq||null));
return this.wA[i];
};
NTMap.prototype.clearMap = function(a){
for(var i=0; i<this.wA.length; i++){
if(this.wA[i]==null || i == this.Jl % this.Hv || (a!=null && this.wA[i]==a)) continue;
this.wA[i].style.visibility = "hidden";
}
};
NTMap.prototype.setZoom = function(a,b,c){
if(this.Ll.getScale()==a && this.Ll.getZoom()==b){
return false;
}
if(c && this.Vv && this.Cq && this.Ut){
for(var i=0; i<this.Bo.length; i++){
this.Bo[i].hide();
}
for(var i=0; i<this.Bl.length; i++){
this.Bl[i].hide();
}
if(this.Ed && this.Ed.iswork()){
this.clearMap();
this.Ed.stop();
}else{
var Vh = this.wA[this.Jl];
this.clearMap(Vh);
this.Ed = new NTMapScaleCtrl(Vh);
this.Ed.autoChangeScale(this.Ll,a,b,function(){
});
}
}
this.Ll.setScale(a);
this.Ll.setZoom(b);
if(this.Gh)
this.Gh.setStatus(this.Ll);
this.Bc = true;
if(this.Vv){
if(this.reload()){
E[0](this.Ll.getPos(),this);
E[2](this.getZoom(),this);
}
}
};
NTMap.prototype.getZoom = function(){
return {scale: this.Ll.getScale(), zoom: this.Ll.getZoom()};
};
NTMap.prototype.setPalette = function(a){
this.Ll.setPalette(a);
this.Bc = true;
if(this.Vv && this.Cq){
this.reload();
}
};
NTMap.prototype.addParam = function(a,b){
this.Ll.addParam(a,b);
};
NTMap.prototype.removeParam = function(a){
this.Ll.removeParam(a);
};
NTMap.prototype.getPos = function(){
return this.Ll.getPos();
};
NTMap.prototype.addRoute = function(){
for(var a=0; a<arguments.length; a++){
this.Ll.addRoute(arguments[a]);
}
if(this.Vv){
this.reload();
}
};
NTMap.prototype.removeRoute = function(){
var r = false;
if(arguments.length > 0){
for(var i=0; i<arguments.length; i++){
r=this.Ll.removeRoute(arguments[i]);
}
}else{
if(this.Ll.getRoute().length>0){
this.Ll.clearRoute();
r=true;
}
}
if(r && this.Vv){
this.reload();
}
};
NTMap.prototype.getRouteList = function(){
if(!this.Ll.getRoute().length) return null;
return this.Ll.getRoute();
};
NTMap.prototype.addCenter = function(a,b,c){
if (typeof a == 'string'){
}else if(typeof a == 'object'){
b=a.width;
c=a.height;
a=a.src;
}else{
return false;
}
this.center = Uc(a,b,c,true,"object");
NTEvent.add(this.center, "contextmenu", this.Pv);
this.lD.appendChild(this.center);
this.center.style.zIndex=900;
this.center.style.visibility = "hidden";
};
NTMap.prototype.addBackground = function(a){
if(a==null) return;
this.Rt = Vc("bgi","absolute",0,0);
Uu(this.Rt, this.Ll.getSize().x, this.Ll.getSize().y);
this.Rt.style.backgroundImage = "url(" + a.src + ")";
this.lD.appendChild(this.Rt);
this.Rt.style.zIndex=10;
this.Rt.style.visibility = "hidden";
};
NTMap.prototype.addIcon = function(){
var rL = arguments;
for(var i = 0; i<rL.length; i++){
rL[i].addDocument(this.Vb,301);
this.Bo.push(rL[i]);
}
if(this.Ut){
this.buildIcon();
this.Kj();
}
};
NTMap.prototype.getIcon = function(a){
var Zl = new Array();
for(var i=0; i<this.Bo.length; i++){
if(a && a!=this.Bo[i].getGroup()){
continue;
}
Zl.push(this.Bo[i]);
}
return Zl;
};
NTMap.prototype.clearIcon = function(a){
var Zl = new Array();
for(var i=0; i<this.Bo.length; i++){
if(a && a!=this.Bo[i].getGroup()){
Zl.push(this.Bo[i]);
continue;
}
this.Bo[i].remove();
}
this.Bo = Zl;
};
NTMap.prototype.buildIcon = function(){
for(var i=0; i<this.Bo.length; i++){
var a=this.Bo[i];
if(a.getImage()==null) continue;
var eP = a.getImage();
if(a==null || a.getPos()==null) continue;
var p = NTGeoUtil.LonLat2Pixel(a.getPos(),this.Ll);
var iconXDiff = 0;
var iconYDiff = 0;
var position = a.getIconPosition();
if(position == 1 || position == 4 || position == 7){
iconXDiff = eP.offsetWidth/2;
}
else if(position == 2 || position == 5 || position == 8){
iconXDiff = eP.offsetWidth;
}
if(position == 3 || position == 4 || position == 5){
iconYDiff = eP.offsetHeight/2;
}
else if(position == 6 || position == 7 || position == 8){
iconYDiff = eP.offsetHeight;
}
Gm(eP, p.x - iconXDiff - s(this.Vb, "left"), p.y - iconYDiff - s(this.Vb, "top"));
Gm(a.getCather(), p.x - iconXDiff - s(this.Vb, "left"), p.y - iconYDiff - s(this.Vb, "top"));
var is = a.getShadow();
if(is!=null){
Gm(is, s(eP,"left"), new Number(s(eP,"top")) + eP.offsetHeight-is.offsetHeight);
is.style.visibility = "visible";
}
eP.style.visibility = "visible";
}
};
NTMap.prototype.openContext = function(a,b){
this.closeContext();
a.style.position = 'absolute';
a.style.top = b.top + "px";
a.style.left= b.left+ "px";
a.style.visibility = 'visible';
this.Iy = a;
this.lD.appendChild(a);
};
NTMap.prototype.closeContext = function() {
if (this.Iy) {
this.Iy.style.visibility = 'hidden';
Pp(this.Iy);
Nv(this.Iy);
this.Iy = undefined;
}
};
NTMap.prototype.addMsg = function(a){
if(this.yF){
return false;
}
var d = a.createDocument(this.Vb);
this.Bl.push(a);
a.moveTo(NTGeoUtil.LonLat2Pixel(a.getPos(),this.Ll));
return true;
};
NTMap.prototype.closeMsg=function(a) {
if (!this.yF) {
return false;
}
this.yF.close();
}
NTMap.prototype.openMsg = function(Ev,a){
if(!this.yF || !Ev){
return;
}
this.yF.decorate({color:a.bgcolor, border: a.bordercolor, max:a.max});
this.yF.setPos(Ev);
this.yF.replaceContent({title:"", body:a.content});
this.Bl[0]=this.yF;
this.yF.moveTo(NTGeoUtil.LonLat2Pixel(Ev,this.Ll));
this.yF.open();
return this.yF;
};
NTMap.prototype.Kj = function(){
for(var i=0; i<this.Bl.length; i++){
if(this.Bl[i]==null || this.Bl[i].getPos()==null) continue;
var p = NTGeoUtil.LonLat2Pixel(this.Bl[i].getPos(),this.Ll);
this.Bl[i].moveTo(p);
}
};
NTMap.prototype.loadToolbar = function(a){
if(!a) a = NTZoomToolbar.DEFAULT;
a.setParent(this.lD);
a.setStatus(this.Ll);
a.onChange(this.Ow);
a.load();
this.Gh = a;
this.Pz.set(a);
};
NTMap.prototype.loadScalebar = function(a){
this.Aj = new NTScaler(this.lD,NTGeoUtil.JP(this.Ll.getPos()),a);
};
NTMap.prototype.setProperty = function(a,b){
if(a=="autoload"){
this.Vv = b;
}
if(a=="url"){
this.Uq = b;
}
if(a=="image"){
Ls = new Image();
Ls.src = b;
}
};
NTMap.prototype.moveMapPlate = function(a,b){
style = this.Vb.style;
if(a) style.left = this.Vb.offsetLeft + a + "px";
if(b) style.top = this.Vb.offsetTop + b + "px";
};
NTMap.prototype.changeCenterPosition = function(a,b) {
this.Ll.setPos(NTGeoUtil.pixel2LonLat(new NTSize(a,b),this.Ll));
}
Ef('NTMap', NTMap);
Ef('NTSize', NTSize);
Ef('NTIcon', NTMapIcon);
Ef('NTImage', NTImage);
Ef('NTColor',NTColor);
Ef('NTLatLng', NTLatLng);
Ef('NTRoute', NTRoute);
Ef('NTPopup', NTPopup);
Ef('NTZoomToolbar', NTZoomToolbar);
Ef('NTResizer', NTResizer);
Ef('eventHandler',Object.eventHandler);
Ef('NTEvent', NTEvent);
Uf(NTMapCtrl);
Uf(NTMapScaleCtrl);
Uf(NTResizer);
Uf(NTMap.El);
})();

