var Active_VTab_Route ;


//-------------------------------------------------------------
function VTab_Route_Handler(e,MouseEvent) {
var EventTrigger  

    if (typeof e == 'string') { 
        EventTrigger=document.getElementById(e)
    }
    if (typeof e == 'object') { 
        EventTrigger= GetEventTrigger (e)
    }
    
     
    if (MouseEvent == "over" ) {
        EventTrigger.style.color="#FF9A00";
    } else if (MouseEvent == "out") {
        EventTrigger.style.color="#0065b3";
        
    } else if (MouseEvent == "initial") { 
        Active_VTab_Route = Active_VTab_Route || '1';
      //  Route_Tools_Handler("RoutePlan_Route_NewRoute" ,"inactive");
        TRI_RoutePlaning_DeActived_Tools();
    } else if (MouseEvent == "click") {
        
        document.getElementById("VTab_Route_Imag"+ Active_VTab_Route).src="Images/Route_DeActive.png"
        document.getElementById("VTab_Route_Cell"+ Active_VTab_Route).style.fontWeight="normal";
        
        document.getElementById("VTab_Route_borderUL"+ Active_VTab_Route).style.background= "url(Images/VTabMenu_borderUL_UnSel.gif)";
        document.getElementById("VTab_Route_borderUM"+ Active_VTab_Route).style.background= "url(Images/VTabMenu_borderUM_UnSel.gif)";
        document.getElementById("VTab_Route_borderUR"+ Active_VTab_Route).style.background= "url(Images/VTabMenu_borderUR_UnSel.gif)";
        
        
        
        document.getElementById("VTab_Route_borderL"+ Active_VTab_Route).style.background= "url(Images/VTabMenu_borderL_UnSel.gif)";
        document.getElementById("VTab_Route_Cell"+ Active_VTab_Route).style.background= "url(Images/VTabMenu_borderM_UnSel.gif)";
        document.getElementById("VTab_Route_borderR"+ Active_VTab_Route).style.background= "url(Images/VTabMenu_borderR_UnSel.gif)";      
 
        document.getElementById("VTab_Route_borderBL"+ Active_VTab_Route).style.background= "url(Images/VTabMenu_borderBL_UnSel.gif)";
        document.getElementById("VTab_Route_borderBM"+ Active_VTab_Route).style.background= "url(Images/VTabMenu_borderBM_UnSel.gif)";
        document.getElementById("VTab_Route_borderBR"+ Active_VTab_Route).style.background= "url(Images/VTabMenu_borderBR_UnSel.gif)";       
        

        Active_VTab_Route= Right(EventTrigger.id,1);
      //  var ObjectID ="VTab_Route_Imag"+ Active_VTab_Route ;
        document.getElementById("VTab_Route_Imag"+ Active_VTab_Route ).src="Images/Route_Active.png"
        document.getElementById("VTab_Route_Cell"+ Active_VTab_Route).style.fontWeight="bold";
        document.getElementById("VTab_Route_borderUL"+ Active_VTab_Route).style.background= "url(Images/VTabMenu_borderUL_Sel.gif)";
        document.getElementById("VTab_Route_borderUM"+ Active_VTab_Route).style.background= "url(Images/VTabMenu_borderUM_Sel.gif)";
        document.getElementById("VTab_Route_borderUR"+ Active_VTab_Route).style.background= "url(Images/VTabMenu_borderUR_Sel.gif)";        
        
        document.getElementById("VTab_Route_borderL"+ Active_VTab_Route).style.background= "url(Images/VTabMenu_borderL_Sel.gif)";
        document.getElementById("VTab_Route_Cell"+ Active_VTab_Route).style.background= "url(Images/VTabMenu_borderM_Sel.gif)";
        document.getElementById("VTab_Route_borderR"+ Active_VTab_Route).style.background= "url(Images/VTabMenu_borderR_Sel.gif)";     

        document.getElementById("VTab_Route_borderBL"+ Active_VTab_Route).style.background= "url(Images/VTabMenu_borderBL_Sel.gif)";
        document.getElementById("VTab_Route_borderBM"+ Active_VTab_Route).style.background= "url(Images/VTabMenu_borderBM_Sel.gif)";
        document.getElementById("VTab_Route_borderBR"+ Active_VTab_Route).style.background= "url(Images/VTabMenu_borderBR_Sel.gif)";          
          
        if (Active_VTab_Route=='1'){
            document.getElementById("RoutePlan_InfoDIV").style.display="block";
            document.getElementById("TravelSolution_DIV").style.display="none";
            document.getElementById("RoutePlay_InfoDIV").style.display="none";            
        }
        if (Active_VTab_Route=='2'){
            document.getElementById("RoutePlan_InfoDIV").style.display="none";
            document.getElementById("TravelSolution_DIV").style.display="block";
            document.getElementById("RoutePlay_InfoDIV").style.display="none";
        }
        if (Active_VTab_Route=='3'){
            document.getElementById("RoutePlan_InfoDIV").style.display="none";
            document.getElementById("TravelSolution_DIV").style.display="none";
            document.getElementById("RoutePlay_InfoDIV").style.display="block";
        }    
    } 
}




//*********************************************
var TRI_WayPoint_Info = new Array();

function TRI_WayPoint_Info_Rec(_Wptype, _Label, _Code, _ID, _X, _Y, _Time){
    this.Order
    this.Wptype = _Wptype;
    this.Label = _Label;
    this.Code = _Code;
    this.ID = _ID;
    this.X = _X;
    this.Y = _Y;
    this.Time = _Time;
}

function TRI_WayPoint_Info_Add(_Wptype, _Label, _Code, _ID, _X, _Y, _Time){
    TRI_WayPoint_Info[TRI_WayPoint_Info.length] = new TRI_WayPoint_Info_Rec(_Wptype, _Label, _Code, _ID, _X, _Y, _Time);
    RoutePlan_WayP_list_SelectedItem = null;
}
function TRI_WayPoint_Info_DelWayPoint(index){
   TRI_WayPoint_Info.splice(index,1);
   RoutePlan_WayP_list_SelectedItem = null;
} 

function TRI_WayPoint_Info_Read (_WayPoints) {  
    TRI_WayPoint_Info = new Array();
    var WayPoint_Label ="";
    var c = 0;
    var d = _WayPoints.length;
    for (Wp in _WayPoints) {
        c++;
        if (_WayPoints[Wp]) {
            var vals = _WayPoints[Wp].split(";");
            WayPoint_Label = GDI_DynamicLabel ["WayPoint"];
            if (c==1) {WayPoint_Label = GDI_DynamicLabel ["FromHere"]};
            if (c==d) {WayPoint_Label = GDI_DynamicLabel ["ToHere"]};
            TRI_WayPoint_Info_Add (WayPoint_Label, vals[3] + " [ " +TOILayer_Label[vals[2]] + " ] ", vals[2], vals[0], vals[4], vals[5], Left(vals[6],2) +":" + Right(vals[6],2));
        }
   }
}



    
    

//.............................................................
 


 //.............................................................
 
//.............................................................
















//var RouteCarTimer

//function RouteOver(e){
//    //if (CTO_MapActiveTools!="Arrow"){return}
//    var EventTrigger= GetEventTrigger (e)
//    var MouseEvent= GetEventType (e)
//    if (EventTrigger.id==""){
//        EventTrigger=EventTrigger.parentNode
//        if (MouseEvent == "mouseout"){return}
//    }
//    var Mcode=EventTrigger.id.split("^")[0];
//    var MapID=Map.getMapIDFromCode(Mcode);
//    if (Map.MapObj[MapID].ActiveTools!="Arrow"){return}
//        
//var objtype = EventTrigger.id.split("^")[1].split(">")[0]
//  //  var objtype = EventTrigger.id.split(">")[0]
////.split(">")[1].split("|");
//    if (objtype !="MLk"){
//    return
//    }
//    
//    
//    
//    
//    //----------------------------------------------
//    if (MouseEvent == "mouseover" ) {
//        var Counter = EventTrigger.id.split(">")[1].split("|");
//        var R=parseInt(Counter[0])
//        var RR=parseInt(Counter[1])
//       // var LLL=parseInt(Counter[2])
//        TravelObj.MapTravel.GetFocus(Mcode + "^MRd>" + R + "|" + RR)
//       // var RoadOver = document.getElementById(Mcode + "^MRd>" + R + "|" + RR);
//       // RoadOver.setAttribute("stroke", TravelObj.MapTravel.LineColorFocus);
//        clearTimeout(TravelObj.MapCar.HiddenTimer)
//        
//          //----------------------------------------------    
//    } else if (MouseEvent == "mouseout") {
////        if(TravelObj.MapCar.MouseIsOver){
////            clearTimeout(TravelObj.MapCar.HiddenTimer);
////            return
////        }
//        
//        var Counter = EventTrigger.id.split(">")[1].split("|");
//        var R=parseInt(Counter[0])
//        var RR=parseInt(Counter[1])
//        
//        TravelObj.MapCar.HiddenTimer = setTimeout( "TravelObj.MapCar.Hidden('"+ Mcode + "^MRd>" + R + "|" + RR +"')" , 200 );

//    //----------------------------------------------    
//    } else if (MouseEvent == "mousemove") {
//        clearTimeout ( TravelObj.MapCar.HiddenTimer );
//       // document.getElementById("RoutePlan_RouteTitle").innerHTML =  TravelObj.MapCar.MouseIsOver
//      
//        // var LinkElem = GetEventTrigger(e)//.parentElement;
//       // if(LinkElem.id.indexOf("MLk>") < 0) {LinkElem = GetEventTrigger(e).parentNode}
//    
//        var Counter = EventTrigger.id.split(">")[1].split("|");
//        var R=parseInt(Counter[0])
//        var RR=parseInt(Counter[1])
//        var LLL=parseInt(Counter[2])
//    
//        //----------
//        var pCont = getPosition_Object(TravelMapDraw_container.id);
//        var pCurs = getPosition_Cursor(e);
//        var p ={x: pCurs.x - pCont.x , y: pCurs.y - pCont.y}
//        //----------
//        var Link =  TravelData.Routes[Counter[0]].Roads[Counter[1]].Links[Counter[2]];
//        var LinkA = Link.Points.slice();
//        if (LLL < TravelData.Routes[R].Roads[RR].Links.length-1){
//            var nextLink = parseInt(LLL) + 1
//            LinkA[LinkA.length] =  TravelData.Routes[R].Roads[RR].Links[nextLink].Points[0];
//        }
//        //----------
//        
//        
//        var nC = takeNearest(p.x , p.y , LinkA);
//        nC.R = Counter[0];
//        nC.RR = Counter[1];
//        nC.LLL = Counter[2];
//    
//        var p1 = TravelData.Routes[R].Roads[RR].Links[LLL].Points[nC.PPPP];
//        var p2 = TravelData.Routes[R].Roads[RR].Links[LLL].Points[nC.PPPP+1];
//    //alert(nC.DisFromPoint + " - P1=" + p1.x + "," + p1.y + "  P2=" + p2.x + "," + p2.y);
//    //----------
//    var car_Info= TravelData.Routes[R].Roads[RR].Info.RoadLabel + 
//                    "<br>[" + TravelData.Routes[R].Roads[RR].Links[LLL].Info.Type + "]<br> " +
//                    GDI_DynamicLabel ["DriveDistance"] +"=" + TravelObj.ToLengthString(520) + "<br>" + 
//                    GDI_DynamicLabel ["DriveTime"] +"=" +TravelObj.ToTimeString(500)
//                    
//                    var Digital = new Date();
//                    var hours = Digital.getHours();
//                    var minutes = Digital.getMinutes();
//                    var seconds = Digital.getSeconds();
//                    dn = "AM";
//                    if ((hours >= 12) && (minutes >= 1) || (hours >= 13)) {
//                        dn = "PM";
//                        hours = hours-12;
//                    }
//                    if (hours == 0){
//                        hours = 12;
//                    }                
//car_Info+=  "<br>" +hours +":"+ minutes+":"+  seconds+" "+  dn



//        var Car = document.getElementById(Mcode + "^MTc>");
//        Car.style.visibility= "visible";
//        Car.style.left = parseInt(nC.Car.x-4)  + "px";
//        Car.style.top = parseInt(nC.Car.y-4) + "px";
//        //Car.style.title = car_Info;
//      
//        
//        var PopUp_X= parseInt(ctoMap.ImagePos.x+ nC.Car.x +10);
//        var PopUp_Y= parseInt(ctoMap.ImagePos.y + nC.Car.y +10) ;
//            //document.getElementById("PopUpTip").style.display="block";
//            document.getElementById("PopUpTip").style.visibility= "visible";
//            document.getElementById("PopUpTip").style.left = PopUp_X+"px"; 
//            document.getElementById("PopUpTip").style.top = PopUp_Y+"px";
//            document.getElementById("PopUpTip_Info").innerHTML =  car_Info;
//            document.getElementById("PopUpTip_Title").innerHTML =  "Vechicle Info" + " ...";

//    e.cancelBubble = true;
//     //----------------------------------------------  
//   // } else if (MouseEvent == "mousemove") {     
//   
//}
//}

//function RouteOut(e){
//   // if(document.getElementById("MTc>")){
//  //      TravelObj.MapCar.HiddenTimer = setTimeout( "RouteHiddenCar()" , 5000 );

//  //  e.cancelBubble = true;
//}
//function RouteHiddenCar(ElemID){
//    if(TravelObj.MapCar.MouseIsOver){return}
//    var Mcode=ElemID.split("^")[0];
//    document.getElementById(Mcode + "^MTc>").style.visibility= "hidden";
//    document.getElementById("PopUpTip").style.visibility= "hidden";
//}


//function takeNearest(x,y,Link){
//    var minD = 99999999;
//    var MousePosMeter = new MapPoint(x,y).transform(ctoMap.ImageRect,ctoMap.MapRect);

//    var travelCounter = new Object();
//    
//    var LinkPointsPixel = Link;
//     
//    for (i=0;i<LinkPointsPixel.length-1;i++){
//        var x1 = parseInt(LinkPointsPixel[i].x);
//        var y1 = parseInt(LinkPointsPixel[i].y);
//        var x2 = parseInt(LinkPointsPixel[i+1].x);
//        var y2 = parseInt(LinkPointsPixel[i+1].y);
//        //  var d = dotLineLength(x, y, x1, y1, x2, y2, true);
//        var Nearest = TheMoreNearPoint(x1, y1, x2, y2, MousePosMeter.x, MousePosMeter.y);
//        
//        if(Nearest.d < minD){
//            minD=Nearest.d;
//            //travelCounter.LLL = LLL;
//            travelCounter.PPPP = i;
//            travelCounter.DisFromPoint = minD;
//            travelCounter.Car = new MapPoint(Nearest.x,Nearest.y).transform(ctoMap.MapRect,ctoMap.ImageRect);
//        }
//    }
//return travelCounter;
//}


//--------------------------------------------------------------------------------------------------------
/*
Description: calculate the more near point belonging to a given segment.
Parameters:
       nSx1, nSy1 =  First point of the segment
       nSx2, int nSy2 = Second point of the segment
       nPx, int nPy = The point to analize
       *nCercaX,  *nCercaY = The closest point to the given point (nPx,nPy) that belongs to the segment
Returns: The distance between the point and the founded point of the segment
*/
function TheMoreNearPoint(nSx1,nSy1,nSx2,nSy2,nPx,nPy){
       
       var nCercaX;  
       var nCercaY;
       
       //caracterizo la recta del segmento dado Y=m*X + b
       var m, b;

       var bEsHorizontalOVertical = false;

       //el segmento es vertical
       if (nSx2 == nSx1){
               nCercaX = nSx1;
               nCercaY = nPy;
               bEsHorizontalOVertical = true;
       }

       //el segmento es horizontal
       if (nSy2 == nSy1){
               nCercaY = nSy1;
               nCercaX = nPx;
               bEsHorizontalOVertical = true;
       }

       //el segmento est? caracterizado por una recta \"AX + BY + C = 0\" con
       // A y B distintos de cero
       if (!bEsHorizontalOVertical){
               m = (nSy2 - nSy1) / (nSx2 - nSx1);
               b = nSy1 - (nSx1 * m);

               //caracterizo la recta que une al punto dado con el punto m?s
               // cercano dentro del segmento Y=m1*X + b1
               var m1, b1;

               m1 = -1 / m;
               b1 = -m1 * nPx + nPy;

               //encuentro el punto de intersecci?n
               nCercaX =  (b1 - b) / (m - m1);
               nCercaY =  m * nCercaX + b;
       }

       //verificar que el punto encontrado est? dentro del segmento
       if ( nCercaX < Math.min(nSx1,nSx2)
               ||  nCercaX > Math.max(nSx1,nSx2)
               ||  nCercaY < Math.min(nSy1,nSy2)
               ||  nCercaY > Math.max(nSy1,nSy2) )
       {
               //el punto m?s cercano ser? uno de los dos extremos (el m?s cercano al punto)
               if (LineDistance(nSx1, nSy1, nPx, nPy)<= LineDistance(nSx2, nSy2, nPx, nPy)){
                       nCercaX = nSx1;
                       nCercaY = nSy1;
               }else{
                       nCercaX = nSx2;
                       nCercaY = nSy2;
               }
       }
       return {d: LineDistance(nPx, nPy, nCercaX , nCercaY), x:nCercaX ,y:nCercaY };

}
//--------------------------------------------------------------------------------------------



//------------------------------------------------------------------------
//return the distance between thwo points in a x,y plane.
function LineDistance(lOldX,lOldY,lNewX,lNewY){
       var x = lNewX - lOldX;
       var y = lNewY - lOldY;
       return Math.sqrt(Math.pow(x,2) + Math.pow(y,2));
}
//------------------------------------------------------------------------




////--------------------------------------------------------------
//// TravelObj.MapTravel.Draw ------------------------------------
//TravelObj.MapTravel.Draw = function(Tdata,_Container ,_rectMeter,_rectPix,_LineWith, _LineColor, UseFor){
//    if (!Tdata.visible){return;}
//    var Container = _Container;
//    var RectMapMeter = _rectMeter;
//    var RectMapPix = _rectPix;    

//    var TravelLineWith=_LineWith        //2
//    var TravelLineColor=_LineColor     //"#00FF00"; //jg.setColor("#ffff66");    
//     
//    var TravelChkBound ="";
//    var RouteChkBound ="";
//    var RoutesChkBoundIsNeed = false ;
//    var RoadChkBound ="";
//    var RoadsChkBoundIsNeed = false ;
//    var LinkChkBound ="";
//    var LinksChkBoundIsNeed = false ;
//    var SegmentChkBound ="";
//    var SegmentsChkBoundIsNeed = false ; 
//    //--------------------------------------------------------------
//    //Container.innerHTML="";
//    //--------------------------------------------------------------
//    var TravelRectMap = new MapRect( Tdata.Bound.MinX, Tdata.Bound.MaxY, Tdata.Bound.MaxX,Tdata.Bound.MinY) 
//    TravelChkBound =TravelObj.ChkRectIntersection(RectMapMeter,TravelRectMap)
//    if (TravelChkBound=="Out"){return;}
//    RoutesChkBoundIsNeed = false ;
//    if (TravelChkBound=="Intersected"){RoutesChkBoundIsNeed = true}
//    //--------------------------------------------------------------
//    var jg = new jsGraphics(Container.id);
//    jg.setStroke(TravelLineWith);
//    jg.setColor(TravelLineColor);
//    var ExpandInPixel=TravelLineWith*2
//    //Container.innerHTML="";
//      
//    //--------------------------------------------------------------    
//    var TravelRectPix = TravelRectMap.transform(RectMapMeter,RectMapPix);
//    TravelRectPix = TravelRectPix.expandPix(7)
//    
//     //--------------------------------------------------------------
//    var Handler_innerHTML= " onmousemove='RouteOver(event)' onmouseout='RouteOver(event)' "
//    //--------------------------------------------------------------   
//   
//    var Travel_innerHTML = new Array();
//    Travel_innerHTML[0] = "<div id='MTr>' style='position: absolute; z-index:1000; border:none; "+
//                            "filter:alpha(opacity=70);-moz-opacity:.70;opacity:.70;"+
//                            "left:" + parseInt(TravelRectPix.x1) + "px; top:" +  parseInt(TravelRectPix.y1) + "px; "+
//                            "width:" +  parseInt(TravelRectPix.w()) + "px; height:" +  parseInt(TravelRectPix.h()) + "px;'>"; 
//    //--------------------------------------------------------------Travel Route
//    var d_Travel = {x: parseInt(TravelRectPix.x1), y: parseInt(TravelRectPix.y1)};
//    for (R in Tdata.Routes){                            
//        var RouteRectMap = new MapRect( Tdata.Routes[R].Bound.MinX, Tdata.Routes[R].Bound.MaxY, Tdata.Routes[R].Bound.MaxX,Tdata.Routes[R].Bound.MinY) 
//        if (RoutesChkBoundIsNeed){
//            RouteChkBound =TravelObj.ChkRectIntersection(RectMapMeter,RouteRectMap);
//            if (RouteChkBound=="Out"){continue;}
//            RoadsChkBoundIsNeed = false ;
//            if (RouteChkBound=="Intersected"){RoadsChkBoundIsNeed = true}  
//        }else{
//            RoadsChkBoundIsNeed = false ; 
//        }                            
//        var RouteRectPix = RouteRectMap.transform(RectMapMeter,RectMapPix);
//        RouteRectPix = RouteRectPix.expandPix(5)
//        var Route_innerHTML = new Array();
//        Route_innerHTML[0] = "<div id='MRt>" + R + "' style='position: absolute; border:none; "+
//                            "left:" + parseInt(RouteRectPix.x1-d_Travel.x) + "px; top:" +  parseInt(RouteRectPix.y1-d_Travel.y) + "px; "+
//                            "width:" +  parseInt(RouteRectPix.w()) + "px; height:" +  parseInt(RouteRectPix.h()) + "px;'>"
//        //--------------------------------------------------------------Travel Route Road                            
//        var d_route =  {x: parseInt(RouteRectPix.x1), y: parseInt(RouteRectPix.y1)};
//        var str="";
//        var _iwRegex1 =  /%%([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);/g;
//        for (RR in Tdata.Routes[R].Roads){  
//            var RoadRectMap = new MapRect(Tdata.Routes[R].Roads[RR].Bound.MinX,Tdata.Routes[R].Roads[RR].Bound.MaxY,Tdata.Routes[R].Roads[RR].Bound.MaxX,Tdata.Routes[R].Roads[RR].Bound.MinY)                 
//            if (RoadsChkBoundIsNeed){
//                RoadChkBound =TravelObj.ChkRectIntersection(RectMapMeter,RoadRectMap);
//                if (RoadChkBound=="Out"){continue;}
//                LinksChkBoundIsNeed = false ;
//                if (RoadChkBound=="Intersected"){LinksChkBoundIsNeed = true}  
//            }else{
//                    LinksChkBoundIsNeed = false ; 
//            }            
//            var RoadRectPix = RoadRectMap.transform(RectMapMeter,RectMapPix);
//            RoadRectPix = RoadRectPix.expandPix(4)
//            var Road_innerHTML= new Array();
//            Road_innerHTML[0] = "<div id='MRd>" + R + "|" + RR + "' style='position: absolute; border: none;"+
//                                "left: " +  parseInt(RoadRectPix.x1-d_route.x) + "px; top:" +  parseInt(RoadRectPix.y1-d_route.y ) + "px; "+
//                                "width:" +  parseInt(RoadRectPix.w()) + "px; height:" +  parseInt(RoadRectPix.h()) + "px;'>"        
//            //-------------------------------------------------------Travel Route Road Link
//            var d_road =  {x: parseInt(RoadRectPix.x1), y: parseInt(RoadRectPix.y1)};
//            for (LLL in Tdata.Routes[R].Roads[RR].Links){  
//                var LinkRectMap = new MapRect(Tdata.Routes[R].Roads[RR].Links[LLL].Bound.MinX,Tdata.Routes[R].Roads[RR].Links[LLL].Bound.MaxY,Tdata.Routes[R].Roads[RR].Links[LLL].Bound.MaxX,Tdata.Routes[R].Roads[RR].Links[LLL].Bound.MinY)                 
//                if (LinksChkBoundIsNeed){
//                    LinkChkBound =TravelObj.ChkRectIntersection(RectMapMeter,LinkRectMap);
//                    if (LinkChkBound=="Out"){continue;}
//                    SegmentsChkBoundIsNeed = false ;
//                    if (LinkChkBound=="Intersected"){SegmentsChkBoundIsNeed = true}  
//                }else{
//                    SegmentsChkBoundIsNeed = false ; 
//                }
//                var LinkRectPix = LinkRectMap.transform(RectMapMeter,RectMapPix);
//                LinkRectPix = LinkRectPix.expandPix(ExpandInPixel)
//                var w= parseInt(LinkRectPix.w())
//                var h= parseInt(LinkRectPix.h())
//                
//                var Link_innerHTML= new Array();
//                Link_innerHTML[0] = "<div id='MLk>" + R + "|" + RR + "|" + LLL + "' style='border: none; position: absolute;"+
//                                    "left: "+ parseInt(LinkRectPix.x1-d_road.x) + "px; top:" +  parseInt(LinkRectPix.y1-d_road.y ) + "px; "+
//                                    "width:" + w+ "px; height:" + h + "px;' <UseFor> >"
//                //-------------------------------------------------------Travel Route Road Link Segment
//                var Segment_innerHTML= new Array();
//                if (w<TravelLineWith&&h<TravelLineWith){
//                    Segment_innerHTML[0] = "<div style='overflow:hidden;position:absolute;background-color:"+ TravelLineColor + "; "+
//                                        "left:0px; top:0px; width:"+ TravelLineWith +"px; height:"+ TravelLineWith +"px;'></div>";
//                    Link_innerHTML[Link_innerHTML.length]=Segment_innerHTML[0]+  " </div>" ;
//                    Road_innerHTML[Road_innerHTML.length]= Link_innerHTML.join("");
//                    continue;
//                }
//                //-----------------------
//                var d_link=  {x: parseInt(LinkRectPix.x1), y: parseInt(LinkRectPix.y1)};
//                var LinkPointsPixel= new Array();
//                for (pppp in Tdata.Routes[R].Roads[RR].Links[LLL].Points){
//                    LinkPointsPixel[pppp] = new MapPoint( Tdata.Routes[R].Roads[RR].Links[LLL].Points[pppp].x, Tdata.Routes[R].Roads[RR].Links[LLL].Points[pppp].y, Tdata.Routes[R].Roads[RR].Links[LLL].Points[pppp].z).transform(RectMapMeter,RectMapPix);
//                }
//                if (LLL < Tdata.Routes[R].Roads[RR].Links.length-1){
//                    var NextLLL=  (parseInt(LLL)+1) 
//                    LinkPointsPixel[LinkPointsPixel.length] = new MapPoint( Tdata.Routes[R].Roads[RR].Links[NextLLL].Points["0"].x, Tdata.Routes[R].Roads[RR].Links[NextLLL].Points["0"].y,Tdata.Routes[R].Roads[RR].Links[NextLLL].Points["0"].z).transform(RectMapMeter,RectMapPix);
//                }
//                   
//                for (i=0;i<LinkPointsPixel.length-1;i++){
//                    /// check line with in
//                    var x1 = parseInt(LinkPointsPixel[i].x-d_link.x );
//                    var y1 = parseInt(LinkPointsPixel[i].y-d_link.y);
//                    //var z1 = parseInt(LinkPointsPixel[i].z);
//                    var x2 = parseInt(LinkPointsPixel[i+1].x-d_link.x);
//                    var y2 = parseInt(LinkPointsPixel[i+1].y-d_link.y);
//                   // var z2 = parseInt(LinkPointsPixel[i+1].z);
//                    //-------------
//                    jg.htm=""
//                    jg.drawLine(x1, y1, x2, y2);
//	                Segment_innerHTML[Segment_innerHTML.length]= jg.htm.replace(_iwRegex1,
//                    '<div style="overflow:hidden;position:absolute;background-color:'+
//	                '$1;left:$2;top:$3;width:$4;height:$5"></div>\n');
//                }
//                Link_innerHTML[Link_innerHTML.length]= Segment_innerHTML.join("") +  " </div>" ;
//                Road_innerHTML[Road_innerHTML.length]= Link_innerHTML.join("") ;
//            } 
//            Road_innerHTML[Road_innerHTML.length]=  " </div>" ;
//            Route_innerHTML[Route_innerHTML.length]= Road_innerHTML.join("") ;
//        }
//        Route_innerHTML[Route_innerHTML.length]= " </div>" 
//        Travel_innerHTML[Travel_innerHTML.length]= Route_innerHTML.join("") ;
//    }
//    var InnerHTML= Travel_innerHTML.join("") +  " </div>";
//    if (UseFor=="Map"){ 
//        InnerHTML=InnerHTML.replace(/<UseFor>/g, Handler_innerHTML);
//    }else{
//        InnerHTML=InnerHTML.replace(/<UseFor>/g,"");
//    }
//    Container.innerHTML += InnerHTML;
//}      






