﻿function GetTraffic(GACTION,getvalue,GO_BACK,getvalue2,id1,id2,id3,id4)   //旅運規劃顯示路線圖
{
       //從mrtplan的aaa得到getvalue或getvalue和getvalue2(公車路線名稱) 然後找出此路線名稱經過的站牌 
    
 ACTION=GACTION;
 //alert(ACTION);
 if(ACTION=="44")  //查詢公車路線
  {
          lunphline=1;
          goback=GO_BACK;
          var a=encodeURI(getvalue);     
          Glid=a;
          var s = "ACTION="+"44"+"&Glid="+a+"&id1="+id1+"&id2="+id2+"&Lang="+PUrlStr;   
               XmlHttp5 = createXMLHttpRequest();
               XmlHttp5.onreadystatechange = suck1; 
               XmlHttp5.open("POST", "./ASPX/Lun_GetTraffic_FUN.aspx", true);   
               XmlHttp5.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
               XmlHttp5.send(s); 
  }
   
 if(ACTION=="444")  //查詢(公車轉公車或公車轉捷運輸公車的)公車路線
  {
          lunphline=2;
          goback=GO_BACK;
          var a=encodeURI(getvalue);   
          var b=encodeURI(getvalue2);    
          var s = "ACTION="+"444"+"&Glid1="+a+"&Glid2="+b+"&id1="+id1+"&id2="+id2+"&id3="+id3+"&id4="+id4+"&Lang="+PUrlStr;    
	    	      
               XmlHttp5 = createXMLHttpRequest();
               XmlHttp5.onreadystatechange = suck1; 
               XmlHttp5.open("POST", "./ASPX/Lun_GetTraffic_FUN.aspx", true); 
               XmlHttp5.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
               XmlHttp5.send(s);   
   }
}


 function suck1()
 {
       if (XmlHttp5.readyState == 4)
        {
          if (XmlHttp5.status == 200)
            {
            	//alert(XmlHttp5.responseText);
              
              if(ACTION=="44")  //ACTION=="44"
                {   
                  suckkk=XmlHttp5.responseText.split('_&');           
    	          suckkk[0]=suckkk[0].split('_|');
                  for (x=1;x<3;x++)
                  {
    	             suckkk[0][x]=suckkk[0][x].split('_,');
    	
                  }
                   lunpathfu();
         
               }//ACTION=="44"
               
              if(ACTION=="444")  //ACTION=="444"
               {   
                   var suckkk2=XmlHttp5.responseText.split('_$');
                   suckkk3=suckkk2[0].split('_&');
                   suckkk4=suckkk2[1].split('_&');
                    for (var i=0;i<2;i++)
                   {
    	             suckkk3[i]=suckkk3[i].split('_|');
                   }
                    for (var x=1;x<suckkk3[0].length;x++)
                   {
    	             suckkk3[0][x]=suckkk3[0][x].split('_,');
                   }
                    for (var y=1;y<suckkk3[1].length;y++)
                   {
    	             suckkk3[1][y]=suckkk3[1][y].split('_,');
                   }
                    for (var ii=0;ii<2;ii++)
                   {
    	             suckkk4[ii]=suckkk4[ii].split('_|');
                   }
                    for (var xx=1;xx<suckkk4[0].length;xx++)
                   {
    	             suckkk4[0][xx]=suckkk4[0][xx].split('_,');
                   }
                    for (var yy=1;yy<suckkk4[1].length;yy++)
                   {
    	             suckkk4[1][yy]=suckkk4[1][yy].split('_,');
                   }
               lunpathfu2();
                	
               }  //ACTION=="444"           
             }    //if (XmlHttp5.status == 200)
          } // if (XmlHttp5.readyState == 4)
  }//function suck1()


function lunpathfu()
{
	//alert(suckkk[0][1][0]+","+suckkk[0][2][0]);
   
    if(lunphline==1)    //1就顯示公車路線和車機的資料 
     { 
       var luuunpathe1 = document.getElementById("luuunpath1");
       var w = gMapBase.getClientWidth();
  	   var h = gMapBase.getClientHeight();
  	   var ltpt = gMapBase.ToMapPoint(0, 0);
  	   var rbpt = gMapBase.ToMapPoint(w, h);
  	   var TM2X = MapToRealPosX(ltpt.X);	
	   var TM2Y = MapToRealPosY(ltpt.Y);	   
  	   var tmps = new Array();

  	   
  	  if(Gsname!=null&&Gcname1!=null&&Gcname2!=null&&Gcname3!=null&&Gcname4!=null&&Gename!=null)  
  	   {   //有這些Gsname!=null&&Gcname1!=null&&Gcname2!=null&&Gcname3!=null&&Gcname4!=null&&Gename!=null
  	   
  	     luuunpath1.innerHTML ="";
  	   
  	   
  	   
  	    if(Gact=='lu1'||Gact=='lu3'||Gact=='lu6')  
  	  { 
  	    //假如是 公車直達，捷運直達方案 那Gsname為第上車的點 Gename為下車點，且搭的公車一樣，去回乘一樣， 
  	    //Gsname站序小 Gename站序大 
  	   var m="";   //起點的站牌名
  	   var n="";   //迄點的站牌名
  	   var mm;
  	   var nn;
  	      var xname;
              var yname;
              var xgoba;
              var ygoba;
              var xsen;
              var ysen;
              var xcount;
              var ycount;
              var xcount0;
              var ycount0;
              var smna;
  	      var emna;
  	    
  	    if(Gact=='lu1')  //找  Gsname  Gcname1
  	    {
  	       smna=Gsname;
  	       emna=Gename;
  	       
  	        try {
  	        for (var ii=1;ii<3;ii++) 
                 {      
                     if(ii < 3)
                     {
                     var  doname=suckkk[0][ii][0]; 
  		    
  		     if(doname==smna)
  		        {
  		         xcount0=ii;
  		        }
  		      if(doname==emna )
  		        {
  		        ycount0=ii;
  		        }  
  		      } 
                 } 
                } // try {
                catch (e) {}
  	       
  	    }
  	    
  	     if(Gact=='lu3')  //找  Gsname  Gcname1
  	    {
  	      //alert("lu3");
  	       smna=Gsname;
  	       emna=Gcname1;
  	        try {
  	          for (var ii=1; ii<3; ii++) 
                  {      
                    if(ii < 3)
                     {
                     var  doname=suckkk[0][ii][0]; 
  		    
  		     if(doname==smna)
  		        {
  		         xcount0=ii;
  		        }
  		      if(doname==emna )
  		        {
  		        ycount0=ii;
  		        }  
  		     }   
                  } 
                 }//try {
                  catch (e) {}
  	    }
  	    
  	     if(Gact=='lu6')  //找  Gsname  Gcname1
  	    {
  	      
  	       smna=Gcname2;
  	       emna=Gename;
  	        try {
  	     for (var ii=1;ii<3;ii++) 
             {      
                    if(i < 3)
                     {
                    var  doname=suckkk[0][ii][0]; 
  		    
  		     if(doname==smna)
  		        {
  		         xcount0=ii;
  		        }
  		      if(doname==emna )
  		        {
  		        ycount0=ii;
  		        }  
  		     }   
              }
                  }//try {
                   catch (e) {}
  	     }
  	   
  	   //一起用
  	   if(xcount0!=null&&ycount0!=null)
  	   {  
  	    
  	     var  Screenlunpa0 =gMapBase.FromMapPoint(RealToMapPosX(suckkk[0][xcount0][4]),RealToMapPosY(suckkk[0][xcount0][5]));	
             var  mrk1="Get.gif";
             var mrk2="Down.gif";
           
            if(Screenlunpa0.X > 0 && Screenlunpa0.Y > 0)  // 貼出上公車的站牌
            {
  		         tmps.push('<img border="0" src="./images/')     
  		         tmps.push(mrk1);
  		         tmps.push('"');
  		         tmps.push('onMouseOver="lunLineInfo2('); 	 
  		         tmps.push( xcount0);
  		         tmps.push( ')"');  	
  		         tmps.push('onMouseout="document.getElementById(\'luuunpath3\').style.display=\'none\'; "');	  
  		         tmps.push(' style= "cursor:hand; position:absolute;left:');
  		         tmps.push(Screenlunpa0.X-19);
  		         tmps.push('px;top:');
  		         tmps.push(Screenlunpa0.Y-31);
  		         tmps.push('px;z-index:3; width:19px; length:31px;">'); 
  		        //alert(Screenlunpa0.X+","+Screenlunpa0.Y );
  	     } 	
  		     
  		     
  	      var  Screenlunpa1 =gMapBase.FromMapPoint(RealToMapPosX(suckkk[0][ycount0][4]),RealToMapPosY(suckkk[0][ycount0][5]));	

            if(Screenlunpa1.X > 0 && Screenlunpa1.Y > 0)  //貼出下公車的站牌
            {
  		         tmps.push('<img border="0" src="./images/')     
  		         tmps.push(mrk2);
  		         tmps.push('"');
  		         tmps.push('onMouseOver="lunLineInfo2('); 	 
  		         tmps.push( ycount0);
  		         tmps.push( ')"');  	  
  		         tmps.push('onMouseout="document.getElementById(\'luuunpath3\').style.display=\'none\'; "');	
  		         tmps.push(' style= "cursor:hand; position:absolute;left:');
  		         tmps.push(Screenlunpa1.X-19);
  		         tmps.push('px;top:');
  		         tmps.push(Screenlunpa1.Y-31);
  		         tmps.push('px;z-index:3; width:19px; length:31px;">'); 
  		       
  	     } //if(Screenlunpa1.X > 0 && Screenlunpa1.Y > 0) 	
     
  		     
            }//一起用
  	           document.getElementById('luuunpath2').innerHTML = "";
  	           document.getElementById('luuunpath2').style.display='';
  	           document.getElementById('luuunpath2').innerHTML = tmps.join(''); 
  	 
  	
  	    try{  
  	   
  	    if(RGLayer!=null)
  	    {
  	      if( _LayerManager.RemovePointLayerTrue(RGLayer) == true  )
  	      _LayerManager.RemovePointLayer(RGLayer);
  	      
  	    }
  	    
  	    if(RGLayer2!=null )
        {
           if( _LayerManager.RemovePointLayerTrue(RGLayer2) == true  )
           _LayerManager.RemovePointLayer(RGLayer2);
         
        }
  	   
  	    
  	    RGLayer=_LayerManager.AddShpLayer2(suckkk[0][1][1],suckkk[0][1][1],suckkk[0][1][6],"2");   
  	    gMapBase.RefreshMap(true,true);  
  	    RGLayervalue=1; 
  	    }catch(e){}
             
  	   } //if(Gact=='lu1'||Gact=='lu3'||Gact=='lu6')
  	} //if(Gsname!=null&&Gcname1!=null&&Gcname2!=null&&Gcname3!=null&&Gcname4!=null&&Gename!=null)
    } //if(lunphline==1)

}
       
 function lunpathfu2()
{
// alert(lunphline);
  if(lunphline==2)    //1就顯示公車路線和車機的資料 
     { 
       
  	    if(RGLayer!=null)
  	    {
  	      if( _LayerManager.RemovePointLayerTrue(RGLayer) == true  )
  	      _LayerManager.RemovePointLayer(RGLayer);
  	      
  	    }
  	    
  	    if(RGLayer2!=null )
        {
           if( _LayerManager.RemovePointLayerTrue(RGLayer2) == true  )
           _LayerManager.RemovePointLayer(RGLayer2);
        }
       
       var w = gMapBase.getClientWidth();
  	   var h = gMapBase.getClientHeight();
  	   var ltpt = gMapBase.ToMapPoint(0, 0);
  	   var rbpt = gMapBase.ToMapPoint(w, h);
  	   var TM2X = MapToRealPosX(ltpt.X);	
	   var TM2Y = MapToRealPosY(ltpt.Y);
	   var tmps = new Array();
	   
  	 
  	  if(Gsname!=null&&Gcname1!=null&&Gcname2!=null&&Gcname3!=null&&Gcname4!=null&&Gename!=null)  
  	   {   //有這些Gsname!=null&&Gcname1!=null&&Gcname2!=null&&Gcname3!=null&&Gcname4!=null&&Gename!=null
  	   
  	      luuunpath1.innerHTML ="";
  	      var m="";   //起點的站牌名
  	      var n="";   //迄點的站牌名
  	      var mm;
  	      var nn;
  	      var xname;
              var yname;
              var xgoba;
              var ygoba;
              var xsen;
              var ysen;
              var xcount;
              var ycount;
              var xcount0;
              var ycount0;
              var smna;
  	      var emna;
  	      
  	      
  	       var m2="";   //起點的站牌名
  	       var n2="";   //迄點的站牌名
  	       var mm2;
  	       var nn2;
  	       var xname2;
               var yname2;
               var xgoba2;
               var ygoba2;
               var xsen2;
               var ysen2;
               var xcount3;
               var ycount3;
               var xcount4;
               var ycount4;
  	       var smna2;
  	       var emna2;
  	          
  	          
  	   
  	    if(Gact=='lu2'||Gact=='lu4')  
  	     { 
  	       if(Gact=='lu2')
  	       {
  	       smna=Gsname;
  	       emna=Gcname1;
  	       smna2=Gcname2;
  	       emna2=Gename;
  	       
  	      }
  	      
  	      if(Gact=='lu4')
  	       {
  	       smna=Gsname;
  	       emna=Gcname1;
  	       smna2=Gcname4;
  	       emna2=Gename;
  	      }
  	      
  	      try {
  	       for (var gg=1;gg<suckkk3[0].length;gg++) 
                 {      
                     var  doname=suckkk3[0][gg][0]; 
  		     if(doname==smna)
  		        {
  		        xcount0=gg;
  		        }
  		      if(doname==emna )
  		        {
  		        ycount0=gg;
  		        }  
  		        
                 }  // for (i=1;i<suckkk[0].length;i++) 
                } //try {
                catch (e) {}
       
            try {
  	     for (var y=1;y<suckkk4[0].length;y++) 
             {      
                     var  doname2=suckkk4[0][y][0]; 
  		     if(doname2==smna2)
  		        {
  		        xcount4=y;
  		        }
  		      if(doname2==emna2 )
  		        {
  		         ycount4=y;
  		        }  
  		        
              }  // for (i=1;i<suckkk[0].length;i++) 
             }//try {
                catch (e) {}
              
              
                 
  	   }  
  	      //一起用
  	   if(xcount0!=null&&ycount0!=null)
  	   {  
  	        var  Screenlunpa0 =gMapBase.FromMapPoint(RealToMapPosX(suckkk3[0][xcount0][4]),RealToMapPosY(suckkk3[0][xcount0][5]));	
            //第一條路線的第一個站牌
             var  mrk1="Get.gif";
           
             var mrk2="Down.gif";
           
            if(Screenlunpa0.X > 0 && Screenlunpa0.Y > 0)
            {
  		         tmps.push('<img border="0" src="./images/')     
  		         tmps.push(mrk1);
  		         tmps.push('"'); 
  		         tmps.push('onMouseOver="lunLineInfo2(');    
  		         tmps.push( xcount0);
  		         tmps.push( ',suckkk3)"');  
  		        // tmps.push('onMouseOut="lunpalLineCler()"'); 
  		         tmps.push('onMouseout="document.getElementById(\'luuunpath3\').style.display=\'none\'; "');		  	  
  		         tmps.push(' style= "cursor:hand;position:absolute;left:');
  		         tmps.push(Screenlunpa0.X-16);
  		         tmps.push('px;top:');
  		         tmps.push(Screenlunpa0.Y-16);
  		         tmps.push('px;z-index:3; width:20px;">'); 
  		       
  		     } 	
  		     
  		     
  		    var  Screenlunpa1 =gMapBase.FromMapPoint(RealToMapPosX(suckkk3[0][ycount0][4]),RealToMapPosY(suckkk3[0][ycount0][5]));	
                 //第一條路線的第二個站牌
            if(Screenlunpa1.X > 0 && Screenlunpa1.Y > 0)
            {
  		         tmps.push('<img border="0" src="./images/')     
  		         tmps.push(mrk2);
  		         tmps.push('"'); 
  		         tmps.push('onMouseOver="lunLineInfo2(');   	 
  		         tmps.push( ycount0);
  		         tmps.push( ',suckkk3)"');  
  		         //tmps.push('onMouseOut="lunpalLineCler()"'); 	  
  		          tmps.push('onMouseout="document.getElementById(\'luuunpath3\').style.display=\'none\'; "');		  
  		         tmps.push(' style= "cursor:hand;position:absolute;left:');
  		         tmps.push(Screenlunpa1.X-16);
  		         tmps.push('px;top:');
  		         tmps.push(Screenlunpa1.Y-16);
  		         tmps.push('px;z-index:3; width:20px;">'); 
  		       
  		     } 	

  		 }
  		
  	   if(xcount4!=null&&ycount4!=null)
  	   {  var  Screenlunpa2 =gMapBase.FromMapPoint(RealToMapPosX(suckkk4[0][xcount4][4]),RealToMapPosY(suckkk4[0][xcount4][5]));	
           //第二條路線的第一個站牌
              var  mrk1="Get.gif";
           
             var mrk2="Down.gif";
           
            if(Screenlunpa2.X > 0 && Screenlunpa2.Y > 0)
            {
  		         tmps.push('<img border="0" src="./images/')     
  		         tmps.push(mrk1);
  		         tmps.push('"');
  		         tmps.push('onMouseOver="lunLineInfo2(');   //當滑鼠點下時，就顯示從哪裡走到哪裡就會到哪裡的資訊 	 
  		         tmps.push( xcount4);
  		         tmps.push( ',suckkk4)"');  
  		        // tmps.push('onMouseOut="lunpalLineCler()"'); 	 
  		         tmps.push('onMouseout="document.getElementById(\'luuunpath3\').style.display=\'none\'; "');		  
  		         tmps.push(' style= "cursor:hand;position:absolute;left:');
  		         tmps.push(Screenlunpa2.X-16);
  		         tmps.push('px;top:');
  		         tmps.push(Screenlunpa2.Y-16);
  		         tmps.push('px;z-index:3; width:20px;">'); 
  		       
  		     } 	
  		     
  		     
  		    var  Screenlunpa3 =gMapBase.FromMapPoint(RealToMapPosX(suckkk4[0][ycount4][4]),RealToMapPosY(suckkk4[0][ycount4][5]));	
               //第二條路線的第二個站牌
            if(Screenlunpa3.X > 0 && Screenlunpa3.Y > 0)
            {
  		         tmps.push('<img border="0" src="./images/')     
  		         tmps.push(mrk2);
  		         tmps.push('"');
  		         tmps.push('onMouseOver="lunLineInfo2(');   //當滑鼠點下時，就顯示從哪裡走到哪裡就會到哪裡的資訊 	 
  		         tmps.push( ycount4);
  		         tmps.push( ',suckkk4)"');  
  		        // tmps.push('onMouseOut="lunpalLineCler()"'); 
  		         tmps.push('onMouseout="document.getElementById(\'luuunpath3\').style.display=\'none\'; "');			  
  		         tmps.push(' style= "cursor:hand;position:absolute;left:');
  		         tmps.push(Screenlunpa3.X-16);
  		         tmps.push('px;top:');
  		         tmps.push(Screenlunpa3.Y-16);
  		         tmps.push('px;z-index:3; width:20px;">'); 
  		       
  		     } 	
  		     
  		 }
  	   //一起用
  	           document.getElementById('luuunpath2').innerHTML = "";
  	           document.getElementById('luuunpath2').style.display='';
  	           document.getElementById('luuunpath2').innerHTML = tmps.join(''); 
  	              
  	     
       
         
   try{RGLayer=_LayerManager.AddShpLayer2(suckkk3[0][1][1],suckkk3[0][1][1],suckkk3[0][1][6],"2");    
   RGLayer2=_LayerManager.AddShpLayer2(suckkk4[0][1][1],suckkk4[0][1][1],suckkk4[0][1][6],"3");    gMapBase.RefreshMap(true,true);  RGLayervalue=2;}catch(e){} 
 	     
   	   
  	 
  	   } //有這些Gsname!=null&&Gcname1!=null&&Gcname2!=null&&Gcname3!=null&&Gcname4!=null&&Gename!=null
     
      }  // if(lunphline==2) 
}//function lunpathfu2()      
       
function lunLineInfo3(bg)  //當滑鼠點下時，就顯示起迄點的資訊 或捷運站牌的資訊 	 bg為0是起點 1是迄點
{
         var THE_NAME;
         var S3;
         var walk;
         var topl;
         var start;
         var end;
  
           if(bg==0)  
           { 
             start=mrts_x;
             end=mrts_y;
             if(PUrlStr=="eng")
              {
               walk="Walk <font color=blue>"+walk1+"</font>m where the destination is located<font color=blue>"+Gsname+"</font>.";
              }
             else 
              {
               walk="由此起點步行<font color=blue>"+walk1+"</font>公尺後便可到達<font color=blue>"+Gsname+"</font>";
              }
             S3 =gMapBase.FromMapPoint(RealToMapPosX(start),RealToMapPosY(end)); 
             topl=S3.Y-75;
           }
           
           if(bg==31)   //公車轉捷運  起點搭的捷運站
           { 
             THE_NAME=Gcname2;
             document.getElementById('shxxp4').innerHTML ='';
             S3 =gMapBase.FromMapPoint(RealToMapPosX(Gcx2),RealToMapPosY(Gcy2));
             if(PUrlStr=="eng")
              {
               walk="Take a MRT from this station and get off after <font color=blue>"+num2+"</font> station(s) at <font color=blue>"+Gename+"</font> station.";
              }
             else
              {
               walk="由此捷運站搭乘捷運經過<font color=blue>"+num2+"</font>個站後便可到達<font color=blue>"+Gename+"</font>捷運站";
              }
             topl=S3.Y-105;
           }
           
           if(bg==32)   //公車轉捷運  起點搭的捷運站
           { 
              THE_NAME=Gename;
              document.getElementById('shxxp4').innerHTML = '';
              S3 =gMapBase.FromMapPoint(RealToMapPosX(Gex),RealToMapPosY(Gey));
              if(PUrlStr=="eng")
              {
                walk="From this stop walk <font color=blue>"+walk3+"</font>m where the destination is located.";
              }
             else 
              {
                walk="走出此捷運站後步行約<font color=blue>"+walk3+"</font>公尺後便可到達目的地";
              }
              topl=S3.Y-105;
           }
           
           if(bg==41)   //公車轉捷運  起點搭的捷運站
           { 
             document.getElementById('shxxp4').innerHTML = '';
             S3 =gMapBase.FromMapPoint(RealToMapPosX(Gcx2),RealToMapPosY(Gcy2));
             if(PUrlStr=="eng")
              {
               walk="Take a MRT from this station and get off after <font color=blue>"+num2+"</font> station(s) at <font color=blue>"+Gcname3+"</font> station.";
              }
             else 
              {
               walk="由此捷運站搭乘捷運經過<font color=blue>"+num2+"</font>個站後便可到達<font color=blue>"+Gcname3+"</font>捷運站";
              }
             topl=S3.Y-85;
           }
           
           if(bg==42)   //公車轉捷運  起點搭的捷運站
           { 
             document.getElementById('shxxp4').innerHTML = '';
             S3 =gMapBase.FromMapPoint(RealToMapPosX(Gcx3),RealToMapPosY(Gcy3));
             if(PUrlStr=="eng")
              {
               walk="Walk <font color=blue>"+walk3+"</font>m from this station to <font color=blue>"+Gcname4+"</font>.";
              }
             else 
              {
               walk="走出此捷運站後步行約<font color=blue>"+walk3+"</font>公尺後便可到達<font color=blue>"+Gcname4+"</font>公車站牌";
              }
             topl=S3.Y-85;
           }
           
           if(bg==51)   //捷運直達的  起點搭的捷運站
           { 
             THE_NAME=Gsname;
             document.getElementById('shxxp4').innerHTML = '';
             S3 =gMapBase.FromMapPoint(RealToMapPosX(Gsx),RealToMapPosY(Gsy));
             if(PUrlStr=="eng")
              {
               walk="Take a MRT from this station and get off after <font color=blue>"+num1+"</font> station(s) at <font color=blue>"+Gename+"</font> station.";
              }
             else 
              {
               walk="由此捷運站搭乘捷運經過<font color=blue>"+num1+"</font>個站後便可到達<font color=blue>"+Gename+"</font>捷運站";
              }
             topl=S3.Y-100;
           }
           
           if(bg==52)   //捷運直達的  起點搭的捷運站
           { 
             THE_NAME=Gename;
             document.getElementById('shxxp4').innerHTML = '';
             S3 =gMapBase.FromMapPoint(RealToMapPosX(Gex),RealToMapPosY(Gey));
             if(PUrlStr=="eng")
              {
               walk="From this stop walk <font color=blue>"+walk2+"</font>m where the destination is located.";
              }
             else 
              {
               walk="走出此捷運站後步行約<font color=blue>"+walk2+"</font>公尺後便可到達目的地";
              }
             topl=S3.Y-100;
           }
           
           if(bg==61)   //捷運轉公車的  起點搭的捷運站
           { 
             THE_NAME=Gsname;
             document.getElementById('shxxp4').innerHTML = '';
             S3 =gMapBase.FromMapPoint(RealToMapPosX(Gsx),RealToMapPosY(Gsy));
             if(PUrlStr=="eng")
              {
               walk="Take a MRT from this station and get off after <font color=blue>"+num1+"</font> station(s) at <font color=blue>"+Gcname1+"</font> station.";
              }
             else 
              {
               walk="由此捷運站搭乘捷運經過<font color=blue>"+num1+"</font>個站後便可到達<font color=blue>"+Gcname1+"</font>捷運站";
              } 
             topl=S3.Y-102;
           }
           
           if(bg==62)   //捷運轉公車的  起點搭的捷運站
           { 
              THE_NAME=Gcname1;
              document.getElementById('shxxp4').innerHTML = '';
              S3 =gMapBase.FromMapPoint(RealToMapPosX(Gcx1),RealToMapPosY(Gcy1));
              if(PUrlStr=="eng")
              {
               walk="Walk <font color=blue>"+walk2+"</font>m from this station to <font color=blue>"+Gcname2+"</font>.";
              }
             else 
              {
               walk="走出此捷運站後步行約<font color=blue>"+walk2+"</font>公尺後便可到達<font color=blue>"+Gcname2+"</font>公車站牌";
              } 
             topl=S3.Y-102;
           }
           
           
              var tmps2 = new Array();
              tmps2.push('<table border="0"   ') 
              tmps2.push('onMouseout="document.getElementById(\'luuunpath3\').style.display=\'none\'; "');
              tmps2.push('onMouseover="lunpalLineIN()"'); 		     
  	          tmps2.push(' style= " background:#FEFFAF;filter:alpha(opacity=83);   cursor:hand;  font-family: Arial;text-align:center; font-size: 7pt; border:#E10F00   1px   solid; position:absolute;left:');
  		      tmps2.push(S3.X-75);  
  		      tmps2.push('px;top:');
  		      tmps2.push(topl );  
  		      tmps2.push('px;z-index:3;' );	     
  		      tmps2.push('width:' );
  		      tmps2.push('140' );
  		      tmps2.push('px;');
  	  	      tmps2.push('length:' );
  		      tmps2.push('50' );
  		      tmps2.push('px;">');
  		      tmps2.push('<tr style= "  cursor:default; background-color:#FF91FE; font-size: 9pt;   border-style:ridge;">');
  		      tmps2.push('<td>');
  		      tmps2.push(THE_NAME);
  		      tmps2.push('</td>');
  		      tmps2.push('</tr>');
  		      tmps2.push('<tr style= "  cursor:default; font-size: 9pt; ">');
  		      tmps2.push('<td>');
  		      tmps2.push(walk);
  		      tmps2.push('</td>');
  		      tmps2.push('</tr>');
  		      tmps2.push('</table>');   		    
  		      
  		      document.getElementById('luuunpath3').style.display='';  
  	          document.getElementById('luuunpath3').innerHTML = tmps2.join(''); 
  	 	             
} //lunLineInfo3(bg) 
 
       
function lunLineInfo2(xkx,yky,bg)  //當滑鼠點下時，就顯示從哪裡走到哪裡就會到哪裡的資訊 	 bg為0是起點
{
 //this.PaToBline=PaToBline;
  
  var x=xkx;
  var ScreenClientPt2;
  var x_x;
  var x_y; 
  var x_name;
  var timer;   
  var unm;
  var walk;
  var topl;
  var The_Name="";
  var ykk;
  
  
if(yky==null) //除了方案2、4的一般情況
 { 
   ScreenClientPt2 =gMapBase.FromMapPoint(RealToMapPosX(suckkk[0][x][4]),RealToMapPosY(suckkk[0][x][5])); 
   x_name=suckkk[0][x][0];
   The_Name=suckkk[0][x][0];
   
   if(Gact=='lu1')  
    { 
      if(PUrlStr=="eng")
       {
         if(x_name==Gsname)
          {walk="Take bus no.<font color=blue>"+car1+"</font> from this stop to<font color=blue>"+Gename+"</font>."; topl=ScreenClientPt2.Y-103;}
         else
          {walk="From this stop walk <font color=blue>"+walk2+"</font>m where the destination is located."; topl=ScreenClientPt2.Y-103;}
       }
      else
       {
         if(x_name==Gsname)
          {walk="由此站牌搭乘公車<font color=blue>"+car1+"</font>到達<font color=blue>"+Gename+"</font>"; topl=ScreenClientPt2.Y-103;}
         else
          {walk="由此站牌下車步行約<font color=blue>"+walk2+"</font>公尺後便可抵達目的地"; topl=ScreenClientPt2.Y-103;}
       }     
    }
   if(Gact=='lu3')  
    { 
      if(PUrlStr=="eng")
       {
         if(x_name==Gsname)
          {walk="Take bus no.<font color=blue>"+car1+"</font> from this stop to <font color=blue>"+Gcname1+"</font>."; topl=ScreenClientPt2.Y-103;}
         else
          {walk="Walk <font color=blue>"+walk2+"</font>m from this stop to <font color=blue>"+Gcname2+"</font> station."; topl=ScreenClientPt2.Y-103;}
       }
      else
       { 
        if(x_name==Gsname)
         {walk="由此站牌搭乘公車<font color=blue>"+car1+"</font>到達<font color=blue>"+Gcname1+"</font>."; topl=ScreenClientPt2.Y-103;}
        else
         {walk="由此站牌下車步行約<font color=blue>"+walk2+"</font>公尺後到達<font color=blue>"+Gcname2+"</font>捷運站"; topl=ScreenClientPt2.Y-103;}
       }    
    } 
 
   if(Gact=='lu6')  
    { 
      if(PUrlStr=="eng")
       {
        if(x_name==Gcname2)
         {walk="Take bus no.<font color=blue>"+car1+"</font> from this stop to <font color=blue>"+Gename+"</font>."; topl=ScreenClientPt2.Y-103;}
        else if(x_name==Gename)
         {walk="From this stop walk <font color=blue>"+walk3+"</font>m where the destination is located."; topl=ScreenClientPt2.Y-103;}
       }
      else
       {
        if(x_name==Gcname2)
         {walk="由此站牌搭乘公車<font color=blue>"+car1+"</font>到達<font color=blue>"+Gename+"</font>."; topl=ScreenClientPt2.Y-103;}
        else if(x_name==Gename)
         {walk="由此站牌下車步行約<font color=blue>"+walk3+"</font>公尺後便可抵達目的地"; topl=ScreenClientPt2.Y-103;}
       }      
    }
  }  // if(yky==null)
  
  
else   //方案2或4的時候
 {
   if(Gact=='lu2')  
    { 
      ykk=eval(yky);
      ScreenClientPt2 =gMapBase.FromMapPoint(RealToMapPosX(yky[0][x][4]),RealToMapPosY(yky[0][x][5])); 
      x_name=yky[0][x][0];    
      if(yky==suckkk3) 
       {
        if(PUrlStr=="eng")
         {
          if(x_name==Gsname)
           {The_Name=x_name; walk="Take bus no.<font color=blue>"+car1+"</font> from this stop to <font color=blue>"+Gcname1+"</font>."; topl=ScreenClientPt2.Y-90;}
          else if(x_name==Gcname1)
           {The_Name=x_name; walk="Walk <font color=blue>"+walk2+"</font>m from this stop to <font color=blue>"+Gcname2+"</font>."; topl=ScreenClientPt2.Y-95;}
         }
        else
         { 
          if(x_name==Gsname)
           {The_Name=x_name; walk="由此站牌搭乘公車<font color=blue>"+car1+"</font>到<font color=blue>"+Gcname1+"</font>公車站牌"; topl=ScreenClientPt2.Y-90;}
          else if(x_name==Gcname1)
           {The_Name=x_name; walk="由此站牌下車並步行約<font color=blue>"+walk2+"</font>公尺後到達<font color=blue>"+Gcname2+"</font>公車站牌"; topl=ScreenClientPt2.Y-95;}
         }
       }
      else if(yky==suckkk4)
       {
        if(PUrlStr=="eng")
         {
          if(x_name==Gcname2)
           {The_Name=x_name; walk="Take bus no.<font color=blue>"+car2+"</font> from this stop to <font color=blue>"+Gename+"</font>."; topl=ScreenClientPt2.Y-90;}
          else if(x_name==Gename)
           {The_Name=x_name; walk="Walk <font color=blue>"+walk3+"</font>m where the destination is located."; topl=ScreenClientPt2.Y-90;}
         }
        else
         { 
          if(x_name==Gcname2)
           {The_Name=x_name; walk="由此站牌搭乘公車<font color=blue>"+car2+"</font>到<font color=blue>"+Gename+"</font>公車站牌"; topl=ScreenClientPt2.Y-90;}
          else if(x_name==Gename)
           {The_Name=x_name; walk="由此站牌下車並步行約<font color=blue>"+walk3+"</font>公尺後便到達目的地"; topl=ScreenClientPt2.Y-90;}
         }
       }                     
    } //if(Gact=='lu2')     
   
   if(Gact=='lu4')  
    { 
      ykk=eval(yky);
      ScreenClientPt2 =gMapBase.FromMapPoint(RealToMapPosX(yky[0][x][4]),RealToMapPosY(yky[0][x][5])); 
      x_name=yky[0][x][0];
      if(yky==suckkk3) 
       {
        if(PUrlStr=="eng")
         {
           if(x_name==Gsname)
            {The_Name=x_name; walk="Take bus no.<font color=blue>"+car1+"</font> from this stop to <font color=blue>"+Gcname1+"</font>."; topl=ScreenClientPt2.Y-70;}
           else if(x_name==Gcname1)
            {The_Name=x_name; walk="Walk <font color=blue>"+walk2+"</font>m from this stop to <font color=blue>"+Gcname2+"</font>station."; topl=ScreenClientPt2.Y-70;}
         }
        else
         {  
           if(x_name==Gsname)
            {The_Name=x_name; walk="由此站牌搭乘公車<font color=blue>"+car1+"</font>經過<font color=blue>"+num1+"</font>個站後便抵達<font color=blue>"+Gcname1+"</font>公車站牌"; topl=ScreenClientPt2.Y-70;}
           else if(x_name==Gcname1)
            {The_Name=x_name; walk="由此站牌下車並步行約<font color=blue>"+walk2+"</font>公尺後便到達<font color=blue>"+Gcname2+"</font>捷運站"; topl=ScreenClientPt2.Y-70;}
         }
       }
      else if(yky==suckkk4) 
       {
        if(PUrlStr=="eng")
         {
          if(x_name==Gcname4)
           { The_Name=x_name; walk="Take bus no.<font color=blue>"+car2+"</font> from this stop to <font color=blue>"+Gename+"</font>."; topl=ScreenClientPt2.Y-70;}
          else if(x_name==Gename)
           { The_Name=x_name; walk="Walk <font color=blue>"+walk4+"</font>m where the destination is located."; topl=ScreenClientPt2.Y-55;}
         }
        else
         { 
          if(x_name==Gcname4)
           { The_Name=x_name; walk="由此站牌搭乘公車<font color=blue>"+car2+"</font>經過<font color=blue>"+num3+"</font>個站後便抵達<font color=blue>"+Gename+"</font>公車站牌"; topl=ScreenClientPt2.Y-70;}
          else if(x_name==Gename)
           { The_Name=x_name; walk="由此站牌下車並步行約<font color=blue>"+walk4+"</font>公尺便到達目的地"; topl=ScreenClientPt2.Y-55;}
         }
       }             
    }//if(Gact=='lu4')   
  }// else方案2或4的時候
            
              var tmps2 = new Array();
              tmps2.push('<table border="0"   ') 
              tmps2.push('onMouseOut="lunpalLineCler()"'); 
              tmps2.push('onMouseover="lunpalLineIN()"'); 		     
  	          tmps2.push(' style= " background:#FEFFAF;filter:alpha(opacity=83);   cursor:hand;  font-family: Arial;text-align:center; font-size: 7pt; border:#E10F00   1px   solid; position:absolute;left:');
  		      tmps2.push(ScreenClientPt2.X-75);  
  		      tmps2.push('px;top:'+topl+'px;z-index:3;');     
  		      tmps2.push('width:140px;length:50px;">' );
  		      tmps2.push('<tr style= "  cursor:default; background-color:#FF91FE; font-size: 9pt; border-style:ridge;">');
  		      tmps2.push('<td>'+The_Name+'</td></tr>');
  		      tmps2.push('<tr style= "  cursor:default; font-size: 9pt; ">');
  		      tmps2.push('<td>'+walk+'</td></tr>');
  		      tmps2.push('<tr style= " color: blue; font-family: Arial; text-decoration: underline;  cursor:hand;  font-size: 8pt;  "');
  		   
  		     if(Gact !='lu2' && Gact !='lu4')
  		     {
  		      tmps2.push('onMouseDown="lunLineInfo('+x+')" >');    	 
  		      tmps2.push('<td>'+Planlag[15]+'</td></tr>');  //顯示公車資訊
  		     }
  		     
  		     else
  		     {
  		      inxxx=ykk;
  		      tmps2.push('onMouseDown="lunLineInfo('+x+',inxxx)">');    	  
  		      tmps2.push('<td>'+Planlag[15]+'</td></tr>');
  		     }
  		     
  		      tmps2.push('</table>'); 
  		      document.getElementById('luuunpath3').style.display='';
  		      document.getElementById('luuunpath3').innerHTML = tmps2.join(''); 
}     

              ///////////////////////////滑鼠移過顯示車機或站牌的資料/////////////////////
function lunLineInfo(xkx,yky)
{
 //this.PaToBline=PaToBline;
  
 
  var x=xkx;
  var ScreenClientPt2;
  var x_x;
  var x_y; 
  var x_name;
  var timer;   
  var unm;
  
 if(yky==null) //除了方案2、4的一般情況
 { 
  
   ScreenClientPt2 =gMapBase.FromMapPoint(RealToMapPosX(suckkk[0][x][4]),RealToMapPosY(suckkk[0][x][5])); 
   x_x=suckkk[0][x][4];
   x_y=suckkk[0][x][5]; 
   x_name=suckkk[0][x][0];
   
    if(suckkk[0][x][3]=="" && (suckkk[0][x][2]=="0" || suckkk[0][x][2]=="9") )
    {
      timer=Planlag[16]; //暫無動態資訊
    }
    else if(suckkk[0][x][3]=="")
    {
      timer=Planlag[17];  //尚未發車
    }
    else if(suckkk[0][x][3]==0)
    {
       timer=Planlag[18]; //進站中
    }
    else if(suckkk[0][x][3] == 1)
    {
       timer=Planlag[19]; //即將到站
    }
    else
    {   timer=suckkk[0][x][3]+Planlag[20];  }  //分鐘
  }
  else   //方案2或4的時候
  {
    var ykk=eval(yky);
    ScreenClientPt2 =gMapBase.FromMapPoint(RealToMapPosX(yky[0][x][4]),RealToMapPosY(yky[0][x][5])); 
    x_x=yky[0][x][4];
    x_y=yky[0][x][5]; 
    x_name=yky[0][x][0];
   
    if(yky[0][x][3]=="" && (yky[0][x][2]=="0" || yky[0][x][2]=="9"))
    {
      timer=Planlag[16]; //暫無動態資訊
    }
    else if(yky[0][x][3]==0)
    {
       timer=Planlag[18]; //進站中
    }
    else if(yky[0][x][3] ==1)
    {
       timer=Planlag[19]; //即將到站
    }
    else
    {   timer=yky[0][x][3]+Planlag[20];  }  //分鐘
  }
        var tmps2 = new Array();
        tmps2.push('<table border="0" '); 
        tmps2.push('onMouseOut="lunpalLineCler()"'); 	 
        tmps2.push('onMouseover="lunpalLineIN()"'); 	
    	tmps2.push(' style= " background:#FEFFAF;filter:alpha(opacity=83);   cursor:hand;  font-family: Arial;text-align:center; font-size: 7pt; border:#E10F00   1px   solid; position:absolute;left:');
  		tmps2.push(ScreenClientPt2.X-75);  
  		tmps2.push('px;top:');
  		tmps2.push(ScreenClientPt2.Y-60 );  
  		tmps2.push('px;z-index:3;' );	     
  		tmps2.push('width:' );
  		tmps2.push('150' );
  		tmps2.push('px;');
  	  	tmps2.push('length:' );
  		tmps2.push('50' );
  		tmps2.push('px;">');
  		tmps2.push('<tr style= "  cursor:default; background-color:#FF91FE; font-size: 8pt;   border-style:ridge;">');
  		tmps2.push('<td>');
  		tmps2.push(x_name);
  		tmps2.push('</td>');
  		tmps2.push('</tr>');  		      
  		tmps2.push('<tr style= "  cursor:default;  font-size: 8pt;  ">');
  		tmps2.push('<td>');
  		tmps2.push(timer);
  		tmps2.push('</td>');
  		tmps2.push('</tr>');  		      
  		tmps2.push('</table>'); 
  		    
  		document.getElementById('luuunpath3').style.display='';
  		document.getElementById('luuunpath3').innerHTML = tmps2.join('');   	             
}

function lunGaCarInfo(ga)  //車的資料
{
 //this.PaToBline=PaToBline;
  var x=ga;
  var i;
if(suckkk[1]==null)
{return false;}  
  
 var ScreenClientPt2 =gMapBase.FromMapPoint(RealToMapPosX(suckkk[1][x][2]),RealToMapPosY(suckkk[1][x][3]));
 
 
  if(suckkk[1][x][4]==0)
   {
     i=Planlag[21];  //去程
   }
  if(suckkk[1][x][4]==1)
   {
     i=Planlag[22];  //回程
   }
  
              var car_num=suckkk[1][x][0];
              var tmpsGaCar = new Array();
              tmpsGaCar.push('<table border="0"   '); 
              tmpsGaCar.push('onMouseout="document.getElementById(\'luuunpath4\').style.display=\'none\'; "');
              tmpsGaCar.push('onMouseover="document.getElementById(\'luuunpath4\').style.display=\'\'; "'); 		     
  	          tmpsGaCar.push(' style= " background:#FEFFAF;filter:alpha(opacity=83);   cursor:hand;  font-family: Arial;text-align:center; font-size: 9pt; border:#E10F00   1px   solid; position:absolute;left:');
  		      tmpsGaCar.push(ScreenClientPt2.X-60);  
  		      tmpsGaCar.push('px;top:');
  		      tmpsGaCar.push(ScreenClientPt2.Y-65 );  
  		      tmpsGaCar.push('px;z-index:3;' );	     
  		      tmpsGaCar.push('width:' );
  		      tmpsGaCar.push('90' );
  		      tmpsGaCar.push('px;');
  	  		  tmpsGaCar.push('length:' );
  		      tmpsGaCar.push('60' );
  		      tmpsGaCar.push('px;">');
  		      tmpsGaCar.push('<tr>');
  		      tmpsGaCar.push('<td>');
  		      tmpsGaCar.push(i);
  		      tmpsGaCar.push('</td>');
  		      tmpsGaCar.push('</tr>');
  		      tmpsGaCar.push('<tr>');
  		      tmpsGaCar.push('<td>');
  		      tmpsGaCar.push('車號:');
  		      tmpsGaCar.push(car_num);
  		      tmpsGaCar.push('</td>');
  		      tmpsGaCar.push('</tr>');
  		      tmpsGaCar.push('</table>'); 
  		      var luuunpathe4 = document.getElementById("luuunpath4");   
  	              luuunpathe4.innerHTML = tmpsGaCar.join(''); 
  	              luuunpathe4.style.display='';
        
}



 function  lunpalInfoCler()
  {
  //document.getElementById("shxxp2").innerHTML="";
  //document.getElementById("shxxp4").innerHTML="";
  document.getElementById("luuunpath4").innerHTML="";
    //document.getElementById("shxxp4").innerHTML="";
  
  }
  
  
  function lunpalLineCler()
  {
   //document.getElementById("luuunpath3").innerHTML="";
   document.getElementById("luuunpath3").style.display='none';
 
  }
  function lunpalLineIN()
  {
   //document.getElementById("luuunpath3").innerHTML="";
   document.getElementById("luuunpath3").style.display='';
   
  }
	  
	  //////////////////////////滑鼠移過顯示車機或站牌的資料/////////////////////





function Luun(act,sname,sx,sy,cname1,cx1,cy1,cname2,cx2,cy2,cname3,cx3,cy3,cname4,cx4,cy4,ename,ex,ey)
{ 
  var luun = new Array();  
  var bodyrRexf5 = document.getElementById("shxxp5");
  if(act!=undefined)
  {
    shxxp1.innerHTML=''; 
    shxxp4.innerHTML='';  
    
    Gact=act;
       
    Gsname=sname;
    Gsx=sx;
    Gsy=sy;
    Gcname1=cname1;
    Gcx1=cx1; //alert('cx1:'+cx1);
    Gcy1=cy1; //alert('cy1:'+cy1);
    Gcname2=cname2;
    Gcx2=cx2;
    Gcy2=cy2;
    Gcname3=cname3;
    Gcx3=cx3;
    Gcy3=cy3;
    Gcname4=cname4;
    Gcx4=cx4;
    Gcy4=cy4;
    Gename=ename;
    Gex=ex;
    Gey=ey;       
 }    
 
 
if(Gact=='lu1'||Gact=='lu5')  //公車直達
 {
     setPoish=2; //要不要顯示給用戶點起啟點的
  	 document.getElementById("setpxx1").innerHTML= '';
     document.getElementById("setpxx2").innerHTML='';       
     var xy1_name=document.getElementById('TxtPoint0').value;
     var xy1_x=RoadGuideData[0][0];;
     var xy1_y=RoadGuideData[0][1];
     var xy2_name=document.getElementById('TxtPoint1').value;
     var xy2_x=RoadGuideData[1][0];
     var xy2_y=RoadGuideData[1][1];     
     var xy1 =gMapBase.FromMapPoint(RealToMapPosX(xy1_x),RealToMapPosY(xy1_y));
     var xy2 =gMapBase.FromMapPoint(RealToMapPosX(xy2_x),RealToMapPosY(xy2_y));
     var sxy =gMapBase.FromMapPoint(RealToMapPosX(Gsx),RealToMapPosY(Gsy));
     var exy =gMapBase.FromMapPoint(RealToMapPosX(Gex),RealToMapPosY(Gey));              	  		  
  			    
  		  		
  		if(Gact=='lu5')
  		{     
  		  if(RGLayer!=null)
  	      {
  	        if( _LayerManager.RemovePointLayerTrue(RGLayer) == true  )
  	          _LayerManager.RemovePointLayer(RGLayer);  	      
  	      }
  	    
  	      if(RGLayer2!=null )
          {
            if( _LayerManager.RemovePointLayerTrue(RGLayer2) == true  )
             _LayerManager.RemovePointLayer(RGLayer2);         
          }
          
          var Lu5MrtX1=parseInt(sxy.X)-9;
          var Lu5MrtY1=parseInt(sxy.Y)-16;
          var Lu5MrtX2=parseInt(exy.X)-9;
          var Lu5MrtY2=parseInt(exy.Y)-16;
          
  		      luun.push('<img border="0" src="./images/TP_PA.gif"'); 
  		      luun.push('onMouseout="document.getElementById(\'luuunpath3\').style.display=\'none\'; "');	  
  		      luun.push('onMouseOver="lunLineInfo3(51)"');  //當滑鼠點擊此處顯示 起點的捷運站的資訊      
  		      luun.push(' style= "cursor:hand;position:absolute;left:'+Lu5MrtX1+'px;top:'+Lu5MrtY1+'px;z-index:3;width:19px;length:32px ">');
  		      luun.push('<img border="0" src="./images/TP_PA.gif"');     
  		      luun.push('onMouseout="document.getElementById(\'luuunpath3\').style.display=\'none\'; "');  
  		      luun.push('onMouseOver="lunLineInfo3(52)"');  //當滑鼠點擊此處顯示 終點的捷運站的資訊 			        
  		      luun.push(' style= "cursor:hand;position:absolute;left:'+Lu5MrtX2+'px;top:'+Lu5MrtY2+'px;z-index:3;width:19px;length:32px ">');
  		      document.getElementById("luuunpath2").innerHTML = "";
  		 }  
  		     bodyrRexf5.style.display='';
  		     bodyrRexf5.innerHTML ='';  
  		     bodyrRexf5.innerHTML = luun.join(''); 
  		   
  } 	//lu1 || lu5    結束  
     
 if(Gact=='lu2'||Gact=='lu3'||Gact=='lu6')
  {
 	   if(RGLayer!=null)
  	    {
  	      if( _LayerManager.RemovePointLayerTrue(RGLayer) == true  )
  	      _LayerManager.RemovePointLayer(RGLayer);
  	      
  	    }
  	    
  	   if(RGLayer2!=null )
        {
           if( _LayerManager.RemovePointLayerTrue(RGLayer2) == true  )
           _LayerManager.RemovePointLayer(RGLayer2);
         
        }
 	
     setPoish=2; //要不要顯示給用戶點起啟點的
     document.getElementById("setpxx1").innerHTML= "";
     document.getElementById("setpxx2").innerHTML="";              
     var xy1_name=document.getElementById('TxtPoint0').value;
     var xy1_x=RoadGuideData[0][0];;
     var xy1_y=RoadGuideData[0][1];
     var xy2_name=document.getElementById('TxtPoint1').value;
     var xy2_x=RoadGuideData[1][0];
     var xy2_y=RoadGuideData[1][1];         
     var xy1 =gMapBase.FromMapPoint(RealToMapPosX(xy1_x),RealToMapPosY(xy1_y));
     var xy2 =gMapBase.FromMapPoint(RealToMapPosX(xy2_x),RealToMapPosY(xy2_y));
     var sxy =gMapBase.FromMapPoint(RealToMapPosX(Gsx),RealToMapPosY(Gsy));
     var cx1 =gMapBase.FromMapPoint(RealToMapPosX(Gcx1),RealToMapPosY(Gcy1));
     var cx2 =gMapBase.FromMapPoint(RealToMapPosX(Gcx2),RealToMapPosY(Gcy2));
     var exy =gMapBase.FromMapPoint(RealToMapPosX(Gex),RealToMapPosY(Gey));
     

          
          
     
  		    if(Gact=='lu6')  	
  		    {	    
  		      var Lu6MrtX1=parseInt(sxy.X)-9;
              var Lu6MrtY1=parseInt(sxy.Y)-16;
              var Lu6MrtX2=parseInt(cx1.X)-9;
              var Lu6MrtY2=parseInt(cx1.Y)-16;
            
  		      luun.push('<img border="0" src="./images/TP_PA.gif" ');
  		      luun.push('onMouseOver="lunLineInfo3(61)" ');  //當滑鼠點擊此處顯示 起點的捷運站的資訊  
  		      luun.push('onMouseOut="lunpalLineCler(); PathInfoCler();" '); //lunpalLineCler除掉luuunpath3的div  cxyzCler除掉shxxp4 div   	        
  		      luun.push(' style= "cursor:hand;position:absolute;left:'+Lu6MrtX1+'px;top:'+Lu6MrtY1+'px;z-index:3;width:19px;length:32px ">');
  		      luun.push('<img border="0" src="./images/TP_PA.gif"');  
  		      luun.push('onMouseOver="lunLineInfo3(62)"');  //當滑鼠點擊此處顯示 迄點的捷運站的資訊   	
  		      luun.push('onMouseOut="lunpalLineCler(); PathInfoCler();"'); //lunpalLineCler除掉luuunpath3的div  cxyzCler除掉shxxp4 div 
  		      luun.push(' style= "cursor:hand;position:absolute;left:'+Lu6MrtX2+'px;top:'+Lu6MrtY2+'px;z-index:3;width:19px;length:32px ">');
  		     }
  		      
  		     if(Gact=='lu3')
  		     {
  		      var Lu3MrtX1=parseInt(cx2.X)-9;
              var Lu3MrtY1=parseInt(cx2.Y)-16;
              var Lu3MrtX2=parseInt(exy.X)-9;
              var Lu3MrtY2=parseInt(exy.Y)-16;
          
  		      luun.push('<img border="0" src="./images/TP_PA.gif"');     
  		      luun.push('onMouseover="lunLineInfo3(31)"');  //當滑鼠點擊此處顯示 起點的捷運站的資訊
  		      luun.push('onMouseOut="lunpalLineCler(); PathInfoCler();"'); //lunpalLineCler除掉luuunpath3的div  cxyzCler除掉shxxp4 div   	        
  		      luun.push(' style= "cursor:hand;position:absolute;left:'+Lu3MrtX1+'px;top:'+Lu3MrtY1+'px;z-index:600;width:19px;length:32px">'); 		    
  		      luun.push('<img border="0" src="./images/TP_PA.gif"');     
  		      luun.push('onMouseover="lunLineInfo3(32)"');  //當滑鼠點擊此處顯示 迄點的捷運站的資訊
  		      luun.push('onMouseOut="lunpalLineCler(); PathInfoCler();"'); //lunpalLineCler除掉luuunpath3的div  cxyzCler除掉shxxp4 div   		        
  		      luun.push(' style= "cursor:hand;position:absolute;left:'+Lu3MrtX2+'px;top:'+Lu3MrtY2+'px;z-index:600;width:19px;length:32px ">');    
  		     }
  		    
  		     bodyrRexf5.style.display='';
  		     bodyrRexf5.innerHTML ='';  
  		     bodyrRexf5.innerHTML = luun.join(''); 
  		    
   }//lu2  || lu3 || lu6結束  
}  //Luun


function PoiPA()
  {
     document.getElementById("shxxp3").innerHTML="";
         
    if( poixg==1&&Gact==undefined)
     {
     
      document.getElementById("shxxp2").innerHTML="";  
      this.PaInfo=PaInfo;//顯示站牌資訊
      this.PaToBline=PaToBline;//顯示站牌資訊
       var bodyrRexf = document.getElementById("shxxp1");
       var w = gMapBase.getClientWidth();
  	   var h = gMapBase.getClientHeight();
  	   var ltpt = gMapBase.ToMapPoint(0, 0);
  	   var rbpt = gMapBase.ToMapPoint(w, h);
  	   var TM2X = MapToRealPosX(ltpt.X);	
	   var TM2Y = MapToRealPosY(ltpt.Y);
	   
  	   var tmps = new Array();
       for (i=1;i<TrafficData.length;i++)
         {  
            var mak="";
            var sizX;
            var sizY;
           
           if(paiaction==26||paiaction==56)   //站牌查詢
            {
               var mrk1=TrafficData[i][3];
               if(mrk1==0)
                mrk="flag_blue.gif";
               else
               mrk="flag_red.gif";               
               pa_x=TrafficData[1][1];
               pa_y=TrafficData[1][2];           
            }
           if(paiaction==36)  //地標查詢
            {
              if(TrafficData[i][0]==paovalue)
               {               
                 mrk="TP_PA.gif";
                 sizX=19;
                 sizY=32;              
                 pa_x=TrafficData[i][1];
                 pa_y=TrafficData[i][2];       
               }
              if(TrafficData[i][0]!=paovalue)
               {
                var mrk1=TrafficData[i][3];
                if(mrk1==0)
                mrk="flag_blue.gif";
                else
                mrk="flag_red.gif";
                sizX=16;
                sizY=16;
               }
            }                    

           ScreenClientPt =gMapBase.FromMapPoint(RealToMapPosX(TrafficData[i][1]),RealToMapPosY(TrafficData[i][2]));	
           var ggg=gMapBase.FromMapPoint(RealToMapPosX(TrafficData[i][1]),RealToMapPosY(TrafficData[i][2]));
           
            if(ScreenClientPt.X > 0 && ScreenClientPt.Y > 0)
            {
  		      tmps.push('<img border="0" src="./images/'+mrk);
  		      tmps.push('" onMouseOver="PaInfo('+i+')"'); 	 	
  		      tmps.push('onclick="PaToBline('+i+')"'); 	 	  
  		      tmps.push(' style= "position:absolute;left:');
  		      tmps.push(ScreenClientPt.X-sizX);
  		      tmps.push('px;top:');
  		      tmps.push(ScreenClientPt.Y-sizY);
  		      tmps.push('px;z-index:3;width:'+sizX+'px;length:'+sizY+'px ">' );
  		     } 	
         }
          document.getElementById("shxxp1").style.display='';
  	      bodyrRexf.innerHTML = tmps.join(''); 
  	       if(poixg2==1)
  	       {
  	         var TM2XX=RealToMapPosX(pa_x)-0.003;
	         var TM2YY=RealToMapPosY(pa_y);
	         gMapBase.MoveMapTo(TM2XX , TM2YY);
             gMapBase.putMapLevel(parseInt(8));
             gMapBase.RefreshMap(true,true);
             poixg2=2;
             PoiPA();
  	       }
      }
  }    
  
function PaInfo(xkx)
{
  var x=xkx;
  var ScreenClientPt2 =gMapBase.FromMapPoint(RealToMapPosX(TrafficData[x][1]),RealToMapPosY(TrafficData[x][2]));
  var x_x=TrafficData[x][1];
  var x_y=TrafficData[x][2]; 
  var x_name=TrafficData[x][0];
  var mrk1=TrafficData[x][3];
  var mak="";
   if(mrk1==0)
    {mrk=Planlag[21];} //去程
   else
    {mrk=Planlag[22];} //回程
  
              var num =TrafficData[x][4];
              var tmps2 = new Array();
              tmps2.push('<table border="0" onMouseOut="PathInfoCler()"'); 	 
    		  tmps2.push(' style= "background-color:#FEFFAF;position:absolute;left:');
  		      tmps2.push(ScreenClientPt2.X+5+'px;top:'+ScreenClientPt2.Y+5+'px;z-index:3;">');
  		      tmps2.push('<tr><td>'+x_name+'</td></tr>');
  		      tmps2.push('<tr><td>站序'+num+'</td></tr>');
  		      tmps2.push('<tr><td>'+mrk+'</td></tr></table>');
  		        		      
  		   var bodyrRexf2 = document.getElementById("shxxp2");     
  		       bodyrRexf2.style.display='';
               bodyrRexf2.innerHTML= tmps2.join('');         
}

function PaToBline(ggg) //當點擊某個站牌時，把站牌中文名稱傳回DoPaLine.HTML
{
var x=ggg;
var x_name=TrafficData[x][0];
var F_PX=TrafficData[x][5];
var F_PY=TrafficData[x][6];

      document.getElementById("shxxp3").innerHTML="";
                
      if(mpg==1)
      {
        parent.document.mrts_name=x_name;
        parent.document.mrts_x=TrafficData[x][1];
        parent.document.mrts_y=TrafficData[x][2];
        parent.document.mrts_px=F_PX;
        parent.document.mrts_py=F_PY;     
        SEPoi(); 
	  }
	   
	  if(mpg==2)
      {
	    parent.document.mrte_name=x_name;
	    parent.document.mrte_x=TrafficData[x][1];
        parent.document.mrte_y=TrafficData[x][2];
        parent.document.mrte_px=F_PX;
        parent.document.mrte_py=F_PY;  
        SEPoi();
	  }
}

function SEPoi()  //有問題
{
         var tmps3 = new Array(); 
         var sname=parent.document.mrts_name;
         var sx=parent.document.mrts_x;
         var sy=parent.document.mrts_y;         
         var ename=parent.document.mrte_name;
         var ex=parent.document.mrte_x;
         var ey=parent.document.mrte_y;
         
       if(sx!=undefined) 
       { 
          var spoi="se0.gif";
          var ScreenClientPt3 =gMapBase.FromMapPoint(RealToMapPosX(sx),RealToMapPosY(sy));
          tmps3.push('<img border="0" src="./images/')     
  		  tmps3.push(spoi);
  		  tmps3.push('"');
  		  tmps3.push('onMouseOver="SrartInfo('); 	  //有問題
  		  tmps3.push( ScreenClientPt3.X);
  		  tmps3.push( ',');
  		  tmps3.push( ScreenClientPt3.Y);		  
  		  tmps3.push( ')"');  		  
  		  tmps3.push(' style= "position:absolute;left:');
  		  tmps3.push(ScreenClientPt3.X-32);
  		  tmps3.push('px;top:');
  		  tmps3.push(ScreenClientPt3.Y-32);
  		  tmps3.push('px;z-index:3;' );
  		  tmps3.push('width:' );
  		  tmps3.push('32' );
  		  tmps3.push('px;');
  		  tmps3.push('length:' );
  		  tmps3.push('32' );
  		  tmps3.push('px ">');
       } 

       if(ex!=undefined)
       {
          var spoi="se1.gif";
          var ScreenClientPt4 =gMapBase.FromMapPoint(RealToMapPosX(ex),RealToMapPosY(ey));               
          tmps3.push('<img border="0" src="./images/'+spoi)     
  		  tmps3.push('" onMouseOver="EndInfo('); 	 
  		  tmps3.push( ScreenClientPt4.X);
  		  tmps3.push( ',');
  		  tmps3.push( ScreenClientPt4.Y);		  
  		  tmps3.push( ')"');  		  
  		  tmps3.push(' style= "position:absolute;left:'+ScreenClientPt4.X-32+'px;top:'+ScreenClientPt4.Y-32);
  		  tmps3.push('px;z-index:3;width:32px;length:32px ">' );        
       }
       
        if(sx!=undefined||ex!=undefined)
        {
         document.getElementById("shxxp3").style.display='';
        var bodyrRexf3 = document.getElementById("shxxp3");  
        bodyrRexf3.innerHTML = tmps3.join('');       
        }
}



function SrartInfo(x,y)  //有問題
{
 
   var bodyrRexf4 = document.getElementById("shxxp4");
       bodyrRexf4.innerHTML = "";
     
              var tmps4 = new Array();
              tmps4.push('<table border="0" '); 
              tmps4.push('onMouseOut="PathInfoCler()"'); 	 
    		  tmps4.push(' style= "background-color:#FFFFFF;position:absolute;left:'+x-2);
  		      tmps4.push('px;top:'+y-2+'px;z-index:3;">');
  		      tmps4.push('<tr><td>'+Planlag[23]+'</td></tr></table>');  //起點
  		      
         bodyrRexf4.style.display='';
         bodyrRexf4.innerHTML = tmps4.join(''); 
}


function EndInfo(x,y)
{
 var bodyrRexf4 = document.getElementById("shxxp4");
     bodyrRexf4.innerHTML = "";
     
              var tmps4 = new Array();
              tmps4.push('<table border="0" '); 
              tmps4.push('onMouseOut="PathInfoCler()"'); 	 
    		  tmps4.push(' style= "background-color:#FFFFFF;position:absolute;left:'+x-2+'px;top:'+y-2+'px;z-index:3;">');
  		      tmps4.push('<tr><td>'+Planlag[24]+'</td></tr></table>'); //終點
        
  		bodyrRexf4.style.display='';  
        bodyrRexf4.innerHTML = tmps4.join(''); 
}



function LuSrartInfo(x,y)
{
 var bodyrRexf4 = document.getElementById("shxxp4");
     bodyrRexf4.innerHTML = "";
                          
              var tmps4 = new Array();
              tmps4.push('<table border="0" '); 
              tmps4.push('onMouseOut="PathInfoCler()"'); 	 
    		  tmps4.push(' style= "background-color:#FFFFFF;position:absolute;left:'+x-2+'px;top:');
   		      tmps4.push(y-2+'px;z-index:3;">');
  		      tmps4.push('<tr><td>'+Planlag[23]+'</td></tr></table>');

  		bodyrRexf4.style.display='';   
        bodyrRexf4.innerHTML = tmps4.join(''); 
}


function LuEndInfo(x,y)
{
 var bodyrRexf4 = document.getElementById("shxxp4");
     bodyrRexf4.innerHTML = "";
              
              var tmps4 = new Array();
              tmps4.push('<table border="0" '); 
              tmps4.push('onMouseOut="PathInfoCler()"'); 	 
    		  tmps4.push(' style= "background-color:#FFFFFF;position:absolute;left:'+x-2+'px;top:');
   		      tmps4.push(y-2+'px;z-index:3;">');
  		      tmps4.push('<tr><td>'+Planlag[24]+'</td></tr></table>'); //終點
        
  		  bodyrRexf4.style.display='';  
          bodyrRexf4.innerHTML = tmps4.join('');
}




function sxy(x,y)
{
 var bodyrRexf4 = document.getElementById("shxxp4");
     bodyrRexf4.innerHTML = "";
     
             var xna="";
             if(Gact=='lu5'||Gact=='lu6')
              { 
                if(PUrlStr=="eng")
                 {
                  xna="<font color=blue>"+Gsname+"</font> Station"; 
                 }
                else 
                 {
                  xna="捷運<font color=blue>"+Gsname+"</font>站"; 
                 }
              }
             else 
              {  
                if(PUrlStr=="eng")
                 {
                  xna="第一個搭車處";
                 }
                else
                 {
                  xna="First Stop";
                 } 
              } 
             
              var tmps2 = new Array();
              tmps2.push('<table border="0"   ')
              tmps2.push('onMouseOut="PathInfoCler()"');
              tmps2.push('onMouseover="PathInfoIN()"');
              tmps2.push(' style= " background:#FEFFAF;filter:alpha(opacity=83);   cursor:hand;  font-family: Arial;text-align:center; font-size: 7pt; border:#E10F00   1px   solid; position:absolute;left:');
  		      tmps2.push(x-65);  
  		      tmps2.push('px;top:');
  		      tmps2.push(y-55 );  
  		      tmps2.push('px;z-index:3;' );	     
  		      tmps2.push('width:' );
  		      tmps2.push('100' );
  		      tmps2.push('px;');
  		      tmps2.push('length:' );
  		      tmps2.push('50' );
  		      tmps2.push('px;">');
  		      tmps2.push('<tr style= "  cursor:default; font-size: 9pt; ">');
  		      tmps2.push('<td>');
  		      tmps2.push(xna);
  		      tmps2.push('</td>');
  		      tmps2.push('</tr>');
  		      tmps2.push('</table>');
             
  		  bodyrRexf4.style.display='';
          bodyrRexf4.innerHTML = tmps2.join(''); 
}

function cx1(x,y)
{
 var bodyrRexf4 = document.getElementById("shxxp4");
     bodyrRexf4.innerHTML = "";
     
              
          var xna="";
          if(Gact=='lu6')
          {  
            if(PUrlStr=="eng")
             {
              xna="<font color=blue>"+Gcname1+"</font> Station"; 
             } 
            else 
             {
              xna="捷運<font color=blue>"+Gcname1+"</font>站"; 
             } 
          }
          else 
          {  
            if(PUrlStr=="eng")
             {
              xna="第一個搭車處";
             }
            else
             {
              xna="First Stop";
             } 
          }
             
              var tmps2 = new Array();
              tmps2.push('<table border="0"   ')
              tmps2.push('onMouseOut="PathInfoCler()"');
              tmps2.push('onMouseover="PathInfoIN()"');
              tmps2.push(' style= " background:#FEFFAF;filter:alpha(opacity=83);   cursor:hand;  font-family: Arial;text-align:center; font-size: 7pt; border:#E10F00   1px   solid; position:absolute;left:');
  		      tmps2.push(x-65);  
  		      tmps2.push('px;top:');
  		      tmps2.push(y-55 );  
  		      tmps2.push('px;z-index:3;' );	     
  		      tmps2.push('width:' );
  		      tmps2.push('100' );
  		      tmps2.push('px;');
  		      tmps2.push('length:' );
  		      tmps2.push('50' );
  		      tmps2.push('px;">');
  		      tmps2.push('<tr style= "  cursor:default; font-size: 9pt; ">');
  		      tmps2.push('<td>');
  		      tmps2.push(xna);
  		      tmps2.push('</td>');
  		      tmps2.push('</tr>');
  		      tmps2.push('</table>');
  		      
  		      bodyrRexf4.style.display='';
              bodyrRexf4.innerHTML = tmps2.join('');
}

function cx2(x,y)
{
 var bodyrRexf4 = document.getElementById("shxxp4");
     bodyrRexf4.innerHTML = "";
     
             var xna="";
             if(Gact=='lu3' || Gact=='lu4')
              {  
                if(PUrlStr=="eng")
                 {
                   xna="<font color=blue>"+Gcname2+"</font> Station";
                 }
                else   
                 {
                   xna="捷運<font color=blue>"+Gcname2+"</font>站";
                 }
              }            
             
              var tmps2 = new Array();
              tmps2.push('<table border="0"   ')
              tmps2.push('onMouseOut="PathInfoCler()"');
              tmps2.push('onMouseover="PathInfoIN()"');
              tmps2.push(' style= " background:#FEFFAF;filter:alpha(opacity=83);   cursor:hand;  font-family: Arial;text-align:center; font-size: 7pt; border:#E10F00   1px   solid; position:absolute;left:');
  		      tmps2.push(x-65+'px;top:'+y-55);  
  		      tmps2.push('px;z-index:3;width:100px;length:50px;">' );	     
  		      tmps2.push('<tr style= "  cursor:default; font-size: 9pt; ">');
  		      tmps2.push('<td>'+xna+'</td></tr></table>');
  		      
  		      bodyrRexf4.style.display='';
              bodyrRexf4.innerHTML = tmps2.join('');
}



function cx3(x,y)
{
 var bodyrRexf4 = document.getElementById("shxxp4");
     bodyrRexf4.innerHTML = "";
              
              var tmps4 = new Array();
              tmps4.push('<table border="0" '); 
              tmps4.push('onMouseOut="PathInfoCler()"'); 	 
    		  tmps4.push(' style= "background-color:#FFFFFF;position:absolute;left:');
  		      tmps4.push(x-2);
  		      tmps4.push('px;top:');
  		      tmps4.push(y-2);
   		      tmps4.push('px;z-index:3;">');
  		      tmps4.push('<tr>');
  		      tmps4.push('<td>');
   		 
  		      tmps4.push('轉乘點3');
  		      tmps4.push('</td>');
  		      tmps4.push('</tr>');
  		      tmps4.push('</table>'); 
        
  		bodyrRexf4.style.display='';  
        bodyrRexf4.innerHTML = tmps4.join(''); 
}

function cx4(x,y)
{
 var bodyrRexf4 = document.getElementById("shxxp4");
     bodyrRexf4.innerHTML = "";
              
              var tmps4 = new Array();
              tmps4.push('<table border="0" '); 
              tmps4.push('onMouseOut="PathInfoCler()"'); 	 
    		  tmps4.push(' style= "background-color:#FFFFFF;position:absolute;left:');
  		      tmps4.push(x-2);
  		      tmps4.push('px;top:');
  		      tmps4.push(y-2);
   		      tmps4.push('px;z-index:3;">');
  		      tmps4.push('<tr>');
  		      tmps4.push('<td>');
   		 
  		      tmps4.push('轉乘點4');
  		      tmps4.push('</td>');
  		      tmps4.push('</tr>');
  		      tmps4.push('</table>'); 
        
  		  bodyrRexf4.style.display='';  
          bodyrRexf4.innerHTML = tmps4.join(''); 
}


function exy(x,y)
{
 var bodyrRexf4 = document.getElementById("shxxp4");
     bodyrRexf4.innerHTML = "";
     

               var xna="";
               if(Gact=='lu3'||Gact=='lu5')
                { 
                  if(PUrlStr=="eng")
                   {
                     xna="<font color=blue>"+Gename+"</font> Station"; 
                   }  
                  else 
                   {
                     xna="捷運<font color=blue>"+Gename+"</font>站"; 
                   }
                }
               else if(Gact=='lu4')
                {  
                  if(PUrlStr=="eng")
                   {
                    xna="<font color=blue>"+Gcname3+"</font> Station";
                   }
                  else 
                   {
                    xna="捷運<font color=blue>"+Gcname3+"</font>站";
                   }
                }
              var tmps2 = new Array();
              tmps2.push('<table border="0"   ')
              tmps2.push('onMouseOut="PathInfoCler()"');
              tmps2.push('onMouseover="PathInfoIN()"');
              tmps2.push(' style= " background:#FEFFAF;filter:alpha(opacity=83);   cursor:hand;  font-family: Arial;text-align:center; font-size: 7pt; border:#E10F00   1px   solid; position:absolute;left:');
  		      tmps2.push(x-65+'px;top:'+y-55);        
  		      tmps2.push('px;z-index:3;width:100px;length:50px;">' );
  		      tmps2.push('<tr style= "  cursor:default; font-size: 9pt; ">');
  		      tmps2.push('<td>'+xna+'</td></tr></table>');
  		      
  		      bodyrRexf4.style.display='';
              bodyrRexf4.innerHTML = tmps2.join('');
}



function PathInfoCler()
{
  document.getElementById("shxxp4").style.display='none';
  document.getElementById("shxxp2").innerHTML="";
}
function PathInfoIN()
{
 document.getElementById("shxxp4").style.display='';
}  
  
  
function LuunMove(x,y)
{
             var XX=RealToMapPosX(x)-0.03;
	         var YY=RealToMapPosY(y);
	         gMapBase.MoveMapTo(XX , YY);
             gMapBase.putMapLevel(parseInt(4));
             gMapBase.RefreshMap(true,true);
             document.getElementById("shxxp1").innerHTML="";
}
  
  
function RMenu()
{
       //OpTabWin
      //把螢幕座標轉成經緯座標
      
     if(RMenush==1)  //要不要顯示
     {
        if(clearvalue==1)  //假如是先按清除規劃後  又按右建就執行alltoopen();  
        alltoopen();  
       
       
      if(RMenush2==1)  //抓螢幕座標
       {
        var lt = gMapBase.ToMapPoint(event.clientX, event.clientY);
        RhPoiX= MapToRealPosX(lt.X);
        RhPoiY= MapToRealPosY(lt.Y);
        RMenush2=0;
      
        OpTabWin=1;  //  設為0，不管如何移動地圖，table 都不會顯示，1為顯示 設為1才能顯示SetPoiInfo的table
       // GMclientX=event.clientX;
       // GMclientY=event.clientY;
      
       //假如按右鍵的地方 超出一定範圍就把小人移到中心點
       var ggcx=event.clientX;   //380 905
       var ggcy=event.clientY;  //80
       var gate=parseInt(gMapBase.getMapLevel()) 
           
           if(ggcy<80)
           {
  	         
  	         var TM2XX=RealToMapPosX(RhPoiX);
	         var TM2YY=RealToMapPosY(RhPoiY);
	         
	         if(gate==9)
	         {TM2XX=TM2XX-0.001; TM2YY=TM2YY+0.00005 }
	         
	         gMapBase.MoveMapTo(TM2XX , TM2YY);
             gMapBase.RefreshMap(true,true);
            
            
           }
        
          if(ggcx<380||ggcx>905)
           {
  	         var TM2XX=RealToMapPosX(RhPoiX)-0.005;
	         var TM2YY=RealToMapPosY(RhPoiY);
	        
	         if(gate==9)
	         {TM2XX=TM2XX+0.005; TM2YY=TM2YY+0.00005 }
	         
	         gMapBase.MoveMapTo(TM2XX , TM2YY);
             
             gMapBase.RefreshMap(true,true);
           }
        //假如按右鍵的地方 超出一定範圍就把小人移到中心點
       }
     
       openmenu=1; //是否打開菜單  
       setPoish=2; //0406 把setPoi關掉 
       document.getElementById("setpxx1").style.display='';
      
      
      
          var GMclient =gMapBase.FromMapPoint(RealToMapPosX(RhPoiX),RealToMapPosY(RhPoiY));	
          var tmps = new Array();
              tmps.push('<img border="0" src="./images/')     
  	          tmps.push('05.gif');
  	          tmps.push('"'); 	     
  		      tmps.push(' style= "position:absolute;left:');
  		      tmps.push(GMclient.X-20);
  		      tmps.push('px;top:');
  		      tmps.push(GMclient.Y-20);
  		      tmps.push('px;z-index:3;' );
  		     
  		      tmps.push('width:' );
  		      tmps.push('20' );
  		      tmps.push('px;');
  		     
  		      tmps.push('length:' );
  		      tmps.push('20' );
  		      tmps.push('px ">');
  		      
  		       document.getElementById("setpxx1").style.display=''; 
  		       document.getElementById("setpxx1").innerHTML= tmps.join(''); 
  		       SetPoipx=RhPoiX;
               SetPoipy=RhPoiY;
               SetPoina="";
               
              SetPoiInfo(RhPoiX,RhPoiY,GMclient.X,GMclient.Y);
          } 
  }
  
  function SetPoi(px,py,na)
  {
      if(setPoish!=2)
       {
           
             if(clearvalue==1)  //0408假如是先按清除規劃後  又按查詢規劃就執行alltoopen();  
             alltoopen();       //這二行可能會出錯
       
          // var shstartpoi= document.getElementById("startpoi")
  		  //var shendpoi=document.getElementById("endpoi")
  		  var sx= parent.document.mrts_x;
          var sy= parent.document.mrts_y;
  		  var ex= parent.document.mrte_x;
          var ey= parent.document.mrte_y;
  		  
         /*
           if(sx!=null&&sy!=null)  //0408假如開始的圖已經選了，又再作搜尋規畫點，
            {                             //就執行startimgpoi，不讓起點的圖還停在畫面上
                startimgpoi();
            }
         
           if(ex!=null&&ey!=null)
            {
                endimgpoi();
            }
            
          */
         
           if(px!=undefined&&py!=undefined)
              {
               SetPoipx=px;
               SetPoipy=py;
               SetPoina=na;
               openmenu=1; //打開菜單 
              }
              
          if(SetPoipx!=undefined&&SetPoipy!=undefined)
          {   
             
              ScreenClientPt =gMapBase.FromMapPoint(RealToMapPosX(SetPoipx),RealToMapPosY(SetPoipy));
          var tmps = new Array();
              tmps.push('<img border="0" src="./images/05.gif')         
  		      tmps.push('" style= "position:absolute;left:');
  		      tmps.push(ScreenClientPt.X-20);
  		      tmps.push('px;top:');
  		      tmps.push(ScreenClientPt.Y-20);
  		      tmps.push('px;z-index:3;width:20px;length:20px ">' );

  		      document.getElementById("setpxx1").style.display=''; 
  		      document.getElementById("setpxx1").innerHTML= tmps.join(''); 
              SetPoiInfo(SetPoipx,SetPoipy,ScreenClientPt.X,ScreenClientPt.Y);
          }
        }   //setPoish!=2
  }
  
  function SetPoiInfo(x,y,px,py)  //顯示是否設為起點的框框
  {
  
   if(openmenu==1)
    {
        var  ScreenOpenMun =gMapBase.FromMapPoint(RealToMapPosX(x),RealToMapPosY(y));
              var tmps = new Array();
  	          tmps.push('<table border="0" style= " background:#FEFFAF;filter:alpha(opacity=83);   cursor:hand;  font-family: Arial;text-align:center; font-size: 9pt; border:#E10F00   1px   solid; position:absolute;left:');
  		      tmps.push(ScreenOpenMun.X-50+'px;top:'+ScreenOpenMun.Y-80+'px;z-index:3;width:80px;length:600px;">');
  		      tmps.push('<tr onmouseover=this.style.background="#FEFFFF";  onmouseout=this.style.background="#FEFFAF"; onmousedown="SetPoiStart( ');
  		      tmps.push(x);
  		      tmps.push(',');
  		      tmps.push(y);
  		      tmps.push(')"  >');
  		      tmps.push('<td>'+Planlag[25]+'</td></tr>');  //設為起點
  		      tmps.push('<tr onmouseover=this.style.background="#FEFFFF";  onmouseout=this.style.background="#FEFFAF"; onmousedown="SetPoiEnd( ');
  		      tmps.push(x);
  		      tmps.push(',');
  		      tmps.push(y);
  		      tmps.push(')"  >');
  		      tmps.push('<td>'+Planlag[26]+'</td></tr>'); //設為終點
  		      tmps.push('<tr onmouseover=this.style.background="#FEFFFF";  onmouseout=this.style.background="#FEFFAF"; onmousedown="SetPoiInfoClear()" >');
  		      tmps.push('<td>'+Planlag[27]+'</td></tr></table>');  //關閉視窗
  		      
  		   if(OpTabWin==1)  //1才顯示table 
  		    { document.getElementById("setpxx2").style.display=''; document.getElementById("setpxx2").innerHTML= tmps.join(''); }
    }      
  }
  
function SetPoiInfoClear()
  {
    document.getElementById("setpxx2").innerHTML="";
    document.getElementById("setpxx1").innerHTML="";
    RMenush=0;  //關掉
    setPoish=2; //關掉
  }
  
function SetPoiStart(x,y)
  {
    SetPoiSorE=1;
    OpTabWin=0;  //按下設為起點後，不管如何移動地圖，table 都不會顯示
    handle1(x,y);
  }
  
  
  
 function SetPoiEnd(x,y)
  {
      SetPoiSorE=2;
      OpTabWin=0;//按下設為迄點後，不管如何移動地圖，table 都不會顯示
      handle1(x,y);
  }
  

 function handle1(x,y)
  {
              if( SetPoiSorE==1)
              {
               parent.document.mrts_name=SetPoina;
               parent.document.mrts_x=SetPoipx;
               parent.document.mrts_y=SetPoipy;
               parent.document.mrts_px=x;
               parent.document.mrts_py=y; 
               document.getElementById("setpxx2").innerHTML="";
               startimgpoivalue=1; //可以執行startimgpoivalue這個function
               startimgpoi();
              }
              if( SetPoiSorE==2)
              {
               parent.document.mrte_name=SetPoina;
               parent.document.mrte_x=SetPoipx;
               parent.document.mrte_y=SetPoipy;
               parent.document.mrte_px=x;
               parent.document.mrte_py=y;
               endimgpoivalue=1; //可以執行endimgpoi這個function
               endimgpoi();
               document.getElementById("setpxx2").innerHTML="";
              }
  }
  
  function SetToClear()
  {  
   document.getElementById("shxxp4").innerHTML="";
   document.getElementById("shxxp5").innerHTML="";
   document.getElementById("RightMenu").innerHTML="";   
  }
  

  
 function startimgpoi()  //貼上開始的圖
 {
 
          if(startimgpoivalue==1)
  {        
          var sx= parent.document.mrts_x;
          var sy= parent.document.mrts_y;
        //  openmenu=2; //關掉左鍵的框框    
       if(sx!=null&&sy!=null)     
       {   
         imgpoi=1;
         var   startimgpoi =gMapBase.FromMapPoint(RealToMapPosX(sx),RealToMapPosY(sy));      
            
         var tmps = new Array();
              tmps.push('<img border="0" src="./images/')     
  	          tmps.push('起點.gif');
  		      tmps.push('" style= "position:absolute;left:');
  		      tmps.push(startimgpoi.X-20);
  		      tmps.push('px;top:');
  		      tmps.push(startimgpoi.Y-25);
  		      tmps.push('px;z-index:3;width:19px;length:31px ">' );
  		     // document.getElementById("setpxx1").innerHTML="";   //把小人清掉
  		      document.getElementById("startpoi").style.display='';   		     
  		      document.getElementById("startpoi").innerHTML= tmps.join('');   		    
  		      if(parent.document.mrts_name=="")
  		      parent.OneFrm.ifSearch2.knostr.innerHTML="圖面自定起點";
  		      else
  		      parent.OneFrm.ifSearch2.knostr.innerHTML=parent.document.mrts_name;
  		      
       }
       
    }
 }
 

 function endimgpoi()
 {
 
    if( endimgpoivalue==1)
    {
          var ex= parent.document.mrte_x;
          var ey= parent.document.mrte_y;
         //  openmenu=2; //關掉左鍵的框框   
           
        
       if(ex!=null&&ey!=null)     
       {   
         imgpoi=2;
         var   endimgpoi =gMapBase.FromMapPoint(RealToMapPosX(ex),RealToMapPosY(ey));      
            
         var tmps = new Array();
              tmps.push('<img border="0" src="./images/終點.gif" style= "position:absolute;left:')     
  		      tmps.push(endimgpoi.X-20);
  		      tmps.push('px;top:');
  		      tmps.push(endimgpoi.Y-25);
  		      tmps.push('px;z-index:3;width:19px;length:31px ">' );
  		      
  		     //  document.getElementById("setpxx1").innerHTML="";   //把小人關掉
  		      document.getElementById("endpoi").style.display=''; 
  		      document.getElementById("endpoi").innerHTML= tmps.join('');   		        		     
  		      if(parent.document.mrte_name=="")
  		      parent.OneFrm.ifSearch2.knoend.innerHTML="圖面自定終點"
  		      else
  		      parent.OneFrm.ifSearch2.knoend.innerHTML=parent.document.mrte_name;
       }
     }
 }
 
//document.getElementById("startpoi").innerHTML=""
//

 function alltoclar()
 {
   document.getElementById("shxxp").style.display='none';
   
  
  
      	    if(RGLayer!=null)
  	    {
  	      if( _LayerManager.RemovePointLayerTrue(RGLayer) == true  )
  	      _LayerManager.RemovePointLayer(RGLayer);
  	      
  	    }
  	    
  	    if(RGLayer2!=null )
        {
           if( _LayerManager.RemovePointLayerTrue(RGLayer2) == true  )
           _LayerManager.RemovePointLayer(RGLayer2);
         
        }
          poixg=0;
          clearvalue=1; //設為1 代表目前div已經關掉了
          
               
               parent.document.mrts_name=null;
               parent.document.mrts_x=null;
               parent.document.mrts_y=null;
               parent.document.mrts_px=null;
               parent.document.mrts_py=null; 
               parent.document.mrte_name=null;
               parent.document.mrte_x=null;
               parent.document.mrte_y=null;
               parent.document.mrte_px=null;
               parent.document.mrte_py=null;
          
          
          openmenu=2;
          endimgpoivalue=0;   //0代表不執行這個function
          startimgpoivalue=0; //0代表不執行這個function
          
          
          
          Gact=null,Gsname=null,Gsx=null,Gsy=null,Gcname1=null,Gcx1=null,Gcy1=null,Gcname2=null;
          Gcx2=null,Gcy2=null,Gcname3=null,Gcx3=null,Gcy3=null,Gcname4=null,Gcx4=null,Gcy4=null,Gename=null,Gex=null,Gey=null;
          SrartInfox=null,SrartInfoy=null;
          lunphline=0;
          
          RMenush=0;  //移動地圖會不會跑出 右鍵的選單
 
 }
 
 function alltoopen() 
 {
 
          document.getElementById("shxxp1").innerHTML="";
          document.getElementById("shxxp2").innerHTML="";
          document.getElementById("shxxp3").innerHTML="";
          document.getElementById("shxxp4").innerHTML="";
          document.getElementById("shxxp5").innerHTML="";
          document.getElementById("shxxp6").innerHTML="";
          document.getElementById("setpxx1").innerHTML="";
          document.getElementById("setpxx2").innerHTML="";
          document.getElementById("setpxx3").innerHTML="";
          document.getElementById("RightMenu").innerHTML="";
          document.getElementById("startpoi").innerHTML="";
          document.getElementById("endpoi").innerHTML="";
          document.getElementById("luuunpath1").innerHTML="";
          document.getElementById("luuunpath2").innerHTML="";
          document.getElementById("luuunpath3").innerHTML="";
          document.getElementById("luuunpath4").innerHTML="";
          parent.mrts_name=null;
          parent.mrts_x=null;
          parent.mrts_y=null;
          parent.mrts_px=null;
          parent.mrts_py=null;
          parent.mrte_name=null;
          parent.mrte_x=null;
          parent.mrte_y=null;
          parent.mrte_px=null;
          parent.mrte_py=null;
          document.getElementById("shxxp").style.display='';
          clearvalue=0;   //設為1 代表目前div已經打開掉了
          lunphline=0; //1才會顯示公車路線
 }
 
 
 function GrouMto(cxx,cyy)   // 在mrtplan.html的 規劃按下  站牌名稱，就把座標移到座標處
 {
      var TM2XX=RealToMapPosX(cxx)-0.002;
	  var TM2YY=RealToMapPosY(cyy);
	  gMapBase.MoveMapTo(TM2XX , TM2YY);
      gMapBase.putMapLevel(parseInt(7));             
       setpxx1.innerHTML= '';    //怪
       setpxx2.innerHTML='';  
       shxxp4.innerHTML=''; 
       shxxp5.innerHTML='';         
       endpoi.innerHTML= '';    
       startpoi.innerHTML= ''; 
       gMapBase.RefreshMap(true,true);              
       Luun(); 
 }
 
 
 function GrouMto2(cxx,cyy,g)   // 在mrtplan.html的 規劃按下  站牌名稱，就把座標移到座標處
 {
       var TM2XX=RealToMapPosX(cxx)-0.03;
	   var TM2YY=RealToMapPosY(cyy);
	   gMapBase.MoveMapTo(TM2XX , TM2YY);
       gMapBase.putMapLevel(parseInt(4));
       document.getElementById("setpxx1").innerHTML= "";    //怪
       document.getElementById("setpxx2").innerHTML="";  
       document.getElementById("shxxp4").innerHTML=""; 
       document.getElementById("shxxp5").innerHTML=""; 
       document.getElementById("endpoi").innerHTML= "";    
       document.getElementById("startpoi").innerHTML= ""; 
       gMapBase.RefreshMap(true,true);
       Luun();
 }
 
 
  
function TheSartMlpan()
{
           document.getElementById("shxxp1").innerHTML="";
           document.getElementById("shxxp2").innerHTML="";
           document.getElementById("shxxp3").innerHTML="";
           document.getElementById("shxxp4").innerHTML="";
           document.getElementById("shxxp5").innerHTML="";
           document.getElementById("shxxp6").innerHTML="";
           document.getElementById("setpxx1").innerHTML="";
           document.getElementById("setpxx2").innerHTML="";
           document.getElementById("setpxx3").innerHTML="";
           document.getElementById("RightMenu").innerHTML="";
           document.getElementById("luuunpath1").innerHTML="";
           document.getElementById("luuunpath2").innerHTML="";
           document.getElementById("luuunpath3").innerHTML="";
           document.getElementById("luuunpath4").innerHTML="";
}


function ClearROADL()  //清除路線的圖層
{
       if(RGLayer!=null)
  	    {
  	      if( _LayerManager.RemovePointLayerTrue(RGLayer) == true  )
  	      _LayerManager.RemovePointLayer(RGLayer);  	      
  	    }
  	    
  	   if(RGLayer2!=null )
        {
           if( _LayerManager.RemovePointLayerTrue(RGLayer2) == true  )
           _LayerManager.RemovePointLayer(RGLayer2);         
        }
}

function dtreeFun()
{
           document.getElementById("shxxp1").innerHTML="";
           document.getElementById("shxxp2").innerHTML="";
           document.getElementById("shxxp3").innerHTML="";
           document.getElementById("shxxp4").innerHTML="";
           document.getElementById("shxxp5").innerHTML="";
           document.getElementById("shxxp6").innerHTML="";
           document.getElementById("setpxx1").innerHTML="";
           document.getElementById("setpxx2").innerHTML="";
           document.getElementById("setpxx3").innerHTML="";
           document.getElementById("RightMenu").innerHTML="";
           document.getElementById("luuunpath1").innerHTML="";
           document.getElementById("luuunpath2").innerHTML="";
           document.getElementById("luuunpath3").innerHTML="";
           document.getElementById("luuunpath4").innerHTML="";
           document.getElementById("startpoi").innerHTML="";
           document.getElementById("endpoi").innerHTML="";
   
  
       if(RGLayer!=null)
  	    {
  	      if( _LayerManager.RemovePointLayerTrue(RGLayer) == true  )
  	      _LayerManager.RemovePointLayer(RGLayer);
  	      
  	    }
  	    
  	   if(RGLayer2!=null )
        {
           if( _LayerManager.RemovePointLayerTrue(RGLayer2) == true  )
           _LayerManager.RemovePointLayer(RGLayer2);
         
        }
          poixg=0;
          Gact=null,Gsname=null,Gsx=null,Gsy=null,Gcname1=null,Gcx1=null,Gcy1=null,Gcname2=null;
          Gcx2=null,Gcy2=null,Gcname3=null,Gcx3=null,Gcy3=null,Gcname4=null,Gcx4=null,Gcy4=null,Gename=null,Gex=null,Gey=null;
          SrartInfox=null,SrartInfoy=null;
          lunphline=0;          
          RMenush=0;  //移動地圖會不會跑出 右鍵的選單
}
