/* 
Copyright 2006 NAVITIME JAPAN CO.,LTD. All Rights Reserved.
Auther by myoshida@navitime.co.jp
Version1.2.2
*/
(function() {
var $UtilImagePath$ = new Image(450,340);
var $document$ = document;
var $CopyRightJP$ = '+VzBW8wAgZi1lh3k+-/+T09Ty5b7XeU-/+Vv1XH1cwdAaWYg-';
var $CopyRightWW$ = '+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 = $document$.getElementById(element);
if (arguments.length == 1)
return element;
elements.push(element);
}
return elements;
}
function $getEventX$(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 $getEventY$(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 $getEventClass$(e){
if(NTUserAgent.type==1){
return e.target.className;
}else if(NTUserAgent.type==3){
return e.target.className;
}else{
return e.target.className;
}
};
function $addWindow$(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 $createDiv$(a,b,c,d){
var r = $document$.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 $createImage$(u,w,h){
var r = $document$.createElement("img");
if(u!=null && u!="")r.src = u;
if(w!=null) r.width = w;
if(h!=null)r.height = h;
return r;
}
function $removeElement$(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 $removeAllElement$(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){
$removeAllElement$(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(){};
Object.prototype.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);
}
};
Object.prototype.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 $TimeOutHandler$(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($document$.body){
$document$.body.scroll=a?"auto":"no"
if(window.innerHeight){
var s = $document$.body.style;
s.height=a?"auto":window.innerHeight-32
s.width=a?"auto":window.innerWidth-32
s.overflow=a?"visible":"hidden"
}
}else if($document$.height){
if(a && $document$._height){
$document$.height=$document$._height
delete $document$._height
$document$.width=$document$._width
delete $document$._width
window.onresize=window._resize
}
if(!a){
if(!$document$._height){
$document$._height=$document$.height
$document$._width=$document$.width
window._resize=window.onresize
window.onresize=new Function("if(window._resize)_resize();scrollbar(false)")
}
$document$.height=window.innerHeight
$document$.width=window.innerWidth
}
}
}
var E = [
function(a){(window["onMapLoad"] || EmptyFunction)(a);},
function(a){(window["onMapMove"] || EmptyFunction)(a);},
];
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 $loadPng$(b,w,h,p,c){
var a;
if(NTUserAgent.type==1 && NTUserAgent.version<7){
a = $createDiv$(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 = $createImage$(b,w,h);
a.style.position="absolute";
}
if(c) a.className = c;
return a;
}
function $splitImage$(u,x,y,w,h,p,c){
var a=$createDiv$("",p ? "relative" : "absolute", 0, 0);
a.style.overflow = "hidden";
$resize$(a,w,h);
var b=$loadPng$(u,$UtilImagePath$.width, $UtilImagePath$.height, false, c);
a.appendChild(b);
$move$(b,-x, -y);
if(c) a.className = c;
return a;
}
function $move$(a,b,c){
var s = a.style;
s.left = isNaN(b)?b:b+'px';
s.top= isNaN(c)?c:c+'px';
}
function $resize$(a,b,c){
var s = a.style;
s.width= isNaN(b)?b:b+'px';
s.height = isNaN(c)?c:c+'px';
}
function $copy$(a){
var $return$ = document.createElement(a.tagName);
for(var i in a.style){
try{$return$.style[i] = a.style[i];}catch(e){}
}
var l = a.childNodes.length;
for(var i=0; i<l; i++){
var copyObject = $copy$(a.childNodes[i]);
$return$.appendChild(copyObject);
}
if(a.innerHTML) $return$.innerHTML = a.innerHTML;
return $return$;
}
var NTHashMap = function(){
this.$map$ = new Object();
for(var i in this.$map$){
this.$map$[i] = null;
}
this.$mapsize$ = 0;
};
NTHashMap.prototype = {
put: function(a,b){
this.$map$[a] = b;
this.$mapsize$++;
},
get: function(a){
for(var i in this.$map$){
if(i == a) return this.$map$[i];
}
return null;
},
remove: function(a){
this.$mapsize$--;
this.$map$[a] = null;
},
size: function(a){
return this.$mapsize$;
},
toArray: function(a){
if(this.size()==0){
return [];
}
return this.$map$;
},
toString: function(){
if(this.size()==0){
return "";
}
var ret="{";
for(var i in this.$map$){
if(this.$map$[i]!=null) ret+= (ret.length==1?"":",") + i + ":" + this.$map$[i];
}
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 $LatComvert$(a,b,c){
if(b!=null){
a=$getBiggest$(a,b)
}
if(c!=null){
a=$getSmallest$(a,c)
}
return a
}
function $LonComvert$(a,b,c){
while(a>c){
a-=c-b
}
while(a<b){
a+=c-b
}
return a
}
function $getSmallest$(a,b){
return Math.min(a,b)
}
function $getBiggest$(a,b){
return Math.max(a,b)
}
function $getRadians$(a){
return a*Math.PI/180
}
NTLatLng.prototype.latRadians=function(){
return $getRadians$($LatComvert$(this.Latitude/3600000,-90,90))
};
NTLatLng.prototype.lngRadians=function(){
return $getRadians$($LonComvert$(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(){
alert("aaa")
};
/* 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);
function NTZoomToolbar(){
this.$zoomContainer$ = new Array();
for (var i=0, j=0; i < arguments.length; i+=2, j++) {
this.$zoomContainer$[j] = new $NTZoomToolValue$(arguments[i],arguments[i+1]);
}
this.$parent$ = $document$.body;
this.$status$ = null;
this.$MouseDownHandler$= this.eventHandler("onMouseDown");
this.$MouseMoveHandler$= this.eventHandler("onMouseMove");
this.$MouseUpHandler$= this.eventHandler("onMouseUp");
this.$MouseOverHandler$= this.eventHandler("onMouseOver");
this.$MouseOutHandler$= this.eventHandler("onMouseOut");
this.$PlusClickHandler$= this.eventHandler("onPlusClick");
this.$MinusClickHandler$= this.eventHandler("onMinusClick");
this.$RailClickHandler$= this.eventHandler("onRailClick");
this.$moving_flg$= false;
this.changedFunc = null;
this.$range1$ = 7;
this.$initialIdx$ = 0;
}
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.$zoomContainer$[this.$zoomContainer$.length] = new $NTZoomToolValue$(a,b);
};
NTZoomToolbar.prototype.setParent = function(a){
this.$parent$ = a;
};
NTZoomToolbar.prototype.onChange = function(a){
this.changedFunc = a;
};
NTZoomToolbar.prototype.setStatus = function(a){
this.$status$ = a;
for(var i=0; i<this.$zoomContainer$.length; i++){
var z = this.$zoomContainer$[i];
if(a.getScale()==z.getScale() && a.getZoom()==z.getZoom()){
this.$initialIdx$ = i;
break;
}
}
if(this.$initialIdx$ != 0){
this.scrollTo(this.$initialIdx$ * this.$range1$ + 1);
}
};
NTZoomToolbar.prototype.setScaleByPoi = function(a){
if(a==null || a.poi==null || a.poi.length==0) return;
var $maxlon$=0,$minlon$=0,$maxlat$=0,$minlat$=0,$lonRange$,$latRange$;
for(var i=0; i<a.poi.length; i++){
if(a.poi[i]==null){continue;}
if(a.center == null){
if($maxlon$ == 0 || $maxlon$ < a.poi[i].getLongitude()){ $maxlon$=a.poi[i].getLongitude();}
if($minlon$ == 0 || $minlon$ > a.poi[i].getLongitude()){ $minlon$=a.poi[i].getLongitude();}
if($maxlat$ == 0 || $maxlat$ < a.poi[i].getLatitude()){ $maxlat$=a.poi[i].getLatitude();}
if($minlat$ == 0 || $minlat$ > a.poi[i].getLatitude()){ $minlat$=a.poi[i].getLatitude();}
}else{
if($maxlon$ == 0 || $maxlon$ < Math.abs(a.poi[i].getLongitude() - a.center.getLongitude())){
$maxlon$ = Math.abs(a.poi[i].getLongitude() - a.center.getLongitude());
}
if($maxlat$ == 0 || $maxlat$ < Math.abs(a.poi[i].getLatitude() - a.center.getLatitude())){
$maxlat$ = Math.abs(a.poi[i].getLatitude() - a.center.getLatitude());
}
}
}
if(a.center == null){
$lonRange$ = Math.abs($maxlon$ - $minlon$)*1.1;
$latRange$ = Math.abs($maxlat$ - $minlat$)*1.1;
}else{
$lonRange$ = $maxlon$ * 2 *1.1;
$latRange$ = $maxlat$ * 2 *1.1;
}
for(var i=this.$zoomContainer$.length-1; i>= 0; i--){
var s = new NTMapStatus(this.$status$.getPos(),this.$status$.getSize(),0,this.$zoomContainer$[i].getScale(),this.$zoomContainer$[i].getZoom());
var pxOfLon = Math.ceil(NTGeoUtil.getLonFactor(s));
var pxOfLat = Math.ceil(NTGeoUtil.getLatFactor(s));
if(this.$status$.getSize().x * pxOfLon > $lonRange$ && this.$status$.getSize().y * pxOfLat > $latRange$){
this.scrollTo(i * this.$range1$ + 1, true);
break;
}
}
if(a.center==null){
return new NTLatLng(Math.round(new Number($minlat$) + new Number($maxlat$-$minlat$)/2) , Math.round(new Number($minlon$) + new Number($maxlon$ - $minlon$)/2));
}else{
return a.center;
}
};
NTZoomToolbar.prototype.onMouseDown = function(e){
this.$mover$.onMouseDown(e);
this.$moving_flg$ = true;
}
NTZoomToolbar.prototype.onMouseMove = function(e){
this.$mover$.onMouseMove(e);
}
NTZoomToolbar.prototype.onMouseUp = function(e){
CancelBubble(e);
if(!this.$moving_flg$) return;
var a = this.$mover$.onMouseUp(e);
this.scrollTo(s(this.$Point$,"top")+1);
this.$moving_flg$ = false;
}
NTZoomToolbar.prototype.onRailClick = function(e){
if(e.target.parentNode != this.$RailPlate$){
return false;
}
var $y$ = $getEventY$(e);
if(NTUserAgent.type==2) $y$ -=104;
if(NTUserAgent.type==4) $y$ += e.target.offsetTop;
this.scrollTo($y$);
};
NTZoomToolbar.prototype.scrollTo = function(a,b){
if(b==null) b=false;
var idx = Math.floor((a-1) / this.$range1$);
if(idx >= this.$zoomContainer$.length){
return false;
}
var ztv = this.$zoomContainer$[idx];
if(this.$Point$) this.$Point$.style.top = idx * this.$range1$ + 1 + "px";
if(this.changedFunc != null){
this.changedFunc(ztv.getScale(), ztv.getZoom(),b);
}
};
NTZoomToolbar.prototype.load = function(){
var style;
this.$BasePlate$ = $createDiv$("zoomToolbar","relative","10px","0px");
style = this.$BasePlate$.style;
style.zIndex=901;
style.width = "26px";
style.padding = "2px";
this.$parent$.appendChild(this.$BasePlate$);
this.$Minus$ = $splitImage$($UtilImagePath$.src, 15, 50, 20, 20, 'relative', '');
style = this.$Minus$.style;
style.left = '3px';
style.top = '2px';
this.$BasePlate$.appendChild(this.$Minus$);
this.$RailPlate$ = $splitImage$($UtilImagePath$.src, 55, 50, 20, this.$zoomContainer$.length * this.$range1$, 'relative', '');
style = this.$RailPlate$.style;
style.left = '3px';
style.top = '0px';
this.$BasePlate$.appendChild(this.$RailPlate$);
this.$Plus$ = $splitImage$($UtilImagePath$.src, 35, 50, 20, 20, 'relative', '');
style = this.$Plus$.style;
style.left = '3px';
style.top = '0px';
this.$BasePlate$.appendChild(this.$Plus$);
this.$Point$ = $splitImage$($UtilImagePath$.src, 0, 65, 15, 7, 'absolute', '');
style = this.$Point$.style;
style.left = '2px';
style.top = '1px';
this.$RailPlate$.appendChild(this.$Point$);
var $eventElement$ = this.$Point$.setCapture?this.$Point$:window;
NTEvent.add(this.$Point$,'mousedown',this.$MouseDownHandler$);
NTEvent.add($eventElement$,'mousemove',this.$MouseMoveHandler$);
NTEvent.add($eventElement$,'mouseup',this.$MouseUpHandler$);
NTEvent.add(this.$RailPlate$, 'click', this.$RailClickHandler$);
NTEvent.add(this.$Plus$,'mouseover',this.$MouseOverHandler$);
NTEvent.add(this.$Minus$,'mouseover',this.$MouseOverHandler$);
NTEvent.add(this.$Point$,'mouseover',this.$MouseOverHandler$);
NTEvent.add(this.$RailPlate$,'mouseover',this.$MouseOverHandler$);
NTEvent.add(this.$Plus$,'mouseout',this.$MouseOutHandler$);
NTEvent.add(this.$Minus$,'mouseout',this.$MouseOutHandler$);
NTEvent.add(this.$Point$,'mouseout',this.$MouseOutHandler$);
NTEvent.add(this.$RailPlate$,'mouseout',this.$MouseOutHandler$);
NTEvent.add(this.$Plus$,'click',this.$PlusClickHandler$);
NTEvent.add(this.$Minus$,'click',this.$MinusClickHandler$);
this.$mover$ = new NTMover(this.$Point$);
this.$mover$.downTarget=this.$Point$;
this.$mover$.setAvailableArea(new NTSize(2,1), new NTSize(2,(s(this.$RailPlate$,"height")-s(this.$Point$,"height"))));
if(this.$initialIdx$ != 0){
this.scrollTo(this.$initialIdx$ * this.$range1$ + 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.$Point$,"top") <= 1){
return false;
}
this.scrollTo(s(this.$Point$,"top") - this.$range1$, true);
};
NTZoomToolbar.prototype.onPlusClick = function(e){
if(s(this.$Point$,"top") >= this.$zoomContainer$.length * this.$range1$ + 1){
return false;
}
this.scrollTo(s(this.$Point$,"top") + this.$range1$, true);
};
function $NTZoomToolValue$(a,b){
this.scale = a;
this.zoom = b;
}
$NTZoomToolValue$.prototype.getScale = function(){
return this.scale;
};
$NTZoomToolValue$.prototype.getZoom = function(){
return this.zoom;
};
function NTScaler(a){
var top = s(a,"height")-37;
var stl;
this._sc = $createDiv$('NTScale',"absolute","10px",top+"px");
stl = this._sc.style;
stl.zIndex = 910;
stl.font = "0px Arial";
stl.backgroundColor = "#FFF";
stl.height ="18px";
setAlpha(this._sc,60);
a.appendChild(this._sc);
this._bar = $createDiv$('NTScaleBar',"absolute","12px", top+5+"px");
stl = this._bar.style;
stl.zIndex = 911;
stl.border = "1px #000 solid";
stl.width = "0px";
stl.height = "6px";
stl.backgroundColor = "#FFF";
stl.fontSize = "0px";
a.appendChild(this._bar);
this._text = $createDiv$('NTScaleText',"absolute","0px",top+2+"px");
stl = this._text.style;
stl.zIndex = 912;
stl.color = "#555";
stl.font = "bold 10px Arial";
a.appendChild(this._text);
}
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 h=this.of(e/1000,"km",e,"m");
this._bar.style.width = h.length + "px";
this._text.style.left = h.length + 17 + "px";
this._text.innerHTML = h.display;
this._sc.style.width = h.length + 17 + this._text.offsetWidth+ "px";
};
function $Of$(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){
var e=a;
var f=b;
if(a<1){
e=c;
f=d;
}
var g=$Of$(e);
var h=Math.round(125*g/(2*e));
return{
length:h,display:g+" "+f
}
};
var NTPopup = function(a,b){
this.closeClickHandler = this.eventHandler("onCloseClick");
this.$pos$ = a;
this.$contents$ = new Array();
this.$factor$ = new NTPopupFactor();
this.spaceX = 8;
this.spaceY = 24;
this.$visibility$ = false;
this.$sizecontent$ = 0;
this.$maxWidth$ = 0;
this.$maxHeight$ = 0;
this.$bgcolor$ = "#FFF";
this.$bordercolor$ = "#949494";
if(b){
if(b.max){
this.$maxWidth$ = b.max.x;
this.$maxHeight$ = b.max.y;
}
if(b.bgcolor) this.$bgcolor$ = b.bgcolor;
if(b.bordercolor) this.$bordercolor$ = b.bordercolor;
}
};
NTPopup.prototype = {
createDocument: function(a){
this.$parent$ = a;
this.$base$ = $createDiv$("","relative",0,0);
var s = this.$base$.style;
s.cursor = "default";
s.visibility = "hidden";
this.$factor$.top = $popupLayer$(25, 0, 220-(25-this.spaceX)*2, 25, 1, 0, 0, 0, this.$bgcolor$,true, this.$bordercolor$ );
this.$factor$.middle = $popupLayer$(0, 0, 240+20, 50-20, 0, 1, 1, 0, this.$bgcolor$,true, this.$bordercolor$ );
this.$factor$.bottom = $popupLayer$(25, 0, 220-(25-this.spaceX)*2, 25, 0, 0, 0, 1, this.$bgcolor$,true, this.$bordercolor$ );
this.$factor$.tail = $popupImage$($UtilImagePath$.src,50,0,100,50,0,-1,false,"static");
this.$factor$.tail.style.visibility = "hidden";
this.$factor$.topleft = $popupImage$($UtilImagePath$.src,0,0,25,25,0,0,false,"object");
this.$factor$.topright = $popupImage$($UtilImagePath$.src,25,0,25,25,0,0,false,"object");
this.$factor$.bottomleft = $popupImage$($UtilImagePath$.src,0,25,25,25,0,0,false,"object");
this.$factor$.bottomright = $popupImage$($UtilImagePath$.src,25,25,25,25,0,0,false,"object");
this.$factor$.shadow = $popupImage$($UtilImagePath$.src,150,0,300,150,0,0,false,"static");
this.$factor$.shadow.style.visibility = "hidden";
this.$factor$.close = $popupImage$($UtilImagePath$.src,0,50,15,15,0,0,false,"object");
this.$factor$.close.style.cursor = "pointer";
NTEvent.add(this.$factor$.close, 'click', this.closeClickHandler);
var bg = this.$factor$.getFactor();
for(var i=0; i< bg.length; i++){
this.$base$.appendChild(bg[i]);
}
this.$base$.style.position = "absolute";
this.$parent$.appendChild(this.$base$);
this.$parent$.appendChild(this.$factor$.tail);
this.$parent$.appendChild(this.$factor$.shadow);
for(var o=0; o<this.$sizecontent$; o++){
this.$parent$.appendChild(this.$contents$[o].body);
}
this.setDepth();
this.resize();
return this.getDocument();
},
getDocument: function(){
return {base: this.$base$, shadow: this.$factor$.shadow, tail: this.$factor$.tail};
},
getPos: function(){
return this.$pos$;
},
setPos: function(a){
this.$pos$ = a;
},
addContent: function(a,b){
b.className = "object";
var style = b.style;
style.display = "block";
style.visibility = "hidden";
style.position = "absolute";
var $content$ = {title:a, body:b};
this.$contents$.push($content$);
this.$sizecontent$++;
},
getContent: function(){
return this.$contents$;
},
replaceContent: function(a){
for(var o=0; o<this.$sizecontent$; o++){
this.$contents$[o].body.style.display="none";
this.$contents$[o].body.style.visibility="hidden";
}
this.$contents$ = new Array();
this.$sizecontent$ = 0;
this.addContent(a.title, a.body);
for(var o=0; o<this.$sizecontent$; o++){
this.$parent$.appendChild(this.$contents$[o].body);
}
this.setDepth();
this.resize();
},
resize: function(a,b){
var $style$;
if(!a && !b){
if(this.$sizecontent$ == 0) return;
var $maxWidth$=130, $maxHeight$=50;
for(var i=0; i<this.$sizecontent$; i++){
$dom$ = this.$contents$[i].body;
$style$ = $dom$.style;
$style$.position = "relative";
alert($maxWidth$);
alert("$dom$.offsetWidth="+$dom$.offsetWidth);
if($dom$.offsetWidth > $maxWidth$){
alert(0);
if(this.$maxWidth$ > 0 && $dom$.offsetWidth > this.$maxWidth$){
$maxWidth$ = this.$maxWidth$<130?130:this.$maxWidth$;
$style$.width = this.$maxWidth$ + "px";
alert($style$.width);
}else{
$maxWidth$ = $dom$.offsetWidth<150?150:$dom$.offsetWidth;
$style$.width = $maxWidth$+"px";
}
}else{
$style$.width = $maxWidth$+"px";
}
alert("$dom$.style.width="+$dom$.style.width);
alert("$dom$.offsetHeight="+$dom$.offsetHeight);
if($dom$.offsetHeight > $maxHeight$){
if(this.$maxHeight$>0 && $dom$.offsetHeight > this.$maxHeight$){
alert(1);
$maxHeight$ = this.$maxHeight$;
$style$.height = this.$maxHeight$ - this.spaceY + "px";
$style$.overflow = "auto";
}else{
alert(2);
$maxHeight$ = $dom$.offsetHeight;
$style$.height = $maxHeight$+"px";
}
}
$style$.position = "absolute";
}
a = $maxWidth$;
b = $maxHeight$;
}
$resize$(this.$factor$.middle, a+(this.spaceX*2)-2, b-(25-this.spaceY/2));
$resize$(this.$factor$.top, a-(25-this.spaceX)*2, 24);
$resize$(this.$factor$.bottom, a-(25-this.spaceX)*2,24);
$move$(this.$factor$.topright, a + this.spaceX -(25 - this.spaceX), 0);
$move$(this.$factor$.bottomleft, 0, b+(this.spaceY/2));
$move$(this.$factor$.bottomright, a + this.spaceX -(25 - this.spaceX), b+(this.spaceY/2));
$move$(this.$factor$.tail, (a-100)/2+this.spaceX,-1);
$move$(this.$factor$.shadow, $maxWidth$/2 - 50, this.$base$.offsetHeight - this.$factor$.shadow.offsetHeight);
$move$(this.$factor$.close, $maxWidth$+this.spaceX-this.$factor$.close.offsetWidth, 5);
$style$ = this.$base$.style;
$style$.width = a + this.spaceX * 2 + "px";
$style$.height = this.$factor$.top.offsetHeight + this.$factor$.middle.offsetHeight + this.$factor$.bottom.offsetHeight + "px";
$style$.overflow = "hidden";
},
setDepth: function(a){
this.$base$.style.zIndex = (a||400);
this.$factor$.tail.style.zIndex = (a||400)+20;
this.$factor$.shadow.style.zIndex = (a||400)-200;
for(var o=0; o<this.$sizecontent$; o++){
this.$contents$[o].body.style.zIndex = (a||400)+60;
}
},
open: function(){
this.$base$.style.visibility = "visible";
this.$factor$.tail.style.visibility = "visible";
this.$factor$.shadow.style.visibility = "visible";
this.$visibility$ = true;
if(this.$sizecontent$>0) this.$contents$[0].body.style.visibility = "visible";
},
close: function(){
this.$base$.style.visibility = "hidden";
this.$factor$.tail.style.visibility = "hidden";
this.$factor$.shadow.style.visibility = "hidden";
this.$visibility$ = false;
for(var i=0; i<this.$sizecontent$; i++){
this.$contents$[i].body.style.visibility = "hidden";
}
},
foreground: function(){
this.$base$.style.zIndex |= 100;
var bg = this.$factor$.getFactor();
for(var i=0; i< bg.length; i++){
bg[i].style.zIndex |= 100;
}
for(var i=0; i<this.$sizecontent$; i++){
this.$contents$[i].body.style.zIndex|=100;
}
},
back: function(){
this.$base$.style.zIndex &=~ 100;
var bg = this.$factor$.getFactor();
for(var i=0; i< bg.length; i++){
bg[i].style.zIndex &=~ 100;
}
for(var i=0; i<this.$sizecontent$; i++){
this.$contents$[i].body.style.zIndex &=~ 100;
}
},
remove: function(){
if(this.$factor$.tail) $removeElement$(this.$factor$.tail);
if(this.$factor$.shadow) $removeElement$(this.$factor$.shadow);
this.$pos$ = null;
this.$contents$ = null;
this.$sizecontent$ = 0;
this.$maxWidth$ = null;
this.$maxHeight$ = null;
this.$bgcolor$ = null;
this.$bordercolor$ = null;
this.$visibility$ = null;
this.$factor$.remove();
this.$factor$ = null;
if(this.$base$) $removeElement$(this.$base$);
this.$base$ = null;
},
onCloseClick: function(){
this.close();
},
hide: function(){
if(this.$visibility$){
this.$base$.style.visibility = "hidden";
this.$factor$.tail.style.visibility = "hidden";
this.$factor$.shadow.style.visibility = "hidden";
for(var i=0; i<this.$sizecontent$; i++){
this.$contents$[i].body.style.visibility = "hidden";
}
}
},
visible: function(){
if(this.$visibility$){
this.$base$.style.visibility = "visible";
this.$factor$.tail.style.visibility = "visible";
this.$factor$.shadow.style.visibility = "visible";
for(var i=0; i<this.$sizecontent$; i++){
this.$contents$[i].body.style.visibility = "visible";
}
}
},
isAvalable: function(){
return (this.$base$ != null);
},
decorate: function($option$){
if($option$.border){
this.$factor$.top.style.borderColor = $option$.border;
this.$factor$.middle.style.borderColor = $option$.border;
this.$factor$.bottom.style.borderColor = $option$.border;
}
if($option$.color){
this.$factor$.top.style.backgroundColor = $option$.color;
this.$factor$.middle.style.backgroundColor = $option$.color;
this.$factor$.bottom.style.backgroundColor = $option$.color;
}
if($option$.max){
this.$maxWidth$ = $option$.max.x;
this.$maxHeight$ = $option$.max.y;
}
},
moveTo: function(a){
$move$(this.$base$, a.x - this.$base$.offsetWidth/2 - s(this.$parent$, "left"), a.y - this.$base$.offsetHeight - this.$factor$.tail.offsetHeight - s(this.$parent$,"top")+1);
$move$(this.$factor$.tail, a.x - 50 - s(this.$parent$, "left"), a.y - this.$factor$.tail.offsetHeight - s(this.$parent$, "top"));
$move$(this.$factor$.shadow, a.x - 50 - s(this.$parent$, "left"), a.y - this.$factor$.shadow.offsetHeight - s(this.$parent$, "top"));
for(var i=0; i<this.$sizecontent$; i++){
$move$(this.$contents$[i].body, a.x - this.$base$.offsetWidth/2 - s(this.$parent$,"left") + this.spaceX, a.y - this.$base$.offsetHeight - this.$factor$.tail.offsetHeight - s(this.$parent$,"top") + this.spaceY);
}
}
};
function $popupImage$(u,$initX$,$initY$,w,h,x,y,p,c){
var t = $splitImage$(u, $initX$, $initY$, w, h, p, c);
var stl = t.style;
if(x) stl.left = x + "px";
if(y) stl.top = y + "px";
return t;
};
function $popupLayer$(x,y,w,h,$borderTop$,$borderLft$,$borderRht$,$borderBtm$,c,$position$,$borderColor$){
var t = $createDiv$("", $position$ ? "relative" : "absolute", x ,y);
var stl = t.style;
stl.fontSize = "0";
if($borderTop$ && $borderTop$>0){
stl.borderTop = $borderTop$ + "px " + $borderColor$ + " solid";
h -= 1;
}
if($borderLft$ && $borderLft$>0){
stl.borderLeft = $borderLft$ + "px " + $borderColor$ + " solid";
w -= 1;
}
if($borderRht$ && $borderRht$>0){
stl.borderRight = $borderRht$ + "px " + $borderColor$ + " solid";
w -= 1;
}
if($borderBtm$ && $borderBtm$>0){
stl.borderBottom = $borderBtm$ + "px " + $borderColor$ + " solid";
h -=1 ;
}
$resize$(t,w,h);
stl.backgroundColor = c;
t.className = "object";
return t;
};
var NTPopupFactor = function(){
this.topleft =$createDiv$('',"absolute", 0, 0);
this.topright =$createDiv$('',"absolute", 0, 0);
this.bottomleft =$createDiv$('',"absolute", 0, 0);
this.bottomright =$createDiv$('',"absolute", 0, 0);
this.top =$createDiv$('',"relative", 0, 0);
this.middle =$createDiv$('',"relative", 0, 0);
this.bottom =$createDiv$('',"relative", 0, 0);
this.tail =$createDiv$('',"absolute", 0, 0);
this.shadow =$createDiv$('',"absolute", 0, 0);
this.close =$createDiv$('',"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="";
(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("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)?3:5;
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 $oldSize$ = new NTSize(NTGeoUtil.getLonFactor(a) , NTGeoUtil.getLatFactor(a));
a.setScale(c);
a.setZoom(z);
var $newSize$ = new NTSize(NTGeoUtil.getLonFactor(a) , NTGeoUtil.getLatFactor(a));
var $rateWidth$ = $oldSize$.x/$newSize$.x;
var $rateHeight$ = $oldSize$.y/$newSize$.y;
if($rateWidth$ > 5 || $rateWidth$ < 0.2){
if(this.endFunction) this.endFunction();
return;
}
this.endSiz = new NTSize(Math.floor(this.startSiz.x * $rateWidth$),Math.floor(this.startSiz.y * $rateHeight$));
this.endPos = new NTSize(this.startPos.x - (Math.floor(this.startSiz.x * $rateWidth$)-this.startSiz.x)/2 , this.startPos.y - (Math.floor(this.startSiz.y * $rateHeight$)-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.$pos$=a;
this.$imgsrc$ = b;
this.$shdsrc$ = d;
this.$id$ = c;
this.$icon$;
this.$shadow$;
this.$group$;
this.$events$ = new Array();
this.Initialize();
};
NTMapIcon.prototype = {
Initialize: function(){
this.$icon$ = $loadPng$(this.$imgsrc$.src, this.$imgsrc$.width,this.$imgsrc$.height);
this.$icon$.className = (this.$id$ !=null && this.$id$ != "") ? "object" : "static";
this.$icon$.style.visibility = "hidden";
if(this.$shdsrc$){
this.$shadow$ = $loadPng$(this.$shdsrc$.src, this.$shdsrc$.width,this.$shdsrc$.height);
this.$shadow$.className = "static";
this.$shadow$.style.visibility = "hidden";
}
},
addDocument: function(a,b){
this._parent = a;
this._zindex = b;
this.$icon$.style.zIndex=this._zindex;
this._parent.appendChild(this.$icon$);
this.$eventCatcher$ = document.createElement("div");
this.$eventCatcher$.className="object";
this.$eventCatcher$.style.position = "absolute";
this.$eventCatcher$.style.width = this.$icon$.offsetWidth+"px";
this.$eventCatcher$.style.height = this.$icon$.offsetHeight+"px";
this.$eventCatcher$.style.zIndex = 440;
this._parent.appendChild(this.$eventCatcher$);
for(var e = 0; e < this.$events$.length; e++){
NTEvent.add(this.$eventCatcher$, this.$events$[e].type, this.$events$[e].func);
}
if(this.$shadow$){
this.$shadow$.style.zIndex=this._zindex-200;
this._parent.appendChild(this.$shadow$);
}
},
addEvent: function(a,b){
this.$events$.push({type:a, func:b});
},
removeEvent: function(){
},
getEvent: function(a){
if(a!=null){
for(e in this.$events$){
if(e.type == a) return e.func;
}
return function(){};
}
return this.$events$;
},
getId: function(){return this.$id$;},
getImage: function(){return this.$icon$;},
getCather: function(){return this.$eventCatcher$;},
getShadow: function(){return this.$shadow$;},
getPos: function(){return this.$pos$;},
remove: function(){
var len = this._parent.childNodes.length;
for(var i=0; i<len; i++){
if(this._parent.childNodes[i]==this.$icon$){
this._parent.removeChild(this._parent.childNodes[i]);
}
if(this.$shadow$ != null && this._parent.childNodes[i]==this.$shadow$){
this._parent.removeChild(this._parent.childNodes[i]);
}
}
this.$icon$ = null;
this.$shadow$ = null;
},
rebuild: function(){
this.Initialize();
this.addDocument(this._parent,this._zindex);
},
hide: function(){
if(!this.$icon$) return;
this.$icon$.style.visibility = "hidden";
if(this.$shadow$) this.$shadow$.style.visibility = "hidden";
},
visible: function(){
if(!this.$icon$) return;
this.$icon$.style.visibility = "visible";
if(this.$shadow$) this.$shadow$.style.visibility = "visible";
},
setGroup: function(a){
this.$group$ = a;
},
getGroup: function(){
return this.$group$;
}
}
/* 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 $createImage$(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,2727,818,163);
return b[a.getScale()]/a.getZoom();
};
NTGeoUtil.getLatFactor = function(a){
if(NTGeoUtil.JP){
var b = new Array(160000,26667,2223,667,134);
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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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.$base$ = "http://www.navitime.co.jp/mapimage.jsp";
NTUrl.create = function(a,b){
var c=this.$base$;
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 in a.getParam()){
if(a.getParam()[i]==null) continue;
c += "&"+i + "=" + a.getParam()[i];
}
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{
cache[cache.length] = new NTRouteIcon(cache.length,route[i].orv,NTRouteIcon.START,route[i].orvtf);
route[i].setOrvId(cache.length-1);
}
if(di!=-1){
route[i].setDnvId(di);
cache[di].icon = NTRouteIcon.OTHER;
}else{
cache[cache.length] = new NTRouteIcon(cache.length,route[i].dnv,NTRouteIcon.END,route[i].dnvtf);
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);
}
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() + ",,,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){
this.id=a;
this.pos=b;
this.icon=c;
this.toll=d;
};
NTRouteIcon.START = "10001";
NTRouteIcon.END = "10002";
NTRouteIcon.OTHER = "10003";
/* Copyright (C) 2006 NAVITIME JAPAN CO.,LTD. All Rights Reserved. */
var NTMover = function(target) {
this.srcElement = target;
this.downTarget;
this.mouseDownPos;
this.defaultPos = new NTSize(s(target,"left"),s(target, "top"));
this.isMouseDown=false;
this.differencialX;
this.differencialY;
this.movedX;
this.movedY;
this.dummy = $createDiv$('',"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 - $getEventX$(e);
this.differencialY = e.clientY - $getEventY$(e);
this.defaultPos = new NTSize(s(this.srcElement, "left"),s(this.srcElement, "top"));
this.mouseDownPos = new NTSize($getEventX$(e), $getEventY$(e));
this.isMouseDown = true;
this.movedX = 0;
this.movedY = 0;
CancelBubble(e);
};
NTMover.prototype.onMouseMove = function(e){
var stl = this.srcElement.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){
this.orv = a;
this.dnv = b;
this.color = (c==null) ? NTColor.DEFAULT : c;
this.method = d;
this.orvtf = e;
this.dnvtf = f
this.oid;
this.did;
this.isAvailable = true;
};
NTRoute.prototype.setColor = function(a){
this.color = a;
};
NTRoute.prototype.setImage = function(a,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.$isMapInstanced$ = false;
this.$isMapLoaded$ = false;
this.$BaseContainer$ = $(a);
var s;
this.$status$ = new NTMapStatus(NTLatLng.parse(this.$BaseContainer$.innerHTML),NTSize.parse(this.$BaseContainer$),0,3,3);
this.$BaseContainer$.innerHTML="";
s = this.$BaseContainer$.style
s.textAlign="left";
s.overflow="hidden";
s.position="relative";
this.$MapPlate$ = $createDiv$("MovingContainer","relative", "0px", "0px");
s = this.$MapPlate$.style;
s.position = "absolute";
s.zIndex = 12;
this.$MapPlate$.className = "container";
this.$BaseContainer$.appendChild(this.$MapPlate$);
this.$IconPlate$ = $createDiv$("IconContainer","absolute","0px","0px");
this.$IconPlate$.style.zIndex = 100;
this.$IconPlate$.className = "container";
this.$MapPlate$.appendChild(this.$IconPlate$);
this.$arrMapObjects$ = new Array();
this.$MapImageIndex$ = 0;
this.$imageMaxCount$ = 6;
this.$isAutoLoad$ = (b && b.load=="manual")?false:true;
this.$mapType$ = (b && b.mouse!=null)?b.mouse:2;
$UtilImagePath$.src = (b.image||"item1.1.png");
if(b && b.url) this.$mapServer$ = b.url;
this.$isNeedMapReset$ = false;
this.$isMoving$ = false;
this.$zoomTool$ = null;
this.$arrIcons$ = new Array();
this.$arrMessages$ = new Array();
if(b && b.popup!="multi"){
this.$popup$ = new NTPopup(this.$status$.getPos());
this.$popup$.createDocument(this.$MapPlate$);
this.$arrMessages$[0] = this.$popup$;
}
this.$WindowLoadHandler$= this.eventHandler("$onLoad$");
this.$WindowUnLoadHandler$= this.eventHandler("$onUnload$");
this.$MouseOverHandler$= this.eventHandler("$onMouseOver$");
this.$MouseOutHandler$= this.eventHandler("$onMouseOut$");
this.$DoubleClickHandler$= this.eventHandler("$onDblClick$");
this.$MouseDownHandler$= this.eventHandler("$onMouseDown$");
this.$MouseMoveHandler$= this.eventHandler("$onMouseMove$");
this.$MouseUpHandler$= this.eventHandler("$onMouseUp$");
this.$WindowMouseOutHandler$= this.eventHandler("$onWindowMouseOut$");
this.$ImageLoadHandler$= this.eventHandler("$onImageLoad$");
this.$DoubleClickMoved$= this.methodHandler("$onImageMoved$");
this.$ChangeZoomHandler$= this.methodHandler("setZoom");
this.$WheelHandler$= this.eventHandler("$onWheelScroll$");
this.$KeyPressHandler$= this.eventHandler("$onKeyPress$");
this.$MenuHandler$= this.eventHandler("$onContextMenu$");
NTEvent.add(window, 'load', this.$WindowLoadHandler$);
NTEvent.add(window, 'unload', this.$WindowUnLoadHandler$);
};
NTMap.prototype.$onLoad$ = function(){
this.$status$.setSize(NTSize.parse(this.$BaseContainer$));
$resize$(this.$IconPlate$, this.$status$.getSize().x, this.$status$.getSize().y);
if(this.center!=null){
$move$(this.center, Math.round(this.$status$.getSize().x/2-this.center.offsetWidth/2), Math.round(this.$status$.getSize().y/2-this.center.offsetHeight/2));
this.center.style.visibility = "visible";
}
if(this.$background$!=null){
this.$background$.style.visibility = "visible";
}
var $eventElement$ = this.$MapPlate$.setCapture?this.$MapPlate$:window;
this.$ntMover$ = new NTMover(this.$MapPlate$);
this.$ntMover$.downTarget=this.$MapPlate$;
if(this.$mapType$ >= 2){
NTEvent.add(this.$MapPlate$, 'dblclick',this.$DoubleClickHandler$);
}else if(this.$mapType$ == 1){
NTEvent.add(this.$MapPlate$, 'click',this.$DoubleClickHandler$);
}
if(this.$mapType$ >= 2){
NTEvent.add(this.$MapPlate$,'mousedown',this.$MouseDownHandler$);
NTEvent.add($eventElement$,'mousemove',this.$MouseMoveHandler$);
NTEvent.add($eventElement$,'mouseup',this.$MouseUpHandler$);
}
if(this.$mapType$ >= 1){
NTEvent.add(this.$MapPlate$, 'DOMMouseScroll', this.$WheelHandler$);
NTEvent.add(this.$MapPlate$, 'mousewheel', this.$WheelHandler$);
NTEvent.add($document$,'keypress',this.$KeyPressHandler$);
NTEvent.add(this.$MapPlate$, 'mouseover', this.$MouseOverHandler$); 
NTEvent.add(this.$MapPlate$, 'mouseout',this.$MouseOutHandler$); 
}
NTEvent.add(window,'mouseout',this.$WindowMouseOutHandler$);
NTEvent.add(this.$MapPlate$, 'contextmenu', this.$MenuHandler$);
this.$isMapInstanced$=true;
var $copyright$ = $createDiv$('cp','absolute',0,0);
this.$BaseContainer$.appendChild($copyright$);
var $stylebind$ = $copyright$.style;
$stylebind$.fontSize = '10px';
$stylebind$.color = '#000';
$stylebind$.padding = '1px';
$copyright$.innerHTML = UnescapeUTF7(NTGeoUtil.JP(this.$status$.getPos())?$CopyRightJP$:$CopyRightWW$);
$stylebind$.left = "5px";
$stylebind$.top = this.$status$.getSize().y - $copyright$.offsetHeight -3+"px";
$stylebind$.zIndex = 902;
if(this.$isAutoLoad$){
this.reload();
}else{
this.$isMapOperate$=true;
}
};
NTMap.prototype.$onUnload$ = function(e){
this.clearMap();
this.$arrMapObjects$ = null;
this.$arrIcons$ = null;
this.$arrMessages$ = null;
$UtilImagePath$ = null;
$removeAllElement$(this.$BaseContainer$);
};
NTMap.prototype.$onContextMenu$ = function(e){
CancelBubble(e);
return false;
};
NTMap.prototype.$onMouseOver$ = function(e){
if(NTUserAgent.type==1 && NTUserAgent.version==5) return false;
this.$MapPlate$.style.cursor = "pointer";
};
NTMap.prototype.$onMouseOut$ = function(e){
if(NTUserAgent.type==1 && NTUserAgent.version==5) return false;
this.$MapPlate$.style.cursor = "default";
};
NTMap.prototype.$onDblClick$ = function(e){
if(!this.$isMapOperate$) return false;
var $target$ = e.target;
while($target$.parentNode!=null){
if($target$.className=="object") return;
$target$ = $target$.parentNode;
}
if(NTUserAgent.type!=1 && NTUserAgent.version!=5){
this.$MapPlate$.style.cursor = "wait";
}
var a = $getEventX$(e);
var c = $getEventY$(e);
if($getEventClass$(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.$MapPlate$, "left");
c += s(this.$MapPlate$, "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.$MapPlate$, "left");
c += s(this.$MapPlate$, "top");
}
}else{
if(NTUserAgent.type==2 || NTUserAgent.type==3){
if(e.target == this.$IconPlate$){
a += s(this.$MapPlate$, "left");
}else{
a -= s(this.$MapPlate$, "left");
}
}
if(NTUserAgent.type==2 || NTUserAgent.type==3){
if(e.target == this.$IconPlate$){
c += s(this.$MapPlate$, "top");
}else{
c -= s(this.$MapPlate$, "top");
}
}
}
a -=this.$status$.getSize().x/2;
c -=this.$status$.getSize().y/2;
CancelBubble(e);
var f=new NTSize(a,c);
E[1](NTGeoUtil.pixel2LonLat(f,this.$status$));
this.moveTo(NTGeoUtil.pixel2LonLat(f,this.$status$));
};
NTMap.prototype.$onMouseDown$ = function(e){
if(!this.$isMapOperate$) return false;
if(e.target.className=="object"){
CancelBubble(e);
return;
}
this.$ntMover$.onMouseDown(e);
};
NTMap.prototype.$onMouseMove$ = function(e){
if(!this.$isMapOperate$) return false;
if(e.target.className=="object"){
CancelBubble(e);
return;
}
this.$ntMover$.onMouseMove(e);
};
NTMap.prototype.$onMouseUp$ = function(e){
if(!this.$isMapOperate$) return false;
if(e.target.className=="object"){
CancelBubble(e);
return;
}
var a = this.$ntMover$.onMouseUp(e);
if(a){
this.$status$.setPos(NTGeoUtil.pixel2LonLat(a,this.$status$));
E[1](this.$status$.getPos());
this.reload();
}
CancelBubble(e);
};
NTMap.prototype.$onWheelScroll$ = function(e){
if(this.$zoomTool$==null || !this.$isMapOperate$){
CancelBubble(e);
return;
}
var delta = 0;
if (e.wheelDelta) {
delta = e.wheelDelta/120; 
if (NTUserAgent.type==4) delta = -delta;
} else if (e.detail) {
delta = -e.detail/3;
}
if(delta == 1){
this.$zoomTool$.onMinusClick();
}
if(delta == -1){
this.$zoomTool$.onPlusClick();
}
CancelBubble(e);
};
NTMap.prototype.$onKeyPress$ = function(e){
if(e.target.tagName == "INPUT" || e.target.tagName == "TEXTAREA") return;
if(e.target != $document$)
var lon = this.$status$.getPos().getLongitude();
var lat = this.$status$.getPos().getLatitude();
if(e.keyCode==37){
E[1](NTGeoUtil.pixel2LonLat(new NTSize(-this.$status$.getSize().x/2,0), this.$status$));
this.moveTo(NTGeoUtil.pixel2LonLat(new NTSize(-this.$status$.getSize().x/2,0), this.$status$));
CancelBubble(e);
}
if(e.keyCode==38){
E[1](NTGeoUtil.pixel2LonLat(new NTSize(0,-this.$status$.getSize().y/2), this.$status$));
this.moveTo(NTGeoUtil.pixel2LonLat(new NTSize(0,-this.$status$.getSize().y/2), this.$status$));
CancelBubble(e);
}
if(e.keyCode==39){
E[1](NTGeoUtil.pixel2LonLat(new NTSize(this.$status$.getSize().x/2,0), this.$status$))
this.moveTo(NTGeoUtil.pixel2LonLat(new NTSize(this.$status$.getSize().x/2,0), this.$status$));
CancelBubble(e);
}
if(e.keyCode==40){
E[1](NTGeoUtil.pixel2LonLat(new NTSize(0,this.$status$.getSize().y/2), this.$status$));
this.moveTo(NTGeoUtil.pixel2LonLat(new NTSize(0,this.$status$.getSize().y/2), this.$status$));
CancelBubble(e);
}
if(e.keyCode==187 || e.keyCode==107 || e.charCode == 43){
if(!this.$zoomTool$) return;
this.$zoomTool$.onPlusClick();
CancelBubble(e);
}
if(e.keyCode==189 || e.keyCode==109 || e.charCode == 45 || e.charCode == 61){
if(!this.$zoomTool$) return;
this.$zoomTool$.onMinusClick();
CancelBubble(e);
}
};
NTMap.prototype.$onImageLoad$ = function(e){
var i=this.$MapImageIndex$ % this.$imageMaxCount$;
if(!this.$isMoving$){
$move$(this.$arrMapObjects$[i], -s(this.$MapPlate$, "left") , -s(this.$MapPlate$,"top"));
this.$arrMapObjects$[i].style.visibility = "visible";
this.buildIcon();
this.$buildMsg$();
}
if(NTUserAgent.type!=1 && NTUserAgent.version!=5){
this.$MapPlate$.style.cursor = "pointer";
}
for(var x=0,y=i,z=this.$imageMaxCount$+50; x<this.$imageMaxCount$; x++,y++,z--){
if(y >= this.$imageMaxCount$){
y=0;
}
if(this.$arrMapObjects$[y]==null || y==i){
continue;
}
this.$arrMapObjects$[y].style.zIndex = z;
}
if(this.$isNeedMapReset$){
this.clearMap();
this.$isNeedMapReset$ = false;
}
for(var i=0; i<this.$arrIcons$.length; i++){
this.$arrIcons$[i].visible();
}
for(var i=0; i<this.$arrMessages$.length; i++){
this.$arrMessages$[i].visible();
}
E[0](this.$status$.getPos());
if(this.$scaler$!=null) this.$scaler$.set(this.$status$);
this.$isMapLoaded$ = true;
if(!this.$isMoving$){
this.$isMapOperate$ = true;
}
};
NTMap.prototype.$onWindowMouseOut$=function(e){
if(!e.relatedTarget){
this.$onMouseUp$(e);
}
};
NTMap.prototype.moveTo = function(a){
if(arguments.length==0 && a==null) return false;
if(!this.$isMapInstanced$){
this.$status$.setPos(a);
}
if(!this.$isMapOperate$) return false;
this.$isMapOperate$ = false;
var b = NTGeoUtil.LonLat2Pixel(a,this.$status$);
var mx = s(this.$MapPlate$, "left") - (b.x-this.$status$.getSize().x/2);
var my = s(this.$MapPlate$, "top") - (b.y-this.$status$.getSize().y/2);
if(Math.abs(s(this.$MapPlate$, "left") - mx) > 5000 || Math.abs(s(this.$MapPlate$, "top") - my) > 5000){
this.$status$.setPos(a);
this.$isNeedMapReset$ = true;
this.reload();
}else{
this.$isMoving$ = true;
this.$status$.setPos(a);
this.makeMapImage();
var m = new NTMapCtrl(this.$MapPlate$);
m.autoScrollTo(mx,my,this.$DoubleClickMoved$);
}
};
NTMap.prototype.$onImageMoved$ = function(a){
this.$isMoving$ = false;
var i=this.$MapImageIndex$ % this.$imageMaxCount$;
$move$(this.$arrMapObjects$[i], -s(this.$MapPlate$, "left"), -s(this.$MapPlate$, "top"));
this.buildIcon();
this.$buildMsg$();
if(this.$isMapLoaded$){
this.$arrMapObjects$[i].style.visibility = "visible";
this.$isMapOperate$ = true;
}
};
NTMap.prototype.reload = function(){
if(!this.$isMapInstanced$ && !this.$isMapOperate$) return false;
return this.makeMapImage()? true: false;
};
NTMap.prototype.makeMapImage = function(){
this.$isMapOperate$ = false;
this.$isMapLoaded$ = false;
this.$MapImageIndex$ = ++this.$MapImageIndex$ % this.$imageMaxCount$;
var stl, i=this.$MapImageIndex$;
if(this.$arrMapObjects$[i]==null){
this.$arrMapObjects$[i] = $createImage$("", this.$status$.getSize().x, this.$status$.getSize().y);
stl = this.$arrMapObjects$[i].style;
stl.position = "absolute";
NTEvent.add(this.$arrMapObjects$[i],'load',this.$ImageLoadHandler$);
this.$MapPlate$.appendChild(this.$arrMapObjects$[i]);
}else{
stl = this.$arrMapObjects$[i].style;
stl.width = this.$status$.getSize().x + "px";
stl.height = this.$status$.getSize().y + "px";
setAlpha(this.$arrMapObjects$[i],100);
}
stl.visibility = "hidden";
stl.zIndex=this.$imageMaxCount$+50;
this.$arrMapObjects$[i].src = NTUrl.create(this.$status$,(this.$mapServer$||null));
return this.$arrMapObjects$[i];
};
NTMap.prototype.clearMap = function(a){
for(var i=0; i<this.$arrMapObjects$.length; i++){
if(this.$arrMapObjects$[i]==null || i == this.$MapImageIndex$ % this.$imageMaxCount$ || (a!=null && this.$arrMapObjects$[i]==a)) continue;
this.$arrMapObjects$[i].style.visibility = "hidden";
}
};
NTMap.prototype.setZoom = function(a,b,c){
if(this.$status$.getScale()==a && this.$status$.getZoom()==b){
return false;
}
if(c && this.$isAutoLoad$ && this.$isMapInstanced$ && this.$isMapLoaded$){
for(var i=0; i<this.$arrIcons$.length; i++){
this.$arrIcons$[i].hide();
}
for(var i=0; i<this.$arrMessages$.length; i++){
this.$arrMessages$[i].hide();
}
setAlpha(this.$IconPlate$, 0);
if(this.$scalectl$ && this.$scalectl$.iswork()){
this.clearMap();
this.$scalectl$.stop();
}else{
var $img$ = this.$arrMapObjects$[this.$MapImageIndex$];
this.clearMap($img$);
this.$scalectl$ = new NTMapScaleCtrl($img$);
this.$scalectl$.autoChangeScale(this.$status$,a,b,function(){
});
}
}
this.$status$.setScale(a);
this.$status$.setZoom(b);
if(this.$zoomTool$)
this.$zoomTool$.setStatus(this.$status$);
this.$isNeedMapReset$ = true;
if(this.$isAutoLoad$){
if(this.reload())
E[0](this.$status$.getPos());
}
};
NTMap.prototype.getZoom = function(){
return {scale: this.$status$.getScale(), zoom: this.$status$.getZoom()};
};
NTMap.prototype.setPalette = function(a){
this.$status$.setPalette(a);
this.$isNeedMapReset$ = true;
if(this.$isAutoLoad$){
this.reload();
}
};
NTMap.prototype.addParam = function(a,b){
this.$status$.addParam(a,b);
};
NTMap.prototype.removeParam = function(a){
this.$status$.removeParam(a);
};
NTMap.prototype.getPos = function(){
return this.$status$.getPos();
};
NTMap.prototype.addRoute = function(){
for(var a=0; a<arguments.length; a++){
this.$status$.addRoute(arguments[a]);
}
if(this.$isAutoLoad$){
this.reload();
}
};
NTMap.prototype.removeRoute = function(){
var r = false;
if(arguments.length > 0){
for(var i=0; i<arguments.length; i++){
r=this.$status$.removeRoute(arguments[i]);
}
}else{
if(this.$status$.getRoute().length>0){
this.$status$.clearRoute();
r=true;
}
}
if(r && this.$isAutoLoad$){
this.reload();
}
};
NTMap.prototype.getRouteList = function(){
if(!this.$status$.getRoute().length) return null;
return this.$status$.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 = $loadPng$(a,b,c,true,"object");
this.$BaseContainer$.appendChild(this.center);
this.center.style.zIndex=900;
this.center.style.visibility = "hidden";
};
NTMap.prototype.addBackground = function(a){
if(a==null) return;
this.$background$ = $createDiv$("bgi","absolute",0,0);
$resize$(this.$background$, this.$status$.getSize().x, this.$status$.getSize().y);
this.$background$.style.backgroundImage = "url(" + a.src + ")";
this.$BaseContainer$.appendChild(this.$background$);
this.$background$.style.zIndex=10;
this.$background$.style.visibility = "hidden";
};
NTMap.prototype.addIcon = function(){
if(typeof arguments[0] == "array"){
}else{
}
for(var i = 0; i<arguments.length; i++){
var a = arguments[i];
a.addDocument(this.$MapPlate$,301);
this.$arrIcons$.push(arguments[i]);
}
if(this.$isMapLoaded$){
this.buildIcon();
this.$buildMsg$();
}
};
NTMap.prototype.getIcon = function(a){
var $temp$ = new Array();
for(var i=0; i<this.$arrIcons$.length; i++){
if(a && a!=this.$arrIcons$[i].getGroup()){
continue;
}
$temp$.push(this.$arrIcons$[i]);
}
return $temp$;
};
NTMap.prototype.clearIcon = function(a){
var $temp$ = new Array();
for(var i=0; i<this.$arrIcons$.length; i++){
if(a && a!=this.$arrIcons$[i].getGroup()){
$temp$.push(this.$arrIcons$[i]);
continue;
}
this.$arrIcons$[i].remove();
}
this.$arrIcons$ = $temp$;
};
NTMap.prototype.buildIcon = function(){
for(var i=0; i<this.$arrIcons$.length; i++){
var a=this.$arrIcons$[i];
if(a.getImage()==null) continue;
var $icon$ = a.getImage();
if(a==null || a.getPos()==null) continue;
var p = NTGeoUtil.LonLat2Pixel(a.getPos(),this.$status$);
$move$($icon$, p.x - $icon$.offsetWidth/2 - s(this.$MapPlate$, "left"), p.y - $icon$.offsetHeight - s(this.$MapPlate$, "top"));
$move$(a.getCather(), p.x - $icon$.offsetWidth/2 - s(this.$MapPlate$, "left"), p.y - $icon$.offsetHeight - s(this.$MapPlate$, "top"));
var is = a.getShadow();
if(is!=null){
$move$(is, s($icon$,"left"), new Number(s($icon$,"top")) + $icon$.offsetHeight-is.offsetHeight);
is.style.visibility = "visible";
}
$icon$.style.visibility = "visible";
}
};
NTMap.prototype.addMsg = function(a){
if(this.$popup$){
return false;
}
var d = a.createDocument(this.$MapPlate$);
this.$arrMessages$.push(a);
a.moveTo(NTGeoUtil.LonLat2Pixel(a.getPos(),this.$status$));
return true;
};
NTMap.prototype.openMsg = function($pos$,a){
if(!this.$popup$ || !$pos$){
alert("return");
return;
}
this.$popup$.decorate({color:a.bgcolor, border: a.bordercolor, max:a.max});
this.$popup$.setPos($pos$);
this.$popup$.replaceContent({title:"", body:a.content});
this.$arrMessages$[0]=this.$popup$;
this.$popup$.moveTo(NTGeoUtil.LonLat2Pixel($pos$,this.$status$));
this.$popup$.open();
return this.$popup$;
};
NTMap.prototype.$buildMsg$ = function(){
for(var i=0; i<this.$arrMessages$.length; i++){
if(this.$arrMessages$[i]==null || this.$arrMessages$[i].getPos()==null) continue;
var p = NTGeoUtil.LonLat2Pixel(this.$arrMessages$[i].getPos(),this.$status$);
this.$arrMessages$[i].moveTo(p);
}
};
NTMap.prototype.loadToolbar = function(a){
if(!a) a = NTZoomToolbar.DEFAULT;
a.setParent(this.$BaseContainer$);
a.setStatus(this.$status$);
a.onChange(this.$ChangeZoomHandler$);
a.load();
this.$zoomTool$ = a;
};
NTMap.prototype.loadScalebar = function(){
this.$scaler$ = new NTScaler(this.$BaseContainer$);
};
NTMap.prototype.setProperty = function(a,b){
if(a=="autoload"){
this.$isAutoLoad$ = b;
}
if(a=="url"){
this.$mapServer$ = b;
}
if(a=="image"){
$UtilImagePath$ = new Image();
$UtilImagePath$.src = b;
}
};
$addWindow$('NTMap', NTMap);
$addWindow$('NTSize', NTSize);
$addWindow$('NTIcon', NTMapIcon);
$addWindow$('NTImage', NTImage);
$addWindow$('NTColor',NTColor);
$addWindow$('NTLatLng', NTLatLng);
$addWindow$('NTRoute', NTRoute);
$addWindow$('NTPopup', NTPopup);
$addWindow$('NTZoomToolbar', NTZoomToolbar);
$addWindow$('NTResizer', NTResizer);
$addWindow$('eventHandler',Object.eventHandler);
$addWindow$('NTEvent', NTEvent);
$TimeOutHandler$(NTMapCtrl);
$TimeOutHandler$(NTMapScaleCtrl);
$TimeOutHandler$(NTResizer);
})();

