﻿var vM =    null;               //地图对象
var vMe =   null;               //鹰眼对象

var _DebugControl;              //纠错控件

var _ZoomBar = null;            //缩放工具条
var _TabControl;                //选项卡
var _EntityPopControl;          //实体Pop
var _CompanyPopControl;         //企业Pop
var _EShopPopControl;           //E店Pop
var _BusStationControl;         //公交Pop
var _ThemePopControl;           //主题Pop
var _CommendPopControl;         //推荐Pop
var _FromSearchControl;         //这里出发Pop
var _ToSearchControl;           //到达这里Pop

var _MapExpandingState = true;       //标记地图搜索栏收缩状态
var _MapFullScreenState = false;       //标记地图是否为全屏状态
var _IsBeginSelectMark = false;  //是否开始标记
var _IsBeginScale = false;  //是否开始测距
var __IsDrawBusLineState = false; //标记当前是公交站点的画线图层还是换乘的画线图层

var _IconLayer;             //小图标图层
var _EyeIconLayer;           //鹰眼图标图层
var _BusTransferLineLayer;          //公交换乘线图层
var _PopLayer;
var _ShowScaleLayer;        
var _ShowMessageBoxLayer;       
var _BusStationLayer;

var _BusLineCoordList = [];        //公交线路坐标
var _BusLineData = null;           //公交站点数据
var _BusLineType = 0;              //线路正向还是反向

var _EAddressRegTab = null;
var _EAddressManagerTab = null;
var _EAddressStatus = 0; //0：申请，1：管理
var _IsBeginSelectEAddress = false;
var _LoginCallback = null;//登录完成后的回调函数

var _EAddressOperatorType = 0;

// add by HQ 20090614
var cPeripheralSearchControl;   //周边搜索控件
var cSearchResultControl;       //搜索结果列表控件

function fnLoadInit(){
    //加载对象
    if(typeof vEdushiMap =='undefined' || typeof vEdushiMap.Body.NewMapLayer !='function'  || typeof veyeEdushiMap =='undefined' ||  typeof veyeEdushiMap.Body.NewMapLayer !='function')
    {
        setTimeout("fnLoadInit()",300);
        return;
    }
    vM  = vEdushiMap;
    vMe = veyeEdushiMap;    
    //vM.Body.flgShowPlot = false;
    vM.Body.flgContextMenu = true;
    window.onresize();
    
    _IconLayer = vM.NewMapLayer('Icon',269, 0);
    _EyeIconLayer = vMe.NewMapLayer('Icon', 264, 0);
    _PopLayer = vM.NewMapLayer('Pop',269, 0);
    _MarkLayer = vM.NewMapLayer('Mark', 265, 0);//标记图层
    _BusTransferLineLayer = vM.NewMapLayer('BusTransferLine', 149);//公交线路
    _ShowScaleLayer = vM.NewMapLayer('Scale', 260);//显示测距
    _ShowMessageBoxLayer = vM.NewMapLayer('message', 300);
    _BusStationLayer = vM.NewMapLayer('BusStation', 261);
    
    //加载企业信息
    fnShowInitCompanyInfo();
   // fnAddMarkCss();
    
//    //初始化广告
//    fnInitPicAD();
//    //下载主题地图分类列表
//    fnLoadThemeMapsTypeList();
//    //下载热门关键字
//    fnLoadHotKey(); 
//    //下载常用位置
//    fnLoadCommonGoTo();   
//    
//    //初始化各种Pop add by HQ 20090614
    fnInitPopControl();
    
    
    //初始化查询结果面板 add by HQ 20090614
	fnInitSearchResult();
		
		
//    //初始化选项卡
//    fnInitTabControl();
//    //初始化滚动新闻列表
//    fnLoadNewsList();
//    
    //滑竿缩放
    _ZoomBar = new ZoomBarClass();
    _ZoomBar.Init();    
    vM.onMapZoomChange = function(z){
        _ZoomBar.ZoomTo(vM.Zoom());
        vMe.FlatZoom(vM.Zoom());
        if(__IsDrawBusLineState)
        {
            fnShowBusStationIco(_BusLineData, _BusLineType);
        }
        else
        {
            fnDrawingBusLine(_BusLineCoordList);
        }
    };
    
    //地图鹰眼联动
//    vMe.onMapMoveEnd = function(x,y,flg){
//        if(vM.MapState()!=0)
//        {
//            if(__IsDrawBusLineState)
//            {
//                fnShowBusStationIco(_BusLineData, _BusLineType);
//            }
//            else
//            {
//                fnDrawingBusLine(_BusLineCoordList);
//            }
//        }
//        if(flg==0){vM.MoveTo(x,y,true);}
//    };

// 以上的事件是alading的新程序支持的，我们的版本不支持，采用下边的方法

    vMe.onMapMoveEnd = function(x,y,flg){
        if(flg==0){vM.MoveTo(x,y,true);}
    };
    //地图移动
    vM.onMapMoveEnd = function(x,y,flg){
        if(flg==0){vMe.MoveTo(x,y,true);}
    };   
    //测距结束 
    vM.onScaleEnd = function(dis){
        //fnShowScaleResult(dis);
		//暂时屏蔽测试结束的提示，现在的程序不支持 王同超 2009-03-09
    };
    //地图双击事件
    vM.onMapDblClick = function(e){
        if (!_IsBeginScale){
            if (vM.Zoom() >0){
                vM.MoveTo(vM.PointerX(),vM.PointerY());
                vMe.MoveTo(vM.PointerX(),vM.PointerY());
                vM.FlatZoom(0);
            }
            else{
                vM.MoveTo(vM.PointerX(),vM.PointerY(),true);
                vMe.MoveTo(vM.PointerX(),vM.PointerY(),true);
            }
        }
        _IsBeginScale = false; 
    };
    vM.onMapMouseUp = function(e){
        if (_IsBeginSelectMark){
           _Mark.Add(vM.PointerX(),vM.PointerY(),'');
        }
        if(_IsBeginSelectEAddress){
            _EAddress.Add(vM.PointerX(),vM.PointerY(),'','');
        }
    };

    // 实体热区点击事件 add by HQ 20090618
    vM.onSpotClick = function(spot)
    {
        cSearchResultControl.EntityCompanySearch(spot.ID, spot.OwnerName, spot.CenterX, spot.CenterY);
   	}
   		
   		
    //加载扩展插件
    if (typeof _PluginList != 'undefined')
    {
        for (var i=0; i<_PluginList.length; i++)
        {
            if (typeof _PluginList[i].Init == 'function')
            {
                _PluginList[i].Init();
            }
        }
    }
//    ENetwork.DownloadScript('http://www.google-analytics.com/urchin.js',function(){
//        if(typeof urchinTracker != 'undefined'){
//            _uacct = GlobalConfig.GoogleID;
//            urchinTracker();
//        }
//    });
}
function fnShowScaleResult(dis){
    fnShowMessageBox('测距', '<div class="P">本次测距总长：<strong id="distance">'+dis+'</strong>。</div><div class="P">以上数据仅供参考，请以实际长度为准。</div>');
}
//初始化Pop广告和搜索广告
function fnInitPicAD(){
//    var sADUrl =  'Ad/ImageAd.aspx?domain=&l=';
//    ENetwork.DownloadScript(sADUrl,function(){
//        if(typeof _StaticAd =='undefined'){ 
//            return false;
//        }
//        else{
//            return true;
//        }
//    });
    //判断是否来源Pop广告
    var C_ID = fnRequest('cid');
    var O_ID = fnRequest('oid');
    if (/.+?\?\d+$/gi.test(window.document.location.href)){
        O_ID = window.document.location.href.replace(/^.+?\?/gi, '');
    }
    if((C_ID!=''|| O_ID!='')&&(C_ID*1>0||O_ID*1>0)){
        if(document.referrer!=''){
            window.__IsSourceAD = true; //是否是来源定位
        }
    }
}

// 显示首页打开默认的企业
function fnShowInitCompanyInfo()
{
    var c_id = fnRequest('c_id');
    var x;
    var y;
    G.getJSON("GetCompanyInfo.ashx" ,{"c_id":c_id}, function(json){
    x = json.X;
    y = json.Y;
    if(x == null || x == "" || y == null || y == "")
    {
        return ;
    }
    else
    {
        fnShowSearchPop(c_id,x,y);
    }
    }); 
}

//显示纠错 flag:0-实体 1-企业
function fnShowDebugControl(x, y, id, name, flag){
    if (!_DebugControl){
        _DebugControl = new DebugControl(vM.Body.document);
        _DebugControl.ID = vM.appendEntity(_DebugControl.Body, _PopLayer, false, x, y, 300, 240, 0, 38, false);
        _DebugControl.Width = 300;
        _DebugControl.Height = 245;
        _DebugControl.ResumeLayout();
        _DebugControl.Debug(id, name, flag, x, y);
    }
    else{
        vM.moveEntity(_DebugControl.ID, x, y);
        _DebugControl.Show();
        _DebugControl.Debug(id, name, flag, x, y);
    }
}
//隐藏纠错控件
function fnHideDebugControl(){
    _DebugControl.Hide();
}
function fnAddMarkCss()
{
    var MarkCss=vM.$C('link');
    MarkCss.rel='stylesheet';
    MarkCss.type = 'text/css';
    MarkCss.href='Css/Mark.css';
    vM.Body.document.getElementsByTagName('head')[0].appendChild(MarkCss);
}
//初始化选项卡
function fnInitTabControl()
{
    if(!_TabControl)
    {
        var HeadContainer = $('HeadContainer');
        var BodyContainer = $('BodyContainer');
        var LeftBtn = $('LeftBtn');
        var RightBtn = $('RightBtn');
        _TabControl = new TabControl(HeadContainer,BodyContainer,LeftBtn,RightBtn);
    }
}

//立体黄页搜索，王同超 090318

function fnLocalSearch()
{
    var searchkey = escape($(wd).value.trim());
    if(searchkey == "" || searchkey == "请输入所查找的信息关键字或者电话")
    {
        $("wd").focus();
        return false;
    }
    else
    {
        var searchUrl = "LocalSearch.aspx?wd=" + searchkey;
        $("BodyContainer").innerHTML = "正在获取企业动态信息请稍候..."; 
        
        $("BodyContainer").innerHTML = "<iframe frameborder=0 width=100% height=519 allowTransparency=true scrolling=no src="+searchUrl+"></iframe>"; 
        
    }
}

//企业、房产切换
function fnIndexSwitch(channel)
{
    switch(channel)
    {
        case "company":
             $("BodyContainer").innerHTML = "正在获取企业动态信息请稍候..."; 
             $("BodyContainer").innerHTML = "<iframe frameborder=0 width=100% height=556px allowTransparency=true scrolling=no src=TypeList.aspx?s_type=&s_keyword=&s_display=></iframe>"; 
            break;
        case "house":
             $("BodyContainer").innerHTML = "正在获取房产信息请稍候..."; 
             $("BodyContainer").innerHTML = "<iframe frameborder=0  width=100% height=556px allowTransparency=true scrolling=no src=house/search_result_114.asp></iframe>"; 
            break;
        default:
             $("BodyContainer").innerHTML = "正在获取企业动态信息请稍候..."; 
             $("BodyContainer").innerHTML = "<iframe frameborder=0 width=100% height=556px allowTransparency=true scrolling=no src=TypeList.aspx?s_type=&s_keyword=&s_display=></iframe>"; 
    
    }
}

//区县导航 王同超 090330
function fnQX(area)
{
    switch(area)
   {
       case "zhangdian":
         vM.MoveTo(15232,10662,true);
         break;
       case "boshan":
         vM.MoveTo(-109793,36633,true);
         break;
       case "zichuan":
         vM.MoveTo(-48652,24640,true);
         break;
       case "linzi":
         vM.MoveTo(70168,43124,true);
         break;
       case "zhoucun":
         vM.MoveTo(-30284,-12851,true);
         break;
       case "huantai":
         vM.MoveTo(52768,-1208,true);
         break;
       case "gaoqing":
         vM.MoveTo(40904,-62096,true);
         break;
       case "yiyuan":
         vM.MoveTo(-84168,102320,true);
         break;
       default:
         vM.MoveTo(15232,10662,true);
   }
  fnChangeRegionColor(area);

}
function fnChangeRegionColor(region)
{
    //G("#region_select td div.region_s")[0].className="region";
    G("#region_select td div.region_s").each(function(){this.className="region"});
    G("#r_" + region )[0].className = "region_s";
}
//初始化Pop
function fnInitPopControl()
{
    // 重新定义右键菜单 by HQ 20090614
    //vM.Body.MenuContextMenu.Items['end'].SetCaption("速度");
    //vM.Body.MenuContextMenu.Items['zoomin'].key="zoomin1";
//    vM.Body.MenuContextMenu.Items['end'].visible = false;   //如何到达这里
//    vM.Body.MenuContextMenu.Items['start'].visible = false; //从这里出发
//    vM.Body.MenuContextMenu.Items['cirbus'].visible = false; //周边公交
//    vM.Body.MenuContextMenu.Items['sign'].visible = false; //标记该位
//    vM.Body.MenuContextMenu.Items['errors'].visible = false; //纠错
    vM.Body.MenuContextMenu.Items['about'].SetCaption("关于淄博信息港...");

    vM.Body.MenuContextMenu.Items['end'].style.display = 'none';   //如何到达这里
    vM.Body.MenuContextMenu.Items['start'].style.display = 'none'; //从这里出发
    vM.Body.MenuContextMenu.Items['cirbus'].style.display = 'none'; //周边公交
    vM.Body.MenuContextMenu.Items['sign'].style.display = 'none'; //标记该位
    vM.Body.MenuContextMenu.Items['errors'].style.display = 'none'; //纠错


    //王同超  重新定义
    vM.onContextMenuClick = function(key,wx,wy,mx,my,spot){
        switch (key){
            case 'center':
                vM.MoveTo(mx,my,true);
                break;
            case 'zoomout':
                vM.FlatZoom(vM.Zoom()+1);
                break;
            case 'zoomin':
                vM.FlatZoom(vM.Zoom()-1);
                break;  
            case 'cirsearch':
                if (spot){
                    fnShowPeripheralSearch(spot.CenterX, spot.CenterY, spot.Title);
                }
                else
                {
                    fnShowPeripheralSearch(vM.PointerX(), vM.PointerY(),'');
                }
                break; 
            case 'about':
                alert("ddd");
                fnShowMessageBox('关于全搜索…','<a href="http://www.zbinfo.net" target="_blank">淄博联通<br />http://www.zbinfo.net</a>');
                break;
        }
    };
}
//查找周边 add by HQ 20090614
function fnShowPeripheralSearch(){
	if (!cPeripheralSearchControl){
		cPeripheralSearchControl = new PeripheralSearchControl({Parent:vM});
		cPeripheralSearchControl.ID = vM.appendEntity(cPeripheralSearchControl.Body, _PopLayer, false, vM.PointerX(), vM.PointerY(), 303, 185, 0, 38, false);
		cPeripheralSearchControl.Width = 303;
		cPeripheralSearchControl.Height = 185;
		cPeripheralSearchControl.ResumeLayout();
		cPeripheralSearchControl.onLoadComplete = function(){
			cPeripheralSearchControl.ShowPeripheralSearch(vM.PointerX(), vM.PointerY());
		};
		cPeripheralSearchControl.onPeripheralSearch = function(keyword, x, y, area){
			cSearchResultControl.LocalNearBySearch(keyword, x, y, area);
		};
	}
	else{
		vM.moveEntity(cPeripheralSearchControl.ID, vM.PointerX(), vM.PointerY());
		cPeripheralSearchControl.ShowPeripheralSearch(vM.PointerX(), vM.PointerY());
	}
}
//搜索列表控件初始化
function fnInitSearchResult(){
	if (!cSearchResultControl){
		cSearchResultControl = new SearchResultControl();
		$("DragWindow").appendChild(cSearchResultControl.Body, _PopLayer, false, vM.PointerX(), vM.PointerY()+185, 303, 418, 0, 38, false);
		cSearchResultControl.Body.style.zIndex = 999;
		cSearchResultControl.Width = 303;
		cSearchResultControl.Height = 418;
		cSearchResultControl.ResumeLayout();
		cSearchResultControl.MoveTo(0, 0);
		cSearchResultControl.onLoadComplete = function(){
		};
	}
	else
	{
		cSearchResultControl.Show();
	}
}


function fnOpenTab()
{
    if(_MapFullScreenState){
        fnFullScreen($('aFullScrenn'));
        if(!_MapExpandingState){
            fnExpanding($('imgExpanding'));
        }
    }
    else{
        if(!_MapExpandingState){
            fnExpanding($('imgExpanding'));
        }
    }
}


//搜索结果点击调用的方法，判断是实体还是企业后调用不同的Pop
//function fnShowSearchPop(oid,cid,lstid,x,y)
//{
//    if(cid*1>0){
//        if(lstid>0){
//            fnShowEShopPop(cid,x,y);
//        }
//        else{
//            fnShowCompanyPop(cid,x,y);
//        }
//    }
//    else{
//        fnShowEntityPop(oid,x,y);
//    }
//}
//显示实体POP
function fnShowEntityPop(id,x,y)
{
    MoveTo(x*1  + vM.GetMapPos(170), y*1, true);
    vM.moveEntity(_EntityPopControl.ID, x*1, y*1);
    _EntityPopControl.ShowPop(id); 
}
//显示企业Pop
function fnShowCompanyPop(id,x,y)
{
    MoveTo(x*1  + vM.GetMapPos(170), y*1, true);
    vM.moveEntity(_CompanyPopControl.ID, x*1, y*1);
    _CompanyPopControl.ShowPop(id); 
}
//显示E店Pop
function fnShowEShopPop(id,x,y)
{
    MoveTo(x*1  + vM.GetMapPos(170), y*1, true);
    vM.moveEntity(_EShopPopControl.ID, x*1, y*1);
    _EShopPopControl.ShowPop(id); 
}
//显示主题Pop
function fnShowThemePop(id,x,y)
{
    MoveTo(x*1  + vM.GetMapPos(170), y*1, true);
    vM.moveEntity(_ThemePopControl.ID, x*1, y*1);
    _ThemePopControl.ShowPop(id); 
}
//显示推荐Pop根据主题ID
function ShowCommendPopById(id,x,y)
{
    MoveTo(x*1  + vM.GetMapPos(170), y*1, true);
    vM.moveEntity(_CommendPopControl.ID, x*1, y*1);
    _CommendPopControl.ShowPop(id);
}
//显示推荐Pop根据主题标题和内容
function ShowCommendPopByContent(title,content,x,y)
{
    MoveTo(x*1  + vM.GetMapPos(170), y*1, true);
    vM.moveEntity(_CommendPopControl.ID, x*1, y*1);
    _CommendPopControl.ShowPopData(x,y,title,content);
}

function fnCommonGoToClick(QuickLink)
{
    if (QuickLink.Flag == 0){        
        vM.MoveTo(QuickLink.x, QuickLink.y);
    }
    else if (QuickLink.Flag == 1){
        fnShowEntityPop(QuickLink.OwnerID, QuickLink.x, QuickLink.y);
    }
    else if (QuickLink.Flag == 2){
        fnShowCompanyPop(QuickLink.CompanyID, QuickLink.x, QuickLink.y);
    }
}          



//触发选项卡里的Iframe onresize事件
function fnAttachIframeResize()
{
    if(typeof _TabControl != 'undefined')
    {
        for(var i=0; i<_TabControl.TabList.length; i++)
        {
            _TabControl.TabList[i].TabBody.style.height = _TabControl.TabList[i].TabBody.parentNode.clientHeight - 8 +'px';
            _TabControl.TabList[i].resize();
        }
    }
}
//重写窗口缩放事件
window.onresize=function(){    
    var h = fnGetWindowHeight(),w = fnGetWindowWidth(); 
    if($('divDialog'))
    {
        $('divDialog').style.top = (h-120)/2 + 'px';
        $('divDialog').style.left = (w-300)/2 + 'px';
    }    
    if($('divDialogBg'))
    {
        $('divDialogBg').style.height = h + 'px';
        $('divDialogBg').style.width = w + 'px';
    }
    if($('divLoginDialog'))
    {
        $('divLoginDialog').style.top = (h-120)/2 + 'px';
        $('divLoginDialog').style.left = (w-300)/2 + 'px';
    }
    if(h<450||w<750)
    {
        h=450;
        w=750;
        document.body.style.width='750px';
        document.body.style.height = '450px';
    }
    else
    {
        document.body.style.width= w+'px';
        document.body.style.height = h+ 'px';
    }   
    if(_MapFullScreenState)
    {
        $('Header').style.display='none';
        $('Navigation').style.display = 'none';
        $('EdushiMap').style.top='0px';
        $('Content').style.marginRight = '0px';
        $('Content').style.width = w + 'px';        
        $('EdushiMap').style.width = w + 'px';
        $('EdushiMap').style.height= h-25 + 'px';    
        $('DetailMap').style.width = w + 'px';
        $('DetailMap').style.height= h-25 + 'px';
        $('Wrapper').style.width = w + 'px';
        $('Wrapper').style.height= h-25 + 'px';
        vEdushiMap.MapHeight(h-25);
        vEdushiMap.MapWidth(w);
    }
    else
    {        
        $('Header').style.display='block';
        $('Navigation').style.display = 'block';         
        if(_MapExpandingState)
        {
            $('NavContent').style.display = 'block';
            $('Content').style.marginRight = '340px';
            $('Content').style.width = w-340 + 'px';
            $('Navigation').style.marginLeft = '-340px';
            $('Navigation').style.width = '340px';
            $('EdushiMap').style.width = w-342 + 'px';
            $('DetailMap').style.width = w-342 + 'px';
            $('BodyContainer').style.height = h-200+'px';
            vM.MapWidth(w-342);            
        }
        else
        {
            $('NavContent').style.display = 'none';
            $('Content').style.marginRight = '11px';
            $('Content').style.width = w-11 + 'px';
            $('Navigation').style.marginLeft = '-13px';
            $('Navigation').style.width = '13px';
            $('EdushiMap').style.width = w-13 + 'px';
            $('DetailMap').style.width = w-13 + 'px';
            vM.MapWidth(w-13);  
        }   
        var iShrinkDHHeight = h-51;
        var iShrinkDHPaddingTop = (iShrinkDHHeight - 105)/2;
        $('ShrinkDH').style.paddingTop = iShrinkDHPaddingTop + 'px';
        $('ShrinkDH').style.height = (h-50-iShrinkDHPaddingTop) + 'px';
        $('NavContent').style.height = (h-59) + 'px';
        $('Navigation').style.height = (h-51) + 'px';  
        $('EdushiMap').style.height = h-76 + 'px';
        $('DetailMap').style.height = h-76 + 'px';
        $('Wrapper').style.height= h-76 + 'px';
        vM.MapHeight(h-76);        
    }
    //主题列表
//    $('divThemeMask').style.width = (w*0.6-100) + 'px';
//    $('divThemeClip').style.clip = 'rect(0px ' + (w*0.6-100) + 'px 22px 0px)';
    //fnAttachIframeResize();
    //fnInitThemeScroll();      
};
//添加小图标至地图与鹰眼中
function fnAppendIcon(title, x, y, text, sImgPath, sImgPath2, sFn, w, h, ew, eh, isAppendEye){
    if (sImgPath2.length == 0){
        sImgPath2 = sImgPath;
    }
    var iconHTML = '<div id="'+x+'_'+y+'" style ="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+sImgPath+'\',sizingMethod=\'image\');width:'+w+'px;height:'+h+'px; background-image:url('+sImgPath+')!important;background-image:none;cursor:pointer;" onclick="' + sFn + '" title="'+title+'"><span style="display:block;width:32px;line-height:33px;text-align:center;font-size:12px;font-family:\"宋体\";color:#930;">'+ text +'</span></div>';
    var p = vM.$C('div');
    p.innerHTML =iconHTML;
    vM.appendEntity(p, _IconLayer, false, x, y, w,h,ew,eh, false);
    vM.$(x+'_'+y).onmouseover = function (){
        if(document.all){
            this.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+sImgPath2+'\',sizingMethod=\'image\')';  
        }
        else{
            this.style.backgroundImage = null;
            this.style.backgroundImage='url(' + sImgPath2 + ')!important';
        }
    };
    vM.$(x+'_'+y).onmouseout  = function(){
        if(document.all){
            this.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+sImgPath+'\',sizingMethod=\'image\')';
        }
        else{  
            this.style.backgroundImage = null;
            this.style.backgroundImage='url(' + sImgPath + ')!important';
        }
    };
    if(isAppendEye){
        var pe = vMe.$C('div');
        pe.innerHTML = iconHTML;    
        vMe.appendEntity(pe, _EyeIconLayer, false, x, y, w,h,ew,eh, false);
        vMe.$(x+'_'+y).onmouseover = function (){
            if(document.all){
                this.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+sImgPath2+'\',sizingMethod=\'image\')';
            }
            else{  
                this.style.backgroundImage = null;
                this.style.backgroundImage="url(" + sImgPath2 + ")!important";
            }
        };
        vMe.$(x+'_'+y).onmouseout  = function(){
            if(document.all){
                this.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+sImgPath+'\',sizingMethod=\'image\')';  
            }
            else{
                this.style.backgroundImage = null;
                this.style.backgroundImage='url(' + sImgPath + ')!important';
            }
        }   
    } 
}
/*************登录部分*********************/

//搜索选项切换
function fnSearchChange(oThis)
{ 
    __EdushiSuggest.Hide();   
    switch(oThis.id)
    {         
        case 'liMapSearch':
            $('MapSearch').style.display = 'block';
            $('BusSearch').style.display = 'none';
            $('EShopSearch').style.display = 'none';
            $('EAddress').style.display = 'none';
            oThis.className = 'Current';
            $('liBusSearch').className = '';            
            $('liEShopSearch').className = ''; 
            $('liEAddress').className = '';            
            break;
        case 'liBusSearch':
            $('liEShopSearch').className = '';
            $('liMapSearch').className = '';
            oThis.className = 'Current';
            $('liEAddress').className = '';
            $('BusSearch').style.display = 'block';            
            $('MapSearch').style.display = 'none';           
            $('EShopSearch').style.display = 'none';
            $('EAddress').style.display = 'none';
            break;
        case 'liEShopSearch': 
            $('EShopSearch').style.display = 'block';            
            $('MapSearch').style.display = 'none';            
            $('BusSearch').style.display = 'none';
            $('EAddress').style.display = 'none';
            oThis.className = 'Current';
            $('liMapSearch').className = '';
            $('liBusSearch').className = '';
            $('liEAddress').className = '';
            break;
        case 'liEAddress':
            $('liEShopSearch').className = '';
            $('liBusSearch').className = '';
            $('liMapSearch').className = '';
            oThis.className = 'Current';
            $('EAddress').style.display = 'block';            
            $('MapSearch').style.display = 'none';           
            $('EShopSearch').style.display = 'none';
            $('BusSearch').style.display = 'none';
            fnNewEAddressList();
            break;
    }
    oThis.className = 'Current';
}  
//公交搜索切换
function fnBusSearchChange(sValue)
{
    __EdushiSuggest.Hide();
    switch (sValue)
    {        
        case '0':           
            $('BusTransfer').style.display='block';
            $('BusLine').style.display='none';
            $('BusStation').style.display='none';
            break;
        case '1':
            $('BusLine').style.display='block';
            $('BusTransfer').style.display='none';
            $('BusStation').style.display='none';
            break;
        case '2':
            $('BusStation').style.display='block';
            $('BusLine').style.display='none';
            $('BusTransfer').style.display='none';
            break;
    }
}
//地图搜索|公交搜索|E店搜索Suggest
function fnKeySearchSuggest(fn, input, x, y, w, type, reqtype, evt){
    if(input.value.trim().length < 1)
    {
        __EdushiSuggest.Hide();
        input.focus();
        return;
    }
    evt = window.event ? window.event : evt;
    var maptype;//地图|E店搜索类型
    if(reqtype != 0)
    {
        maptype = reqtype;
    }
    else
    {
        var iMapSearchType = GetRadioValue('MapSearchType'); 
        switch(iMapSearchType)
        {
            case '0':
                maptype = 2;    //模糊搜索
                break;
            case '1':
                maptype = 3;    //名称搜索
                break;
            case '2':
                maptype = 4;    //地址搜索
                break;
        }        
    }
    fnKeyInputChanged(input, evt.keyCode, x, y, w, type, maptype);
    if (evt.keyCode == 13 && __EdushiSuggest.SuggestPannel.style.display != 'block'){
        eval(fn);
        __EdushiSuggest.Hide();
    }
}

//地图搜索切换
function fnMapSearchChange(sValue)
{
    __EdushiSuggest.Hide();
    switch (sValue)
    {        
        case '0':            
            $('divSearch').style.display='block';
            $('divAroundSearch').style.display='none';
            break;
        case '1':            
            $('divSearch').style.display='block';
            $('divAroundSearch').style.display='none';
            break;
        case '2':
            $('divSearch').style.display='block';
            $('divAroundSearch').style.display='none';
            break;
        case '3':
            $('divSearch').style.display='none';
            $('divAroundSearch').style.display='block';
            break;
    }
} 
/*******************begin添加选项卡的函数集**********************/

//本地地图搜索结果回调
function onSearchDataLoadComplete(data,begin,end)
{
    _IconLayer.innerHTML = '';
    _EyeIconLayer.innerHTML = '';
    for (var i=begin; i<end; i++)
    {
        fnAppendIcon(data[i].OCName,data[i].X, data[i].Y, i+1,  'Images/VesicleBg.png',  'Images/AlterVesicle.png', 'if(parent.fnShowSearchPop){parent.fnShowSearchPop('+data[i].OwnerID+', '+data[i].CompanyID+','+data[i].LST_ID+',' + data[i].X + ', ' + data[i].Y + ');}',41,33,13,27,true);
    };
}
//主题数据加载结果回调
function onThemeDataLoadComplete(data)
{
    _IconLayer.innerHTML = '';
    _EyeIconLayer.innerHTML = '';
    if(data != null)
    {
        for (var i=0; i<data.length; i++)
        {
            if (data[i].BCC_CompanyICO != '') //判断是否有主题点图片
            {
                var sThemeImage =  'cn///themeImages/BBLCompany/' + data[i].BCC_CompanyICO;         
                if (data[i].BCC_CompanyID*1 == 0)
                {
                    fnAppendIcon(data[i].BCC_CompanyName,data[i].X, data[i].Y, i+1, sThemeImage, '', 'if(parent.ShowCommendPopById){parent.ShowCommendPopById('+data[i].BCC_ID+', ' + data[i].X + ', ' + data[i].Y + ');}',41,33,13,27,false);
                }
                else
                {
                    fnAppendIcon(data[i].BCC_CompanyName,data[i].X, data[i].Y, i+1, sThemeImage, '', 'if(parent.fnShowThemePop){('+data[i].BCC_ID+', ' + data[i].X + ', ' + data[i].Y + ');}',41,33,13,27,false);
                }
            }
            else
            {
                var sThemeImage =  'Images/ThMapIco.png';
                var sThemeOverImage =  'Images/AlterThMapIco.png';
                if (data[i].BCC_CompanyID*1 == 0)
                {
                    fnAppendIcon(data[i].BCC_CompanyName,data[i].X, data[i].Y, i+1, sThemeImage, sThemeOverImage, 'if(parent.ShowCommendPopById){parent.ShowCommendPopById('+data[i].BCC_ID+', ' + data[i].X + ', ' + data[i].Y + ');}',41,33,13,27,false);
                }
                else
                {
                    fnAppendIcon(data[i].BCC_CompanyName,data[i].X, data[i].Y, i+1, sThemeImage, sThemeOverImage, 'if(parent.fnShowThemePop){parent.fnShowThemePop('+data[i].BCC_ID+', ' + data[i].X + ', ' + data[i].Y + ');}',41,33,13,27,false);
                }
            }
        }
    }
}
//公交搜索
function fnBusSearch()
{    
    __EdushiSuggest.Hide();
    var iBusSearchType = GetRadioValue('BusSearchType');
    switch(iBusSearchType)
    {
        case '0':   //公交换乘搜索
            var sStartStation = $('txtBusStart').value.trim();
            if(sStartStation.length < 1)
            {
                $('txtBusStart').focus();
                return;
            }
            var sEndStation = $('txtBusEnd').value.trim();
            if(sEndStation.length < 1)
            {
                $('txtBusEnd').focus();
                return;
            }
            if(sStartStation == '起点' || sEndStation == '终点')
            {
                $('txtBusStart').focus();
                return;
            }
            fnAddBusTransferSearchTab(sStartStation,sEndStation);
            break;
        case '1':   //公交线路搜索
            var sBusNo = $('txtBusLine').value.trim();
            if(sBusNo.length < 1)
            {
                $('txtBusLine').focus();
                return;
            }
            if(sBusNo == '请输入要搜索的线路')
            {
                $('txtBusLine').focus();
                return;                
            }
            fnAddBusLineSearchTab(sBusNo);
            break;
        case '2':   //公交站点搜索
            var sStationName = $('txtBusStation').value.trim();
            if(sStationName.length < 1)
            {
                $('txtBusStation').focus();
                return;
            }
            if(sStartStation == '请输入站点名')
            {
                $('txtBusStation').focus();
                return;                
            }
            fnAddBusStationSearchTab(sStationName);
            break;
    }    
}

function fnAddTab(tab, height)
{
    if(!height)
    {
        tab.TabBody.style.height = '100%';
    }
    else
    {
        tab.TabBody.style.height = height;
    }
    _TabControl.AddTab(tab);
}

/*******************end添加选项卡**********************/
//初始化分类主题滚动效果
function fnInitThemeScroll()
{
    var ulThemeList = $('ulThemeList');
    var iLen = ulThemeList.childNodes.length;
    var iMaxWidth = 0;
    var iClipWidth = fnGetWindowWidth()*0.6-100;
    var iStepWidth = 5;
    var hwScroll;
    for (var i=0; i<iLen; i++)
    {
        if (ulThemeList.childNodes[i].tagName)
        {
            iMaxWidth += ulThemeList.childNodes[i].clientWidth + 10; //10像素是li的margin
        }
    }
    
    if (iMaxWidth <= iClipWidth)    //自适应浏览器分辨率
    {
        $('RollArLf').style.display = 'none';
        $('RollArRgt').style.display = 'none';
        ulThemeList.parentNode.style.left = '0px';
        return;
    }
    else
    {
        $('RollArLf').style.display = 'block';
        $('RollArRgt').style.display = 'block';
    }
    
    $('ImgThemeScrollLeft').onmouseover = function(){
        $('ImgThemeScrollLeft').style.cursor = 'pointer';
        window.clearInterval(hwScroll);
        hwScroll = setInterval(function(){
            var iLeft = ulThemeList.parentNode.style.left.replace('px', '')*1;
            if (iLeft + iStepWidth > 0)
            {
                ulThemeList.parentNode.style.left = '0px';
                window.clearInterval(hwScroll);
            }
            else
            {
                ulThemeList.parentNode.style.left = (iLeft + iStepWidth) + 'px';
            }
        }, 20);
    };
    $('ImgThemeScrollRight').onmouseover = function(){
        $('ImgThemeScrollRight').style.cursor = 'pointer';
        window.clearInterval(hwScroll);
        hwScroll = setInterval(function(){
            var iLeft = ulThemeList.parentNode.style.left.replace('px', '')*1;
            if ((iLeft*-1 + iClipWidth + iStepWidth) >= iMaxWidth)
            {
                ulThemeList.parentNode.style.left = (iClipWidth - iMaxWidth) + 'px';
                window.clearInterval(hwScroll);
            }
            else
            {
                ulThemeList.parentNode.style.left = (iLeft - iStepWidth) + 'px';
            }
        }, 20);
    };
    $('ImgThemeScrollLeft').onmouseout = function(){
        window.clearInterval(hwScroll);
    };
    $('ImgThemeScrollRight').onmouseout = function(){
        window.clearInterval(hwScroll);
    }
}

//region 页面上固定的按钮的功能
//开始标记
function fnSelectMarkPoint(){
    _Mark.Begin();   
}
//显示隐藏标签
function fnLabel(){
    if(vM.flgShowLabel){
        vM.flgShowLabel=false;
        vM.ViewLabels(false);
        vM.Show();
    }else{
        vM.flgShowLabel=true;
        vM.ViewLabels(true);
        vM.Show();
    }
}
//测距
function fnScale(){
    vM.Body.ScaleLine='#fcff00|2'; 
    vM.StartScale();
    _IsBeginScale = true;
}


//全屏
function fnFullScreen(obj){
    if(_MapFullScreenState)
    {
        _MapFullScreenState = false;
        obj.innerHTML = '最大化';
        obj.title = '最大化';
        obj.parentNode.className = 'Ico5'
    }
    else
    {   
        _MapFullScreenState = true;
        obj.innerHTML = '还原';
        obj.title = '还原';
        obj.parentNode.className = 'Ico6';
    }
    
    window.onresize();    
}
function fnShowCommonGoTo()
{
    if($('divQuickLink').style.display == 'block')
    {
        $('divQuickLink').style.display = 'none';
    }
    else
    {  
        $('divQuickLink').style.display = 'block';
    }
}
function fnShowMyEAddress()
{
    if($('MyEadNav').style.display == 'block')
    {
        $('MyEadNav').style.display = 'none';
    }
    else
    {  
        $('MyEadNav').style.display = 'block';
    }
}

//右侧搜索栏收缩展开
function fnExpanding(obj)
{   
    if(_MapExpandingState)
    {
        _MapExpandingState = false;
        obj.src = 'Images/Expanding.gif';
    }
    else
    {
        _MapExpandingState = true;
        obj.src ='Images/DrawBack.gif';        
    }
    window.onresize();
}
//鹰眼收缩
function fnEyeExpanding(obj)
{
    if($('EagleMapCon').style.display=='none')
    {
        $('EagleMapCon').style.display='block';
        obj.src = 'Images/DrawBack.gif';
        if($('EyeArrow').className == 'SmallArrow')
        {
            $('EagleMapNav').style.width='196px';
        }
        else
        {
            $('EagleMapNav').style.width = '376px';
        }
    }
    else
    {        
        $('EagleMapCon').style.display='none';
        obj.src = 'Images/Expanding.gif'; 
        $('EagleMapNav').style.width='10px';
    }
}
//改变鹰眼地图尺寸
function fnEyeResize(obj)
{
    var w = 180;
    var h = 140;
    if(obj.className == 'SmallArrow')
    {
        obj.className = 'BigArrow';
        w = 2*w;   
        h = 2*h;        
        $('EagleMapDH').style.paddingTop = '95px';
        $('EagleMapNav').style.width='376px';
    }
    else
    {
        $('EagleMapDH').style.paddingTop = '20px';
        obj.className = 'SmallArrow';
        $('EagleMapNav').style.width='196px';
    }      
    obj.parentNode.style.width = w+ 'px';
    obj.parentNode.style.height = h + 'px';
    vMe.MapHeight(h);    
    vMe.MapWidth(w);
    vMe.Show(); 
}
//endregion 页面上固定的按钮的功能
/*路牌，地铁等开关显示 ***************************************/
function fnStation(){
    if(vM.Body.SignsVisible['bus']){
        vM.ViewSigns(false, 'bus');
        vM.Show();
    }else{
        vM.ViewSigns(true, 'bus');
        vM.Show();
    }
}
function fnRoad(){
    if(vM.Body.SignsVisible['road']){
        vM.ViewSigns(false, 'road');
        vM.Show();
    }else{
        vM.ViewSigns(true, 'road');
        vM.Show();
    }
}
function fnPack(){
    if(vM.Body.SignsVisible['park']){
        vM.ViewSigns(false, 'park');
        vM.Show();
    }else{
        vM.ViewSigns(true, 'park');
        vM.Show();
    }
}
function fnSubWay(){
    if(vM.Body.SignsVisible['subway']){
        vM.ViewSigns(false, 'subway');
        vM.Show();
    }else{
        vM.ViewSigns(true, 'subway');
        vM.Show();
    }
}
/***************************************/
//缩放条控制类
function ZoomBarClass()
{
    this.beginLevel = 1;
    this.beginTopPixel = 112;
    this.zoomStepPixel = 16;
    this.maxLevel = 4;
    this.moveStepPixel = 256;
    
    this.currentLevel = this.beginLevel;
    this.originalY = 0;
    this.originalTop = 0;
    this.zoomFlag = false;
    this.zoomBar = $('ControlUnit');
    
    //初始化缩放控件
    this.Init = function()
    {
        this.zoomBar.onmousedown = function(evt){
            evt = window.event ? window.event : evt;
            originalY = evt.clientY;
            this.originalTop = this.zoomBar.offsetTop;
            this.zoomFlag = true;
        }.bindAsEventListener(this);
        
        $('EzoomBar').onmousemove = this.zoomBar.onmousemove = function(evt){
            evt = window.event ? window.event : evt;
            var ey = evt.clientY;
            if (this.zoomFlag){
                var iTop = ey - originalY + this.originalTop;
                if (iTop < this.beginTopPixel) iTop = this.beginTopPixel;
                if (iTop > (this.beginTopPixel + this.zoomStepPixel*(this.maxLevel-1))) iTop = this.beginTopPixel + this.zoomStepPixel*(this.maxLevel-1);
                this.zoomBar.style.top = iTop + 'px';
            }
        }.bindAsEventListener(this);  
        
        $('EzoomBar').onmouseup = function(evt){
            if (this.zoomFlag){
                var z = Math.round((this.zoomBar.offsetTop - this.beginTopPixel) / this.zoomStepPixel);
                if (z > this.maxLevel-1) z = this.maxLevel-1;
                if (z < 0) z = 0;
                this.currentLevel = z;
                this.zoomBar.style.top = (this.beginTopPixel + z * this.zoomStepPixel) + 'px';
                this.zoomFlag = false;
                vM.FlatZoom(this.currentLevel);
            }
        }.bindAsEventListener(this);  
    };
    //缩放一定的"步长","步长"可以为负数
    this.ZoomWithStep = function(step){
        this.currentLevel += step;
        if (this.currentLevel > this.maxLevel-1) this.currentLevel = this.maxLevel-1;
        if (this.currentLevel < 0) this.currentLevel = 0;
        this.zoomBar.style.top = (this.beginTopPixel + this.currentLevel * this.zoomStepPixel) + 'px';
        vM.FlatZoom(this.currentLevel);
    };
    //缩放到指定的级别
    this.ZoomTo = function(level){
        this.currentLevel = level;
        this.zoomBar.style.top = (this.beginTopPixel + this.currentLevel * this.zoomStepPixel) + 'px';
        vM.FlatZoom(this.currentLevel);
    };
    this.Move = function(direction)
    {
        var iMapCenterX = vM.CenterX();
        var iMapCenterY = vM.CenterY();
        switch(direction)
        {
            case "up":
                MoveTo(iMapCenterX, iMapCenterY-vM.GetMapPos(this.moveStepPixel), true); 
                break;
            case "down":
                MoveTo(iMapCenterX, iMapCenterY+vM.GetMapPos(this.moveStepPixel), true); 
                break;
            case "left":
                MoveTo(iMapCenterX-vM.GetMapPos(this.moveStepPixel), iMapCenterY, true);  
                break; 
            case "right":
                MoveTo(iMapCenterX+vM.GetMapPos(this.moveStepPixel), iMapCenterY, true);  
                break; 
            case "center":
                MoveTo(vM.Property.CenterX, vM.Property.CenterY);
                break;                                 
        }
    };
    this.Switch3D = function(obj)
    {
//        if(vM.MapState()!=0 && !vM.MapLoading())
//        {
            vM.ViewSigns(true, 'park');
            vM.ViewPlots(true, 'ad');
            var oDivs = obj.parentNode.parentNode.getElementsByTagName('div');
            oDivs[0].className = 'Wx';
            oDivs[1].className = 'Ew';
//            vM.MapState(0);
            vM.Switch23D();
            obj.className = 'Sw Current';
            $('CompassNav').innerHTML = '<img src="Images/CompassIco.gif" alt="指针" />';
            $('CopyrightNav').style.display = '';
            fnEyeExpanding($('imgEyeExpanding'), false);
           
//        }
    };
    this.Switch2D = function(obj)
    {
//        if(vM.MapState()!=1 && !vM.MapLoading())
//        {
            vM.ViewSigns(false, 'park');
            vM.ViewPlots(false, 'ad');
            var oDivs = obj.parentNode.parentNode.getElementsByTagName('div');
            oDivs[2].className = 'Sw';
            oDivs[0].className = 'Wx';
//            vM.MapState(1);
            vM.Switch23D();
            obj.className = 'Ew Current';            
            $('CompassNav').innerHTML = '<img src="Images/CompassIco.gif" alt="指针" />';
            $('CopyrightNav').style.display = 'none';
            fnEyeExpanding($('imgEyeExpanding'), true);

//        }
    };    
    
    this.SwitchWX = function(obj)
    {       
    
           alert("暂不提供卫星图！");
    
//        if(vM.MapState()!=2 && !vM.MapLoading())
//        {
//            vM.ViewSigns(false, 'park');
//            vM.ViewPlots(false, 'ad');
//            var oDivs = obj.parentNode.parentNode.getElementsByTagName('div');
//            oDivs[1].className = 'Ew';
//            oDivs[2].className = 'Sw';            
//            vM.MapState(2);
//            obj.className = 'Wx Current';
//            $('CompassNav').innerHTML = '<img src="''Images/CompassIco1.gif" alt="指针" />';
//            $('CopyrightNav').style.display = 'none';
//            fnEyeExpanding($('imgEyeExpanding'), true);   
//            $('lnkSwichCity').style.display = 'none';
//            $('lnkVisitOldVersion').style.display = 'none';
//        }
    } 
}
//地图移动和鹰眼联动
function MoveTo(x,y)
{
    vM.MoveTo(x, y, true); 
    vMe.MoveTo(x, y, true);
}
/******************begin:各种URL支持和定位********************/
function fnGetPositionByCID()//企业Pop定位
{
    var cid = fnRequest('cid');
    if (cid != '' && cid*1 > 0)
    {
        _CompanyPopControl.ShowPop(cid,true); 
    }
}
function fnGetPositionByEID()//E店Pop定位
{
    var eid = fnRequest('eid');
    if (eid != '' && eid*1 > 0)
    {
        _EShopPopControl.ShowPop(eid,true); 
    }
}
function fnGetPositionByTID()//主题Pop定位
{
    var tid = fnRequest('tid');
    var tname = fnRequest('tname');
    if (tid != '' && tid*1 > 0 && tname == '')
    {
        _ThemePopControl.ShowPop(tid,true); 
    }
}
function fnGetPositionByOID()  //实体Pop定位
{
    var oid = fnRequest('oid');
    if (/.+?\?\d+$/gi.test(window.document.location.href))
    {
        oid = window.document.location.href.replace(/^.+?\?/gi, '');
    }
    if (oid != '' && oid*1 > 0)
    {
        _EntityPopControl.ShowPop(oid,true);
    }
}
//URL的解析
function fnUrlParse()
{
    if(fnRequest('searchshop') == 1)
    {
        fnSearchChange($('liEShopSearch'));
    }
    if(fnRequest('EAddressRegister') == 1)
    {
        fnSearchChange($('liEAddress'));
        fnEAddressRegister(fnRequest('EAddressName'));
        
    }
    if(fnRequest('EAddressManager') == 1)
    {
        fnSearchChange($('liEAddress'));
        fnEAddressManager();
        
    }
    var x = fnRequest('x');
    var y = fnRequest('y');
    if (x != ''&&y != '')
    {
        MoveTo(x, y);
    }
    var q = fnRequest('q');       //本搜
    if (q != '')
    {
        fnMapSearchByHotkey(unescape(q));
    }
    var nq = fnRequest('nq');
    if (nq != '')
    {
        fnNearbySearch(unescape(nq),x,y,1000);
    }
    var iBusId = fnRequest('bid');
    if(iBusId != '')
    {
        fnOnBusClick(iBusId, unescape(fnRequest('bname')),'');
    }
    var tid = fnRequest('tid');
    var tname = fnRequest('tname');
    if(tid != '' && tname != '')
    {
        fnLoadThemeMapListByTypeId(tid,unescape(tname));
    }
    var b = fnRequest('b');       //公交搜索
    if (b != '')
    {
        if (/^\w?\d+$/.test(b))
        {
            fnAddBusLineSearchTab(unescape(b)); 
        }
        else
        {
            fnAddBusStationSearchTab(unescape(b));  
        }
    }
    var s = fnRequest('s');       //站名搜索
    if (s != '')
    {
        fnAddBusStationSearchTab(unescape(s)); 
    }
    
    var b1 = fnRequest('b1');//两个站点间的搜索
    if (b1 != '')
    {
        var b2 = fnRequest('b2');
        if (b2 != '')
        {
            fnAddBusTransferSearchTab(unescape(b1), unescape(b2));
        }
    }
    var title = fnRequest('title');
    if(title=="")
    {
        title = fnRequest('tname');
    }
    var content = fnRequest('content');
    if(x=='')
    {
        x = fnRequest('tx');
    }
    if(x=='')
    {
        return;
    }
    if (y=='')
    {
        y = fnRequest('ty');
    }
    if(y=='')
    {
        return;
    }
    if (x != ''&&y != '' && title !='')
    {
        _Mark.Show(x,y,unescape(title),unescape(content));
    }    
}
/******************end:各种定位********************/
/*****begin:地图上显示如公交**********************/
//显示公交站信息，id:公交站ID
//定位到公交站并显示线路信息
function fnGotoBusStation(id, name, x, y)
{
    if(_BusTransferLineLayer.innerHTML=='')
    {
        var PopHtml='<span style="cursor:pointer; height:26px; float:left; font-size:12px; color:#000;white-space:nowrap;{$topwidth}"><span style="cursor:pointer; width:24px; height:24px; float:left; background:url(Images/gongjiao.gif) no-repeat; text-align:center; padding-top:2px;">1</span><span style="cursor:pointer; height:19px;line-height:19px; background:#fff; padding-right:4px; float:left;{$width};" onclick="parent.fnShowBusStation('+id+',\''+name+'\','+x+','+y+')">'+name+'</span></span>';
        _BusStationLayer.innerHTML = '';
        var div = vM.$C('div');
        div.innerHTML = PopHtml;
        var vlen = name.length*12.1;
        vM.appendEntity(div, _BusStationLayer, false, x,y,vlen+35,26,12,28, false);
    }
    MoveTo(x, y);
}
function fnShowBusStation(id, name, x, y){
    if (!_BusStationControl){
        _BusStationControl = new BusStationControl(vM.Body.document);
        _BusStationControl.ID = vM.appendEntity(_BusStationControl.Body, _PopLayer, false, x, y, 303, 170, 0, 38, false);
        _BusStationControl.Width = 303;
        _BusStationControl.Height = 165;
        
        _BusStationControl.ResumeLayout();
        _BusStationControl.onLoadComplete = function(){
            _BusStationControl.ShowBusStation(id,name);
        };
        _BusStationControl.onBusClick = function(busid, busname, stationName){
            fnOnBusClick(busid, busname, stationName);
        };
    }
    else{
        vM.moveEntity(_BusStationControl.ID, x, y);
        _BusStationControl.ShowBusStation(id,name);
    }
}

//加载完线路显示公交站
function fnShowBusStationIco(arrBusData, type){
    _BusLineType = type;
    _BusLineData = arrBusData;
    _BusTransferLineLayer.innerHTML='';
    _BusStationLayer.innerHTML = '';
    if(_BusLineData!=null)
    {                  
        var PopHtml='<span style="cursor:pointer; height:26px; float:left; font-size:12px; color:#000;white-space:nowrap;{$topwidth}"><span style="cursor:pointer; width:24px; height:24px; float:left; background:url(Images/gongjiao.gif) no-repeat; text-align:center; padding-top:2px;">{$No}</span><span style="cursor:pointer; height:19px;line-height:19px; background:#fff; padding-right:4px; float:left;{$width};" onclick="parent.fnShowBusStation({$StationID},\'{$BusStationName}\',{$X},{$Y})">{$BusStationName}</span></span>';
        if(_BusLineType==1){
            var l=_BusLineData.BusUp.length;         
            for(i=0;i<l;i++){
                var oBusUp = _BusLineData.BusUp[i];
                var vlen = oBusUp.StationName.length*12.1;
                var nd = vM.$C('div');
                nd.id='B_pop'+i;
                nd.innerHTML=PopHtml.replace('{$No}',(i+1)).replaceAll('{$BusStationName}',oBusUp.StationName).replace('{$topwidth}','width:'+(vlen+40)+'px').replace('{$width}','width:'+(vlen+10)+'px').replace('{$StationID}',oBusUp.StationID).replace('{$X}',oBusUp.PositionX).replace('{$Y}',oBusUp.PositionY);
                vM.appendEntity(nd, _BusTransferLineLayer, false, oBusUp.PositionX,oBusUp.PositionY,vlen+35,26,12,28, false);
            }
            if(_BusLineData.UpCoord.length > 0)
            {
                vM.DrawPolyLine(_BusTransferLineLayer, vM.ChangeCoords(_BusLineData.UpCoord, vM.Property.ZoomPer[vM.Zoom()]), 4, '#ffff00', 0.7);
            }
        }else{
            var l=_BusLineData.BusDown.length;
            var coords;            
            for(i=0;i<l;i++){
                var oBusDown = _BusLineData.BusDown[i];
                coords +=  oBusDown.PositionX + ',' + oBusDown.PositionY + ',';
                var vlen = oBusDown.StationName.length*12.1;
                var nd = vM.$C('div');
                nd.id='B_pop'+i;
                nd.innerHTML=PopHtml.replace('{$No}',(i+1)).replaceAll('{$BusStationName}',oBusDown.StationName).replace('{$topwidth}','width:'+(vlen+40)+'px').replace('{$width}','width:'+(vlen+10)+'px').replace('{$StationID}',oBusDown.StationID).replace('{$X}',oBusDown.PositionX).replace('{$Y}',oBusDown.PositionY);
                vM.appendEntity(nd, _BusTransferLineLayer, false, oBusDown.PositionX,oBusDown.PositionY,vlen+35,26,12,28, false);
            }
            if(_BusLineData.DownCoord.length > 0)
            {
                vM.DrawPolyLine(_BusTransferLineLayer, vM.ChangeCoords(_BusLineData.DownCoord, vM.Property.ZoomPer[vM.Zoom()]), 4, '#ffff00', 0.7); 
            }         
        }
    }
}
/********************begin:公交搜索回调********************/
function fnDrawingBusLine(busLineCoordList)
{
    _BusLineCoordList = busLineCoordList;
    _BusTransferLineLayer.innerHTML = '';
    _BusStationLayer.innerHTML = '';
    for (var i=0; i<_BusLineCoordList.length; i++)
    {
        var coord = _BusLineCoordList[i];
        vM.DrawPolyLine(_BusTransferLineLayer, vM.ChangeCoords(coord.Coords, vM.Property.ZoomPer[vM.Zoom()]), coord.Size, coord.Color, coord.Alpha);
        var PopHtml='<span style="cursor:pointer; height:26px; float:left; font-size:12px; color:#000;white-space:nowrap;{$topwidth}"><span style="cursor:pointer; width:24px; height:24px; float:left; background:url(Images/gongjiao.gif) no-repeat; text-align:center; padding-top:2px;">{$No}</span><span style="cursor:pointer; height:19px;line-height:19px; background:#fff; padding-right:4px; float:left;{$width};" onclick="parent.fnShowBusStation({$StationID},\'{$BusStationName}\',{$X},{$Y})">{$BusStationName}</span></span>';
        if(coord.Color == '#00ffff')
        {
            PopHtml='<span style="cursor:pointer; height:26px; float:left; font-size:12px; color:#000;white-space:nowrap;{$topwidth}"><span style="cursor:pointer; width:24px; height:24px; float:left; background:url(Images/gongjiao2.gif) no-repeat; text-align:center; padding-top:2px;">{$No}</span><span style="cursor:pointer; height:19px;line-height:19px; background:#fff; padding-right:4px; float:left;{$width};" onclick="parent.fnShowBusStation({$StationID},\'{$BusStationName}\',{$X},{$Y})">{$BusStationName}</span></span>';            
        }
        for (var j=0; j<coord.PassStation.length; j++)
        {
            var vlen = coord.PassStation[j].StationName.length*12.1;
            var nd = vM.$C('div');
            nd.innerHTML=PopHtml.replace('{$No}',(j+1)).replaceAll('{$BusStationName}',coord.PassStation[j].StationName).replace('{$topwidth}','width:'+(vlen+40)+'px').replace('{$width}','width:'+(vlen+10)+'px').replace('{$StationID}',coord.PassStation[j].StationID).replace('{$X}',coord.PassStation[j].PositionX).replace('{$Y}',coord.PassStation[j].PositionY);
            vM.appendEntity(nd, _BusTransferLineLayer, false, coord.PassStation[j].PositionX, coord.PassStation[j].PositionY,vlen+35,26,12,28, false);
        }
    }
}

function EAddressLoginCallback()
{
    if(_EAddressManagerTab)
    {
        _EAddressManagerTab.destroy();
    }
    if(_EAddressRegTab)
    {
        _EAddressRegTab.destroy();
    }
    if(_EAddressOperatorType==0)
    {
        fnEAddressRegister();
    }
    else
    {
        fnEAddressManager();
    }
};
