/* 
Copyright 2006 NAVITIME JAPAN CO.,LTD. All Rights Reserved.
Auther by masakazu yoshida
*/
(function() {
var Lo = new Image(); //Lo.src="item.png";
var Ab = document;
function $() {
var elements = new Array();
for (var i = 0; i < arguments.length; i++) {
var element = arguments[i];
if (typeof element == 'string')
element = Ab.getElementById(element);
if (arguments.length == 1)
return element;
elements.push(element);
}
return elements;
}
function Al(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 Dt(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 Wr(e){
if(NTUserAgent.type==1){
return e.target.className;
}else if(NTUserAgent.type==3){
return e.target.className;
}else{
return e.target.className;
}
};
function Zi(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 Eb(a,b,c,d){
var r = Ab.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 Fb(u,w,h){
var r = Ab.createElement("img");
if(u!=null && u!="")r.src = u;
if(w!=null) r.width = w;
if(h!=null)r.height = h;
return r;
}
function Si(a){
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 Gl(a){
if(b==null) b=0;
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){
Gl(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 Ty(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(Ab.body){
Ab.body.scroll=a?"auto":"no"
if(window.innerHeight){
var s = Ab.body.style;
s.height=a?"auto":window.innerHeight-32
s.width=a?"auto":window.innerWidth-32
s.overflow=a?"visible":"hidden"
}
}else if(Ab.height){
if(a && Ab._height){
Ab.height=Ab._height
delete Ab._height
Ab.width=Ab._width
delete Ab._width
window.onresize=window._resize
}
if(!a){
if(!Ab._height){
Ab._height=Ab.height
Ab._width=Ab.width
window._resize=window.onresize
window.onresize=new Function("if(window._resize)_resize();scrollbar(false)")
}
Ab.height=window.innerHeight
Ab.width=window.innerWidth
}
}
}
var E = [
function(){(window["onMapLoad"] || EmptyFunction)();},
function(){(window["onMapMove"] || EmptyFunction)();},
];
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;
s.filter='progid:DXImageTransform.Microsoft.alpha(opacity='+b+')';
}
function Ji(b,w,h,p,c){
var a;
if(NTUserAgent.type==1 && NTUserAgent.version<7){
a = Eb(null,p ? "relative" : "absolute", 0, 0);
var s = a.style;
s.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="+b+")";
if(w) s.width = w+"px";
if(h) s.height = h+"px";
if(c) a.className = c;
}else{
a = Fb(b,w,h);
a.style.position="absolute";
if(c) a.className = c;
}
return a;
}
function Om(u,x,y,w,h,p,c){
var a=Eb("",p ? "relative" : "absolute", 0, 0);
a.style.overflow = "hidden";
Np(a,w,h);
var i = new Image(); i.src=u;
var b=Ji(u,i.width, i.height, false, c);
a.appendChild(b);
Br(b,-x, -y);
if(c) a.className = c;
return a;
}
function Br(a,b,c){
var s = a.style;
s.left = isNaN(b)?b:b+'px';
s.top= isNaN(c)?c:c+'px';
}
function Np(a,b,c){
var s = a.style;
s.width= isNaN(b)?b:b+'px';
s.height = isNaN(c)?c:c+'px';
}
var NTHashMap = function(){
this._map = new Array();
};
NTHashMap.prototype.put = function(a,b){
this._map[this._map.length] = {key:a,value:b};
};
NTHashMap.prototype.get = function(a){
for(var i=0; i<this._map.length; i++){
if(this._map[i].key == a){
return this._map[i].value;
}
}
return null;
};
NTHashMap.prototype.size = function(a){
return this._map.length;
};
NTHashMap.prototype.toArray = function(a){
if(this.size()==0){
return null;
}
var ret = new Object();
for(var i in ret){
ret[i] = null;
}
for(var i=0; i<this._map.length; i++){
if(this._map[i].key != null && this._map[i].key != ""){
ret[this._map[i].key] = this._map[i].value
}
}
return ret;
}
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 Bw(a,b,c){
if(b!=null){
a=Dq(a,b)
}
if(c!=null){
a=Vf(a,c)
}
return a
}
function Wu(a,b,c){
while(a>c){
a-=c-b
}
while(a<b){
a+=c-b
}
return a
}
function Vf(a,b){
return Math.min(a,b)
}
function Dq(a,b){
return Math.max(a,b)
}
function Zu(a){
return a*Math.PI/180
}
NTLatLng.prototype.latRadians=function(){
return Zu(Bw(this.Latitude/3600000,-90,90))
};
NTLatLng.prototype.lngRadians=function(){
return Zu(Wu(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);
var NTPoint = function(x, y) {};
NTPoint.prototype.alert=function(){
alert("aaa")
};
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);
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);
}
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;
};
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.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 = Ab.body;
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.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 new NTZoomToolValue(a,b);
};
NTZoomToolbar.prototype.setParent = function(a){
this.parent = a;
};
NTZoomToolbar.prototype.onChange = function(a){
this.changedFunc = a;
};
NTZoomToolbar.prototype.setInitZoom = function(a,b){
for(var i=0; i<this.zoomContainer.length; i++){
var z = this.zoomContainer[i];
if(a==z.getScale() && b==z.getZoom()){
this._initialIdx = i;
break;
}
}
};
NTZoomToolbar.prototype.onMouseDown = function(e){
this.Gb.onMouseDown(e);
}
NTZoomToolbar.prototype.onMouseMove = function(e){
this.Gb.onMouseMove(e);
}
NTZoomToolbar.prototype.onMouseUp = function(e){
CancelBubble(e);
var a = this.Gb.onMouseUp(e);
this.scrollTo(s(this.Sw,"top"));
}
NTZoomToolbar.prototype.onRailClick = function(e){
if(e.target.parentNode != this.Gw){
return false;
}
var y = NTUserAgent.type == 2?Dt(e)-104: Dt(e);
this.scrollTo(y);
};
NTZoomToolbar.prototype.scrollTo = function(a,b){
if(b==null) b=false;
var idx = Math.ceil((a-1) / this._range1);
if(idx >= this.zoomContainer.length){
return false;
}
var ztv = this.zoomContainer[idx];
this.Sw.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.Is = Eb("zoomToolbar","relative","10px","0px");
style = this.Is.style;
style.zIndex=901;
style.width = "26px";
style.padding = "2px";
this.parent.appendChild(this.Is);
this.Lf = Om(Lo.src, 15, 50, 20, 20, 'relative', '');
style = this.Lf.style;
style.left = '3px';
style.top = '2px';
this.Is.appendChild(this.Lf);
this.Gw = Om(Lo.src, 55, 50, 20, this.zoomContainer.length * this._range1 + 5, 'relative', '');
style = this.Gw.style;
style.left = '3px';
style.top = '0px';
this.Is.appendChild(this.Gw);
this.Tf = Om(Lo.src, 35, 50, 20, 20, 'relative', '');
style = this.Tf.style;
style.left = '3px';
style.top = '0px';
this.Is.appendChild(this.Tf);
this.Sw = Om(Lo.src, 0, 65, 15, 7, 'absolute', '');
style = this.Sw.style;
style.left = '2px';
style.top = '1px';
this.Gw.appendChild(this.Sw);
var Nu = this.Sw.setCapture?this.Sw:window;
NTEvent.add(this.Sw,'mousedown',this.MouseDownHandler);
NTEvent.add(Nu,'mousemove',this.MouseMoveHandler);
NTEvent.add(Nu,'mouseup',this.MouseUpHandler);
NTEvent.add(this.Gw, 'click', this.RailClickHandler);
NTEvent.add(this.Tf,'mouseover',this.MouseOverHandler);
NTEvent.add(this.Lf,'mouseover',this.MouseOverHandler);
NTEvent.add(this.Sw,'mouseover',this.MouseOverHandler);
NTEvent.add(this.Gw,'mouseover',this.MouseOverHandler);
NTEvent.add(this.Tf,'mouseout',this.MouseOutHandler);
NTEvent.add(this.Lf,'mouseout',this.MouseOutHandler);
NTEvent.add(this.Sw,'mouseout',this.MouseOutHandler);
NTEvent.add(this.Gw,'mouseout',this.MouseOutHandler);
NTEvent.add(this.Tf,'click',this.PlusClickHandler);
NTEvent.add(this.Lf,'click',this.MinusClickHandler);
this.Gb = new NTMover(this.Sw);
this.Gb.downTarget=this.Sw;
this.Gb.setAvailableArea(new NTSize(2,1), new NTSize(1,(s(this.Gw,"height")-s(this.Sw,"height")-5)));
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.Sw,"top") <= 1){
return false;
}
this.scrollTo(s(this.Sw,"top") - this._range1, true);
};
NTZoomToolbar.prototype.onPlusClick = function(e){
if(s(this.Sw,"top") >= this.zoomContainer.length * this._range1 + 1){
return false;
}
this.scrollTo(new Number(s(this.Sw,"top")-1) + 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")-22;
var stl;
this._sc = Eb('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 = Eb('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 = Eb('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 Gh(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=Gh(e);
var h=Math.round(125*g/(2*e));
return{
length:h,display:g+" "+f
}
};
var NTPopup = function(a,b){
this._pos = a;
this._titles = new Array();
this._contents = new Array();
this._div = Eb("","relative",0,0);
this._div.className = "object";
var s = this._div.style;
s.cursor = "default";
s.visibility = "hidden";
this._bgfactor = new NTPopupFactor();
this.spaceX = 18;
this.spaceY = 24;
this.max_width = 450;
this.max_height = 200;
this.Rq = "#FFF";
this.Iy = "#949494";
if(b!=null){
if(b['source']!=null){
Lo = new Image();
Lo.src = b['source'];
}
if(b['maxsize']!=null){
this.max_width = b['maxsize'][x];
this.max_height = b['maxsize'][y];
}
if(b['bgcolor']!=null) this.Rq = b['bgcolor'];
if(b['bordercolor']!=null) this.Iy = b['bordercolor'];
}
this.closeClickHandler = this.eventHandler("onCloseClick");
};
NTPopup.prototype.createDocument = function(a){
var bgobj = new Array();
this._bgfactor.top = No(25, 0, 220-(25-this.spaceX)*2, 25, 1, 0, 0, 0, this.Rq,true, this.Iy );
this._bgfactor.middle = No(0, 0, 240+20, 50-20, 0, 1, 1, 0, this.Rq,true, this.Iy );
this._bgfactor.bottom = No(25, 0, 220-(25-this.spaceX)*2, 25, 0, 0, 0, 1, this.Rq,true, this.Iy );
this._bgfactor.tail = Jm(Lo.src,50,0,100,50,0,-1,true,"object");
this._bgfactor.topleft = Jm(Lo.src,0,0,25,25,0,0,false,"object");
this._bgfactor.topright = Jm(Lo.src,25,0,25,25,0,0,false,"object");
this._bgfactor.bottomleft = Jm(Lo.src,0,25,25,25,0,0,false,"object");
this._bgfactor.bottomright = Jm(Lo.src,25,25,25,25,0,0,false,"object");
this._bgfactor.shadow = Jm(Lo.src,150,0,300,150,0,0,false,"static");
this._bgfactor.close = Jm(Lo.src,0,50,15,15,0,0,false,"object");
this._bgfactor.close.style.cursor = "pointer";
NTEvent.add(this._bgfactor.close, 'click', this.closeClickHandler);
var bg = this._bgfactor.getFactor();
for(var i=0; i< bg.length; i++){
this._div.appendChild(bg[i]);
}
for(var o=0; o<this._contents.length; o++){
this._div.appendChild(this._contents[o]);
}
this._div.style.position = "absolute";
a.appendChild(this._div);
return this._div;
};
NTPopup.prototype.getDocument = function(){
return this._div;
};
NTPopup.prototype.getPos = function(){
return this._pos;
};
NTPopup.prototype.addContent = function(a,b){
this._titles.push(a);
var style = b.style;
b.className = "object";
style.visibility = "hidden";
style.position = "absolute";
Br(b,this.spaceX,this.spaceY);
this._contents.push(b);
};
NTPopup.prototype.resize = function(a,b){
var style;
if(!a && !b){
if(this._contents.length == 0) return;
var mw=0, mh=0;
for(var i=0; i<this._contents.length; i++){
style = this._contents[i].style;
if(this._contents[i].offsetWidth > mw){
if(this._contents[i].offsetWidth > this.max_width){
mw = this.max_width;
style.width = this.max_width - this.spaceX * 2 + "px";
style.overflowX = "scroll";
}else{
mw = this._contents[i].offsetWidth;
}
}
if(this._contents[i].offsetHeight > mh){
if(this._contents[i].offsetHeight > this.max_height){
mh = this.max_height;
style.height = this.max_height - this.spaceY + "px";
style.overflowY = "scroll";
style.paddingRight = "18px";
}else{
mh = this._contents[i].offsetHeight;
}
}
}
a = mw<150?150:mw;
b = mh<50?50:mh;
}
style = this._div.style;
style.width = a + this.spaceX * 2 + "px";
style.height = b + this.spaceY * 2 + this._bgfactor.tail.offsetHeight + "px";
Np(this._bgfactor.middle, a+(this.spaceX*2)-2, b-(25-this.spaceY/2));
Np(this._bgfactor.top, a-(25-this.spaceX)*2, 24);
Np(this._bgfactor.bottom, a-(25-this.spaceX)*2,24);
Br(this._bgfactor.topright, a + this.spaceX -(25 - this.spaceX), 0);
Br(this._bgfactor.bottomleft, 0, b+(this.spaceY/2));
Br(this._bgfactor.bottomright, a + this.spaceX -(25 - this.spaceX), b+(this.spaceY/2));
Br(this._bgfactor.tail, (a-100)/2+this.spaceX,-1);
Br(this._bgfactor.shadow, this._div.offsetWidth/2 - 50, this._div.offsetHeight - this._bgfactor.shadow.offsetHeight);
Br(this._bgfactor.close, this._div.offsetWidth-this._bgfactor.close.offsetWidth-this.spaceX/3, this.spaceY/3);
};
NTPopup.prototype.getContent = function(){
for(var i=0; i<this._contents.length; i++){
}
};
NTPopup.prototype.setDepth = function(a){
this._div.style.zIndex = a;
var bg = this._bgfactor.getFactor();
for(var i=0; i< bg.length; i++){
bg[i].style.zIndex = a;
}
for(var i=0; i<this._contents.length; i++){
this._contents[i].style.zIndex=a;
}
this._bgfactor.shadow.style.zIndex = a-100;
};
NTPopup.prototype.open = function(){
this._div.style.visibility = "visible";
for(var i=0; i<this._contents.length; i++){
if(i==0)
this._contents[i].style.visibility = "visible";
}
};
NTPopup.prototype.close = function(){
this._div.style.visibility = "hidden";
for(var i=0; i<this._contents.length; i++){
this._contents[i].style.visibility = "hidden";
}
};
NTPopup.prototype.foreground = function(){
this._div.style.zIndex |= 100;
var bg = this._bgfactor.getFactor();
for(var i=0; i< bg.length; i++){
bg[i].style.zIndex |= 100;
}
for(var i=0; i<this._contents.length; i++){
this._contents[i].style.zIndex|=100;
}
};
NTPopup.prototype.back = function(){
this._div.style.zIndex &=~ 100;
var bg = this._bgfactor.getFactor();
for(var i=0; i< bg.length; i++){
bg[i].style.zIndex &=~ 100;
}
for(var i=0; i<this._contents.length; i++){
this._contents[i].style.zIndex &=~ 100;
}
};
NTPopup.prototype.remove = function(){
Gl(this._div);
};
NTPopup.prototype.onCloseClick = function(){
this.close();
};
function Jm(u,ix,iy,w,h,x,y,p,c){
var t = Om(u, ix, iy, w, h, p, c);
var stl = t.style;
if(x) stl.left = x + "px";
if(y) stl.top = y + "px";
return t;
};
function No(x,y,w,h,bt,bl,br,bb,c,p,bc){
var t = Eb("", p ? "relative" : "absolute", x ,y);
var stl = t.style;
stl.fontSize = "0";
if(bt && bt>0){
stl.borderTop = bt + "px " + bc + " solid";
h -= 1;
}
if(bl && bl>0){
stl.borderLeft = bl + "px " + bc + " solid";
w -= 1;
}
if(br && br>0){
stl.borderRight = br + "px " + bc + " solid";
w -= 1;
}
if(bb && bb>0){
stl.borderBottom = bb + "px " + bc + " solid";
h -=1 ;
}
Np(t,w,h);
stl.backgroundColor = c;
t.className = "object";
return t;
};
var NTPopupFactor = function(){
this.topleft =Eb('',"absolute", 0, 0);
this.topright =Eb('',"absolute", 0, 0);
this.bottomleft =Eb('',"absolute", 0, 0);
this.bottomright =Eb('',"absolute", 0, 0);
this.top =Eb('',"relative", 0, 0);
this.middle =Eb('',"relative", 0, 0);
this.bottom =Eb('',"relative", 0, 0);
this.tail =Eb('',"relative", 0, 0);
this.shadow =Eb('',"absolute", 0, 0);
this.close =Eb('',"absolute", 0, 0);
};
NTPopupFactor.prototype.getFactor = function(){
return [this.shadow, this.top, this.middle, this.bottom, this.tail,this.topleft, this.topright, this.bottomleft, this.bottomright, this.close];
};
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 x1 = new Number(s(this.src,"left"));
var x2 = new Number(this.reachX)-x1;
var x3 = Math.abs(x2/5)<1? (x2>0)?1:-1 : x2/5;
var y1 = new Number(s(this.src, "top"));
var y2 = new Number(this.reachY)-y1;
var y3 = Math.abs(y2/5)<1? (y2>0)?1:-1 : y2/5;
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()",(NTUserAgent.type==4 || NTUserAgent.type==2)?5: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 os = new NTSize(NTGeoUtil.getLonFactor(a) , NTGeoUtil.getLatFactor(a));
a.setScale(c);
a.setZoom(z);
var ns = new NTSize(NTGeoUtil.getLonFactor(a) , NTGeoUtil.getLatFactor(a));
var rw = os.x/ns.x;
var rh = os.y/ns.y;
this.endSiz = new NTSize(Math.floor(this.startSiz.x * rw),Math.floor(this.startSiz.y * rh));
this.endPos = new NTSize(this.startPos.x - (Math.floor(this.startSiz.x * rw)-this.startSiz.x)/2 , this.startPos.y - (Math.floor(this.startSiz.y * rh)-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){
clearTimeout(this.timeoutId);
if(this.endFunction) this.endFunction();
return false;
}
this.timeoutId = this.setTimeout("this.autoChangeScale()",(NTUserAgent.type==4 || NTUserAgent.type==2)?5:10);
};
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);
};
var NTMapIcon = function(a,b,c,d) {
this.Lr=a;
this.Hd = b;
this.Rf = d;
this.Jo = c;
this.Lx;
this.Un;
this.Initialize();
};
NTMapIcon.prototype.Initialize = function(){
this.Lx = Ji(this.Hd.src, this.Hd.width,this.Hd.height);
this.Lx.className = (this.Jo !=null && this.Jo != "") ? "object" : "static";
this.Lx.style.visibility = "hidden";
if(this.Rf){
this.Un = Ji(this.Rf.src, this.Rf.width,this.Rf.height);
this.Un.className = "static";
this.Un.style.visibility = "hidden";
}
}
NTMapIcon.prototype.addDocument = function(a,b){
this._parent = a;
this._zindex = b;
this.Lx.style.zIndex=this._zindex;
this._parent.appendChild(this.Lx);
if(this.Un){
this.Un.style.zIndex=this._zindex-100;
this._parent.appendChild(this.Un);
}
}
NTMapIcon.prototype.addEvent = function(a,b,c){
};
NTMapIcon.prototype.getId = function(){
return this.Jo;
}
NTMapIcon.prototype.getImage = function(){
return this.Lx;
};
NTMapIcon.prototype.getShadow = function(){
return this.Un;
};
NTMapIcon.prototype.getPos = function(){
return this.Lr;
};
NTMapIcon.prototype.remove = function(){
var len = this._parent.childNodes.length;
for(var i=0; i<len; i++){
if(this._parent.childNodes[i]==this.Lx){
this._parent.removeChild(this._parent.childNodes[i]);
}
if(this.Un != null && this._parent.childNodes[i]==this.Un){
this._parent.removeChild(this._parent.childNodes[i]);
}
}
this.Lx = null;
this.Un = null;
}
NTMapIcon.prototype.rebuild = function(){
this.Initialize();
this.addDocument(this._parent,this._zindex);
}
var NTImage = function(a,b,c) {
this.src=a;
this.width=b;
this.height=c;
};
NTImage.prototype.getImage = function(){
return Fb(this.src,this.width,this.height);
}
var NTGeoUtil = function() {};
NTGeoUtil.getLonFactor = function(a){
var b = new Array(200000,33333,2727,818,163);
return b[a.getScale()]/a.getZoom();
};
NTGeoUtil.getLatFactor = function(a){
if(a.getPos().getLongitude() > 441230691 && a.getPos().getLatitude() > 86737111 && a.getPos().getLongitude() < 525430675 && a.getPos().getLatitude() < 165297104){
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));
//alert(moveX+','+ moveY);
//移動的even
document.control.move_lat.value = (new Number(status.getPos().getLatitude()) - new Number(lat));
document.control.move_lon.value = (new Number(status.getPos().getLongitude()) + new Number(lon));

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;
}
};
var NTScale = function() {
};
NTScale.getScale = function(a){
};
var NTUrl = function() {};
NTUrl._URLBASE = "http://192.168.1.10/tw003gps/ImageRasterNV.jsp";
NTUrl.create = function(a,b){
var c=this._URLBASE;
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=" + 'large' ;
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 == b){
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;//原本是C  不給他放出發及目的的ICON是'0' 
this.toll=d;
};
NTRouteIcon.START = "10001";
NTRouteIcon.END = "10002";
NTRouteIcon.OTHER = "10003";
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 = Eb('',"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){
	////////////////////////
	//一移動就關MS訊息視窗
	////////////////////////
	moveXY_Ms();
if(e.button!=0 && e.button!=1){
CancelBubble(e);
return false;
}
if(this.srcElement.setCapture) this.srcElement.setCapture();
	
this.differencialX = e.clientX - Al(e);
this.differencialY = e.clientY - Dt(e);

this.defaultPos = new NTSize(s(this.srcElement, "left"),s(this.srcElement, "top"));
this.mouseDownPos = new NTSize(Al(e), Dt(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);
};
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;
}
var NTMap = function(a,b,c) {
this.Nl = false;
this.Pv = false;
this.Df = $(a);
this.Hl = NTSize.parse(this.Df);
var s;
this.Tv = new NTMapStatus(NTLatLng.parse(this.Df.innerHTML),this.Hl,0,3,3);
this.Df.innerHTML="";
s = this.Df.style
s.textAlign="left";
s.overflow="hidden";
s.position="relative";
this.Sk = Eb("MovingContainer","relative", "0px", "0px");
s = this.Sk.style;
s.position = "absolute";
s.zIndex = 12;
this.Sk.className = "container";
this.Df.appendChild(this.Sk);
this.Zh = Eb("IconContainer","absolute","0px","0px");
this.Zh.style.zIndex = 100;
Np(this.Zh, this.Df.offsetWidth, this.Df.offsetHeight);
this.Zh.className = "container";
this.Sk.appendChild(this.Zh);
this.Gt = new Array();
this.Us = 0;
this.Qx = 20;
this.Vi = c==false?false:true;
if(b!=null) this.Cc = b;
this.bF = false;
this.Bd = false;
this.Ok = null;
this.Yp = new Array();
this.Nx = new Array();
this.WindowLoadHandler= this.eventHandler("onLoad");
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);
};
NTMap.prototype.onLoad = function(){
if(this.center!=null){
this.center.style.visibility = "visible";
}
if(this.bgi!=null){
this.bgi.style.visibility = "visible";
}
var Nu = this.Sk.setCapture?this.Sk:window;
this.Ud = new NTMover(this.Sk);
this.Ud.downTarget=this.Sk;
NTEvent.add(this.Sk, 'mouseover', this.MouseOverHandler); 
NTEvent.add(this.Sk, 'mouseout',this.MouseOutHandler); 
NTEvent.add(this.Sk, 'dblclick',this.DoubleClickHandler);
NTEvent.add(this.Sk,'mousedown',this.MouseDownHandler);
NTEvent.add(Nu,'mousemove',this.MouseMoveHandler);
NTEvent.add(Nu,'mouseup',this.MouseUpHandler);
NTEvent.add(window,'mouseout',this.WindowMouseOutHandler);
NTEvent.add(this.Sk, 'DOMMouseScroll',this.WheelHandler);
NTEvent.add(this.Sk, 'mousewheel', this.WheelHandler);
NTEvent.add(Ab,'keypress',this.KeyPressHandler);
NTEvent.add(this.Sk, 'contextmenu', this.MenuHandler);
this.Nl=true;
if(this.Vi){
this.reload();
}else{
this.Tk=true;
}
};
NTMap.prototype.onContextMenu = function(e){
CancelBubble(e);
return false;
};
NTMap.prototype.onMouseOver = function(e){
if(NTUserAgent.type==1 && NTUserAgent.version==5) return false;
//p {cursor:url("cur_g6.cur");};
this.Sk.style.cursor = "pointer";

};
NTMap.prototype.onMouseOut = function(e){
if(NTUserAgent.type==1 && NTUserAgent.version==5) return false;
this.Sk.style.cursor = "default";
};
NTMap.prototype.onDblClick = function(e){
if(!this.Tk) return false;
if(e.target.className=="object") return false;
if(Wr(e)=="static" && NTUserAgent.type!=1){
}
if(NTUserAgent.type!=1 && NTUserAgent.version!=5){
this.Sk.style.cursor = "wait";
}
var a = Al(e);
var c = Dt(e);
if(Wr(e) == "static" && 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.Sk, "left");
c += s(this.Sk, "top");
}else{
if(NTUserAgent.type==2 || NTUserAgent.type==3){
if(e.target == this.Zh){
a += s(this.Sk, "left");
}else{
a -= s(this.Sk, "left");
}
}
if(NTUserAgent.type==2 || NTUserAgent.type==3){
if(e.target == this.Zh){
c += s(this.Sk, "top");
}else{
c -= s(this.Sk, "top");
}
}
}
a -=this.Hl.x/2;
c -=this.Hl.y/2;
CancelBubble(e);
var f=new NTSize(a,c);
E[1]();
this.moveTo(NTGeoUtil.pixel2LonLat(f,this.Tv));
};
NTMap.prototype.onMouseDown = function(e){
if(!this.Tk) return false;
if(e.target.className=="object"){
CancelBubble(e);
return;
}
this.Ud.onMouseDown(e);
};
NTMap.prototype.onMouseMove = function(e){
if(!this.Tk) return false;
if(e.target.className=="object"){
CancelBubble(e);
return;
}
this.Ud.onMouseMove(e);
};
NTMap.prototype.onMouseUp = function(e){
if(!this.Tk) return false;
if(e.target.className=="object"){
CancelBubble(e);
return;
}
var a = this.Ud.onMouseUp(e);
if(a){
this.Tv.setPos(NTGeoUtil.pixel2LonLat(a,this.Tv));
E[1]();
this.reload();
}
CancelBubble(e);
};
NTMap.prototype.onWheelScroll = function(e){
if(this.Ok==null || !this.Tk){
CancelBubble(e);
return;
}
var delta = 0;
if (e.wheelDelta) {
	//alert (e.wheelDelta) ;	
	if (e.wheelDelta >= 120){//判斷滑鼠滾輪是往上滾,放大
			
		up();
	}else if (e.wheelDelta <= -120 ){//若滑鼠滾輪是往下滾，縮小
		down();
	}
//delta = e.wheelDelta/120; 
if (NTUserAgent.type==4) delta = -delta;
} else if (e.detail) {
	if(e.detail <= -3 ){
		up();
	}else if (e.detail <= 3 ){
		down();
}
//delta = -e.detail/3;
}
if(delta == 1){
this.Ok.onMinusClick();
}
if(delta == -1){
this.Ok.onPlusClick();
}
CancelBubble(e);
};

NTMap.prototype.onKeyPress = function(e){
if(e.target.tagName == "INPUT" || e.target.tagName == "TEXTAREA") return;
if(e.target != Ab)
var lon = this.Tv.getPos().getLongitude();
var lat = this.Tv.getPos().getLatitude();
if(e.keyCode==37){
this.moveTo(NTGeoUtil.pixel2LonLat(new NTSize(-this.Hl.x/2,0), this.Tv));
CancelBubble(e);
}
if(e.keyCode==38){
this.moveTo(NTGeoUtil.pixel2LonLat(new NTSize(0,-this.Hl.y/2), this.Tv));
CancelBubble(e);
}
if(e.keyCode==39){
this.moveTo(NTGeoUtil.pixel2LonLat(new NTSize(this.Hl.x/2,0), this.Tv));
CancelBubble(e);
}
if(e.keyCode==40){
this.moveTo(NTGeoUtil.pixel2LonLat(new NTSize(0,this.Hl.y/2), this.Tv));
CancelBubble(e);
}
if(e.keyCode==187 || e.keyCode==107 || e.charCode == 43){
if(!this.Ok) return;
this.Ok.onPlusClick();
CancelBubble(e);
}
if(e.keyCode==189 || e.keyCode==109 || e.charCode == 45 || e.charCode == 61){
if(!this.Ok) return;
this.Ok.onMinusClick();
CancelBubble(e);
}
};
NTMap.prototype.onImageLoad = function(e){
var i=this.Us % this.Qx;
if(!this.Bd){
Br(this.Gt[i], -s(this.Sk, "left") , -s(this.Sk,"top"));
this.Gt[i].style.visibility = "visible";
this.buildIcon();
this.buildMsg();
}
if(NTUserAgent.type!=1 && NTUserAgent.version!=5){
this.Sk.style.cursor = "pointer";
}
for(var x=0,y=i,z=this.Qx+50; x<this.Qx; x++,y++,z--){
if(y >= this.Qx){
y=0;
}
if(this.Gt[y]==null || y==i){
continue;
}
this.Gt[y].style.zIndex = z;
}
if(this.bF){
this.clearMap();
this.bF = false;
}
setAlpha(this.Zh, 100);
E[0]();
if(this.Jg!=null) this.Jg.set(this.Tv);
this.Pv = true;
if(!this.Bd){
this.Tk = 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.Nl){
this.Tv.setPos(a);
}
if(!this.Tk) return false;
this.Tk = false;
var b = NTGeoUtil.LonLat2Pixel(a,this.Tv);
var mx = s(this.Sk, "left") - (b.x-this.Hl.x/2);
var my = s(this.Sk, "top") - (b.y-this.Hl.y/2);
if(Math.abs(s(this.Sk, "left") - mx) > 5000 || Math.abs(s(this.Sk, "top") - my) > 5000){
this.Tv.setPos(a);
this.bF = true;
this.reload();
}else{
this.Bd = true;
this.Tv.setPos(a);
this.makeMapImage();
var m = new NTMapCtrl(this.Sk);
m.autoScrollTo(mx,my,this.DoubleClickMoved);
}
};
NTMap.prototype.onImageMoved = function(a){
this.Bd = false;
var i=this.Us % this.Qx;
Br(this.Gt[i], -s(this.Sk, "left"), -s(this.Sk, "top"));
this.buildIcon();
this.buildMsg();
if(this.Pv){
this.Gt[i].style.visibility = "visible";
this.Tk = true;
}
};
NTMap.prototype.reload = function(){
if(!this.Nl && !this.Tk) return false;
var _img = this.makeMapImage();
};
NTMap.prototype.makeMapImage = function(){
this.Tk = false;
this.Pv = false;
this.Us = ++this.Us % this.Qx;
var stl, i=this.Us;
if(this.Gt[i]==null){
this.Gt[i] = Fb("", this.Hl.x, this.Hl.y);
stl = this.Gt[i].style;
stl.position = "absolute";
NTEvent.add(this.Gt[i],'load',this.ImageLoadHandler);
this.Sk.appendChild(this.Gt[i]);
}else{
stl = this.Gt[i].style;
stl.width = this.Hl.x + "px";
stl.height = this.Hl.y + "px";
setAlpha(this.Gt[i],100);
}
stl.visibility = "hidden";
stl.zIndex=this.Qx+50;
this.Gt[i].src = NTUrl.create(this.Tv,(this.Cc||null));
return this.Gt[i];
};
NTMap.prototype.clearMap = function(a){
for(var i=0; i<this.Gt.length; i++){
if(this.Gt[i]==null || i == this.Us % this.Qx || (a!=null && this.Gt[i]==a)) continue;
this.Gt[i].style.visibility = "hidden";
}
};
NTMap.prototype.setZoom = function(a,b,c){
if(this.Tv.getScale()==a && this.Tv.getZoom()==b){
return false;
}
if(c){
setAlpha(this.Zh, 0);
this.clearMap(this.Gt[this.Us]);
var scalectrl = new NTMapScaleCtrl(this.Gt[this.Us]);
scalectrl.autoChangeScale(this.Tv,a,b);
}else{
this.Tv.setScale(a);
this.Tv.setZoom(b);
}
E[0]();
this.bF = true;
this.reload();
};
NTMap.prototype.getZoom = function(){
return {scale: this.Tv.getScale(), zoom: this.Tv.getZoom()};
};
NTMap.prototype.setPalette = function(a){
this.Tv.setPalette(a);
this.bF = true;
this.reload();
};
NTMap.prototype.addParam = function(a,b){
this.Tv.addParam(a,b);
};
NTMap.prototype.getPos = function(){
return this.Tv.getPos();
};
NTMap.prototype.addRoute = function(){
for(var a=0; a<arguments.length; a++){
this.Tv.addRoute(arguments[a]);
}
this.reload();
};
NTMap.prototype.removeRoute = function(){
var r = false;
if(arguments.length > 0){
for(var i=0; i<arguments.length; i++){
r=this.Tv.removeRoute(arguments[i]);
}
}else{
if(this.Tv.getRoute().length>0){
this.Tv.clearRoute();
r=true;
}
}
if(r){
this.reload();
}
};
NTMap.prototype.getRouteList = function(){
return this.Tv.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 = Ji(a,b,c,"object");
this.Df.appendChild(this.center);
Br(this.center, Math.round(this.Df.offsetWidth/2-this.center.offsetWidth/2), Math.round(this.Df.offsetHeight/2-this.center.offsetHeight/2));
this.center.style.zIndex=900;
this.center.style.visibility = "hidden";
};
NTMap.prototype.addBackground = function(a){
this.bgi = Eb("bgi","absolute",0,0);
this.bgi.appendChild(a.getImage());
this.Df.appendChild(this.bgi);
this.bgi.style.zIndex=10;
this.bgi.style.visibility = "hidden";
};
NTMap.prototype.addIcon = function(){
for(var i = 0; i<arguments.length; i++){
var a = arguments[i];
a.addDocument(this.Sk,this.Yp.length + 201);

if(a.getId()!=null && a.getId()!=""){
	//alert(a.getId());
//NTEvent.add(a.getImage(), 'click', window.eventHandler("on"+a.getId()+"Click"));
NTEvent.add(a.getImage(), 'click', window.eventHandler("addInfo_map"));
//alert (eventHandler);

}


this.Yp.push(arguments[i]);
}
if(this.Pv){
this.buildIcon();
this.buildMsg();
}
};
NTMap.prototype.clearIcon = function(icon_id){
for(var i=0; i<this.Yp.length; i++){
//this.Yp[i].remove();
if (this.Yp[i].getId()== icon_id)
	{this.Yp[i].remove();
	}
}
//this.Yp = new Array();
};
NTMap.prototype.buildIcon = function(){
for(var i=0; i<this.Yp.length; i++){
var a=this.Yp[i];
if(a.getImage()==null) continue;
var im = a.getImage();
var p = NTGeoUtil.LonLat2Pixel(a.getPos(),this.Tv);
Br(im, p.x - im.offsetWidth/2 - s(this.Sk, "left"), p.y - im.offsetHeight - s(this.Sk, "top"));
var is = a.getShadow();
if(is!=null){
Br(is, s(im,"left"), new Number(s(im,"top")) + im.offsetHeight-is.offsetHeight);
is.style.visibility = "visible";
}
im.style.visibility = "visible";
}
};
NTMap.prototype.addMsg = function(a){
var p = NTGeoUtil.LonLat2Pixel(a.getPos(),this.Tv);
var d = a.createDocument(this.Sk);
a.resize();
a.setDepth(this.Nx.length + 400);
this.Nx.push(a);
Br(d,p.x - d.offsetWidth/2 - s(this.Sk, "left"), p.y - d.offsetHeight - s(this.Sk, "top"));
};
NTMap.prototype.buildMsg = function(){
for(var i=0; i<this.Nx.length; i++){
var p = NTGeoUtil.LonLat2Pixel(this.Nx[i].getPos(),this.Tv);
var d = this.Nx[i].getDocument();
Br(d, p.x - d.offsetWidth/2 - s(this.Sk, "left"), p.y - d.offsetHeight - s(this.Sk, "top"));
}
};
NTMap.prototype.loadToolbar = function(a){
if(!a) a = NTZoomToolbar.DEFAULT;
a.setParent(this.Df);
a.setInitZoom(this.Tv.getScale(), this.Tv.getZoom());
a.onChange(this.ChangeZoomHandler);
//a.load();不顯示放大縮小的Toolbar
this.Ok = a;
};
NTMap.prototype.loadScalebar = function(){
this.Jg = new NTScaler(this.Df);
};
Zi('NTMap', NTMap);
Zi('NTSize', NTSize);
Zi('NTIcon', NTMapIcon);
Zi('NTImage', NTImage);
Zi('NTColor',NTColor);
Zi('NTLatLng', NTLatLng);
Zi('NTRoute', NTRoute);
Zi('NTPopup', NTPopup);
Zi('NTZoomToolbar', NTZoomToolbar);
Zi('NTResizer', NTResizer);
Zi('eventHandler',Object.eventHandler);
Zi('NTEvent', NTEvent);
Ty(NTMapCtrl);
Ty(NTMapScaleCtrl);
Ty(NTResizer);
})();
/*
按ICON會有的動作
*/
function addInfo_map(){

	
}
