/*! Module Name : bus_search.js
      version : 1.0
    Developer : daniel Park
    Description
    : 대중교통 라우팅 검색 알고리즘 수행.
*/
BusSearchModule = function(opt, _parent) {
    this.map = opt.map;
    this.$inputStartTxt = $('#' + opt.inputStartTxtId);
    this.$inputEndTxt = $('#' + opt.inputEndTxtId);
    this.$pageNum = $('#' + opt.pageNumId);
    this.$language = $('#' + opt.languageId);
    this.searchName = null;
    this.resultPos = null;
    this.resultName = null;
    this.parentObj = _parent;
};

BusSearchModule.prototype = {
    init : function() {
        $("#pageNum").attr('value', 1);
    },
    search : function(_gubun) {
        var searchTxt = '';

        if (_gubun == BusLocalTextBox.START_TARGET) {
            searchTxt = this.$inputStartTxt.val();
        } else {
            searchTxt = this.$inputEndTxt.val();
        }

        this.searchName = searchTxt;
        this.searchExecute();
    },
    searchExecute : function() {
        var varRq = 'poi';
        var varF = 'json';
        var varLang = this.$language.val();
        var varPage = this.$pageNum.val() + ',' + ViewCount;
        var varParameter = 'f=' + varF + '&rq=' + varRq + '&lang='+
                            varLang + '&page=' + varPage + '&name=' + this.searchName;
        executeAjaxArgument(true, varParameter, this.rtnSearchPoi, this);
    },
    rtnSearchPoi : function(data) {
        var resultCode = 0;
        var address;

        if (!data || !data.Mapot.Response.Poi.Placemark) {
            this.viewResultTotalCount(0);
            this.noData();
            return;
        }

        var totalCnt = data.Mapot.Response.Poi.Page.totalCnt;
        // Total Count view
        this.viewResultTotalCount(totalCnt);

        // Content View <div><ul>
        $("#resultInfo").append("<div id='sch_place' class='sch_map'></div>");
        $("#sch_place")
                .append("<ul id='sch_place_sub' class='pathSearch'></ul");

        // Content Loop <ul><li><dl><a>
        if (data.Mapot.Response.Poi.Placemark.length > 0) {
            var thisObj = this;
            $.each(data.Mapot.Response.Poi.Placemark, function(index, value) {
                if (!value.address) {
                    tempAddress = '-';
                } else {
                    var tempAddress = value.address.substring(value.address.indexOf(",") + 1);

                    if(mapLang=="china_g" || mapLang=="china_b")
                        tempAddress = ReplaceAll(tempAddress, ',', '');
                    else
                        tempAddress = ReplaceAll(tempAddress, ',', ' ');

                    tempAddress = ReplaceAll(tempAddress, 'null', ' ');
                }
                thisObj.viewPoiResultDetail(index, value.name, tempAddress,
                        new SPoint(value.Point.coordinate[0],
                                value.Point.coordinate[1], 'WGS84_Degree'));
            });
        }

        // Page Display
        this.viewPaging($('#pageNum').val(), totalCnt);
    },
    viewPoiResultDetail : function(_idx, _poiName, _poiAddress, _poiPoint) {
        var thisObj = this;
        $link = $("#sch_place_sub");

        $link.append("<div id='sublist_" + _idx + "'>" + "<a>" + _poiName
                + "</a><br>" + "</div>");

        $("#sublist_" + _idx).wrap("<li></li>").append(
                "<span id='searchResult_" + _idx + "'  class='addr'>"
                        + _poiAddress + "</span>");

        $("#sublist_" + _idx).attr('coordX', _poiPoint.x).attr('coordY',
                _poiPoint.y).attr('address', _poiAddress).attr('poiName',
                _poiName);

        $clickInfo = $("#sublist_" + _idx);
        $clickInfo.css('cursor', 'pointer');
        $clickInfo.bind('click', function() {
            thisObj.map.setCenterAndZoom(new SPoint($(this).attr('coordX'), $(
                    this).attr('coordY')), 2);
            thisObj.parentObj.cbPoiSearchResultClick($(this).attr('poiName'),
                    $(this).attr('address'), $(this).attr('coordX'), $(this)
                            .attr('coordY'));

            return false;
        });

        var displayTitle = '';
        if (!_poiName || _poiName == '')
            displayTitle = _poiAddress;
        else
            displayTitle = _poiName;
    },
    viewResultTotalCount : function(_totalCount) {
        this.deletePoiSearchHtml();
        var searchTxt = '';
        var tempTxt = '';

        searchTxt = this.searchName;

        $link = $("#resultInfo");
        $link.append("<div class='sch_title'>" + "<strong>'" + searchTxt + "' "
                + i18NObj.getTextValue('searchResultTitle') + " ("
                + i18NObj.getTextValue('searchResultCountHead') +
                + _totalCount + ' ' + i18NObj.getTextValue('searchResultCount')
                + ")</strong></div>");
    },
    noData : function() {
        $link = $("#resultInfo");
        $link.append("<div class='nonerouteContainer'><ul><li>" + i18NObj.getTextValue('searchNotResult') + "</li></ul></div>");
    },
    deletePoiSearchHtml : function() {
        // Guide창 hide 시키기
    this.parentObj.parentObj.showSearch();
    this.parentObj.parentObj.hideGuide();
    this.parentObj.parentObj.hideResult();

    $("#resultInfo").empty();
    $("#pageNavigation").empty();
},
viewPaging : function(_currentPage, _totalItemCount) {
    var totalPage = Math.ceil(_totalItemCount / ViewCount);
    var currentStep = Math.ceil(_currentPage / ViewPageCount);
    var totalStep = Math.ceil(totalPage / ViewPageCount);

    var prevPageMax = (currentStep - 1) * ViewPageCount;
    var currPageMin = prevPageMax + 1;
    var nextPageMin = (currentStep * ViewPageCount) + 1;
    $link = $("#pageNavigation");
    $link.empty();

    // Prev Action
    if (currentStep > 1) {
        $('<a></a>').attr( {
            'class' : 'arrow_pre',
            'onfocus' : 'this.blur()',
            'href' : 'javascript:goBusSearchResultPage(' + prevPageMax + ')'
        }).append("<img src='/images/index2/n_local_btn_32.gif' border='0' />")
                .appendTo($link);
    }

    // Real Item Display
    for ( var index = 0; index < ViewPageCount
            && currPageMin + index <= totalPage; index++) {
        if (_currentPage == (currPageMin + index)) {
            $('<span></span>').addClass('current').html(currPageMin + index)
                    .appendTo($link).html((currPageMin + index));
        } else {
            $('<a></a>')
                    .attr(
                            {
                                'onfocus' : 'this.blur()',
                                'href' : 'javascript:goBusSearchResultPage(' + (currPageMin + index) + ')'
                            }).html(currPageMin + index).appendTo($link);
        }
    }

    // Next Action.
    if (currentStep < totalStep) {
        $('<a></a>').attr( {
            'class' : 'arrow_next',
            'onfocus' : 'this.blur()',
            'href' : 'javascript:goBusSearchResultPage(' + nextPageMin + ')'
        }).append("<img src='/images/index2/n_local_btn_33.gif' border='0' />")
                .appendTo($link);
    }
}
};

/**
 * 입력 박스 컨트롤 = 자동차 길찾기
 */
BusLocalTextBox = function(obj, _parentObj) {
    this.map = obj.map;
    this.$inputStartTxt = $('#' + obj.inputStartTxtId);
    this.$searchStartBtn = $('#' + obj.searchStartBtnId);
    this.$inputEndTxt = $('#' + obj.inputEndTxtId);
    this.$searchEndBtn = $('#' + obj.searchEndBtnId);
    this.$routeSearchBtn = $('#' + obj.routeBtnId);
    this.$busResetBtn = $('#' + obj.busResetBtnId);

    this.searchModule = new BusSearchModule(obj, this);
    this.statusStart;
    this.statusEnd;
    this.currentSearchPoiStatus;
    this.parentObj = _parentObj;

    this.init();
};

BusLocalTextBox.START_TARGET = "START_POINT";
BusLocalTextBox.END_TARGET = "END_POINT";

BusLocalTextBox.INIT = "INIT";
BusLocalTextBox.INPUTOK = "INPUTOK";
BusLocalTextBox.COMPLETE = "COMPLETE";

BusLocalTextBox.prototype = {
    init : function() {
        this.status = BusLocalTextBox.INIT;
        var thisObject = this;

        this.$inputStartTxt.bind('click', function() {
            thisObject._inputStartClick.call(thisObject);
        });
        this.$inputStartTxt.bind('keydown', function(e) {
            thisObject.textKeyDown.apply(thisObject, new Array(e,
                    BusLocalTextBox.START_TARGET));
        });
        this.$searchStartBtn.bind('click', function() {
            thisObject._searchPoi.apply(thisObject, new Array(
                    thisObject.$inputStartTxt, BusLocalTextBox.START_TARGET));
        });
        this.$inputEndTxt.bind('click', function() {
            thisObject._inputEndClick.call(thisObject);
        });
        this.$inputEndTxt.bind('keydown', function(e) {
            thisObject.textKeyDown.apply(thisObject, new Array(e,
                    BusLocalTextBox.END_TARGET));
        });
        this.$searchEndBtn.bind('click', function() {
            thisObject._searchPoi.apply(thisObject, new Array(
                    thisObject.$inputEndTxt, BusLocalTextBox.END_TARGET));
        });
        this.$routeSearchBtn.bind('click', function(e) {
            thisObject._searchRouteBtnExecute.call(thisObject, e);
        });
        this.$busResetBtn.bind('click', function() {
            thisObject._searchRouteReset.call(thisObject);
        });
    },
    _inputStartClick : function() {
        if (this._isEmpty(this.$inputStartTxt)) {
            this.$inputStartTxt.attr('value', '');
        }
        this.$inputStartTxt.focus();
    },
    _inputEndClick : function() {
        if (this._isEmpty(this.$inputEndTxt)) {
            this.$inputEndTxt.attr('value', '');
        }
        this.$inputEndTxt.focus();
    },
    textKeyDown : function(e, target) {
        if (e.keyCode == 13 || e.keyCode == 9) {
            var $targetPoint = '';

            if (target == BusLocalTextBox.START_TARGET) {
                this.currentSearchPoiStatus = BusLocalTextBox.START_TARGET;
                $targetPoint = this.$inputStartTxt;
            } else {
                this.currentSearchPoiStatus = BusLocalTextBox.END_TARGET;
                $targetPoint = this.$inputEndTxt;
            }
            this._searchPoi($targetPoint);
            e.preventDefault();
        } else {
            if (target == BusLocalTextBox.START_TARGET) {
                this._inputStartClick();
            } else {
                this._inputEndClick();
            }
        }
    },
    _isEmpty : function($objTarget) {
        return $objTarget.val() == ''
                || $objTarget.val() == i18NObj
                        .getTextValue('searchStartInput')
                || $objTarget.val() == i18NObj.getTextValue('searchEndInput');
    },
    _searchPoi : function($target, targetPosition) {
        if (targetPosition != null)
            this.currentSearchPoiStatus = targetPosition;

        if (this._isEmpty($target)) {
            if (this.currentSearchPoiStatus == BusLocalTextBox.START_TARGET)
                alert(i18NObj.getTextValue('searchStartRequire'));
            else
                alert(i18NObj.getTextValue('searchEndRequire'));

            return false;
        }

        if ($target.val().length<2){
            alert(i18NObj.getTextValue('twoWordLengthRequire'));		// 2자 이상 입력 요청.
            return false;
        }

        this._searchPoiInnerExecute();
    },
    _searchPoiInnerExecute : function() {
        var poiSearchValue = '';

        if (this.currentSearchPoiStatus == BusLocalTextBox.START_TARGET)
            poiSearchValue = this.$inputStartTxt.val();
        else
            poiSearchValue = this.$inputEndTxt.val();

        this.searchModule.init();
        this.searchModule.search(this.currentSearchPoiStatus);
    },
    _searchRouteBtnExecute : function(e) {
        if (this._isEmpty(this.$inputStartTxt) || !this.parentObj.startPointCoord) {
            alert(i18NObj.getTextValue('searchStartRequire'));
            return false;
        }

        if (this._isEmpty(this.$inputEndTxt) || !this.parentObj.endPointCoord) {
            alert(i18NObj.getTextValue('searchEndRequire'));
            return false;
        }

        eventOverlap(e);
        e.stopPropagation();
        e.preventDefault();

        this.parentObj.busRoutingExecute();
    },
    searchPagingPoiExecute : function() {
        this.searchModule.searchExecute();
    },
    cbPoiSearchResultClick : function(_paramName, _paramAddress, _paramX,
            _paramY) {
        var inputValue = '';
        if (!_paramName)
            inputValue = _paramAddress;
        else
            inputValue = _paramName;

        this.inputBox(inputValue);
        this.parentObj.cbPoiSearchClick(inputValue, _paramX, _paramY,
                this.currentSearchPoiStatus);
    },
    inputBox : function(_paramValue) {
        if (this.currentSearchPoiStatus == BusLocalTextBox.START_TARGET)
            this.$inputStartTxt.attr('value', _paramValue);
        else
            this.$inputEndTxt.attr('value', _paramValue);
    },
    clearTextBox : function(_id) {
        if (_id == BusLocalTextBox.START_TARGET)
            this.$inputStartTxt.attr('value', '');
        else
            this.$inputEndTxt.attr('value', '');
    },
    clearTextBoxAll : function() {
        this.$inputStartTxt.attr('value', i18NObj
                .getTextValue('searchStartRequire'));
        this.$inputEndTxt.attr('value', i18NObj
                .getTextValue('searchEndRequire'));
    },
    returnStartPointName : function() {
        return this.$inputStartTxt.val();
    },
    returnEndPointName : function() {
        return this.$inputEndTxt.val();
    },
    setStartBoxValue: function(_paramValue){
        this.$inputStartTxt.attr('value', _paramValue);
    },
    setEndBoxValue: function(_paramValue){
        this.$inputEndTxt.attr('value', _paramValue);
    },
    getStartBoxValue: function(){
        return this.$inputStartTxt.val();
    },
    getEndBoxValue: function(){
        return this.$inputEndTxt.val();
    },
    _searchRouteReset : function() {
        this.parentObj.clearAll();
    }
};

BusRouteServiceModule = function(_param) {
    this.map = _param.map;
    this.mapLayerId = _param.mapLayerId;
    this.$mapLayerObject = $('#' + _param.mapLayerId);
    this.RouteStartPlag = _param.startPlag;
    this.RouteEndPlag = _param.endPlag;
    this.currentRoutePlag = null;
    this.TextBoxModule = new BusLocalTextBox( {
        map : this.map,
        inputStartTxtId : _param.inputStartTxtId,
        searchStartBtnId : _param.searchStartBtnId,
        inputEndTxtId : _param.inputEndTxtId,
        searchEndBtnId : _param.searchEndBtnId,
        routeBtnId : _param.routeBtnId,
        pageNumId : _param.pageNumId,
        languageId : _param.languageId,
        busResetBtnId : _param.busResetBtnId
    }, this);
    debugger;
    this.busRoutingSearchModule = new BusRoutingSearchModule(this.map, this);
    this.startPointCursor;
    this.endPointCursor;
    this.startPointPlag;
    this.endPointPlag;

    this.init();
    this.startMark;
    this.endMark;

    this.startPointCoord = null;
    this.endPointCoord = null;
};

BusRouteServiceModule.ADD_POINT_X = 21;
BusRouteServiceModule.ADD_POINT_Y = -36;

BusRouteServiceModule.prototype = {
    init : function() {
        this.startPointCursor = '/images/cursor/point_start.cur';
        this.endPointCursor = '/images/cursor/point_end.cur';
        this.startPointPlag = '/images/index2/n_local_click_start.png';
        this.endPointPlag = '/images/index2/n_local_click_arrive.png';
        var thisSearchModule = this;
        var $mapObject = this.$mapLayerObject;

        this.RouteStartPlag.prevMapClick = function() {
            this.mapSetCursor(thisSearchModule.startPointCursor);
            this.$topDivId.css("cursor", "default");
            thisSearchModule.resetAllInfo();

            thisSearchModule.clearMark(thisSearchModule.startMark,
                    BusRouteSearchControl.Bus_SEARCH_MARK_START_ID);
            thisSearchModule.showGuide();
            thisSearchModule.hideSearch();
            thisSearchModule.hideResult();
            thisSearchModule.busRoutingSearchModule.unloadPolyLine();
        };
        this.RouteEndPlag.prevMapClick = function() {
            this.mapSetCursor(thisSearchModule.endPointCursor);
            this.$topDivId.css("cursor", "default");
            thisSearchModule.resetAllInfo();

            thisSearchModule.clearMark(thisSearchModule.endMark,
                    BusRouteSearchControl.Bus_SEARCH_MARK_END_ID);
            thisSearchModule.showGuide();
            thisSearchModule.hideSearch();
            thisSearchModule.hideResult();
            thisSearchModule.busRoutingSearchModule.unloadPolyLine();
        };
        this.RouteStartPlag.onFix = function(_areaName, _pos) {
            thisSearchModule.onFixStart(_areaName, _pos);
        };
        this.RouteEndPlag.onFix = function(_areaName, _pos) {
            thisSearchModule.onFixEnd(_areaName, _pos);
        };
    },
    initExecute: function(_sX, _sY, _eX, _eY, _sName, _eName){
        this.onFixEnd(null, new SPoint(_eX, _eY, 'WGS84_Degree'));

        this.TextBoxModule.setStartBoxValue(_sName);
        if(_sName != null && !_sX ){
            alert(i18NObj.getTextValue('searchStartRequire'));
            this.TextBoxModule.$searchStartBtn.click();
        }

        this.TextBoxModule.setEndBoxValue(_eName);

        if(_sX!=null && _sY!=null){
            this.onFixStart(null, new SPoint(_sX, _sY, 'WGS84_Degree'));
            this.busRoutingExecute();
        }
    },
    initStartParam: function(_sX, _sY, _sName){
        this.onFixStart(null, new SPoint(_sX, _sY), null, true);
        this.TextBoxModule.setStartBoxValue(_sName);
    },
    initEndParam: function(_eX, _eY, _eName){
        this.onFixEnd(null, new SPoint(_eX, _eY), null, true);
        this.TextBoxModule.setEndBoxValue(_eName);
    },
    unLoadModule : function() {
        this.TextBoxModule = null;

        this.map.clearOverlay(BusRouteSearchControl.Bus_SEARCH_MARK_START_ID);
        this.map.clearOverlay(BusRouteSearchControl.Bus_SEARCH_MARK_END_ID);

        this.RouteStartPlag = null;
        this.RouteEndPlag = null;

        this.busRoutingSearchModule.unLoadModule();
    },
    onFixStart : function(_areaName, _pos, _poiSearchPath, _notAddFlag) {
        if (this.startMark == null) {
            // Image Point 보정하기
            var imagePoint = null;
            if(_notAddFlag!=null){
                imagePoint = new SPoint(0, 0);
            }
            else{
                imagePoint = new SPoint(MapPixelPerPoint(CarRouteServiceModule.ADD_POINT_X),
                                                MapPixelPerPoint(CarRouteServiceModule.ADD_POINT_Y));
            }
            var markPoint = new SPoint(_pos.x, _pos.y);
            markPoint.add(imagePoint.x, imagePoint.y);

            var markSize = new SSize(44, 47);
            this.startMark = new SContent(this.startPointPlag, 'image',
                    markPoint, markSize, true, 'top', false);
//			this.startMark.SMark
//					.setContent("<table border='0' cellspacing='0' cellpadding='0'>"
//							+ "<tr>"
//							+ "<td width='4'><img src='/images/index/popup_left.gif' width='4' height='24'></td>"
//							+ "<td background='/images/index/popup_side.gif'><div align='center'><font color='#FFFFFF' size='-1'>"
//							+ _areaName
//							+ "</font></div></td>"
//							+ "<td width='4'><img src='/images/index/popup_right.gif' width='4' height='24'></td>"
//							+ "</tr>" + "</table>");
            this.map.addOverlay(this.startMark, true, false,
                    BusRouteSearchControl.Bus_SEARCH_MARK_START_ID);
            this.startMark.setDraggable(true, this._startMarkEndDrag, this);
//			this.startMark.SMark.showInfoWin();
        } else {
            var imagePoint;
            // Image Point 보정하기
            if (this.RouteStartPlag.mapEndDragFlag) {
                imagePoint = new SPoint(MapPixelPerPoint(0),
                        MapPixelPerPoint(0));
                this.RouteStartPlag.mapEndDragFlag = false;
            } else {
                imagePoint = new SPoint(MapPixelPerPoint(BusRouteServiceModule.ADD_POINT_X),
                        MapPixelPerPoint(BusRouteServiceModule.ADD_POINT_Y));
            }
            var markPoint = new SPoint(_pos.x, _pos.y);
            markPoint.add(imagePoint.x, imagePoint.y);

            this.startMark.SMark.setPoint(markPoint);
//			this.startMark.SMark
//					.setContent("<table border='0' cellspacing='0' cellpadding='0'>"
//							+ "<tr>"
//							+ "<td width='4'><img src='/images/index/popup_left.gif' width='4' height='24'></td>"
//							+ "<td background='/images/index/popup_side.gif'><div align='center'><font color='#FFFFFF' size='-1'>"
//							+ _areaName
//							+ "</font></div></td>"
//							+ "<td width='4'><img src='/images/index/popup_right.gif' width='4' height='24'></td>"
//							+ "</tr>" + "</table>");
//
//			this.startMark.SMark.showInfoWin();
            this.startMark.SMark.redraw();
        }

        this.cbPlagEndDrag(markPoint.x, markPoint.y, BusLocalTextBox.START_TARGET, _poiSearchPath);
    },
    clearMark : function(_paramObj, _id) {
        if (!_paramObj)
            return;

        this.map.clearOverlay(_id);
        this.clearTextBox(_id);

        if (_id == BusRouteSearchControl.Bus_SEARCH_MARK_START_ID) {
            this.startPointCoord = null;
        } else {
            this.endPointCoord = null;
        }
    },
    clearTextBox : function(_id) {
        if (_id == BusRouteSearchControl.Bus_SEARCH_MARK_START_ID) {
            this.startMark = null;
            this.TextBoxModule.clearTextBox(BusLocalTextBox.START_TARGET);
        } else {
            this.endMark = null;
            this.TextBoxModule.clearTextBox(BusLocalTextBox.END_TARGET);
        }
    },
    onFixEnd : function(_areaName, _pos, _poiSearchPath, _notAddFlag) {
        if (this.endMark == null) {
            // Image Point 보정하기
            var imagePoint = null;
            if(_notAddFlag!=null){
                imagePoint = new SPoint(0, 0);
            }
            else{
                imagePoint = new SPoint(MapPixelPerPoint(CarRouteServiceModule.ADD_POINT_X),
                                                MapPixelPerPoint(CarRouteServiceModule.ADD_POINT_Y));
            }
            var markPoint = new SPoint(_pos.x, _pos.y);
            markPoint.add(imagePoint.x, imagePoint.y);

            var markSize = new SSize(44, 47);
            this.endMark = new SContent(this.endPointPlag, 'image', markPoint,
                    markSize, true, 'top', false);
//			this.endMark.SMark
//					.setContent("<table border='0' cellspacing='0' cellpadding='0'>"
//							+ "<tr>"
//							+ "<td width='4'><img src='/images/index/popup_left.gif' width='4' height='24'></td>"
//							+ "<td background='/images/index/popup_side.gif'><div align='center'><font color='#FFFFFF' size='-1'>"
//							+ _areaName
//							+ "</font></div></td>"
//							+ "<td width='4'><img src='/images/index/popup_right.gif' width='4' height='24'></td>"
//							+ "</tr>" + "</table>");
            this.map.addOverlay(this.endMark, true, false,
                    BusRouteSearchControl.Bus_SEARCH_MARK_END_ID);
//			this.endMark.SMark.showInfoWin();
            this.endMark.setDraggable(true, this._endMarkEndDrag, this);
        } else {
            var imagePoint;

            // Image Point 보정하기
            if (this.RouteEndPlag.mapEndDragFlag) {
                imagePoint = new SPoint(MapPixelPerPoint(0),
                        MapPixelPerPoint(0));
                this.RouteEndPlag.mapEndDragFlag = false;
            } else {
                imagePoint = new SPoint(MapPixelPerPoint(BusRouteServiceModule.ADD_POINT_X),
                        MapPixelPerPoint(BusRouteServiceModule.ADD_POINT_Y));
            }

            var markPoint = new SPoint(_pos.x, _pos.y);
            markPoint.add(imagePoint.x, imagePoint.y);

            this.endMark.SMark.setPoint(markPoint);
//			this.endMark.SMark
//					.setContent("<table border='0' cellspacing='0' cellpadding='0'>"
//							+ "<tr>"
//							+ "<td width='4'><img src='/images/index/popup_left.gif' width='4' height='24'></td>"
//							+ "<td background='/images/index/popup_side.gif'><div align='center'><font color='#FFFFFF' size='-1'>"
//							+ _areaName
//							+ "</font></div></td>"
//							+ "<td width='4'><img src='/images/index/popup_right.gif' width='4' height='24'></td>"
//							+ "</tr>" + "</table>");
//			this.endMark.SMark.showInfoWin();
            this.endMark.SMark.redraw();
        }

        this.cbPlagEndDrag(markPoint.x, markPoint.y, BusLocalTextBox.END_TARGET, _poiSearchPath);
    },
    resetAllInfo : function() {
        this.RouteStartPlag.removeMapClickEvent();
        this.RouteStartPlag.setStyle();
        this.RouteEndPlag.removeMapClickEvent();
        this.RouteEndPlag.setStyle();
    },
    onMapClickActivation : function(info) {
    },
    _getInfoWindowContent : function(_nodeType, info) {
        if (!this._nodeTe) {
            this._nodeTe = TrimPath
                    .parseTemplate(route__node_infowindow_template);
        }
        info.nodeType = _nodeType;
        return this._nodeTe.process(info);
    },
    _startMarkEndDrag : function(e) {
        this.RouteStartPlag.mapEndDragFlag = true;
        this.RouteStartPlag.mapClickEvent(null, e);
    },
    _endMarkEndDrag : function(e) {
        this.RouteEndPlag.mapEndDragFlag = true;
        this.RouteEndPlag.mapClickEvent(null, e);
    },
    searchPagingPoiExecute : function() {
        this.TextBoxModule.searchPagingPoiExecute();
    },
    cbPoiSearchClick : function(_paramValue, _paramX, _paramY, _paramFlag) {
        if (_paramFlag == BusLocalTextBox.START_TARGET) {
            this.RouteStartPlag.mapEndDragFlag = true;
            this.onFixStart(_paramValue, new SPoint(Math.floor(_paramX), Math
                    .floor(_paramY)), true);
        } else {
            this.RouteEndPlag.mapEndDragFlag = true;
            this.onFixEnd(_paramValue, new SPoint(Math.floor(_paramX), Math
                    .floor(_paramY)), true);
        }
    },
    cbPlagEndDrag : function(_paramX, _paramY, _paramFlag, _poiSearchPath) {
        if (_paramFlag == BusLocalTextBox.START_TARGET) {
            this.setStartPoint(Math.floor(_paramX), Math.floor(_paramY));
        } else {
            this.setEndPoint(Math.floor(_paramX), Math.floor(_paramY));
        }

        if (this.busRoutingSearchModule.getExecuteFlag()) {
            this.busRoutingSearchModule.unloadPolyLine();
            this.hideResult();

            if(!_poiSearchPath){
                this.hideSearch();
                this.showGuide();
            }
        }
    },
    setStartPoint : function(_paramX, _paramY) {
        var tempPos = new SPoint(_paramX, _paramY);

        if (!this.startPointCoord)
            this.startPointCoord = tempPos;
        else
            this.startPointCoord.set(_paramX, _paramY);

        this.busRoutingSearchModule.setStartPoint(this.startPointCoord);
    },
    setEndPoint : function(_paramX, _paramY) {
        var tempPos = new SPoint(_paramX, _paramY);

        if (!this.endPointCoord)
            this.endPointCoord = tempPos;
        else
            this.endPointCoord.set(_paramX, _paramY);

        this.busRoutingSearchModule.setEndPoint(this.endPointCoord);
    },
    busRoutingExecute : function() {
        if (!this.startPointCoord || !this.endPointCoord)
            return;
        this.busRoutingSearchModule.executeBus();
    },
    showSearch : function() {
        $("#ifr_sch_result").show();
    },
    showGuide : function() {
        $("#busleftinfo").show();
    },
    showResult : function() {
        $("#bus_result").show();
    },
    hideSearch : function() {
        $("#ifr_sch_result").hide();
    },
    hideGuide : function() {
        $("#busleftinfo").hide();
    },
    hideResult : function() {
        $("#bus_result").hide();
    },
    hideSearchAndGuide : function() {
        this.hideGuide();
        this.hideSearch();
    },
    showSearchAndGuide : function() {
        this.showGuide();
        this.showSearch();
    },
    clearAll : function() {
        this.startPointCoord = null;
        this.endPointCoord = null;

        this.resetAllInfo();

        this.clearMark(this.RouteStartPlag,
                BusRouteSearchControl.Bus_SEARCH_MARK_START_ID);
        this.clearMark(this.RouteEndPlag,
                BusRouteSearchControl.Bus_SEARCH_MARK_END_ID);

        this.busRoutingSearchModule.unloadPolyLine();

        this.TextBoxModule.clearTextBoxAll();

        this.hideResult();
        this.showGuide();
    }
};

BusRouteSearchControl = function(_param) {
    this.$topDivId = $('#' + _param.divId);
    this.$flagId = $('#' + _param.buttonId);
    this.$inputBoxId = $('#' + _param.inputBoxId);
    this.initProgress();
    this.status;
    this.clickInfo;
    this.areaName;
    this.mapEndDragFlag = false;
};

BusRouteSearchControl.INIT = 'INIT';
BusRouteSearchControl.MAP_CLICK_WAIT = 'MAP_CLICK_WAIT';
BusRouteSearchControl.CLICKED = 'MAP_CLICK_OK';
BusRouteSearchControl.SETUP = 'SETUP';
BusRouteSearchControl.Bus_SEARCH_MARK_START_ID = 'MARK_START_ID';
BusRouteSearchControl.Bus_SEARCH_MARK_END_ID = 'MARK_END_ID';

BusRouteSearchControl.prototype = {
    initProgress : function() {
        this.status = BusRouteSearchControl.INIT;
        this.nullEventFunc(this.$topDivId);
        this.addPlagEvent();
    },
    onclickFlagButton : function(event) {
        var tempClass = this.$flagId.attr('class');

        if (tempClass.indexOf('on') != -1) {
            this._cleanMapClickInfo();
        } else {
            this.prevMapClick(this);
            this.removeMapClickEvent();
            this.addMapClickEvent();
            this.status = BusRouteSearchControl.MAP_CLICK_WAIT;
            this.setStyle("on");
        }

        return false;
    },
    nullEventFunc : function(_id) {
        $link = _id;
        $.each(eventTypes, function(index, eventType) {
            $link.bind(eventType, function(event) {
                return false;
            });
        });
    },
    _cleanMapClickInfo : function() {
        this.mapSetCursor();
        this.removeMapClickEvent();
        this.setStyle();
    },
    mapSetCursor : function(type) {
        var $mapObj = $('#mapContainer');
        if (!type) {
            $mapObj.children('div').css("cursor", "default");
        } else {
            $mapObj.children('div')
                    .css("cursor", "url('" + type + "'),default");
        }
    },
    prevMapClick : function() {
    },
    setMapClickInfo : function() {
        this.prevMapClick();
    },
    mapClickEvent : function(event, eventCoord) {
        this.setStyle();
        var clickPositionCoord = new SPoint(eventCoord.x, eventCoord.y);
        var areaName = this.getOpenApiAreaName(clickPositionCoord);
        this.fixMap(areaName, clickPositionCoord);
    },
    fixMap : function(_areaName, _pos) {
        if (!this.areaName)
            this.areaName = _areaName;
        this.areaName = _areaName;
        this.status = BusRouteSearchControl.SETUP;
        this.$inputBoxId.attr('value', this.areaName);
        this._cleanMapClickInfo();
        this.onFix(_areaName, _pos);
    },
    onFix : function(_areaName, _pos) {
    },
    addPlagEvent : function() {
        mapObserverEvent.addEvent(this.$flagId, 'click',
                this.onclickFlagButton, this);
    },
    removePlagEvent : function() {
        mapObserverEvent.addEvent(this.$flagId, 'click');
    },
    removeMapClickEvent : function() {
        SEvent.mapEventRemoveById('click', this.mapClickEvent);
    },
    addMapClickEvent : function() {
        SEvent.mapEventHandler('click', this.mapClickEvent, this);
    },
    setStyle : function(_flag) {
        if (enum_BrowserType.IE) {
            if (!_flag)
                this.$flagId.removeClass().addClass(this.$flagId.attr('tag')+'IE');
            else
                this.$flagId.removeClass().addClass(this.$flagId.attr('tag') + '_' + _flag +'IE');
        }
        else{
            if (!_flag)
                this.$flagId.removeClass().addClass(this.$flagId.attr('tag'));
            else
                this.$flagId.removeClass().addClass(this.$flagId.attr('tag') + '_' + _flag);
        }
    },
    getOpenApiAreaName : function(_coord) {
        var coordWGS84 = TMtoWGS84(_coord.x, _coord.y);
        var areaName = BusmakeReverseGeocodingParemeter(coordWGS84.x,
                coordWGS84.y);
        return areaName;
    }
};

/**
 * 대중교통 길찾기 라우팅 모듈
 */
BusRoutingSearchModule = function(map, _parent) {
    this.parentObj = _parent;
    this.map = map;

    this.routeStartPoint = null;
    this.routeEndPoint = null;
    this.executeFlag = false;

    this.opt =null;;
    this.busResultViewer = new BusResultParsingViewer(map, this);
}

BusRoutingSearchModule.EXPIRE_DISTANCE = 10;

BusRoutingSearchModule.FIRST_SEARCH_RESULT = "FIRST_RESULT";
BusRoutingSearchModule.SECOND_SEARCH_RESULT = "SECOND_RESULT";

BusRoutingSearchModule.BUS_SEARCH = "2";
BusRoutingSearchModule.RAIN_SEARCH = "1";
BusRoutingSearchModule.COMBINE_SARCH = "3";
BusRoutingSearchModule.TOTAL_SEARCH = "4";
BusRoutingSearchModule.AREA_CODE = "1";
BusRoutingSearchModule.START_RADIUS = 700;
BusRoutingSearchModule.END_RADIUS = 700;

BusRoutingSearchModule.prototype = {
    setStartPoint : function(startPos) {
        if (!this.startPos) {
            this.routeStartPoint = new SPoint();
            this.routeStartPoint.set(startPos.x, startPos.y);
            this.executeFlag = true;
        } else {
            if (this.routeStartPoint.distance(startPos) < BusRoutingSearchModule.EXPIRE_DISTANCE) {
                this.executeFlag = false;
            } else {
                this.routeStartPoint.x = startPos.x;
                this.routeStartPoint.y = startPos.y;
                this.executeFlag = true;
            }
        }
    },
    setEndPoint : function(endPos) {
        if (!this.routeEndPoint) {
            this.routeEndPoint = new SPoint();
            this.routeEndPoint.set(endPos.x, endPos.y);
            this.executeFlag = true;
        } else {
            if (this.routeEndPoint.distance(endPos) < BusRoutingSearchModule.EXPIRE_DISTANCE) {
                this.executeFlag = false;
            } else {
                this.routeEndPoint.x = endPos.x;
                this.routeEndPoint.y = endPos.y;
                this.executeFlag = true;
            }
        }
    },
    getExecuteFlag : function() {
        return this.executeFlag;
    },
    getOpt: function(){
        return this.opt;
    },
    setOpt : function(opt) {
        this.opt = opt;
        this.busResultViewer.setOpt(opt);
    },
    executeBus : function() {
        if (!this.executeFlag)
            return false;

        this.executeFlag = false;
        this.busResultViewer.toogleBusImage();
        this.busResultViewer.setOpt(BusRoutingSearchModule.BUS_SEARCH);
        this.cleanAllResult();
        this.setOpt(BusRoutingSearchModule.BUS_SEARCH);
        this.viewBusResult();
        this.executePathFind();
    },
    executeTrain : function() {
        this.executeFlag = false;
        this.cleanTrainResult();
        this.setOpt(BusRoutingSearchModule.RAIN_SEARCH);
        this.viewTrainResult();
        this.executePathFind();
    },
    executeBusTrain: function(){
        this.executeFlag = false;
        this.cleanCombineResult();
        this.setOpt(BusRoutingSearchModule.COMBINE_SARCH);
        this.viewCombineResult();
        this.executePathFind();
    },
    executePathFind : function() {
        var walkDistance = BusRoutingSearchModule.START_RADIUS;
        var distance = Math.floor(this.routeStartPoint.distance(this.routeEndPoint));
        var paramF = 'json';
        var paramSX = this.routeStartPoint.x;
        var paramSY = this.routeStartPoint.y;
        var paramEX = this.routeEndPoint.x;
        var paramEY = this.routeEndPoint.y;

        if (distance < walkDistance){
            this.busResultViewer.walkDistance(distance);
            return;
        }

        this.loadingAjax(true);
        AJAX_URL_PARAM = 'output=json&SX=' + paramSX + '&SY=' + paramSY + '&EX=' + paramEX
                + '&EY=' + paramEY + '&PFlag='
                + this.getOpt() + '&CID='
                + BusRoutingSearchModule.AREA_CODE + '&sRadius='
                + BusRoutingSearchModule.START_RADIUS + '&eRadius='
                + BusRoutingSearchModule.END_RADIUS + '&pageInfo=PathFind&lang='
                + convertTrafficLang(mapLang);
        executeBusSearchAjaxArgument(true, this.cbPathFindResult, this);
    },
    executePathLane : function(mapObj) {
        this.loadingAjax();
        AJAX_URL_PARAM = 'output=json&pageInfo=LoadLane&Param=0:0@'+ mapObj;
        executeBusSearchAjaxArgument(false, this.cbBusLaneResult, this);
        this.unloadingAjax();
    },
    cleanAllResult : function() {
        this.cleanBusResult();
        this.cleanTrainResult();
        this.cleanCombineResult();
    },
    cleanBusResult : function() {
        this.parentObj.hideSearchAndGuide();
        this.parentObj.showResult();
        this.busResultViewer.emptyBusData();
    },
    cleanTrainResult: function(){
        this.busResultViewer.emptyTrainData();
    },
    cleanCombineResult: function(){
        this.busResultViewer.emptyCombineData();
    },
    unLoadModule : function() {
        this.executeFlag = false;
        this.busResultViewer.unLoadModule();
    },
    cbPathFindResult : function(data) {
        this.loadingAjax(false);
        this.unloadingAjax();
        this.busResultViewer.setData(data);
        this.busResultViewer.viewPathFind();
    },
    cbBusLaneResult: function(data){
        this.busResultViewer.setLaneData(data);
        this.busResultViewer.viewLane();
    },
    loadingAjax : function(flag) {
        if(flag){
            $('#contentLoading').show();
        }
        else{
            $('#contentLoading').hide();
        }
    },
    unloadingAjax : function() {
        $('#contentLoading').ajaxStart(function(){});
        $('#contentLoading').ajaxStop(function(){});
    },
    unloadPolyLine : function() {
        this.busResultViewer.unloadPolyLine();
    },
    viewBusResult: function(){
        this.busResultViewer.viewResultPannelHide();
        this.busResultViewer.viewResultPannelBusView();
    },
    viewTrainResult: function(){
        this.busResultViewer.viewResultPannelHide();
        this.busResultViewer.viewResultPannelTrainView();
    },
    viewCombineResult: function(){
        this.busResultViewer.viewResultPannelHide();
        this.busResultViewer.viewResultPannelCombineView();
    }
};


/**
 * 결과 데이타 출력
 */
BusResultParsingViewer = function(map, parentObj) {
    this.map = map;
    this.parentObj = parentObj;
    this.pathFindData = null;
    this.pathRainFindData = null;
    this.pathCombineFindData = null;
    this.pathLaneData = null;
    this.opt = BusRoutingSearchModule.BUS_SEARCH;
    this.$resultDiv = $('#bus_result_route');
    this.$resultTrainDiv = $('#train_result_route');
    this.$resultCombineDiv = $('#combine_result_route');
    this.$resultRealDataDiv = null;
    this.BusPathCount = 0;
    this.divLoop = 0;
    this.polyLineObj = null;
}

BusResultParsingViewer.POLYLINE_BUS_COLOR = 'red';
BusResultParsingViewer.POLYLINE_TRAIN_COLOR = 'blue';
BusResultParsingViewer.POLYLINE_OPACITY = 0.5;
BusResultParsingViewer.POLYLINE_WEIGHT = 5;

BusResultParsingViewer.prototype = {
    viewPathFind : function() {
        if(!this.viewCommonHead())
            return false;

        this.viewPath();
    },
    setOpt: function(_opt){
        this.opt = _opt;
    },
    getOpt: function(){
        return this.opt;
    },
    setData: function(data){
        switch(this.getOpt()){
            case BusRoutingSearchModule.BUS_SEARCH:
                this.pathFindData = data;
                break;
            case BusRoutingSearchModule.RAIN_SEARCH:
                this.pathRainFindData = data;
                break;
            case BusRoutingSearchModule.COMBINE_SARCH:
                this.pathCombineFindData = data;
                break;
        }
    },
    setSubTrainData: function(data){
        this.pathSubTrainFindData = data;
    },
    setLaneData: function(data){
        this.pathLaneData = data;
    },
    viewPath: function(){
        this.divLoop = 0;
        var tempPathData = null;

        switch(this.getOpt()){
            case BusRoutingSearchModule.BUS_SEARCH:
                tempPathData = this.pathFindData;
                break;
            case BusRoutingSearchModule.RAIN_SEARCH:
                tempPathData = this.pathRainFindData;
                break;
            case BusRoutingSearchModule.COMBINE_SARCH:
                tempPathData = this.pathCombineFindData;
                break;
        }

        for(var index=0; index<tempPathData.Result.Path.length; index++){
            var busNumber = '-';
            var busType = '-';
            var distance  = 1;
            var payment = 900;
            var time = '-';
            var stopCount = 0;

            if(tempPathData.Result.Path[index].Distance != null){
                distance = tempPathData.Result.Path[index].Distance;
            }

            payment = tempPathData.Result.Path[index].Payment;
            if(tempPathData.Result.Path[index].Time!=null){
                time = tempPathData.Result.Path[index].Time;
            }

            switch(this.getOpt()){
                case BusRoutingSearchModule.BUS_SEARCH:
                    stopCount = tempPathData.Result.Path[index].StopCount;

                    // [버스] 데이타 생성
                    if(!tempPathData.Result.Path[index].ExChange){
                        this._displayNumberGroup(index, stopCount, distance, time, payment,
                                                    tempPathData.Result.Path[index].Start);
                    }
                    else{
                        this._displayNumberGroup(index, stopCount, distance, time, payment,
                                                    tempPathData.Result.Path[index].Start,
                                                    tempPathData.Result.Path[index].ExChange);
                    }
                    break;
                case BusRoutingSearchModule.RAIN_SEARCH:
                    stopCount = tempPathData.Result.Path[index].SubStopCount;

                    // [전철] 데이타 생성
                    if(!tempPathData.Result.Path[index].ExChange){
                        this._displayTrainNumberGroup(index, stopCount, distance, time, payment,
                                                    tempPathData.Result.Path[index].Start);
                    }
                    else{
                        this._displayTrainNumberGroup(index, stopCount, distance, time, payment,
                                                    tempPathData.Result.Path[index].Start,
                                                    tempPathData.Result.Path[index].ExChange);
                    }
                    break;
                case BusRoutingSearchModule.COMBINE_SARCH:
                    // [버스+지하철] 데이타 생성
                    if(!tempPathData.Result.Path[index].ExChange){
                        this._displayCombineNumberGroup(index, stopCount, distance, time, payment,
                                                    tempPathData.Result.Path[index].Start);
                    }
                    else{
                        this._displayCombineNumberGroup(index, stopCount, distance, time, payment,
                                                    tempPathData.Result.Path[index].Start,
                                                    tempPathData.Result.Path[index].ExChange);
                    }
                    break;
            }
        }

        this.viewResultCountDetail(this.divLoop);
    },
    _displayNumberGroup:function(_parentIndex, _stopCount, _distance, _time, _price, _startObj, _exchangeObj){
        var sBusNumber = null;
        var sBusType = null;
        var xBusNumber = null;
        var xBusType = null;

        // 출발 버스 리스트
        for(var index=0; index<_startObj.Lane.length; index++){
            sBusNumber = _startObj.Lane[index].BusNo;
            sBusType = _startObj.Lane[index].type;

            if(_exchangeObj!=null){
                for(var indexSub=0; indexSub<_exchangeObj.length; indexSub++){
                    for(var indexSub2=0; indexSub2<_exchangeObj[indexSub].Lane.length; indexSub2++){
                        this._displayNumberSubHead(this.divLoop);
                        this._displayBusNumber(this.divLoop,
                                                sBusNumber,
                                                sBusType,
                                                _exchangeObj[indexSub].Lane[indexSub2].BusNo,
                                                _exchangeObj[indexSub].Lane[indexSub2].type);

                        this._displayInfo(this.divLoop, _distance, _time, _price);
                        this._dipslayBusStopCount(this.divLoop, _stopCount);
                        this._dipslayBusBtn(this.divLoop, _parentIndex, index, indexSub, indexSub2);
                        this.divLoop++;
                    }
                }
            }
            else{
                this._displayNumberSubHead(this.divLoop);
                this._displayBusNumber(this.divLoop, sBusNumber, sBusType);
                this._displayInfo(this.divLoop, _distance, _time, _price);
                this._dipslayBusStopCount(this.divLoop, _stopCount);
                this._dipslayBusBtn(this.divLoop, _parentIndex, index);
                this.divLoop++;
            }
        }
    },
    _displayCombineNumberGroup: function(_parentIndex, _stopCount, _distance, _time, _price, _combineStartObj, _combineExchangeObj){
        var sTrainNumber = null;
        var sTrainType = null;
        var xTrainNumber = null;
        var xTrainType = null;

        if(_combineExchangeObj!=null){
            this._displayNumberSubHead(this.divLoop);
            this._displayCombineNumber(this.divLoop
                                    ,_combineStartObj
                                    ,_combineExchangeObj);
            this._displayInfo(this.divLoop, _distance, _time, _price);
            this._dipslayCombineStopCount(this.divLoop, _combineStartObj, _combineExchangeObj);
            this._dipslayCombineBtn(this.divLoop, _parentIndex);
        }
        else{
            this._displayNumberSubHead(this.divLoop);
            this._displayCombineNumber(this.divLoop, _combineStartObj);
            this._displayInfo(this.divLoop, _distance, _time, _price);
            this._dipslayCombineStopCount(this.divLoop, _combineStartObj);
            this._dipslayCombineBtn(this.divLoop, _parentIndex);
        }

        this.divLoop++;
    },
    _displayTrainNumberGroup:function(_parentIndex, _stopCount, _distance, _time, _price, _trainStartObj, _trainExchangeObj){
        var sTrainNumber = null;
        var sTrainType = null;
        var xTrainNumber = null;
        var xTrainType = null;

        // 출발 전철  리스트
        sTrainNumber = _trainStartObj.Lane[0].SubName;
        sTrainType = _trainStartObj.Lane[0].LaneID;

        if(_trainExchangeObj!=null){
            this._displayNumberSubHead(this.divLoop);
            this._displayTrainNumber(this.divLoop,
                                    sTrainNumber,
                                    sTrainType,
                                    _trainExchangeObj);

            this._displayInfo(this.divLoop, _distance, _time, _price);
            this._dipslayTrainStopCount(this.divLoop, _trainStartObj, _trainExchangeObj);
            this._dipslayTrainBtn(this.divLoop, _parentIndex);
        }
        else{
            this._displayNumberSubHead(this.divLoop);
            this._displayTrainNumber(this.divLoop, sTrainNumber, sTrainType);
            this._displayInfo(this.divLoop, _distance, _time, _price);
            this._dipslayTrainStopCount(this.divLoop, _trainStartObj);
            this._dipslayTrainBtn(this.divLoop, _parentIndex);
        }

        this.divLoop++;
    },
    _displayNumberSubHead: function(_index){
        var contentDiv = null;
        var parentDiv = null;
        var contentClass = null;

        switch(this.getOpt()){
            case BusRoutingSearchModule.BUS_SEARCH:
                contentDiv = 'route_info_';
                parentDiv = 'deselectedItem';
                break;
            case BusRoutingSearchModule.RAIN_SEARCH:
                contentDiv = 'route_train_info_';
                parentDiv = 'deselectedItemSubtrain';
                break;
            case BusRoutingSearchModule.COMBINE_SARCH:
                contentDiv = 'route_combine_info_';
                parentDiv = 'deselectedItemCombine';
                break;
        }

        $("<div></div>").appendTo(this.$resultRealDataDiv)
                        .addClass('deselectedItem').css('padding-bottom', '0px')
                        .attr('id', parentDiv+_index)
                        .append('<div></div>').children()
                        .addClass('contents_main').attr('id', contentDiv + _index);
    },
    _displayBusNumber:function(_index, _SBusNumber, _SBusType, _XBusNumber, _XBusType){
        var parentObj = $('#route_info_'+ _index);

        // 시작점  버스 표시
        $("<div></div>").appendTo(parentObj)
                        .addClass('bn').css('text-decoration', 'none')
                        .append('<img></img><a>'+ _SBusNumber + '</a>').children().addClass('bImg')
                                                .attr('src', '/images/index2/'+ busTypeImg(_SBusType));

        // 환승  버스 표시
        if (_XBusNumber!=null){
            parentObj.children().append('<span></span>').children('span:last')
                                    .addClass('traffucarriw')
                                    .append('<img></img>').children().attr('src', '/images/index2/traffic_arrow.gif')
                                                        .parent().parent()
                                .append(' <span></span>').children('span:last')
                                    .append('<img></img><a>'+ _XBusNumber + '</a>').children().addClass('bImg')
                                                .attr('src', '/images/index2/'+ busTypeImg(_XBusType));
        }
    },
    _displayCombineNumber: function(_index, _SCombineObj, _XCombineObj){
        var parentObj = $('#route_combine_info_'+ _index);

        var sNumber = null;
        var sType = null;
        var sImage = null;

        // 1.1  [시작] 지하철/버스  구분
        if(!_SCombineObj.SubStopCount){
            sNumber = _SCombineObj.Lane[0].BusNo;
            sType = _SCombineObj.Lane[0].type;
            sImage = '/images/index2/'+ busTypeImg(sType);
        }
        else{
            sNumber = _SCombineObj.Lane[0].SubName;
            sType = _SCombineObj.Lane[0].LaneID;
            sImage = '/images/index2/subway_icon_img/'+ getConvertTrainImage(sType);
        }

        // 1.2 시작점  표시
        $("<div></div>").appendTo(parentObj)
                        .addClass('bn').css('text-decoration', 'none')
                        .append('<img></img><a>'+ sNumber + '</a>').children().addClass('bImg')
                                                .attr('src', sImage);


        // 2.1 환승 정보  표시
        if (_XCombineObj!=null) {
            var xNumber = null;
            var xType = null;
            var xImage = null;

            for(var exIndex=0; exIndex<_XCombineObj.length; exIndex++){

                // 2.2  [환승] 지하철/버스  구분
                if(!_XCombineObj[exIndex].SubStopCount){
                    xNumber = _XCombineObj[exIndex].Lane[0].BusNo;
                    xType = _XCombineObj[exIndex].Lane[0].type;
                    xImage = '/images/index2/'+ busTypeImg(xType);
                }
                else{
                    xNumber = _XCombineObj[exIndex].Lane[0].SubName;
                    xType = _XCombineObj[exIndex].Lane[0].LaneID;
                    xImage = '/images/index2/subway_icon_img/'+ getConvertTrainImage(xType);
                }

                // 환승 화살표 표시
                parentObj.children().append('<span></span>').children('span:last')
                                    .addClass('traffucarriw')
                                    .append('<img></img>').children('img:last')
                                    .attr('src', '/images/index2/traffic_arrow.gif')
                                    .addClass('bImg');

                // 환승지점  표시
                parentObj.children().append('<img></img> '+xNumber).children('img:last')
                                    .addClass('bImg')
                                    .attr('src', xImage);
            }
        }
    },
    _displayTrainNumber:function(_index, _STrainNumber, _STrainType, _XTrainObj){
        var parentObj = $('#route_train_info_'+ _index);


        // 시작점  지하철 표시
        $("<div></div>").appendTo(parentObj)
                        .addClass('bn').css('text-decoration', 'none')
                        .append('<img></img>'+ _STrainNumber).children('img').addClass('bImg')
                        .attr('src', '/images/index2/subway_icon_img/'+ getConvertTrainImage(_STrainType));

        // 환승역 표시
        if (_XTrainObj!=null) {
            var xTrainNumber = null;
            var xTrainType = null;

            for(var exIndex=0; exIndex<_XTrainObj.length; exIndex++){
                // 환승 화살표 표시
                parentObj.children().append('<span></span>').children('span:last')
                                    .addClass('traffucarriw')
                                    .append('<img></img>').children('img:last')
                                    .attr('src', '/images/index2/traffic_arrow.gif')
                                    .addClass('bImg');

                // 지하철 표시
                xTrainNumber = _XTrainObj[exIndex].Lane[0].SubName;
                xTrainType = _XTrainObj[exIndex].Lane[0].LaneID;
                parentObj.children().append('<img></img> '+xTrainNumber).children('img:last')
                        .addClass('bImg')
                        .attr('src', '/images/index2/subway_icon_img/'+ getConvertTrainImage(xTrainType));
            }
        }
    },
    _displayInfo: function(_index, _distance, _time, _price){
        var contentDiv = null;
        var timeText = null;
        var distanceText = null;
        var wonText = null;

        switch(this.getOpt()){
            case BusRoutingSearchModule.BUS_SEARCH:
                contentDiv = 'route_info_';
                break;
            case BusRoutingSearchModule.RAIN_SEARCH:
                contentDiv = 'route_train_info_';
                break;
            case BusRoutingSearchModule.COMBINE_SARCH:
                contentDiv = 'route_combine_info_';
                break;
        }

        if(_time > 1) {
            timeText = ' ' + i18NObj.getTextValue('yak')  + _time +i18NObj.getTextValue('min(s)');
        }
        else{
            timeText = ' ' + i18NObj.getTextValue('yak')  + _time +i18NObj.getTextValue('min');
        }

        distanceText = i18NObj.getTextValue('carBusResultCount') + _distance +' km';
        wonText = '('+ i18NObj.getTextValue('yak')  + _price + i18NObj.getTextValue('won') +')';
        $("<div></div>").appendTo($('#' + contentDiv + _index))
                        .addClass('search_infomation')
                        .append('<span></span>').children().addClass('seperate')
                                                .html(distanceText).parent()
                        .append('<span></span>').children('span:eq(1)').addClass('seperate')
                                                .html(timeText).parent()
                        .append('<span></span>').children('span:eq(2)').addClass('seperate')
                                                .html(wonText);
    },
    _dipslayBusStopCount: function(_index, _busStopCount){
        var parentObj = $('#route_info_'+ _index);
        var stopText = null;

        if (mapLang=="eng"){
            stopText = _busStopCount + i18NObj.getTextValue('bus')+ this._englishStopCount(_busStopCount, 'stopname');
        }
        else{
            stopText = i18NObj.getTextValue('bus')+ _busStopCount + this._englishStopCount(_busStopCount, 'stopname');
        }

        $("<div></div>").appendTo(parentObj)
                        .append('<strong></strong>').children()
                                                    .html(stopText);
    },
    _dipslayCombineStopCount: function(_index, _combineStartObj, _combineExchangeObj){
        var parentObj = $('#route_combine_info_'+ _index);

        var startTxt  = null;

        // 1.1  [시작] 지하철/버스  구분
        if(!_combineStartObj.SubStopCount){
            if (mapLang=="eng"){
                startTxt = _combineStartObj.BusStopCount + i18NObj.getTextValue('bus')+  this._englishStopCount(_combineStartObj.BusStopCount, 'stopname');
            }
            else{
                startTxt = i18NObj.getTextValue('bus')+ _combineStartObj.BusStopCount + i18NObj.getTextValue('stopname');
            }
        }
        else{
            if (mapLang=="eng"){
                startTxt = _combineStartObj.SubStopCount + i18NObj.getTextValue('subway')+ this._englishStopCount(_combineStartObj.SubStopCount, 'station');
            }
            else{
                startTxt = i18NObj.getTextValue('subway')+ _combineStartObj.SubStopCount + i18NObj.getTextValue('station');
            }

        }

        // 시작 정차  갯수 표시
        $("<div></div>").appendTo(parentObj)
                        .append('<strong></strong>').children()
                            .html(startTxt);

        // 환승 출력
        if (_combineExchangeObj!=null) {
            var xStopTxt = null;

            for(var exIndex=0; exIndex<_combineExchangeObj.length; exIndex++){
                // 1.1  [시작] 지하철/버스  구분
                if(!_combineExchangeObj[exIndex].SubStopCount){
                    if (mapLang=="eng"){
                        xStopTxt = _combineExchangeObj[exIndex].BusStopCount + i18NObj.getTextValue('bus')+  this._englishStopCount(_combineExchangeObj[exIndex].BusStopCount, 'stopname');
                    }
                    else{
                        xStopTxt = i18NObj.getTextValue('bus')+  _combineExchangeObj[exIndex].BusStopCount + i18NObj.getTextValue('stopname');
                    }
                }
                else{
                    if (mapLang=="eng"){
                        xStopTxt = _combineExchangeObj[exIndex].SubStopCount + i18NObj.getTextValue('subway')+ this._englishStopCount(_combineExchangeObj[exIndex].SubStopCount, 'station');
                    }
                    else{
                        xStopTxt = i18NObj.getTextValue('subway')+ _combineExchangeObj[exIndex].SubStopCount + i18NObj.getTextValue('station');
                    }
                }

                // 환승 '+' 표시
                parentObj.children('div:last').children('strong')
                                                .append('+');

                // 환승  갯수 표시
                parentObj.children('div:last').children('strong')
                                                .append(xStopTxt);
            }
        }
    },
    _dipslayTrainStopCount: function(_index, _trainStartObj, _trainExchangeObj){
        var parentObj = $('#route_train_info_'+ _index);
        var startTxt  = null;
        var startStopCount = null;

        startStopCount = _trainStartObj.SubStopCount;

        if (mapLang=="eng"){
            startTxt = startStopCount + i18NObj.getTextValue('bus')+  this._englishStopCount(startStopCount, 'station');
        }
        else{
            startTxt = i18NObj.getTextValue('bus')+ startStopCount + i18NObj.getTextValue('station');
        }

        // 시작 지하철 정차역 갯수 표시
        $("<div></div>").appendTo(parentObj)
                        .append('<strong></strong>').children()
                            .html(startTxt);

        // 환승 출력
        if (_trainExchangeObj!=null) {
            var xTrainStopCount = null;
            var xExChangeTxt = null;

            for(var exIndex=0; exIndex<_trainExchangeObj.length; exIndex++){
                xTrainStopCount =  _trainExchangeObj[exIndex].SubStopCount;

                if (mapLang=="eng"){
                    xExChangeTxt = xTrainStopCount + i18NObj.getTextValue('subway') + this._englishStopCount(xTrainStopCount, 'station');
                }
                else{
                    xExChangeTxt = i18NObj.getTextValue('subway') +  xTrainStopCount + this._englishStopCount(xTrainStopCount, 'station');
                }

                // 환승 '+' 표시
                parentObj.children('div:last').children('strong')
                                                .append('+');

                // 환승 지하철 정차역 갯수 표시
                parentObj.children('div:last').children('strong')
                                                .append(xExChangeTxt);
            }
        }
    },
    _dipslayCombineBtn: function(_index, _parentIndex, _startIndex, _exchangeIndex, _exchangeSubIndex){
        var parentObj = $('#route_combine_info_'+ _index);
        var thisObj = this;
        var classId = 'select_button';

        $("<div></div>").appendTo(parentObj)
                        .addClass('select_button')
                        .append('<span></span>').children()
                            .addClass("simple_path_on")
                            .append('<img></img>').children()
                                    .attr('src', '/images/index2/'+ mapLang +'/n_local_btn_25_down.gif')
                                    .css('cursor', 'pointer')
                                    .click(function(){
                                        thisObj.parentObj.executePathLane(thisObj.pathCombineFindData.Result.Path[_parentIndex].MapObj);
                                    }).parent()
                            .parent()
                        .append('<span></span>').children('span:last')
                            .addClass('view_path')
                            .append(' <img></img>').children()
                                .attr('src', '/images/index2/'+ mapLang +'/n_local_btn_24.gif')
                                    .css('cursor', 'pointer')
                                    .click(function(){
                                        if(_exchangeIndex!=null){
                                            thisObj._displayCombineDetailInfo(_index, _parentIndex);
                                        }
                                        else{
                                            thisObj._displayCombineDetailInfo(_index, _parentIndex);
                                        }

                                        return false;
                                    });
    },
    _dipslayTrainBtn: function(_index, _parentIndex, _startIndex, _exchangeIndex, _exchangeSubIndex){
        var parentObj = $('#route_train_info_'+ _index);
        var thisObj = this;
        var classId = 'select_button';

        $("<div></div>").appendTo(parentObj)
                        .addClass('select_button')
                        .append('<span></span>').children()
                            .addClass("simple_path_on")
                            .append('<img></img>').children()
                                    .attr('src', '/images/index2/'+ mapLang +'/n_local_btn_25_down.gif')
                                    .css('cursor', 'pointer')
                                    .click(function(){
                                        thisObj.parentObj.executePathLane(thisObj.pathRainFindData.Result.Path[_parentIndex].MapObj);
                                    }).parent()
                            .parent()
                        .append('<span></span>').children('span:last')
                            .addClass('view_path')
                            .append(' <img></img>').children()
                                .attr('src', '/images/index2/'+ mapLang +'/n_local_btn_24.gif')
                                    .css('cursor', 'pointer')
                                    .click(function(){
                                        if(_exchangeIndex!=null){
                                            thisObj._displayTrainDetailInfo(_index, _parentIndex);
                                        }
                                        else{
                                            thisObj._displayTrainDetailInfo(_index, _parentIndex);
                                        }

                                        return false;
                                    });
    },
    _dipslayBusBtn: function(_index, _parentIndex, _startIndex, _exchangeIndex, _exchangeSubIndex){
        var parentObj = $('#route_info_'+ _index);
        var thisObj = this;

        $("<div></div>").appendTo(parentObj)
                        .addClass('select_button')
                        .append('<span></span>').children()
                            .addClass("simple_path_on")
                            .append('<img></img>').children()
                                .attr('src', '/images/index2/'+ mapLang +'/n_local_btn_25_down.gif')
                                .css('cursor', 'pointer')
                                .click(function(){
                                    thisObj.parentObj.executePathLane(thisObj.pathFindData.Result.Path[_parentIndex].MapObj);
                                }).parent()
                            .parent()
                        .append('<span></span>').children('span:last')
                            .addClass('view_path')
                            .append('  <img></img>').children()
                                .attr('src', '/images/index2/'+ mapLang +'/n_local_btn_24.gif')
                                .css('cursor', 'pointer')
                                .click(function(){
                                    if(_exchangeIndex!=null){
                                        thisObj._displayBusDetailInfo(_index, _parentIndex, _startIndex, _exchangeIndex, _exchangeSubIndex);
                                    }
                                    else{
                                        thisObj._displayBusDetailInfo(_index, _parentIndex, _startIndex);
                                    }

                                    return false;
                                })
    },
    _displayCombineDetailInfo: function(_index, _parentIndex){
        var $brotherDiv = $('#deselectedItemCombine' + _index);

        $('#routeContainerCombine > .contents_sub').hide();

        if(this.$resultRealDataDiv.children().is('#deselectedItem_sub_combine'+ _index)){
            $('#deselectedItem_sub_combine'+ _index).show();
            return;
        }
        else{
            var objData = this.pathCombineFindData.Result;
            var startWalkMether = 0;
            var startStopPosition = null;
            var startStopName  = null;
            var startNumber = null;
            var startType = 0;
            var startStopCount = 0;
            var startWay = null;
            var nextStopName = null;
            var startMeterText = null;
            var startTitle = null;
            var startWayText = null;
            var startImage = null;

            // 1.1. 도보 길이 계산
            startStopPosition = new SPoint(Math.floor(objData.Path[_parentIndex].Start.KX),
                    Math.floor(objData.Path[_parentIndex].Start.KY));
            startWalkMether = Math.floor(this.parentObj.routeStartPoint.distance(startStopPosition));
            // 1.2   정차역 이름 구하기
            startStopName = objData.Path[_parentIndex].Start.Name;

            // 1.3  다음정거장 이름 가져오기
            if(!objData.Path[_parentIndex].ExChange){
                nextStopName = objData.Path[_parentIndex].End.Name;
            }
            else{
                nextStopName = objData.Path[_parentIndex].ExChange[0].Name;
            }


            // 1.4 [시작] 지하철/버스  구분
            if(!objData.Path[_parentIndex].Start.SubStopCount){
                startNumber = objData.Path[_parentIndex].Start.Lane[0].BusNo;
                startType = objData.Path[_parentIndex].Start.Lane[0].type;
                startStopCount = objData.Path[_parentIndex].Start.BusStopCount;

                startTitle = '(' + startStopName + ')';
                startImage = '/images/index2/'+ busTypeImg(startType);

                startMeterText = startStopName + i18NObj.getTextValue('to') + ' ' + startWalkMether +'m ' + i18NObj.getTextValue('dobo');
                startWayText = startStopName + ' ' + i18NObj.getTextValue('ridebus');
                startCountText = startStopCount + i18NObj.getTextValue('nextstationcnt') + ' '+ nextStopName + i18NObj.getTextValue('downbus');


                // 00 으로  00 m 도보,
                // 00 버스정류장에서 타기
                // 00 정거장 이동 후 00 버스정류장에서 내리기
                if (mapLang=="eng"){
                    startMeterText = startWalkMether + i18NObj.getTextValue('walkText')+ startStopName;
                    startWayText = i18NObj.getTextValue('rideBus') + startStopName;
                    startCountText = i18NObj.getTextValue('busDownStation1') + nextStopName + i18NObj.getTextValue('busDownStation2') +  this.englishNumberConvert(startStopCount) + i18NObj.getTextValue('busDownStation3');
                }
                else if(mapLang=="china_b" || mapLang=="china_g"){
                    startMeterText = i18NObj.getTextValue('walkText1') + startStopName + i18NObj.getTextValue('walkText2') + startWalkMether + i18NObj.getTextValue('walkText3');
                    startWayText = startStopName + i18NObj.getTextValue('rideBus');
                    startCountText = startStopCount + i18NObj.getTextValue('busDownStation1')+ nextStopName + i18NObj.getTextValue('busDownStation2');
                }
                else{
                    startMeterText = startStopName + i18NObj.getTextValue('walkText1')+ startWalkMether + i18NObj.getTextValue('walkText2');
                    startWayText = startStopName + i18NObj.getTextValue('rideBus');
                    startCountText = startStopCount + i18NObj.getTextValue('busDownStation1')+ nextStopName + i18NObj.getTextValue('busDownStation2');
                }
            }
            else{
                startNumber = objData.Path[_parentIndex].Start.Lane[0].SubName;
                startType = objData.Path[_parentIndex].Start.Lane[0].LaneID;
                startStopCount = objData.Path[_parentIndex].Start.SubStopCount;
                startWay = objData.Path[_parentIndex].Start.Way;

                startTitle = '(' + startStopName + i18NObj.getTextValue('station')+')';
                startImage = '/images/index2/subway_icon_img/'+ getConvertTrainImage(startType);

                // 00 으로  00 m 도보,
                // 00 에서 00 방면 열차타기
                // 00 정거장 이동 후 00 역에서 내리기
                if (mapLang=="eng"){
                    startWalkText = startWalkMether + i18NObj.getTextValue('walkText')+ startStopName;
                    startWayText = i18NObj.getTextValue('trainWayText1') + startWay + i18NObj.getTextValue('trainWayText2') + startStopName + '.';
                    startCountText = i18NObj.getTextValue('trainStopText1')+ nextStopName + i18NObj.getTextValue('trainStopText2') + this.englishNumberConvert(startStopCount) + i18NObj.getTextValue('trainStopText3') ;
                }
                else if(mapLang=="china_b" || mapLang=="china_g"){
                    startMeterText = i18NObj.getTextValue('walkText1') + startStopName + i18NObj.getTextValue('walkText2') + startWalkMether + i18NObj.getTextValue('walkText3');
                    startWayText = i18NObj.getTextValue('trainWayText1')+ startStopName + i18NObj.getTextValue('trainWayText2') + startWay + i18NObj.getTextValue('trainWayText3');
                    startCountText = i18NObj.getTextValue('trainStopText1')+ nextStopName + i18NObj.getTextValue('trainStopText2') + startStopCount + i18NObj.getTextValue('trainStopText3') ;
                }
                else{
                    startMeterText = startStopName + i18NObj.getTextValue('walkText1')+ startWalkMether + i18NObj.getTextValue('walkText2');
                    startWayText = startStopName + i18NObj.getTextValue('trainWayText1') + startWay + i18NObj.getTextValue('trainWayText2');
                    startCountText = startStopCount + i18NObj.getTextValue('trainStopText1')+' '+ nextStopName + i18NObj.getTextValue('trainStopText2');
                }
            }


            // 1.5  출발 점  설명하기...
            $("<div></div>").insertAfter($brotherDiv)
                            .attr('id', 'deselectedItem_sub_combine' + _index)
                            .addClass('contents_sub')
                            .css('border-top', '1px solid rgb(226, 226, 226)')
                            .append('<dl></dl>').children()
                                .addClass('contents_list')
                                .append('<dt></dt>').children()
                                    .append('<span></span>').children()
                                        .addClass('route_start')
                                        .html(i18NObj.getTextValue('start') + ' <a class="pName">'+ this.parentObj.parentObj.TextBoxModule.returnStartPointName() + '</a>')
                                        .parent()
                                    .parent()
                                .append('<dt></dt>').children('dt:last')
                                    .html(startMeterText)
                                    .parent()
                                .append('<dt></dt>').children('dt:last')
                                    .append('<img></img>').children('img')
                                        .addClass('bImg')
                                        .attr('src', startImage)
                                        .parent()
                                    .append('<a></a> ').children('a')
                                        .html('<strong>'+ startNumber +'</strong> ')
                                        .parent()
                                    .append(startTitle)
                                    .parent()
                                .append('<dt></dt>').children('dt:last')
                                    .html(startWayText)
                                    .parent()
                                .append('<dt></dt>').children('dt:last')
                                    .html(startCountText);



            // 2.1 환승 점  설명하기...
            if(objData.Path[_parentIndex].ExChange!=null){
                var exStopName  = null;
                var exNumber = null;
                var exType = 0;
                var exWay = null;
                var exStopCount = 0;
                var exImage = null;
                var exTitle = null;
                var exCountText = null;

                for(var exIndex=0; exIndex<objData.Path[_parentIndex].ExChange.length; exIndex++){
                    if(exIndex+1<objData.Path[_parentIndex].ExChange.length){
                        nextName = objData.Path[_parentIndex].ExChange[(exIndex+1)].Name;
                    }
                    else{
                        nextName = objData.Path[_parentIndex].End.Name;
                    }

                    // 2.2 지하철/버스  구분
                    if(!objData.Path[_parentIndex].ExChange[exIndex].SubStopCount){
                        exNumber = objData.Path[_parentIndex].ExChange[exIndex].Lane[0].BusNo;
                        exType = objData.Path[_parentIndex].ExChange[exIndex].Lane[0].type;
                        exStopCount = objData.Path[_parentIndex].ExChange[exIndex].BusStopCount;
                        exStopName = objData.Path[_parentIndex].ExChange[exIndex].Name;

                        exTitle = '(' + exStopName + ')';
                        exImage = '/images/index2/'+ busTypeImg(exType);

                        if (mapLang=="eng"){
                            exWayText = i18NObj.getTextValue('rideBus') + exStopName;
                            exCountText = i18NObj.getTextValue('busDownStation1') + nextStopName + i18NObj.getTextValue('busDownStation2') +  this.englishNumberConvert(exStopCount) + i18NObj.getTextValue('busDownStation3');
                        }
                        else if(mapLang=="china_b"){
                            exWayText = exStopName + i18NObj.getTextValue('rideBus');
                            exCountText = exStopCount + i18NObj.getTextValue('busDownStation1')+ nextStopName + i18NObj.getTextValue('busDownStation2');
                        }
                        else{
                            exWayText = exStopName + i18NObj.getTextValue('rideBus');
                            exCountText = exStopCount + i18NObj.getTextValue('busDownStation1')+ nextStopName + i18NObj.getTextValue('busDownStation2');
                        }
                    }
                    else{
                        exNumber = objData.Path[_parentIndex].ExChange[exIndex].Lane[0].SubName;
                        exType = objData.Path[_parentIndex].ExChange[exIndex].Lane[0].LaneID;
                        exStopCount = objData.Path[_parentIndex].ExChange[exIndex].SubStopCount;
                        exWay = objData.Path[_parentIndex].ExChange[exIndex].Way;
                        exStopName = objData.Path[_parentIndex].ExChange[exIndex].Name;

                        exTitle = '(' + exStopName + i18NObj.getTextValue('station')+')'
                        exImage = '/images/index2/subway_icon_img/'+ getConvertTrainImage(exType);

                        if (mapLang=="eng"){
                            exWayText = i18NObj.getTextValue('trainWayText1') + exWay + i18NObj.getTextValue('trainWayText2') + exStopName + '.';
                            exCountText = i18NObj.getTextValue('trainStopText1')+ nextName + i18NObj.getTextValue('trainStopText2') + this.englishNumberConvert(exStopCount) + i18NObj.getTextValue('trainStopText3') ;
                        }
                        else if(mapLang=="china_b"){
                            exWayText = i18NObj.getTextValue('trainWayText1')+ exStopName + i18NObj.getTextValue('trainWayText2') + exWay + i18NObj.getTextValue('trainWayText3');
                            exCountText = i18NObj.getTextValue('trainStopText1')+ nextName + i18NObj.getTextValue('trainStopText2') + exStopCount + i18NObj.getTextValue('trainStopText3') ;
                        }
                        else{
                            exWayText = exStopName + i18NObj.getTextValue('trainWayText1') + exWay + i18NObj.getTextValue('trainWayText2');
                            exCountText = exStopCount + i18NObj.getTextValue('trainStopText1')+' '+ nextName + i18NObj.getTextValue('trainStopText2');
                        }
                    }

                    // 2.8 전철 내용 표출..
                    $('#deselectedItem_sub_combine' + _index).children()
                                                    .append('<dt></dt>').children('dt:last')
                                                        .append('<img></img>').children('img')
                                                            .addClass('bImg')
                                                            .attr('src', exImage)
                                                            .parent()
                                                        .append('<a></a>').children('a')
                                                            .html('<strong>'+ exNumber +'</strong>')
                                                            .parent()
                                                        .append(exTitle)
                                                        .parent()
                                                    .append('<dt></dt>').children('dt:last')
                                                        .html(exWayText)
                                                        .parent()
                                                    .append('<dt></dt>').children('dt:last')
                                                        .html(exCountText);
                }
            }



            // 도착점 설명하기
            // 3.1. 도보 길이 계산
            var endPosition = new SPoint(Math.floor(objData.Path[_parentIndex].End.KX),
                                            Math.floor(objData.Path[_parentIndex].End.KY));
            var endWalkMether = Math.floor(this.parentObj.routeEndPoint.distance(endPosition));
            var endText = null;

            // 목적지까지 00 m 도보
            if (mapLang=="eng"){
                endText = endWalkMether + i18NObj.getTextValue('endText');
            }
            else{
                endText = i18NObj.getTextValue('endText1')+ endWalkMether + i18NObj.getTextValue('endText2');
            }

            $('#deselectedItem_sub_combine' + _index).children()
                                .append('<dt></dt>').children('dt:last')
                                    .html(endText)
                                    .parent()
                                .append('<dt></dt>').children('dt:last')
                                    .append('<span></span>').children()
                                        .addClass('route_end')
                                        .append(i18NObj.getTextValue('end'))
                                        .append('<a></a>').children('a')
                                            .addClass('pName')
                                            .append(this.parentObj.parentObj.TextBoxModule.returnEndPointName());

        }

        return false;
    },
    _displayTrainDetailInfo: function(_index, _parentIndex){
        var $brotherDiv = $('#deselectedItemSubtrain' + _index);

        $('#routeContainerTrain > .contents_sub').hide();

        if(this.$resultRealDataDiv.children().is('#deselectedItem_sub_train'+ _index)){
            $('#deselectedItem_sub_train'+ _index).show();
            return;
        }
        else{
            var startWalkMether = 0;
            var startStopTrainPosition = null;
            var startTrainStopName  = null;
            var startTrainNumber = null;
            var startTrainType = 0;
            var startStopCount = 0;
            var startTrainWay = null;
            var exBusCount = 0;
            var nextTrainName = null;

            var startWalkText = null;
            var startWayText = null;
            var startTrainDownText = null;

            // 1.1. 도보 길이 계산
            startTrainBusPosition = new SPoint(Math.floor(this.pathRainFindData.Result.Path[_parentIndex].Start.KX),
                    Math.floor(this.pathRainFindData.Result.Path[_parentIndex].Start.KY));
            startWalkMether = Math.floor(this.parentObj.routeStartPoint.distance(startTrainBusPosition));

            // 1.2. 전철 정류장 이름
            startTrainStopName = this.pathRainFindData.Result.Path[_parentIndex].Start.Name;
            // 1.3    전철 번호 구하기
            startTrainNumber = this.pathRainFindData.Result.Path[_parentIndex].Start.Lane[0].SubName;
            // 1.4    전철 타입 가져오기
            startTrainType = this.pathRainFindData.Result.Path[_parentIndex].Start.Lane[0].LaneID;
            // 1.5    전철 정류장 이동 갯수
            startStopCount = this.pathRainFindData.Result.Path[_parentIndex].Start.SubStopCount;
            // 1.6  전철 방면 구하기
            startTrainWay = this.pathRainFindData.Result.Path[_parentIndex].Start.Way;

            // 1.7 전철 다음정거장 이름 가져오기
            if(!this.pathRainFindData.Result.Path[_parentIndex].ExChange){
                nextTrainName = this.pathRainFindData.Result.Path[_parentIndex].End.Name;
            }
            else{
                nextTrainName = this.pathRainFindData.Result.Path[_parentIndex].ExChange[0].Name;
            }

            // 00 으로  00 m 도보,
            // 00 에서 00 방면 열차타기
            // 00 정거장 이동 후 00 역에서 내리기

            if (mapLang=="eng"){
                startWalkText = startWalkMether + i18NObj.getTextValue('walkText')+ startTrainStopName;
                startWayText = i18NObj.getTextValue('trainWayText1') + startTrainWay + i18NObj.getTextValue('trainWayText2') + startTrainStopName + '.';
                startTrainDownText = i18NObj.getTextValue('trainStopText1')+ nextTrainName + i18NObj.getTextValue('trainStopText2') + this.englishNumberConvert(startStopCount) + i18NObj.getTextValue('trainStopText3') ;
            }
            else if(mapLang=="china_b" || mapLang=="china_g"){
                startWalkText = i18NObj.getTextValue('walkText1') + startTrainStopName + i18NObj.getTextValue('walkText2') + startWalkMether + i18NObj.getTextValue('walkText3');
                startWayText = i18NObj.getTextValue('trainWayText1')+ startTrainStopName + i18NObj.getTextValue('trainWayText2') + startTrainWay + i18NObj.getTextValue('trainWayText3');
                startTrainDownText = i18NObj.getTextValue('trainStopText1')+ nextTrainName + i18NObj.getTextValue('trainStopText2') + startStopCount + i18NObj.getTextValue('trainStopText3') ;
            }
            else{
                startWalkText = startTrainStopName + i18NObj.getTextValue('walkText1')+ startWalkMether + i18NObj.getTextValue('walkText2');
                startWayText = startTrainStopName + i18NObj.getTextValue('trainWayText1') + startTrainWay + i18NObj.getTextValue('trainWayText2');
                startTrainDownText = startStopCount + i18NObj.getTextValue('trainStopText1')+' '+ nextTrainName + i18NObj.getTextValue('trainStopText2');
            }

            // 1.8  출발 점  설명하기...
            $("<div></div>").insertAfter($brotherDiv)
                            .attr('id', 'deselectedItem_sub_train' + _index)
                            .addClass('contents_sub')
                            .css('border-top', '1px solid rgb(226, 226, 226)')
                            .append('<dl></dl>').children()
                                .addClass('contents_list')
                                .append('<dt></dt>').children()
                                    .append('<span></span>').children()
                                        .addClass('route_start')
                                        .html(i18NObj.getTextValue('start')+' <a class="pName">'+ this.parentObj.parentObj.TextBoxModule.returnStartPointName() + '</a>')
                                        .parent()
                                    .parent()
                                .append('<dt></dt>').children('dt:last')
                                    .html(startWalkText)
                                    .parent()
                                .append('<dt></dt>').children('dt:last')
                                    .append('<img></img>').children('img')
                                        .addClass('bImg')
                                        .attr('src', '/images/index2/subway_icon_img/'+ getConvertTrainImage(startTrainType))
                                        .parent()
                                    .append('<a></a> ').children('a')
                                        .html('<strong>'+ startTrainNumber +'</strong> ')
                                        .parent()
                                    .append('(' + startTrainStopName + i18NObj.getTextValue('station') + ')')
                                    .parent()
                                .append('<dt></dt>').children('dt:last')
                                    .html(startWayText)
                                    .parent()
                                .append('<dt></dt>').children('dt:last')
                                    .html(startTrainDownText);

            // 2.1 환승 점  설명하기...
            if(this.pathRainFindData.Result.Path[_parentIndex].ExChange!=null){
                var exTrainStopName  = null;
                var exTrainNumber = null;
                var exTrainType = 0;
                var exWay = null;
                var exTrainWayText = null;
                var exTrainDownText = null;

                for(var exIndex=0; exIndex<this.pathRainFindData.Result.Path[_parentIndex].ExChange.length; exIndex++){
                    // 2.2. 전철  정류장 이름
                    exTrainStopName = this.pathRainFindData.Result.Path[_parentIndex].ExChange[exIndex].Name;
                    // 2.3    전철 호선 구하기
                    exTrainNumber = this.pathRainFindData.Result.Path[_parentIndex].ExChange[exIndex].Lane[0].SubName;
                    // 2.4   전철 정차 갯수 가져오기
                    exTrainStopCount = this.pathRainFindData.Result.Path[_parentIndex].ExChange[exIndex].SubStopCount;
                    // 2.5  전철  타입 가져오기
                    exTrainType = this.pathRainFindData.Result.Path[_parentIndex].ExChange[exIndex].Lane[0].LaneID;
                    // 2.6  전철 방면 가져오기
                    exWay = this.pathRainFindData.Result.Path[_parentIndex].ExChange[exIndex].Way;
                    // 2.7  전철 다음정거장 이름 가져오기
                    if(exIndex+1<this.pathRainFindData.Result.Path[_parentIndex].ExChange.length){
                        nextTrainName = this.pathRainFindData.Result.Path[_parentIndex].ExChange[(exIndex+1)].Name;
                    }
                    else{
                        nextTrainName = this.pathRainFindData.Result.Path[_parentIndex].End.Name;
                    }

                    if (mapLang=="eng"){
                        exTrainWayText = i18NObj.getTextValue('trainWayText1') + exWay + i18NObj.getTextValue('trainWayText2') + exTrainStopName + '.';
                        exTrainDownText = i18NObj.getTextValue('trainStopText1')+ nextTrainName + i18NObj.getTextValue('trainStopText2') + this.englishNumberConvert(exTrainStopCount) + i18NObj.getTextValue('trainStopText3') ;
                    }
                    else if(mapLang=="china_b"){
                        exTrainWayText = i18NObj.getTextValue('trainWayText1')+ exTrainStopName + i18NObj.getTextValue('trainWayText2') + exWay + i18NObj.getTextValue('trainWayText3');
                        exTrainDownText = i18NObj.getTextValue('trainStopText1')+ nextTrainName + i18NObj.getTextValue('trainStopText2') + exTrainStopCount + i18NObj.getTextValue('trainStopText3') ;
                    }
                    else{
                        exTrainWayText = exTrainStopName + i18NObj.getTextValue('trainWayText1') + exWay + i18NObj.getTextValue('trainWayText2');
                        exTrainDownText = exTrainStopCount + i18NObj.getTextValue('trainStopText1')+' '+ nextTrainName + i18NObj.getTextValue('trainStopText2');
                    }


                    // 2.8 전철 내용 표출..
                    $('#deselectedItem_sub_train' + _index).children()
                                                    .append('<dt></dt>').children('dt:last')
                                                        .append('<img></img>').children('img')
                                                            .addClass('bImg')
                                                            .attr('src', '/images/index2/subway_icon_img/'+ getConvertTrainImage(exTrainType))
                                                            .parent()
                                                        .append('<a></a>').children('a')
                                                            .html('<strong>'+ exTrainNumber +'</strong>')
                                                            .parent()
                                                        .append('(' + exTrainStopName + i18NObj.getTextValue('station')+ ')')
                                                        .parent()
                                                    .append('<dt></dt>').children('dt:last')
                                                        .html(exTrainWayText)
                                                        .parent()
                                                    .append('<dt></dt>').children('dt:last')
                                                        .html(exTrainDownText);
                }
            }

            // 도착점 설명하기
            // 3.1. 도보 길이 계산
            var endTrainPosition = new SPoint(Math.floor(this.pathRainFindData.Result.Path[_parentIndex].End.KX),
                    Math.floor(this.pathRainFindData.Result.Path[_parentIndex].End.KY));
            var endWalkMether = Math.floor(this.parentObj.routeEndPoint.distance(endTrainPosition));
            var endText = null;

            // 목적지까지 00 m 도보
            if (mapLang=="eng"){
                endText = endWalkMether + i18NObj.getTextValue('endText');
            }
            else{
                endText = i18NObj.getTextValue('endText1')+ endWalkMether + i18NObj.getTextValue('endText2');
            }

            $('#deselectedItem_sub_train' + _index).children()
                                .append('<dt></dt>').children('dt:last')
                                    .html(endText)
                                    .parent()
                                .append('<dt></dt>').children('dt:last')
                                    .append('<span></span>').children()
                                        .addClass('route_end')
                                        .append(i18NObj.getTextValue('end'))
                                        .append('<a></a>').children('a')
                                            .addClass('pName')
                                            .append(this.parentObj.parentObj.TextBoxModule.returnEndPointName());
        }

        return false;
    },
    _displayBusDetailInfo: function(_index, _parentIndex, _startIndex, _exchangeIndex, _exchangeSubIndex){
        var $brotherDiv = $('#deselectedItem' + _index);

        $('#routeContainer > .contents_sub').hide();

        if(this.$resultRealDataDiv.children().is('#deselectedItem_sub'+ _index)){
            $('#deselectedItem_sub'+ _index).show();
            return;
        }
        else{
            var startWalkMether = 0;
            var startStopBusPosition = null;
            var startBusStopName  = null;
            var startBusNumber = null;
            var startBusType = 0;
            var exBusCount = 0;
            var endBusCount = 0;

            var startWalkText = null;
            var startRideBus = null;

            // 1.1. 도보 길이 계산
            startStopBusPosition = new SPoint(Math.floor(this.pathFindData.Result.Path[_parentIndex].Start.KX),
                    Math.floor(this.pathFindData.Result.Path[_parentIndex].Start.KY));
            startWalkMether = Math.floor(this.parentObj.routeStartPoint.distance(startStopBusPosition));

            // 1.2. 버스 정류장 이름
            startBusStopName = this.pathFindData.Result.Path[_parentIndex].Start.Name;
            // 1.3   버스 번호 구하기
            startBusNumber = this.pathFindData.Result.Path[_parentIndex].Start.Lane[_startIndex].BusNo;
            // 1.4   버스 타입 가져오기
            startBusType = this.pathFindData.Result.Path[_parentIndex].Start.Lane[_startIndex].type;
            // 1.5   버스 정류장 이동 갯수
            if(_exchangeIndex!=null){
                exBusCount = this.pathFindData.Result.Path[_parentIndex].Start.BusStopCount
            }
            else{
                endBusCount = this.pathFindData.Result.Path[_parentIndex].Start.BusStopCount
            }

            // 00 으로  00 m 도보,
            // 00 버스정류장에서 타기
            if (mapLang=="eng"){
                startWalkText = startWalkMether + i18NObj.getTextValue('walkText')+ startBusStopName;
                startRideBus = i18NObj.getTextValue('rideBus') + startBusStopName;
            }
            else if(mapLang=="china_b" || mapLang=="china_g"){
                startWalkText = i18NObj.getTextValue('walkText1') + startBusStopName + i18NObj.getTextValue('walkText2') + startWalkMether + i18NObj.getTextValue('walkText3');
                startRideBus = startBusStopName + i18NObj.getTextValue('rideBus');
            }
            else{
                startWalkText = startBusStopName + i18NObj.getTextValue('walkText1')+ startWalkMether + i18NObj.getTextValue('walkText2');
                startRideBus = startBusStopName + i18NObj.getTextValue('rideBus');
            }

            // 1.6  출발 점  설명하기...
            $("<div></div>").insertAfter($brotherDiv)
                            .attr('id', 'deselectedItem_sub' + _index)
                            .addClass('contents_sub')
                            .append('<dl></dl>').children()
                                .addClass('contents_list')
                                .append('<dt></dt>').children()
                                    .append('<span></span>').children()
                                        .addClass('route_start')
                                        .html(i18NObj.getTextValue('start')+'  <a class="pName">'+ this.parentObj.parentObj.TextBoxModule.returnStartPointName() + '</a>')
                                        .parent()
                                    .parent()
                                .append('<dt></dt>').children('dt:last')
                                    .html(startWalkText)
                                    .parent()
                                .append('<dt></dt>').children('dt:last')
                                    .append('<img></img>').children()
                                        .addClass('bImg')
                                        .attr('src', '/images/index2/'+ busTypeImg(startBusType))
                                        .parent()
                                    .append('<a></a> ').children('a')
                                        .html('<strong>'+ startBusNumber +'</strong> ')
                                        .parent()
                                    .append(startBusStopName)
                                    .parent()
                                .append('<dt></dt>').children('dt:last')
                                    .html(startRideBus);

            // 2.1 환승 점  설명하기...
            if(_exchangeIndex!=null){
                var exWalkMether = 0;
                var exStopBusPosition = null;
                var exBusStopName  = null;
                var exBusNumber = null;
                var exBusType = 0;
                var exBusText = null;

                // 2.2. 버스 정류장 이름
                exBusStopName = this.pathFindData.Result.Path[_parentIndex].ExChange[_exchangeIndex].Name;
                // 2.3   버스 번호 구하기
                exBusNumber = this.pathFindData.Result.Path[_parentIndex].ExChange[_exchangeIndex].Lane[_exchangeSubIndex].BusNo;
                // 2.4  버스 정류장 가져오기
                exBusStopCount = this.pathFindData.Result.Path[_parentIndex].ExChange[_exchangeIndex].Lane[_exchangeSubIndex].BusStopCount;
                // 2.5  버스 타입 가져오기
                exBusType = this.pathFindData.Result.Path[_parentIndex].ExChange[_exchangeIndex].Lane[_exchangeSubIndex].type;
                // 2.6 버스 정류장 갯수 가져오기
                endBusCount = this.pathFindData.Result.Path[_parentIndex].ExChange[_exchangeIndex].BusStopCount;

                // 00 정거장 이동 후 00 버스정류장에서 내리기
                if (mapLang=="eng")
                    exBusText = i18NObj.getTextValue('busDownStation1') + exBusStopName + i18NObj.getTextValue('busDownStation2') +  this.englishNumberConvert(exBusStopCount) + i18NObj.getTextValue('busDownStation3');
                else
                    exBusText = exBusCount + i18NObj.getTextValue('busDownStation1')+ exBusStopName + i18NObj.getTextValue('busDownStation2');


                $('#deselectedItem_sub' + _index).children()
                                .append('<dt></dt>').children('dt:last')
                                    .html(exBusText)
                                    .parent()
                                .append('<dt></dt>').children('dt:last')
                                    .append(i18NObj.getTextValue('otherbus')+': ')
                                    .append('<img></img>').children('img')
                                        .addClass('bImg')
                                        .attr('src', '/images/index2/'+ busTypeImg(exBusType))
                                        .parent()
                                    .append('<a></a>').children('a')
                                        .html('<strong>'+ exBusNumber +'</strong>');
            }


            // 도착점 설명하기
            var endBusStopName = this.pathFindData.Result.Path[_parentIndex].End.Name;
            var endBusPosition = new SPoint(Math.floor(this.pathFindData.Result.Path[_parentIndex].End.KX),
                                    Math.floor(this.pathFindData.Result.Path[_parentIndex].End.KY));
            var endWalkMether = Math.floor(this.parentObj.routeEndPoint.distance(endBusPosition));
            var endText = null;
            var endBusText = null;


             // 00 정거장 이동 후 00 버스정류장에서 내리기
             // 목적지까지 00 m 도보
            if (mapLang=="eng"){
                endText = endWalkMether + i18NObj.getTextValue('endText');
                endBusText = i18NObj.getTextValue('busDownStation1') + endBusStopName + i18NObj.getTextValue('busDownStation2') +  this.englishNumberConvert(endBusCount) + i18NObj.getTextValue('busDownStation3');
            }
            else{
                endText = i18NObj.getTextValue('endText1')+ endWalkMether + i18NObj.getTextValue('endText2');
                endBusText = endBusCount + i18NObj.getTextValue('busDownStation1')+ endBusStopName + i18NObj.getTextValue('busDownStation2');
            }


            $('#deselectedItem_sub' + _index).children()
                                .append('<dt></dt>').children('dt:last')
                                    .html(endBusText)
                                    .parent()
                                .append('<dt></dt>').children('dt:last')
                                    .html(endText)
                                    .parent()
                                .append('<dt></dt>').children('dt:last')
                                    .append('<span></span>').children()
                                        .addClass('route_end')
                                        .append(i18NObj.getTextValue('end'))
                                        .append('<a></a>').children('a')
                                            .addClass('pName')
                                            .append(this.parentObj.parentObj.TextBoxModule.returnEndPointName());
        }

        return false;

    },
    viewCommonHead: function(){
        var targetData = null;

        switch(this.getOpt()){
            case BusRoutingSearchModule.BUS_SEARCH:
                this.toogleBusImage();
                targetData = this.pathFindData;
                break;
            case BusRoutingSearchModule.RAIN_SEARCH:
                this.toogleTrainImage();
                targetData  = this.pathRainFindData;
                break;
            case BusRoutingSearchModule.COMBINE_SARCH:
                this.toogleCombineImage();
                targetData = this.pathCombineFindData;
                break;
        }

        if(!targetData.Result.Path){
            this.viewResultCount();
            this.viewResultCountDetail(0);
            this.viewNotFound();
            return false;
        }

        this.viewResultCount();
        this.viewDataHeadCommon();

        return true;
    },
    viewResultCount: function(){
        var targetObjtargetObj = null;
        var targetId = null;

        switch(this.getOpt()){
            case BusRoutingSearchModule.BUS_SEARCH:
                targetObj = this.$resultDiv;
                targetId = 'bus_sch_title';
                break;
            case BusRoutingSearchModule.RAIN_SEARCH:
                targetObj = this.$resultTrainDiv;
                targetId = 'train_sch_title';
                break;
            case BusRoutingSearchModule.COMBINE_SARCH:
                targetObj = this.$resultCombineDiv;
                targetId = 'combine_sch_title';
                break;
        }

        $("<div></div>").appendTo(targetObj)
                    .attr('id', targetId)
                    .addClass('bus_sch_title')
                    .append('<strong></strong>');
    },
    viewResultCountDetail: function(_totalCount){
        var targetId = null;

        switch(this.getOpt()){
            case BusRoutingSearchModule.BUS_SEARCH:
                targetId = 'bus_sch_title';
                break;
            case BusRoutingSearchModule.RAIN_SEARCH:
                targetId = 'train_sch_title';
                break;
            case BusRoutingSearchModule.COMBINE_SARCH:
                targetId = 'combine_sch_title';
                break;
        }

        $("#"+ targetId + " > strong").html(
                            i18NObj.getTextValue('searchResultTitle') +
                            " ("+ _totalCount + ' ' + i18NObj.getTextValue('searchResultCount') + ")");
    },
    viewDataHeadCommon: function(){
        var classId = 'sch_way';

        switch(this.getOpt()) {
            case BusRoutingSearchModule.BUS_SEARCH:
               targetObj = this.$resultDiv;
               contentId = 'routeContainer';
               break;
            case BusRoutingSearchModule.RAIN_SEARCH:
               targetObj = this.$resultTrainDiv;
               contentId = 'routeContainerTrain';
               break;
            case BusRoutingSearchModule.COMBINE_SARCH:
               targetObj = this.$resultCombineDiv;
               contentId = 'routeContainerCombine';
               break;
        }

        if (enum_BrowserType.IE) {
            classId = 'sch_way_IE';
        }

        $("<div></div>").appendTo(targetObj)
                        .attr('id', classId)
                        .css('height', Math.abs($(window).height()-345))
                        .append('<div></div>')
                        .children().attr('id', contentId).addClass('routeContainer')
                        .css('height', Math.abs($(window).height()-345));
        this.$resultRealDataDiv = $('#'+ contentId);
    },
    emptyBusData: function(){
        this.$resultDiv.empty();
        this.divLoop = 0;
    },
    emptyTrainData: function(){
        this.$resultTrainDiv.empty();
        this.divLoop = 0;
    },
    emptyCombineData: function(){
        this.$resultCombineDiv.empty();
        this.divLoop = 0;
    },
    unloadPolyLine: function(){
        if(this.polyLineObj!=null)
            this.polyLineObj.unload();

        this.polyLineObj = null;
    },
    unLoadModule: function(){
        this.unloadPolyLine();
    },
    viewLane: function(){
        this.unloadPolyLine();

        this.polyLineObj = new SPolyline();

        var transCoord = sortLinkInfoOfJson(this.pathLaneData);

        for (var index=0; index< transCoord.getLaneLength();index++){
            for (var subIndex=0; subIndex< transCoord.getLanePerLinkLength(index);subIndex++){

                var x = transCoord.getLaneInformationX(index, subIndex);
                var y = transCoord.getLaneInformationY(index, subIndex);

                this.polyLineObj.addPoints(new SPoint(x, y));
            }
        }

        this.polyLineObj.opacity = BusResultParsingViewer.POLYLINE_OPACITY;
        this.polyLineObj.setWeight(BusResultParsingViewer.POLYLINE_WEIGHT);
        if (this.getOpt()==BusRoutingSearchModule.BUS_SEARCH)
            this.polyLineObj.color = BusResultParsingViewer.POLYLINE_BUS_COLOR;
        else
            this.polyLineObj.color = BusResultParsingViewer.POLYLINE_TRAIN_COLOR;

        mapObj.addOverlay(this.polyLineObj);
        var polyBound = this.polyLineObj.getBound();
        setPoiLevelAndFitting(mapObj.viewSize.width, mapObj.viewSize.height,
                                polyBound[0], polyBound[2], polyBound[3], polyBound[1]);
    },
    walkDistance: function(_distance){
        var min = parseInt(_distance/60);
        var targetObj = null;
        var contentId = null;
        var distanceText = null;

        switch(this.getOpt()) {
            case BusRoutingSearchModule.BUS_SEARCH:
               targetObj = this.$resultDiv;
               contentId = 'routeContainer';
               break;
            case BusRoutingSearchModule.RAIN_SEARCH:
               targetObj = this.$resultTrainDiv;
               contentId = 'routeContainerTrain';
               break;
            case BusRoutingSearchModule.COMBINE_SARCH:
               targetObj = this.$resultCombineDiv;
               contentId = 'routeContainerCombine';
               break;
        }
        $('#contentLoading').hide();



        $("<div></div>").appendTo(targetObj)
                        .attr('id', 'sch_way')
                        .append('<div></div>')
                        .children().attr('id', contentId).addClass('nonerouteContainer');
        this.$resultRealDataDiv = $('#'+ contentId);


        // 출발지와 도착지 간 직선거리가 920m(약 분)로, 도보 이동이 더 편리할 수 있습니다. (평균 도보 속도 기준)
        distanceText = i18NObj.getTextValue('distanceError1') +
                          _distance +
                          i18NObj.getTextValue('distanceError2') +
                          Math.max(min, 1) +
                          i18NObj.getTextValue('distanceError3');


        $("<div></div>").appendTo(this.$resultRealDataDiv)
                        .append('<strong></strong>').children()
                                                    .html(distanceText);
    },
    viewNotFound: function(){
        var targetObj = null;

        switch(this.getOpt()) {
            case BusRoutingSearchModule.BUS_SEARCH:
               targetObj = this.$resultDiv;
               break;
            case BusRoutingSearchModule.RAIN_SEARCH:
               targetObj = this.$resultTrainDiv;
               break;
            case BusRoutingSearchModule.COMBINE_SARCH:
               targetObj = this.$resultCombineDiv;
               break;
        }

        $("<div></div>").appendTo(targetObj)
                        .addClass('contents_sub')
                        .append('<a></a>').children()
                                .html(i18NObj.getTextValue('searchNotResult'));
    },
    viewResultPannelHide: function(){
        $('.bus_result').children('div:gt(0)').hide();
    },
    viewResultPannelBusView: function(){
        $('#bus_result_route').show();
    },
    viewResultPannelTrainView: function(){
        $('#train_result_route').show();
    },
    viewResultPannelCombineView: function(){
        $('#combine_result_route').show();
    },
    toogleBusImage: function(){
        $('#tabbus > img').attr('src', '/images/index2/'+ mapLang +'/tab_bus_p.gif');
        $('#tabsubway > img').attr('src', '/images/index2/'+ mapLang +'/tab_subway.gif');
        $('#tabbussubwqy > img').attr('src', '/images/index2/'+ mapLang +'/tab_bussubway.gif');
    },
    toogleTrainImage: function(){
        $('#tabbus > img').attr('src', '/images/index2/'+ mapLang +'/tab_bus.gif');
        $('#tabsubway > img').attr('src', '/images/index2/'+ mapLang +'/tab_subway_p.gif');
        $('#tabbussubwqy > img').attr('src', '/images/index2/'+ mapLang +'/tab_bussubway.gif');
    },
    toogleCombineImage: function(){
        $('#tabbus > img').attr('src', '/images/index2/'+ mapLang +'/tab_bus.gif');
        $('#tabsubway > img').attr('src', '/images/index2/'+ mapLang +'/tab_subway.gif');
        $('#tabbussubwqy > img').attr('src', '/images/index2/'+ mapLang +'/tab_bussubway_p.gif');
    },
    englishNumberConvert: function(_number){
        var rtnText = null;

        switch(_number){
            case 1:
                rtnText = _number + '<SUP>st</SUP>';
                break;
            case 2:
                rtnText = _number + '<SUP>nd</SUP>';
                break;
            case 3:
                rtnText = _number + '<SUP>rd</SUP>';
                break;
            default:
                rtnText = _number + '<SUP>th</SUP>';
                break;
        }

        return rtnText;
    },
    _englishStopCount: function(_number, textId){
        var rtnText = null;

        if (mapLang == "eng") {
            if(_number>1)
                rtnText = i18NObj.getTextValue('stop(s)');
            else
                rtnText = i18NObj.getTextValue(textId);
        }
        else{
            rtnText = i18NObj.getTextValue(textId);
        }

        return rtnText;
    }
}

function BusmakeReverseGeocodingParemeter(_x, _y) {
    var paramF = 'json';
    var paramKey = '';
    var paramRq = 'reversegeocoding';
    var paramLang = mapLang;
    var paramPoint = _x + ',' + _y;

    this.AJAX_URL_PARAM = 'f=' + paramF // + '&key=' + paramKey
            + '&rq=' + paramRq + '&lang=' + paramLang + '&point=' + paramPoint;

    var resultAddressName = '';

    $.ajax( {
        type : "POST",
        url : AJAX_MAP_OPEN_API,
        data : "svcCode=uTourOnion&" + this.AJAX_URL_PARAM,
        async : false,
        dataType : "json",
        success : function(data) {
            resultAddressName = returnBusReverseGeocoding(data);
        }
    });

    return resultAddressName;
};

function returnBusReverseGeocoding(data) {
    if (!data)
        return '-';

    if (!data.Mapot.Response.ReverseGeocoding.Placemark.name)
        return '-';

    var tempAddress = data.Mapot.Response.ReverseGeocoding.Placemark.name
            .substring(data.Mapot.Response.ReverseGeocoding.Placemark.name
                    .indexOf(",") + 1);
    tempAddress = ReplaceAll(tempAddress, ',', ' ');
    tempAddress = ReplaceAll(tempAddress, 'null', ' ');

    return tempAddress;
};

function goBusSearchResultPage(pageNum) {
    $("#pageNum").attr('value', pageNum);
    busStartRouteControl.searchPagingPoiExecute.call(busStartRouteControl);
}

/**
 * 버스 결과 버튼
 */
function callPathBus(){
    if(busStartRouteControl.busRoutingSearchModule.busResultViewer.getOpt()==BusRoutingSearchModule.BUS_SEARCH){
        return false;
    }

    busStartRouteControl.busRoutingSearchModule.busResultViewer.setOpt(BusRoutingSearchModule.BUS_SEARCH);
    busStartRouteControl.busRoutingSearchModule.busResultViewer.toogleBusImage();
    busStartRouteControl.busRoutingSearchModule.busResultViewer.viewResultPannelHide();

    if($('#bus_result_route').children().is('div')){
        $('#bus_result_route').show();
    }
}

/**
 * 지하철 결과 버튼
 */
function callPathSubway(){
    if(busStartRouteControl.busRoutingSearchModule.busResultViewer.getOpt()==BusRoutingSearchModule.RAIN_SEARCH){
        return false;
    }

    busStartRouteControl.busRoutingSearchModule.busResultViewer.setOpt(BusRoutingSearchModule.RAIN_SEARCH);
    busStartRouteControl.busRoutingSearchModule.busResultViewer.toogleTrainImage();

    if($('#train_result_route').children().is('div')){
        busStartRouteControl.busRoutingSearchModule.busResultViewer.viewResultPannelHide();
        $('#train_result_route').show();
    }
    else{
        busStartRouteControl.busRoutingSearchModule.executeTrain();
    }
}

/**
 * 버스 + 지하철 결과 버튼
 */
function callPathBusSubway(){
    if(busStartRouteControl.busRoutingSearchModule.busResultViewer.getOpt()==BusRoutingSearchModule.COMBINE_SARCH){
        return false;
    }

    busStartRouteControl.busRoutingSearchModule.busResultViewer.setOpt(BusRoutingSearchModule.COMBINE_SARCH);
    busStartRouteControl.busRoutingSearchModule.busResultViewer.toogleCombineImage();

    if($('#combine_result_route').children().is('div')){
        busStartRouteControl.busRoutingSearchModule.busResultViewer.viewResultPannelHide();
        $('#combine_result_route').show();
    }
    else{
        busStartRouteControl.busRoutingSearchModule.executeBusTrain();
    }
}

function getConvertTrainImage(trainType){
    var trainImage = null;

    switch(trainType){
        case 0:			// 수도권 중앙선
            trainImage = 'i_subway_0.gif';
            break;
        case 1:			// 1 호선
        case 11:
        case 12:
        case 13:
        case 18:
            trainImage = 'i_subway_1.gif';
            break;
        case 2:			// 2호선
        case 14:
        case 15:
            trainImage = 'i_subway_2.gif';
            break;
        case 3:
            trainImage = 'i_subway_3.gif';
            break;
        case 4:
            trainImage = 'i_subway_4.gif';
            break;
        case 5:			// 5호선
        case 16:
        case 17:
            trainImage = 'i_subway_5.gif';
            break;
        case 6:
            trainImage = 'i_subway_6.gif';
            break;
        case 7:
            trainImage = 'i_subway_7.gif';
            break;
        case 8:       	// 수도권 8호선
            trainImage = 'i_subway_8.gif';
            break;
        case 9:       	// 수도권 9호선
            trainImage = 'i_subway_9.gif';
            break;
        case 100:     	// 수도권 분당선
            trainImage = 'i_subway_bun.gif';
            break;
        case 101:     	// 수도권 공항철도
            trainImage = 'i_subway_gong.gif';
            break;
        case 103:     	// 수도권 중앙선
            trainImage = 'i_subway_jung.gif';
            break;
        case 21:      	// 인천 1호선
            trainImage = 'i_subway_in.gif';
            break;
        default :
            trainImage = '';
            break;
    }

    return trainImage;
}

var BusRouteLineInfo = null;
