﻿String.prototype.trim = function()
 {
    return this.replace(/(^\s*)|(\s*$)/g, "");
};
Array.prototype.max = function()
 {
    var i, max = this[0];
    for (i = 1; i < this.length; i++)
     {
        if (max < this[i])
            max = this[i];
    }
    return max;
};
Array.prototype.min = function()
 {
    var i, min = this[0];
    for (i = 1; i < this.length; i++)
     {
        if (min > this[i])
            min = this[i];
    }
    return min;
};
function StopBubble(e)
 {
    if (e && e.stopPropagation)
        e.stopPropagation();
    else
        window.event.cancelBubble = true;
};
function StopDefault(e)
 {
    if (e && e.preventDefault)
        e.preventDefault();
    else
        window.event.returnValue = false;
    return false;
};
function StopDivBubble(id) 
{
    var all = document.getElementById(id);
    ZDEvent.addListener(all, "mousedown", StopBubble, false);
    ZDEvent.addListener(all, "mouseup", StopBubble, false);
    ZDEvent.addListener(all, "mousemove", StopBubble, false);
    ZDEvent.addListener(all, "dblclick", StopBubble, false);
    ZDEvent.addListener(all, "mouseout", StopBubble, false);
    ZDEvent.addListener(all, "click", StopBubble, false);
    ZDEvent.addListener(all, "mousewheel", StopBubble, false);
    ZDEvent.addListener(all, "contextmenu", StopBubble, false);
};
function GetImgSize(url)
 {
    var oImg = new Image();
    oImg.src = url;
    var size = [];
    size[0] = oImg.width;
    size[1] = oImg.height;
    return size;
};
function CreatDiv(pElement, id, left, top, position, zIndex, visibility, style, content) 
{
    this.obj = document.createElement("div");
    this.obj.id = id ? id : "infoDiv" + Math.random();
    this.obj.name = id ? id : "infoDiv" + Math.random();
    this.obj.style.left = parseInt(left) + "px";
    this.obj.style.top = parseInt(top) + "px";
    this.obj.style.position = position ? position : "absolute";
    this.obj.unselectable = "on";
    if (zIndex) this.obj.style.zIndex = zIndex;
    if (visibility) this.obj.style.visibility = visibility;
    if (style) this.obj.style.cssText = this.obj.style.cssText + ";" + style;
    if (content) this.obj.innerHTML = content;
    if (pElement != null)
        pElement.appendChild(this.obj);
    return this.obj;
};
function GetSize(obj)
 {
    var o = (typeof (obj) == "object") ? obj : document.getElementById(obj);
    var r = [o.offsetWidth, o.offsetHeight];
    if (o == document.body && !document.all) { r[1] = o.clientHeight; };
    if (!r[0]) { r[0] = o.clientWidth; };
    if (!r[0]) { r[0] = parseInt(o.style.width); };
    if (!r[1]) { r[1] = o.clientHeight; };
    if (!r[1]) { r[1] = parseInt(o.style.height); };
    if (!r[0] || !r[1])
     {
        var pw = o.parentElement;
        while (pw)
	 {
            if (!r[0] && pw.offsetWidth) { r[0] = pw.offsetWidth; };
            if (!r[1] && pw.offsetHeight) { r[1] = pw.offsetHeight; };
            if (r[0] && r[1]) { break; };
            pw = pw.parentElement;
        };
    };
    return r;
};
function GetAbsolutePos(obj)
 {
    var ow = [0, 0];
    var pw = obj;
    while (pw && pw.offsetParent) 
    {
        ow[0] += pw.offsetLeft;
        ow[1] += pw.offsetTop;
        pw = pw.offsetParent;
    };
    return ow;
};
function GetClientXY(evt, obj) 
{
    if (typeof evt.offsetX != "undefined") 
    {
        var pw = evt.target || evt.srcElement;
        var aw = [evt.offsetX, evt.offsetY];
        while (pw && pw != obj)
	 {
            if (pw.tagName == "AREA") { pw = pw.offsetParent || pw.parentElement; continue; }
            aw[0] += pw.offsetLeft;
            aw[1] += pw.offsetTop;
            pw = pw.offsetParent || pw.parentElement;
        };
        return [aw[0], aw[1]];
    }
    else if (typeof evt.pageX != "undefined") 
    {
        var aw = GetAbsolutePos(obj);
        return [evt.clientX - aw[0], evt.clientY - aw[1]];
    }
    else
    { return [0, 0]; }
};
function correctPNG() 
{
    var imgs = document.getElementsByName("PngImgs");
    for (var i = 0; i < imgs.length; )
     {
        var img = imgs[i];
        var strNewHTML;
        var imgID = (img.id) ? "id='" + img.id + "' " : "";
        var imgClass = (img.className) ? "class='" + img.className + "' " : "";
        var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
        var imgStyle = "display:inline-block;" + img.style.cssText;
        if (img.align == "left") imgStyle = "float:left;" + imgStyle;
        if (img.align == "right") imgStyle = "float:right;" + imgStyle;
        if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;
        strNewHTML = "<span unselectable ='on' " + imgID + imgClass + imgTitle + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" + "(src='" + img.src + "', sizingMethod='scale');\"></span>";
        img.outerHTML = strNewHTML;
    }
};
if (document.all) { document.write('<meta http-equiv="ImageToolBar" content="no"/>'); };
var ZDEvent = new Object();
ZDEvent.addListener = function(o, evType, f, capture)
 {
    if (o.addEventListener)
     {
        if (typeof (capture) == "undefined")
            capture = false;
        o.addEventListener(evType, f, capture);
    }
    else if (o.attachEvent)
        o.attachEvent("on" + evType, f);
    else
        eval("o.on" + evType + "=f;");
};
ZDEvent.removeListener = function(o, evType, f, capture)
 {
    if (o.removeEventListener)
     {
        if (typeof (capture) == "undefined")
            capture = false;
        o.removeEventListener(evType, f, capture);
     }
    else if (o.detachEvent)
        o.detachEvent("on" + evType, f);
    else
        eval("o.on" + evType + "=null;");
};
ZDEvent.clearEvent = function(o, evType)
{
    eval("o.on" + evType + "=null;");
};
var IMSOperType = {
    ZoomIn: 1001,
    ZoomOut: 1002,
    Drag: 1003,
    Restore: 1004,
    Erase: 1005,
    Refresh: 1006,
    SelectByHitting: 2001,
    SelectByRect: 2002,
    SelectByCircle: 2003,
    SelectByPolygon: 2004,
    SelectByLine: 2005,
    MeasureDistance: 3001,
    MeasureArea: 3002,
    OpenMagnifier: 3003,
    AddLabel: 3004,
    Add3DOutline: 3005,
    AddPoint: 3006,
    SelectPoint: 3007
};
var IMSMapType = {
    Grid: 0,
    Vector: 1,
    GridAndVector: 2
};
function IMSMaps(pDiv, mapType, mapConfig, HdfName) {
    this.xMinMap = 36557.6011008672;                      //整图的最小逻辑坐标
    this.yMinMap = 425.000122070313;
    this.xMaxMap = 92939.3577270508;                      //整图的最大逻辑坐标
    this.yMaxMap = 56806.7567482539;
    this.levelNum = 9;
    this.imgSize = 256;
    this.moveSpeed = 20;
    this.statusBarFlag = true;
    this.isShowOprImg = true;
    this.zoomRate = 1.5;
    this.backgroundImage = "url(images/mapgis.jpg)";
    this.errorImage = "images/transparence.gif";
    this.mapout = "images/mapgis.jpg";
    this.gridImageUrl = ["GetIMG.ashx"];
    this.vectImageUrl = ["GetMap.aspx"];
    this.setCoordPrec = 6;
    this.gridName = HdfName;
    this.magnifierSize = [200, 150];
    this.vectImageFormat = "gif";
    this.activeTool = "Pan";
    this.drawAction = "Pan";
    this.mapType = mapType;
    this.centerCoor = [0, 0];
    this.logicXlength = this.xMaxMap - this.xMinMap;
    this.logicYlength = this.yMaxMap - this.yMinMap;
    this.restoreParam = [this.xMinMap + this.logicXlength / 2, this.yMinMap + this.logicYlength / 2, 1];
    this.inf = [0, 0, 0];
    this.subTab = new Array();
    this.rowImgNo = 0;
    this.rowWidth = 0;
    this.rowsNum = 0;
    this.cellsNum = 0;
    this.newMapLeft = 0;
    this.newMapTop = 0;
    this.overMapLeft = 0;
    this.overMapTop = 0;
    this.mdLogicX = 0;
    this.mdLogicY = 0;
    this.muLogicX = 0;
    this.muLogicY = 0;
    this.mdScrX = 0;
    this.mdScrY = 0;
    this.xLogic = 0;
    this.yLogic = 0;
    this.calculateXarray = new Array();
    this.calculateYarray = new Array();
    this.calculateXarrayW = new Array();
    this.calculateYarrayW = new Array();
    this.drawStyle = [["#f06", "1px", "#119", "0.45"], ["#f06", "1px", "#119", "0.45"], ["#f06", "1px", "#119", "0.45"], ["#f06", "1px", "#119", "0.45"]];         //画图类样式。0,rect;1,circle;2,line;3,area
    this.oldLev = 0;
    this.imgArr = new Array();
    window.thisObj = this;
    window.IntervalID = new Object();
    this.isIE = navigator.appName.indexOf("Microsoft Internet Explorer") != -1 ? 1 : 0;
    this.isMapMove = false;
    this.isCarMove = false;
    this.pressing = false;
    this.buttons = new Array(false, false, false, false);
    this.rect = [];
    this.operType = 1003;
    this.operTypeIcon = [];
    this.gStr = ["请初始化IMSSearch控件", "请初始化IMSMeasure控件", "请初始化IMSMarker控件"]; //全局String
    this.pObj = null;
    this.mapContainer = null;
    this.vmlObj = null;
    this.drawDiv = null;
    this.simpleDraw = null;
    this.eagleEye = null;
    this.hso = null;
    this.showHsLev;
    this.so = null;
    this.mo = null;
    this.mapLabelObj = null;
    this.shadeFlg = true;
    this.hdfInfoArray;
    this.seeLay = [];
    this.vectLay = [];
    this.hasVectorMap = false;
    this.addActiveTool = new Array();
    this.addMouseDownFunction = new Array();
    this.addMouseMoveFunction = new Array();
    this.addMouseUpFunction = new Array();
    this.addMouseDblClickFunction = new Array();
    this.zoomFunction = new Array();
    this.addMouseOutFunction = new Array();
    this.resizeFunction = new Array();
    this.addKeyPressfunction = new Array();

    this.ChangeGridMap = function(gridName) {
        this.gridName = gridName;
        this.gridChangeFlg = true;

        while (this.imgArr.length > 0) {
            delete thisObj.imgArr[thisObj.imgArr[0]];
            thisObj.imgArr.shift();
        }

        this.refresh();
        this.gridChangeFlg = false;
    }

    this.Init = function()
     {
        if (this.isIE) AddVMLTag();
        this.InitMap();
        if (this.mapType == 0)
	 {
            this.hasVectorMap = false;
            this.restoreMap();
        }
        else if (this.mapType == 1) 
	{
            this.GetVectBound();
            this.GetVectorMap();
        }
        else
	 {
            this.restoreMap();
        }
    };

    this.InitMap = function()
     {
        this.pObj = (typeof (pDiv) == "object") ? pDiv : document.getElementById(pDiv);
        if (this.pObj.style.position != "absolute") { this.pObj.style.position = "relative"; };
        this.pObj.style.overflow = "hidden";
        this.pObj.unselectable = "on";
        this.pObj.style.backgroundImage = this.backgroundImage;
        var tmp = GetSize(this.pObj);
        if (this.pObj.style.height == "" || this.pObj.style.width == "") 
	{
            this.pObj.style.width = tmp[0] + "px";
            this.pObj.style.height = tmp[1] + "px";
        }
        this.imsMap = CreatDiv(this.pObj, "ZDIMSMap", 0, 0, "absolute", 1, "visible");
        this.simpleDraw = CreatDiv(this.imsMap, "simpleDraw", 0, 0, "absolute", 2002, "visible");
        this.mapContainer = CreatDiv(this.imsMap, "mapContainer", 0, 0, "absolute", 1, "visible", "margin:0;padding:0;", "");
        this.mapContainer2 = CreatDiv(this.imsMap, "mapContainer2", 0, 0, "absolute", 2, "visible", "margin:0;padding:0;", "");
        this.overLay = CreatDiv(this.imsMap, "overLay", 0, 0, "absolute", 3, "visible");
        this.drawDiv = CreatDiv(this.overLay, "drawMap", 0, 0, "absolute", 2001, "visible");
        for (var i = 0, j = this.gridImageUrl.length; i < j; i++) 
	{
            this.seeLay[i] = CreatDiv(this.mapContainer, "gridMap" + i, 0, 0, "absolute", 1 + i, "visible");
        }
        for (var i = 0, j = this.vectImageUrl.length; i < j; i++) 
	{
            this.vectLay[i] = CreatDiv(this.mapContainer2, "vectMap" + i, 0, 0, "absolute", 1 + i, "visible");
            this.vectLay[i].innerHTML = "<IMG src='" + this.errorImage + "' width='" + this.pObj.clientWidth + "px' height='" + this.pObj.clientHeight + "px' unselectable ='on' onerror='this.src=\"" + this.errorImage + "\"' style='top:0px;left:0px;position:absolute;'/>";
            this.vectLay[i].firstChild.onload = function() { this.style.left = 0; this.style.top = 0; if (thisObj.loader) thisObj.loader.setFree(); }
            this.vectLay[i].style.left = 0 + "px";
            this.vectLay[i].style.top = 0 + "px";
        }
        if (this.vectImageUrl.length > 0) this.hasVectorMap = true;
        ZDEvent.addListener(this.imsMap, "mousedown", this.OnMapMouseDown, false);
        ZDEvent.addListener(this.imsMap, "mouseup", this.OnMapMouseUp, false);
        ZDEvent.addListener(this.imsMap, "mousemove", this.OnMapMouseMove, false);
        ZDEvent.addListener(this.imsMap, "dblclick", this.OnMapDblClick, false);
        ZDEvent.addListener(this.imsMap, "mouseout", this.OnMapMouseOut, false);
        ZDEvent.addListener(this.imsMap, "contextmenu", function(e) { StopDefault(e) }, false);
        ZDEvent.addListener(this.imsMap, "mousewheel", this.OnWheelEvent, false);
        ZDEvent.addListener(this.pObj, "resize", this.OnResize, false);
        ZDEvent.addListener(window, "unload", this.OnUnload, false);
        if (this.mapType != 1) 
	   {
            ZDEvent.addListener(document, "keydown", this.OnKeyDown, false);
            ZDEvent.addListener(this.mapContainer, "keypress", this.OnKeyPress, false);
            ZDEvent.addListener(document, "keyup", this.OnKeyUp, false);
        }
    };
    this.GetTopDiv = function() {
        return this.pObj;
    }
    this.GetVectBound = function(reload) 
    {
        var url = this.getVectCoorPage + "?w=" + this.pObj.offsetWidth + "&h=" + this.pObj.offsetHeight + "&rnd=" + Math.random();
        if (reload)
            url += "&reload=true";
        this.rect = AJAXRequest(url, false, "GET", null).split(",");
        this.xMinMap = parseFloat(this.rect[0]);
        this.yMinMap = parseFloat(this.rect[1]);
        this.xMaxMap = parseFloat(this.rect[2]);
        this.yMaxMap = parseFloat(this.rect[3]);
        this.logicXlength = this.xMaxMap - this.xMinMap;
        this.logicYlength = this.yMaxMap - this.yMinMap;

    };
    this.mapTabNum = 0;
    this.GetTableNum = function() 
    {
        this.rowsNum = Math.ceil(this.pObj.offsetHeight / this.imgSize);
        this.cellsNum = Math.ceil(this.pObj.offsetWidth / this.imgSize);
        if (this.rowsNum % 2)
            this.rowsNum += 2;
        else
            this.rowsNum += 1;
        if (this.cellsNum % 2)
            this.cellsNum += 2;
        else
            this.cellsNum += 1;
        this.mapTabNum = this.cellsNum * this.rowsNum;
    };
    this.InitMapTable = function()
     {
        this.GetTableNum();
        var rowsCenNum = (this.rowsNum - 1) / 2, cellsCenNum = (this.cellsNum - 1) / 2;
        this.subTab[0] = document.createElement("TABLE");
        this.subTab[0].id = "SubTable" + "0";
        this.subTab[0].border = 0;
        this.subTab[0].cellPadding = 0;
        this.subTab[0].cellSpacing = 0;
        this.subTab[0].unselectable = 'on';
        for (var i = 0; i < this.rowsNum; i++)
	 {
            var newTR = this.subTab[0].insertRow(i);
            for (var loop = 0; loop < this.cellsNum; loop++)
                var newTD = newTR.insertCell(loop);
        }
        this.seeLay[0].appendChild(this.subTab[0]);
        this.subTab[0].rows[rowsCenNum].cells[cellsCenNum].id = this.inf.join("&");
        this.AddImage(this.inf[2], this.inf[1], this.inf[0], this.subTab[0].rows[rowsCenNum].cells[cellsCenNum], 0);
        for (var i = 1; i < cellsCenNum + 1; i++)
	 {
            var tdL = this.subTab[0].rows[rowsCenNum].cells[cellsCenNum - i + 1].id.split("&");
            var tdR = this.subTab[0].rows[rowsCenNum].cells[cellsCenNum + i - 1].id.split("&");
            this.subTab[0].rows[rowsCenNum].cells[cellsCenNum - i].id = tdL[0] + "&" + parseInt(tdL[1] * 1 - 1) + "&" + tdL[2];
            this.AddImage(tdL[2] * 1, (tdL[1] * 1 - 1) * 1, tdL[0], this.subTab[0].rows[rowsCenNum].cells[cellsCenNum - i], 0);
            this.subTab[0].rows[rowsCenNum].cells[cellsCenNum + i].id = tdR[0] + "&" + parseInt(tdR[1] * 1 + 1) + "&" + tdR[2];
            this.AddImage(tdR[2] * 1, (tdR[1] * 1 + 1) * 1, tdR[0], this.subTab[0].rows[rowsCenNum].cells[cellsCenNum + i], 0);
        }
        for (var i = 1; i < rowsCenNum + 1; i++)
	 {
            for (var loop = 0; loop < this.cellsNum; loop++) 
	        {
                var tdU = this.subTab[0].rows[rowsCenNum - i + 1].cells[loop].id.split("&");
                var tdD = this.subTab[0].rows[rowsCenNum + i - 1].cells[loop].id.split("&");
                this.subTab[0].rows[rowsCenNum - i].cells[loop].id = parseInt(tdU[0] * 1 + 1) + "&" + tdU[1] + "&" + tdU[2];
                this.AddImage(tdU[2] * 1, tdU[1], (tdU[0] * 1 + 1) * 1, this.subTab[0].rows[rowsCenNum - i].cells[loop], 0);
                this.subTab[0].rows[rowsCenNum + i].cells[loop].id = parseInt(tdD[0] * 1 - 1) + "&" + tdD[1] + "&" + tdD[2];
                this.AddImage(tdD[2] * 1, tdD[1], (tdD[0] * 1 - 1) * 1, this.subTab[0].rows[rowsCenNum + i].cells[loop], 0);
            }
        }
        this.mapContainer.style.width = this.cellsNum * this.imgSize + "px";
        this.mapContainer.style.height = this.rowsNum * this.imgSize + "px";
        this.mapContainer.style.left = Math.round((this.pObj.clientWidth - this.mapContainer.offsetWidth) / 2) + "px";
        this.mapContainer.style.top = Math.round((this.pObj.clientHeight - this.mapContainer.offsetHeight) / 2) + "px";
        this.LoadOtherMapLayer();
    };
    this.LoadOtherMapLayer = function()
     {
        for (var No = 1, k = this.gridImageUrl.length; No < k; No++)
	 {
            var infotmp = "";
            this.subTab[No] = document.createElement("TABLE");
            this.subTab[No].id = "SubTable" + No;
            this.subTab[No].border = 0;
            this.subTab[No].cellPadding = 0;
            this.subTab[No].cellSpacing = 0;
            this.subTab[No].unselectable = 'on';
            for (var i = 0; i < this.rowsNum; i++) {
                var newTR = this.subTab[No].insertRow(i);
                for (var loop = 0; loop < this.cellsNum; loop++)
                    var newTD = newTR.insertCell(loop);
            }
            this.seeLay[No].appendChild(this.subTab[No]);

            for (var i = 0; i < this.rowsNum; i++) 
	    {
                for (var j = 0; j < this.cellsNum; j++)
		 {
                    this.subTab[No].rows[i].cells[j].id = this.subTab[0].rows[i].cells[j].id;
                    var infotmp = this.subTab[0].rows[i].cells[j].id.split("&");
                    this.AddImage(infotmp[2], infotmp[1], infotmp[0], this.subTab[No].rows[i].cells[j], No);
                }
            }
        }
    };
    this.resetDispRect = function(xmin, ymin, xmax, ymax)
     {
        var raw_lminx = xmin;
        var raw_lminy = ymin;
        var raw_lmaxx = xmax;
        var raw_lmaxy = ymax;
        var raw_dx = Math.abs(raw_lmaxx * 1 - raw_lminx * 1);
        var raw_dy = Math.abs(raw_lmaxy * 1 - raw_lminy * 1);
        var dx = this.xMaxMap - this.xMinMap;
        var dy = this.yMaxMap - this.yMinMap;
        switch (thisObj.activeTool) 
	{
            case "ZoomIn":
                raw_lminx = Math.min(xmin, xmax);
                raw_lminy = Math.min(ymin, ymax);
                raw_lmaxx = Math.max(xmin, xmax);
                raw_lmaxy = Math.max(ymin, ymax);
                if (raw_dx == 0 || raw_dy == 0) 
		{
                    var dxl = dx / 4;
                    var dyl = dy / 4;
                    this.xMinMap = raw_lminx * 1 - dxl;
                    this.yMinMap = raw_lminy * 1 - dyl;
                    this.xMaxMap = raw_lminx * 1 + dxl;
                    this.yMaxMap = raw_lminy * 1 + dyl;
                }
                else
		 {
                    if (raw_dx * this.pObj.offsetWidth / dx < 5 || raw_dy * this.pObj.offsetHeight / dy < 5)
		     {
                        raw_dx = 5 * dx / this.pObj.offsetWidth;
                        raw_dy = 5 * dy / this.pObj.offsetHeight;
                    }
                    if (this.pObj.offsetWidth / this.pObj.offsetHeight > raw_dx / raw_dy) {
                        this.xMinMap = raw_lminx * 1 - 0.5 * (raw_dy * this.pObj.offsetWidth / this.pObj.offsetHeight - raw_dx);
                        this.xMaxMap = raw_lmaxx * 1 + 0.5 * (raw_dy * this.pObj.offsetWidth / this.pObj.offsetHeight - raw_dx);
                        this.yMinMap = raw_lminy;
                        this.yMaxMap = raw_lmaxy;

                    }
                    else {
                        this.xMinMap = raw_lminx;
                        this.xMaxMap = raw_lmaxx;
                        this.yMinMap = raw_lminy * 1 - 0.5 * (raw_dx * this.pObj.offsetHeight / this.pObj.offsetWidth - raw_dy);
                        this.yMaxMap = raw_lmaxy * 1 + 0.5 * (raw_dx * this.pObj.offsetHeight / this.pObj.offsetWidth - raw_dy);
                    }
                }
                break;
            case "ZoomOut":
                raw_lminx = Math.min(xmin, xmax);
                raw_lminy = Math.min(ymin, ymax);
                raw_lmaxx = Math.max(xmin, xmax);
                raw_lmaxy = Math.max(ymin, ymax);
                if (raw_dx == 0 || raw_dy == 0)
		 {
                    this.xMinMap = raw_lminx - dx;
                    this.yMinMap = raw_lminy - dy;
                    this.xMaxMap = raw_lminx * 1 + dx;
                    this.yMaxMap = raw_lminy * 1 + dy;
                }
                else 
		{
                    if (raw_dx * this.pObj.offsetWidth / dx < 5 || raw_dy * this.pObj.offsetHeight / dy < 5)
		     {
                        raw_dx = 5 * dx / this.pObj.offsetWidth;
                        raw_dy = 5 * dy / this.pObj.offsetHeight;
                    }
                    var rate;
                    if (this.pObj.offsetWidth / this.pObj.offsetHeight > raw_dx / raw_dy)
		     {
                        rate = dy / raw_dy;
                    }
                    else
		     {
                        rate = dx / raw_dx;
                    }
                    var new_dx = rate * dx;
                    var new_dy = rate * dy;
                    var center_lx = raw_lminx * 1 + raw_dx / 2;
                    var center_ly = raw_lminy * 1 + raw_dy / 2;
                    this.xMinMap = center_lx - new_dx / 2;
                    this.yMinMap = center_ly - new_dy / 2;
                    this.xMaxMap = center_lx + new_dx / 2;
                    this.yMaxMap = center_ly + new_dy / 2;
                }
                break;
            case "Pan":
                var dlx = raw_lmaxx - raw_lminx;
                var dly = raw_lminy - raw_lmaxy;
                this.xMinMap -= dlx;
                this.yMinMap += dly;
                this.xMaxMap -= dlx;
                this.yMaxMap += dly;
                break;
            default:
                this.xMinMap = xmin * 1 - this.logicXlength / 2;
                this.yMinMap = ymin * 1 - this.logicYlength / 2;
                this.xMaxMap = xmax * 1 + this.logicXlength / 2;
                this.yMaxMap = ymax * 1 + this.logicYlength / 2;
                break;
        }
        this.logicXlength = this.xMaxMap - this.xMinMap;
        this.logicYlength = this.yMaxMap - this.yMinMap;
    };
    this.GetVectorMap = function() 
    {
        var tmp = this.getCurWinLog();
        this.GetVectorMapByCood(tmp[0], tmp[1], tmp[2], tmp[3]);
    };

    this.GetVectorMapByCood = function(xmin, ymin, xmax, ymax)
     {
        for (var i = 0, j = this.vectImageUrl.length; i < j; i++)
	 {
            var url = this.vectImageUrl[i] + "?layerNo=" + i + "&LogicMinX=" + xmin + "&LogicMinY=" + ymin + "&LogicMaxX=" + xmax + "&LogicMaxY=" + ymax;
            url += "&ImageWidth=" + this.pObj.clientWidth + "&ImageHeight=" + this.pObj.clientHeight + "&ImageFormat=" + this.vectImageFormat + "&rnd=" + Math.random();
            this.vectLay[i].firstChild.src = url;
            this.vectLay[i].firstChild.style.width = this.pObj.clientWidth + "px";
            this.vectLay[i].firstChild.style.height = this.pObj.clientHeight + "px";
        }
        if (this.loader)
            this.loader.setBusy();
    };
    this.AddImage = function(level, lineNo, rowNo, htmlTag, layerNo) 
    {
        var svrNo = "0";
        if (layerNo == 0 && this.mapTabNum > 0)
            this.mapTabNum--;
        if ((rowNo * 1 < 0) || (rowNo * 1 >= this.rowImgNo) || (lineNo * 1 < 0) || (lineNo * 1 >= this.rowImgNo))
            htmlTag.innerHTML = "<IMG src='" + this.mapout + "' width='" + this.imgSize + "px' height='" + this.imgSize + "px' unselectable ='on'>";
        else if (!this.imgArr[htmlTag.id + layerNo])
	 {
            var id = rowNo + "&" + lineNo + "&" + (parseInt(level) + 1);
            var levelF = parseInt(level) + 1;
            if (this.hotSpotsObj != null && level >= this.showHsLev - 1 && layerNo == 0) 
	    {
                this.hotSpotsObj.GethsInfo(rowNo, lineNo, level);
            }
            htmlTag.innerHTML = "<IMG id='" + id + "' src='" + this.gridImageUrl[layerNo] + "?a=" + rowNo + "&GridName=" + this.gridName + "&b=" + lineNo + "&c=" + levelF + "&layerNo=" + layerNo + "&svrNo=" + svrNo + "' width='" + this.imgSize + "px' height='" + this.imgSize + "px' onload='SaveMapImage(this,\"" + (htmlTag.id + layerNo) + "\");' unselectable ='on'>";
        }
        else
            htmlTag.appendChild(this.imgArr[htmlTag.id + layerNo]);
    };
    window.SaveMapImage = function(obj, names)
     {
        var tmpStr = names.split("&");

        if (thisObj.imgArr.length > 500)
	 {
            for (var i = 0; i < 100; i++)
	     {
                delete thisObj.imgArr[thisObj.imgArr[0]];
                thisObj.imgArr.shift();
            };
        }
        else
	 {
            if (obj.src.search(thisObj.mapout) != -1) return;
            thisObj.imgArr.push(names);
            thisObj.imgArr[names] = obj;
        }
    };

    this.TableInsertRow = function(direct, displacement)
     {
        this.newMapTop += displacement;
        this.mapContainer.style.top = this.mapContainer.offsetTop + displacement + "px";
        for (var No = 0, j = this.gridImageUrl.length; No < j; No++)
	 {
            var newRowIndex = direct == "up" ? 0 : this.subTab[No].rows.length;
            var newTR = this.subTab[No].insertRow(newRowIndex);
            for (var i = 0; i < this.cellsNum; i++) 
	    {
                var newTD = newTR.insertCell(i);
                var beforeTDIndex = direct == "up" ? 1 : this.subTab[No].rows.length - 2;
                var beforeID = this.subTab[No].rows[beforeTDIndex].cells[i].id.split("&");
                var beforeIDIncrease = direct == "up" ? 1 : -1;
                newTD.id = (beforeID[0] * 1 + beforeIDIncrease * 1) + "&" + parseInt(beforeID[1]) + "&" + beforeID[2];
                this.AddImage(beforeID[2] * 1, beforeID[1], (beforeID[0] * 1 + beforeIDIncrease * 1) * 1, newTD, No);
            }
            var delRowIndex = direct == "up" ? this.subTab[No].rows.length - 1 : 0;
            this.subTab[No].deleteRow(delRowIndex);

        }
    };

    this.TableInsertCol = function(direct, displacement)
     {
        this.newMapLeft += displacement;
        this.mapContainer.style.left = this.mapContainer.offsetLeft + displacement + "px";
        for (var No = 0, j = this.gridImageUrl.length; No < j; No++)
	 {
            for (var i = 0; i < this.rowsNum; i++)
	     {
                var beforeCellIndex = direct == "left" ? 0 : this.subTab[No].rows[i].cells.length - 1;
                var beforeID = this.subTab[No].rows[i].cells[beforeCellIndex].id.split("&");
                var insertCellIndex = direct == "left" ? 0 : this.subTab[No].rows[i].cells.length;
                var newTD = this.subTab[No].rows[i].insertCell(insertCellIndex);
                var beforeIDIncrease = direct == "left" ? -1 : 1;
                newTD.id = beforeID[0] + "&" + (beforeID[1] * 1 + beforeIDIncrease * 1) + "&" + beforeID[2];
                this.AddImage(beforeID[2] * 1, (beforeID[1] * 1 + beforeIDIncrease * 1) * 1, beforeID[0] * 1, newTD, No);
                var delCellIndex = direct == "left" ? this.subTab[No].rows[i].cells.length - 1 : 0;
                this.subTab[No].rows[i].deleteCell(delCellIndex);
            }

        }
    };

    this.TableInsert = function()
     {
        this.TableInsertUp();
        this.TableInsertDown();
        this.TableInsertLeft();
        this.TableInsertRight();
    };

    this.TableInsertUp = function()
     {
        while (this.mapContainer.offsetTop > 0) 
	{
            this.TableInsertRow("up", -1 * this.imgSize);
        }
    };

    this.TableInsertDown = function()
     {
        while (this.mapContainer.offsetTop + this.subTab[0].offsetHeight < this.pObj.offsetHeight) {
            this.TableInsertRow("down", this.imgSize);
        }
    };

    this.TableInsertLeft = function()
     {
        while (this.mapContainer.offsetLeft > 0)
	 {
            this.TableInsertCol("left", -1 * this.imgSize);
        }
    };

    this.TableInsertRight = function()
     {
        while (this.mapContainer.offsetLeft + this.subTab[0].offsetWidth < this.pObj.offsetWidth) {
            this.TableInsertCol("right", this.imgSize);
        }
    };
    this.DblClickMoveToCenter = function(Mx, My) 
    {
        if (this.mapType != 1) {
            this.FillMapImages(Mx, My, this.moveSpeed);
            StartMoveMapLayer();
        }
    };
    this.FillMapImages = function(Mx, My, sd)
    {
        var AREA_X = (Mx >= this.pObj.clientWidth / 2) ? 1 : -1;
        var AREA_Y = (My >= this.pObj.clientHeight / 2) ? -1 : 1;
        if (AREA_Y == 1)
	 {
            window.createRow_Num = My;
            window.createRow_Num = this.pObj.clientHeight / 2 - window.createRow_Num;
            window.createRow_Num = (window.createRow_Num > 0) ? Math.ceil(window.createRow_Num / this.imgSize) : 0;
            for (var No = 0; No < this.gridImageUrl.length; No++)
	     {
                var cellsNum = this.subTab[No].rows[0].cells.length;
                for (var i = 0; i < window.createRow_Num; i++)
		 {
                    var newTR = this.subTab[No].insertRow(0);
                    for (var loop = 0; loop < cellsNum; loop++)
		     {
                        var newTD = newTR.insertCell(loop);
                        var beforeID = this.subTab[No].rows[1].cells[loop].id.split("&");
                        newTD.id = (beforeID[0] * 1 + 1) + "&" + parseInt(beforeID[1]) + "&" + beforeID[2];
                        this.AddImage(beforeID[2] * 1, beforeID[1] * 1, (beforeID[0] * 1 + 1) * 1, newTD, No);
                    }
                }
            }
            this.mapContainer.style.top = parseInt(this.mapContainer.style.top) - this.imgSize * window.createRow_Num + "px";
            window.createRow_Num = [window.createRow_Num, 1];
        }
        else if (AREA_Y == -1)
	 {
            window.createRow_Num = this.pObj.clientHeight - My;
            window.createRow_Num = this.pObj.clientHeight / 2 - window.createRow_Num;
            window.createRow_Num = (window.createRow_Num > 0) ? Math.ceil(window.createRow_Num / this.imgSize) : 0;
            for (var No = 0; No < this.gridImageUrl.length; No++)
	     {
                var cellsNum = this.subTab[No].rows[0].cells.length;
                for (var i = 0; i < window.createRow_Num; i++) 
		{
                    var newTR = this.subTab[No].insertRow(this.subTab[No].rows.length);
                    for (var loop = 0; loop < cellsNum; loop++)
		     {
                        var newTD = newTR.insertCell(loop);
                        var beforeID = this.subTab[No].rows[this.subTab[No].rows.length - 2].cells[loop].id.split("&");
                        newTD.id = (beforeID[0] - 1) + "&" + beforeID[1] + "&" + beforeID[2];
                        this.AddImage(beforeID[2] * 1, beforeID[1] * 1, (beforeID[0] * 1 - 1) * 1, newTD, No);
                    }
                }
            }
            window.createRow_Num = [window.createRow_Num, -1];
        }
        if (AREA_X == 1)
	 {
            window.createCol_Num = this.pObj.clientWidth - Mx;
            window.createCol_Num = this.pObj.clientWidth / 2 - window.createCol_Num;
            window.createCol_Num = (window.createCol_Num > 0) ? Math.ceil(window.createCol_Num / this.imgSize) : 0;
            for (var No = 0; No < this.gridImageUrl.length; No++) 
	    {
                var rowsNum = this.subTab[No].rows.length;
                for (var i = 0; i < window.createCol_Num; i++)
		 {
                    for (var loop = 0; loop < rowsNum; loop++)
		     {
                        var beforeID = this.subTab[No].rows[loop].cells[this.subTab[No].rows[loop].cells.length - 1].id.split("&");
                        var newTD = this.subTab[No].rows[loop].insertCell(this.subTab[No].rows[loop].cells.length);
                        newTD.id = beforeID[0] + "&" + (beforeID[1] * 1 + 1) + "&" + beforeID[2];
                        this.AddImage(beforeID[2] * 1, (beforeID[1] * 1 + 1) * 1, beforeID[0] * 1, newTD, No);
                    }
                }
            }
            window.createCol_Num = [window.createCol_Num, 1];
        }
        else if (AREA_X == -1) 
	{
            window.createCol_Num = Mx;
            window.createCol_Num = this.pObj.clientWidth / 2 - window.createCol_Num;
            window.createCol_Num = (window.createCol_Num > 0) ? Math.ceil(window.createCol_Num / this.imgSize) : 0;
            for (var No = 0; No < this.gridImageUrl.length; No++)
	     {
                var rowsNum = this.subTab[No].rows.length;
                for (var i = 0; i < window.createCol_Num; i++)
		 {
                    for (var loop = 0; loop < rowsNum; loop++)
		     {
                        var beforeID = this.subTab[No].rows[loop].cells[0].id.split("&");
                        var newTD = this.subTab[No].rows[loop].insertCell(0);
                        newTD.id = beforeID[0] + "&" + (beforeID[1] - 1) + "&" + beforeID[2];
                        this.AddImage(beforeID[2] * 1, (beforeID[1] * 1 - 1) * 1, beforeID[0] * 1, newTD, No);
                    }
                }
            }
            this.mapContainer.style.left = parseInt(this.mapContainer.style.left) - this.imgSize * window.createCol_Num + "px";
            window.createCol_Num = [window.createCol_Num, -1];
        }
        this.InitMapLayerMove(Mx, My, sd);
    };
    this.InitMapLayerMove = function(Mx, My, speed) 
    {
        var road = Math.sqrt(Math.pow((Mx - this.pObj.clientWidth / 2), 2) + Math.pow((My - this.pObj.clientHeight / 2), 2));
        var time = road / speed;
        xPosi = Mx >= this.pObj.clientWidth / 2 ? 1 : -1;
        yPosi = My >= this.pObj.clientHeight / 2 ? 1 : -1;
        perX = -(Mx - this.pObj.clientWidth / 2) / time;
        perY = -(My - this.pObj.clientHeight / 2) / time;
        if (perX > -1 && perX < 0)
            perX = -1;
        if (perY > -1 && perY < 0)
            perY = -1;
        newMove_X = parseInt(this.mapContainer.style.left) + (this.pObj.clientWidth / 2 - Mx);
        newMove_Y = parseInt(this.mapContainer.style.top) + (this.pObj.clientHeight / 2 - My);
        newMove_X1 = parseInt(this.overLay.style.left) + (this.pObj.clientWidth / 2 - Mx);
        newMove_Y1 = parseInt(this.overLay.style.top) + (this.pObj.clientHeight / 2 - My);
        this.isMapMove = true;
    };

    StartMoveMapLayer = function()
     {
        if (xPosi * (parseInt(thisObj.mapContainer.style.left) - newMove_X) > Math.abs(perX) || yPosi * (parseInt(thisObj.mapContainer.style.top) - newMove_Y) > Math.abs(perX)) {
            thisObj.mapContainer.style.left = (xPosi * (parseInt(thisObj.mapContainer.style.left) - newMove_X) > Math.abs(perX)) ? parseInt(thisObj.mapContainer.style.left) + perX + "px" : newMove_X + "px";
            thisObj.mapContainer.style.top = (yPosi * (parseInt(thisObj.mapContainer.style.top) - newMove_Y) > Math.abs(perY)) ? parseInt(thisObj.mapContainer.style.top) + perY + "px" : newMove_Y + "px";
            thisObj.overLay.style.left = (xPosi * (parseInt(thisObj.overLay.style.left) - newMove_X1) > Math.abs(perX)) ? parseInt(thisObj.overLay.style.left) + perX + "px" : newMove_X1 + "px";
            thisObj.overLay.style.top = (yPosi * (parseInt(thisObj.overLay.style.top) - newMove_Y1) > Math.abs(perY)) ? parseInt(thisObj.overLay.style.top) + perY + "px" : newMove_Y1 + "px";
            try 
	    {
                thisObj.centerCoor = thisObj.screenToLogic(Math.round(thisObj.pObj.clientWidth / 2), Math.round(thisObj.pObj.clientHeight / 2));
                if (thisObj.hso != null)
                    thisObj.hso.Showhs(HotSpotInfoArr);
            }
            catch (e) { }
        }
        else 
	{
            thisObj.mapContainer.style.left = newMove_X + "px";
            thisObj.mapContainer.style.top = newMove_Y + "px";
            thisObj.overLay.style.left = newMove_X1 + "px";
            thisObj.overLay.style.top = newMove_Y1 + "px";
            xFlg = true;
            yFlg = true;
            DeleteOtioseTable();
            thisObj.isMapMove = false;

            thisObj.cellsNum = thisObj.subTab[0].rows[0].cells.length;
            thisObj.rowsNum = thisObj.subTab[0].rows.length;
            thisObj.AdjustControl();
        }
        if (thisObj.isMapMove)
            setTimeout("StartMoveMapLayer()", 1);
        else
	 {
            if (thisObj.hasVectorMap)
	     {
                thisObj.GetVectorMap();
            }
        }
    };
    DeleteOtioseTable = function()
     {
        if (window.createRow_Num[1] == 1)
	 {
            var DeleteDownRowNo = (parseInt(thisObj.mapContainer.style.top) + thisObj.imgSize * thisObj.subTab[0].rows.length - parseInt(thisObj.pObj.clientHeight)) / thisObj.imgSize;
            DeleteDownRowNo = parseInt(DeleteDownRowNo);
            for (var No = 0; No < thisObj.gridImageUrl.length; No++)
	     {
                if (DeleteDownRowNo >= window.createRow_Num[0])
		 {
                    for (var i = 0; i < window.createRow_Num[0]; i++)
                        thisObj.subTab[No].deleteRow(thisObj.subTab[No].rows.length - 1);
                }
                else
		 {
                    for (var i = 0; i < DeleteDownRowNo; i++)
                        thisObj.subTab[No].deleteRow(thisObj.subTab[No].rows.length - 1);
                    for (var i = 0; i < (window.createRow_Num[0] - DeleteDownRowNo); i++) {
                        thisObj.subTab[No].deleteRow(0);
                        if (yFlg)
                            thisObj.mapContainer.style.top = parseInt(thisObj.mapContainer.style.top) + thisObj.imgSize + "px";
                    }
                }
                yFlg = false;
            }
        }
        else if (window.createRow_Num[1] == -1)
	 {
            var DeleteUpRowNo = Math.abs(parseInt(thisObj.mapContainer.style.top) / thisObj.imgSize);
            DeleteUpRowNo = parseInt(DeleteUpRowNo);
            for (var No = 0; No < thisObj.gridImageUrl.length; No++)
	     {
                if (DeleteUpRowNo >= window.createRow_Num[0])
		 {
                    for (var i = 0; i < window.createRow_Num[0]; i++)
		     {
                        thisObj.subTab[No].deleteRow(0);
                        if (yFlg)
                            thisObj.mapContainer.style.top = parseInt(thisObj.mapContainer.style.top) + thisObj.imgSize + "px";
                    };
                }
                else {
                    for (var i = 0; i < DeleteUpRowNo; i++) 
		    {
                        thisObj.subTab[No].deleteRow(0);
                        if (yFlg)
                            thisObj.mapContainer.style.top = parseInt(thisObj.mapContainer.style.top) + thisObj.imgSize + "px";
                    };
                    for (var i = 0; i < (window.createRow_Num[0] - DeleteUpRowNo); i++) {
                        thisObj.subTab[No].deleteRow(thisObj.subTab[No].rows.length - 1);
                    }
                }
                yFlg = false;
            }
        };
        if (window.createCol_Num[1] == 1) 
	{
            var DeleteLeftRowNo = Math.abs(parseInt(thisObj.mapContainer.style.left) / thisObj.imgSize);
            DeleteLeftRowNo = parseInt(DeleteLeftRowNo);
            for (var No = 0; No < thisObj.gridImageUrl.length; No++)
	     {
                var num = thisObj.subTab[No].rows.length;
                if (DeleteLeftRowNo >= window.createCol_Num[0])
		 {
                    for (var i = 0; i < window.createCol_Num[0]; i++)
		     {
                        for (var loop = 0; loop < num; loop++)
                            thisObj.subTab[No].rows[loop].deleteCell(0);
                        if (xFlg)
                            thisObj.mapContainer.style.left = parseInt(thisObj.mapContainer.style.left) + thisObj.imgSize + "px";
                    };
                }
                else {
                    for (var i = 0; i < DeleteLeftRowNo; i++) 
		    {
                        for (var loop = 0; loop < num; loop++)
                            thisObj.subTab[No].rows[loop].deleteCell(0);
                        if (xFlg)
                            thisObj.mapContainer.style.left = parseInt(thisObj.mapContainer.style.left) + thisObj.imgSize + "px";
                    };
                    for (var i = 0; i < (window.createCol_Num[0] - DeleteLeftRowNo); i++) {
                        for (var loop = 0; loop < num; loop++)
                            thisObj.subTab[No].rows[loop].deleteCell(thisObj.subTab[No].rows[loop].cells.length - 1);
                    }
                }
                xFlg = false;
            }
        }
        else if (window.createCol_Num[1] == -1)
	 {
            var DeleteRightRowNo = (parseInt(thisObj.mapContainer.style.left) + thisObj.imgSize * thisObj.subTab[0].rows[0].cells.length - parseInt(thisObj.pObj.clientWidth)) / thisObj.imgSize;
            DeleteRightRowNo = parseInt(DeleteRightRowNo);
            for (var No = 0; No < thisObj.gridImageUrl.length; No++)
	     {
                var num = thisObj.subTab[No].rows.length;
                if (DeleteRightRowNo >= window.createCol_Num[0]) 
		{
                    for (var i = 0; i < window.createCol_Num[0]; i++)
		     {
                        for (var loop = 0; loop < num; loop++)
                            thisObj.subTab[No].rows[loop].deleteCell(thisObj.subTab[No].rows[loop].cells.length - 1);
                    };
                }
                else {
                    for (var i = 0; i < DeleteRightRowNo; i++)
		     {
                        for (var loop = 0; loop < num; loop++)
                            thisObj.subTab[No].rows[loop].deleteCell(thisObj.subTab[No].rows[loop].cells.length - 1);
                    }
                    for (var i = 0; i < (window.createCol_Num[0] - DeleteRightRowNo); i++) {
                        for (var loop = 0; loop < num; loop++)
                            thisObj.subTab[No].rows[loop].deleteCell(0);
                        if (xFlg)
                            thisObj.mapContainer.style.left = parseInt(thisObj.mapContainer.style.left) + thisObj.imgSize + "px";
                    }
                }
                xFlg = false;
            }
        }
    };

    this.OnMapMouseDown = function(Evnt)
     {
        if (thisObj.isCarMove || Evnt.button == 2) return;
        else
	 {
            thisObj.pressing = true;
            var tmp = GetClientXY(Evnt, thisObj.pObj);
            if (thisObj.mdLogicX == thisObj.xLogic && thisObj.mdLogicY == thisObj.yLogic) return;
            thisObj.mdLogicX = thisObj.xLogic;
            thisObj.mdLogicY = thisObj.yLogic;
            switch (thisObj.drawAction)
	     {
                case "Pan":
                    thisObj.mdScrX = Evnt.clientX;
                    thisObj.mdScrY = Evnt.clientY;
                    thisObj.newMapLeft = thisObj.mapContainer.offsetLeft;
                    thisObj.newMapTop = thisObj.mapContainer.offsetTop;
                    thisObj.overMapLeft = thisObj.overLay.offsetLeft;
                    thisObj.overMapTop = thisObj.overLay.offsetTop;
                    break;
                case "Point":
                    break;
                case "Rect":
                    if (thisObj.vmlObj == null) 
		            {
                        thisObj.vmlObj = new IMSPalette(thisObj.simpleDraw, "rect");
                        thisObj.vmlObj.setStyle(thisObj.drawStyle[0][0], thisObj.drawStyle[0][1], thisObj.drawStyle[0][2], thisObj.drawStyle[0][3]);
                    }
                    thisObj.vmlObj.setStartPnt(tmp[0], tmp[1]);
                    break;
                case "Polyline":
                    if(thisObj.yLogic>0&&thisObj.yLogic>0)
                    {
                        var tmp1 = thisObj.logicToScreen(thisObj.xLogic, thisObj.yLogic);
                        if (thisObj.vmlObj == null) 
		                {
                            thisObj.vmlObj = new IMSPalette(thisObj.overLay, "polyline");//thisObj.simpleDraw
                            thisObj.vmlObj.setStyle(thisObj.drawStyle[3][0], thisObj.drawStyle[3][1], thisObj.drawStyle[3][2], thisObj.drawStyle[3][3]);
                            thisObj.vmlObj.setStartPnt(tmp1[0], tmp1[1]);
                        }
                        thisObj.vmlObj.appendPoint(tmp1[0], tmp1[1]);
                        thisObj.calculateXarray[thisObj.calculateXarray.length] = thisObj.xLogic;
                        thisObj.calculateYarray[thisObj.calculateYarray.length] = thisObj.yLogic;
                        thisObj.calculateXarrayW[thisObj.calculateXarrayW.length] = tmp1[0];
                        thisObj.calculateYarrayW[thisObj.calculateYarrayW.length] = tmp1[1];
                    }
                    break;
                case "Area":
                         var tmp1 = thisObj.logicToScreen(thisObj.xLogic, thisObj.yLogic);
                        if (thisObj.vmlObj == null)
		               {
                            thisObj.vmlObj = new IMSPalette(thisObj.overLay, "area");
                            thisObj.vmlObj.setStyle(thisObj.drawStyle[3][0], thisObj.drawStyle[3][1], thisObj.drawStyle[3][2], thisObj.drawStyle[3][3]);
                            thisObj.vmlObj.setStartPnt(tmp1[0], tmp1[1]);
                        }
                        thisObj.vmlObj.appendPoint(tmp1[0], tmp1[1]);
                        thisObj.calculateXarray[thisObj.calculateXarray.length] = thisObj.xLogic;
                        thisObj.calculateYarray[thisObj.calculateYarray.length] = thisObj.yLogic;
                        thisObj.calculateXarrayW[thisObj.calculateXarrayW.length] = tmp1[0];
                        thisObj.calculateYarrayW[thisObj.calculateYarrayW.length] = tmp1[1];
                    break;
                case "Circle":
                    if (thisObj.vmlObj == null)
		           {
                        thisObj.vmlObj = new IMSPalette(thisObj.simpleDraw, "circle");
                        thisObj.vmlObj.setStyle(thisObj.drawStyle[1][0], thisObj.drawStyle[1][1], thisObj.drawStyle[1][2], thisObj.drawStyle[1][3]);
                    }
                    thisObj.vmlObj.setStartPnt(tmp[0], tmp[1]);
                    break;
                default:
                    break;
            }
            for (var i = 0, j = thisObj.addMouseDownFunction.length; i < j; i++) {
                if (typeof (thisObj.addMouseDownFunction[i]) == 'function')
                    thisObj.addMouseDownFunction[i](Evnt);
            }
        }
        StopDefault(Evnt);
    };

    this.OnMapMouseMove = function(Evnt)
     {
        var showFlg = true;
        thisObj.XYOnMouseMove(Evnt);
        if (thisObj.isCarMove || Evnt.button == 2) return;
        else 
	{
            var tmp = GetClientXY(Evnt, thisObj.pObj);
            switch (thisObj.drawAction)
	     {
                case "Pan":
                    if (thisObj.pressing)
		     {
                        thisObj.mapContainer.style.left = thisObj.newMapLeft + Evnt.clientX - thisObj.mdScrX + "px";
                        thisObj.mapContainer.style.top = thisObj.newMapTop + Evnt.clientY - thisObj.mdScrY + "px";
                        if (thisObj.vectLay != null)
                            for (var i = 0, j = thisObj.vectImageUrl.length; i < j; i++)
                            if (thisObj.vectLay[i] != null) {
                            thisObj.vectLay[i].firstChild.style.left = Evnt.clientX - thisObj.mdScrX + "px";
                            thisObj.vectLay[i].firstChild.style.top = Evnt.clientY - thisObj.mdScrY + "px";
                        }
                        thisObj.overLay.style.left = thisObj.overMapLeft + Evnt.clientX - thisObj.mdScrX + "px";
                        thisObj.overLay.style.top = thisObj.overMapTop + Evnt.clientY - thisObj.mdScrY + "px";
                        if (thisObj.mapType != 1)
                            thisObj.TableInsert();
                        document.getElementById("ZDIMSMap").style.cursor = "move";
                    }
                    break;
                case "Rect":
                    if (thisObj.vmlObj != null && thisObj.pressing)
		            {
                        thisObj.vmlObj.drawing(tmp[0], tmp[1]);
                    }
                    break;
                case "Polyline":
                    if (thisObj.vmlObj != null) 
		            {
		                var tmp1 = thisObj.logicToScreen(thisObj.xLogic, thisObj.yLogic);
                        thisObj.vmlObj.drawing(tmp1[0], tmp1[1]);//===csh
                    }
                    break;
                case "Area":
                    if (thisObj.vmlObj != null) 
		            {
		            	var tmp1 = thisObj.logicToScreen(thisObj.xLogic, thisObj.yLogic);
                        thisObj.vmlObj.drawing(tmp1[0], tmp1[1]);//===csh
                    }
                    break;
                case "Polygon":
                    break;
                case "Circle":
                    if (thisObj.vmlObj != null && thisObj.pressing)
		     {
                        thisObj.vmlObj.drawing(tmp[0], tmp[1]);
                    }
                    break;
                default:
                    break;
            }
            for (var i = 0, j = thisObj.addMouseMoveFunction.length; i < j; i++)
	     {
                if (typeof (thisObj.addMouseMoveFunction[i]) == 'function')
                    thisObj.addMouseMoveFunction[i](Evnt);
            }
        }
        StopDefault(Evnt);
    };
    this.OnMapMouseUp = function(Evnt)
     {
        if (thisObj.isCarMove) return;
        else if (Evnt.button == 2)
	 {
            thisObj.closeMagnifier();
        }
        else {
            thisObj.pressing = false;
            var tmp = GetClientXY(Evnt, thisObj.pObj);
            thisObj.muLogicX = thisObj.xLogic;
            thisObj.muLogicY = thisObj.yLogic;
            switch (thisObj.drawAction)
	     {
                case "Pan":
                    thisObj.ChargeRect(thisObj.mdLogicX, thisObj.mdLogicY, thisObj.muLogicX, thisObj.muLogicY);
                    break;
                case "Rect":
                    if (thisObj.vmlObj != null)
		     {
                        thisObj.vmlObj.dispose();
                        thisObj.vmlObj = null;
                        thisObj.ChargeRect(thisObj.mdLogicX, thisObj.mdLogicY, thisObj.muLogicX, thisObj.muLogicY);
                    }
                    break;
                case "Circle":
                    if (thisObj.vmlObj != null)
		         {
                        thisObj.vmlObj.dispose();
                        thisObj.vmlObj = null;
                    }
                    break;
                default:
                    break;
            }

            for (var i = 0, j = thisObj.addMouseUpFunction.length; i < j; i++)
	     {
                if (typeof (thisObj.addMouseUpFunction[i]) == 'function')
                    thisObj.addMouseUpFunction[i](Evnt);
            }
        }
        document.getElementById("ZDIMSMap").style.cursor = "";
        StopDefault(Evnt);
    };
    this.OnMapDblClick = function(Evnt) 
    {
        if (thisObj.isCarMove) return;
        if ((thisObj.drawAction == "Polyline" || thisObj.drawAction == "Area") && thisObj.vmlObj != null) {
            thisObj.vmlObj.dispose();
            thisObj.vmlObj = null;
        }
        else if (thisObj.drawAction == "Pan")
	 {
            var tmp = GetClientXY(Evnt, thisObj.pObj);
            thisObj.DblClickMoveToCenter(tmp[0], tmp[1]);

        }
        if (thisObj.activeTool == "OpenMagnifier")
	 {
            thisObj.closeMagnifier();
        }
        for (var i = 0, j = thisObj.addMouseDblClickFunction.length; i < j; i++)
	 {
            if (typeof (thisObj.addMouseDblClickFunction[i]) == 'function')
                thisObj.addMouseDblClickFunction[i](Evnt);
        }
        thisObj.calculateXarray = new Array();
        thisObj.calculateYarray = new Array();
        thisObj.calculateXarrayW = new Array();
        thisObj.calculateYarrayW = new Array();
        if (thisObj.drawAction == "Pan")
        {
            thisObj.jumpMap3();
	    }
    };
    this.OnMapMouseOut = function(Evnt)
     {
        for (var i = 0, j = thisObj.addMouseOutFunction.length; i < j; i++) {
            if (typeof (thisObj.addMouseOutFunction[i]) == 'function')
                thisObj.addMouseOutFunction[i](Evnt);
        }
        document.getElementById("ZDIMSMap").style.cursor = "";
    };
    this.OnUnload = function()
     {
        if (thisObj == null) return;
        thisObj.pObj.parentNode.removeChild(thisObj.pObj);
        thisObj.pObj = null;
        thisObj.mapContainer = null;
        thisObj.vmlObj = null;
        thisObj.drawDiv = null;
        thisObj.simpleDraw = null;
        thisObj.seeLay = null;
        thisObj.vectLay = null;
        thisObj.overLay = null;
        thisObj.eagleEye = null;
        thisObj.hso = null;
        thisObj.so = null;
        thisObj.mo = null;
        thisObj.mapLabelObj = null;
        thisObj = null;
    };
    this.OnResize = function(Evnt) 
    {
        if (thisObj.mapType == 1) { thisObj.GetVectorMap(); thisObj.AdjustControl(); }
        else 
	{
            thisObj.pntLocation(thisObj.centerCoor[0], thisObj.centerCoor[1]);
            if (document.getElementById("centerPoint")) {
                document.getElementById("centerPoint").style.left = parseInt(thisObj.pObj.clientWidth / 2) - 8 + "px";
                document.getElementById("centerPoint").style.top = parseInt(thisObj.pObj.clientHeight / 2) - 8 + "px";
            };
        }
        for (var k = 0, j = thisObj.resizeFunction.length; k < j; k++) 
	{
            if (typeof (thisObj.resizeFunction[k]) == 'function')
                thisObj.resizeFunction[k](Evnt);
        }

    };
    this.ChargeRect = function(lminx, lminy, lmaxx, lmaxy) 
    {
        switch (this.activeTool) 
	{
            case "ZoomIn":
                this.ScaleZoomOutOrIn(true);
                break;
            case "ZoomOut":
                this.ScaleZoomOutOrIn(false);
                break;
            case "Pan":
                if (this.hasVectorMap) 
		{
                    if (this.mapType != 1)
                        this.GetVectorMap();
                    else 
		    {
                        this.jumpMap(0, 0, 0);
                        break;
                    }
                };
                this.AdjustControl();
                break;
            default:
                break;
        }
    };
    this.zoomFlag = true;
    this.OnWheelEvent = function(evnt)
     {
        if (!thisObj.zoomFlag)
            return;
        //===csh     测距,面积时当滑轮移动时，线自动清除。
       if (thisObj.vmlObj != null)
       {
           switch (thisObj.drawAction)
	     {
	         case "Polyline":
	         {
                    thisObj.vmlObj.clearPoint();
        //            thisObj.mo.clearMeasureParam();

        //            thisObj.vmlObj.dispose();
        //            thisObj.vmlObj = null;
        //            thisObj.calculateXarray.length=0;
        //            thisObj.calculateYarray.length=0;
                    thisObj.xLogic=0;
                    thisObj.yLogic=0;                

                    var calculateDiv = document.getElementById("calculateDiv");
                    calculateDiv.innerHTML = "";
                    var calculateDiv1 = document.getElementById("calculateDiv1");
                    calculateDiv1.innerHTML="";
                    thisObj.mo.drawLine();
                    break;
                }
                case "Area":
                {
                     thisObj.vmlObj.clearPoint();
//                     thisObj.mo.clearMeasureParam();

//                    thisObj.vmlObj.dispose();
//                    thisObj.vmlObj = null;
//                    thisObj.calculateXarray.length=0;
//                    thisObj.calculateYarray.length=0;

//                    thisObj.xLogic=0;
//                    thisObj.yLogic=0;                

                    var calculateDiv = document.getElementById("calculateDiv");
                    calculateDiv.innerHTML = "";
                    thisObj.mo.drawLine();
                    break;
                }
           }
       } 
       //=====end 
        var b, c, d;
        if (!evnt)
            evnt = event;
        b = evnt.wheelDelta;
        c = evnt.detail;
        d = !b ? (!c ? 0 : -c) : b;
        if (d > 0 && thisObj.inf[2] >= 0)
	 {
            thisObj.zoomFlag = false;
            setTimeout("thisObj.jumpMapByLev(thisObj.inf[2]+2);thisObj.zoomFlag=true;", 200);
        }
        else if (d > 0 && thisObj.inf[2] < 0)
            return;
        else if (d < 0 && thisObj.inf[2] >= 0 && thisObj.inf[2] <=thisObj.levelNum - 1) {
            thisObj.zoomFlag = false;
            setTimeout("thisObj.jumpMapByLev(thisObj.inf[2]);thisObj.zoomFlag=true;", 200);
        }
        else if (d < 0 && thisObj.inf[2] > thisObj.levelNum - 1)
            return;
        evnt.cancelBubble = true;
    };
    this.ZoomByShade = function(flag)
     {
        var lev = this.inf[2];
        if (!flag)
            lev++;
        else
            lev--;
        if (lev < 0 || lev == this.levelNum)
            return;
        this.GetLogicLength();
        if (window.shadeTimeFlg)
            return;
        Dynamic(flag);
    };
    this.MapShade = function(zoomLev) 
    {
        this.GetLogicLength();
        document.getElementById("ZDIMSMap").style.zoom = zoomLev;
        this.MoveToCenter(zoomLev);
    };

    this.MoveToCenter = function(zoomLev)
     {
        var pixelX = thisObj.logicXlength / thisObj.rowWidth;
        var px_change = thisObj.logicXlength / (thisObj.rowWidth * zoomLev);
        var movX = thisObj.Rowl / px_change - thisObj.Rowl / pixelX;
        var movY = thisObj.Linl / px_change - thisObj.Linl / pixelX;
        document.getElementById("ZDIMSMap").style.left = 0 - movX;
        document.getElementById("ZDIMSMap").style.top = 0 + movY;
    };

    this.zoomCount = 0;
    window.shadeTimeFlg = false;
    Dynamic = function(flag)
     {
        var zoomInOut = flag ? 2 : 1;
        var zoom = flag ? -1 : 1;
        thisObj.zoomCount++;
        if (thisObj.zoomCount <= (10 / zoomInOut)) 
	{
            document.getElementById("ZDIMSMap").style.zoom = (1 + 0.1 * thisObj.zoomCount * zoom);
            var pixelX = thisObj.logicXlength / thisObj.rowWidth;
            var px_change = thisObj.logicXlength / (thisObj.rowWidth * (1 + zoom * thisObj.zoomCount / 10));
            var movX = thisObj.Rowl / px_change - thisObj.Rowl / pixelX;
            var movY = thisObj.Linl / px_change - thisObj.Linl / pixelX;
            document.getElementById("ZDIMSMap").style.left = 0 - movX;
            document.getElementById("ZDIMSMap").style.top = 0 + movY;
            window.shadeTimeFlg = true;
            setTimeout("Dynamic(" + flag + ")", 50 * zoomInOut);
        }
        else
	 {
            thisObj.ResetMap(flag);
        }
    };
    this.ResetMap = function(flag)
     {
        if (flag)
	 {
            this.jumpMapByLev(this.inf[2]);
        }
        else
	 {
            this.jumpMapByLev(this.inf[2] + 2);
        }
        this.zoomCount = 0;
        window.shadeTimeFlg = false;
        document.getElementById("ZDIMSMap").style.zoom = 1;
    };
    this.GetLogicLength = function()
     {
        this.l = 0;
        this.t = 0;
        this.centerCoor = this.screenToLogic(this.pObj.clientWidth / 2, this.pObj.clientHeight / 2);
        var cornor = this.screenToLogic(this.l, this.t);
        this.Rowl = this.centerCoor[0] - cornor[0];
        this.Linl = this.centerCoor[1] - cornor[1];
    };
    this.OnKeyDown = function(evnt)
     {
        var e = thisObj.isIE ? event : evnt;
        if (e.keyCode > 36 && e.keyCode < 41)
	 {
            thisObj.buttons[e.keyCode - 37] = true;
            if (!document.getElementById("divKBArrow"))
	     {
                CreatDiv(thisObj.pObj, "divKBArrow", 0, 0, "absolute", 500, "visible", null);
            }
            thisObj.OnKeyPress(e);
        }
        StopBubble(e);
    };
    this.OnKeyUp = function(evnt)
     {
        thisObj.isMapMove = false;
        var e = thisObj.isIE ? event : evnt;
        if (e.keyCode > 36 && e.keyCode < 41)
	 {
            thisObj.buttons[e.keyCode - 37] = false;
            var obj = document.getElementById("divKBArrow");
            if (obj == null)
                return;
            else
                obj.innerHTML = "";
            if (thisObj.hasVectorMap)
                thisObj.GetVectorMap(thisObj);
        }
    };
    this.OnKeyPress = function(Evnt)
     {
        var speed = thisObj.moveSpeed;
        var e = thisObj.isIE ? event : Evnt;
        var vmlMoveFlg = false;
        thisObj.isMapMove = true;
        var centerLeft = parseInt(thisObj.pObj.clientWidth / 2);
        var centerTop = parseInt(thisObj.pObj.clientHeight / 2);
        var i = 0;
        var directionFlg = new Array(0, 0, 0, 0);
        var obj = document.getElementById("divKBArrow");
        obj.innerHTML = "";
        if (thisObj.buttons[0]) { directionFlg[0] = 1; obj.innerHTML += "<img name='ArrowLeft' style='display:block;Z-INDEX: 800; LEFT: " + (centerLeft - 31) + "px; POSITION: absolute; TOP: " + (centerTop - 10) + "px;' src='images/left.gif'>"; } //左
        else if (thisObj.buttons[2]) { directionFlg[2] = -1; obj.innerHTML += "<img name='ArrowRight' style='Z-INDEX: 800; LEFT: " + (centerLeft * 1 + 11) + "px; POSITION: absolute; TOP: " + (centerTop * 1 - 10) + "px;'  src='images/right.gif'>"; } //右
        if (thisObj.buttons[1]) { directionFlg[1] = 1; obj.innerHTML += "<img name='ArrowUp' style='Z-INDEX:800; LEFT: " + (centerLeft - 10) + "px; POSITION: absolute; TOP: " + (centerTop - 31) + "px;'  src='images/up.gif'>"; } //上
        else if (thisObj.buttons[3]) { directionFlg[3] = -1; obj.innerHTML += "<img name='ArrowDown' style='Z-INDEX: 800; LEFT: " + (centerLeft - 10) + "px; POSITION: absolute; TOP: " + (centerTop + 11) + "px;'  src='images/down.gif'>"; } //下
        var horizontalFlg = directionFlg[0] + directionFlg[2];
        var verticalFlg = directionFlg[1] + directionFlg[3];
        thisObj.mapContainer.style.left = parseInt(thisObj.mapContainer.offsetLeft) + speed * horizontalFlg + "px";
        thisObj.mapContainer.style.top = parseInt(thisObj.mapContainer.offsetTop) + speed * verticalFlg + "px";
        thisObj.TableInsert();
        thisObj.AdjustControl();
        var pX = thisObj.logicXlength / thisObj.rowWidth;
        var pY = thisObj.logicYlength / thisObj.rowWidth;
        thisObj.xLogic += -1 * speed * horizontalFlg * pX;
        thisObj.yLogic += speed * verticalFlg * pY;
        thisObj.xLogic = thisObj.xLogic.toFixed(thisObj.setCoordPrec) * 1;
        thisObj.yLogic = thisObj.yLogic.toFixed(thisObj.setCoordPrec) * 1;
        if (thisObj.statusBarFlag)
            window.status = "X：" + thisObj.xLogic + " Y：" + thisObj.yLogic;
        for (var i = 0; i < thisObj.addKeyPressfunction.length; i++)
	 {
            if (typeof (thisObj.addKeyPressfunction[i]) == 'function')
                thisObj.addKeyPressfunction[i](Evnt);
        }
    };
    this.AdjustControl = function() 
    {
        this.centerCoor = this.screenToLogic(Math.round(this.pObj.clientWidth / 2), Math.round(this.pObj.clientHeight / 2));
        try
	 {
            SetMyCursor();
            if (this.sco != null)
                this.sco.reSetScale();
            if (this.eagleEye != null)
                this.eagleEye.eagleJumpingMap(this.centerCoor[0], this.centerCoor[1], this.inf[2]);
            if (this.hso != null)
                this.hso.Showhs(HotSpotInfoArr);

        }
        catch (e) { }
        if (this.mapType == 1) 
	{
            var coor1 = this.screenToLogic(0, 0);
            this.overLay.style.left = Math.round((this.rect[0] - coor1[0]) / this.logicXlength * this.pObj.clientWidth) + "px";
            this.overLay.style.top = Math.round((coor1[1] - this.rect[3]) / this.logicYlength * this.pObj.clientHeight) + "px";
        }
        else
	 {
            var pX = this.logicXlength / this.rowWidth;
            var pY = this.logicYlength / this.rowWidth;
            var coor1 = this.screenToLogic(0, 0);
            this.overLay.style.left = Math.round((this.xMinMap - coor1[0]) / pX) + "px";
            this.overLay.style.top = Math.round((coor1[1] - this.yMaxMap) / pY) + "px";
        }
        document.getElementById("ZDIMSMap").style.left = "0px";
        document.getElementById("ZDIMSMap").style.top = "0px";
    };
    this.XYOnMouseMove = function(Evnt)
     {
        var tmp = GetClientXY(Evnt, this.pObj);
        var tmpXY = this.screenToLogic(tmp[0], tmp[1]);
        if (tmpXY == null) return;
        this.xLogic = tmpXY[0].toFixed(this.setCoordPrec) * 1;
        this.yLogic = tmpXY[1].toFixed(this.setCoordPrec) * 1;
        if (this.statusBarFlag)
            window.status = "X：" + this.xLogic + " Y：" + this.yLogic;
    };
    this.ScaleZoomOutOrIn = function(flag)
     {
        if (this.mapType == 1)
	 {
            this.jumpMap(0, 0, 0);
            return;
        }
        if (!flag && this.inf[2] * 1 <= 0)
            return;
        if (flag && this.inf[2] * 1 >= this.levelNum - 1)
            return;
        var x = (this.mdLogicX + this.muLogicX) / 2;
        var y = (this.mdLogicY + this.muLogicY) / 2;
        this.centerCoor = [x, y];
        if (flag)
	 {
            this.inf[2] = parseInt(this.inf[2]) + 1;
        }
        else
	 {
            this.inf[2] -= 1;
        }
        this.jumpMap(x, y, (this.inf[2] + 1));
    };
    //========ChenSongHua 2011-03-24
   this.ScaleZoomTO = function(Num) {
        if (this.mapType == 1) {
            this.jumpMap(0, 0, 0);
            return;
        }
        if (Num <= 0)
            return;
        if (Num > this.levelNum)
            return;
        var x = this.mdLogicX;
        var y = this.mdLogicY;
        this.centerCoor = [x, y];
        this.jumpMap(x, y, Num);
    };    
    //==========end 
    this.Point = function()
     {
        var center = CreatDiv(this.pObj, "centerPoint", parseInt(this.pObj.clientWidth) / 2 - 8, parseInt(this.pObj.clientHeight) / 2 - 8, "absolute", 200, "visible");
        center.innerHTML = "<img src='images/point.gif' onclick='return false;'>";
    };

    this.GetMapMagnifier = function()
     {
        if (document.getElementById("mapMagnifier") == null)
	 {
            var obj = document.createElement("DIV");
            obj.id = "mapMagnifier";
            obj.style.position = "absolute";
            obj.style.border = "5px ridge #D4D0C8";
            obj.style.zIndex = 10;
            obj.style.display = "none";
            obj.style.overflow = "hidden";
            obj.style.backgroundColor = "#fff";
            obj.style.top = "0px";
            obj.style.left = "0px";
            obj.style.width = parseInt(this.magnifierSize[0]) + "px";
            obj.style.height = parseInt(this.magnifierSize[1]) + "px"; ;
            this.pObj.appendChild(obj);
        }
        return document.getElementById("mapMagnifier");
    }

    this.LoadGridMagnifier = function()
     {
        var zoomDiv = this.GetMapMagnifier();
        for (var i = 0; i < this.gridImageUrl.length; i++)
	 {
            zoomDiv.innerHTML += "<table id='zoomTab" + i + "' cellSpacing='0' cellPadding='0' border='0' style='position:absolute;z-index:" + i + "'>"
                     + "<tr><td id='td" + i + "20'></td><td id='td" + i + "21'></td><td id='td" + i + "22'></td></tr>"
                     + "<tr><td id='td" + i + "10'></td><td id='td" + i + "11'></td><td id='td" + i + "12'></td></tr>"
                     + "<tr><td id='td" + i + "00'></td><td id='td" + i + "01'></td><td id='td" + i + "02'></td></tr></table>";
        };
    };
    this.LoadVectMagnifier = function() 
    {
        var zoomDiv = this.GetMapMagnifier();
        for (var i = 0; i < this.vectImageUrl.length; i++) 
	{
            var vectDiv = CreatDiv(zoomDiv, "vectZoom" + i, 0, 0, "absolute");
            zoomDiv.appendChild(vectDiv);
            var vectMap = document.getElementById("vectMap" + i);
            vectDiv.innerHTML = "<img src='" + vectMap.firstChild.src + "'/>";
            vectDiv.firstChild.style.width = vectMap.firstChild.offsetWidth * thisObj.zoomRate + "px";
            vectDiv.firstChild.style.height = vectMap.firstChild.offsetHeight * thisObj.zoomRate + "px";
        };
    };
    this.ShowMapMagnifier = function() 
    {
        this.GetMapMagnifier().innerHTML = "<img src='images/point.gif' style='z-index:100;position:absolute;left:" + parseInt(this.magnifierSize[0] / 2 - 3) + "px;top:" + parseInt(this.magnifierSize[1] / 2 - 3) + "px'>";
        if (this.mapType == 0)
	 {
            this.LoadGridMagnifier();
        }
        else if (this.mapType == 1) 
	{
            this.LoadVectMagnifier();
        }
        else 
	{
            this.LoadGridMagnifier();
            this.LoadVectMagnifier();
        }
    };
    var temptbid = new Array();
    this.MoveMapMagnifier = function(evt)
     {
        if (thisObj.activeTool != "OpenMagnifier" && evt.button != 0) return;
        var x1 = thisObj.xLogic;
        var y1 = thisObj.yLogic;
        var zoomDiv = thisObj.GetMapMagnifier();
        zoomDiv.style.display = "block";
        var tmp = GetClientXY(evt, thisObj.pObj);
        var xPix = tmp[0];
        var yPix = tmp[1];
        if (thisObj.mapType == 0 || thisObj.mapType == 2) 
	{
            var pX = thisObj.logicXlength / thisObj.rowWidth;
            var rowNo = Math.floor((y1 - thisObj.yMinMap) * (2 << thisObj.inf[2]) / thisObj.logicYlength);
            var lineNo = Math.floor((x1 - thisObj.xMinMap) * (2 << thisObj.inf[2]) / thisObj.logicXlength);
            var tdid = rowNo + "&" + lineNo + "&" + thisObj.inf[2];
            for (var i = 0; i < thisObj.gridImageUrl.length; i++) 
	    {
                if (document.getElementById("zoomTab" + i) != null && temptbid[i] != tdid) {
                    var tdarr = tdid.split("&");
                    var TabX = parseInt(tdarr[1]);
                    var TabY = parseInt(tdarr[0]);
                    temptbid[i] = tdid;
                    var tempid = "";
                    thisObj.InsertTabInit(tdid, "td" + i + "11", i);
                    tempid = TabY + "&" + (TabX - 1) + "&" + tdarr[2];
                    thisObj.InsertTabInit(tempid, "td" + i + "10", i);
                    tempid = TabY + "&" + (TabX + 1) + "&" + tdarr[2];
                    thisObj.InsertTabInit(tempid, "td" + i + "12", i);
                    tempid = (TabY - 1) + "&" + (TabX - 1) + "&" + tdarr[2];
                    thisObj.InsertTabInit(tempid, "td" + i + "00", i);
                    tempid = (TabY - 1) + "&" + TabX + "&" + tdarr[2];
                    thisObj.InsertTabInit(tempid, "td" + i + "01", i);
                    tempid = (TabY - 1) + "&" + (TabX + 1) + "&" + tdarr[2];
                    thisObj.InsertTabInit(tempid, "td" + i + "02", i);
                    tempid = (TabY + 1) + "&" + (TabX - 1) + "&" + tdarr[2];
                    thisObj.InsertTabInit(tempid, "td" + i + "20", i);
                    tempid = (TabY + 1) + "&" + TabX + "&" + tdarr[2];
                    thisObj.InsertTabInit(tempid, "td" + i + "21", i);
                    tempid = (TabY + 1) + "&" + (TabX + 1) + "&" + tdarr[2];
                    thisObj.InsertTabInit(tempid, "td" + i + "22", i);
                }
                var leftTopY = (rowNo + 2) * thisObj.logicYlength / (2 << thisObj.inf[2]) + thisObj.yMinMap;
                var leftTopX = (lineNo - 1) * thisObj.logicXlength / (2 << thisObj.inf[2]) + thisObj.xMinMap;
                var tbid = document.getElementById("zoomTab" + i);
                tbid.style.top = (y1 - leftTopY) / pX * thisObj.zoomRate + zoomDiv.offsetHeight / 2 + "px"; //*thisObj.zoomRate
                tbid.style.left = (leftTopX - x1) / pX * thisObj.zoomRate + zoomDiv.offsetWidth / 2 + "px"; //*thisObj.zoomRate
            }
        }
        if (thisObj.mapType == 1 || thisObj.mapType == 2)
	 {
            var tmp = thisObj.getCurWinLog();
            var pX = (tmp[2] - tmp[0]) / thisObj.pObj.clientWidth;
            for (var i = 0; i < thisObj.vectImageUrl.length; i++)
	     {
                var vectZoom = document.getElementById("vectZoom" + i);
                vectZoom.style.top = (y1 - tmp[3]) / pX * thisObj.zoomRate + zoomDiv.offsetHeight / 2 + "px";
                vectZoom.style.left = (tmp[0] - x1) / pX * thisObj.zoomRate + zoomDiv.offsetWidth / 2 + "px";
            }
        }
        var thisHeight = thisObj.pObj.clientHeight;
        var thisWidth = thisObj.pObj.clientWidth;
        if (xPix + 15 + zoomDiv.offsetWidth > thisWidth)
            zoomDiv.style.left = xPix - 15 - zoomDiv.offsetWidth + "px";
        else
            zoomDiv.style.left = xPix + 15 + "px";
        if (yPix + 15 + zoomDiv.offsetHeight > thisHeight)
            zoomDiv.style.top = yPix - 15 - zoomDiv.offsetHeight + "px";
        else
            zoomDiv.style.top = yPix + 15 + "px";
    };
    this.InsertTabInit = function(tdid, aimtdid, layerNo)
     {
        var imageSrc = "";
        var cy = document.getElementById(aimtdid);
        var temp = tdid.split('&');
        var rowNo = temp[0];
        var lineNo = temp[1];
        var level = temp[2];
        if ((rowNo * 1 < 0) || (rowNo * 1 >= this.rowImgNo) || (lineNo * 1 < 0) || (lineNo * 1 >= this.rowImgNo))
            imageSrc = thisObj.mapout;
        else 
	{
            var levelF = parseInt(level) + 1;
            imageSrc = thisObj.gridImageUrl[layerNo] + "?layerNo=" + layerNo + "&GridName=" + thisObj.gridName + "&a=" + rowNo + "&b=" + lineNo + "&c=" + levelF;
        }
        cy.innerHTML = "<img src=" + imageSrc + " width='" + thisObj.imgSize * thisObj.zoomRate + "px' height='" + thisObj.imgSize * thisObj.zoomRate + "px'>";
    };
    this.closeMagnifier = function() 
    {
        thisObj.GetMapMagnifier().style.display = "none";
        this.removeEventListener("mousemove", thisObj.MoveMapMagnifier, false);
    };
    this.setRestoreParam = function(level)
     {
        this.restoreParam[2] = level * 1;
    };
    this.setRestoreParam = function(x, y, level)
     {
        this.restoreParam = [x * 1, y * 1, level * 1];
    };
    this.restoreMap = function()
     {
        if (this.isCarMove)
            return;
        if (this.mapType == 1)
	 {
            this.GetVectBound(true);
            this.GetVectorMap();
            this.AdjustControl();
        }
        else
            this.jumpMap(this.restoreParam[0], this.restoreParam[1], this.restoreParam[2]);
        for (var k = 0, j = this.zoomFunction.length; k < j; k++)
	 {
            if (typeof (this.zoomFunction[k]) == 'function')
                this.zoomFunction[k]();
        }
    };
    this.jumpMapByLev = function(count) 
    {
        if (count >= 1 && count <= this.levelNum)
            this.jumpMap(this.centerCoor[0], this.centerCoor[1], parseInt(count));
    };
    //===========csh
    this.jumpMap1 = function(xmin, ymin, xmax, ymax, level) 
    {
        var raw_lminx = xmin;
        var raw_lminy = ymin;
        var raw_lmaxx = xmax;
        var raw_lmaxy = ymax;
        var x = (raw_lmaxx*1 + raw_lminx*1) / 2;
        var y = (raw_lmaxy*1 + raw_lminy*1) / 2;
        this.jumpMap(x, y, level);
    }
     this.jumpMap3 = function() 
    {
        var x = this.muLogicX; 
        var y = this.muLogicY;
        var tmpLev = this.oldLev * 1;
        level=this.oldLev+2;
        if (this.mapType != 1 && level >= 0 && level <=this.levelNum) 
        {
          this.jumpMap(x, y, level);
        }
    }; 
    this.jumpMap2 = function(x, y) 
    {
       var level=this.oldLev;
//        level--;
        var tmpLev = this.oldLev * 1;
        if (this.mapType != 1 && level >= 0 && level < this.levelNum) 
	{
            this.inf[2] = level;
            this.oldLev = level;
            this.rowImgNo = 2 << (parseInt(this.inf[2]));
            this.rowWidth = 2 << (parseInt(this.inf[2]) + parseInt(Math.log(this.imgSize) / Math.log(2)));
            var pX = this.logicXlength / this.rowWidth;
            var pY = this.logicYlength / this.rowWidth;
            var lineNo = Math.floor((x - this.xMinMap) / pX / this.imgSize);
            var rowNo = Math.floor((y - this.yMinMap) / pY / this.imgSize);
            var dotleft = (x - this.xMinMap) / pX - this.imgSize * lineNo;
            var dottop = (y - this.yMinMap) / pY - this.imgSize * rowNo;
            this.inf = [rowNo, lineNo, this.inf[2]];
            for (var i = 0, j = this.gridImageUrl.length; i < j; i++) {
                if (this.seeLay[i].hasChildNodes())
                    this.seeLay[i].removeChild(this.subTab[i]);
            }
            this.InitMapTable();
            this.mapContainer.style.left = this.mapContainer.offsetLeft + (this.imgSize / 2 - dotleft) + "px";
            this.mapContainer.style.top = this.mapContainer.offsetTop - (this.imgSize / 2 - dottop) + "px";
            this.AdjustControl();
            if (thisObj.hasVectorMap) { thisObj.GetVectorMap() }
        }
        else
	 {
            this.resetDispRect(this.mdLogicX, this.mdLogicY, this.muLogicX, this.muLogicY);
            this.GetVectorMapByCood(this.xMinMap, this.yMinMap, this.xMaxMap, this.yMaxMap);
            this.AdjustControl();
        };
        this.centerCoor = [x, y];
        if (tmpLev != this.inf[2] || this.mapType == 1)
            for (var k = 0, j = this.zoomFunction.length; k < j; k++)
	     {
            if (typeof (this.zoomFunction[k]) == 'function')
                this.zoomFunction[k]();
        }
    };
    ///===============end
    this.jumpMap = function(x, y, level) 
    {
        level--;
        var tmpLev = this.oldLev * 1;
        if (this.mapType != 1 && level >= 0 && level < this.levelNum) 
	{
            this.inf[2] = level;
            this.oldLev = level;
            this.rowImgNo = 2 << (parseInt(this.inf[2]));
            this.rowWidth = 2 << (parseInt(this.inf[2]) + parseInt(Math.log(this.imgSize) / Math.log(2)));
            var pX = this.logicXlength / this.rowWidth;
            var pY = this.logicYlength / this.rowWidth;
            var lineNo = Math.floor((x - this.xMinMap) / pX / this.imgSize);
            var rowNo = Math.floor((y - this.yMinMap) / pY / this.imgSize);
            var dotleft = (x - this.xMinMap) / pX - this.imgSize * lineNo;
            var dottop = (y - this.yMinMap) / pY - this.imgSize * rowNo;
            this.inf = [rowNo, lineNo, this.inf[2]];
            for (var i = 0, j = this.gridImageUrl.length; i < j; i++) {
                if (this.seeLay[i].hasChildNodes())
                    this.seeLay[i].removeChild(this.subTab[i]);
            }
            this.InitMapTable();
            this.mapContainer.style.left = this.mapContainer.offsetLeft + (this.imgSize / 2 - dotleft) + "px";
            this.mapContainer.style.top = this.mapContainer.offsetTop - (this.imgSize / 2 - dottop) + "px";
            this.AdjustControl();
            if (thisObj.hasVectorMap) { thisObj.GetVectorMap() }
        }
        else
	 {
            this.resetDispRect(this.mdLogicX, this.mdLogicY, this.muLogicX, this.muLogicY);
            this.GetVectorMapByCood(this.xMinMap, this.yMinMap, this.xMaxMap, this.yMaxMap);
            this.AdjustControl();
        };
        this.centerCoor = [x, y];
        if (tmpLev != this.inf[2] || this.mapType == 1)
            for (var k = 0, j = this.zoomFunction.length; k < j; k++)
	     {
            if (typeof (this.zoomFunction[k]) == 'function')
                this.zoomFunction[k]();
        }
    };
    this.pntLocation = function(x, y) 
    {
        if (this.mapType == 1) 
	{
            this.mdLogicX = this.muLogicX = x;
            this.mdLogicY = this.muLogicY = y;
            this.xMinMap = x * 1 - this.logicXlength / 2 * 1;
            this.yMinMap = y * 1 - this.logicYlength / 2 * 1;
            this.xMaxMap = x * 1 + this.logicXlength / 2 * 1;
            this.yMaxMap = y * 1 + this.logicYlength / 2 * 1;
            this.logicXlength = this.xMaxMap - this.xMinMap;
            this.logicYlength = this.yMaxMap - this.yMinMap;
            this.GetVectorMapByCood(this.xMinMap, this.yMinMap, this.xMaxMap, this.yMaxMap);
            this.AdjustControl();
            this.centerCoor = [x, y];
        }
        else
            this.jumpMap(x, y, parseInt(this.inf[2]) + 1);
    };
    this.clearOper = function() 
    {
        this.closeMagnifier();
        if (this.mo)
            this.mo.clearMeasureParam();
        if (this.vmlObj) 
	{
            this.vmlObj.dispose();
            this.vmlObj = null;
        }
        this.calculateXarray = [];
        this.calculateYarray = [];
        this.calculateXarrayW = [];
        this.calculateYarrayW = [];
    };
    this.setCurOper = function(operType)
     {
        this.operType = parseInt(operType);
        this.clearOper();
        switch (this.operType)
	 {
            case 1001:
                this.activeTool = "ZoomIn";
                this.drawAction = "Rect";
                break;
            case 1002:
                this.activeTool = "ZoomOut";
                this.drawAction = "Rect";
                break;
            case 1003:
                this.activeTool = "Pan";
                this.drawAction = "Pan";
                break;
            case 1004:
                this.restoreMap();
                break;
            case 1005:
                if (this.vmlObj != null) 
		        {
                    this.vmlObj.dispose();
                    this.vmlObj = null;
                }
                break;
            case 1006:
                this.refresh();
                break;
            case 2001:
                if (this.so == null) { alert(this.gStr[0]); return; };
                this.so.setQueryMode("SelectByHitting", "Point");
                break;
            case 2002:
                if (this.so == null) { alert(this.gStr[0]); return; };
                this.so.setQueryMode("SelectByRect", "Rect");
                break;
            case 2003:
                if (this.so == null) { alert(this.gStr[0]); return; };
                this.so.setQueryMode("SelectByCircle", "Circle");
                break;
            case 2004:
                if (this.so == null) { alert(this.gStr[0]); return; };
                this.so.setQueryMode("SelectByPolygon", "Area");
                break;
            case 2005:
                if (this.so == null) { alert(this.gStr[0]); return; };
                this.so.setQueryMode("SelectByLine", "Polyline");
                break;
            case 3001:
                if (this.mo == null) { alert(this.gStr[1]); return; };
                this.mo.setMeasureMode("MeasureDistance", "Polyline");
                break;
            case 3002:
                if (this.mo == null) { alert(this.gStr[1]); return; };
                this.mo.setMeasureMode("MeasureArea", "Area");
                break;
            case 3003:
                this.activeTool = "OpenMagnifier";
                this.drawAction = "OpenMagnifier";
                this.ShowMapMagnifier();
                this.addEventListener("mousemove", thisObj.MoveMapMagnifier, false);
                break;
            case 3004:
                if (this.mapLabelObj == null) { alert(this.gStr[2]); return; };
                this.mapLabelObj.SetMarkerMode();
                break;
            case 3005:
                this.activeTool = "Pan";
                this.drawAction = "Pan";
                break;
            case 3006://增加点
                if (this.mapLabelObj == null) { alert(this.gStr[2]); return; };
                this.mapLabelObj.SetAddPoint();
                break;
            case 3007:
                if (this.mapLabelObj == null) { alert(this.gStr[2]); return; };
                this.mapLabelObj.SetAddPoint();
                break;
            default:
                this.activeTool = "Pan";
                this.drawAction = "Pan";
                break;
        }

    };
    this.getClickCoor = function()
     {
        return [this.muLogicX, this.muLogicY];
    };
    this.screenToLogic = function(x, y)
     {
        if (this.mapType != 1) 
	{
            var firstTD_ID = this.subTab[0].getElementsByTagName("TD")[0].id.split("&");
            var physics_x = x - this.mapContainer.offsetLeft;
            var physics_y = y - this.mapContainer.offsetTop;
            physics_x = physics_x / this.rowWidth * this.logicXlength;
            physics_y = -1 * physics_y / this.rowWidth * this.logicYlength;
            var boxX = (this.logicXlength / Math.pow(2, this.inf[2] + 1)) * firstTD_ID[1] * 1 + this.xMinMap;
            var boxY = (this.logicYlength / Math.pow(2, this.inf[2] + 1)) * (firstTD_ID[0] * 1 + 1) + this.yMinMap;
            physics_x = physics_x + boxX;
            physics_y = physics_y + boxY;
            return [physics_x, physics_y];
        }
        else 
	{
            var lx = this.xMinMap + x / this.pObj.offsetWidth * this.logicXlength;
            var ly = this.yMinMap + (this.pObj.offsetHeight - y) / this.pObj.offsetHeight * this.logicYlength;
            return [lx, ly];
        }
    };
    this.logicToScreen = function(x, y)
     {
        var wx = 0, wy = 0;
        if (this.mapType != 1)
	 {
            wx = Math.round((x - this.xMinMap) / this.logicXlength * this.rowWidth);
            wy = Math.round((this.yMaxMap - y) / this.logicYlength * this.rowWidth);
        }
        else 
	{
            wx = Math.round((x - this.rect[0]) / this.logicXlength * this.pObj.clientWidth);
            wy = Math.round((this.rect[3] - y) / this.logicYlength * this.pObj.clientHeight);
        }
        return [wx, wy];

    };
    this.getCurWinLog = function() 
    {
        if (this.mapType != 1) 
	{
            var coor1 = this.screenToLogic(0, this.pObj.clientHeight);
            var coor2 = this.screenToLogic(this.pObj.clientWidth, 0);
            return coor1.concat(coor2);
        }
        else
	 {
            return [this.xMinMap, this.yMinMap, this.xMaxMap, this.yMaxMap];
        }
    };
    this.addControl = function(obj, isCanMove)
     {
        if (obj.div) obj = obj.div;
        if (obj.ctlFlg == "so")
        { this.so = obj; return; }
        if (typeof (obj) == "object" && isCanMove)
            this.overLay.appendChild(obj);
        else if (typeof (obj) == "object" && !isCanMove)
            this.pObj.appendChild(obj);
        if (obj.style.zIndex == 0)
            obj.style.zIndex = 1001;
        obj.style.display = "";
        obj.style.visibility = "visible";

    };
    this.removeControl = function(obj, isCanMove)
     {
        if (obj.div) obj = obj.div;
        if (obj.ctlFlg == "so")
        { this.so = null; return; };
        if (obj.ctlFlg == "mo")
        { this.mo = null; return; }
        if (typeof (obj) == "object" && isCanMove)
            this.overLay.removeChild(obj);
        else if (typeof (obj) == "object" && !isCanMove)
            this.pObj.removeChild(obj);
    };
    this.loadConfig = function(mapConfig) 
    {
        if (mapConfig) {
            mapConfig.apply(this, arguments);
        }
        this.logicXlength = this.xMaxMap - this.xMinMap;
        this.logicYlength = this.yMaxMap - this.yMinMap;
        this.restoreParam = [this.xMinMap + this.logicXlength / 2, this.yMinMap + this.logicYlength / 2, 1];
    };
    this.loadAllCtl = function() 
    {
        this.Point();
        var sc = new IMSScale();
        sc.setUnits([103133.845, 1000], ["米", "千米"]);
        this.addControl(sc, false);
        if (this.mapType != 1) 
	{
            var s = new IMSNavigation();
            this.addControl(s, false);
        }
        var l = new IMSLogo();
        this.addControl(l, false);
        var mo = new IMSMeasure();
        mo.setDistanceUnits([103133.845, 1000], ["米", "千米"]);
        mo.setAreaUnits([10636589908.557, 1000000], ["平方米", "平方千米"]);
        this.addControl(mo, false);
        var eagleEye = new IMSEagleMap();
        this.addControl(eagleEye, false);
    };
    this.getCurLev = function()
     {
        return parseInt(this.inf[2]) + 1;
    };
    this.refresh = function() 
    {
        if (this.mapType == 1) this.GetVectorMap();
        else this.pntLocation(this.centerCoor[0], this.centerCoor[1]);
    };
    this.moveTo = function(lx, ly) 
    {
        var xy = thisObj.logicToScreen(lx, ly);
        this.DblClickMoveToCenter(xy[0] + this.overLay.offsetLeft, xy[1] + this.overLay.offsetTop);
    };
    this.getCenterPnt = function() 
    {
        return this.centerCoor.slice(0);
    };
    this.setRectDrawStyle = function(lineColor, lineWidth, fillColor, fillOpacity) 
    {
        this.drawStyle[0][0] = lineColor;
        this.drawStyle[0][1] = lineWidth;
        this.drawStyle[0][2] = fillColor;
        this.drawStyle[0][3] = fillOpacity;
        if (thisObj.vmlObj)
            thisObj.vmlObj.setStyle(thisObj.drawStyle[0][0], thisObj.drawStyle[0][1], thisObj.drawStyle[0][2], thisObj.drawStyle[0][3]);
    };
    this.setCircleDrawStyle = function(lineColor, lineWidth, fillColor, fillOpacity) 
    {
        this.drawStyle[1][0] = lineColor;
        this.drawStyle[1][1] = lineWidth;
        this.drawStyle[1][2] = fillColor;
        this.drawStyle[1][3] = fillOpacity;
        if (thisObj.vmlObj)
            thisObj.vmlObj.setStyle(thisObj.drawStyle[1][0], thisObj.drawStyle[1][1], thisObj.drawStyle[1][2], thisObj.drawStyle[1][3]);
    };
    this.setLineDrawStyle = function(lineColor, lineWidth)
     {
        this.drawStyle[2][0] = lineColor;
        this.drawStyle[2][1] = lineWidth;
        if (thisObj.vmlObj)
            thisObj.vmlObj.setStyle(thisObj.drawStyle[2][0], thisObj.drawStyle[2][1], thisObj.drawStyle[2][2], thisObj.drawStyle[2][3]);
    };
    this.setPolygonDrawStyle = function(lineColor, lineWidth, fillColor, fillOpacity)
     {
        this.drawStyle[3][0] = lineColor;
        this.drawStyle[3][1] = lineWidth;
        this.drawStyle[3][2] = fillColor;
        this.drawStyle[3][3] = fillOpacity;
        if (thisObj.vmlObj)
            thisObj.vmlObj.setStyle(thisObj.drawStyle[3][0], thisObj.drawStyle[3][1], thisObj.drawStyle[3][2], thisObj.drawStyle[3][3]);
    };
    this.getMapViewSize = function()
     {
        return [this.pObj.clientWidth, this.pObj.clientHeight];
    };
    this.closeGridLayer = function(index) 
    {
        if (index > 0) 
	{
            if (this.seeLay[index].hasChildNodes())
                this.seeLay[index].removeChild(this.subTab[index]);
            this.gridImageUrl.splice(index, 1);
        }
        if (index == 0)
            this.seeLay[0].style.visibility = "hidden";
        if (document.getElementById("zoomTab" + index))
            document.getElementById("zoomTab" + index).style.display = "none";
    };

    this.openGridLayer = function(index, url)
     {
        if (index == 0)
	 {
            if (this.seeLay[0].style.visibility != "visible")
	     {
                this.seeLay[0].style.visibility = "visible";
            }
        }
        if (index > 0)
	 {
            if (typeof (url) != "undefined")
                this.gridImageUrl[index] = url;
            if (!this.seeLay[index].hasChildNodes()) 
	    {
                this.subTab[index] = document.createElement("TABLE");
                this.subTab[index].id = "SubTable" + index;
                this.subTab[index].border = 0;
                this.subTab[index].cellPadding = 0;
                this.subTab[index].cellSpacing = 0;
                var infotmp = "";
                for (var i = 0; i < this.subTab[0].rows.length; i++)
		 {
                    var newTR = this.subTab[index].insertRow(i);
                    for (var loop = 0; loop < this.subTab[0].rows[0].cells.length; loop++)
                        var newTD = newTR.insertCell(loop);
                }
                this.seeLay[index].appendChild(this.subTab[index]);

                for (var i = 0; i < this.subTab[0].rows.length; i++)
		 {
                    for (var j = 0; j < this.subTab[0].rows[i].cells.length; j++)
		     {
                        this.subTab[index].rows[i].cells[j].id = this.subTab[0].rows[i].cells[j].id;
                        infotmp = this.subTab[0].rows[i].cells[j].id.split("&")
                        this.AddImage(infotmp[2], infotmp[1], infotmp[0], this.subTab[index].rows[i].cells[j], index);
                    }
                }
                this.seeLay[index].style.width = this.seeLay[0].style.width;
                this.seeLay[index].style.height = this.seeLay[0].style.height;
                this.seeLay[index].style.left = this.seeLay[0].style.left;
                this.seeLay[index].style.top = this.seeLay[0].style.top;
            }
        }
        if (document.getElementById("zoomTab" + index))
            document.getElementById("zoomTab" + index).style.display = "";
    };
    this.openVectMap = function(index)
     {
        var tmp = this.getCurWinLog();
        var url = this.vectImageUrl[index] + "?layerNo=" + index + "&LogicMinX=" + tmp[0] + "&LogicMinY=" + tmp[1] + "&LogicMaxX=" + tmp[2] + "&LogicMaxY=" + tmp[3];
        url += "&ImageWidth=" + this.pObj.clientWidth + "&ImageHeight=" + this.pObj.clientHeight + "&ImageFormat=" + this.vectImageFormat + "&rnd=" + Math.random();
        this.vectLay[index].firstChild.src = url;
    };
    this.closeVectLayer = function(index)
     {
        this.vectLay[index].innerHTML = "";
    };
    this.getGridCode = function(x, y)
     {
        var offset = this.inf[2];
        var row = Math.floor((y - this.yMinMap) * (2 << offset) / this.logicYlength);
        var col = Math.floor((x - this.xMinMap) * (2 << offset) / this.logicXlength);
        return row * (2 << offset) + col;
    };
    this.getGridCodes = function(sx, sy, ex, ey) 
    {
        if ((sx < this.xMinMap && ex < this.xMinMap) || (sx > this.xMaxMap && ex > this.xMaxMap)) return "";
        if ((sy < this.yMinMap && ey < this.yMinMap) || (sy > this.yMaxMap && ey > this.yMaxMap)) return "";
        var offset = this.inf[2];
        sx = sx < this.xMinMap ? this.xMinMap : sx;
        sx = sx > this.xMaxMap ? (this.xMaxMap - 0.00001) : sx;
        sy = sy < this.yMinMap ? this.yMinMap : sy;
        sy = sy > this.yMaxMap ? (this.yMaxMap - 0.00001) : sy;
        ex = ex < this.xMinMap ? this.xMinMap : ex;
        ex = ex > this.xMaxMap ? (this.xMaxMap - 0.00001) : ex;
        ey = ey < this.yMinMap ? this.yMinMap : ey;
        ey = ey > this.yMaxMap ? (this.yMaxMap - 0.00001) : ey;
        var row1 = Math.floor((sy - this.yMinMap) * (2 << offset) / this.logicYlength);
        var col1 = Math.floor((sx - this.xMinMap) * (2 << offset) / this.logicXlength);
        var gridCodes = "";
        var row = Math.floor((ey - this.yMinMap) * (2 << offset) / this.logicYlength);
        var col = Math.floor((ex - this.xMinMap) * (2 << offset) / this.logicXlength);
        var maxR = row1 > row ? row1 : row;
        var minR = row1 > row ? row : row1;
        var maxC = col1 > col ? col1 : col;
        var minC = col1 > col ? col : col1;
        for (var i = minR; i <= maxR; i++)
	 {
            for (var j = minC; j <= maxC; j++)
	     {
                var gridCode = i * (2 << offset) + j;
                gridCodes += gridCode + ",";
            }
        }
        return gridCodes.substr(0, gridCodes.length - 1);
    };
    this.gridCodeConvert = function(index, baseLevel, currentLevel) 
    {
        var strTmp = index.split("&");
        var row = parseInt(parseInt(strTmp[0]) / Math.pow(2, currentLevel - baseLevel));
        var lin = parseInt(parseInt(strTmp[1]) / Math.pow(2, currentLevel - baseLevel));
        if (currentLevel >= baseLevel)
            return row * Math.pow(2, this.levelNum) + lin;
        else 
	{
            var newgds = new Array();
            var zongshu = Math.pow(2, (baseLevel - currentLevel));
            for (var i = 0; i < zongshu; i++)
                for (var j = 0; j < zongshu; j++)
                newgds.push((row + i) * Math.pow(2, this.levelNum) + (lin + j));
            return newgds;
        }
    };
    this.addEventListener = function(evType, f, capture)
     {

        switch (evType.toLowerCase())
	 {
            case "mousedown":
                for (var i = 0, j = this.addMouseDownFunction.length; i <= j; i++)
                    if (this.addMouseDownFunction[i] == null || typeof (this.addMouseDownFunction[i]) == "undefined")
                { this.addMouseDownFunction[i] = f; break; };
                break;
            case "mousemove":
                for (var i = 0, j = this.addMouseMoveFunction.length; i <= j; i++)
                    if (this.addMouseMoveFunction[i] == null || typeof (this.addMouseMoveFunction[i]) == "undefined")
                { this.addMouseMoveFunction[i] = f; break; };
                break;
            case "mouseup":
                for (var i = 0, j = this.addMouseUpFunction.length; i <= j; i++)
                    if (this.addMouseUpFunction[i] == null || typeof (this.addMouseUpFunction[i]) == "undefined")
                { this.addMouseUpFunction[i] = f; break; };
                break;
            case "dblclick":
                for (var i = 0, j = this.addMouseDblClickFunction.length; i <= j; i++)
                    if (this.addMouseDblClickFunction[i] == null || typeof (this.addMouseDblClickFunction[i]) == "undefined")
                { this.addMouseDblClickFunction[i] = f; break; };
                break;
            case "mouseout":
                for (var i = 0, j = this.addMouseOutFunction.length; i <= j; i++)
                    if (this.addMouseOutFunction[i] == null || typeof (this.addMouseOutFunction[i]) == "undefined")
                { this.addMouseOutFunction[i] = f; break; };
                break;
            case "zoom":
                for (var i = 0, j = this.zoomFunction.length; i <= j; i++)
                    if (this.zoomFunction[i] == null || typeof (this.zoomFunction[i]) == "undefined")
                { this.zoomFunction[i] = f; break; };
                break;
            case "resize":
                for (var i = 0, j = this.resizeFunction.length; i <= j; i++)
                    if (this.resizeFunction[i] == null || typeof (this.resizeFunction[i]) == "undefined")
                { this.resizeFunction[i] = f; break; };
                break;
            case "keypress":
                for (var i = 0, j = this.addKeyPressfunction.length; i <= j; i++)
                    if (this.addKeyPressfunction[i] == null || typeof (this.addKeyPressfunction[i]) == "undefined")
                { this.addKeyPressfunction[i] = f; break; };
                break;
            default:
                ZDEvent.addListener(this.pObj, evType, f, capture);
                break;

        }
    };
    this.removeEventListener = function(evType, f, capture)
     {
        switch (evType.toLowerCase())
	 {
            case "mousedown":
                for (var i = 0; i < this.addMouseDownFunction.length; i++) 
		{
                    if (this.addMouseDownFunction[i] == f)
                        this.addMouseDownFunction.splice(i, 1, null);
                }
                break;
            case "mousemove":
                for (var i = 0; i < this.addMouseMoveFunction.length; i++) 
		{
                    if (this.addMouseMoveFunction[i] == f)
                        this.addMouseMoveFunction.splice(i, 1, null);
                }
                break;
            case "mouseup":
                for (var i = 0; i < this.addMouseUpFunction.length; i++)
		 {
                    if (this.addMouseUpFunction[i] == f)
                        this.addMouseUpFunction.splice(i, 1, null);
                }
                break;
            case "mouseout":
                for (var i = 0; i < this.addMouseOutFunction.length; i++)
		 {
                    if (this.addMouseOutFunction[i] == f)
                        this.addMouseOutFunction.splice(i, 1, null);
                }
                break;
            case "dblclick":
                for (var i = 0; i < this.addMouseDblClickFunction.length; i++)
		 {
                    if (this.addMouseDblClickFunction[i] == f)
                        this.addMouseDblClickFunction.splice(i, 1, null);
                }
                break;
            case "zoom":
                for (var i = 0; i < this.zoomFunction.length; i++)
		 {
                    if (this.zoomFunction[i] == f)
                        this.zoomFunction.splice(i, 1, null);
                }
                break;
            case "resize":
                for (var i = 0, j = this.zoomFunction.length; i < j; i++)
		 {
                    if (this.resizeFunction[i] == f)
                        this.resizeFunction.splice(i, 1, null);
                }
                break;
            case "keypress":
                for (var i = 0, j = this.addKeyPressfunction.length; i < j; i++) 
		{
                    if (this.addKeyPressfunction[i] == f)
                        this.addKeyPressfunction.splice(i, 1, null);
                }
                break;
                break;
            default:
                ZDEvent.removeListener(this.pObj, evType, f, capture);
                break;
        }
    };
    this.iEVersion = function()
     {
        var Browser_Agent = navigator.userAgent;
        var Version_Start = Browser_Agent.indexOf("MSIE");
        var Version_End = Browser_Agent.indexOf(";", Version_Start);
        var Actual_Version = Browser_Agent.substring(Version_Start + 5, Version_End);
        return parseFloat(Actual_Version);
    };
    this.loadConfig(mapConfig);
    this.Init();
    if (this.isIE && this.iEVersion() < 6.9)
        setTimeout("correctPNG()", 1);
};

function AddVMLTag()
 {
    if (document.namespaces) 
    {
        document.namespaces.add("v", "urn:schemas-microsoft-com:vml"); //添加VML标记
    }
    else
     {
        alert("添加VML标记失败！可能此浏览器不支持VML。");
    }
    var _oStyle = document.createElement("style");
    document.body.appendChild(_oStyle);
    _oStyle.styleSheet.addRule("v\\:shape", "behavior:url(#default#VML)");
    _oStyle.styleSheet.addRule("v\\:oval", "behavior:url(#default#VML)");
    _oStyle.styleSheet.addRule("v\\:rect", "behavior:url(#default#VML)");
    _oStyle.styleSheet.addRule("v\\:fill", "behavior:url(#default#VML)");
    _oStyle.styleSheet.addRule("v\\:circle", "behavior:url(#default#VML)");
    _oStyle.styleSheet.addRule("v\\:polyline", "behavior:url(#default#VML)");
    _oStyle.styleSheet.addRule("v\\:area", "behavior:url(#default#VML)");
    
};

function IMSPalette(pElement, drawType)
 {
    var drawObj = null;
    var isIe = navigator.appName.indexOf("Microsoft Internet Explorer") != -1 ? 1 : 0;
    switch (drawType.toLowerCase()) 
    {
        case "rect":
            drawObj = isIe ? new VmlRectClass(pElement, false) : new SvgRectClass(pElement, false);
            break;
        case "circle":
            drawObj = isIe ? new VmlRectClass(pElement, true) : new SvgRectClass(pElement, true);
            break;
        case "polyline":
            drawObj = isIe ? new VmlPolylineClass(pElement, false, false) : new SvgPolylineClass(pElement, false);
            break;
        case "area":
            drawObj = isIe ? new VmlPolylineClass(pElement, true, true) : new SvgPolylineClass(pElement, true);
            break;
        default:
            break;
    }
    drawObj.flash = PaletteFalsh;
    return drawObj;
};

function PaletteFalsh(flashtimes, interval)
{
    interval = interval*1000;
	    flashtimes = flashtimes*2;	    
	    if(typeof(lineInterval)=="number"){   
	        clearInterval(lineInterval);
            flashObj.style.visibility = "hidden";
        }
        if(typeof(PaletteObj)=="object"){
            //PaletteObj.dispose();
        }
        PaletteObj = this;
        flashObj = thisObj.isIE?this.obj:this.svgObj;
	    flashMapDiv=function (){					
			    if(flashObj!=null&&flashtimes > 0){			        
			        if(flashObj.style.visibility == "visible")
			            flashObj.style.visibility = "hidden";
			         else
			            flashObj.style.visibility = "visible";
			        flashtimes--; 
			    }
			    else{
			        flashObj.style.visibility = "hidden";
			    	clearTimeout(lineInterval);
			    	if(flashObj.parentNode)
			    	flashObj.parentNode.innerHTML="";
			    	//PaletteObj.dispose();
			    }
			    lineInterval = setTimeout("flashMapDiv()",interval)
			}
			flashMapDiv();
}

function VmlRectClass(pElement, flag) 
{
    this.obj = null;
    this.parent = pElement;
    if (flag)
     {
        this.obj = document.createElement("v:oval");
        this.obj.radius = 0;
    }
    else
     {
        this.obj = document.createElement("v:rect");
    }
    this.obj.style.width = "0px";
    this.obj.style.height = "0px";
    this.obj.style.left = "0px";
    this.obj.style.top = "0px";
    this.obj.id = "circleOnMap";
    this.obj.filled = "t";
    this.obj.fillcolor = "#119";
    this.obj.strokecolor = "#f06";
    this.obj.strokeweight = "1pt";
    this.obj.style.position = "absolute";
    this.obj.style.zIndex = 10;
    this.obj.flashCount = 0;
    this.obj.flashTimes = 3;
    this.obj.flashFlg = false;
    this.Mx = 0;
    this.My = 0;
    pElement.appendChild(this.obj);
    this.obj.appendChild(document.createElement("v:fill"));
    this.obj.fill.opacity = "0.45";
    this.setStyle = function(lineColor, lineWidth, fillColor, fillOpacity) {
        this.obj.strokecolor = lineColor ? lineColor : "#f06";
        this.obj.strokeweight = lineWidth ? lineWidth : "1pt";
        this.obj.fillcolor = fillColor ? fillColor : "#119";
        this.obj.fill.opacity = fillOpacity ? fillOpacity : "0.45";
    };
    this.setStartPnt = function(x, y)
     {
        this.Mx = x;
        this.My = y;
    };
    this.drawing = function(mx, my)
     {
        if (!flag) 
	{
            this.obj.style.top = Math.min(my, this.My) + "px";
            this.obj.style.left = Math.min(mx, this.Mx) + "px";
            this.obj.style.width = Math.abs(mx - this.Mx) + "px";
            this.obj.style.height = Math.abs(my - this.My) + "px";
        }
        else
	 {
            var w = Math.abs(mx - this.Mx);
            var h = Math.abs(my - this.My);
            this.obj.radius = Math.sqrt(w * w + h * h);
            this.obj.style.width = this.obj.radius * 2 + "px";
            this.obj.style.height = this.obj.radius * 2 + "px";
            this.obj.style.left = this.Mx - this.obj.radius + "px";
            this.obj.style.top = this.My - this.obj.radius + "px";
        }
    };
    this.draw = function() { };
    this.flash = function(times, interval) { };
    this.dispose = function()
     {
        if (this.obj != null)
	 {
            this.parent.removeChild(this.obj);
            delete this.obj;
        }
    };
};


function SvgRectClass(pElement, flag)
 {
    this.obj = null;
    this.paletteObj = null;
    this.svgObj = document.createElementNS("http://www.w3.org/2000/svg", "svg");
    this.svgObj.setAttribute("width", 100000000);
    this.svgObj.setAttribute("height", 100000000);
    pElement.appendChild(this.svgObj);
    if (flag)
        this.paletteObj = document.createElementNS("http://www.w3.org/2000/svg", "circle");
    else
        this.paletteObj = document.createElementNS("http://www.w3.org/2000/svg", "rect");
    this.paletteObj.setAttribute("fill", "#119");
    this.paletteObj.setAttribute("stroke", "#f06");
    this.paletteObj.setAttribute("stroke-width", "1.5px");
    this.paletteObj.setAttribute("fill-opacity", 0.45);
    this.svgObj.appendChild(this.paletteObj);
    this.Mx = 0;
    this.My = 0;
    this.setStartPnt = function(x, y) 
    {
        this.Mx = x;
        this.My = y;
    };
    this.setStyle = function(lineColor, lineWidth, fillColor, fillOpacity) {
        var lColor = lineColor ? lineColor : "#f06";
        var lWidth = lineWidth ? lineWidth : "1.5px";
        var fColor = fillColor ? fillColor : "#119";
        var fOpacity = fillOpacity ? fillOpacity : 0.45;
        this.paletteObj.setAttribute("stroke", lColor);
        this.paletteObj.setAttribute("stroke-width", lWidth);
        this.paletteObj.setAttribute("fill", fColor);
        this.paletteObj.setAttribute("fill-opacity", fOpacity);
    };
    this.drawing = function(x, y)
     {
        var mx = x;
        var my = y;
        if (flag) 
	{
            var radius = Math.sqrt((mx - this.Mx) * (mx - this.Mx) + (my - this.My) * (my - this.My));
            this.paletteObj.setAttribute("r", radius + "px");
            this.paletteObj.setAttribute("cx", this.Mx + "px");
            this.paletteObj.setAttribute("cy", this.My + "px");
        }
        else
	 {
            var startX = Math.min(this.Mx, mx);
            var startY = Math.min(this.My, my);
            var dx = Math.abs(mx - this.Mx);
            var dy = Math.abs(my - this.My);
            this.paletteObj.setAttribute("width", dx);
            this.paletteObj.setAttribute("height", dy);
            this.paletteObj.setAttribute("x", startX);
            this.paletteObj.setAttribute("y", startY);
        }
    };
    this.dispose = function() 
    {
        this.paletteObj.setAttribute("width", "0px");
        this.paletteObj.setAttribute("height", "0px");
        pElement.removeChild(this.svgObj);
    };
};
function SvgPolylineClass(pElement, isArea) 
{
    this.obj = null;
    this.paletteObj = null;
    this.svgObj = document.createElementNS("http://www.w3.org/2000/svg", "svg");
    this.svgObj.setAttribute("width", 100000000);
    this.svgObj.setAttribute("height", 100000000);
    pElement.appendChild(this.svgObj);
    this.paletteObj = document.createElementNS("http://www.w3.org/2000/svg", "path");
    this.paletteObj.setAttribute("fill", "#119");
    this.paletteObj.setAttribute("stroke", "#f06");
    this.paletteObj.setAttribute("stroke-width", "1.5px");
    this.paletteObj.setAttribute("fill-opacity", 0.45);
    this.svgObj.appendChild(this.paletteObj);
    this.Mx = 0;
    this.My = 0;
    this.pntArr = new Array();
    this.setStartPnt = function(x, y)
     {
        this.Mx = x;
        this.My = y;
    };
    this.setStyle = function(lineColor, lineWidth, fillColor, fillOpacity) {
        var lColor = lineColor ? lineColor : "#f06";
        var lWidth = lineWidth ? lineWidth : "1px";
        var fColor = fillColor ? fillColor : "#119";
        var fOpacity = fillOpacity ? fillOpacity : 0.45;
        this.paletteObj.setAttribute("stroke", lColor);
        this.paletteObj.setAttribute("stroke-width", lWidth);
        this.paletteObj.setAttribute("fill", fColor);
        this.paletteObj.setAttribute("fill-opacity", fOpacity);
    };
    this.drawing = function(x, y)
     {
        var mx = x;
        var my = y;
        this.pntArr.push(mx + "," + my);
        this.len = this.pntArr.length;
        var pntStr = "M";
        for (var i = 0; i < this.len; i++)
	 {
            var temp = this.pntArr[i].split(",");
            pntStr += temp[0] + " " + temp[1] + "L";
        }
        if (isArea) 
	{
            pntStr = pntStr.substring(0, pntStr.length - 1) + "Z";
            this.paletteObj.setAttribute("d", pntStr);
        }
        else 
	{
            pntStr = pntStr.substring(0, pntStr.length - 1);
            this.paletteObj.setAttribute("fill", "white");
            this.paletteObj.setAttribute("fill-opacity", 0);
            this.paletteObj.setAttribute("d", pntStr);
        }
        this.pntArr.pop();
    };
    this.draw = function(dotInfo) 
    {
        this.pntArr = dotInfo;
        this.len = this.pntArr.length;
        var pntStr = "M";
        for (var i = 0; i < this.len; i++)
	 {
            var temp = this.pntArr[i].split(",");
            pntStr += temp[0] + " " + temp[1] + "L";
        }
        if (isArea)
	 {
            pntStr = pntStr.substring(0, pntStr.length - 1) + "Z";
            this.paletteObj.setAttribute("d", pntStr);
        }
        else
	 {
            pntStr = pntStr.substring(0, pntStr.length - 1);
            this.paletteObj.setAttribute("fill", "white");
            this.paletteObj.setAttribute("fill-opacity", 0);
            this.paletteObj.setAttribute("d", pntStr);
        }
    };
    this.appendPoint = function(x, y)
     {
        this.pntArr.push(x + "," + y);
    };
    this.dispose = function() 
    {
        this.paletteObj.setAttribute("d", "");
        pElement.removeChild(this.svgObj);
    };
};

function VmlPolylineClass(pElement, isArea, isClosed, vmlId) 
{
    this.obj = document.createElement("v:shape");
    this.obj.id = vmlId ? vmlId : "lineOnMap" + Math.round(Math.random() * 10000);
    this.obj.filled = "f";
    if (isArea) 
    {
        this.obj.filled = "t";
        this.obj.fillcolor = "#119";
    };
    this.obj.strokecolor = "#f06";
    this.obj.strokeweight = "1px";
    this.obj.style.position = "absolute";
    this.obj.style.zIndex = 10;
    this.obj.style.width = 50;
    this.obj.style.height = 50;
    this.obj.style.left = "0px";
    this.obj.style.top = "0px";
    this.obj.coordsize = "50,50";
    this.obj.style.visibility = "visible";
    this.flashCount = 0;
    this.flashTimes = 3;
    this.flashFlg = false;
    this.Mx = 0;
    this.My = 0;
    this.pntArr = new Array();
    pElement.appendChild(this.obj);
    if (isArea) 
    {
        this.obj.appendChild(document.createElement("v:fill"));
        this.obj.fill.opacity = "0.3";
    };
    this.setStyle = function(lineColor, lineWidth, fillColor, fillOpacity) 
    {
        this.obj.strokecolor = lineColor ? lineColor : "#f06";
        this.obj.strokeweight = lineWidth ? lineWidth : "1px";
        if (isClosed)
	 {
            this.obj.fillcolor = fillColor ? fillColor : "#119";
            this.obj.fill.opacity = fillOpacity ? fillOpacity : "0.3";
        }
    };
    this.setStartPnt = function(x, y)
     {
        this.Mx = x;
        this.My = y;
    };
    this.drawing = function(mx, my)
     {
        this.pntArr.push(mx + "," + my);
        //csh
//        if (isClosed || isArea)
//            this.pntArr.push(this.Mx + "," + this.My);
        this.obj.path = this.getPntStr();
//        if (isClosed || isArea)
//            this.pntArr.pop();
       //end
        this.pntArr.pop();
    };
    this.getPntStr = function()
     {
        var pntStr = "";
        var first = this.pntArr[0].toString();
        var find = first.indexOf(",");
        if (find > 0) 
	{
            pntStr = "m " + first + " l ";
            var len = this.pntArr.length;
            for (var i = 1; i < len; i++)
	     {
                pntStr += this.pntArr[i] + " ";
            }
            if (isClosed || isArea)
                pntStr += " x e";
            else
                pntStr += " e ";
        }
        return pntStr;
    };
    this.appendPoint = function(mx, my)
     {
          this.pntArr.push(mx + "," + my);
    };
   //======csh
    this.clearPoint = function()
    {
         var len = this.pntArr.length;
         for (var i = 0; i < len; i++)
         {
             this.pntArr.pop();
         }
         this.obj.path = "m 0,0 l 0,0 e";
         return ;
    };
    //======end
    this.draw = function(pntArrObj)
     {
        this.pntArr = pntArrObj;
        this.obj.path = this.getPntStr();
    };
    this.dispose = function() 
    {
        if (this.obj != null)
	   {
            this.obj.path = "m 0,0 l 0,0 e";
            pElement.removeChild(this.obj);
            delete this.obj;
        }
    };

};

function IMSNavigation(barType) 
{
    if (thisObj.mapType == 1) 
    {
        throw new Error(0, "IMSNavigation不能加载在类型为IMSMapType.Vector的地图上！");
        return;
    }
    this.up_url = "images/up.png";
    this.right_url = "images/right.png";
    this.down_url = "images/down.png";
    this.left_url = "images/left.png";
    this.restore_url = "images/refresh.png";
    this.zoom_in_url = "images/add.png";
    this.zoom_out_url = "images/sub.png";
    this.cursor_url = "images/a_f.png";
    this.node_url = "images/a_t.gif";
    this.ctlleft = 10;
    this.ctltop = 10;
    thisObj.barMoveSpeed = 30;
    this.isStandBar = barType ? barType : 0;
    barType = this.isStandBar;
    node_url_size = GetImgSize(this.node_url);
    this.setImage = function(up_url, right_url, down_url, left_url, restore_url, zoom_in_url, zoom_out_url, cursor_url, node_url) {
        this.up_url = up_url ? up_url : "images/up.png";
        this.right_url = right_url ? right_url : "images/right.png";
        this.down_url = down_url ? down_url : "images/down.png";
        this.left_url = left_url ? left_url : "images/left.png";
        this.restore_url = restore_url ? restore_url : "images/refresh.png";
        this.zoom_in_url = zoom_in_url ? zoom_in_url : "images/add.png";
        this.zoom_out_url = zoom_out_url ? zoom_out_url : "images/sub.png";
        this.cursor_url = cursor_url ? cursor_url : "images/a_f.png";
        this.node_url = node_url ? node_url : "images/a_t.gif";
    };
    this.setControlPos = function(left, top)
     {
        this.ctlleft = left;
        this.ctltop = top;
    };
    this.moveSpeed = function(speed) 
    {
        thisObj.barMoveSpeed = speed;
    };
    this.setMapShade = function(flag) 
    {
        if (typeof (flag) == "boolean")
            thisObj.shadeFlg = flag;
    }

    var scaleHtml = "<div id='mycursor' style='position:absolute; left:0px; top:0px;'>";
    scaleHtml += "<IMG src='" + this.cursor_url + "' style='cursor:pointer;'>";
    scaleHtml += "</div>";
    scaleHtml += "<table width='17px'  border='0' cellpadding='0' cellspacing='0' id='myscale' unselectable ='on'>";
    scaleHtml += "<tr><td width='17px'><img name='first' src='" + this.node_url + "'></td></tr>";
    for (var i = 0; i < thisObj.levelNum - 2; i++) 
    {
        scaleHtml += "<tr><td><img src='" + this.node_url + "' height='12px'></td></tr>";
    }
    scaleHtml += "<tr><td><img name='last' src='" + this.node_url + "'></td></tr>";
    scaleHtml += "</table>";
    var Htmls0 = "<table  border='0' cellspacing='0' cellpadding='1'>";
    Htmls0 += "<tr>";
    Htmls0 += "<td>&nbsp;</td>";
    Htmls0 += "<td align='center'><img alt='上移' id='ImsRulerUP' style='cursor:pointer;' src='" + this.up_url + "'></td>";
    Htmls0 += "<td>&nbsp;</td>";
    Htmls0 += "</tr>";
    Htmls0 += "<tr>";
    Htmls0 += "<td align='center'><img alt='左移' id='ImsRulerLEFT' style='cursor:pointer;' src='" + this.left_url + "'></td>";
    Htmls0 += "<td align='center'><img alt='复位' id='ImsRulerREFURBISH' style='cursor:pointer;' src='" + this.restore_url + "'></td>";
    Htmls0 += "<td align='center'><img alt='右移' id='ImsRulerRIGHT' style='cursor:pointer;'  src='" + this.right_url + "'></td>";
    Htmls0 += "</tr>";
    Htmls0 += "<tr>";
    Htmls0 += "<td>&nbsp;</td>";
    Htmls0 += "<td align='center'><img alt='下移' id='ImsRulerDOWN' style='cursor:pointer;'  src='" + this.down_url + "'></td>";
    Htmls0 += "<td>&nbsp;</td>";
    Htmls0 += "</tr>";
    Htmls0 += "<tr>";
    Htmls0 += "<td>&nbsp;</td>";
    Htmls0 += "<td>";
    Htmls0 += "<table border='0' cellspacing='0' cellpadding='0'>";
    Htmls0 += "<tr><td><img alt='放大' id='ImsRulerZoomIn' style='cursor:pointer;' src='" + this.zoom_in_url + "'></td></tr>";
    if (this.isStandBar == 0)
        Htmls0 += "<tr><td><div style='position:relative; width:17px;'>" + scaleHtml + "</div></td></tr>";
    else
        Htmls0 += "<tr><td height='2'></td></tr>";
    Htmls0 += "<tr><td><img alt='缩小' id='ImsRulerZoomOut' style='cursor:pointer;' src='" + this.zoom_out_url + "'></td></tr>";
    Htmls0 += "</table></td>";
    Htmls0 += "<td>&nbsp;</td>";
    Htmls0 += "</tr></table>";

    this.div = CreatDiv(document.body, "navigationBar", this.ctlleft, this.ctltop, "absolute", 3, "visible", null, Htmls0);
    this.div.style.visibility = "hidden";
    var mcTop = null;
    var mouseY = null;
    if (this.isStandBar == 0) 
    {
        window.enabledCursor = false;
        this.mycursor_obj = document.getElementById("mycursor");
        this.mycursor_obj.StartDrag = function(Evnt) 
	{
            if (thisObj.isMapMove) return;
            var e = Evnt ? Evnt : event;
            if (e.button == 1 && thisObj.isIE)
	     {
                var obj = document.getElementById("mycursor");
                mcTop = parseInt(obj.style.top);
                mouseY = e.clientY + document.body.scrollTop;
            };
            if (e.button == 0 && !thisObj.isIE)
	     {
                e.preventDefault();
                var obj = document.getElementById("mycursor");
                mcTop = parseInt(obj.style.top);
                mouseY = e.pageY;
            };
            window.enabledCursor = true;
            Evnt ? Evnt.preventDefault() : event.returnValue = false;
        };
        this.mycursor_obj.StartMove = function(Evnt)
	 {
            if (thisObj.isMapMove) return;
            if (window.enabledCursor)
	     {
                Evnt ? Evnt.preventDefault() : event.returnValue = false;
                var e = Evnt ? Evnt : event;
                var obj = document.getElementById("mycursor");
                var curMouseY = null;
                if (thisObj.isIE)
                    curMouseY = e.clientY + document.body.scrollTop;
                else
                    curMouseY = e.pageY;
                var a = GetAbsolutePos(document.first)[1] + document.first.offsetHeight / 2;
                var b = GetAbsolutePos(document.last)[1] + document.last.offsetHeight / 2;
                if (curMouseY >= a && curMouseY <= b)
                    obj.style.top = mcTop - (mouseY - curMouseY) + "px";
                if (curMouseY < a) curMouseY = a;
                else if (curMouseY > b) curMouseY = b;
                if (thisObj.shadeFlg) {
                    var movY = parseInt(curMouseY - mouseY);
                    var n = Math.abs(movY / node_url_size[1]);
                    var zoomLev;
                    if (movY < 0)
		     {
                        zoomLev = Math.pow(2, n) + (Math.abs(movY) - n * node_url_size[1]) * Math.pow(2, n) / node_url_size[1];
                    }
                    else 
		    {
                        zoomLev = Math.pow(2, -n) + (Math.abs(movY) - n * node_url_size[1]) * Math.pow(2, -n) / node_url_size[1];
                    }
                    thisObj.MapShade(zoomLev);
                }
            };
        };
        this.mycursor_obj.StartUp = function(Evnt) 
	{
            Evnt ? Evnt.preventDefault() : event.returnValue = false;
            if (thisObj.isMapMove) return;
            var Arr_scale = document.getElementById("myscale").getElementsByTagName("TD");
            var obj = document.getElementById("mycursor");
            for (var i = 0; i < Arr_scale.length; i++)
	     {
                if (parseInt(obj.style.top) + obj.offsetHeight / 2 >= Arr_scale[i].offsetTop && parseInt(obj.style.top) + obj.offsetHeight / 2 <= Arr_scale[i].offsetTop + Arr_scale[i].offsetHeight && (Arr_scale.length - i - 1) != parseInt(thisObj.inf[2])) {
                    thisObj.jumpMapByLev(Arr_scale.length - i);
                    break;
                };
            };
            if (document.getElementById("ZDIMSMap").style.zoom != 1) document.getElementById("ZDIMSMap").style.zoom = 1;
        };
        this.mycursor_obj.onmousedown = this.mycursor_obj.StartDrag;
        this.mycursor_obj.onmousemove = this.mycursor_obj.StartMove;
        this.mycursor_obj.onmouseup = this.mycursor_obj.StartUp;
        this.SetSingleScale = function() 
	{
            var objs = document.getElementById("myscale").getElementsByTagName("TD");
            for (var i = 0; i < objs.length; i++)
	     {
                objs[i].num = i;
                objs[i].onclick = function()
		 {
                    if (thisObj.isMapMove) return;
                    thisObj.jumpMapByLev(thisObj.levelNum - this.num);
                };
            };

        };
        this.SetSingleScale();
        window.disabledCursor = function()
	 {
            window.enabledCursor = false;
        };
        ZDEvent.addListener(document, "mouseup", window.disabledCursor, false);
        SetMyCursor();
    };

    document.getElementById("ImsRulerUP").onclick = function(Evnt) 
    {
        if (thisObj.isMapMove) return;
        thisObj.FillMapImages(thisObj.pObj.clientWidth / 2, thisObj.pObj.clientHeight / 2 - thisObj.imgSize * 2, thisObj.barMoveSpeed);
        StartMoveMapLayer();

    };
    document.getElementById("ImsRulerDOWN").onclick = function(Evnt)
     {
        if (thisObj.isMapMove) return;
        thisObj.FillMapImages(thisObj.pObj.clientWidth / 2, thisObj.pObj.clientHeight / 2 + thisObj.imgSize * 2, thisObj.barMoveSpeed);
        StartMoveMapLayer();

    };
    document.getElementById("ImsRulerLEFT").onclick = function()
     {
        if (thisObj.isMapMove) return;
        thisObj.FillMapImages(thisObj.pObj.clientWidth / 2 - thisObj.imgSize * 2, thisObj.pObj.clientHeight / 2, thisObj.barMoveSpeed);
        StartMoveMapLayer();
    };
    document.getElementById("ImsRulerRIGHT").onclick = function()
     {
        if (thisObj.isMapMove) return;
        thisObj.FillMapImages(thisObj.pObj.clientWidth / 2 + thisObj.imgSize * 2, thisObj.pObj.clientHeight / 2, thisObj.barMoveSpeed);
        StartMoveMapLayer();
    };
    document.getElementById("ImsRulerZoomIn").onclick = function() 
    {
        if (thisObj.isMapMove) return;
        if (thisObj.shadeFlg) thisObj.ZoomByShade(false);
        else thisObj.jumpMapByLev(thisObj.inf[2] + 2);
    };
    document.getElementById("ImsRulerZoomOut").onclick = function()
     {
        if (thisObj.isMapMove) return;
        if (thisObj.shadeFlg) thisObj.ZoomByShade(true);
        else thisObj.jumpMapByLev(thisObj.inf[2]);
    };
    document.getElementById("ImsRulerREFURBISH").onclick = function()
     {
        thisObj.restoreMap();
    };
};
SetMyCursor = function() 
{
    var mycur = document.getElementById("mycursor");
    if (mycur == null) return;
    var scaletab = document.getElementById("myscale").getElementsByTagName("TD");
    mycur.style.top = scaletab[thisObj.levelNum - thisObj.inf[2] - 1].offsetTop + "px";
};
function IMSScale() 
{
    thisObj.sco = this;
    this.div = {};
    this.unit = [[1, 1000], ["米", "千米"]];
    this.init = function()
     {
        this.div = CreatDiv(document.body, "scale", 0, 0, "absolute", 20);
        this.div.display = "none";
        this.div.style.left = "15%";
        this.div.style.top = "93%";
        this.div.innerHTML = '<table  border="0" cellpadding="0" cellspacing="0" unselectable ="on"><tr><td align="center" valign="bottom" id="c_scale" style="font-size:12px;color:#e97575;" unselectable ="on">' + this.getC_scale_Units(thisObj.inf[2]) + '</td></tr><tr><td align="center" valign="top" ><img id="scale" src="images/scale.gif" width="60px" height="10px"></td></tr></table>';
    };
    this.getC_scale_Units = function(level) 
    {
        var pixelX = thisObj.logicXlength / (thisObj.imgSize * Math.pow(2, level + 1));
        var len = parseInt(pixelX * 58 * this.unit[0][0]);
        if (len > this.unit[0][1])
            return parseInt(len / this.unit[0][1]) + this.unit[1][1];
        else
            return len + this.unit[1][0];
    };
    this.setUnits = function(valueArr, unitArr)
     {
        this.unit = [valueArr, unitArr];
        this.reSetScale();
    };
    this.setPos = function(left, top) 
    {
        this.div.style.left = left;
        this.div.style.top = top;
    };
    this.setFontColor = function(color)
     {
        document.getElementById("c_scale").style.color = color ? color : "#e97575";
    };
    this.reSetScale = function() 
    {
        document.getElementById("c_scale").innerHTML = this.getC_scale_Units(thisObj.inf[2]);
    };
    this.init();
};
function IMSLogo() 
{
//    this.link = "http://www.mapgis.com.cn";
    this.link = "http://www.silverdata.com.cn";
//    this.tip = "点击进入中地数码主页";
    this.tip = "点击进入厦门银据主页";
//    this.imgSrc = "images/mapgis.png";
    this.imgSrc = "images/silverdata.png";
    this.div = CreatDiv(document.body, "logoDiv", 0, 0, "absolute", 21, "visible");
    this.div.display = "none";
    this.div.style.left = "3%";
    this.div.style.top = "94%";
    this.div.innerHTML = "<a  href='" + this.link + "' target='_blank' style='cursor:pointer'><img  alt='" + this.tip + "' id='logoPng' name='PngImgs' src='" + this.imgSrc + "' width='60px' height='22px'/></a>";
    this.setlogo = function(link, tip, imgSrc) 
    {
        this.link = link ? link : "http://www.mapgis.com.cn";
        this.tip = tip ? tip : "点击进入中地数码主页";
        this.imgSrc = imgSrc ? imgSrc : "images/mapgis.png";
        this.div.innerHTML = "<a href='" + this.link + "' target='_blank' style='cursor:pointer'><img  alt='" + this.tip + "' id='logoPng' name='PngImgs' src='" + this.imgSrc + "' width='60px' height='22px'/></a>";
    };
    this.setPos = function(left, top) 
    {
        this.div.style.left = left;
        this.div.style.top = top;
    };
};
function IMSHotSpots(lev, dataRequestPage)
 {
    this.div = CreatDiv(document.body, "map3D", 0, 0, "absolute", 2);
    thisObj.hso = this;
    window.HotSpotInfoArr = new Array();
    thisObj.showHsLev = lev;
    this.hotSpotInfoArrNo = -1;
    this.isProLoad = false;
    this.isLoad = false;
    this.requestUrl = dataRequestPage ? dataRequestPage : "Maps.ashx";
    this.hWidth = thisObj.getMapViewSize()[0];
    this.hHeight = thisObj.getMapViewSize()[1];
    this.div.style.width = this.hWidth + "px";
    this.wLoadArr = new Array();
    var hsHint = document.createElement("DIV");
    hsHint.id = "hsHintDiv";
    hsHint.style.position = "absolute";
    hsHint.style.zIndex = "5";
    hsHint.style.backgroundColor = "#FFFFCC";
    hsHint.style.padding = "2px";
    hsHint.style.whitespace = "nowrap";
    hsHint.style.left = "0px";
    hsHint.style.top = "0px";
    hsHint.style.display = "none";
    hsHint.style.filter = "Alpha(Opacity=90)";
    this.div.appendChild(hsHint);
    var hsDiv = document.createElement("DIV");
    hsDiv.id = "hotspotDiv";
    hsDiv.style.position = "absolute";
    hsDiv.style.zIndex = "5";
    hsDiv.style.left = "0px";
    hsDiv.style.top = "0px";
    hsDiv.style.display = "none";
    hsDiv.onmousedown = function(Evnt)
     {
        var e = Evnt ? Evnt : event;
        var hsDiv = document.getElementById("hotspotDiv");
        if (hsDiv.style.display == '') 
	{
            hsDiv.style.display = 'none';
        }
        thisObj.OnMapMouseDown(e);
    };
    hsDiv.onmousemove = function(Evnt) { var e = Evnt ? Evnt : event; thisObj.OnMapMouseMove(e) };
    hsDiv.ondblclick = function(Evnt) { var e = Evnt ? Evnt : event; thisObj.OnMapDblClick(e) };
    hsDiv.onmouseup = function(Evnt) 
    {
        var e = Evnt ? Evnt : event;
        if (HotSpotInfoArr.length > 0)
            thisObj.hso.Showhs(HotSpotInfoArr);
        thisObj.OnMapMouseUp(e);

    };

    this.div.appendChild(hsDiv);
    hsDiv.innerHTML = "<img id='hsimg'  src='images/transparence.gif' width='" + this.hWidth + "' height='" + this.hHeight + "' usemap='#hsmap' border='0'  style='position: absolute;left:0px;top:0px; z-index: 5;'/>";
    var mapTag = document.createElement("map");
    mapTag.id = "hsmap";
    mapTag.name = "hsmap";
    hsDiv.appendChild(mapTag);

    this.GethsInfo = function(rowNo, lineNo, level)
     {
        var id = rowNo + "&" + lineNo + "&" + parseInt(level + 1);
        var grids = thisObj.gridCodeConvert(id, thisObj.levelNum, (level + 1));
        if (!HotSpotInfoArr[grids] && thisObj.inf[2] >= (thisObj.showHsLev - 1))
            this.RequestCommonData(grids);

    };
    this.RequestCommonData = function(grids)
     {
        if (this.isLoad)
	 {
            this.wLoadArr[this.wLoadArr.length] = grids;
            if (!this.isProLoad)
                window.setTimeout('thisObj.hso.ProLoad();', 30);
            return;
        }
        this.isLoad = true;
        var str = "_method=GetHotSpotData&gridid=" + grids;
        AJAXRequest(this.requestUrl, true, "POST", str, thisObj.hso.cbCommonData);
    };
    this.ProLoad = function()
     {
        var grids;
        if (!this.isLoad && this.wLoadArr.length > 0) 
	{
            grids = this.wLoadArr[this.wLoadArr.length - 1];
            this.wLoadArr.length--;
            this.RequestCommonData(grids);
        }
        if (this.wLoadArr.length > 0)
	 {
            this.isProLoad = true;
            window.setTimeout('thisObj.hso.ProLoad();', 30);
        }
        else
	 {
            this.isProLoad = false;
        }
    };
    this.cbCommonData = function(res)
     {
        if (res == null || res == "")
	 {
            window.setTimeout('thisObj.hso.isLoad=false;', 1);
            return;
        }
        window.setTimeout('thisObj.hso.isLoad=false;', 1);
        var resStr = res.split("|");
        var build = resStr[1].split("$");
        for (var j = 0; j < build.length; j++)
	 {
            var subBd = build[j].split("#");
            var index = ++thisObj.hso.hotSpotInfoArrNo % 100;
            HotSpotInfoArr[index] = new ModelInfo(subBd[0], subBd[1], subBd[2]);
        }
        thisObj.hso.Showhs(HotSpotInfoArr);
    };

    function ModelInfo(bld, name, coords)
     {
        this.name = name;
        this.bid = bld;
        this.coords = coords;
    };
    this.logicToScreen = function(x, y)
     {
        var wx = 0, wy = 0;
        var viewXMin = thisObj.getCurWinLog()[0];
        var viewYMin = thisObj.getCurWinLog()[3];
        var px = thisObj.logicXlength / thisObj.rowWidth;
        wX = Math.round((x - viewXMin) / px);
        wY = Math.round((viewYMin - y) / px);
        return [wX, wY];
    };
    this.Showhs = function(hsinfo)
     {
        var hsDiv = document.getElementById("hotspotDiv");
        var mapTag = document.getElementById("hsmap");
        hsDiv.style.display = '';
        for (var i = 0; i < hsinfo.length; i++) 
	{
            var coords = "";
            var xyArr = hsinfo[i].coords.split(",");
            for (var j = 0; j < xyArr.length; j = j + 2)
	     {
                var temp = this.logicToScreen(xyArr[j], xyArr[j + 1]);
                if (j == 0) 
		{
                    coords = temp[0] + "," + temp[1];
                }
                else
                    coords += "," + temp[0] + "," + temp[1];

            }
            var o = hsinfo[i];
            var area = mapTag.childNodes[i];
            if (area == null) area = document.createElement("area");
            area.id = o.name;
            area.shape = "poly";
            area.coords = coords;
            area.onmousemove = function(Evnt)
	     {
                var e = Evnt ? Evnt : event;
                var src = e.srcElement ? e.srcElement : e.target;
                if (src.tagName.toUpperCase() != "AREA") return;
                var xy = GetClientXY(e, document.getElementById("hotspotDiv"));
                var hsHint = document.getElementById("hsHintDiv");
                hsHint.style.display = "block";
                hsHint.style.top = xy[1] - 10 + "px";
                hsHint.style.left = xy[0] + 10 + "px";
                hsHint.innerHTML = src.id;
            };
            area.onmouseout = function()
	     {
                var hsHint = document.getElementById("hsHintDiv");
                hsHint.style.display = "none";
            };
            area.noHref = true;
            if (area.parentNode != mapTag) mapTag.appendChild(area);
        }
        for (var i = hsinfo.length; i < mapTag.childNodes.length; i++)
	 {
            var area = mapTag.childNodes[i];
            area.coords = "0,0,0,0,0,0";
        }
    }
    if (lev == 1)
     {
        for (var row = 0; row < 2; row++)
	 {
            for (var lin = 0; lin < 2; lin++)
                thisObj.hso.GethsInfo(row, lin, 0);
        }
    }
};

function IMSEagleMap(size, zoomAdd, imgSrc, hidePosition, cSpeed)
 {
    thisObj.eagleEye = this;
    this.bWidth = thisObj.getMapViewSize()[0];
    this.bHeigth = thisObj.getMapViewSize()[1];
    this.eagleSize = size ? size : [150, 120];
    this.eWidth = this.eagleSize[0];
    this.eHeight = this.eagleSize[1];
    this.eagleImgSrc = imgSrc ? imgSrc : ["images/h_arrow.gif", "images/d_arrow.gif"];
    this.eagleZoomAdd = zoomAdd ? zoomAdd : 3;
    if (this.eagleZoomAdd < 3)
        this.eagleZoomAdd = 3;
    this.hidePosition = hidePosition ? hidePosition : "3";
    var openImg = this.eagleImgSrc[1];
    var hideImg = this.eagleImgSrc[0];
    var eLeft;
    var eTop;
    this.ePosition;
    this.cDivL;
    this.cDivT;
    this.eagleLay;
    this.eagleRowsNum;
    this.eagleCellsNum;
    this.eagleMx;
    this.eagleMy;
    this.eagleL;
    this.eagleT;
    this.eaglePressing;
    this.cDivX;
    this.cDivY;
    this.mX;
    this.mY;
    this.cPress;
    this.cSpeed = cSpeed ? cSpeed : 30;
    this.eagleDefL = 0;
    this.eagleDefT = 0;
    var eagleObj = this;
    var dragInterval;
    var spaceFlag = true;
    var hasImageFlag = false;
    this.mapLevel = 0;
    this.setCDiv = false;
    var eOutStyle = "#81A6D0 4px solid ";
    this.imgSize = 256;
    this.MoveImgs = Math.log(this.imgSize) / Math.log(2);
    this.mapout = thisObj.mapout;
    this.center_scale = 0;
    this.centerRL = Math.pow(2, this.center_scale);
    this.eagleJspid = this.centerRL + "&" + this.centerRL + "&" + this.center_scale;
    this.eagleInf = this.eagleJspid.split("&");
    this.eagleImg_obj = new Array();
    this.eSubTab = null;
    this.isIE = navigator.appName.indexOf("Microsoft Internet Explorer") != -1 ? 1 : 0;
    this.dragFalg = false;
    this.eImgUrl;
    if (typeof (thisObj.gridImageUrl) == "object" && thisObj.ImageUrl != 'undefined')
        this.eImgUrl = thisObj.gridImageUrl[0];
    else
        this.eImgUrl = '';
    this.levelFlag = true;
    this.div = CreatDiv(document.body, "eagleDiv", 0, 0, "absolute", 5);
    ZDEvent.addListener(this.div, "contextmenu", StopBubble, false);
    ZDEvent.addListener(this.div, "contextmenu", StopDefault, false);
    var objEOut1 = CreatDiv(this.div, "DIVEagleOut1", "0px", "0px", "absolute", 1);
    objEOut1.style.border = eOutStyle;
    objEOut1.style.width = this.eWidth + "px";
    objEOut1.style.height = this.eHeight + "px";
    objEOut1.style.overflow = "hidden";
    objEOut1.style.background = "white";
    var objEOut = document.getElementById("DIVEagleOut");
    if (objEOut == null)
     {
        objEOut = document.createElement("DIV");
        objEOut.id = "DIVEagleOut";
        objEOut.style.position = "absolute";
        objEOut.style.width = 15 + "px";
        objEOut.style.height = 15 + "px";
        objEOut.style.zIndex = "500";
        this.isIE ? objEOut.style.filter = "alpha(opacity=80)" : objEOut.style.MozOpacity = 0.8;
    }
    var objEOutHtm = "<img id='BtnEagle' src='" + openImg + "' style='cursor:pointer;' title='隐藏鹰眼' onclick='UnhiddenEagle()'/>";
    objEOut.innerHTML = objEOutHtm;
    this.div.appendChild(objEOut);
    var eObjBorderWidth = parseInt(objEOut1.style.borderWidth);
    var eObjImgWidth = parseInt(document.getElementById("BtnEagle").offsetWidth);
    var eObjImgHeight = parseInt(document.getElementById("BtnEagle").offsetHeight);
    this.ELocation = function()
     {
        this.bWidth = thisObj.getMapViewSize()[0];
        this.bHeigth = thisObj.getMapViewSize()[1];
        switch (this.hidePosition) {
            case "1":
                eLeft = parseInt(this.eWidth) - eObjImgWidth + eObjBorderWidth;
                eTop = parseInt(this.eHeight) - eObjImgHeight + eObjBorderWidth;
                this.ePosition = [-eObjBorderWidth, -eObjBorderWidth];
                break;
            case "2":
                eLeft = eObjBorderWidth;
                eTop = parseInt(this.eHeight) - eObjImgHeight + eObjBorderWidth;
                this.ePosition = [this.bWidth - this.eWidth, -eObjBorderWidth];
                break;
            case "3":
                eLeft = eObjBorderWidth;
                eTop = eObjBorderWidth;
                this.ePosition = [this.bWidth - this.eWidth, this.bHeigth - this.eHeight];
                break;
            case "4":
                eLeft = parseInt(this.eWidth) - eObjImgWidth + eObjBorderWidth;
                eTop = eObjBorderWidth;
                this.ePosition = [-eObjBorderWidth, this.bHeigth - this.eHeight];
                break;
            default:
                break;
        }
        objEOut1.style.left = this.ePosition[0] + "px";
        objEOut1.style.top = this.ePosition[1] + "px";
        objEOut.style.left = parseInt(this.ePosition[0]) + eLeft + "px";
        objEOut.style.top = parseInt(this.ePosition[1]) + eTop + "px";
    };
    this.ELocation();
    this.OnEagleResize = function()
     {
        thisObj.eagleEye.ELocation();
        var objBtnEagle = objEOut.getElementsByTagName("img")[0];
        if (!spaceFlag)
	 {
            objBtnEagle.title = "显示鹰眼";
            switch (thisObj.eagleEye.hidePosition)
	     {
                case "1":
                    objEOut.style.top = parseInt(objEOut.style.top) - thisObj.eagleEye.eHeight + eObjImgHeight + "px";
                    objEOut.style.left = parseInt(objEOut.style.left) - thisObj.eagleEye.eWidth + eObjImgWidth + "px";
                    break;
                case "2":
                    objEOut.style.top = parseInt(objEOut.style.top) - thisObj.eagleEye.eHeight + eObjImgHeight + "px";
                    objEOut.style.left = parseInt(objEOut.style.left) + thisObj.eagleEye.eWidth - eObjBorderWidth - eObjImgWidth + "px";
                    break;
                case "3":
                    objEOut.style.top = parseInt(objEOut.style.top) + thisObj.eagleEye.eHeight - eObjImgHeight - eObjBorderWidth + "px";
                    objEOut.style.left = parseInt(objEOut.style.left) + thisObj.eagleEye.eWidth - eObjBorderWidth - eObjImgWidth + "px";
                    break;
                case "4":
                    objEOut.style.top = parseInt(objEOut.style.top) + thisObj.eagleEye.eHeight - eObjImgHeight - eObjBorderWidth + "px";
                    objEOut.style.left = parseInt(objEOut.style.left) - thisObj.eagleEye.eWidth + eObjImgWidth + "px";
                    break;
                default:
            }
            objBtnEagle.src = hideImg;
            objEOut1.style.display = "none";
        }
    };
    thisObj.addEventListener("resize", this.OnEagleResize, false);
    objEOut1.style.left = this.ePosition[0] + "px";
    objEOut1.style.top = this.ePosition[1] + "px";
    objEOut.style.left = parseInt(this.ePosition[0]) + eLeft + "px";
    objEOut.style.top = parseInt(this.ePosition[1]) + eTop + "px";
    UnhiddenEagle = function() 
    {
        var objBtnEagle = objEOut.getElementsByTagName("img")[0];
        if (spaceFlag)
	 {
            objBtnEagle.title = "显示鹰眼";
            switch (thisObj.eagleEye.hidePosition) 
	    {
                case "1":
                    objEOut.style.top = parseInt(objEOut.style.top) - thisObj.eagleEye.eHeight + eObjImgHeight + "px";
                    objEOut.style.left = parseInt(objEOut.style.left) - thisObj.eagleEye.eWidth + eObjImgWidth + "px";
                    break;
                case "2":
                    objEOut.style.top = parseInt(objEOut.style.top) - thisObj.eagleEye.eHeight + eObjImgHeight + "px";
                    objEOut.style.left = parseInt(objEOut.style.left) + thisObj.eagleEye.eWidth - eObjBorderWidth - eObjImgWidth + "px";
                    break;
                case "3":
                    objEOut.style.top = parseInt(objEOut.style.top) + thisObj.eagleEye.eHeight - eObjImgHeight - eObjBorderWidth + "px";
                    objEOut.style.left = parseInt(objEOut.style.left) + thisObj.eagleEye.eWidth - eObjBorderWidth - eObjImgWidth + "px";
                    break;
                case "4":
                    objEOut.style.top = parseInt(objEOut.style.top) + thisObj.eagleEye.eHeight - eObjImgHeight - eObjBorderWidth + "px";
                    objEOut.style.left = parseInt(objEOut.style.left) - thisObj.eagleEye.eWidth + eObjImgWidth + "px";
                    break;
                default:
            }
            objBtnEagle.src = hideImg;
            objEOut1.style.display = "none";
            spaceFlag = false;
        }
        else {
            objBtnEagle.title = "隐藏鹰眼";
            objEOut1.style.display = "";
            objEOut1.style.left = thisObj.eagleEye.ePosition[0] + "px";
            objEOut1.style.top = thisObj.eagleEye.ePosition[1] + "px";
            switch (thisObj.eagleEye.hidePosition)
	     {
                case "1":
                    objEOut.style.top = parseInt(objEOut.style.top) + thisObj.eagleEye.eHeight - eObjImgHeight + "px";
                    objEOut.style.left = parseInt(objEOut.style.left) + thisObj.eagleEye.eWidth - eObjImgWidth + "px";
                    break;
                case "2":
                    objEOut.style.top = parseInt(objEOut.style.top) + thisObj.eagleEye.eHeight - eObjImgHeight + "px";
                    objEOut.style.left = parseInt(objEOut.style.left) - thisObj.eagleEye.eWidth + eObjBorderWidth + eObjImgWidth + "px";
                    break;
                case "3":
                    objEOut.style.top = parseInt(objEOut.style.top) - thisObj.eagleEye.eHeight + eObjImgHeight + eObjBorderWidth + "px";
                    objEOut.style.left = parseInt(objEOut.style.left) - thisObj.eagleEye.eWidth + eObjBorderWidth + eObjImgWidth + "px";
                    break;
                case "4":
                    objEOut.style.top = parseInt(objEOut.style.top) - thisObj.eagleEye.eHeight + eObjImgHeight + eObjBorderWidth + "px";
                    objEOut.style.left = parseInt(objEOut.style.left) + thisObj.eagleEye.eWidth - eObjImgWidth + "px";
                    break;
                default:
            }
            objBtnEagle.src = openImg;
            spaceFlag = true;
            if (thisObj.mapType == 1 && !hasImageFlag) {
                thisObj.eagleEye.GetVectMap();
            } else if (thisObj.mapType !== 1 && !hasImageFlag) {
                thisObj.eagleEye.eagleJumpingMap(thisObj.centerCoor[0], thisObj.centerCoor[1], thisObj.inf[2]);
                hasImageFlag = true;
            }
        }

    };
    this.eagleLay = CreatDiv(objEOut1, "Map", "0px", "0px", "absolute", 2, "visible");
    var centerImg = document.createElement("IMG");
    centerImg.id = "centerImg";
    centerImg.style.zIndex = 5;
    centerImg.style.position = "absolute";
    centerImg.style.visibility = "visible";
    centerImg.src = "images/point.gif";
    objEOut1.appendChild(centerImg);
    centerImg.style.top = (this.eHeight) / 2 - parseInt(centerImg.offsetHeight) / 2 + "px";
    centerImg.style.left = (this.eWidth) / 2 - parseInt(centerImg.offsetWidth) / 2 + "px";
    var centerImg1 = document.createElement("IMG");
    centerImg1.id = "centerImg1";
    centerImg1.style.zIndex = 5;
    centerImg1.style.position = "absolute";
    centerImg1.style.visibility = "visible";
    centerImg1.src = "images/point.gif";
    objEOut1.appendChild(centerImg1);
    centerImg1.style.top = (this.eHeight) / 2 - parseInt(centerImg.offsetHeight) / 2 + "px";
    centerImg1.style.left = (this.eWidth) / 2 - parseInt(centerImg.offsetWidth) / 2 + "px";
    var cDivObj = CreatDiv(objEOut1, "centerDiv", "0px", "0px", "absolute", 4, "visible");
    cDivObj.style.borderWidth = "1px";
    var cDiv = CreatDiv(cDivObj, "cDiv", "0px", "0px", "absolute", 4, "visible");
    cDiv.style.border = "red 1px solid ";
    cDiv.style.background = "#3366cc";
    cDivObj.style.width = "0px";
    cDivObj.style.height = "0px";
    this.isIE ? cDiv.style.filter = "alpha(opacity=25)" : cDiv.style.MozOpacity = 0.25;
    var cDivObj1 = CreatDiv(objEOut1, "centerDiv1", "0px", "0px", "absolute", 3, "hidden");
    cDivObj1.style.border = "red 1px solid ";
    cDivObj1.style.background = "#3366cc";
    this.isIE ? cDivObj1.style.filter = "alpha(opacity=25)" : cDivObj1.style.MozOpacity = 0.25;
    this.setButtonImage = function(img1, img2) {
        openImg = img1;
        hideImg = img2;
    };
    this.setBorderColor = function(color) {
        objEOut1.style.borderColor = color;
    };
    this.setRectBorderColor = function(color) {
        cDiv.style.borderColor = color;
        cDivObj1.style.borderColor = color;
    };
    this.setRectBackColor = function(color) 
    {
        cDiv.style.background = color;
        cDivObj1.style.background = color;
    };
    this.setViewStatus = function(flag) 
    {
        if ((flag && spaceFlag) || (!flag && !spaceFlag))
            UnhiddenEagle();
    };
    this.isOpen = function()
     {
        var flag = spaceFlag;
        return flag;
    };
    this.changeViewStatus = function()
     {
        UnhiddenEagle();
    };
    this.GetTableNum = function()
     {
        this.eagleRowsNum = Math.ceil(this.eHeight / this.imgSize);
        this.eagleCellsNum = Math.ceil(this.eWidth / this.imgSize);
        if (this.eagleRowsNum % 2)
            this.eagleRowsNum += 2;
        else
            this.eagleRowsNum += 1;
        if (this.eagleCellsNum % 2)
            this.eagleCellsNum += 2;
        else
            this.eagleCellsNum += 1;
    };
    this.AddImage = function(level, lineNo, rowNo, htmlTag)
     {
        if ((rowNo * 1 < 0) || (rowNo * 1 >= eagleRowImgNo) || (lineNo * 1 < 0) || (lineNo * 1 >= eagleRowImgNo)) {
            htmlTag.innerHTML = "<IMG id='none'  src='" + this.mapout + "' width='" + this.imgSize + "' height='" + this.imgSize + "'>";
        } else if (!this.eagleImg_obj[htmlTag.id]) {
            var id = rowNo + "&" + lineNo + "&" + parseInt(level + 1);
            var levelF = 0;
            if (this.levelFlag == true)
                levelF = level;
            else
                levelF = level + 1;
            if (this.levelFlag == true) {
                if (levelF == 0 && rowNo * 1 == 0 && rowNo * 1 == 0 && lineNo * 1 == 0)
                    htmlTag.innerHTML = "<IMG id='" + id + "' src='" + this.eImgUrl + "?layerNo=0&GridName=" + thisObj.gridName + "&a=" + rowNo + "&b=" + lineNo + "&c=" + levelF + "' width='" + this.imgSize + "' height='" + this.imgSize + "' >";
                else
                    htmlTag.innerHTML = "<IMG id='none'  src='" + this.mapout + "' width='" + this.imgSize + "' height='" + this.imgSize + "'>";
            } else
                htmlTag.innerHTML = "<IMG id='" + id + "' src='" + this.eImgUrl + "?layerNo=0&GridName=" + thisObj.gridName + "&a=" + rowNo + "&b=" + lineNo + "&c=" + levelF + "' width='" + this.imgSize + "' height='" + this.imgSize + "' >";
        } else
            htmlTag.appendChild(this.eagleImg_obj[htmlTag.id]);
    };
    this.InitCenDiv = function()
     {

        if ((this.mapLevel - this.eagleInf[2]) < this.eagleZoomAdd)
	 {
            cDivObj.style.visibility = "hidden";
            cDivObj1.style.visibility = "hidden";
            return;
        }
        var mLevel = this.mapLevel + 1;
        if (!this.levelFlag)
            mLevel = this.mapLevel;
        var cWidth = (this.bWidth / (2 << (parseInt(mLevel)))) * (2 << (parseInt(this.eagleInf[2])));
        var cHeigh = (this.bHeigth / (2 << (parseInt(mLevel)))) * (2 << (parseInt(this.eagleInf[2])));
        cDivObj1.style.width = cWidth + "px";
        cDivObj1.style.height = cHeigh + "px";
        cDivObj1.style.left = this.eWidth / 2 - cWidth / 2 + "px";
        cDivObj1.style.top = this.eHeight / 2 - cHeigh / 2 + "px";
        cDivObj1.style.visibility = "visible";
        cDivObj.style.width = cWidth + "px";
        cDivObj.style.height = cHeigh + "px";
        cDivObj.style.left = this.eWidth / 2 - cWidth / 2 + "px";
        cDivObj.style.top = this.eHeight / 2 - cHeigh / 2 + "px";
        cDivObj.style.visibility = "visible";
        cDiv.style.width = cWidth + "px";
        cDiv.style.height = cHeigh + "px";
        centerImg.style.top = (cHeigh) / 2 - parseInt(centerImg.offsetHeight) / 2 + "px";
        centerImg.style.left = (cWidth) / 2 - parseInt(centerImg.offsetWidth) / 2 + "px";
        centerImg1.style.top = (cHeigh) / 2 - parseInt(centerImg.offsetHeight) / 2 + "px";
        centerImg1.style.left = (cWidth) / 2 - parseInt(centerImg.offsetWidth) / 2 + "px";
        cDivObj.appendChild(centerImg);
        cDivObj1.appendChild(centerImg1);
        centerImg.style.visibility = "visible";
        this.cDivL = parseInt(cDivObj.style.left);
        this.cDivT = parseInt(cDivObj.style.top);
    };
    this.InitMapTable = function() {
        this.InitCenDiv();
        this.GetTableNum();
        var rCNum = (this.eagleRowsNum - 1) / 2, cCNum = (this.eagleCellsNum - 1) / 2;
        eagleRowImgNo = 2 << (parseInt(this.eagleInf[2]));
        eagleRowWidth = 2 << (parseInt(this.eagleInf[2]) + parseInt(this.MoveImgs));
        var infotmp = this.eagleJspid.split("&");
        this.eSubTab = document.createElement("TABLE");
        this.eSubTab.id = "eagleSubTable" + "0";
        this.eSubTab.border = 0;
        this.eSubTab.cellPadding = 0;
        this.eSubTab.cellSpacing = 0;
        for (var i = 0; i < this.eagleRowsNum; i++) {
            var newTR = this.eSubTab.insertRow(i);
            for (var loop = 0; loop < this.eagleCellsNum; loop++)
                var newTD = newTR.insertCell(loop);
        }
        this.eagleLay.appendChild(this.eSubTab);
        this.eSubTab.rows[rCNum].cells[cCNum].id = this.eagleJspid;
        this.AddImage(infotmp[2] * 1, infotmp[1], infotmp[0], this.eSubTab.rows[rCNum].cells[cCNum]);
        for (var i = 1; i < cCNum + 1; i++) {
            var tdL = this.eSubTab.rows[rCNum].cells[cCNum - i + 1].id.split("&");
            var tdR = this.eSubTab.rows[rCNum].cells[cCNum + i - 1].id.split("&");
            this.eSubTab.rows[rCNum].cells[cCNum - i].id = tdL[0] + "&" + parseInt(tdL[1] * 1 - 1) + "&" + tdL[2];
            this.AddImage(tdL[2] * 1, (tdL[1] * 1 - 1) * 1, tdL[0], this.eSubTab.rows[rCNum].cells[cCNum - i]);
            this.eSubTab.rows[rCNum].cells[cCNum + i].id = tdR[0] + "&" + parseInt(tdR[1] * 1 + 1) + "&" + tdR[2];
            this.AddImage(tdR[2] * 1, (tdR[1] * 1 + 1) * 1, tdR[0], this.eSubTab.rows[rCNum].cells[cCNum + i]);
        }
        for (var i = 1; i < rCNum + 1; i++) {
            for (var loop = 0; loop < this.eagleCellsNum; loop++) {
                var tdU = this.eSubTab.rows[rCNum - i + 1].cells[loop].id.split("&");
                var tdD = this.eSubTab.rows[rCNum + i - 1].cells[loop].id.split("&");
                this.eSubTab.rows[rCNum - i].cells[loop].id = parseInt(tdU[0] * 1 + 1) + "&" + tdU[1] + "&" + tdU[2];
                this.AddImage(tdU[2] * 1, tdU[1], (tdU[0] * 1 + 1) * 1, this.eSubTab.rows[rCNum - i].cells[loop]);
                this.eSubTab.rows[rCNum + i].cells[loop].id = parseInt(tdD[0] * 1 - 1) + "&" + tdD[1] + "&" + tdD[2];
                this.AddImage(tdD[2] * 1, tdD[1], (tdD[0] * 1 - 1) * 1, this.eSubTab.rows[rCNum + i].cells[loop]);
            }
        }
        this.eagleLay.style.width = this.eagleCellsNum * this.imgSize + "px";
        this.eagleLay.style.height = this.eagleRowsNum * this.imgSize + "px";
        this.eagleDefL = parseInt(objEOut1.style.width) / 2 - parseInt(this.eagleLay.style.width) / 2;
        this.eagleDefT = parseInt(objEOut1.style.height) / 2 - parseInt(this.eagleLay.style.height) / 2;
        this.eagleLay.style.cursor = "pointer";
        this.eagleLay.style.left = this.eagleDefL + "px";
        this.eagleLay.style.top = this.eagleDefT + "px";
    };
    this.MapLayerStartDrag = function(Evnt) {
        var e = Evnt ? Evnt : event;
        if (e.button == 1 || e.button == 0) {
            if (!this.isIE) {
                window.focus();
                e.preventDefault();
            }
            this.eagleMx = e.clientX;
            this.eagleMy = e.clientY;
            this.eagleL = parseInt(this.eagleLay.style.left);
            this.eagleT = parseInt(this.eagleLay.style.top);
            this.eaglePressing = true;
        }
    };
    this.MapLayerMoveStart = function(Evnt) {
        var e = Evnt ? Evnt : event;
        if (this.eaglePressing && e.button != 2) {
            if (this.isIE)
                e.returnValue = false;
            var nowMx = e.clientX;
            var nowMy = e.clientY;
            this.eagleLay.style.left = this.eagleL + nowMx - this.eagleMx + "px";
            this.eagleLay.style.top = this.eagleT + nowMy - this.eagleMy + "px";
        }
    };
    this.CenterDivStarDrag = function(Evnt) {
        var e = Evnt ? Evnt : event;
        this.cDivX = e.clientX;
        this.cDivY = e.clientY;
        cDivObj.style.visibility = "visible";
        this.isIE ? cDiv.style.filter = "alpha(opacity=30)" : cDiv.style.MozOpacity = 0.3;
        centerImg1.style.display = "";
        cDivObj.style.left = this.cDivL + 1 + "px";
        cDivObj.style.top = this.cDivT + 1 + "px";
        cDivObj1.style.left = this.cDivL + 1 + "px";
        cDivObj1.style.top = this.cDivT + 1 + "px";
        this.cPress = true;
    };
    this.CenterDivMove = function(Evnt) {
        var e = Evnt ? Evnt : event;
        if (this.isIE)
            e.returnValue = false;
        var nowMx = e.clientX;
        var nowMy = e.clientY;
        this.isIE ? cDiv.style.filter = "alpha(opacity=35)" : cDiv.style.MozOpacity = 0.35;
        this.mX = nowMx - this.cDivX;
        this.mY = nowMy - this.cDivY;
        cDivObj.style.left = this.cDivL + this.mX + "px";
        cDivObj.style.top = this.cDivT + this.mY + "px";
        var cl = parseInt(cDivObj.style.left);
        var ct = parseInt(cDivObj.style.top);
        var dw = this.eWidth - parseInt(cDivObj.style.width);
        var dh = this.eHeight - parseInt(cDivObj.style.height);
        var dL = 0;
        if (cl <= 0) {
            cDivObj.style.left = "0px";
            this.eagleLay.style.left = parseInt(this.eagleLay.style.left) + 1 + "px";
        } else if (cl >= dw) {
            cDivObj.style.left = dw + "px";
            this.eagleLay.style.left = parseInt(this.eagleLay.style.left) - 1 + "px";
        }
        if (ct <= 0) {
            cDivObj.style.top = "0px";
            this.eagleLay.style.top = parseInt(this.eagleLay.style.top) + 1 + "px";
        } else if (ct >= dh) {
            cDivObj.style.top = dh + "px";
            this.eagleLay.style.top = parseInt(this.eagleLay.style.top) - 1 + "px";
        }
        this.dragFalg = true;
    };
    cDivObj.onmouseout = function(Evnt) {
        var e = Evnt ? Evnt : event;
        thisObj.eagleEye.isIE ? e.cancelBubble = true : e.preventDefault();
    };

    centDivDown = function(Evnt) {
        if (thisObj.eagleEye.dragFalg)
            return;
        var e = Evnt ? Evnt : event;
        if (e.button == 2)
            return;
        eagleObj.CenterDivStarDrag(e);
        ZDEvent.addListener(document, "mousemove", centDivMove, false);
        ZDEvent.addListener(document, "mouseup", centDivUp, false);
        thisObj.eagleEye.isIE ? e.cancelBubble = true : e.preventDefault();
    };
    centDivMove = function(Evnt) {
        cDivObj.style.cursor = "move";
        var e = Evnt ? Evnt : event;
        if (e.button == 2 || !thisObj.eagleEye.cPress) return;
        if (thisObj.eagleEye.isIE && e.button == 0) return;
        eagleObj.CenterDivMove(e);
        thisObj.eagleEye.isIE ? e.cancelBubble = true : e.preventDefault();
    };
    centDivUp = function(Evnt) {

        if (thisObj.eagleEye.cPress && thisObj.eagleEye.dragFalg) {
            eagleObj.DragMoveBack(Evnt);
        } else {
            cDivObj1.style.left = thisObj.eagleEye.cDivL + "px";
            cDivObj1.style.top = thisObj.eagleEye.cDivT + "px";
        }
        thisObj.eagleEye.cPress = false;
    };
    ZDEvent.addListener(cDivObj, "mousedown", centDivDown, false);
    ZDEvent.addListener(cDivObj, "mousemove", centDivMove, false);
    ZDEvent.addListener(cDivObj, "mouseup", centDivUp, false);
    this.DragMoveBack = function(Evnt) {
        if (this.cSpeed < 1 || this.cSpeed > 60)
            this.cSpeed = 30;
        var e = Evnt ? Evnt : event;
        var eMapL = parseInt(this.eagleLay.style.left);
        var eMapT = parseInt(this.eagleLay.style.top);
        this.isIE ? cDiv.style.filter = "alpha(opacity=25)" : cDiv.style.MozOpacity = 0.25;
        var x = (this.eWidth) / 2 + this.mX;
        var y = (this.eHeight) / 2 + this.mY;
        var eagleCenterCoor = EagleLogicCoordinate(x, y, eagleObj);
        var cL = parseInt(cDivObj.style.left);
        var cT = parseInt(cDivObj.style.top);
        var dLeft = cL - this.cDivL;
        var dTop = cT - this.cDivT;
        var kLeft = dLeft / this.cSpeed;
        var kTop = dTop / this.cSpeed;
        var transpar = 0;
        if (this.isIE)
            transpar = cDiv.filters.alpha.opacity;
        else
            transpar = cDiv.style.MozOpacity;
        var kScale = transpar / this.cSpeed;
        dragInterval = setInterval(function() {
            if (thisObj.eagleEye.cSpeed < 1)
	    {
                clearInterval(dragInterval);
                cDivObj.style.left = thisObj.eagleEye.cDivL + 1 + "px";
                cDivObj.style.top = thisObj.eagleEye.cDivT + 1 + "px";
                cDivObj1.style.left = thisObj.eagleEye.cDivL + 1 + "px";
                cDivObj1.style.top = thisObj.eagleEye.cDivT + 1 + "px";
                centerImg1.style.display = "none";
                thisObj.eagleEye.isIE ? cDiv.style.filter = "alpha(opacity=25)" : cDiv.style.MozOpacity = 0.25;
                thisObj.eagleEye.dragFalg = false;
            }
            thisObj.eagleEye.cSpeed--; cL -= kLeft; cT -= kTop; transpar -= kScale;
            cDivObj.style.left = cL + "px";
            cDivObj.style.top = cT + "px";
            if (thisObj.eagleEye.isIE)
                cDiv.filters.alpha.opacity = transpar;
            else
                cDiv.style.MozOpacity = transpar;
        }, 10);
        thisObj.pntLocation(eagleCenterCoor[0], eagleCenterCoor[1]);

    };
    this.eagleLay.onmousedown = function(Evnt) {
        var e = Evnt ? Evnt : event;
        thisObj.eagleEye.isIE ? e.cancelBubble = true : e.preventDefault();
        if (e.button == 2)
            return;
        thisObj.eagleEye.MapLayerStartDrag(e);
    };
    this.eagleLay.onmousemove = function(Evnt) {
        var e = Evnt ? Evnt : event;
        if (e.button == 2) return;
        eagleObj.MapLayerMoveStart(e, this);
        if (thisObj.eagleEye.eaglePressing) {
            thisObj.eagleEye.eagleLay.style.cursor = "move";
        }

        thisObj.eagleEye.isIE ? e.cancelBubble = true : e.preventDefault();
    };
    this.eagleLay.onmouseup = function(Evnt) {
        var e = Evnt ? Evnt : event;
        thisObj.eagleEye.eaglePressing = false;
        thisObj.eagleEye.eagleLay.style.cursor = "pointer";
        if (e.button == 2) return;
        var x = (thisObj.eagleEye.eWidth) / 2;
        var y = (thisObj.eagleEye.eHeight) / 2;
        var eagleCenterCoor = EagleLogicCoordinate(x, y, eagleObj);
        thisObj.pntLocation(eagleCenterCoor[0], eagleCenterCoor[1]);
    };
    objEOut.oncontextmenu = function(Evnt) {
        return false;
    };
    window.EagleLogicCoordinate = function(x, y, eagleObj) {
        thisObj.eagleEye.eagleInf[2] = parseInt(thisObj.eagleEye.eagleInf[2]);
        var len;
        if (thisObj.eagleEye.levelFlag == true)
            len = thisObj.logicXlength * 2;
        else
            len = thisObj.logicXlength;
        var firstTD_ID;
        if (thisObj.eagleEye.eSubTab == "")
            return;
        else
            firstTD_ID = thisObj.eagleEye.eSubTab.getElementsByTagName("TD")[0].id.split("&");
        var physics_x = parseInt(x) - parseInt(thisObj.eagleEye.eagleLay.style.left);
        var physics_y = parseInt(y) - parseInt(thisObj.eagleEye.eagleLay.style.top);
        physics_x = physics_x * (len / eagleRowWidth);
        physics_y = -1 * physics_y * (len / eagleRowWidth);
        var boxX = (len / Math.pow(2, thisObj.eagleEye.eagleInf[2] + 1)) * firstTD_ID[1] * 1 + thisObj.xMinMap;
        var boxY = (len / Math.pow(2, thisObj.eagleEye.eagleInf[2] + 1)) * (firstTD_ID[0] * 1 + 1) + thisObj.yMinMap;
        physics_x = physics_x + boxX;
        physics_y = physics_y + boxY;
        return [physics_x, physics_y];
    };
    this.eagleJumpingMap = function(x, y, level) 
    {
        if (thisObj.mapType == 1) {
            this.GetVectMap();
            return;
        }
        if (!spaceFlag) {
            hasImageFlag = false;
            return;
        } else
            hasImageFlag = true;
        if (this.mapLevel == level) {
            this.setCDiv = false;
        }
        else
            this.setCDiv = true;
        this.mapLevel = level;
        if (level > this.eagleZoomAdd)
            thisObj.eagleEye.levelFlag = false;
        else
            thisObj.eagleEye.levelFlag = true;
        var eagleLevel = ((level - this.eagleZoomAdd + 1) > 0) ? (level - this.eagleZoomAdd) : 0;
        if (!this.levelFlag)
            eagleLevel = eagleLevel - 1;
        if (eagleLevel >= 0 && eagleLevel < thisObj.levelNum * 1) {
            this.eagleInf[2] = eagleLevel;
            eagleRowImgNo = 2 << (parseInt(this.eagleInf[2]));
            eagleRowWidth = 2 << (parseInt(this.eagleInf[2]) + parseInt(this.MoveImgs));
            var len;
            if (thisObj.eagleEye.levelFlag == true)
                len = thisObj.logicXlength * 2;
            else
                len = thisObj.logicXlength;
            var pX = len / eagleRowWidth;
            lineNo = Math.floor((x - thisObj.xMinMap) / pX / this.imgSize);
            rowNo = Math.floor((y - thisObj.yMinMap) / pX / this.imgSize);
            var dotleft = (x - thisObj.xMinMap) / pX * 1 - this.imgSize * lineNo;
            var dottop = (y - thisObj.yMinMap) / pX * 1 - this.imgSize * rowNo;
            this.eagleJspid = rowNo + "&" + lineNo + "&" + this.eagleInf[2];
            this.eagleInf = this.eagleJspid.split("&");
            if (this.eagleLay.childNodes.length > 0)	//by lsg 9.17
                this.eagleLay.removeChild(this.eSubTab);
            this.InitMapTable();
            window.eagleCenterCoor = [x, y];
            this.eagleLay.style.left = parseInt(this.eagleLay.style.left) + (this.imgSize / 2 - dotleft) + "px";
            this.eagleLay.style.top = parseInt(this.eagleLay.style.top) - (this.imgSize / 2 - dottop) + "px";
        }
    };
    this.vectZoom = 13;
    this.vectELay = [];
    for (var i = 0, j = thisObj.vectImageUrl.length; i < j; i++) {
        this.vectELay[i] = CreatDiv(objEOut1, "vectELay" + i, 0, 0, "absolute", 1 + i, "visible");
        this.vectELay[i].innerHTML = "<IMG id='vectEImg0' src='" + this.mapout + "' width='" + this.eWidth + "px' height='" + this.eHeight + "px' />";
    }
    this.xMin;
    this.xMax;
    this.yMin;
    this.yMax;
    this.eLogicXLength;
    this.eLogicYLength;
    this.xDown;
    this.yDown;
    this.xMove;
    this.yMove;
    this.xTmp;
    this.yTmp;
    this.xUp;
    this.yUp;
    this.cVectWidth = thisObj.pObj.offsetWidth / this.vectZoom;
    this.cVectHeight = thisObj.pObj.offsetHeight / this.vectZoom;
    this.cL;
    this.cT;
    this.cLTmp;
    this.cTTmp;
    this.cVectLogicX;
    this.cVectLogicY;
    this.px;
    this.py;
    this.flag = true;
    var cVectObj = CreatDiv(objEOut1, "cVectObj", 0, 0, "absolute", 13, "hidden");
    cVectObj.style.visibility = "hidden";
    cVectObj.style.border = "red 1px solid ";
    cVectObj.style.background = "#3366cc";
    cVectObj.style.width = this.cVectWidth + "px";
    cVectObj.style.height = this.cVectHeight + "px";

    cVectDown = function(Evnt) {
        var e = Evnt ? Evnt : event;
        thisObj.eagleEye.xDown = e.clientX;
        thisObj.eagleEye.yDown = e.clientY;
        thisObj.eagleEye.xTmp = thisObj.eagleEye.xDown;
        thisObj.eagleEye.yTmp = thisObj.eagleEye.yDown;
        thisObj.eagleEye.isIE ? cVectObj.style.filter = "alpha(opacity=60)" : cVectObj.style.MozOpacity = 0.6;
        ZDEvent.addListener(document, "mouseup", cVectUp, false);
        thisObj.eagleEye.cPress = true;
        thisObj.eagleEye.isIE ? e.cancelBubble = true : e.preventDefault();

    };
    cVectUp1 = function() {
        thisObj.eagleEye.cPress = false;
    }
    cVectMove = function(Evnt) {
        var e = Evnt ? Evnt : event;
        thisObj.eagleEye.xMove = e.clientX;
        thisObj.eagleEye.yMove = e.clientY;
        if (thisObj.eagleEye.cPress) {
            thisObj.eagleEye.cLTmp += thisObj.eagleEye.xMove - thisObj.eagleEye.xTmp;
            thisObj.eagleEye.cTTmp += thisObj.eagleEye.yMove - thisObj.eagleEye.yTmp;
            cVectObj.style.left = parseInt(thisObj.eagleEye.cLTmp) + "px";
            cVectObj.style.top = parseInt(thisObj.eagleEye.cTTmp) + "px";
            thisObj.eagleEye.xTmp = thisObj.eagleEye.xMove;
            thisObj.eagleEye.yTmp = thisObj.eagleEye.yMove;
            var cl = parseInt(cVectObj.style.left);
            var ct = parseInt(cVectObj.style.top);
            var dw = thisObj.eagleEye.eWidth - parseInt(cVectObj.style.width);
            var dh = thisObj.eagleEye.eHeight - parseInt(cVectObj.style.height);
            var dL = 0;
            if (cl <= 0) {
                cVectObj.style.left = "0px";
            } else if (cl >= dw) {
                cVectObj.style.left = dw + "px";
            }
            if (ct <= 0) {
                cVectObj.style.top = "0px";
            } else if (ct >= dh) {
                cVectObj.style.top = dh + "px";
            }
        }
        thisObj.eagleEye.isIE ? e.cancelBubble = true : e.preventDefault();

    };
    cVectUp = function(Evnt) {
        var e = Evnt ? Evnt : event;
        thisObj.eagleEye.xUp = e.clientX;
        thisObj.eagleEye.yUp = e.clientY;
        if (thisObj.eagleEye.cPress) {
            var dx = (thisObj.eagleEye.xUp - thisObj.eagleEye.xDown) * thisObj.eagleEye.px;
            var dy = (thisObj.eagleEye.yUp - thisObj.eagleEye.yDown) * thisObj.eagleEye.py;
            thisObj.eagleEye.cVectLogicX += dx;
            thisObj.eagleEye.cVectLogicY -= dy;
            thisObj.eagleEye.flag = false;
            thisObj.pntLocation(thisObj.eagleEye.cVectLogicX, thisObj.eagleEye.cVectLogicY);
            thisObj.eagleEye.isIE ? cVectObj.style.filter = "alpha(opacity=45)" : cVectObj.style.MozOpacity = 0.45;
            thisObj.eagleEye.cPress = false;
            thisObj.eagleEye.eagleJumpingMap(thisObj.eagleEye.cVectLogicX, thisObj.eagleEye.cVectLogicY, thisObj.inf[2]);
        }
        thisObj.eagleEye.isIE ? e.cancelBubble = true : e.preventDefault();
    };
    ZDEvent.addListener(cVectObj, "mousedown", cVectDown, false);
    ZDEvent.addListener(cVectObj, "mousemove", cVectMove, false);
    ZDEvent.addListener(cVectObj, "mouseout", cVectUp, false);
    this.GetVectMap = function() {
        if (!this.flag) {
            this.flag = true;
            return;
        }
        this.DisplayCDiv();
        this.GetVectBound();
        for (var i = 0, j = thisObj.vectImageUrl.length; i < j; i++) {
            var url = "";
            if (spaceFlag) {
                url = thisObj.vectImageUrl[i] + "?layerNo=" + i + "&LogicMinX=" + this.xMin + "&LogicMinY=" + this.yMin + "&LogicMaxX=" + this.xMax + "&LogicMaxY=" + this.yMax;
                url += "&ImageWidth=" + this.eWidth + "&ImageHeight=" + this.eHeight + "&ImageFormat=" + thisObj.vectImageFormat + "&IsEagle=true&rnd=" + Math.random();
                hasImageFlag = true;
            } else {
                url = "images/transparence.gif"
                hasImageFlag = false;
            }
            this.vectELay[i].firstChild.src = url;
        }
    };
    this.DisplayCDiv = function() {
        cVectObj.style.visibility = "visible";
        this.cLTmp = this.cL = this.eWidth / 2 - this.cVectWidth / 2;
        this.cTTmp = this.cT = this.eHeight / 2 - this.cVectHeight / 2;
        cVectObj.style.left = this.cL + "px";
        cVectObj.style.top = this.cT + "px";
        this.isIE ? cVectObj.style.filter = "alpha(opacity=45)" : cVectObj.style.MozOpacity = 0.45;
    };
    this.GetVectBound = function() {
        var cVectDivWidth = parseInt(cVectObj.style.width);
        var cVectDivHeight = parseInt(cVectObj.style.height);
        this.eLogicXLength = (this.eWidth / cVectDivWidth) * thisObj.logicXlength;
        this.eLogicYLength = (this.eHeight / cVectDivHeight) * thisObj.logicYlength;
        this.xMin = thisObj.xMinMap - (this.eLogicXLength - thisObj.logicXlength) / 2;
        this.xMax = thisObj.xMaxMap + (this.eLogicXLength - thisObj.logicXlength) / 2;
        this.yMin = thisObj.yMinMap - (this.eLogicYLength - thisObj.logicYlength) / 2;
        this.yMax = thisObj.yMaxMap + (this.eLogicYLength - thisObj.logicYlength) / 2;
        this.cVectLogicX = this.xMin + this.eLogicXLength / 2;
        this.cVectLogicY = this.yMin + this.eLogicYLength / 2;
        this.px = this.eLogicXLength / this.eWidth;
        this.py = this.eLogicYLength / this.eHeight;
    };
    this.InitEagle = function() {
        this.setViewStatus(true)
    };
    this.InitEagle();
    if (this.levelFlag == true) {
        this.eagleLay.style.left = this.eagleDefL + parseInt(this.imgSize) + "px";
        this.eagleLay.style.top = this.eagleDefT - parseInt(this.imgSize) + "px";
    };
    this.egOnUnload = function() 
    {
        objEOut1 = null;
        objEOut = null;
        if (thisObj != null && thisObj.eagleEye != null)
            thisObj.eagleEye.eagleLay = null;
        centerImg = null;
        centerImg1 = null;
        cDivObj = null;
        cDivObj1 = null;
        cVectObj = null;
    };
    ZDEvent.addListener(window, "unload", this.egOnUnload, false);
}
function IMSMarker(saveFlag) 
{
    thisObj.mapLabelObj = this;
    this.flag = saveFlag ? saveFlag : false;
    this.imgSrc = "images/ding.png";
    this.delImgSrc = "images/close.gif";
    this.imgSize = [49, 43];
    this.htmlStyle;
    this.dataurl = "maps.ashx";
    this.labelTitle = "标注";
    this.listenerMark = true;
    this.dotIndex = 0;
    this.labelUrl = "";
    this.labelId = "";
    this.levelNo = 0;
    this.labelName = "";
    this.labelDetail = "";
    this.dialog = document.createElement("DIV");
    this.dialog.id = "markDialog";
    this.dialog.style.position = "absolute";
    this.dialog.style.zIndex = 3;
    this.dialog.style.visibility = "visible";
    thisObj.overLay.appendChild(this.dialog);
    this.div = CreatDiv(document.body, "labelPnt", 0, 0, "absolute", 2);
    this.hiddenFlag = false;
    StopDivBubble("labelPnt");
    StopDivBubble("markDialog");
    this.div.style.display = "none";
    this.setMarkerImg = function(url)
     {
        if (url != "") {
            this.imgSrc = url;
            this.imgSize = GetImgSize(url);
        }
    };
    this.setURL = function(url) 
    {
        if (url != "")
            this.dataurl = url;
    };
    this.setStyle = function(style)
     {
        if (style != "")
            this.htmlStyle = style;
    };
    this.SetMarkerMode = function()
     {
        thisObj.activeTool = "AddLabel";
        thisObj.drawAction = "";
        if (this.listenerMark)
	 {
            thisObj.addEventListener("mouseup", this.ShowDialog, false);
            this.listenerMark = false;
        }
    };
    //==============csh
    //增加点
    this.SetAddPoint = function() {
        thisObj.activeTool = "AddPoint";
        thisObj.drawAction = "";
        if (this.listenerMark) {
            thisObj.addEventListener("mouseup", this.ShowAddPoint, false);
            this.listenerMark = false;
        }
    };
    //==========end
    this.setMarkerTitle = function(text) {
        if (text != "")
            this.labelTitle = text;
    };
    this.getMarkerPoint = function(type) 
    {
        var pointType = type ? type : true;
        if (typeof (thisObj.mapLabelObj.lgX) != "number" || typeof (thisObj.mapLabelObj.lgY) != "number") return;
        if (pointType) return [thisObj.mapLabelObj.lgX, thisObj.mapLabelObj.lgY];
        else {
            var xy = thisObj.logicToScreen(thisObj.mapLabelObj.lgX, thisObj.mapLabelObj.lgY);
            return xy;
        }
    };
    this.CloseDialog = function() 
    {
        this.dialog.style.display = "none";
    };


        this.ShowDialog = function(Evnt)
	 {

        if (thisObj.activeTool != "AddLabel") {
            thisObj.removeEventListener("mouseup", thisObj.mapLabelObj.ShowDialog, false);
            thisObj.mapLabelObj.listenerMark = true;
            return;
        }
        var xy = thisObj.logicToScreen(thisObj.muLogicX, thisObj.muLogicY);
        var dialogStyle = "";
        var htm = '<div style="width: 200px">';
        if (thisObj.isIE == 1)
            htm += '<div style="filter: progid:dximagetransform.microsoft.alphaimageloader(src=' + thisObj.mapLabelObj.imgSrc + ',sizingmethod=\'image\'); height: 45px"></div>';
        else htm += '<div style="height: 45px"><img src="' + thisObj.mapLabelObj.imgSrc + '"/></div>';
        htm += '<div id="showdialog" style="border:solid 1px #acb9c2; background-color:#fff;height: 192px; width: 250px;">';
        htm += '<div style="height:23px; border-bottom:solid 1px #acb9c2 ; background-image:url(images/bg_title.jpg);">';
        htm += '<div style="float:left; padding-left:10px; line-height:23px; font-size:12px; font-weight:bold;color:#314f67;"><img style="margin-top: 3px" alt="标记" src="images/label.gif" /></div>';
        htm += '<div style="width:100px;overflow: hidden;text-overflow:ellipsis;margin-left: 2px;line-height:23px;float:left;height:23px;">' + thisObj.mapLabelObj.labelTitle + '</div>';
        htm += '<a id ="closeDialog" style="cursor: pointer;float:right;height:15px; width:15px; background-image:url(images/close.gif); margin:4px 2px 0px 0px;"></a></div>';
        htm += '<div style="height:42px; line-height:25px;"><div style="margin:10px 0px 0px 8px; height:21px; line-height:21px;"><div style="clear:both; padding:5px 0;">';
        htm += '<div style="float: left">标题： </div>';
        htm += '<input id="txtMarkerTitle" style="border: #666 1px solid; margin-left: 2px;width: 170px; color: #333;float:left; height:20px;font-size:12px;" value="" />';
        htm += '<div style="clear:both; padding:5px 0;"><div style="float: left">内容：</div><textarea id="txtMarkerContent" style="margin-left: 2px;border: #666 1px solid; width: 170px;height: 70px;float:left; border:solid 1px #666666;color: #333;"></textarea></div>';
        htm += '<div style="clear:both; padding:5px 0;"><div class="btnconfirm" id = "btnconfirm" style="margin-left: 85px;width:55px; height:22px; cursor:pointer; background-image:url(images/btnconfirm.gif);"></div></div>';
        htm += '</div></div></div></div>';
        dialogStyle = thisObj.mapLabelObj.htmlStyle ? thisObj.mapLabelObj.htmlStyle : htm;
        thisObj.mapLabelObj.dialog.innerHTML = dialogStyle;
        thisObj.mapLabelObj.dialog.style.display = "block";
        var rightedge = thisObj.getMapViewSize()[0] - Evnt.clientX;
        var bottomedge = document.body.clientHeight - Evnt.clientY;
//        if (rightedge < thisObj.mapLabelObj.dialog.offsetWidth)
//            thisObj.mapLabelObj.dialog.style.left = xy[0] - thisObj.mapLabelObj.dialog.offsetWidth + "px";
//        else
            thisObj.mapLabelObj.dialog.style.left = xy[0] + "px";
//        if (bottomedge < thisObj.mapLabelObj.dialog.offsetHeight)
//            thisObj.mapLabelObj.dialog.style.top = xy[1] - thisObj.mapLabelObj.dialog.offsetHeight + "px";
//        else
            thisObj.mapLabelObj.dialog.style.top = xy[1] - thisObj.mapLabelObj.imgSize[1] + "px"

        thisObj.mapLabelObj.ElementEvent(thisObj.muLogicX, thisObj.muLogicY);
    };
    //===============csh
    this.ShowAddPoint = function(Evnt) {

        if (thisObj.activeTool != "AddPoint") {
            thisObj.removeEventListener("mouseup", thisObj.mapLabelObj.ShowDialog, false);
            thisObj.mapLabelObj.listenerMark = true;
            return;
        }
        var xy = thisObj.logicToScreen(thisObj.muLogicX, thisObj.muLogicY);
        var dialogStyle = "";
        var htm = '<div style="width: 200px">';
        if (thisObj.isIE == 1)
            htm += '<div style="filter: progid:dximagetransform.microsoft.alphaimageloader(src=' + thisObj.mapLabelObj.imgSrc + ',sizingmethod=\'image\'); height: 45px"></div>';
        else htm += '<div style="height: 45px"><img src="' + thisObj.mapLabelObj.imgSrc + '"/></div>';
        htm += '<div id="showdialog" style="border:solid 1px #acb9c2; background-color:#fff;height: 192px; width: 250px;">';
        htm += '<div style="height:23px; border-bottom:solid 1px #acb9c2 ; background-image:url(images/bg_title.jpg);">';
        htm += '<div style="float:left; padding-left:10px; line-height:23px; font-size:12px; font-weight:bold;color:#314f67;"><img style="margin-top: 3px" alt="标记" src="images/label.gif" /></div>';
        htm += '<div style="width:100px;overflow: hidden;text-overflow:ellipsis;margin-left: 2px;line-height:23px;float:left;height:23px;">' + thisObj.mapLabelObj.labelTitle + '</div>';
        htm += '<a id ="closeDialog" style="cursor: pointer;float:right;height:15px; width:15px; background-image:url(images/close.gif); margin:4px 2px 0px 0px;"></a></div>';
        htm += '<div style="height:42px; line-height:25px;"><div style="margin:10px 0px 0px 8px; height:21px; line-height:21px;"><div style="clear:both; padding:5px 0;">';
        htm += '<div style="float: left">名称：</div>';
        htm += '<input id="txtMarkerName" style="border: #666 1px solid; margin-left: 2px;width: 170px; color: #333;float:left; height:20px;font-size:12px;" value="" />';
        htm += '<div style="clear:both; padding:5px 0;"><div style="float: left">电话：</div><input id="txtMarkerTel" style="border: #666 1px solid; margin-left: 2px;width: 170px; color: #333;float:left; height:20px;font-size:12px;" value="" /></div>';
        htm += '<div style="clear:both; padding:5px 0;"><div style="float: left">地址：</div><input id="txtMarkerAddr" style="border: #666 1px solid; margin-left: 2px;width: 170px; color: #333;float:left; height:20px;font-size:12px;" value="" /></div>';
        htm += '<div style="clear:both; padding:5px 0;"><div class="btnconfirm" id = "btnconfirm" style="margin-left: 85px;width:55px; height:22px; cursor:pointer; background-image:url(images/btnconfirm.gif);"></div></div>';
        htm += '</div></div></div></div>';
        dialogStyle = thisObj.mapLabelObj.htmlStyle ? thisObj.mapLabelObj.htmlStyle : htm;
        thisObj.mapLabelObj.dialog.innerHTML = dialogStyle;
        thisObj.mapLabelObj.dialog.style.display = "block";
        var rightedge = thisObj.getMapViewSize()[0] - Evnt.clientX;
        var bottomedge = document.body.clientHeight - Evnt.clientY;
//        if (rightedge < thisObj.mapLabelObj.dialog.offsetWidth)
//            thisObj.mapLabelObj.dialog.style.left = xy[0] - thisObj.mapLabelObj.dialog.offsetWidth + "px";
//        else
            thisObj.mapLabelObj.dialog.style.left = xy[0] + "px";
//        if (bottomedge < thisObj.mapLabelObj.dialog.offsetHeight)
//            thisObj.mapLabelObj.dialog.style.top = xy[1] - thisObj.mapLabelObj.dialog.offsetHeight + "px";
//        else
            thisObj.mapLabelObj.dialog.style.top = xy[1] - thisObj.mapLabelObj.imgSize[1] + "px"

        thisObj.mapLabelObj.ElementEvent(thisObj.muLogicX, thisObj.muLogicY);
    };
   //==============end      
    
    
    this.HideElement = function(id) {
        var ElementObj = document.getElementById(id);
        ElementObj.style.display = "none";
    };
    this.DisplayLable = function()
     {
        if (typeof (thisObj.mapLabelObj.lgX) == "undefined") return;
        var xy = thisObj.logicToScreen(thisObj.mapLabelObj.lgX, thisObj.mapLabelObj.lgY);
        var wx = xy[0];
        var wy = xy[1] - thisObj.mapLabelObj.imgSize[1];

        var temp = "";
        temp += '<div style="width: 156px">';
        if (thisObj.isIE == 1)
            temp += '<div style="filter: progid:dximagetransform.microsoft.alphaimageloader(src=' + thisObj.mapLabelObj.imgSrc + ',sizingmethod=\'image\'); height: 45px"></div>';
        else temp += '<div style="height: 45px"><img src="' + thisObj.mapLabelObj.imgSrc + '"/></div>';
        temp += '<div style="border:solid 1px #acb9c2; background-color:#fff;"><div style="height:23px;border-bottom:solid 1px #ACB9C2 ; background-image:url(images/bg_title.jpg);">';
        temp += '<span style="margin-top: -1px;width:100px;height:23px;float:left; padding-left:10px;overflow: hidden;font-size:12px;text-overflow:ellipsis; font-weight:bold;color:#314F67;"><img style="margin-top: 3px" alt="标记" src="images/label.gif" />' + thisObj.mapLabelObj.labelName + '</span>';
        temp += '<div style="overflow: hidden;margin-top: 3px;float:right;width:35px"><img id ="changeMarker" alt="显示/隐藏" src="images/MarkUp.gif" />&nbsp;<img id="delmarker" src="' + thisObj.mapLabelObj.delImgSrc + '" /></div></div>';
        temp += '<div style="line-height:20px;" id="MarkCEMark">';
        temp += '<div id="textLine" style="clear:both; padding:5px;overflow: hidden; word-break: break-all; text-indent: 2em; white-space: normal">' + thisObj.mapLabelObj.labelDetail + '</div>';
        temp += '</div></div></div>';
        thisObj.mapLabelObj.div.innerHTML = temp;
        thisObj.mapLabelObj.div.style.left = wx + "px";
        thisObj.mapLabelObj.div.style.top = wy + "px";
        thisObj.mapLabelObj.MarkerElementEvent();
    };
    this.MarkerElementEvent = function() 
    {
        var HideMarker = document.getElementById("changeMarker");
        document.getElementById("MarkCEMark").style.display = thisObj.mapLabelObj.hiddenFlag ? "none" : "block";
        HideMarker.onclick = function(evnt)
	 {
            var HideMarker = document.getElementById("changeMarker");
            var ElementObj = document.getElementById("MarkCEMark");
            ElementObj.style.display = ElementObj.style.display == "none" ? "block" : "none";
            HideMarker.src = ElementObj.style.display == "none" ? "images/MarkDown.gif" : "images/MarkUp.gif";
            thisObj.mapLabelObj.hiddenFlag = ElementObj.style.display == "none" ? true : false;
            var e = evnt ? evnt : event;
            StopBubble(e);
        };
        HideMarker.onmousedown = function(evnt)
	 {
            var e = evnt ? evnt : event;
            StopBubble(e);
        };
        HideMarker.onmouseup = function(evnt)
	 {
            var e = evnt ? evnt : event;
            StopBubble(e);
        };

        var DelMarker = document.getElementById("delmarker");
        DelMarker.onclick = function(evnt) 
	{
            thisObj.mapLabelObj.DeletLable();
            var e = evnt ? evnt : event;
            StopBubble(e);
        };
        DelMarker.onmousedown = function(evnt) 
	{
            var e = evnt ? evnt : event;
            StopBubble(e);
        };
        DelMarker.onmouseup = function(evnt)
	 {
            var e = evnt ? evnt : event;
            StopBubble(e);
        };
        DelMarker = null;
        HideMarker = null;
    };
    this.DeletLable = function()
     {
        this.div.innerHTML = "";
        this.lgX = "";
    };
    this.GetLabelIndex = function() 
    {
        var d, s = "";
        d = new Date();
        var y = d.getYear().toString();
        y = y.substring(2, 4);
        s += (d.getMonth() + 1);
        s += d.getDate();
        s += y;
        s += Math.round(Math.random() * 1000);
        return (s);
    };

    this.CreateUrl = function(XLogic, YLogic, name, details)
     {
        var crtUrl = new String(top.document.URL);
        if (crtUrl.indexOf("?") > 0)
            crtUrl = crtUrl.substring(0, crtUrl.indexOf("?"));

        if (this.flag)
	 {
            this.dotIndex = this.GetLabelIndex();
            this.labelUrl = crtUrl + "?$$*id=" + this.dotIndex;
            var levelNo = thisObj.inf[2] + 1;
            var data = "_method=SendLable" + "&lableName=" + encodeURI(name) + "&lableDetail=" + encodeURI(details) + "&lableID=" + encodeURI(this.dotIndex) + "&levelNo=" + levelNo + "&posX=" + XLogic + "&posY=" + YLogic;
            AJAXRequest(this.dataurl, true, "POST", data, thisObj.mapLabelObj.CbLable);
        }
        else
	 {
            this.labelUrl = crtUrl + "?$$*" + XLogic + "&" + YLogic + "&" + (thisObj.inf[2] + 1) + "&" + escape(name) + "&" + escape(details);
        }
    };

    this.CbLable = function(res)
     {
        if (res.error != null)
	 {
            alert("标注失败，请再试一次");
        }
    };

    this.CopeUrl = function()
     {
        var clipBoardContent = '';
        clipBoardContent += this.labelUrl;
        if (this.labelUrl != "")
            if (thisObj.isIE)
	     {
            window.clipboardData.setData("Text", clipBoardContent);
            alert("链接已复制，可粘贴到QQ/MSN等发给好友!");
        }
        else
	 {
            prompt("可点击右键复制此链接发给您的好友!", this.labelUrl);
        }
    };
//=====================csh
//    this.ElementEvent = function(x, y) {
//        var btnConfirm = document.getElementById("btnconfirm");
//        if (btnConfirm == null) return;
//        var btnClose = document.getElementById("closeDialog");
//        var txtMarkerTitle = document.getElementById("txtMarkerTitle");

//        btnConfirm.onclick = function() {
//            if (txtMarkerTitle.value == "") {
//                alert("请输入标记名称");
//                return;
//            }
//            else {
//                var lableName = txtMarkerTitle.value.trim();
//                var lableDetail = document.getElementById("txtMarkerContent").value.trim();
//                thisObj.mapLabelObj.lgX = x;
//                thisObj.mapLabelObj.lgY = y;
//                thisObj.mapLabelObj.labelId = thisObj.mapLabelObj.dotIndex;
//                thisObj.mapLabelObj.labelName = lableName;
//                thisObj.mapLabelObj.labelDetail = lableDetail;
//                thisObj.mapLabelObj.DisplayLable();
//                thisObj.mapLabelObj.CloseDialog();
//                thisObj.mapLabelObj.CreateUrl(thisObj.mapLabelObj.lgX, thisObj.mapLabelObj.lgY, thisObj.mapLabelObj.labelName, thisObj.mapLabelObj.labelDetail);
//                thisObj.mapLabelObj.CopeUrl();

//            }
//        };
//        btnClose.onclick = function() {
//            thisObj.mapLabelObj.CloseDialog();
//        };
//        btnConfirm = null;
//        btnClose = null;

//    };
      this.ElementEvent = function(x, y)
       {
        var btnConfirm = document.getElementById("btnconfirm");
        if (btnConfirm == null) return;
        var btnClose = document.getElementById("closeDialog");
        var txtMarkerName = document.getElementById("txtMarkerName");
        var txtMarkerTel = document.getElementById("txtMarkerTel");
        var txtMarkerAddr = document.getElementById("txtMarkerAddr");

        btnConfirm.onclick = function()
	 {
            if (txtMarkerName.value == "") 
	    {
                alert("请输入标记名称");
                return;
            }
            else 
	    {
                var lableName = txtMarkerName.value.trim();
                var lableTel = txtMarkerTel.value.trim();
                var lableAddr = txtMarkerAddr.value.trim();
                var lableDetail = document.getElementById("txtMarkerAddr").value.trim();
              thisObj.mapLabelObj.lgX = x;
              thisObj.mapLabelObj.lgY = y;
//              thisObj.mapLabelObj.labelId = thisObj.mapLabelObj.dotIndex;
//              thisObj.mapLabelObj.labelName = lableName;
              thisObj.mapLabelObj.labelDetail = lableDetail;
//              thisObj.mapLabelObj.DisplayLable();
//              thisObj.mapLabelObj.CloseDialog();
//              thisObj.mapLabelObj.CreateUrl(thisObj.mapLabelObj.lgX, thisObj.mapLabelObj.lgY, thisObj.mapLabelObj.labelName, thisObj.mapLabelObj.labelDetail);
//              thisObj.mapLabelObj.CopeUrl();

                var dataurl = "Maps.ashx?DEPTID="+document.all.DEPTID.value;
                var data = "_method=AddFeature&Name=" + escape(lableName.trim()) + "&Tel=" + escape(lableTel.trim())+ "&Addr=" + escape(lableAddr.trim())+ "&X=" + escape(x)+ "&Y=" +  escape(y)+"&UserID=csh";
                AJAXRequest(dataurl, true, "POST", data, cdAddFeature);
                thisObj.mapLabelObj.CloseDialog();

            }
        };
        btnClose.onclick = function()
	 {
            thisObj.mapLabelObj.CloseDialog();
        };
        btnConfirm = null;
        btnClose = null;

    };
    //======== end    
    this.getIndex = function()
     {
        var urlParts = new String(top.document.URL);
        if (urlParts.length > 0) 
	{
            var param = urlParts.split('$$*');
            if (typeof (param[1]) == "undefined") return;
            if (param[1].substring(0, 2) == "id")
	     {
                var pairParts = param[1].split("=");
                this.userId = pairParts[1];
                var str = "_method=GetLable&userId=" + this.userId;
                AJAXRequest(this.dataurl, false, "POST", str, thisObj.mapLabelObj.cbDispLable);
            }
            else
	     {
                var par = param[1].split("&");
                thisObj.jumpMap(par[0], par[1], par[2]);
                thisObj.mapLabelObj.lgX = par[0];
                thisObj.mapLabelObj.lgY = par[1];
                thisObj.mapLabelObj.labelId = "";
                thisObj.mapLabelObj.labelName = unescape(par[3]);
                thisObj.mapLabelObj.labelDetail = unescape(par[4]);
                thisObj.mapLabelObj.DisplayLable(par[0], par[1], "", unescape(par[3]), unescape(par[4]));
            }
        }
    };

    this.cbDispLable = function(res)
     {
        if (res.error != null)
	 {
            return;
        }
        var xmlDoc = res;
        if (navigator.appName == "Netscape") {
            var parser = new DOMParser();
            xmlDoc = parser.parseFromString(res, "text/xml");
        }
        var locPnt = res.getElementsByTagName('P');
        thisObj.mapLabelObj.lgX = GetNodeValue(locPnt[0], "X");
        thisObj.mapLabelObj.lgY = GetNodeValue(locPnt[0], "Y");
        thisObj.mapLabelObj.labelName = GetNodeValue(locPnt[0], "name");
        thisObj.mapLabelObj.levelNo = GetNodeValue(locPnt[0], "levelNo");
        thisObj.mapLabelObj.labelDetail = GetNodeValue(locPnt[0], "shortMessage");
        thisObj.jumpMap(thisObj.mapLabelObj.lgX, thisObj.mapLabelObj.lgY, thisObj.mapLabelObj.levelNo);
        thisObj.mapLabelObj.DisplayLable();
    };
    thisObj.mapLabelObj.getIndex();
    thisObj.addEventListener("zoom", thisObj.mapLabelObj.DisplayLable, false);

};

function IMSSearch() 
{
    thisObj.so = this;
    this.listenerPoint = true;
    this.listenerPolyline = true;
    this.listenerRect = true;
    this.listenerCircle = true;
    this.listenerPolygon = true;
    this.offset = [3, 3];
    this.dealFunArr = [null, null, null, null, null];
    this.ctlFlg = "so";
    this.setQueryMode = function(activeTool, drawAction)
     {
        thisObj.activeTool = activeTool;
        thisObj.drawAction = drawAction;
        switch (drawAction) {
            case "Point":
                if (this.listenerPoint) {
                    thisObj.addEventListener("mouseup", thisObj.so.selectByHitting, false);
                    this.listenerPoint = false;
                }
                break;
            case "Circle":
                if (this.listenerCircle) {
                    thisObj.addEventListener("mouseup", thisObj.so.selectByCircle, false);
                    this.listenerCircle = false;
                }
                break;
            case "Rect":
                if (this.listenerRect) {
                    thisObj.addEventListener("mouseup", thisObj.so.selectByRect, false);
                    this.listenerRect = false;
                }
                break;
            case "Area":
                if (this.listenerPolygon) {
                    thisObj.addEventListener("dblclick", thisObj.so.selectByPolygon, false);
                    this.listenerPolygon = false;
                }
                break;
            case "Polyline":
                if (this.listenerPolyline) {
                    thisObj.addEventListener("dblclick", thisObj.so.selectByLine, false);
                    this.listenerPolyline = false;
                }
                break;
            default:
                break;
        }
    };
    this.setSelectByHitting = function(ioffset, dealFun)
     {
        this.offset[0] = ioffset;
        this.dealFunArr[0] = dealFun;
    };
    this.selectByHitting = function()
     {
        if (thisObj.activeTool != "SelectByHitting") {
            thisObj.removeEventListener("mouseup", thisObj.so.selectByHitting, false);
            thisObj.so.listenerPoint = true;
            return;
        }
        var dx = thisObj.so.offset[0];
        var X = Math.max(thisObj.mdLogicX, thisObj.muLogicX);
        var Y = Math.max(thisObj.mdLogicY, thisObj.muLogicY);
        var startX = X - dx;
        var startY = Y - dx;
        var endX = X + dx;
        var endY = Y + dx;
        var param = "centerX=" + X + "&centerY=" + Y + "&radius=" + dx + "&GridCodes=" + thisObj.getGridCodes(startX, startY, endX, endY) + "&lev=" + (thisObj.inf[2] + 1) + "&sType=SelectByHitting";
        if (thisObj.so.dealFunArr[0] != null)
            thisObj.so.dealFunArr[0](param);
    };
    this.setSelectByRect = function(dealFun) 
    {
        this.dealFunArr[1] = dealFun;
    };
    this.selectByRect = function()
     {
        if (thisObj.activeTool != "SelectByRect") {
            thisObj.removeEventListener("mouseup", thisObj.so.selectByRect, false);
            thisObj.so.listenerRect = true;
            return;
        }
        var startX = Math.min(thisObj.mdLogicX, thisObj.muLogicX);
        var startY = Math.min(thisObj.mdLogicY, thisObj.muLogicY);
        var endX = Math.max(thisObj.mdLogicX, thisObj.muLogicX);
        var endY = Math.max(thisObj.mdLogicY, thisObj.muLogicY);
        var param = "startX=" + startX + "&startY=" + startY + "&endX=" + endX + "&endY=" + endY + "&GridCodes=" + thisObj.getGridCodes(startX, startY, endX, endY) + "&lev=" + (thisObj.inf[2] + 1) + "&sType=SelectByRect";
        if (thisObj.so.dealFunArr[1] != null)
            thisObj.so.dealFunArr[1](param);
    };
    this.setSelectByCircle = function(dealFun)
     {
        this.dealFunArr[2] = dealFun;
    };
    this.selectByCircle = function()
     {
        if (thisObj.activeTool != "SelectByCircle") {
            thisObj.removeEventListener("mouseup", thisObj.so.selectByCircle, false);
            thisObj.so.listenerCircle = true;
            return;
        }
        var centerX = thisObj.mdLogicX;
        var centerY = thisObj.mdLogicY;
        var upX = thisObj.muLogicX;
        var upY = thisObj.muLogicY;
        var w = Math.abs(centerX - upX);
        var h = Math.abs(centerY - upY);
        var radius = Math.sqrt(w * w + h * h);
        var startX = centerX - radius;
        var startY = centerY - radius;
        var endX = centerX + radius;
        var endY = centerY + radius;
        var param = "centerX=" + centerX + "&centerY=" + centerY + "&radius=" + radius + "&GridCodes=" + thisObj.getGridCodes(startX, startY, endX, endY) + "&lev=" + (thisObj.inf[2] + 1) + "&sType=SelectByCircle";
        if (thisObj.so.dealFunArr[2] != null)
            thisObj.so.dealFunArr[2](param);
    };
    this.setSelectByPolygon = function(dealFun) 
    {
        this.dealFunArr[3] = dealFun;
    };
    this.selectByPolygon = function() 
    {
        if (thisObj.activeTool != "SelectByPolygon") {
            thisObj.removeEventListener("dblclick", thisObj.so.selectByPolygon, false);
            thisObj.so.listenerPolygon = true;
            return;
        }
        var startX = thisObj.calculateXarray.min();
        var startY = thisObj.calculateYarray.min();
        var endX = thisObj.calculateXarray.max();
        var endY = thisObj.calculateYarray.max();
        var param = "XArray=" + thisObj.calculateXarray.join() + "&YArray=" + thisObj.calculateYarray.join() + "&GridCodes=" + thisObj.getGridCodes(startX, startY, endX, endY) + "&lev=" + (thisObj.inf[2] + 1) + "&sType=SelectByPolygon"; //GetGridcodes(startX,startY,endX,endY,map);
        if (thisObj.so.dealFunArr[3] != null)
            thisObj.so.dealFunArr[3](param);
    };
    this.setSelectByLine = function(ioffset, dealFun) 
    {
        this.offset[1] = ioffset;
        this.dealFunArr[4] = dealFun;
    };
    this.selectByLine = function()
     {
        if (thisObj.activeTool != "SelectByLine") {
            thisObj.removeEventListener("dblclick", thisObj.so.selectByLine, false);
            thisObj.so.listenerPolyline = true;
            return;
        }
        var dx = thisObj.so.offset[1];
        var lineCood = new IMSLineBuffer();
        var xy = lineCood.creatLineBuffer(thisObj.calculateXarray, thisObj.calculateYarray, dx);
        var startX = xy[0].min();
        var startY = xy[1].min();
        var endX = xy[0].max();
        var endY = xy[1].max();
        var param = "XArray=" + xy[0].join() + "&YArray=" + xy[1].join() + "&GridCodes=" + thisObj.getGridCodes(startX, startY, endX, endY) + "&lev=" + (thisObj.inf[2] + 1) + "&sType=SelectByLine"; //GetGridcodes(startX,startY,endX,endY,map);
        if (thisObj.so.dealFunArr[4] != null)
            thisObj.so.dealFunArr[4](param);
    };
    this.getLogicBuffer = function(pixelLen)
     {
        if (thisObj.mapType != 1)
            return thisObj.logicXlength * pixelLen / thisObj.rowWidth;
        else
            return thisObj.logicXlength * pixelLen / thisObj.pObj.clientWidth;
    }
};

function IMSMeasure()
 {
    thisObj.mo = this;
    
    window.traceObj = this;
    window.lineVml = null;
    
    this.listenerDistance = true;
    this.listenerArea = true;
    this.listernerDisMove = true;
    this.listernerAreaMove = true;
    this.calculateDotCout = 0;
    this.calculateResult = null;
    this.ctlFlg = "mo";
    this.distUnit = [[1, 1000], ["米", "公里"]];
    this.areaUnit = [[1, 1000000], ["平方米", "平方公里"]];


    window.strVML="";

    this.div = document.createElement("DIV");
    this.div.id = "calculateDiv";
    this.div.style.position = "absolute";
    this.div.style.border = "1px outset #ddd";
    this.div.style.backgroundColor = "#FFFFDF";
    this.div.style.color = "black";
    this.div.style.zIndex = "18";
    this.div.style.display = "none";
    this.div.style.height = "20px";
    this.div.style.left = "-30px";
    this.div.style.top = "-30px";
    this.div.style.lineHeight = "2";
    
    if (!document.getElementById("calculateDiv1"))
    {
        window.Div1 = document.createElement("DIV");
        window.Div1.id = "calculateDiv1";
        window.Div1.style.position = "absolute";
        window.Div1.style.left = "0px";
        window.Div1.style.display = "none";
        window.Div1.style.top = "0px";
        window.Div1.style.zIndex = "19";
        thisObj.addControl(window.Div1, true);
    }
    this.setMeasureMode = function(activeTool, drawAction)
     {
        thisObj.activeTool = activeTool;
        thisObj.drawAction = drawAction;
        switch (drawAction) {
            case "Polyline":
                if (this.listenerDistance) {
                    thisObj.addEventListener("mousedown", thisObj.mo.distanceMouseDown, false);
                    thisObj.addEventListener("dblclick", thisObj.mo.distanceDblClick, false);
                    thisObj.addEventListener("keypress", thisObj.mo.distanceKeyPress, false);
                    this.listenerDistance = false;
                }
                break;
            case "Area":
                if (this.listenerArea) {
                    thisObj.addEventListener("mousedown", thisObj.mo.areaMouseDown, false);
                    thisObj.addEventListener("dblclick", thisObj.mo.areaDblClick, false);
                    thisObj.addEventListener("keypress", thisObj.mo.areaKeyPress, false);
                    this.listenerArea = false;
                }
                break;
            default:
                break;
        }
        this.clearMeasureParam();
    };
    this.setDistanceUnits = function(valueArr, unitArr)
     {
        this.distUnit = [valueArr, unitArr];
    };
    this.setAreaUnits = function(valueArr, unitArr) 
    {
        this.areaUnit = [valueArr, unitArr];
    };
    this.setTooltipStyle = function(border, backgroundColor, fontColor)
     {
        this.div.style.border = border ? border : "1px outset #ddd";
        this.div.style.backgroundColor = backgroundColor ? backgroundColor : "#FFFFDF";
        this.div.style.color = fontColor ? fontColor : "black";
    };
    
    this.distanceMouseDown = function(e)
     {
        if (thisObj.activeTool != "MeasureDistance") {
            thisObj.removeEventListener("mousedown", thisObj.mo.distanceMouseDown, false);
            thisObj.mo.listenerDistance = true;
            return;
        }
        if (thisObj.mo.listernerDisMove) {
            thisObj.addEventListener("mousemove", thisObj.mo.distanceMouseMove, false);
            thisObj.mo.listernerDisMove = false;
        }
        var calculateDiv = document.getElementById("calculateDiv");
//        var calculateDiv1 = document.getElementById("calculateDiv1");

        if (calculateDiv != null)
	 {
            thisObj.pressing = true;
            thisObj.mo.calculateDotCout += 1;
            if (thisObj.mo.calculateDotCout == 1)
	      {
                calculateDiv.style.display = "";
//                calculateDiv1.style.display="";
            }

            if (thisObj.mo.calculateDotCout <= 1)
            { 
               thisObj.mo.calculateResult = 0; 
               //========csh
                var calculateDiv1 = document.getElementById("calculateDiv1");
                calculateDiv1.innerHTML="";
                
               var temp = thisObj.logicToScreen(thisObj.calculateXarray[0], thisObj.calculateYarray[0]);
               strVML = "<div  style='POSITION:absolute;Z-INDEX:19;LEFT:"+(temp[0])  + "px;TOP:"+(temp[1])  + "px;' ></div>";
               var sVML=document.createElement(strVML);    
                sVML.style.width = thisObj.mapContainer.style.width;
                sVML.style.height = thisObj.mapContainer.style.height;
                sVML.style.position = "absolute";
                sVML.style.border = "1px outset #ddd";
                sVML.style.backgroundColor = "#FFFFDF";
                sVML.style.color = "black";
                sVML.style.zIndex = "19";
                sVML.style.height = "14px";
//                sVML.style.width = "24px";
                strVML="0米";
                sVML.style.width = (strVML.length*8+1)+"px";
                sVML.innerHTML="<font size='1'>"+strVML+"</font>";

                calculateDiv1.insertBefore(sVML);  
                //========end
            }
            else 
	      {      
	            //========csh
	            var calculateDiv1 = document.getElementById("calculateDiv1");
	            var tmpDistanceResult=0,tmpDistanceResult1=0;
                thisObj.mo.calculateResult += TwoPntDistance(thisObj.calculateXarray[thisObj.mo.calculateDotCout - 2], thisObj.calculateYarray[thisObj.mo.calculateDotCout - 2], thisObj.calculateXarray[thisObj.mo.calculateDotCout - 1], thisObj.calculateYarray[thisObj.mo.calculateDotCout - 1], thisObj.mo.distUnit[0][0]);
                
                var tmp = GetClientXY(e, thisObj.pObj);
                if (thisObj.mo.distUnit[1].length > 1 && thisObj.mo.calculateResult > thisObj.mo.distUnit[0][1])
                 {
                    calculateDiv1.innerHTML="";
                    if (thisObj.calculateXarray.length >= 1) {
                        for (var i = 0; i < thisObj.calculateXarray.length; i++) 
                        {
                            var temp = thisObj.logicToScreen(thisObj.calculateXarray[i], thisObj.calculateYarray[i]);
                            strVML = "<div  style='POSITION:absolute;Z-INDEX:19;LEFT:"+(temp[0])  + "px;TOP:"+(temp[1])  + "px;' ></div>"
                            var sVML=document.createElement(strVML);
                            if(i==0)
                            {  
                                sVML.style.width = thisObj.mapContainer.style.width;
                                sVML.style.height = thisObj.mapContainer.style.height;
                                sVML.style.position = "absolute";
                                sVML.style.border = "1px outset #ddd";
                                sVML.style.backgroundColor = "#FFFFDF";
                                sVML.style.color = "black";
                                sVML.style.zIndex = "19";
                                sVML.style.height = "14px";
//                                sVML.style.width = "24px";
                                strVML="0米";
                                sVML.style.width = (strVML.length*8+1)+"px";
                                sVML.innerHTML="<font size='1'>"+strVML+"</font>";

                            }
                           else 
                           {                           
                                tmpDistanceResult1 =  TwoPntDistance(thisObj.calculateXarray[i-1], thisObj.calculateYarray[i-1], thisObj.calculateXarray[i], thisObj.calculateYarray[i], 1); 
                                tmpDistanceResult+=tmpDistanceResult1;
                                sVML.style.width = thisObj.mapContainer.style.width;
                                sVML.style.height = thisObj.mapContainer.style.height;
                                sVML.style.position = "absolute";
                                sVML.style.border = "1px outset #ddd";
                                sVML.style.backgroundColor = "#FFFFDF";
                                sVML.style.color = "black";
                                sVML.style.zIndex = "19";
                                sVML.style.height = "14px";
                                var str="";
                                 if (thisObj.mo.distUnit[1].length > 1 && tmpDistanceResult > thisObj.mo.distUnit[0][1])
                                {
                                      str=(tmpDistanceResult / thisObj.mo.distUnit[0][1]).toFixed(1) + thisObj.mo.distUnit[1][1];
                                      sVML.innerHTML="<font size='1'>"+str+"</font>";
                                 }
                                else
                                 {
                                     str=parseInt(tmpDistanceResult) + thisObj.mo.distUnit[1][0]; + thisObj.mo.distUnit[1][0];
                                     sVML.innerHTML="<font size='1'>"+str+"</font>";
                                 }
                                 sVML.style.width = (str.length*8+1)+"px";
                            }
                            calculateDiv1.insertBefore(sVML);                            
                        } 
                    }  
  
                 }
                else
                 {
                    calculateDiv1.innerHTML="";
                    if (thisObj.calculateXarray.length >= 1) {
                        for (var i = 0; i < thisObj.calculateXarray.length; i++) 
                        {
                            var temp = thisObj.logicToScreen(thisObj.calculateXarray[i], thisObj.calculateYarray[i]);
                            strVML = "<div  style='POSITION:absolute;Z-INDEX:19;LEFT:"+(temp[0])  + "px;TOP:"+(temp[1])  + "px;' ></div>"
                            var sVML=document.createElement(strVML);
                            if(i==0)
                            {  
                                sVML.style.width = thisObj.mapContainer.style.width;
                                sVML.style.height = thisObj.mapContainer.style.height;
                                sVML.style.position = "absolute";
                                sVML.style.border = "1px outset #ddd";
                                sVML.style.backgroundColor = "#FFFFDF";
                                sVML.style.color = "black";
                                sVML.style.zIndex = "19";
                                sVML.style.height = "14px";
//                                sVML.style.width = "24px";
                                strVML="0米";
                                sVML.style.width = (strVML.length*8+1)+"px";
                                sVML.innerHTML="<font size='1'>"+strVML+"</font>";

                            }
                           else 
                           {
                           
                                tmpDistanceResult1 =  TwoPntDistance(thisObj.calculateXarray[i-1], thisObj.calculateYarray[i-1], thisObj.calculateXarray[i], thisObj.calculateYarray[i], 1); 
                                tmpDistanceResult+=tmpDistanceResult1;
                                sVML.style.width = thisObj.mapContainer.style.width;
                                sVML.style.height = thisObj.mapContainer.style.height;
                                sVML.style.position = "absolute";
                                sVML.style.border = "1px outset #ddd";
                                sVML.style.backgroundColor = "#FFFFDF";
                                sVML.style.color = "black";
                                sVML.style.zIndex = "19";
                                sVML.style.height = "14px";
                                var str="";
                                 if (thisObj.mo.distUnit[1].length > 1 && tmpDistanceResult > thisObj.mo.distUnit[0][1])
                                {
                                      str=(tmpDistanceResult / thisObj.mo.distUnit[0][1]).toFixed(1) + thisObj.mo.distUnit[1][1];
                                      sVML.innerHTML="<font size='1'>"+str+"</font>";
                                 }
                                else
                                 {
                                     str=parseInt(tmpDistanceResult) + thisObj.mo.distUnit[1][0]; + thisObj.mo.distUnit[1][0];
                                     sVML.innerHTML="<font size='1'>"+str+"</font>";
                                 }
                                 sVML.style.width = (str.length*8+1)+"px";
                            }
                            calculateDiv1.insertBefore(sVML);                            
                        } 
                    }
                    //=============end
//                     strVML += "<v:textpath style='POSITION:absolute;Z-INDEX:1;LEFT:"+tmp[0] + "px;TOP:"+tmp[1]  + "px;FONT-SIZE:20px;FONT-FAMILY:宋体'  string='1米'></v:textpath >"
                     //strHtml += "<FONT face='宋体' style='font-size:12px;'>" +  parseInt(thisObj.mo.calculateResult) + thisObj.mo.distUnit[1][0] + "</FONT>";
                     //div1.insertBefore(document.createElement(strVML));
                 }
//                 calculateDiv1.style.top = tmp[1] + 15 + "px";
//                 calculateDiv1.style.left = tmp[0] + 20 + "px";
//                thisObj.mo.AdjustDiv(e ? e : event);
           }
        }
    };
    this.distanceMouseMove = function(e)
     {
        if (thisObj.activeTool != "MeasureDistance") {
            thisObj.removeEventListener("mousemove", thisObj.mo.distanceMouseMove, false);
            thisObj.mo.listernerDisMove = true;
            if (thisObj.vmlObj != null)
	     {
                thisObj.vmlObj.dispose();
                thisObj.vmlObj = null;
            }
            return;
        }
        if (thisObj.mo.calculateDotCout > 0)
	 {
            var tmpDistanceResult = 0;
            var tmpDistanceResult1 = 0;
    
            if (thisObj.mo.calculateDotCout <= 1)
            {
                tmpDistanceResult1 = TwoPntDistance(thisObj.calculateXarray[0], thisObj.calculateYarray[0], thisObj.xLogic, thisObj.yLogic, thisObj.mo.distUnit[0][0]);
                tmpDistanceResult = tmpDistanceResult1;
            }
            else
             {
                tmpDistanceResult1=TwoPntDistance(thisObj.calculateXarray[thisObj.mo.calculateDotCout - 1], thisObj.calculateYarray[thisObj.mo.calculateDotCout - 1], thisObj.xLogic, thisObj.yLogic, thisObj.mo.distUnit[0][0]);
                tmpDistanceResult = thisObj.mo.calculateResult + tmpDistanceResult1;
             }
            var calculateDiv = document.getElementById("calculateDiv");
            if (thisObj.mo.distUnit[1].length > 1 && tmpDistanceResult > thisObj.mo.distUnit[0][1])
            {
                calculateDiv.innerHTML ="<FONT face='宋体' style='font-size:12px;'>总距离约为：" + (tmpDistanceResult / thisObj.mo.distUnit[0][1]).toFixed(1) + thisObj.mo.distUnit[1][1] + "</FONT>";
               }
            else
             {
               calculateDiv.innerHTML ="<FONT face='宋体' style='font-size:12px;'>总距离约为：" +  parseInt(tmpDistanceResult) + thisObj.mo.distUnit[1][0] + "</FONT>>";
              }
//              var tmp = thisObj.logicToScreen(thisObj.xLogic, thisObj.yLogic);
            var tmp= GetClientXY(e, thisObj.pObj);
            calculateDiv.style.top = tmp[1] + 15 + "px";
            calculateDiv.style.left = tmp[0] + 20 + "px";
            thisObj.mo.AdjustDiv(e ? e : event);
        }
    };
    this.distanceDblClick = function()
     {
       //========csh
        var calculateDiv1 = document.getElementById("calculateDiv1");
        calculateDiv1.innerHTML="";
        thisObj.mo.clearMeasureParam();

        
        thisObj.mo.calculateDotCout=0;
        thisObj.calculateXarray.length=0;
        thisObj.calculateYarray.length=0;
        thisObj.xLogic=0;
        thisObj.yLogic=0;
        
        //========end
        thisObj.mo.clearMeasureParam();
        if (thisObj.activeTool != "MeasureDistance") {
            thisObj.removeEventListener("dblclick", thisObj.mo.distanceDblClick, false);
            thisObj.mo.listenerDistance = true;
            
           return;
        }

    };
    this.distanceKeyPress = function(e)
     {
        if (thisObj.activeTool != "MeasureDistance") {
            thisObj.removeEventListener("keypress", thisObj.mo.distanceKeyPress, false);
            thisObj.mo.listenerDistance = true;
            return;
        }
        if (thisObj.vmlObj != null)
	 {
            var tmp = thisObj.logicToScreen(thisObj.xLogic, thisObj.yLogic);
            thisObj.vmlObj.drawing(tmp[0] + "," + tmp[1]);
            if (thisObj.mo.calculateDotCout > 0)
	     {
            var tmpDistanceResult = 0;
            var tmpDistanceResult1 = 0;
    
            if (thisObj.mo.calculateDotCout <= 1)
            {
                tmpDistanceResult1 = TwoPntDistance(thisObj.calculateXarray[0], thisObj.calculateYarray[0], thisObj.xLogic, thisObj.yLogic, thisObj.mo.distUnit[0][0]);
                tmpDistanceResult = tmpDistanceResult1;
            }
            else
             {
                tmpDistanceResult1=TwoPntDistance(thisObj.calculateXarray[thisObj.mo.calculateDotCout - 1], thisObj.calculateYarray[thisObj.mo.calculateDotCout - 1], thisObj.xLogic, thisObj.yLogic, thisObj.mo.distUnit[0][0]);
                tmpDistanceResult = thisObj.mo.calculateResult + tmpDistanceResult1;
             }
                var calculateDiv = document.getElementById("calculateDiv")
                if (thisObj.mo.distUnit[1].length > 1 && tmpDistanceResult > thisObj.mo.distUnit[0][1])
                    calculateDiv.innerHTML = "<FONT face='宋体' style='font-size:12px;'>测量距离约为：" + (tmpDistanceResult / thisObj.mo.distUnit[0][1]).toFixed(1) + thisObj.mo.distUnit[1][1] + "</FONT>";
                else
                    calculateDiv.innerHTML = "<FONT face='宋体' style='font-size:12px;'>测量距离约为：" + parseInt(tmpDistanceResult) + thisObj.mo.distUnit[1][0] + "</FONT>";
                calculateDiv.style.top = tmp[1] + thisObj.overLay.offsetTop + 15 + "px";
                calculateDiv.style.left = tmp[0] + thisObj.overLay.offsetLeft + 20 + "px";
                thisObj.mo.AdjustDiv(e ? e : event);
            }
        }
    };
    this.areaMouseDown = function() 
    {
        if (thisObj.activeTool != "MeasureArea") {
            thisObj.removeEventListener("mousedown", thisObj.mo.areaMouseDown, false);
            thisObj.mo.listenerArea = true;
            return;
        }
        if (thisObj.mo.listernerAreaMove) {
            thisObj.addEventListener("mousemove", thisObj.mo.areaMouseMove, false);
            thisObj.mo.listernerAreaMove = false;
        }
        var calculateDiv = document.getElementById("calculateDiv");
        if (calculateDiv != null)
	 {
            thisObj.mo.calculateDotCout += 1;
            if (thisObj.mo.calculateDotCout == 1)
	     {
                calculateDiv.style.display = "";
            }
        }
    };
    this.areaMouseMove = function(e)
     {
        if (thisObj.activeTool != "MeasureArea") {
            thisObj.removeEventListener("mousemove", thisObj.mo.areaMouseMove, false);
            thisObj.mo.listernerAreaMove = true;
            if (thisObj.vmlObj != null)
	     {
                thisObj.vmlObj.dispose();
                thisObj.vmlObj = null;
            }
            return;
        }
        if (thisObj.mo.calculateDotCout > 0)
	 {
	        var tmp = thisObj.logicToScreen(thisObj.xLogic, thisObj.yLogic);

            thisObj.calculateXarray[thisObj.mo.calculateDotCout] = thisObj.xLogic;
            thisObj.calculateYarray[thisObj.mo.calculateDotCout] = thisObj.yLogic;
            var tmpAreaResult = 0;
            if (thisObj.mo.calculateDotCout >= 2)
                tmpAreaResult = parseInt(ComputeArea(thisObj.mo.calculateDotCout, thisObj.calculateXarray, thisObj.calculateYarray, thisObj.mo.areaUnit[0][0]));
            var calculateDiv = document.getElementById("calculateDiv");
            if (thisObj.mo.areaUnit[1].length > 1 && tmpAreaResult > thisObj.mo.areaUnit[0][1])
                calculateDiv.innerHTML = "<FONT face='宋体' style='font-size:12px'>测量面积约为：" + (tmpAreaResult / thisObj.mo.areaUnit[0][1]).toFixed(4) + thisObj.mo.areaUnit[1][1] + "</FONT>";
            else
                calculateDiv.innerHTML = "<FONT face='宋体' style='font-size:12px'>测量面积约为：" + tmpAreaResult + thisObj.mo.areaUnit[1][0] + "</FONT>";

            var tmp = GetClientXY(e, thisObj.pObj);
            calculateDiv.style.top = tmp[1] + 15 + "px";
            calculateDiv.style.left = tmp[0] + 20 + "px";
            thisObj.mo.AdjustDiv(e ? e : event);
        }

    };
    this.areaKeyPress = function(e)
     {
        if (thisObj.activeTool != "MeasureArea") {
            thisObj.removeEventListener("keypress", thisObj.mo.areaKeyPress, false);
            thisObj.mo.listenerArea = true;
            return;
        }
        if (thisObj.vmlObj != null)
	 {

            var tmp = thisObj.logicToScreen(thisObj.xLogic, thisObj.yLogic);
            thisObj.vmlObj.drawing(tmp[0] + "," + tmp[1]);
            if (thisObj.mo.calculateDotCout > 0) 
	    {
                thisObj.calculateXarray[thisObj.mo.calculateDotCout] = thisObj.xLogic;
                thisObj.calculateYarray[thisObj.mo.calculateDotCout] = thisObj.yLogic;
                var tmpAreaResult = 0;
                if (thisObj.mo.calculateDotCout >= 2)
                    tmpAreaResult = parseInt(ComputeArea(thisObj.mo.calculateDotCout, thisObj.calculateXarray, thisObj.calculateYarray, thisObj.mo.areaUnit[0][0]));
                var calculateDiv = document.getElementById("calculateDiv");
                if (thisObj.mo.areaUnit[1].length > 1 && tmpAreaResult > thisObj.mo.areaUnit[0][1])
                    calculateDiv.innerHTML = "<FONT face='宋体' style='font-size:12px'>测量面积约为：" + (tmpAreaResult / thisObj.mo.areaUnit[0][1]).toFixed(4) + thisObj.mo.areaUnit[1][1] + "</FONT>";
                else
                    calculateDiv.innerHTML = "<FONT face='宋体' style='font-size:12px'>测量面积约为：" + tmpAreaResult + thisObj.mo.areaUnit[1][0] + "</FONT>";
                calculateDiv.style.top = tmp[1] + thisObj.overLay.offsetTop + 15 + "px";
                calculateDiv.style.left = tmp[0] + thisObj.overLay.offsetLeft + 20 + "px";
                thisObj.mo.AdjustDiv(e ? e : event);
            }
        }
    };
    this.areaDblClick = function()
     {
        thisObj.mo.clearMeasureParam();
        if (thisObj.activeTool != "MeasureArea") {
            thisObj.removeEventListener("dblclick", thisObj.mo.areaDblClick, false);
            thisObj.mo.listenerArea = true;

        }

    };
    this.clearMeasureParam = function()
     {
        if (!listenFlag1) 
        {
            thisObj.removeEventListener("zoom", this.RePainting1, false);
            listenFlag1=true;
        }
         if (!listenFlag2) 
        {
            thisObj.removeEventListener("zoom", this.RePainting2, false);
            listenFlag2=true;
        }
        var calculateDiv = document.getElementById("calculateDiv");
        if (calculateDiv != null)
	   {
            calculateDiv.style.top = "-30px";
            calculateDiv.style.left = "-30px";
            calculateDiv.style.display = "none";
            calculateDiv = null;
        }
         var calculateDiv1 = document.getElementById("calculateDiv1");
        if (calculateDiv1 != null)
	   {
//            calculateDiv1.style.top = "-30px";
//            calculateDiv1.style.left = "-30px";
//            calculateDiv1.style.display = "none";
//            calculateDiv1 = null;
            calculateDiv1.innerHTML="";
        }  
        this.calculateDotCout = 0;
        this.calculateResult = 0;
    };
    this.AdjustDiv = function(e)
     {
        var xPix = e.clientX;
        var yPix = e.clientY;
        thisHeight = thisObj.pObj.clientHeight;
        thisWidth = thisObj.pObj.clientWidth;
        var calculateDiv = document.getElementById("calculateDiv");
        var topVal = parseInt(calculateDiv.style.top);
        var leftVal = parseInt(calculateDiv.style.left);
        if (xPix + 200 > thisWidth)
	 {
            calculateDiv.style.left = leftVal - 200;
        }
        if (yPix + 40 > thisHeight)
	 {
            calculateDiv.style.top = topVal - 40;
        }
    };
    function TwoPntDistance(x1, y1, x2, y2, unit)
     {
        var xD = Math.abs(x1 - x2);
        var yD = Math.abs(y1 - y2);
        var dist = (Math.sqrt(Math.pow(xD, 2) + Math.pow(yD, 2))) * unit; //103133.845;
        return dist;
    };
    function ComputeArea(numPnt, x, y, unit)
     {
        var area = 0;
        var i, j;
        var xjyi, xiyj;
        var xydiff;
        j = numPnt;

        for (i = 0; i <= numPnt; i++)
	 {
            xiyj = x[i] * y[j];
            xjyi = x[j] * y[i];
            xydiff = (xiyj - xjyi);
            area += xydiff;
            j = i;
        }
        area = Math.abs(area / 2) * unit;
        return area;
    };
    //==============csh
    this.pntLocation = function() 
    {
        if (this.specialNodeInfoArray.length <= 0)
         {
            if (this.HSLogicXArray.length <= 0)
                return;
            thisObj.pntLocation(this.HSLogicXArray[0], this.HSLogicYArray[0]);
        } 
        else 
        {
            if (this.specialNodeInfoArray.length <= 0)
                return;
            thisObj.pntLocation(this.specialNodeInfoArray[0].x, this.specialNodeInfoArray[0].y);
        }
    }
    var listenFlag1 = true;
    var listenFlag2 = true;
    this.drawLine = function()
     {
        var sss=0;
        switch (thisObj.drawAction) {
            case "Polyline":
                   if (listenFlag1) {
                        thisObj.addEventListener("zoom", this.RePainting1, false);
                        listenFlag1 = false;
                    }
                break;
            case "Area":
                   if (listenFlag2) {
                        thisObj.addEventListener("zoom", this.RePainting2, false);
                        listenFlag2 = false;
                    }
                break;
            default:
                break;
        }
    };

     this.RePainting1 = function()
     {
        var calculateDiv1 = document.getElementById("calculateDiv1");
         calculateDiv1.innerHTML="";
        HSXarray = new Array();
        HSYarray = new Array();
        var lineDotInfo = new Array();
        if (thisObj.calculateXarray.length >= 1) 
        {
            for (var i = 0; i < thisObj.calculateXarray.length; i++) {
                var temp = thisObj.logicToScreen(thisObj.calculateXarray[i], thisObj.calculateYarray[i]);
                HSXarray[i] = temp[0];
                HSYarray[i] = temp[1];
                lineDotInfo.push(HSXarray[i] + "," + HSYarray[i]);
            }
            lineVml = new IMSPalette(calculateDiv1, "polyline");
            lineVml.setStyle(traceObj.color, traceObj.width);
            lineVml.draw(lineDotInfo);
        }   
     	var tmpDistanceResult=0,tmpDistanceResult1=0;
        if (thisObj.calculateXarray.length >= 1) 
        {
            for (var i = 0; i < thisObj.calculateXarray.length; i++) 
            {
                var temp = thisObj.logicToScreen(thisObj.calculateXarray[i], thisObj.calculateYarray[i]);
                thisObj.vmlObj.appendPoint(temp[0],temp[1]);
                strVML = "<div  style='POSITION:absolute;Z-INDEX:19;LEFT:"+(temp[0])  + "px;TOP:"+(temp[1])  + "px;' ></div>"
                var sVML=document.createElement(strVML);
                if(i==0)
                {  
                    sVML.style.width = thisObj.mapContainer.style.width;
                    sVML.style.height = thisObj.mapContainer.style.height;
                    sVML.style.position = "absolute";
                    sVML.style.border = "1px outset #ddd";
                    sVML.style.backgroundColor = "#FFFFDF";
                    sVML.style.color = "black";
                    sVML.style.zIndex = "19";
                    sVML.style.height = "14px";
//                    sVML.style.width = "20px";
                    strVML="0米";
                    sVML.style.width = (strVML.length*8+1)+"px";
                    sVML.innerHTML="<font size='1'>"+strVML+"</font>";
                    
                }
               else 
               {
               
                    tmpDistanceResult1 =  TwoPntDistance(thisObj.calculateXarray[i-1], thisObj.calculateYarray[i-1], thisObj.calculateXarray[i], thisObj.calculateYarray[i], 1); 
                    tmpDistanceResult+=tmpDistanceResult1;
                    sVML.style.width = thisObj.mapContainer.style.width;
                    sVML.style.height = thisObj.mapContainer.style.height;
                    sVML.style.position = "absolute";
                    sVML.style.border = "1px outset #ddd";
                    sVML.style.backgroundColor = "#FFFFDF";
                    sVML.style.color = "black";
                    sVML.style.zIndex = "19";
                    sVML.style.height = "14px";
                    var strVML="";
                     if (thisObj.mo.distUnit[1].length > 1 && tmpDistanceResult > thisObj.mo.distUnit[0][1])
                    {
                          strVML=(tmpDistanceResult / thisObj.mo.distUnit[0][1]).toFixed(1) + thisObj.mo.distUnit[1][1];
                          sVML.innerHTML="<font size='1'>"+strVML+"</font>";
                     }
                    else
                     {
                         strVML=parseInt(tmpDistanceResult) + thisObj.mo.distUnit[1][0]; + thisObj.mo.distUnit[1][0];
                         sVML.innerHTML="<font size='1'>"+strVML+"</font>";
                     }
                     sVML.style.width = (strVML.length*8+1)+"px";
                }
                calculateDiv1.insertBefore(sVML);  
        }
       
     }
    }; 
        this.RePainting2 = function()
     {
            var calculateDiv = document.getElementById("calculateDiv");
             calculateDiv.innerHTML="";
        
        if (thisObj.calculateXarray.length >= 1) 
        {
            for (var i = 0; i < thisObj.calculateXarray.length-1; i++) 
            {
                var temp = thisObj.logicToScreen(thisObj.calculateXarray[i], thisObj.calculateYarray[i]);
                thisObj.vmlObj.appendPoint(temp[0],temp[1]);
           }       
        } 
            
      } ;
    //==============end
};

function IMSLineBuffer()
 {
    this.direction = true;
    this.creatLineBuffer = function(streetCoordX, streetCoordY, bufferValue)
     {
        if (bufferValue == 0) return [streetCoordX, streetCoordY];
        bufferValue = bufferValue ? bufferValue : 0.04735;
        var labelXArry = streetCoordX;
        var labelYArry = streetCoordY;
        var newXrray = new Array(labelXArry.length * 2);
        var newYrray = new Array(labelXArry.length * 2);
        var temp = new Array();

        temp = this.GetSingleParallelDot(labelXArry[0] * 1, labelYArry[0] * 1, labelXArry[1] * 1, labelYArry[1] * 1, bufferValue, 1);
        newXrray[0] = temp[0];
        newYrray[0] = temp[1];
        newXrray[labelXArry.length * 2 - 1] = temp[2];
        newYrray[labelXArry.length * 2 - 1] = temp[3];

        for (var i = 1; i < labelXArry.length - 1; i++)
	   {
            var p1 = new this.Point(labelXArry[i - 1], labelYArry[i - 1]);
            var p2 = new this.Point(labelXArry[i], labelYArry[i]);
            var p3 = new this.Point(labelXArry[i + 1], labelYArry[i + 1]);
            temp = this.GetParallelDot(p1, p2, p3, bufferValue);
            newXrray[i] = temp[0];
            newYrray[i] = temp[1];
        }
        temp = this.GetSingleParallelDot(labelXArry[labelXArry.length - 2] * 1, labelYArry[labelXArry.length - 2] * 1, labelXArry[labelXArry.length - 1] * 1, labelYArry[labelXArry.length - 1] * 1, bufferValue, 2);
        newXrray[labelXArry.length - 1] = temp[0];
        newYrray[labelXArry.length - 1] = temp[1];
        newXrray[labelXArry.length] = temp[2];
        newYrray[labelXArry.length] = temp[3];
        this.direction = true;
        var n = labelXArry.length * 2 - 2;
        for (var i = 1; i < labelXArry.length - 1; i++)
	 {
            var p1 = new this.Point(labelXArry[i - 1], labelYArry[i - 1]);
            var p2 = new this.Point(labelXArry[i], labelYArry[i]);
            var p3 = new this.Point(labelXArry[i + 1], labelYArry[i + 1]);
            temp = this.GetParallelDot(p1, p2, p3, 0 - bufferValue);
            newXrray[n] = temp[0];
            newYrray[n] = temp[1];
            n--;
        }
        this.direction = true;
        return [newXrray, newYrray];
    };

    this.GetParallelDot = function(point1, point2, point3, dis)
     {
        var p = new this.Point();
        var line1 = null, line2 = null;
        var kx1 = point2.x - point1.x;
        var ky1 = point2.y - point1.y;
        var kx2 = point2.x - point3.x;
        var ky2 = point2.y - point3.y;
        line1 = this.GetLine(this.MakeLine(point1, point2), dis, this.direction);
        if ((kx1 * ky1 < 0 || ky1 == 0) && (kx2 == 0 || kx2 * ky2 > 0))
	 {
            if (point3.x <= point2.x && point3.y < point2.y)
                this.direction = !this.direction;
            else if (point3.x >= point2.x && point3.y > point2.y)
                this.direction = !this.direction;
        }
        else if ((kx1 * ky1 < 0 || ky1 == 0) && (kx2 == 0 || kx2 * ky2 < 0))
	 {
            if (point1.x <= point2.x && point1.y < point2.y && point3.x <= point2.x && point3.y < point2.y)
                this.direction = !this.direction;
            else if (point1.x >= point2.x && point1.y > point2.y && point3.x >= point2.x && point3.y > point2.y)
                this.direction = !this.direction;
        }
        else if ((kx1 * ky1 > 0 || ky1 == 0) && (kx2 == 0 || kx2 * ky2 > 0)) 
	{
            if (point1.x <= point2.x && point1.y < point2.y && point3.x <= point2.x && point3.y < point2.y)
                this.direction = !this.direction;
            else if (point1.x >= point2.x && point1.y > point2.y && point3.x >= point2.x && point3.y > point2.y)
                this.direction = !this.direction;
        }
        else if ((kx1 * ky1 > 0 || ky1 == 0) && (kx2 == 0 || kx2 * ky2 < 0))
	 {
            if (point3.x <= point2.x && point3.y > point2.y)
                this.direction = !this.direction;
            else if (point3.x >= point2.x && point3.y < point2.y)
                this.direction = !this.direction;
        }
        line2 = this.GetLine(this.MakeLine(point2, point3), dis, this.direction);
        if (line1.a == 0 && line1.b != 0 && line2.a == 0 && line2.b != 0)
	 {
            p.x = point2.x;
            p.y = point2.y + dis;
        }
        else if (line1.a != 0 && line1.b == 0 && line2.a != 0 && line2.b == 0)
	 {
            p.x = point2.x + dis;
            p.y = point2.y;
        }
        else if (line1.a == 0 && line1.b != 0 && line2.a != 0 && line2.b == 0)
	 {
            p.x = point2.x + dis;
            p.y = point2.y + dis;
        }
        else if (line1.a != 0 && line1.b == 0 && line2.a == 0 && line2.b != 0) 
	{
            p.x = point2.x + dis;
            p.y = point2.y + dis;
        }
        else {
            p.x = (line1.b * line2.c - line1.c * line2.b) / (line1.a * line2.b - line2.a * line1.b);
            p.y = (line2.c * line1.a - line2.a * line1.c) / (line1.b * line2.a - line1.a * line2.b);
        }
        return [p.x, p.y];
    };
    this.GetLine = function(line, dis, flag)
     {
        var tl = new this.Line();
        tl.a = line.a;
        tl.b = line.b;
        if (!flag)
            dis = 0 - dis;
        if (line.a == 0 && line.b != 0)
	 {
            tl.c = line.c - dis * line.b;
        }
        else if (line.a != 0 && line.b == 0) 
	{
            tl.c = line.c + dis * line.a;
        }
        else if (line.a != 0 && line.b != 0)
	 {
            if (line.b < 0)
                tl.c = line.c + dis * Math.sqrt(line.a * line.a + line.b * line.b);
            else
                tl.c = line.c - dis * Math.sqrt(line.a * line.a + line.b * line.b);
        }
        return tl;
    };
    this.MakeLine = function(point1, point2)
     {
        var tl = new this.Line();
        var sign = 1;
        tl.a = point2.y - point1.y;
        if (tl.a < 0)
	 {
            sign = -1;
            tl.a = sign * tl.a;
        }
        tl.b = sign * (point1.x - point2.x);
        tl.c = sign * (point1.y * point2.x - point1.x * point2.y);
        return tl;
    };
    this.GetSingleParallelDot = function(x1, y1, x2, y2, dis, backFlag)//获取平行点
    {
        if (!this.direction)
            dis = 0 - dis;
        if (y1 == y2)
	 {
            if (backFlag == 0)
                return [x1, y1 + dis, x1, y1 - dis, x2, y2 + dis, x2, y2 - dis];
            else if (backFlag == 1)
                return [x1, y1 + dis, x1, y1 - dis];
            else
                return [x2, y2 + dis, x2, y2 - dis];
        }
        else if (x1 == x2) 
	{
            if (backFlag == 0)
                return [x1 + dis, y1, x1 - dis, y1, x2 + dis, y2, x2 - dis, y2];
            else if (backFlag == 1)
                return [x1 + dis, y1, x1 - dis, y1];
            else
                return [x2 + dis, y2, x2 - dis, y2];
        }
        else
	 {
            var k = (y1 - y2) / (x1 - x2);
            if (backFlag == 0)
	     {
                return [x1 - dis * k / Math.sqrt(k * k + 1), y1 + dis / Math.sqrt(k * k + 1), x1 + dis * k / Math.sqrt(k * k + 1), y1 - dis / Math.sqrt(k * k + 1), x2 - dis * k / Math.sqrt(k * k + 1), y2 + dis / Math.sqrt(k * k + 1), x2 + dis * k / Math.sqrt(k * k + 1), y2 - dis / Math.sqrt(k * k + 1)];
            }
            else if (backFlag == 1)
	     {
                return [x1 - dis * k / Math.sqrt(k * k + 1), y1 + dis / Math.sqrt(k * k + 1), x1 + dis * k / Math.sqrt(k * k + 1), y1 - dis / Math.sqrt(k * k + 1)];
            }
            else
	     {
                return [x2 - dis * k / Math.sqrt(k * k + 1), y2 + dis / Math.sqrt(k * k + 1), x2 + dis * k / Math.sqrt(k * k + 1), y2 - dis / Math.sqrt(k * k + 1)];
            }
        }
    };
    this.Point = function(x, y)
     {
        this.x = x * 1;
        this.y = y * 1;
    };
    this.Line = function(a, b, c)
     {
        this.a = a;
        this.b = b;
        this.c = c;
    };
}
function IMSVIPPnts()
 {
    thisObj.vo = this;
    this.page = "Maps.ashx";
    this.vipPntInfoArr = [];
    this.div = CreatDiv(document.body, "vipDataDiv", 0, 0, "absolute", 1);
    StopDivBubble("vipDataDiv");
    this.div.style.display = "none";
    this.imgSrc = "images/p1.gif";
    this.activeFun = null;
    this.imgTooltip = "点击跳转到当前点";
    this.imgSize = [16, 18];
    this.setImgSrc = function(src, imgTooltip, onclickFun)
     {
        this.imgSrc = src ? src : "images/p1.gif";
        this.imgTooltip = imgTooltip ? imgTooltip : "点击跳转到当前点";
        this.activeFun = onclickFun;
        this.imgSize = GetImgSize(this.imgSrc);
    };
    this.loadData = function(requestPage)
     {
        var str = "_method=GetVipDate";
        AJAXRequest(requestPage, true, "POST", str, thisObj.vo.CbVipData);
    };
    this.showPnts = function()
     {
        thisObj.vo.div.innerHTML = "";
        var tmpHTML = "";
        for (var j = 0; j < thisObj.vo.vipPntInfoArr.length; ++j)
	 {
            var xy = thisObj.logicToScreen(thisObj.vo.vipPntInfoArr[j].lx, thisObj.vo.vipPntInfoArr[j].ly);
            var wx = xy[0] + "px"; ;
            var wy = xy[1] - thisObj.vo.imgSize[1] + "px";
            var pntTmp = "<div style='z-index:1;position:absolute;visibility:visible;left:" + wx + ";top:" + wy + ";cursor:pointer; '>"
                       + "<table><tr><td><img title='" + thisObj.vo.imgTooltip + "' onclick= 'thisObj.vo.VipClick(" + thisObj.vo.vipPntInfoArr[j].lx + "," + thisObj.vo.vipPntInfoArr[j].ly + ")'  src=" + thisObj.vo.imgSrc + " style='width:" + thisObj.vo.imgSize[0] + "px;height:" + thisObj.vo.imgSize[1] + "px;'>"
                       + "</td><td nowrap=true><strong><font size=" + (thisObj.inf[2] + 1) + " color=red>" + thisObj.vo.vipPntInfoArr[j].name + "</font></strong></td></tr></table></div>";
            tmpHTML += pntTmp;
        }
        thisObj.vo.div.innerHTML = tmpHTML;
        thisObj.vo.div.style.display = "";
    };
    this.hidePnts = function()
     {
        this.div.style.display = "none";
    };
    this.clearPnts = function()
     {
        this.div.innerHTML = "";
        thisObj.removeEventListener("zoom", thisObj.vo.showPnts, false);
    };
    this.CbVipData = function(res)
     {
        if (res == null || res == "")
            return;
        thisObj.vo.vipPntInfoArr = eval(res);
        thisObj.vo.showPnts();
        thisObj.addEventListener("zoom", thisObj.vo.showPnts, false);
    };
    this.VipClick = function(x, y)
     {
        if (typeof (thisObj.vo.activeFun) == 'function')
            thisObj.vo.activeFun();
        else if (thisObj.inf[2] >= thisObj.levelNum - 1)
	 {
            alert("已到最大比例尺");
            return;
        }
        else thisObj.jumpMap(x, y, thisObj.levelNum);
    };
};
function IMSCarMove(color, width) 
{
    this.color = color ? color : "red";
    this.width = width ? width : "2";
    this.HSMoveIndex = 0;
    this.HSperHorizontalMove = 0;
    this.HSperVerticalMove = 0;
    this.HSMoveNum = 0;
    this.HSArrayIndex = 0;
    this.HSCarStartTop = 0;
    this.HSCarStartLeft = 0;
    this.HSMoveFrequency = 50;
    this.HSisShowCurve = true;
    this.HSisShowNode = false;
    this.HSisMapMoveWithCar = true;
    this.traceTimer = 0;
    this.HSLayStartTop = "";
    this.HSLayStartLef = "";
    this.HSInfStartTop = 0;
    this.HSInfStartLef = 0;
    this.HSCarMoveMood = 1;
    window.carmoveflg = 0;
    this.carstopLX = 0;
    this.carstopLY = 0;

    window.MapLayerNum = thisObj.seeLay.length;
    this.HSLogicXArray = new Array();
    this.HSLogicYArray = new Array();
    this.specialNodeInfoArray = new Array();
    this.normalNodeInfoArray = new Array();
    window.traceObj = this;
    window.lineVml = null;

    var busLineDiv = document.getElementById("busLineDiv");
    if (busLineDiv == null) {
        busLineDiv = CreatDiv(thisObj.overLay, "busLineDiv", 0, 0, "absolute", 100);
        busLineDiv.style.display = "block";
        busLineDiv.style.width = thisObj.mapContainer.style.width;
        busLineDiv.style.height = thisObj.mapContainer.style.height;
        busLineDiv.onmousemove = function() { return false; }
        busLineDiv.ondblclick = function() { return false; }
        busLineDiv.onmousedown = function() { return false; }
        busLineDiv.onmouseup = function() { return false; }
    }
    busLineDiv.innerHTML = "";
    var specialNodeDiv = document.getElementById("specialNodeDiv");
    if (specialNodeDiv == null) {
        specialNodeDiv = CreatDiv(thisObj.overLay, "specialNodeDiv", 0, 0, "absolute", 988);
        specialNodeDiv.style.display = "block";
    }
    specialNodeDiv.innerHTML = "";
    var normalNodeDiv = document.getElementById("normalNodeDiv");
    if (normalNodeDiv == null) {
        normalNodeDiv = CreatDiv(thisObj.overLay, "normalNodeDiv", 0, 0, "absolute", 988);
        normalNodeDiv.style.display = "block";
    }
    normalNodeDiv.innerHTML = "";
    function Dot(logicX, logicY) {
        this.x = logicX;
        this.y = logicY;
    };
    this.setLineInfo = function(strPos) {
        this.HSLogicXArray = new Array();
        this.HSLogicYArray = new Array();
        var tmpArray = strPos.split(",");
        for (var i = 0; i < tmpArray.length; i = i + 2) {
            this.HSLogicXArray[i / 2] = tmpArray[i];
            this.HSLogicYArray[i / 2] = tmpArray[i + 1];
        }
    };
    var listenFlag = true;
    this.drawLine = function() {
                if (listenFlag) {
                    thisObj.addEventListener("zoom", this.RePainting, false);
                    listenFlag = false;
                }
        if (busLineDiv !== null)
            busLineDiv.style.display = "block";
        HSXarray = new Array();
        HSYarray = new Array();
        var lineDotInfo = new Array();
        if (this.HSLogicXArray.length >= 1) {
            for (var i = 0; i < this.HSLogicXArray.length; i++) {
                var temp = thisObj.logicToScreen(this.HSLogicXArray[i], this.HSLogicYArray[i]);
                HSXarray[i] = temp[0];
                HSYarray[i] = temp[1];
                lineDotInfo.push(HSXarray[i] + "," + HSYarray[i]);
            }
            lineVml = new IMSPalette(busLineDiv, "polyline");
            lineVml.setStyle(traceObj.color, traceObj.width);
            lineVml.draw(lineDotInfo);
            //放大缩小后路到起点。
//            if (this.specialNodeInfoArray.length <= 0)
//                thisObj.pntLocation(this.HSLogicXArray[0], this.HSLogicYArray[0]);
//            else
//                thisObj.pntLocation(this.specialNodeInfoArray[0].x, this.specialNodeInfoArray[0].y);

        }
    };
    this.pntLocation = function() {
        if (this.specialNodeInfoArray.length <= 0) {
            if (this.HSLogicXArray.length <= 0)
                return;
            thisObj.pntLocation(this.HSLogicXArray[0], this.HSLogicYArray[0]);
        } else {
            if (this.specialNodeInfoArray.length <= 0)
                return;
            thisObj.pntLocation(this.specialNodeInfoArray[0].x, this.specialNodeInfoArray[0].y);
        }
    }
    function ShowCarMove1()
     {
        if (!document.getElementById("HSCar"))
	 {
            window.HSCar = document.createElement("DIV");
            window.HSCar.id = "HSCar";
            window.HSCar.style.position = "absolute";
            window.HSCar.style.left = "0px";
            window.HSCar.style.top = "0px";
            window.HSCar.style.zIndex = "1000";
            thisObj.addControl(window.HSCar, true);
        }
        var tmpNodeX = parseInt(HSXarray[0] * 1 - 13);
        var tmpNodeY = parseInt(HSYarray[0] * 1 - 13);
        window.HSCar = document.getElementById("HSCar");
        window.HSCar.innerHTML = "<IMG id='IMG_HSCar' style='Z-INDEX: 1000; LEFT: " + tmpNodeX + "px; WIDTH: 26px; POSITION: absolute; TOP: " + tmpNodeY + "px; HEIGHT: 20px' src='images/car.gif'>";
        var MoveDistance = Math.sqrt(Math.pow((HSXarray[0] - HSXarray[1]), 2) + Math.pow((HSYarray[0] - HSYarray[1]), 2));
        HSMoveNum = MoveDistance / 5;
        var tmpMoveNum = Math.round(HSMoveNum);
        HSMoveNum = HSMoveNum > tmpMoveNum ? tmpMoveNum + 1 : tmpMoveNum;
        HSperHorizontalMove = 5 * (HSXarray[1] - HSXarray[0]) / MoveDistance;
        HSperVerticalMove = 5 * (HSYarray[1] - HSYarray[0]) / MoveDistance;
        HSArrayIndex = 0;
        window.HSCarStartLeft = 0;
        window.HSCarStartTop = 0;
        window.HSMoveIndex = 0;
        window.IMG_HSCar = document.getElementById("IMG_HSCar");
        traceTimer = window.setInterval('window.ShowCarMove11()', 50);
        window.HSCar.style.visibility = "visible";
    };

    window.ShowCarMove11 = function() 
    {
        if (HSMoveIndex < (HSMoveNum * 1 - 1))
	 {
            var HorizontalMove = (HSMoveIndex * 1 + 1) * HSperHorizontalMove;
            var VerticalMove = (HSMoveIndex * 1 + 1) * HSperVerticalMove;
            window.HSCar = document.getElementById("HSCar");
            window.HSCar.style.left = parseInt(HorizontalMove) + HSCarStartLeft + "px";
            window.HSCar.style.top = parseInt(VerticalMove) + HSCarStartTop + "px";
            ShowMapMoveWithCar();
            HSMoveIndex++;
        }
        else {
            window.HSCar = document.getElementById("HSCar");
            window.HSCar.style.left = HSXarray[HSArrayIndex * 1 + 1] * 1 - HSXarray[HSArrayIndex * 1] * 1 + HSCarStartLeft + "px";
            window.HSCar.style.top = HSYarray[HSArrayIndex * 1 + 1] * 1 - HSYarray[HSArrayIndex * 1] * 1 + HSCarStartTop + "px";
            window.HSCarStartTop = parseInt(window.HSCar.style.top);
            window.HSCarStartLeft = parseInt(window.HSCar.style.left);
            if ((window.HSArrayIndex * 1 + 1) == (HSXarray.length - 1)) 
	    {
                window.carmoveflg = 0;
            }
            ShowMapMoveWithCar();

            HSArrayIndex++;
            if (HSArrayIndex == (HSXarray.length - 1))
	     {
                window.carmoveflg = 0;
                ClearCar();
                clearInterval(traceTimer);
                window.HSCar.style.left = "0px";
                window.HSCar.style.top = "0px";
                thisObj.isCarMove = false;
                thisObj.isMapMove = false;
            }
            else 
	    {
                var MoveDistance = Math.sqrt(Math.pow((HSXarray[HSArrayIndex] - HSXarray[HSArrayIndex + 1]), 2) + Math.pow((HSYarray[HSArrayIndex] - HSYarray[HSArrayIndex + 1]), 2));
                HSMoveNum = MoveDistance / 5;
                var tmpMoveNum = Math.round(HSMoveNum);
                HSMoveNum = HSMoveNum > tmpMoveNum ? tmpMoveNum + 1 : tmpMoveNum;
                HSperHorizontalMove = 5 * (HSXarray[HSArrayIndex + 1] - HSXarray[HSArrayIndex]) / MoveDistance;
                HSperVerticalMove = 5 * (HSYarray[HSArrayIndex + 1] - HSYarray[HSArrayIndex]) / MoveDistance;
                HSMoveIndex = 0;
            }
        }
    };

    function ShowCarMove2() 
    {
        if (!document.getElementById("HSCar"))
	 {
            window.HSCar = document.createElement("DIV");
            window.HSCar.id = "HSCar";
            window.HSCar.style.position = "absolute";
            window.HSCar.style.left = parseInt(thisObj.getMapViewSize()[0]) / 2 - 13 + "px";
            window.HSCar.style.top = parseInt(thisObj.getMapViewSize()[1]) / 2 - 13 + "px";
            window.HSCar.style.zIndex = "1000";
            thisObj.pObj.appendChild(window.HSCar);
            window.HSCar.style.visibility = "visible";
        }
        window.HSCar.style.left = parseInt(thisObj.getMapViewSize()[0]) / 2 - 13 + "px";
        window.HSCar.style.top = parseInt(thisObj.getMapViewSize()[1]) / 2 - 13 + "px";
        window.HSCar.innerHTML = "<IMG id='IMG_HSCar' style='Z-INDEX: 1000; LEFT: 0px; WIDTH: 26px; POSITION: absolute; TOP: 0px; HEIGHT: 20px' src='images/car.gif'>";
        window.HSCar = document.getElementById("HSCar");
        window.HSCar.style.visibility = "visible";
        var MoveDistance = Math.sqrt(Math.pow((HSXarray[0] - HSXarray[1]), 2) + Math.pow((HSYarray[0] - HSYarray[1]), 2));
        HSMoveNum = MoveDistance / 5;
        var tmpMoveNum = Math.round(HSMoveNum);
        HSMoveNum = HSMoveNum > tmpMoveNum ? tmpMoveNum + 1 : tmpMoveNum;
        if (MoveDistance != 0) {
            HSperHorizontalMove = 5 * (HSXarray[1] - HSXarray[0]) / MoveDistance;
            HSperVerticalMove = 5 * (HSYarray[1] - HSYarray[0]) / MoveDistance;
        } else {
            HSperHorizontalMove = 0;
            HSperVerticalMove = 0;
        }
        window.HSArrayIndex = 0;
        window.HSMoveIndex = 0;
        window.IMG_HSCar = document.getElementById("IMG_HSCar");
        traceTimer = window.setInterval('window.ShowCarMove22()', 50);
    }
    window.ShowCarMove22 = function()
     {
        if (HSMoveIndex < (HSMoveNum * 1 - 1))
	 {
            var HorizontalMove = (HSMoveIndex * 1 + 1) * HSperHorizontalMove;
            var VerticalMove = (HSMoveIndex * 1 + 1) * HSperVerticalMove;
            thisObj.mapContainer.style.left = parseInt(thisObj.mapContainer.style.left) - parseInt(HSperHorizontalMove) + "px";
            thisObj.mapContainer.style.top = parseInt(thisObj.mapContainer.style.top) - HSperVerticalMove + "px";
            thisObj.overLay.style.left = parseInt(thisObj.overLay.style.left) - HSperHorizontalMove + "px";
            thisObj.overLay.style.top = parseInt(thisObj.overLay.style.top) - HSperVerticalMove + "px";
            thisObj.TableInsert();
            HSMoveIndex++;
        }
        else 
	{
            thisObj.mapContainer.style.left = parseInt(thisObj.mapContainer.style.left) - (HSXarray[window.HSArrayIndex * 1 + 1] * 1 - HSXarray[window.HSArrayIndex * 1] * 1) + "px";
            thisObj.mapContainer.style.top = parseInt(thisObj.mapContainer.style.top) - (HSYarray[window.HSArrayIndex * 1 + 1] * 1 - HSYarray[window.HSArrayIndex * 1] * 1) + "px";
            thisObj.overLay.style.left = parseInt(thisObj.overLay.style.left) - (HSXarray[window.HSArrayIndex * 1 + 1] * 1 - HSXarray[window.HSArrayIndex * 1] * 1) + "px";
            thisObj.overLay.style.top = parseInt(thisObj.overLay.style.top) - (HSYarray[window.HSArrayIndex * 1 + 1] * 1 - HSYarray[window.HSArrayIndex * 1] * 1) + "px";
            thisObj.TableInsert();
            window.HSArrayIndex++;
            if (window.HSArrayIndex == (HSXarray.length - 1))
	     {
                window.carmoveflg = 0;
                ClearCar();
                clearInterval(traceTimer);
                thisObj.isCarMove = false;
                thisObj.isMapMove = false;
            }
            else
	     {
                var MoveDistance = Math.sqrt(Math.pow((HSXarray[HSArrayIndex] - HSXarray[HSArrayIndex + 1]), 2) + Math.pow((HSYarray[HSArrayIndex] - HSYarray[HSArrayIndex + 1]), 2));
                HSMoveNum = MoveDistance / 5;
                var tmpMoveNum = Math.round(HSMoveNum);
                HSMoveNum = HSMoveNum > tmpMoveNum ? tmpMoveNum + 1 : tmpMoveNum;
                if (MoveDistance != 0) {
                    HSperHorizontalMove = 5 * (HSXarray[1] - HSXarray[0]) / MoveDistance;
                    HSperVerticalMove = 5 * (HSYarray[1] - HSYarray[0]) / MoveDistance;
                } else {
                    HSperHorizontalMove = 0;
                    HSperVerticalMove = 0;
                }
                HSMoveIndex = 0;
            }
        }
    };


    function ShowMapMoveWithCar()
     {
        if ((parseInt(window.IMG_HSCar.style.left) + parseInt(window.HSCar.style.left) + parseInt(thisObj.overLay.style.left)) < 0) {
            thisObj.mapContainer.style.left = parseInt(thisObj.mapContainer.style.left) + 200 + "px";
            thisObj.overLay.style.left = parseInt(thisObj.overLay.style.left) + 200 + "px";
        }
        else if ((parseInt(window.IMG_HSCar.style.left) + parseInt(window.HSCar.style.left) + parseInt(thisObj.overLay.style.left)) > parseInt(thisObj.pObj.clientWidth)) 
	{
            thisObj.mapContainer.style.left = parseInt(thisObj.mapContainer.style.left) - 200 + "px";
            thisObj.overLay.style.left = parseInt(thisObj.overLay.style.left) - 200 + "px";
        }
        if ((parseInt(window.IMG_HSCar.style.top) + parseInt(window.HSCar.style.top) + parseInt(thisObj.overLay.style.top)) < 0)
	 {

            thisObj.mapContainer.style.top = parseInt(thisObj.mapContainer.style.top) + 200 + "px";
            thisObj.overLay.style.top = parseInt(thisObj.overLay.style.top) + 200 + "px";
        }
        else if ((parseInt(window.IMG_HSCar.style.top) + parseInt(window.HSCar.style.top) + parseInt(thisObj.overLay.style.top)) > parseInt(thisObj.pObj.clientHeight)) 
	{

            thisObj.mapContainer.style.top = parseInt(thisObj.mapContainer.style.top) - 200 + "px";
            thisObj.overLay.style.top = parseInt(thisObj.overLay.style.top) - 200 + "px";
        }
        thisObj.TableInsert();
    };
    this.move = function(carMoveMode)
     {
        thisObj.isCarMove = true;
        thisObj.isMapMove = true;
        if (window.carmoveflg == 0)
	 {
            if (carMoveMode == 1)
                ShowCarMove1();
            if (carMoveMode == 2) {
                ShowCarMove2();
                if (this.specialNodeInfoArray.length <= 0)
                    thisObj.pntLocation(this.HSLogicXArray[0], this.HSLogicYArray[0]);
                else
                    thisObj.pntLocation(this.specialNodeInfoArray[0].x, this.specialNodeInfoArray[0].y);
            }
        }
        if (window.carmoveflg == 2)
	 {
            if (carMoveMode == 1) 
	    {
                var pX = thisObj.logicXlength / window.RowWidth;
                var nowX = Math.round((carstopLX - thisObj.XMinMap) / pX);
                var nowY = Math.round((thisObj.YMaxMap - carstopLY) / pX);
                var MoveDistance = Math.sqrt(Math.pow((nowX - HSXarray[HSArrayIndex + 1]), 2) + Math.pow((nowY - HSYarray[HSArrayIndex + 1]), 2));
                HSMoveNum = MoveDistance / 5;
                var tmpMoveNum = Math.round(HSMoveNum);
                HSMoveNum = HSMoveNum > tmpMoveNum ? tmpMoveNum + 1 : tmpMoveNum;
                HSperHorizontalMove = 5 * (HSXarray[HSArrayIndex * 1 + 1] - nowX) / MoveDistance;
                HSperVerticalMove = 5 * (HSYarray[HSArrayIndex * 1 + 1] - nowY) / MoveDistance;
                HSMoveIndex = 0;
                traceTimer = window.setInterval('window.ShowCarMove11()', 50);
            }
            if (carMoveMode == 2)
	     {
                traceTimer = window.setInterval('window.ShowCarMove22()', 50);
            }
        }
        window.carmoveflg = 1;

    };
    this.pause = function()
     {
        window.carmoveflg = 2;
        thisObj.isCarMove = true;
        thisObj.isMapMove = true;

        var wx = parseInt(document.getElementById("IMG_HSCar").style.left) + parseInt(thisObj.mapContainer.style.left) + parseInt(document.getElementById("HSCar").style.left) + 13;
        var wy = parseInt(document.getElementById("IMG_HSCar").style.top) + parseInt(thisObj.mapContainer.style.top) + parseInt(document.getElementById("HSCar").style.top) + 13;
        var tmparr = thisObj.screenToLogic(wx, wy);
        carstopLX = tmparr[0];
        carstopLY = tmparr[1];
        clearInterval(traceTimer);
    };
    this.stop = function()
     {
        window.carmoveflg = 0;
        clearInterval(traceTimer);
        window.HSCar.style.left = "0px";
        window.HSCar.style.top = "0px";
        thisObj.isCarMove = false;
        thisObj.isMapMove = false;
        ClearCar();
    };
    window.ClearCar = function()
     {
        if (document.getElementById("HSCar"))
	 {
            window.HSCar = document.getElementById("HSCar");
            window.HSCar.style.visibility = "hidden";
            if (window.HSCarMoveMood == 1)
	     {
                window.HSCar.style.left = 0;
                window.HSCar.style.top = 0;
                window.HSCar.innerHTML = "";
            }
        }
    };
    this.clearVar = function() 
    {
        if (typeof (traceTimer) != 'undefined' && traceTimer != null)
            clearInterval(traceTimer);
        if (!listenFlag) {
            thisObj.removeEventListener("zoom", this.RePainting, false);
            listenFlag = true;
        }
        thisObj.isCarMove = false;
        thisObj.isMapMove = false;
        lineVml.dispose();
        if (document.getElementById("busLineDiv")) 
	{
            var busLineDiv = document.getElementById("busLineDiv");
            busLineDiv.innerHTML = "";
            busLineDiv.style.display = "none";
        }
        if (document.getElementById("HSCar"))
	 {
            window.HSCar = document.getElementById("HSCar");
            window.HSCar.style.visibility = "hidden";
            if (window.HSCarMoveMood == 1)
	     {
                window.HSCar.style.left = "0px";
                window.HSCar.style.top = "0px";
                window.HSCar.innerHTML = "";
            }
        }
        if (document.getElementById("specialNodeDiv"))
	 {
            var specialNodeDiv = document.getElementById("specialNodeDiv");
            specialNodeDiv.style.display = "none";
        }
        if (document.getElementById("normalNodeDiv"))
	 {
            var normalNodeDiv = document.getElementById("normalNodeDiv");
            normalNodeDiv.style.display = "none";
        }

    };
          function TwoPntDistance(x1, y1, x2, y2, unit)
     {
        var xD = Math.abs(x1 - x2);
        var yD = Math.abs(y1 - y2);
        var dist = (Math.sqrt(Math.pow(xD, 2) + Math.pow(yD, 2))) * unit; //103133.845;
        return dist;
    };
    this.CreateSpecialNodes = function()
     {
        if (this.specialNodeInfoArray.length > 1)
	 {
            var tmpInnerHTML = '';

            for (var i = 0; i < this.specialNodeInfoArray.length; i++)
	     {
                var temp = thisObj.logicToScreen(this.specialNodeInfoArray[i].x, this.specialNodeInfoArray[i].y);
                var left = parseInt(temp[0]) + "px";
                var top = parseInt(temp[1]) + "px";
                var divHTML = '<div id="' + this.specialNodeInfoArray[i].seq + '-HSNode"' + 'style="position:absolute;left:' + left + '; top:' + top + '">';
                divHTML += '<table bgcolor=#030FF9 style="FILTER:progid:DXImageTransform.Microsoft.BasicImage( Rotation=0,Mirror=0,Invert=0,XRay=0,Grayscale=0,Opacity=1);FONT: bold 9pt/1.3 verdana;Z-index:998; BACKGROUND-COLOR:#228B22" cellspacing="1" cellpadding="1" border="0"><td style="height: 18px;"><font color=#ffffff>' + this.specialNodeInfoArray[i].name + '</font></td></table>';
                switch (this.specialNodeInfoArray[i].type) 
		         {
                    case 0:
                        divHTML += '<div style="position:absolute; display:block; left:0px; top:-26px"><img src="images/qi.gif"/></div>';
                        break;
                    case 1:
                        divHTML += '<div style="position:absolute; display:block; left:0px; top:-26px"><img src="images/cheng.gif"/></div>';
                        break;
                    case 3:
                        divHTML += '<div style="position:absolute; display:block; left:0px; top:-26px"><img src="images/zou.gif"/></div>';
                        break;
                    case 4:
                        divHTML += '<div style="position:absolute; display:block; left:0px; top:-26px"><img src="images/huan.gif"/></div>';
                        break;
                    case 5:
                        divHTML += '<div style="position:absolute; display:block; left:0px; top:-26px"><img src="images/zhong.gif"/></div>';
                        break;
                    default:
                        break;
                }
                tmpInnerHTML += divHTML + '</div>';
            }
            document.getElementById("specialNodeDiv").innerHTML = tmpInnerHTML;
            
        }
        else
            return;
    };
    //=========csh
    this.ZoomToScreen = function()
    {
        var calculateDotCout=0;
        var calculateXarray = new Array();
        var calculateYarray = new Array();
        var xMinMap=0,yMinMap=0,xMaxMap=0,yMaxMap=0; 
        for (var i = 0; i < this.specialNodeInfoArray.length; i++)
        {

           calculateXarray[i]=this.specialNodeInfoArray[i].x;
           calculateYarray[i]=this.specialNodeInfoArray[i].y;  
           calculateDotCout++;     
        } 
        var tmpDistanceResult=0,calculateResult=0;
        calculateDotCout=calculateXarray.length-1;
        for(var l=0;l<calculateDotCout;l++)
        {
            if (l<1)
             {
                tmpDistanceResult = TwoPntDistance(calculateXarray[0], calculateYarray[0], calculateXarray[1], calculateYarray[1], 1);
                calculateResult=tmpDistanceResult;
             }
            else                        
            { 
               tmpDistanceResult =  TwoPntDistance(calculateXarray[l], calculateYarray[l], calculateXarray[l+1], calculateYarray[l+1], 1); 
               calculateResult=calculateResult+tmpDistanceResult;
            }  
        }
        xMinMap=calculateXarray[0];
        yMinMap=calculateYarray[0];
        xMaxMap=calculateXarray[0];
        yMaxMap=calculateYarray[0];
        for(var n=0;n<=calculateDotCout;n++)
        {
             if(xMinMap>calculateXarray[n])
            {
               xMinMap=calculateXarray[n];
            }
            if(xMaxMap<calculateXarray[n])
            {
               xMaxMap=calculateXarray[n];
            }               
        }
        for(var n=0;n<=calculateDotCout;n++)
        {
             if(yMinMap>calculateYarray[n])
            {
               yMinMap=calculateYarray[n];
            }
            if(yMaxMap<calculateYarray[n])
            {
               yMaxMap=calculateYarray[n];
            }               
        }
        if(calculateResult<100)
        {
            thisObj.jumpMap1(xMinMap,yMinMap,xMaxMap,yMaxMap,8);
        }
        else if(calculateResult>100&&calculateResult<=300)
        {
            thisObj.jumpMap1(xMinMap,yMinMap,xMaxMap,yMaxMap,8);
        }
        else if(calculateResult>300&&calculateResult<=500)
        {
            thisObj.jumpMap1(xMinMap,yMinMap,xMaxMap,yMaxMap,8);
        }
        else if(calculateResult>500&&calculateResult<=1500)
        {
            thisObj.jumpMap1(xMinMap,yMinMap,xMaxMap,yMaxMap,7);
        }
        else if(calculateResult>1500&&calculateResult<=3000)
        {
           thisObj.jumpMap1(xMinMap,yMinMap,xMaxMap,yMaxMap,6);
        }
        else if(calculateResult>3000&&calculateResult<=5000)
        {
            thisObj.jumpMap1(xMinMap,yMinMap,xMaxMap,yMaxMap,5);
        }
         else if(calculateResult>5000&&calculateResult<=10000)
        {
            thisObj.jumpMap1(xMinMap,yMinMap,xMaxMap,yMaxMap,4);
        }
        else
        {
            thisObj.jumpMap1(xMinMap,yMinMap,xMaxMap,yMaxMap,2);
        }             
        return;  
    }; 
    //==================end
    this.openSpecialNodeDiv = function()
     {
        if (document.getElementById("specialNodeDiv")) 
	{
            this.CreateSpecialNodes();
        }
        var specialNodeDiv = document.getElementById("specialNodeDiv");
        specialNodeDiv.style.display = "block";
    };
    this.closeSpecialNodeDiv = function()
     {
        if (document.getElementById("specialNodeDiv")) 
	{
            var specialNodeDiv = document.getElementById("specialNodeDiv");
            specialNodeDiv.style.display = "none";
        }
    };
    this.CreateNormalNodes = function()
     {
        if (this.normalNodeInfoArray.length > 1) 
	{
            var tmpInnerHTML = '';
            for (var i = 0; i < this.normalNodeInfoArray.length; i++)
	     {
                var temp = thisObj.logicToScreen(this.normalNodeInfoArray[i].x, this.normalNodeInfoArray[i].y);
                var left = parseInt(temp[0]) + "px";
                var top = parseInt(temp[1]) + "px";
                var divHTML = '<div id="' + this.normalNodeInfoArray[i].seq + '-HSNode"' + 'style="position:absolute;left:' + left + '; top:' + top + '">';
                divHTML += '<table bgcolor=#030FF9 style="FILTER:progid:DXImageTransform.Microsoft.BasicImage( Rotation=0,Mirror=0,Invert=0,XRay=0,Grayscale=0,Opacity=1);FONT: bold 9pt/1.3 verdana;Z-index:998; BACKGROUND-COLOR:#228B22" cellspacing="1" cellpadding="1" border="0"><td style="height: 18px;"><font color=#ffffff>' + this.normalNodeInfoArray[i].name + '</font></td></table>';

                tmpInnerHTML += divHTML + '</div>';
            }
            document.getElementById("normalNodeDiv").innerHTML = tmpInnerHTML;
        }
        else
            return;
    };
    this.openNormalNodeDiv = function()
     {
        if (showNormalNodeFlag)
	 {
            if (document.getElementById("normalNodeDiv"))
	     {
                this.CreateNormalNodes();
            }
            var normalNodeDiv = document.getElementById("normalNodeDiv");
            normalNodeDiv.style.display = "block";
        }
    };
    this.closeNormalNodeDiv = function()
     {
        if (document.getElementById("normalNodeDiv"))
	 {
            var normalNodeDiv = document.getElementById("normalNodeDiv");
            normalNodeDiv.style.display = "none";
        }
    };

    var carObj = this;
    this.RePainting = function()
     {
        if (curLine == -1)
            return;
        carObj.clearVar();
        carObj.openSpecialNodeDiv();
        carObj.openNormalNodeDiv();
        carObj.drawLine();
//        car[0].ZoomToScreen();
    };
};
function RtMenu(parentObj, iconList, menuName, commandList, menuId, iHeight, iWidth)
 {
    this.iconList = iconList;
    this.menuName = menuName;
    this.commandList = commandList;
    this.isIE = navigator.appName.indexOf("Microsoft Internet Explorer") != -1 ? 1 : 0;
    var booldata = "true";
    var height = iHeight ? iHeight + "px" : "40px";
    var width = iWidth ? iWidth + "px" : "100px";
    var menuId = menuId ? menuId : "menuTable";
    var menuDiv = document.getElementById("menuDiv");
    if (menuDiv == null) {
        menuDiv = document.createElement("DIV");
        menuDiv.id = "menuDiv";
        menuDiv.style.position = "absolute";
        menuDiv.style.zIndex = "1000";
        menuDiv.style.display = "";
        menuDiv.style.left = "0px";
        menuDiv.style.top = "0px";
        menuDiv.oncontextmenu = function(e) { StopDefault(e) };
        document.body.appendChild(menuDiv);
    }
    var tab = document.getElementById(menuId);
    if (tab == null) {
        tab = document.createElement("TABLE");
        tab.id = menuId;
        tab.cellPadding = 0;
        tab.cellSpacing = 0;
        tab.border = 0;
        tab.style.width = width;
        tab.style.height = height;
        tab.bgColor = "#f4f4f4";
        tab.style.display = "none";
        tab.style.zIndex = 200;
        tab.style.position = "absolute";
        tab.style.border = "#999999  1px  solid";
        tab.oncontextmenu = function(e) { StopDefault(e) };
        menuDiv.appendChild(tab);
        ZDEvent.addListener(parentObj, "contextmenu", sMenu, false);
    };
    menuDiv = null;
    tab = null;
    this.AddButton = function(strName, strIcon, strCommand, tableId, num) {
        var childId = tableId + "0" + num;
        var isChild = typeof (strCommand) == "object";
        var tempTable = document.getElementById(tableId);
        var newTR = tempTable.insertRow(tempTable.rows.length);
        newTR.style.padding = "1px";
        newTR.onclick = function() {
            if (!isChild) {
                if (document.getElementById(tableId) != null)
                    document.getElementById(tableId).style.display = "none";
                eval(strCommand);
                document.getElementById("menuDiv").style.display = "none";
            } else {
                document.body.onclick = null;
                return false;
            }
        };
        newTR.onmouseover = function(Evnt) {
            newTR.style.backgroundColor = "#1a71e6";
            newTR.style.color = "#ffffff";
            newTR.style.cursor = "pointer";
            if (isChild) {
                var offsetT = newTR.offsetTop;
                var pareId = tableId;
                if (document.getElementById(childId) == null) {
                    var tempName = new Array();
                    var tempIcon = new Array();
                    var tempComman = new Array();
                    tempName = strCommand[0];
                    tempIcon = strCommand[1];
                    tempComman = strCommand[2];
                    addChildMenu(parentObj, tempName, tempIcon, tempComman, childId, pareId);
                    showChild(Evnt, childId, pareId, offsetT);
                } else
                    showChild(Evnt, childId, pareId, offsetT);

            }

        };
        newTR.onmouseout = function()
	 {
            newTR.style.backgroundColor = "";
            newTR.style.color = "#000000";
            var child = document.getElementById(childId);
            if (child != null) {
                document.getElementById(childId).style.display = "none";
            }
        };
        var newTD = newTR.insertCell(0);
        newTD.style.width = "20%";
        newTD.style.paddingLeft = "3px";
        newTD.innerHTML = "<img src=" + strIcon + " >";
        newTD = newTR.insertCell(1);
        newTD.style.paddingLeft = "2px";
        newTD.style.width = "80%";
        newTD.style.fontSize = "12px";
        var name = strName;
        newTD.innerHTML = "<div  width='95%'>" + name + "</div>";
        newTD = newTR.insertCell(2);
        newTD.innerHTML = isChild ? "＞" : " ";
        tempTable = null;
    };
    this.AddSeparator = function(tableId)
     {
        if (booldata == "true")
            this.menuName.push("hr");
        else 
	{
            var tempTable = document.getElementById(tableId);
            var newTR = tempTable.insertRow(tempTable.rows.length);
            var newTD = newTR.insertCell(0);
            newTD.colSpan = 2;
            newTD.innerHTML = '<hr class="menuhr" size="1" width="95%" style="BORDER-BOTTOM: #dcdcdc 1px inset; BORDER-LEFT: #dcdcdc 1px inset; BORDER-RIGHT: #dcdcdc 1px inset; BORDER-TOP: #dcdcdc 1px inset">';
        }
    };

    this.showMenu = function(tableId)
     {
        this.createMenu(tableId);
    }
    this.hiddenMenu = function()
     {
        document.getElementById("menuDiv").style.display = "none";
    }
    this.createMenu = function(tableId)
     {
        var menuId = tableId ? tableId : "menuTable";
        for (var i = 0; i < this.menuName.length; i++)
	 {
            booldata = "false";
            if (this.menuName[i] == "hr")
	     {
                this.AddSeparator(menuId);
            }
            else 
	    {
                this.AddButton(this.menuName[i], this.iconList[i], this.commandList[i], menuId, i);
            }
            booldata = "true";
        }
    };
};
function addChildMenu(parentObj, tempName, tempIcon, tempComman, childId) {
    var childMeu = new RtMenu(parentObj, tempIcon, tempName, tempComman, childId);
    childMeu.showMenu(childId);
    document.getElementById(childId).onmouseover = function() {
        document.getElementById(childId).style.display = "";
    }
    document.getElementById(childId).onmouseout = function() {
        document.getElementById(childId).style.display = "none";
    }
};
function showChild(Evnt, childId, pareId, offsetT)
 {
    var childTable = document.getElementById(childId);
    var pareMenu = document.getElementById(pareId);
    childTable.style.left = parseInt(pareMenu.style.left) + pareMenu.offsetWidth - 5 + "px";
    childTable.style.top = parseInt(pareMenu.style.top) + offsetT + 2 + "px";
    childTable.style.display = "";
    return false;
};
function sMenu(Evnt, menuId) 
{
    var e = Evnt ? Evnt : event;

    StopDefault(e);
    var tableId = menuId ? menuId : "menuTable";

    var tempTable = document.getElementById(tableId);
    tempTable.style.display = "";
    document.getElementById("menuDiv").style.display = "";
    var rightedge = document.body.clientWidth - e.clientX;
    var bottomedge = document.body.clientHeight - e.clientY;
    if (rightedge < tempTable.offsetWidth)
        tempTable.style.left = document.body.scrollLeft + e.clientX - tempTable.offsetWidth + "px";
    else
        tempTable.style.left = document.body.scrollLeft + e.clientX + "px";
    if (bottomedge < tempTable.offsetHeight)
        tempTable.style.top = document.body.scrollTop + e.clientY - tempTable.offsetHeight + "px";
    else
        tempTable.style.top = document.body.scrollTop + e.clientY + "px";

    return false;
};
function AJAXRequest(url, isAjax, method, data, callback, charSet)
 {
    var xmlHttp, result;
    if (window.XMLHttpRequest)
        xmlHttp = new XMLHttpRequest();
    else if (window.ActiveXObject)
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4) {
            if (xmlHttp.status == 200) {

                if (xmlHttp.responseXML != null && xmlHttp.responseXML.xml != null && xmlHttp.responseXML.xml != '')
                    result = xmlHttp.responseXML;
                else
                    result = xmlHttp.responseText;
                if (isAjax && typeof (callback) == 'function')
                    callback(result);

            }
            xmlHttp = null;
        }
    }
    if (url.indexOf("?") > 0)
        url += "&random =" + Math.random();
    else
        url += "?&random =" + Math.random();
    xmlHttp.open(method, url, isAjax);
    xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    var charset = charSet ? charSet : "gb2312";
    xmlHttp.setRequestHeader("CharSet", charset);
    xmlHttp.send(data);
    try {
        if (!isAjax)
	 {
            var res = result || xmlHttp.responseText || xmlHttp.responseXML;
            if (typeof (callback) == 'function')
                callback(res);
            return res;
        }
    }
    catch (e) { };
};

//瓦片选取类:HdfArray:瓦片名字数组
function IMSMapLevelSelect(HdfArray, left) {
    this.currentLevel = 1; //当前显示的级数
    this.div = CreatDiv(document.body, "levelDiv", 0, 0, "absolute", 21, "visible");
    this.div.display = "none";
    this.div.style.left = left;
    this.div.style.top = "3%";
    window.thisLevObj = this;
    this.HdfArr = HdfArray;
    this.LevelCount = HdfArray.length; //总级数

    this.setPos = function(left, top) {
        this.div.style.left = left;
        this.div.style.top = top;
    };

    //设置当前级数并更新瓦片显示
    this.selectLevel = function(levelId) {
        var levelIdCol = levelId.split('_');
        var selLevel = parseInt(levelIdCol[1]);
        this.currentLevel = selLevel;
        document.getElementById(levelId).src = "images/" + selLevel + "-1.png";
        if (this.LevelCount > 0) {
            for (var i = 1; i <= this.LevelCount; i++) {
                if (i != selLevel) {

                    document.getElementById(levelIdCol[0] + "_" + i).src = "images/" + i + ".png";
                }
            }
            //改变瓦片显示
            thisObj.ChangeGridMap(this.HdfArr[this.currentLevel - 1]);
        }

    };
    //设置向前选择
    this.fnLevelPreMove = function() {
        if (this.currentLevel != 1) {
            document.getElementById("MapLevel_" + this.currentLevel).src = "images/" + this.currentLevel + ".png";
            this.currentLevel -= 1;
            document.getElementById("MapLevel_" + this.currentLevel).src = "images/" + this.currentLevel + "-1.png";
            thisObj.ChangeGridMap(this.HdfArr[this.currentLevel - 1]);
        }

    };

    //设置向后选择
    this.fnLevelBackMove = function() {
        if (this.currentLevel != this.LevelCount) {
            document.getElementById("MapLevel_" + this.currentLevel).src = "images/" + this.currentLevel + ".png";
            this.currentLevel += 1;
            document.getElementById("MapLevel_" + this.currentLevel).src = "images/" + this.currentLevel + "-1.png";
            thisObj.ChangeGridMap(this.HdfArr[this.currentLevel - 1]);
        }

    };

    var levDiv = document.createElement("div");
    levDiv.style.cursor = "pointer";

    var imgLevelPre = document.createElement("img")
    imgLevelPre.alt = "前移";
    imgLevelPre.id = "LevelPreMove";
    imgLevelPre.onclick = function() {
        thisLevObj.fnLevelPreMove()
    };
    imgLevelPre.src = "images/left.png";
    levDiv.appendChild(imgLevelPre);

    for (var i = 1; i <= this.LevelCount; i++) {
        var imgLevel = document.createElement("img")
        //        imgLevel.alt=i+"级";
        imgLevel.id = "MapLevel_" + i;
        imgLevel.style.width = 31;
        imgLevel.onclick = function() {
            thisLevObj.selectLevel(this.id)
        };
        if (i == 1)
            imgLevel.src = "images/" + i + "-1.png";
        else
            imgLevel.src = "images/" + i + ".png";
        levDiv.appendChild(imgLevel);
    };
    var imgLevelBack = document.createElement("img")
    imgLevelBack.alt = "后移";
    imgLevelBack.id = "LevelBackMove"
    imgLevelBack.onclick = function() {
        thisLevObj.fnLevelBackMove()
    };
    imgLevelBack.src = "images/right.png";
    levDiv.appendChild(imgLevelBack);
    this.div.appendChild(levDiv);
};
