﻿// JScript 文件加载地图
/*****************************************************************************************************************************************************

                     开发人员：   钟 波
                     时间：       11-30

*****************************************************************************************************************************************************/
/********************************************************************定义变量*************************************************************************/
var map=null;//定义地图对像
var mapServer=getmapServer();//定义地图的服务器
var MapCenterX = getcityCenterX();//地图中心X
var MapCenterY= getcityCenterY();//地图中心Y
var MapX=0;
var MapY=0;
var mapName=getmapCityName();//定放地图地名
var overview=null //定义鹰眼
var mapLeveCount=getmapCityScales().length;//定义地图比例级
var MousedblClick=false;
var zoomLevel=1;
var overviewF=false;
/********************************************************************定义变量完***********************************************************************/


/********************************************************************定义事件*/ 
var zoomOutAction=null;//缩小对像
var zoomInAction=null;//放大对像
var panAction=null;//平移对像
/*************************************************************************/


function OnPageLoad()
{
         //document.getElementById("_overview").style.display="none";
         //document.getElementById("_Coverview").style.left="180px";
         //$("QuckLauot").style.display="none";
       if(request("city")!=""&&typeof(request("city"))!="undefined")
       {
      
        //得到地图的中心坐标
            var url="Handler/AjaxMapHandler.ashx?op=CityPoint"+"&city="+request("city")+"&t="+new Date().getTime(); 
            var xmlHttp=new createXMLHTTP();
            xmlHttp.open("get",url,false);
	        xmlHttp.onreadystatechange=function(){
	        if(xmlHttp.readyState==4)//判断对象状态
    	    	{
	         if(xmlHttp.status==200)
	           {	        
	                var value=unescape(xmlHttp.responseText);
	                             
	                if(value.split(',').length==3)
	                {	                    
	                    var X=value.split(',')[0];
	                    var Y=value.split(',')[1];
	                    zoomLevel=parseInt(value.split(',')[2]);
	                    MapX=parseFloat(X);
	                    MapY=parseFloat(Y);
	                  
	                }else
                        {
				
                            MapX=MapCenterX;
                            MapY=MapCenterY;
                            zoomLevel=1;
                           
                        }    

                          	
	           }
    	       xmlHttp=null; 
		    }
	        };xmlHttp.send(null);	
    	}
    	else
    	{
            MapX=MapCenterX;
            MapY=MapCenterY;
            zoomLevel=1;      
    	}
    MapInit();
   
}
function UnOnPageLoad()
{
    try{
	if(map)
	{
	    map.Destroy();

	    map = null;	
    }
   }catch(e)
   {}
}
function MapInit()
{    

        var params = new Object();
        params.mapHandler=mapServer;
        params.mapName = mapName;
        params.mapScales =getmapCityScales();
        mapLeveCount=params.mapScales.length
        params.x = MapX+"";
	    params.y = MapY+"";
	    params.imageFormat = getimageFormat();
        params.zoomLevel =zoomLevel+"";
        params.buffer = 256; // 预先进行下载的视图范围。 
        params.fixedView = false;
        
        map = new SuperMap.IS.MapControl($("map"), params);
        overviewF=false;
        //map.AttachEvent("onendzoom", endzoomAction);
        //map.AttachEvent("onstartzoom",startzoomAction);
        map.AttachEvent("onchangeview", onchangeviewAction); 
        map.Init();  
        //"在成都的位置" 定位
        if(request("op")=="PointPostion")
    {
        var Y=unescape(request("Y"));//地图中心坐标Y
        var X=unescape(request("X"));//地图中心坐标Y
         var XPoint=unescape(request("XPoint"));//加点位标记坐标X
          var YPoint=unescape(request("YPoint"));//加点位标记坐标Y
        
        var Zoom=unescape(request("Zoom"));
        var Name=unescape(request("Name"));
                var str="<table cellpadding=\"0\" cellspacing=\"0\" width='27' height='27' background='images/point1.gif' title='"+Name+"' style='cursor:hand;' onmouseover=\"this.parentNode.style.zIndex=13;\" onmouseout=\"this.parentNode.style.zIndex=10;\" ><tr><td align='center'>";
        str +="<font color='red'><b>★</b></font></td></tr></table>";
   		map.CustomLayer.InsertMark("pointone", parseFloat(XPoint), parseFloat(YPoint), 30, 40, str,"",11);
		map.SetCenterAndZoom( parseFloat(X),parseFloat(Y),parseFloat(Zoom));	
    }
    goSearch();
	//初始化比例级
	   mapLeveInit();
       AddAttachEvent();
       
         //了解是否从另一个网页传参过来
//       setTimeout("goSearch()",1000);
       MapSearchKeyInit(); 

}
function AddAttachEvent()
{       
        getMapCityName();
        
        
        LoadWeatherByCity(clearNbsp($("MapCityName").innerHTML));
        //OnQuckLauot(map.GetZoomLevel()-1);//当前地图的比例位置
}
function AddOverview()
{
     overview=new QXOverviewControl("overview",getmapCityScales(),MapX,MapY,mapName,mapServer,1,map);
     overview.Init();
      
    
}

function addTools()
{
    var value;
    var url="AjaxHtml/Tools.htm"; 
    var xmlHttp=new createXMLHTTP();
    xmlHttp.open("get",url,false);
	xmlHttp.onreadystatechange=function(){
	if(xmlHttp.readyState==4)//判断对象状态
    	{
	     if(xmlHttp.status==200)
	       {	    
	        value=xmlHttp.responseText;
	       }
	        xmlHttp=null;
		}
	};
	xmlHttp.send(null);	
	return value;
}
/****************************************************************************************************************************
    
                                                        以下为地图自身的事件

****************************************************************************************************************************/
//地图层级
function mapLeveInit()
{
    for(i=0;i<mapLeveCount;i++)
    {
        if(i==0)//加入快速切换比例
        {
            document.getElementById("QuckLauot").innerHTML="<a href=\"javascript:\"><img src=\"images/l28.gif\" width=\"16.7\" height=\"10\" border=\"0\" id=\"ImgQuck"+i+"\" onclick=\"SetZoomLever("+i+")\" title=\"第"+(i+1)+"级\"/></a>";
         }else
          {
             document.getElementById("QuckLauot").innerHTML +="<a href=\"javascript:\"><img src=\"images/l29.gif\" width=\"16.7\" height=\"10\" border=\"0\" id=\"ImgQuck"+i+"\"  onclick=\"SetZoomLever("+i+")\" title=\"第"+(i+1)+"级\"/></a>";
          }
    }
}
/*快速切换比例*/
function SetZoomLever(i)
{   
    map.SetZoomLevel(i+1);
} 
//当前地图的比例位置
function OnQuckLauot(i)
{
    
    if(i==0)
    {
        document.getElementById("ImgQuck"+i).src="images/l28-1.gif";
    }else
    {
        document.getElementById("ImgQuck"+i).src="images/l29-1.gif";
    }
}
//在缩放前的比例位置清除掉
function OnQuckLauotClear(i)
{
    if(i=="0")
    {
        document.getElementById("ImgQuck"+i).src="images/l28.gif";
    }else
    {
        document.getElementById("ImgQuck"+i).src="images/l29.gif";
    }
}
//当地在缩放开始时发生
function startzoomAction(e)
{
  
    OnQuckLauotClear((map.GetZoomLevel()-1)+"")
}

//当地在缩放结束时发生
 function endzoomAction(e)
{
    
   // OnQuckLauotClear(map.GetZoomLevel()-1)
   OnQuckLauot((map.GetZoomLevel()-1)+"");//标记出当前的级位
   
}
//当地图切换时发生
function onchangeviewAction(e)
{
    if(overview)//与鹰眼相联
    {  
        overview.setmapF();
        overview.OverviewPanToMapCoord(map.GetMapParam().mapCenter.x,map.GetMapParam().mapCenter.y);
    }
   getMapCityName();//得到地图中点所在的对映图层的属性
   
    
}


/*放大事件*/
function DoZoomIn() { map.ZoomIn(); }
/*缩小事件*/
function DoZoomOut() { map.ZoomOut(); }
/*拉框放大事件*/
function SetZoomInAction()
{
    if (!zoomInAction)
    {
         zoomInAction = new SuperMap.IS.ZoomInAction();
    }
    map.SetAction(zoomInAction); 	
}
 	
//拉框缩小事件
function SetZoomOutAction()
{
	if (!zoomOutAction) 
	    {
	        zoomOutAction = new SuperMap.IS.ZoomOutAction();
	    }
	    map.SetAction(zoomOutAction);
}
//清除高亮事件
function ClearHighLight(){
	map.CustomLayer.ClearMarks();
	map.CustomLayer.ClearLines();
	map.CustomLayer.ClearPolygons();
}
//平移事件
function SetPanAction()
{
	if (!panAction)
	    {		    
		    panAction = new SuperMap.IS.PanAction();
	    }
		
	map.SetAction(panAction);
}
//全图
function ViewEntire() {
    map.SetCenterAndZoom(MapCenterX,MapCenterY,1);
}

//测距
function SetMeasureDistanceAction() {    
var measureDistanceAction=null;
	if(!measureDistanceAction){
	    measureDistanceAction = new SuperMap.IS.MeasureDistanceAction(onMeasureDistanceComplete,onGetMapDateError);
	}
	map.SetAction(measureDistanceAction);
}

//处理测距结果
function onMeasureDistanceComplete(re)
{
    
    var result=re.distance;
    if(parseInt(result)>1000)
    {
        result="测量结果为："+parseInt(result)/1000.0+"公里";
    }else
    {
        result ="测量结果为："+(result+"").substring(0,(result+"").lastIndexOf('.')+2)+"米";
    }
    var str ="<span style=\"background-color:#cccccc;width:100%;z-index:1;height:17;color:White;cursor:move;\" id=\"MeasureResult_head\">§量算结果</span><span style=\"position: absolute;right:0;background-color:#cccccc;cursor:hand;color:White\" onclick='document.getElementById(\"MeasureResult\").style.display=\"none\";map.CustomLayer.RemoveLine(\"MeasureDistance\");'>关闭</span>"
    str +="<span style=\"text-align:center;position: absolute;top:20;left:0;z-index:9999\"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+result+"<br><br><span  style=\"cursor:hand\" onclick='map.CustomLayer.RemoveLine(\"MeasureDistance\")'>清除测量结果</span><br></span>"
    var div=document.getElementById("MeasureResult");
    if(div)
    {
        document.getElementById("MeasureResult").innerHTML=str;
        document.getElementById("MeasureResult").style.display='';
    }else
    {
        new createDiv("MeasureResult",420,260,200,100,str,"White","#000000","#005963",1,"0.8",1)
    }
    SetPanAction();
//    var dd = new YAHOO.util.DD("MeasureResult");
//	dd.setHandleElId("MeasureResult_head");
}
//测量面积
//-----------------测面积

function SetMeasureAreaAction() {
    var measureAreaAction=null;
	if(!measureAreaAction){
	    measureAreaAction = new SuperMap.IS.MeasureAreaAction(onMeasureAreaComplete, onMeasureAreaError);
	}
	map.SetAction(measureAreaAction);
}

function onMeasureAreaComplete(result){

	var areatemp=result.area;
	if(areatemp>0){
	    var areatemp2=areatemp.toString();
	    if(areatemp2.indexOf(".")>0){
	        areatemp=areatemp2.split(".")[0];
	    }
	    //alert("面积量算结果为："+ areatemp + "平方米！");
		 var str ="<span style=\"background-color:#cccccc;width:100%;z-index:1;height:17;color:White;cursor:move;\" id=\"MeasureResult_head\">§量算结果</span><span style=\"position: absolute;right:0;background-color:#cccccc;cursor:hand;color:White\" onclick='document.getElementById(\"MeasureResult\").style.display=\"none\";map.CustomLayer.RemoveLine(\"MeasureDistance\");'>关闭</span>"
    str +="<span style=\"text-align:center;position: absolute;top:20;left:0;z-index:9999\"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;面积量算结果为："+ areatemp + "平方米！<br><br><span  style=\"cursor:hand\" onclick='map.CustomLayer.RemoveLine(\"MeasureDistance\")'>清除测量结果</span><br></span>"
    var div=document.getElementById("MeasureResult");
    if(div)
    {
        document.getElementById("MeasureResult").innerHTML=str;
        document.getElementById("MeasureResult").style.display='';
    }else
    {
        new createDiv("MeasureResult",420,260,200,100,str,"White","#000000","#005963",1,"0.8",1)
    }
	}
	 SetPanAction();

}
function onMeasureAreaError(responseText) {
	
}

//平移到指定位置
function moveMap(X,Y)
{
    Y=parseFloat(Y);
    map.PanToMapCoord(X,Y);
}
//平移到指定位置
function moveMap(X,Y,i)
{   
    Y=parseFloat(Y);
    map.SetCenterAndZoom(X,Y,parseInt(i));
    
}


//返回地图中心所在的城市
function getMapCityName()
{

    var _queryParam=null;
    var _returnFields=["smID","Name_1","Name_2"];
    var _layerNames=["省界与地区界@QXKJ_sichuan"];
    _queryParam=new SuperMap.IS.QueryParam();
    _queryParam.queryLayers=new Array();
    var tempLayerNames = _layerNames.concat();
    while(tempLayerNames.length>0)
	{
	    var ql=new SuperMap.IS.QueryLayer();
	    ql.layerName=tempLayerNames.pop();
	    ql.returnFields=_returnFields;
	    _queryParam.queryLayers.push(ql);
	}
	tempLayerNames=null;
    _queryParam.expectCount = 1;
    map.GetQueryManager().QueryByPoint(map.GetMapParam().mapCenter, 0.00001, _queryParam,getMapCityNameDate,onGetMapDateError);

}
//处理返回地图中心所在的城市
function getMapCityNameDate(resultSet)
{
    
 
    if (!resultSet || resultSet.totalCount < 1)
    {
        $("MapCityName").innerHTML="<a href=\"javaScript:\"> <span  onclick=\"mapCityListShow();\" >川外&nbsp;<img src=\"images/change.gif\" border=\"0\" /></span></a>";
    }else
    {     
    
        
        if(clearNbsp(resultSet.recordsets[0].records[0].fieldValues[2])!=clearNbsp($("MapCityName").innerHTML))
        {  
            
            $("MapCityName").innerHTML="<a href=\"javaScript:\"> <span  onclick=\"mapCityListShow();\" >"+resultSet.recordsets[0].records[0].fieldValues[2]+"&nbsp;<img src=\"images/change.gif\" border=\"0\" /></span></a>";
            LoadWeatherByCity(clearNbsp($("MapCityName").innerHTML));
            MapSearchKeyInit();//加载搜索提示
        }
        
    }
    if (!resultSet || resultSet.totalCount < 1)
    {
        $("MapAreaName").innerHTML="";
    }else
    {
        $("MapAreaName").innerHTML="&nbsp;"+resultSet.recordsets[0].records[0].fieldValues[1];
    }
    
}



//错误
function onGetMapDateError(ErrText)
{
    

}













function mapCityListShow()
{
    var div =document.getElementById("mapClitList");
    if(div)
    {
        div.style.display='';   
    }else
    {
        mapCityListInit();
    }
}




/****************************************************************************************************************************
    
                                                        以下为地图鼠标事件

****************************************************************************************************************************/
var MapMouseDownAndMove=true;//是否在移动
var MapMouseDown=true;
//当鼠标在地图上按下时
function OnMap_MouseDown(e)
{
    //e对像
    MapMouseDown=true;
    e.style.cursor='move';

}
//当鼠标在地图上按起时
function OnMap_MouseUp(e)
{
    //e对像
    e.style.cursor='';    
    MapMouseDown=false;    
    MousedblClick=false;
}
//在地图上的鼠标点击事件
function OnMap_Click(e)
{
    if(!MapMouseDownAndMove&&!MousedblClick)
    {
        //开始点选
        if(map.GetAction().type!="MeasureDistanceAction");
            {
                clickSearch(e);
            }
    }
    
}
//在地图上的鼠标双击事件
function OnMap_DblClick()
{
    MousedblClick=true;
}
//在地图上的鼠标移动事件
function OnMap_MouseMove(e)
{
    MapMouseDownAndMove=false;
    if(MapMouseDown)
    {
        MapMouseDownAndMove=true;
    }
}
/****************************************************************************************************************************
    
                                                        以下为地图鹰眼

****************************************************************************************************************************/
function onerviewShow()
{  
    
    
    if(document.getElementById("_overview").style.display=="")
    {
        document.getElementById("_overview").style.display="none";
         document.getElementById("_Coverview").style.left="180px";
         //$("QuckLauot").style.display="none";

    }else
    {
        document.getElementById("_overview").style.display=""; 
        document.getElementById("_Coverview").style.left="0";
       // $("QuckLauot").style.display="";
    }

    if(!overviewF)
    {
        AddOverview();
    }
}
function QuckLauotShowHide()
{
     if(document.getElementById("QuckLauot").style.display=="")
        {
            document.getElementById("QuckLauot").style.display="none";
           
        }else
        {
            document.getElementById("QuckLauot").style.display="";
           
        }
}



/****************************************************************************************************************************
    
                                                        以下为地图搜索事件

****************************************************************************************************************************/

/*******************************************************地图搜索**********************************************************/



function MapSearch()
{   
    var div=document.getElementById("MapSearchListDiv");
    var MapSearchName=document.getElementById("MapSearchName").value;
    if(!MapSearchName){alert('请输入关键字！');document.getElementById("MapSearchName").focus();return;}
    var city=clearNbsp(document.getElementById("MapCityName").innerHTML);    
    var url="Handler/AjaxMapHandler.ashx?op=MapSearch&city="+escape(city)+"&MapSearchName="+escape(MapSearchName)+"&pageIndex=1&t="+new Date().getTime();
    //document.write(url);
    if(div)
    {
        document.getElementById("MapSearchListDivBody").innerHTML="<br><br><br><br><br>"+loading();
        div.display="";
        document.getElementById("MapSearchListDivBody").display="";
        document.getElementById("MapSearchListDivfoot").display="";
    }else
    {
         MapSearchListDiv("<br><br><br><br><br>"+loading(),"");
    }
   
    var xmlHttp=new createXMLHTTP();
    xmlHttp.open("get",url,true);
	xmlHttp.onreadystatechange=function(){
	if(xmlHttp.readyState==4)//判断对象状态
    	{
	     if(xmlHttp.status==200)
	        {	
	            document.getElementById("MapSearchListDivBody").innerHTML=xmlHttp.responseText;
	            addpoint();
	        }
	        xmlHttp=null;
	      }
	}
    
    xmlHttp.send(null);	    
}

function onMapSearch(pageIndex)
{
    var div=document.getElementById("MapSearchListDiv");
    var MapSearchName=document.getElementById("MapSearchName").value;
      
    var city=clearNbsp(document.getElementById("MapCityName").innerHTML);    
    var url="Handler/AjaxMapHandler.ashx?op=MapSearch&city="+escape(city)+"&MapSearchName="+escape(MapSearchName)+"&pageIndex="+pageIndex+"&t="+new Date().getTime();
    //document.write(url);
    if(div)
    {
        document.getElementById("MapSearchListDivBody").innerHTML="<br><br><br><br><br>"+loading();
        div.display="";
        document.getElementById("MapSearchListDivBody").display="";
        document.getElementById("MapSearchListDivfoot").display="";
    }else
    {
         MapSearchListDiv("<br><br><br><br><br>"+loading(),"");
    }
   
    var xmlHttp=new createXMLHTTP();
    xmlHttp.open("get",url,true);
	xmlHttp.onreadystatechange=function(){
	if(xmlHttp.readyState==4)//判断对象状态
    	{
	     if(xmlHttp.status==200)
	        {	
	            document.getElementById("MapSearchListDivBody").innerHTML=xmlHttp.responseText;
	            addpoint();
	        }
	        xmlHttp=null;
	      }
	}
    
    xmlHttp.send(null);	  
}


/*******************************************************分类搜索**********************************************************/

function TypeSearch()
{
    var TypeSearchNumber=document.getElementById("TypeSearchNumber").value;
    var TypeSearchName=document.getElementById("TypeSearchName").value;
    var city=clearNbsp(document.getElementById("MapCityName").innerHTML); 
    if(!TypeSearchName)
    {
        alert('不能搜索空对像！');
        document.getElementById("TypeSearchName").focus();
        return;
    }
    var url="Handler/AjaxMapHandler.ashx?op=MapType&city="+escape(city)+"&TypeSearchNumber="+escape(TypeSearchNumber)+"&TypeSearchName="+escape(TypeSearchName)+"&pageIndex=1&t="+new Date().getTime();
    //document.write(url);
     var div=document.getElementById("MapSearchListDiv");
      if(div)
    {
        document.getElementById("MapSearchListDivBody").innerHTML="<br><br><br><br><br>"+loading();
        div.display="";
        document.getElementById("MapSearchListDivBody").display="";
        document.getElementById("MapSearchListDivfoot").display="";
    }else
    {
         MapSearchListDiv("<br><br><br><br><br>"+loading(),"");
    }
    var xmlHttp=createXMLHTTP();
    xmlHttp.open("post",url,true);
    
    xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xmlHttp.onreadystatechange=function(){
	if(xmlHttp.readyState==4)//判断对象状态
    	{
	     if(xmlHttp.status==200)
	        {
	            document.getElementById("MapSearchListDivBody").innerHTML=xmlHttp.responseText;
	            addpoint();
	        }
         xmlHttp=null;
	    }
	};
		xmlHttp.send(null);
		
}
//分页分类搜索
function onTypeSearch(pageIndex)
{
    var TypeSearchNumber=document.getElementById("TypeSearchNumber").value;
    var TypeSearchName=document.getElementById("TypeSearchName").value;
    var city=clearNbsp(document.getElementById("MapCityName").innerHTML); 
    if(!TypeSearchName)
    {
        alert('不能搜索空对像！');
        return;
    }
    var url="Handler/AjaxMapHandler.ashx?op=MapType&city="+escape(city)+"&TypeSearchNumber="+escape(TypeSearchNumber)+"&TypeSearchName="+escape(TypeSearchName)+"&pageIndex="+pageIndex+"&t="+new Date().getTime();
    //document.write(url);
     var div=document.getElementById("MapSearchListDiv");
      if(div)
    {
        document.getElementById("MapSearchListDivBody").innerHTML="<br><br><br><br><br>"+loading();
        div.display="";
        document.getElementById("MapSearchListDivBody").display="";
        document.getElementById("MapSearchListDivfoot").display="";
    }else
    {
         MapSearchListDiv("<br><br><br><br><br>"+loading(),"");
    }
    var xmlHttp=createXMLHTTP();
    xmlHttp.open("post",url,false);
    
    xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xmlHttp.onreadystatechange=function(){
	if(xmlHttp.readyState==4)//判断对象状态
    	{
	     if(xmlHttp.status==200)
	        {
	           document.getElementById("MapSearchListDivBody").innerHTML=xmlHttp.responseText;
	           addpoint();        
	           
	        }
         xmlHttp=null;
	    }
	};
		xmlHttp.send(null); 
		
}

/*******************************************************返回企业标的点位信息**********************************************************/

function getComInfo(id)
{
    if(!id){return};
    document.getElementById("ComInfoDiv").style.display="";
    document.getElementById("ComInfoDiv").style.left="0px";
    document.getElementById("ComInfoBody").innerHTML="<br><br><br><br><br>"+loading();
    
    var xmlHttp=createXMLHTTP();
    var url="Handler/AjaxMapHandler.ashx?op=ComInfo&ComID="+id+"&t="+new Date().getTime();
    //document.write(url);
    xmlHttp.open("get",url,false);
    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
            if(xmlHttp.status==200)
            {
                
                document.getElementById("ComInfoBody").innerHTML=xmlHttp.responseText;
	
                PointShow();
                //document.getElementById("comAbout").innerHTML="<span  onmouseover=\"info.stop();\" onmouseout=\"info.start();\"><marquee id=\"info\" scrollamount=\"1\" direction=\"up\" height=\"100\">" +document.getElementById("comAbout").innerHTML+ "</marquee></span>";
                
            }
            xmlHttp=null;
        }
    };
    xmlHttp.send(null);  
}

//选择图片
function selectPic(name,pic,id)
{
	document.getElementById('imglist').innerHTML="<a target=\"_blank\" href=\"yp/ImgShow.aspx?ID="+id+"\"><img  src=\"UpLoad/UpLoadPic/"+pic+"\" width=\"190\" height=\"140\" title="+name+" border=\"0\"></a>";
}

//选择全景
function PanoramicShow(id)
{
    window.open("yp/ParShow.aspx?ID="+id,'Video','','_blank');
}

//选择视频
function VideoShow(id)
{
    window.open("yp/VidShow.aspx?ID="+id,'Video','','_blank');
}
//选择标点
function PointShow()
{
    //lblComPointName
    //alert();
    var name=document.getElementById("lblComPointName").innerHTML;    
    var X=document.getElementById("lblComPointX").innerHTML;
    var Y=document.getElementById("lblComPointY").innerHTML;
    var id=document.getElementById("lblComPointID").innerHTML;
       ////定位放大到企业显示层--start---
             var LayoutName=document.getElementById("lblLayoutName").innerHTML;
//alert(LayoutName);
            var showdiv=7;
            

            //政府 在第八层
            var Government="Government";
                if(LayoutName.substring(0,LayoutName.indexOf("@")-2)==Government)
            {
                showdiv=8;
            }
            //黄金标点符号 在第七层
            var Gold_Punctuation="Gold_punctuation";
               if(LayoutName.substring(0,LayoutName.indexOf("@")-2)==Gold_Punctuation)
            {
                showdiv=8;
            }
            //普通标点符号 在第十层 
             var General_Punctuation="General_punctuation";
               //政府机构 在第十层
            var Government_agencies="Government_agencies";
            //标点 在第十层
            var Punctuation="Punctuation"; 
           
             if(LayoutName.substring(0,LayoutName.indexOf("@")-2)==General_Punctuation || LayoutName.substring(0,LayoutName.indexOf("@")-2)==Government_agencies)
            {
                showdiv=10;
            }
            //标点 在第十一层
            var Punctuation="Punctuation"; 
            if( LayoutName.substring(0,LayoutName.indexOf("@")-2)==Punctuation )
            {
                showdiv=11;
            }
            //
            //alert(LayoutName);
           //alert(showdiv);
          moveMap(X,Y,parseInt(showdiv));
    //--end----
   // moveMap(X,Y);
    InsertCustomLayer(id,name,X,Y,"★");
    
}



/*******************************************************周边搜索**********************************************************/
function NearSearch()
{
    //先清除标点
    while($("point"))
    {
        map.CustomLayer.RemoveMark("point");
    }
    var NearSearchName1=document.getElementById("NearSearchName1").value;
    var NearSearchName2=document.getElementById("NearSearchName2").value;
    var Near=document.getElementById("Near").value;
    var city=clearNbsp(document.getElementById("MapCityName").innerHTML); 
    if(!NearSearchName1){alert("要搜索的位置不能为空！");document.getElementById("NearSearchName1").focus();return;};
    if(!NearSearchName2){alert("要搜索的内容不能为空！");document.getElementById("NearSearchName1").focus();return;};
    //先验证NearSearchName1是不是唯一地址
    var xmlHttp=createXMLHTTP();
    var url="Handler/AjaxMapHandler.ashx?op=CheckNearValue&NearSearchName1="+escape(NearSearchName1)+"&NearSearchName2="+escape(NearSearchName2)+"&Near="+Near+"&city="+escape(city)+"&t="+new Date().getTime();
    //document.write(url);
    
     var div=document.getElementById("MapSearchListDiv");
      if(div)
    {
        document.getElementById("MapSearchListDivBody").innerHTML="<br><br><br><br><br>"+loading();
       
    }else
    {
         MapSearchListDiv("<br><br><br><br><br>"+loading(),"");
    }
    
    xmlHttp.open("get",url,false);
    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
            if(xmlHttp.status==200)
            {
                
                if(xmlHttp.responseText.split(',').length==2)
                {
                    onNearSearch(NearSearchName1,xmlHttp.responseText.split(',')[0],xmlHttp.responseText.split(',')[1],NearSearchName2,Near,1)
                }else
                {
                   
                    document.getElementById("MapSearchListDiv").display="";
                    document.getElementById("MapSearchListDivBody").display="";
                    document.getElementById("MapSearchListDivBody").innerHTML=xmlHttp.responseText;
                    
                }

            }
            xmlHttp=null;
        }
    };
    xmlHttp.send(null);

}

function onNearSearch(Name,X,Y,Value,Near,pageIndex)
{  
    if(!Near){Near=document.getElementById("Near").value;};
    if(!Name||!X||!Y||!Value){return;}
    
    var xmlHttp=createXMLHTTP();
    var url="Handler/AjaxMapHandler.ashx?op=NearSearch&X="+X+"&Y="+Y+"&name="+escape(Name)+"&Value="+escape(Value)+"&Near="+Near+"&pageIndex="+pageIndex+"&t="+new Date().getTime();
    //document.write(url);
    
     var div=document.getElementById("MapSearchListDiv");
      if(div)
    {
        document.getElementById("MapSearchListDivBody").innerHTML="<br><br><br><br><br>"+loading();
         div.display="";
        document.getElementById("MapSearchListDivBody").display="";
        document.getElementById("MapSearchListDivfoot").display="";
    }else
    {
         MapSearchListDiv("<br><br><br><br><br>"+loading(),"");
    }
    
    xmlHttp.open("get",url,false);
    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
            if(xmlHttp.status==200)
            {
                
               //xmlHttp.responseText
               document.getElementById("MapSearchListDivBody").innerHTML=xmlHttp.responseText;
	           addpoint();
			        //var str="<table cellpadding=\"0\" cellspacing=\"0\" width='27' height='27' background='images/point1.gif' title='"+name+"' style='cursor:hand;' onmouseover=\"this.parentNode.style.zIndex=13;\" onmouseout=\"this.parentNode.style.zIndex=10;\" ><tr><td align='center'>";
        //str +="<font color='red'><b>★</b></font></td></tr></table>";
        //Y=parseFloat(Y); 
       
		//map.CustomLayer.InsertMark("pointone1", X,Y, 30, 40, str,"",11);	

		  moveMap(X,Y);
    InsertCustomLayer("point",Name,X,Y,"★");
            }
            xmlHttp=null;
        }
    };
    xmlHttp.send(null); 
}
function nearSearchByPoint()  
{

    var name=document.getElementById("lblComPointName").innerHTML;    
    var X=document.getElementById("lblComPointX").innerHTML;
    var Y=document.getElementById("lblComPointY").innerHTML;    
    
    var str ="<span style=\"background-color:#cccccc;width:100%;z-index:1;height:17;color:White;cursor:move;\" id=\"MeasureResult_head\">§周边查询</span><span style=\"position: absolute;right:0;background-color:#cccccc;cursor:hand;color:White\" onclick='document.getElementById(\"nearSearchByPointDiv\").style.display=\"none\";'>关闭</span>"
    var str1="&nbsp;&nbsp;<input type='text' value='"+name+"' style=\"width: 100px\">&nbsp;&nbsp;<select id=\"Near1\" class=\"texform\" style=\"width: 54px\">";
    str1 +="<option value=\"1\">100米</option><option value=\"2\">200米</option><option value=\"3\">300米</option><option value=\"5\">500米</option>";
    str1 += "<option value=\"8\">800米</option><option value=\"10\">1000米</option><option value=\"20\">2000米</option></select>";
    str1 +="&nbsp;&nbsp;<input id=NearSearchName3 type='text' style=\"width: 100px\">";
    str +="<span style=\"text-align:center;position: absolute;top:20;left:0;z-index:9999\"><br>"+str1+"<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img id=\"btnNearSearch1\" src=\"images/l7.gif\" width=\"33\" height=\"24\"  style=\"cursor: hand\" onclick=\"nearSearchByPoint1("+X+","+Y+",'"+name+"','')\"/><br></span>"
    
    var div=document.getElementById("nearSearchByPointDiv");
    if(div)
    {
        document.getElementById("nearSearchByPointDiv").innerHTML=str;
        document.getElementById("nearSearchByPointDiv").style.display='';
    }else
    {
        new createDiv("nearSearchByPointDiv",350,250,300,100,str,"#FBF3E6","#000000","#aaaaaa",1,"0.9",1)
    }
    
}
function  nearSearchByPoint1(X,Y,Name,Near)
{
    
    var Value=document.getElementById("NearSearchName3").value;
    if(!Value){alert("请输入的值不正确！");document.getElementById("NearSearchName3").focus(); return;}
    if(!Near){
        Near =document.getElementById("Near1").value;
    }
    onNearSearch(Name,X,Y,Value,Near,1);    
    document.getElementById("nearSearchByPointDiv").style.display='none';
    window.document.form1.removeChild("nearSearchByPointDiv");
}

/*******************************************************相联企业**********************************************************/
function getCorrelationCom(com_id)
{
   
     var div=document.getElementById("MapSearchListDiv");
    var MapSearchName=document.getElementById("MapSearchName").value;
    if(!MapSearchName){alert('请输入关键字！');document.getElementById("MapSearchName").focus();return;}
    var city=clearNbsp(document.getElementById("MapCityName").innerHTML);    
    var url="Handler/AjaxMapHandler.ashx?op=getCorrelationCom&com_id="+escape(com_id)+"&pageIndex=1&t="+new Date().getTime();
    //document.write(url);
    if(div)
    {
        document.getElementById("MapSearchListDivBody").innerHTML="<br><br><br><br><br>"+loading();
        div.display="";
        document.getElementById("MapSearchListDivBody").display="";
        document.getElementById("MapSearchListDivfoot").display="";
    }else
    {
         MapSearchListDiv("<br><br><br><br><br>"+loading(),"");
    }
   
    var xmlHttp=new createXMLHTTP();
    xmlHttp.open("get",url,false);
	xmlHttp.onreadystatechange=function(){
	if(xmlHttp.readyState==4)//判断对象状态
    	{
	     if(xmlHttp.status==200)
	        {	
	            document.getElementById("MapSearchListDivBody").innerHTML=xmlHttp.responseText;
	            addpoint();
	        }
	        xmlHttp=null;
	      }
	}
    
    xmlHttp.send(null);	    
    
}
/*******************************************************点选搜索**********************************************************/

function clickSearch(e)
{

    //先得到在再点选的那个图层为那一层
    //数据名
    var DateStr=escape("@QXKJ_Point1");
    //先加总图展示 在第四层
    var DisLlay=escape("Display");
    //政府 在第八层
    var Government=escape("Government");
    //黄金标点符号 在第七层
    var Gold_Punctuation=escape("Gold_Punctuation");
    //普通标点符号 在第八层
    var General_Punctuation=escape("General_Punctuation");
    //政府机构 在第十层
    var Government_agencies=escape("Government_agencies");
    //标点 在第十层
    var Punctuation=escape("Punctuation");  
    //层的数组
    var LayoutName=new Array();
    //地图层
    var zoomlevel=map.GetZoomLevel();
    
    if(zoomlevel>=5)
    {
        //加载总图展示
        LayoutName[LayoutName.length]=DisLlay +"_L"+DateStr;
        LayoutName[LayoutName.length]=DisLlay +"_R"+DateStr;
        LayoutName[LayoutName.length]=DisLlay +"_D"+DateStr;
        LayoutName[LayoutName.length]=DisLlay +"_U"+DateStr;
    }
    if(zoomlevel>=7)
    {
        //加载黄金标点符
        LayoutName[LayoutName.length]=Gold_Punctuation +"_L"+DateStr;
        LayoutName[LayoutName.length]=Gold_Punctuation +"_R"+DateStr;
        LayoutName[LayoutName.length]=Gold_Punctuation +"_D"+DateStr;
        LayoutName[LayoutName.length]=Gold_Punctuation +"_U"+DateStr;
    }
   
     if(zoomlevel>=8)
    {
        //加载政府
        LayoutName[LayoutName.length]=Government +"_L"+DateStr;
        LayoutName[LayoutName.length]=Government +"_R"+DateStr;
        LayoutName[LayoutName.length]=Government +"_D"+DateStr;
        LayoutName[LayoutName.length]=Government +"_U"+DateStr;
        //加载普通标点符号
        LayoutName[LayoutName.length]=General_Punctuation +"_L"+DateStr;
        LayoutName[LayoutName.length]=General_Punctuation +"_R"+DateStr;
        LayoutName[LayoutName.length]=General_Punctuation +"_D"+DateStr;
        LayoutName[LayoutName.length]=General_Punctuation +"_U"+DateStr;
    }
   
     if(zoomlevel>=10)
    {
        //加载政府机构
        LayoutName[LayoutName.length]=Government_agencies +"_L"+DateStr;
        LayoutName[LayoutName.length]=Government_agencies +"_R"+DateStr;
        LayoutName[LayoutName.length]=Government_agencies +"_D"+DateStr;
        LayoutName[LayoutName.length]=Government_agencies +"_U"+DateStr;
        //加载标点符号
        LayoutName[LayoutName.length]=Punctuation +"_L"+DateStr;
        LayoutName[LayoutName.length]=Punctuation +"_R"+DateStr;
        LayoutName[LayoutName.length]=Punctuation +"_D"+DateStr;
        LayoutName[LayoutName.length]=Punctuation +"_U"+DateStr;
    }
        
        //返回点选在的左上点像素坐标
        var point1=new Object();	
	    point1.x=event.x-map.GetOffsetX()-10;
	    point1.y=event.y-map.GetOffsetY()-20;
	    //把原左上点像素坐标转换成地理坐标
	    var point=map.PixelToMapCoord(point1);
	    
	    //返回点选在的右下点像素坐标
	    var rpoint1=new Object();
	    rpoint1.x=event.x-map.GetOffsetX()+10;
	    rpoint1.y=event.y-map.GetOffsetY()+20;
	    
	    //把原右下点像素坐标转换成地理坐标
	    var rpoint=map.PixelToMapCoord(rpoint1);
        //y=parseFloat(y)-113; 
        
        point.y=parseFloat(point.y); 
        rpoint.y=parseFloat(rpoint.y); 
        //alert(LayoutName);
	    if(LayoutName.length>0)
	    {
	        onClickSearch(LayoutName,point,rpoint);
	    }

}
//处理点选
function onClickSearch(LayoutName,point,rpoint)
{
    var xmlHttp=createXMLHTTP();
    var url="Handler/AjaxMapHandler.ashx?op=ClickSearch&LayoutName="+LayoutName+"&pointX="+point.x+"&pointY="+point.y+"&rpointX="+rpoint.x+"&rpointY="+rpoint.y+"&t="+new Date().getTime();
    //document.write(url);
    //alert(url);
    xmlHttp.open("get",url,false);
    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
            if(xmlHttp.status==200)
            {
                //alert(xmlHttp.responseText);
                if(xmlHttp.responseText&&typeof(xmlHttp.responseText)!="undefined")
                {
                    
                    getComInfo(xmlHttp.responseText)
                }                
                //document.getElementById("comAbout").innerHTML="<span  onmouseover=\"info.stop();\" onmouseout=\"info.start();\"><marquee id=\"info\" scrollamount=\"1\" direction=\"up\" height=\"100\">" +document.getElementById("comAbout").innerHTML+ "</marquee></span>";
                
            }
            xmlHttp=null;
        }
    };
    xmlHttp.send(null);  
}

/*******************************************************公交搜索之路线**********************************************************/

function LineSearch()
{   
    var Line=document.getElementById("Line").value;
    if(!Line){alert("请输入的值不正确！");document.getElementById("Line").focus(); return;}
    var city=clearNbsp(document.getElementById("MapAreaName").innerHTML); 
    var url="Handler/MapBusHandler.ashx?op=line&city="+escape(city)+"&line="+escape(Line)+"&T="+new Date().getTime();
    //document.write(url);
    //alert(url);
     var div=document.getElementById("MapSearchListDiv");
    if(div)
    {
        document.getElementById("MapSearchListDivBody").innerHTML="<br><br><br><br><br>"+loading();
        div.display="";
        document.getElementById("MapSearchListDivBody").display="";
        document.getElementById("MapSearchListDivfoot").display="";
    }else
    {
         MapSearchListDiv("<br><br><br><br><br>"+loading(),"");
    }
   
    var xmlHttp=new createXMLHTTP();
    xmlHttp.open("get",url,false);
	xmlHttp.onreadystatechange=function(){
	if(xmlHttp.readyState==4)//判断对象状态
    	{
	     if(xmlHttp.status==200)
	        {	
	            document.getElementById("MapSearchListDivBody").innerHTML=xmlHttp.responseText;	            
	        }
	        xmlHttp=null;
	      }
	}
    
    xmlHttp.send(null);
}

function rLineSearch(Line,city)
{  
    var url="Handler/MapBusHandler.ashx?op=line&city="+escape(city)+"&line="+escape(Line)+"&T="+new Date().getTime();
    //document.write(url);
    //alert(url);
     var div=document.getElementById("MapSearchListDiv");
    if(div)
    {
        document.getElementById("MapSearchListDivBody").innerHTML="<br><br><br><br><br>"+loading();
        div.display="";
        document.getElementById("MapSearchListDivBody").display="";
        document.getElementById("MapSearchListDivfoot").display="";
    }else
    {
         MapSearchListDiv("<br><br><br><br><br>"+loading(),"");
    }
   
    var xmlHttp=new createXMLHTTP();
    xmlHttp.open("get",url,false);
	xmlHttp.onreadystatechange=function(){
	if(xmlHttp.readyState==4)//判断对象状态
    	{
	     if(xmlHttp.status==200)
	        {	
	            document.getElementById("MapSearchListDivBody").innerHTML=xmlHttp.responseText;	            
	        }
	        xmlHttp=null;
	      }
	}
    
    xmlHttp.send(null);
    
}

function getline(lineID,T,city)
{
    //alert();
    var url="Handler/MapBusHandler.ashx?op=lineID&lineID="+lineID+"&T="+T+"&city="+escape(city)+"&tr="+new Date().getTime();
    var div=document.getElementById("MapSearchListDiv");
    if(div)
    {
        document.getElementById("MapSearchListDivBody").innerHTML="<br><br><br><br><br>"+loading();
        div.display="";
        document.getElementById("MapSearchListDivBody").display="";
        document.getElementById("MapSearchListDivfoot").display="";
    }else
    {
         MapSearchListDiv("<br><br><br><br><br>"+loading(),"");
    }
   //document.write(url);
    //alert(url);
    var xmlHttp=new createXMLHTTP(); 
    xmlHttp.open("get",url,false);
	xmlHttp.onreadystatechange=function(){
	if(xmlHttp.readyState==4)//判断对象状态
    	{
	     if(xmlHttp.status==200)
	        {	
	            document.getElementById("MapSearchListDivBody").innerHTML=xmlHttp.responseText;
	            var X=document.getElementById("linePointX").innerHTML.split(','); 
	            var Y=document.getElementById("linePointY").innerHTML.split(',');
	            showline(X,Y);
	        }
	        xmlHttp=null;
	      }
	}
    
    xmlHttp.send(null);
}
function showline(X,Y)
{
   //alert(X);
  clsRemove();   

   var points=new Array();
   
   for(var i=0;i<X.length;i++)
   {
       
        var point=new Object();
        Y[i]=parseFloat(Y[i]);
        point.x=parseFloat(X[i]);
        point.y=parseFloat(Y[i]);
        points.push(point);
   }

    map.CustomLayer.AddLine("BusLine", X, Y, 2, "blue", 1) ;
    map.ViewByPoints(points);
    while(points.length>0){
	    points.pop();
    }
    points=null;
  
}
/*******************************************************公交搜索之站台**********************************************************/
function StopSearch()
{
    var Stop=document.getElementById("Stop").value;
    if(!Stop){alert("请输入站台名！");document.getElementById("Stop").focus(); return;}
    var city=clearNbsp(document.getElementById("MapAreaName").innerHTML); 
    var url="Handler/MapBusHandler.ashx?op=Stop&city="+escape(city)+"&Stop="+escape(Stop)+"&T="+new Date().getTime();
    //document.write(url);
    //alert(url);
     var div=document.getElementById("MapSearchListDiv");
    if(div)
    {
        document.getElementById("MapSearchListDivBody").innerHTML="<br><br><br><br><br>"+loading();
        div.display="";
        document.getElementById("MapSearchListDivBody").display="";
        document.getElementById("MapSearchListDivfoot").display="";
    }else
    {
         MapSearchListDiv("<br><br><br><br><br>"+loading(),"");
    }
   
    var xmlHttp=new createXMLHTTP();
    xmlHttp.open("get",url,false);
	xmlHttp.onreadystatechange=function(){
	if(xmlHttp.readyState==4)//判断对象状态
    	{
	     if(xmlHttp.status==200)
	        {	
	            document.getElementById("MapSearchListDivBody").innerHTML=xmlHttp.responseText;	            
	        }
	        xmlHttp=null;
	      }
	}
    
    xmlHttp.send(null);
}
/*******************************************************公交搜索之换乘**********************************************************/
function SESearch()
{
    var startStop=document.getElementById("startStop").value;
    var endStop=document.getElementById("endStop").value;
    if(!startStop){alert("请输入站台名！");document.getElementById("startStop").focus(); return;}
    if(!endStop){alert("请输入站台名！");document.getElementById("endStop").focus(); return;}
    var city=clearNbsp(document.getElementById("MapAreaName").innerHTML);
    var url="Handler/MapBusHandler.ashx?op=SESearch&city="+escape(city)+"&startStop="+escape(startStop)+"&endStop="+escape(endStop)+"&T="+new Date().getTime();
    //document.write(url);
    //alert(url);
    var div=document.getElementById("MapSearchListDiv");
    if(div)
    {
        document.getElementById("MapSearchListDivBody").innerHTML="<br><br><br><br><br>"+loading();
        div.display="";
        document.getElementById("MapSearchListDivBody").display="";
        document.getElementById("MapSearchListDivfoot").display="";
    }else
    {
         MapSearchListDiv("<br><br><br><br><br>"+loading(),"");
    }
   
    var xmlHttp=new createXMLHTTP();
    xmlHttp.open("get",url,false);
	xmlHttp.onreadystatechange=function(){
	if(xmlHttp.readyState==4)//判断对象状态
    	{
	     if(xmlHttp.status==200)
	        {	
	            document.getElementById("MapSearchListDivBody").innerHTML=xmlHttp.responseText;	            
	        }
	        xmlHttp=null; 
	        
	      }
	}
    
    xmlHttp.send(null);
}
//精确的换乘 
function RSESearch(city)
{   
    map.SetZoomLevel(7);
    var startStopID=document.getElementById("startStopList").value;
    var endStopID=document.getElementById("endStopList").value;
    if(startStopID==endStopID)
	{
	    alert('起点就是终点，请走路吧！');
	    return;	    
	}
    var url="Handler/MapBusHandler.ashx?op=RSESearch&city="+escape(city)+"&startStopID="+escape(startStopID)+"&endStopID="+escape(endStopID)+"&T="+new Date().getTime();
    //document.write(url);
    //alert();
    var div=document.getElementById("MapSearchListDiv");
    if(div)
    {
        document.getElementById("MapSearchListDivBody").innerHTML="<br><br><br><br><br>"+loading();
        div.display="";
        document.getElementById("MapSearchListDivBody").display="";
        document.getElementById("MapSearchListDivfoot").display="";
    }else
    {
         MapSearchListDiv("<br><br><br><br><br>"+loading(),"");
    }
   
    var xmlHttp=new createXMLHTTP();
    xmlHttp.open("get",url,false);
	xmlHttp.onreadystatechange=function(){
	if(xmlHttp.readyState==4)//判断对象状态
    	{
	     if(xmlHttp.status==200)
	        {	
	            document.getElementById("MapSearchListDivBody").innerHTML=xmlHttp.responseText;	            
	        }
	        xmlHttp=null;
	      }
	}
    
    xmlHttp.send(null);
}


//查询起点站
function startshowStop(city)
{
    var StopID=document.getElementById("startStopList").value;
    
    var url="Handler/MapBusHandler.ashx?op=SotpByID&city="+escape(city)+"&StopID="+StopID+"&T="+new Date().getTime();
    //document.write(url);
    var xmlHttp=new createXMLHTTP();
       
    xmlHttp.open("get",url,false);
	xmlHttp.onreadystatechange=function(){
	if(xmlHttp.readyState==4)//判断对象状态
    	{
	     if(xmlHttp.status==200)
	        {	
	          var value=xmlHttp.responseText.split(',');
	           if(value.length>1)
	           {
	                showstartStop(value[0],value[1],value[2]);
	           }
	        }
	        xmlHttp=null;
	      }
	}
    
    xmlHttp.send(null);
}
//显示起点站
function showstartStop(x,y,Name)
{
    if(map.GetZoomLevel()<7)
    {
        map.SetZoomLevel(7);
    }   

    var str="<table><tr><td><img src=\"images/BUS.gif\" title='起点："+Name+"'/></td><td heigth=20 class='kk' style=\" background-color:#FFFFCC;\">&nbsp;"+Name+"&nbsp;</td></tr></table>";
    map.CustomLayer.InsertMark("SBusStop", x, y, 20, 22, str,"",10);
    moveMap(x,y);
}
//查找终点
function endshowStop(city)
{
    var StopID=document.getElementById("endStopList").value;
    var url="Handler/MapBusHandler.ashx?op=SotpByID&city="+escape(city)+"&StopID="+StopID+"&T="+new Date().getTime();
    var xmlHttp=new createXMLHTTP();
    xmlHttp.open("get",url,false);
	xmlHttp.onreadystatechange=function(){
	if(xmlHttp.readyState==4)//判断对象状态
    	{
	     if(xmlHttp.status==200)
	        {	
	           value=xmlHttp.responseText.split(',');
	           if(value.length>1)
	           {
	                var value= showendStop(value[0],value[1],value[2]);
	           }
	        }
	        xmlHttp=null;
	      }
	}
    
    xmlHttp.send(null);
}
//显示终点站

function showendStop(x,y,Name)
{
    if(map.GetZoomLevel()<7)
    {
        map.SetZoomLevel(7);
    }

    var str="<table><tr><td><img src=\"images/BUS.gif\" title='终点："+Name+"'/></td><td heigth=20 class='kk' style=\" background-color:#FFFFCC;\">&nbsp;"+Name+"&nbsp;</td></tr></table>";
    map.CustomLayer.InsertMark("EBusStop", x, y, 20, 22, str,"",10);
    moveMap(x,y);
}




//显示标记
function showStop(x,y,Name)
{
    if(map.GetZoomLevel()<7)
    {
        map.SetZoomLevel(7);
    }
    var str="<table><tr><td><img src=\"images/BUS.gif\" title='"+Name+"'/></td><td heigth=20 class='kk' style=\" background-color:#FFFFCC;\">&nbsp;"+Name+"&nbsp;</td></tr></table>";
    map.CustomLayer.InsertMark("EBusStop", x, y, 20, 22, str,"",10);
    moveMap(x,y);
}

//清除标记
function clsRemove()
{
    map.CustomLayer.RemoveLine("BusLine");
    map.CustomLayer.RemoveMark("SBusStop");
    map.CustomLayer.RemoveMark("BusStop");
    map.CustomLayer.RemoveMark("EBusStop");
}












/*******************************************************标出点位**********************************************************/
function addpoint()
{
    while($("point"))
    {
        map.CustomLayer.RemoveMark("point");
    }
    map.CustomLayer.RemoveMark("pointone");
    var name=document.getElementById("lblPointName").innerHTML.split(',');    
    var X=document.getElementById("lblPointX").innerHTML.split(',');
    var Y=document.getElementById("lblPointY").innerHTML.split(',');    
    var id=document.getElementById("lblPointID").innerHTML.split(',');
    if(map.GetZoomLevel()!=7)
    {
        map.SetZoomLevel(7);
    }
    for (i=0;i<name.length;i++)
    {
        moveMap(X[i],Y[i]);
        addCustomLayer(id[i],name[i],X[i],Y[i],(i+1));
    }
}
//加标点的法
function addCustomLayer(id,name,x,y,zIndex)
{
	//alert(zIndex);
    if(map.GetZoomLevel()!=6)
    {
        map.SetZoomLevel(6);        
    }        
        var str="<table cellpadding=\"0\" cellspacing=\"0\" width='27' height='27' background='images/point.gif' title='"+name+"' style='cursor:hand;' onmouseover=\"this.parentNode.style.zIndex=12;\" onmouseout=\"this.parentNode.style.zIndex=10;\" onclick='getComInfo("+id+")'><tr><td align='center'>";
        str +="<font color='red'><b>"+zIndex+"</b></font></td></tr></table>";        
        y=parseFloat(y);
		map.CustomLayer.AddMark("point", x, y, 30, 40, str,"",10);
		
		
}

function InsertCustomLayer(id,name,x,y,zIndex)
{
        
        
        var str="<table cellpadding=\"0\" cellspacing=\"0\" width='27' height='27' background='images/point1.gif' title='"+name+"' style='cursor:hand;' onmouseover=\"this.parentNode.style.zIndex=13;\" onmouseout=\"this.parentNode.style.zIndex=10;\" ><tr><td align='center'>";
        str +="<font color='red'><b>"+zIndex+"</b></font></td></tr></table>";
        y=parseFloat(y);        
		map.CustomLayer.InsertMark("pointone", x, y, 30, 40, str,"",11);		
		
}


/****************************************************************************************************************************
    
                                                        以下为地图搜索后显示层的样式

****************************************************************************************************************************/

//搜索列表
function MapSearchListDiv(content,contentfoot)
{
    var div = document.createElement("Div");
    div.id="MapSearchListDiv";
    div.style.right ="0px";
	div.style.top = "250px";
	div.style.width ="226px";
	div.style.height = "340px";
	div.style.position = "absolute";
	div.style.zIndex = 12;
	div.style.filter="alpha(opacity="+(0.9*100)+")";
	div.style.opacity=0.9;
    window.document.form1.appendChild(div);    

    var div_head = document.createElement("Div");
    div_head.id="MapSearchListDivhead";
    div_head.style.left="0px";
    div_head.style.top="0px";
    div_head.style.width ="226px";
    div_head.style.height = "30px";
    div_head.style.position = "absolute";
    div_head.style.backgroundImage = "url(Images/l32.gif)"; 
    var str="<table height=30 width=226px style='cursor:move'><tr><td valign=\"middle\">&nbsp;&nbsp;<img src='Images/searchmove.gif'></td><td width=50 valign=\"bottom\">";
    str +="<table width=50  cellpadding=0 cellspacing=0 height=22  background=\"images/l33.gif\"><tr>";
    str +="<td valign=\"middle\" align=center><img src='images/l35.gif' onmouseover=\"this.src='images/l35-1.gif'\" onclick='ondivlistBody()' onmouseout=\"this.src='images/l35.gif'\" id=\"Imgmix\" title=\"最小化\" style='cursor:default'>";
    str +="</td><td valign=\"middle\" align=center><img src='images/l34.gif'onmouseover=\"this.src='images/l34-1.gif'\" onmouseout=\"this.src='images/l34.gif'\" title=\"关闭\" onclick='ondivlist()' style='cursor:default'></td></table></td></tr></table>";
    div_head.innerHTML=str;
    div.appendChild(div_head);
    
       
    var divBody=document.createElement("Div");
    divBody.id="MapSearchListDivBody";
    divBody.style.left="0px";
    divBody.style.top="30px";
    divBody.style.width ="226px";
    divBody.style.height = "300px";
    divBody.style.position = "absolute";
    divBody.style.backgroundImage = "url(Images/lcf_comlist_line.gif)"; 
    divBody.style.verticalAlign="middle";
    divBody.style.overflow="auto";
    divBody.style.textAlign="center";
    divBody.innerHTML=content;
    divBody.style.zIndex=2;
    div.appendChild(divBody);
    
    
    
    var divfoot=document.createElement("Div");    
    divfoot.id="MapSearchListDivfoot";
    divfoot.style.verticalAlign="middle";
    divfoot.style.textAlign="center";
    divfoot.style.left="0px";
    divfoot.style.top="310px";
    divfoot.style.width ="226px";
    divfoot.style.height = "30px";
    divfoot.style.position = "absolute";
    divfoot.style.backgroundImage = "url(Images/l36a.gif)"; 
    divfoot.innerHTML=contentfoot;
    divfoot.style.zIndex = 1;
    div.appendChild(divfoot);
    var dd = new YAHOO.util.DD("MapSearchListDiv");
	dd.setHandleElId("MapSearchListDivhead");
    
}

//小化列表搜索列表
function ondivlistBody()
{   

     if(document.getElementById("MapSearchListDivBody").style.display=="")
     {
        document.getElementById("MapSearchListDivBody").style.display="none";
        document.getElementById("MapSearchListDivfoot").style.display="none";
        document.getElementById("Imgmix").title="最大化";
     }else
     {
        document.getElementById("MapSearchListDivBody").style.display="";
        document.getElementById("MapSearchListDivfoot").style.display="";
        document.getElementById("Imgmix").title="最小化";
     }
}

//清除列表搜索列表
function ondivlist()
{    

     document.getElementById("MapSearchListDiv").removeChild(document.getElementById("MapSearchListDivBody"));
     document.getElementById("MapSearchListDiv").removeChild(document.getElementById("MapSearchListDivfoot"));
     document.getElementById("MapSearchListDiv").removeChild(document.getElementById("MapSearchListDivhead"));
     window.document.form1.removeChild(document.getElementById("MapSearchListDiv")); 
}




//左边的隐藏/显示
function divComInfoShow()
{  

    if(document.getElementById("ComInfoDiv").style.left=="-201px")
    {
         document.getElementById("ComInfoDiv").style.left="0px";
    }else
    {
        document.getElementById("ComInfoDiv").style.left="-201px";
    }
}

//左边的隐藏
function _divComInfoHide()
{
    document.getElementById("ComInfoDiv").style.display="none"; 

}

////左边的显示
function _divComInfoShow()
{
    document.getElementById("ComInfoDiv").style.display=""; 

}




/*************************************************************了解是否从另一个网页传参过来****************************************************************/
function goSearch()
{
    if(request("MapSearchName")!="")//如果需要地图搜索
    {  
        Topmenu('img2',2);  
        document.getElementById("MapSearchName").value=unescape(request("MapSearchName"));
        document.getElementById("MapCityName").innerHTML=unescape(request("city"));
        MapSearch();
    }else if(request("NearSearchName1")!=""&&request("NearSearchName2")!="")//如果需要周边搜索
    {
        Topmenu('img3',3);
        document.getElementById("NearSearchName1").value=unescape(request("NearSearchName1"));
        document.getElementById("NearSearchName2").value=unescape(request("NearSearchName2"));
        document.getElementById("Near").value=unescape(request("Near"));
        document.getElementById("MapCityName").innerHTML=unescape(request("city"));
        NearSearch();
    }else if(request("TypeSearchNumber")!=""&&request("TypeSearchName")!="")
    {   
        Topmenu('img4',4);
        document.getElementById("TypeSearchNumber").value=unescape(request("TypeSearchNumber"));
        document.getElementById("TypeSearchName").value=unescape(request("TypeSearchName"));
        document.getElementById("MapCityName").innerHTML=unescape(request("city"));
        TypeSearch();
    }else if(request("line")!=""&&request("area")!="")//出行服务
    {
        
        Topmenu('img1',1);
        selectRightmenu(0);
        var Line=document.getElementById("Line").value=unescape(request("line")); 
        document.getElementById("MapAreaName").innerHTML=unescape(request("area")); 
        LineSearch()
    }else if(request("Stop")!=""&&request("area")!="")
    {
        Topmenu('img1',1);
        selectRightmenu(2);
        document.getElementById("Stop").value=unescape(request("Stop"));
        
        document.getElementById("MapAreaName").innerHTML=unescape(request("area"));
        StopSearch()
    }else if(request("endStop")!=""&&request("startStop")!=""&&request("area")!="")
    {
        Topmenu('img1',1);
        selectRightmenu(1);
        document.getElementById("startStop").value=unescape(request("startStop"));
        document.getElementById("endStop").value=unescape(request("endStop"));
        SESearch()
    }
    else if(request("id")!="")//得到地图标点
    {   
        
        var id=unescape(request("id"));
        getComInfo(id);
        map.SetZoomLevel(10);
    }else if(request("op")=="nearSearchByPoint")
    {
        Topmenu('img3',3);
        
        var name=unescape(request("name"));
        var X=unescape(request("X"));
        var Y=unescape(request("Y"));
        var Near=request("Near");
        var value=unescape(request("value"));
        document.getElementById("NearSearchName1").value=name;
        document.getElementById("NearSearchName2").value=value;       
        onNearSearch(name,X,Y,value,Near,1);  
    }

}

//天气预报
function LoadWeatherByCity(City)
{   
  if(City=="阿坝藏族羌族自治州")
  {
    City="阿坝";
  }else if(City=="甘孜藏族自治州")
  {
    City="甘孜";
  }else if(City=="凉山彝族自治州")
  {
    City="凉山";
  }
  var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");   
  xmlDoc.async = false;     
  var url="xml.xml";    
  xmlDoc.load(url);    
  var str="";    
  var oNode = xmlDoc.selectSingleNode("//DocumentElement");    
  for(j=0;j<oNode.childNodes.length;j++)    
  {   
        if(oNode.childNodes[j].childNodes[0].text==City.replace("市",""))
        {
            str= "<label style=\"width=140px\"><marquee id=\"Weathermar\" scrollamount=\"3\"><span onmouseover=\"Weathermar.stop();\" onmouseout=\"Weathermar.start();\">"+oNode.childNodes[j].childNodes[0].text+"&nbsp;"+oNode.childNodes[j].childNodes[1].text +"&nbsp;"+oNode.childNodes[j].childNodes[2].text+"</marquee></label>";   
            break;
        }
   }
  $("lblWeather").innerHTML=str;
}













_IncludeScript('yahoo-min.js');
_IncludeScript('event-min.js');
_IncludeScript('dom-min.js');
_IncludeScript('logger-min.js');
_IncludeScript('dragdrop-min.js');