﻿   
   MapContainer = function(strDivName,strMapId,objInstanceName,opts)
   {
        this._opts = opts ||{};
        this._name =   objInstanceName||'sidebar';
        this._sbWidth = 300;
        this._mapWidth = 500;//domyslna szerokosc mapy
        this._timer =    null;
        this._currWidth= 300;
        this._isClose =  true;
        this._timeStep = 1;
        this._moveStep = 50;
        this._currTimeStep=10;
        this._currTabSelected=1;
        this._borderSize = {left:0,top:0,bottom:0,right:0};
        this._gradHeight = 20;
        this._box = document.getElementById(strDivName);
        
        this._lang = {
                        vehicles : Global.lang.pojazdy   || "POJAZDY",
                        routes   : Global.lang.linie     || "LINIE",
                        tools    : Global.lang.opcje     || "OPCJE"
                     }
        
        this._isSidebarRefreshing = Global.refreshRoutesInSidebar || false;
        this._showSelected = false;
        this._enableVehTypes = false;
        
                     
                     
       this.initLang(); 
      
      
      
      
      //alert(this._box.style.borderTop);
      
        this._mapCont = document.createElement('div');this._mapCont.setAttribute('id',strMapId);
        this._sbCont = document.createElement('div');this._sbCont.setAttribute('id','sb');
        this._borderSize = {top:parseInt(this._box.style.borderTopWidth || "0"),bottom:parseInt(this._box.style.borderBottomWidth || "0"),
                            left:parseInt(this._box.style.borderLeftWidth || "0"),right:parseInt(this._box.style.borderRightWidth || "0")};
        
       // alert(this._box.style.borderTop);
        
        this._sbCont.style.top= -this._borderSize.top + 'px';
        this._mainsbCont = document.createElement('div');
        this._button = document.createElement('div');
        this._shadow = document.createElement('div');
        this._tabs = document.createElement('div');
       
        this._sbCont.className       ='sidebar';
        this._mapCont.className      ='mapContainer';   
        this._mainsbCont.className   ='sidebarContainer';
        this._button.className       ='sidebarButton';
        this._shadow.className       ='sidebarLeftShadow';
        this._tabs.className         ='sidebarLeftTabs';
       
        this._box.appendChild(this._mapCont);
        this._box.appendChild(this._sbCont);
      
        if(this._isClose){
            if(navigator.appVersion.indexOf('MSIE 6.0') != -1) //IE 6 
                this._button.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'img/arrow_left.png\',sizingMethod=\'image\')'
            else
                this._button.style.background='url(img/arrow_left.png)';
            this._currWidth = 0;
            this.hideCont(); 
        }
        else{
            if(navigator.appVersion.indexOf('MSIE 6.0') != -1) //IE 6 
                this._button.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'img/arrow_right.png\',sizingMethod=\'image\')'
            else
                this._button.style.background='url(img/arrow_right.png)';
            this._currWidth = this._sbWidth;
            this.openSidebar();
        }
            
       this._sbCont.innerHTML   = '<div class=\'grad\'></div>';
       this._button.style.top   = "0px";
       this._button.style.left  = "-24px";
       var me = this;
       this._button.onclick = function(){me.toggle();};
   
     if(navigator.appVersion.indexOf('MSIE 6.0') != -1){ 
        this._tabs.style.marginRight='-3px';
        this._mainsbCont.style.marginRight='-3px';
        this._sbCont.style.marginRight='-1px';
    }
    
    
     this._shadow.style.position = 'absolute';this._shadow.style.left = '-7px';
     this._mainsbCont.cssFloat='right';
     this._sbCont.appendChild(this._button);
     this._sbCont.appendChild(this._shadow);
     this._sbCont.appendChild(this._tabs);
     this._sbCont.appendChild(this._mainsbCont);
  // this._mainsbCont.innerHTML = "asdasdlj ldjalsdja dj asjdasl daldsjasdasdasda ada sd asd asdasdasdsa";
     
        
    this.html= '';
    this.ROUTES =   1;
    this.VEHICLES = 2;
    this.OPTIONS =  3;
    //zaznaczony wariant
    this.SelVariant = {routeNr:'',
                      trackT : '',
                      showVeh: false
                      }
    

   // this.setBoxSize(800,500);
    this.refreshTabs();
}

   MapContainer.prototype.initLang = function(){
        var r = new StringBuffer();
        var t = new StringBuffer();
        var v = new StringBuffer();
        
        for (var i=0;i<this._lang.routes.length;++i){
            r.append(this._lang.routes.charAt(i));
            r.append('<br>');
       } 
        for (var i=0;i<this._lang.tools.length;++i){
            t.append(this._lang.tools.charAt(i));
            t.append('<br>');
       } 
        for (var i=0;i<this._lang.vehicles.length;++i){
            v.append(this._lang.vehicles.charAt(i));
            v.append('<br>');
       } 
       
       this._lang.routes = r.toString();
       this._lang.tools = t.toString();
       this._lang.vehicles = v.toString();
  }

  MapContainer.prototype.initContentLang = function(){
    g = function(spanId,text){
        document.getElementById(spanId).innerHTML = text;
    }
    
  
    g("przyst",Global.lang.przystanki);
    g("wyszukaj",Global.lang.wyszukaj);
    g("linie",Global.lang.linie);
    g("pokPrz",Global.lang.pokPrz);
    g("rysLinie",Global.lang.rysLinie);
    g("pokNr",Global.lang.pokNr);
    g("pokPrzebTr",Global.lang.pokTr);
    g("centrDoTr",Global.lang.centrDoTr);
    g("grup",Global.lang.grupuj);
   // g("pojazd",Global.lang.pojazdy);
    g("wsz_linie",">> " + Global.lang.wsz_linie + " <<");
    g("akt_linie",">> " + Global.lang.akt_linie + " <<");
   
    //g("linie",Global.lang.przystanki);
  }
   
   MapContainer.prototype.setButton = function()
   {
    
   
   }
   
   
   
   MapContainer.prototype.setBoxSize=function(width,height)
   {
        this._box.style.height  = height - this._borderSize.top - this._borderSize.bottom +'px';
        this._box.style.width   = width - this._borderSize.top - this._borderSize.bottom+'px';
        
        this._sbCont.style.height = height  + this._gradHeight - this._borderSize.top - this._borderSize.bottom +'px';
        this._sbCont.style.width =  this._currWidth +'px';

        this._mainsbCont.style.height = height - this._gradHeight - this._borderSize.bottom  + 'px';


        this._shadow.style.height =  height - this._gradHeight - this._borderSize.bottom   +'px';
        this._tabs.style.height =    height - this._gradHeight - this._borderSize.bottom   +'px';
       
       
        this._mapCont.style.height = height - this._borderSize.top - this._borderSize.bottom + 'px';
        this._mapCont.style.width =  width - this._currWidth - this._borderSize.left - this._borderSize.right + 'px';
    
      
        this.updRoutesHeight();
   }
   
      
   MapContainer.prototype.closeSidebar = function()
   {    
         var me = this;
         
        this.hideCont();
            
         this.timer = window.setInterval(function(){

              if (me._currWidth <= 0) {//7 ozn szerokość cienia
                  clearTimeout (me.timer);
                  me._currWidth = 0;
                  me._isClose = true;
                  
                  if(navigator.appVersion.indexOf('MSIE 6.0') != -1) //IE 6 
                      me._button.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'img/arrow_left.png\',sizingMethod=\'image\')'
                  else
                      me._button.style.background='url(img/arrow_left.png)';
                    
                    me.sidebarClosed();            

                  return;
                  }
                    me._currWidth -= me._moveStep;
                    if (me._currWidth < 0) me._currWidth = 0;
                    me._sbCont.style.width = me._currWidth + 'px';
                    me._mapCont.style.width = me._box.clientWidth - me._currWidth + 'px';
                },me._timeStep);

 }
   
   MapContainer.prototype.openSidebar = function()
   {
            var me = this;
            this.timer = window.setInterval(function(){

              if (me._currWidth >= me._sbWidth) {
                  clearTimeout (me.timer);
                  me._currWidth = me._sbWidth;
                  me._isClose = false;
                  
                  if(navigator.appVersion.indexOf('MSIE 6.0') != -1) //IE 6 
                     me._button.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'img/arrow_right.png\',sizingMethod=\'image\')'
                  else
                     me._button.style.background='url(img/arrow_right.png)';
                   me.showCont();
                   me.sidebarOpened();            
                  return;
                  }
                
                  me._currWidth+=me._moveStep;
                  if (me._currWidth > me._sbWidth) me._currWidth = me._sbWidth;    
                  me._sbCont.style.width = me._currWidth + 'px';
                  me._mapCont.style.width = me._box.clientWidth - me._currWidth + 'px';
                },me._timeStep);
   }
   
   MapContainer.prototype.toggle = function()
   {
    if(this._isClose){
        this.openSidebar();
        }
     else{
        this.closeSidebar();
        }
   }
   MapContainer.prototype.sidebarOpened = function(){};
   MapContainer.prototype.sidebarClosed = function(){};
   
   MapContainer.prototype.hideCont = function(){
       this._mainsbCont.style.display = 'none';
       this._tabs.style.display='none';   
        
   }
   MapContainer.prototype.showCont = function(){
       this._mainsbCont.style.display = 'block';
       this._tabs.style.display='block';   
       
   }
   
   MapContainer.prototype.refreshTabs = function()
   {
      this._tabs.innerHTML = '<ul class=\'vtabs\'>'
                                 +'<li ' + ((this.currentTabSelected==this.ROUTES)?'class=\'selected\'':'') + ' onclick=\'javascript:sidebar.openTab('+this.ROUTES+')\'><a href="#">' + this._lang.routes + '</a></li>'
                                 +'<li ' + ((this.currentTabSelected==this.VEHICLES)?'class=\'selected\'':'') + ' onclick=\'javascript:sidebar.openTab('+this.VEHICLES+')\'><a href="#">' + this._lang.vehicles + '</a></li>'
                                 +'<li ' + ((this.currentTabSelected==this.OPTIONS)?'class=\'selected\'':'') + ' onclick=\'javascript:sidebar.openTab('+this.OPTIONS+')\'><a href="#">' + this._lang.tools + '</a></li>'
                                 +'</ul>';
   }
   MapContainer.prototype.setContent = function(html)
   {
      this.html = html;
      this._mainsbCont.innerHTML = html;//transformXmlDocument(xmlDoc,xslDoc).innerHTML ;
   }
   
   MapContainer.prototype.getContentContainer = function()
   {
        return this._mainsbCont;
   }
   
   MapContainer.prototype.openTab = function(i)
    {
       this.currentTabSelected = i;
       for(var j=0;j<this._mainsbCont.childNodes.length;++j){
          if(this._mainsbCont.childNodes[j].nodeType==1)    
               this._mainsbCont.childNodes[j].style.display="none";
           }
          this._mainsbCont.childNodes[i-1].style.display='block';
        this.onTabChanged(i,this._mainsbCont.childNodes[i-1]);
       this.refreshTabs(); 
  }
  
  MapContainer.prototype.onTabChanged =function (i,cont)
  {
  }
  
  MapContainer.prototype.loadSidebar = function()
  {
       // var div = document.getElementById('first_tab');
        var wbs = new WebServiceClient("CNR_DajListeWariantow");
        var me = this;
        var xslDoc;
     
        this.routeListRefreshed = function(){
        }
      
        wbs.send(function(data){
            me.initMainContent();
            me.bindRoutes(data);
            TaStops.xmlRoutesInfo = data;
            GEvent.addDomListener(document.getElementById("selBox"),"change",
                                   function(){
                                        me.reloadRouteList();
                                   });

            GEvent.addDomListener(document.getElementById("selRoute"),"keyup",
                                   function(){
                                   window.setTimeout(function(){me.reloadRouteList();},1000);
                                   });

           me.showVehiclesType();

           me.showCont();//ukryta zawartość (display:none) powoduje brak przliczania wymiarów, więc chwilowo zmiana statnu przy zamknitym panelu
           me.updRoutesHeight();
           me.hideCont();
            
           //rozpocznij odświeżanie
           if(me._isSidebarRefreshing){
            me._timer = window.setInterval(function(){me.refreshRouteList()},REFRESH_TIME);
           }
           me.sidebarLoaded();
        });
     }
     

  MapContainer.prototype.sidebarLoaded =  function()
  {
  }
  
  
  MapContainer.prototype.showVehiclesType =  function(){
   
    if(Global.VT.enabled){
  
       this._enableVehTypes = true;
       var div1 = document.getElementById('vehTypes');
       var div2 = document.getElementById('vehTypes2');
       
       var me = this;
       var b = new StringBuffer();
        
       this.selVehType1 = document.createElement("select");
       this.selVehType1.style.width='100%';
        
       this.selVehType2 = document.createElement("select");
       this.selVehType2.style.width='100%';
        
       GEvent.addDomListener(this.selVehType1,"change",
                              function(){
                                     me.reloadRouteList();
                               });
       GEvent.addDomListener(this.selVehType2,"change",
                              function(){
                                     me.vehicleTypeChanged(this.options[this.selectedIndex].value);
                              });
                              
        for(var i=0;i<Global.VT.types.length;++i)
        {
            var opt = document.createElement("option");
            opt.value = Global.VT.types[i].ids.join(',');// Global.VT[Global.VT.ids[i]].id;
            opt.text =  Global.VT.types[i].name;//Global.VT.get(Global.VT.types[i]).name;
            
            if(navigator.appVersion.indexOf('MSIE')!=-1)
                this.selVehType1.add(opt);
            else
                this.selVehType1.add(opt,null);
                
            opt = document.createElement("option");
            opt.value = Global.VT.types[i].ids.join(',');// Global.VT[Global.VT.ids[i]].id;
            opt.text =  Global.VT.types[i].name;//Global.VT.get(Global.VT.types[i]).name;
            
            if(navigator.appVersion.indexOf('MSIE')!=-1)
                this.selVehType2.add(opt);
            else
                this.selVehType2.add(opt,null);

        }
        div1.appendChild(this.selVehType1);
        div2.appendChild(this.selVehType2);
     }
  }
  
  MapContainer.prototype.vehicleTypeChanged = function(){
  }
  
  
  
  MapContainer.prototype.reloadRouteList = function(){
        var selBox = document.getElementById("selBox");
                   var me = this;
 
        if(this._isSidebarRefreshing){
            if(this._timer!=null)
                window.clearInterval(this._timer);
            this._timer = window.setInterval(function(){me.refreshRouteList()},REFRESH_TIME);
       }
       
        if(selBox.options[selBox.selectedIndex].value != 'veh')
        {
            this._showSelected = false;
        }
        else{   
            this._showSelected = true;
        }
        
        document.getElementById("tbRoutesDiv").innerHTML = Global.lang.czekaj;
        this.refreshRouteList();
  }
  
  MapContainer.prototype.refreshRouteList = function()
  {
  
        if(this.wbs!=null)
            this.wbs.abort();
        this.wbs = new WebServiceClient("CNR_DajListeWariantow");
        var me = this;
   
        if(this._showSelected)
            this.wbs.appendProperty("actual","T");
        if(this._enableVehTypes){
           this.wbs.appendProperty("vehicleTypes",this.selVehType1.options[this.selVehType1.selectedIndex].value);
        }
        
        var selRoute = document.getElementById("selRoute");
        if(selRoute.value!='')
            this.wbs.appendProperty("routeNr",selRoute.value);

        
        this.wbs.send(function(data){
                   me.bindRoutes(data);
                   me.updRoutesHeight();
                   me.routeListRefreshed();
                });
  }

MapContainer.prototype.bindRoutes = function(xmlData){
                         
        var b = new StringBuffer();
        var routes = xmlData.getElementsByTagName("Route");
        var selected = false;
        
        b.append('<table  style="width:245px">');

        for(var i=0;i<routes.length;++i)
        {
            b.append('<tr>');
                b.append('<td style="border-bottom:1px dashed black">');
                    b.append('<span class="route" style="font-weight:bold">');
                    b.append(routes[i].getAttribute("nr"));
                    b.append('</span>');
                b.append('</td>');
                b.append('<td style="border-bottom:1px dashed black">');
                  b.append('<table style="width:200px">');
                    var dirs = routes[i].childNodes;
                    for(var j=0;j<dirs.length;++j)
                    {
                       // if(me._showSelected || dirs[j].getAttribute('pr')=='T')
                        {
                            b.append('<tr >');
                            var conf=Global.VT.getByGroup(dirs[j].getAttribute('veh'));
                            var i1=conf.vehIcon;
                            var i1=Global.VT.getByGroup(dirs[j].getAttribute('veh')).vehIcon;
                            var nr = routes[i].getAttribute('nr');
                            var type = dirs[j].getAttribute('type');
                            var vehc = parseInt(dirs[j].getAttribute('vehc'));
                            var append = 'src="';
                            
                            if(vehc > 0){
                                if(this.SelVariant.routeNr==nr && this.SelVariant.trackT==type){
                                    append+= (conf.vehShineIcon +'" id="selVeh"');
                                    selected = true;
                                }
                                else
                                    append+= (conf.vehIcon+'"');
                                    
                                    append+= ' onclick="'+this._name+'._vehSelected(this,\''+routes[i].getAttribute('nr')+'\',\''+dirs[j].getAttribute('dir')+'\',\''+dirs[j].getAttribute('type') + '\',\''+ dirs[j].getAttribute('veh') + '\')" style="cursor:pointer"';
                            }
                            else
                                    append+= (conf.vehGrayIcon+'"');
                     
                            
                            b.append('<td style="width:20%"><img ' + append + ' img1="'+conf.vehIcon+'" img2="'+conf.vehShineIcon+'" width="25" height="25" ></img>');
                            b.append('</td>');
                            
                            b.append('<td class="rlist' + (j%2) + '" style="text-align:center;cursor:pointer" ' );
                            b.append('onclick="'+this._name+'._varSelected(this,\'' + nr+'\',\''+dirs[j].getAttribute('dir')+'\',\''+type + '\',\'' + dirs[j].getAttribute('veh')+ '\')" />')
           
                            b.append('<a style="font-weight:bold" >');
                            if(dirs[j].getAttribute('desc1')!=''){
                                b.append('<span style="font-weight:normal">');
                                b.append(dirs[j].getAttribute('desc1'));
                                b.append('</span> <br />');
                            }
                            
                            b.append(dirs[j].getAttribute('desc'));
                            b.append("</a><br /></td></tr>");
                          
                        }
                    }
                     b.append('</table>');
                 b.append('</td>');
             b.append('</tr>');
        }  
          b.append('</table>');  
            
        //if(!selected)             
          //  this.SelVariant.routeNr='';
            
        var div = document.getElementById('tbRoutesDiv');
        div.innerHTML  = b.toString();
}


MapContainer.prototype.updRoutesHeight = function(){
        var div1 = document.getElementById('tbRoutesDiv');
        var height = parseInt(this._mainsbCont.style.height);
        if(div1!=null && height> 0){
            var dy = -25;
                if(div1.previousSibling!=null)
                    dy-=div1.previousSibling.offsetHeight;
            var h = (height+dy) +'px';
            div1.style.height = h;
        }
     
}
MapContainer.prototype.updVehHeight = function(){
        var div2 = document.getElementById('tbVehicles');
        if(div2!=null && height> 0){
                var dy = -25;
                if(div2.previousSibling!=null)
                    dy-=div2.previousSibling.offsetHeight;
            var h = (height+dy) +'px';
            div2.style.height = h;
        }
}

MapContainer.prototype.routeListRefreshed = function(){}       

         
         
MapContainer.prototype.initMainContent = function(strRoutesList){
      var b = new StringBuffer(); 

      b.append('<div id="first_tab" style="overflow:hidden;">');
            b.append('<div class="options" stlye="height:auto">');
                b.append('<h2>');
                b.append('<span id="szuklini">'+Global.lang.wyszukaj+'</span>');
                b.append('</h2>');
                b.append('<select style="width:98%" id="selBox">');
                    b.append('<option value="all" id="wsz_linie">'+Global.lang.wsz_linie+'</option>');
                    b.append('<option value="veh" id="akt_linie">'+Global.lang.akt_linie+'</option>');
                b.append('</select>');
                b.append('<table style="width:98%"><tr><td>'+Global.lang.linie+'</td>');
                b.append('<td><input type="text" style="width:100%" id="selRoute"></input>');
                b.append('</td></tr></table>');
                b.append('<div id="vehTypes"></div>');
            b.append('</div>');
           // b.append('<div class="options" style="border:1px solid #fff">');
                b.append('<div style="overflow:auto;border:1px solid #fff;margin-left:10px"   id="tbRoutesDiv">');
            //if(strRoutesList!=null)
                //b.append(strRouteList);
             //   b.append('</div>');
            b.append('</div>');

      b.append('</div>');


    //<!--POJAZDY -->
    b.append('<div id="second_tab" style="display:none;">');
        b.append('<div class="options">');
            b.append('<h2>');
                b.append('<span id="szuklini">'+Global.lang.opcje+'</span>');
            b.append('</h2>');
            
            b.append('<div id="vehTypes2"></div>');
            b.append('<a href="javascript:'+this._name+'._clearFilter()" style="padding-left:20px">' + Global.lang.czysc + '</a>');
          
        b.append('</div>');
      b.append('<div id="tbVehicles" style="overflow:auto"></div>');
    b.append('</div>');


    //Trzecia zakładka
    b.append('<div id="third_tab" style="display:none;overflow:hidden">');
      b.append('<div class="options">');
        b.append('<h2>');
          b.append('<span id="przyst">'+Global.lang.przystanki+'</span> </h2>');
            b.append('<input type="checkbox" checked="checked" onclick="optionStopsEvent(\'osiedle\')" id="osiedle"  /><span id="grup">'+Global.lang.grupuj+'</span>');
            b.append('<br />');
            b.append('<br></br><h2>');
            b.append('<span id="wyszukaj">'+Global.lang.wyszukaj+'</span>');
            b.append('</h2>');
            b.append('<input type="text" id="tStops"  value="" style="width:170px;margin-left:0px;padding:0px;"></input>');
            b.append('<img src="img/lupe.png"  onclick="javascript:showSelectedStops()" style="display:inline;cursor:pointer;margin-left:2px;padding:0px;"></img>');
      b.append('</div>');

      b.append('<div class="options">');
          b.append('<h2>');
          b.append('<span id="linie">'+Global.lang.linie+'</span> </h2><br/>');
            b.append('<input type="checkbox" id="chStops"   checked="checked" onclick="setOption(\'chStops\')" />');
            b.append('<span id="pokPrz">'+Global.lang.pokPrz+'</span>');
            b.append('<br />');
            b.append('<input type="checkbox" id="chRoutes"  checked="checked" onclick="setOption(\'chRoutes\')"  />');
            b.append('<span id="rysLinie" >'+Global.lang.rysLinie+'</span><br />');
            b.append('<input type="checkbox" id="chLabels"  onclick="setOption(\'chLabels\')"   /> <span id="pokNr">'+Global.lang.pokNr+'</span>');
            b.append('<br />');
            b.append('<a href="javascript:setOption(\'anim\')"  style="padding-left:20px">');
              b.append('<span id="pokPrzebTr">'+Global.lang.pokTr+'</span>');
            b.append('</a><br/>');
            b.append('<a href="javascript:setOption(\'bounds\')"  style="padding-left:20px">');
              b.append('<span id="centrDoTr">'+Global.lang.centrDoTr+'</span>');
            b.append('</a>');
          b.append('</div>');
   
    b.append('</div>');

    this.getContentContainer().innerHTML = b.toString();
    

}

MapContainer.prototype._vehSelected = function(el,routeNr,direc,trackT,vehType){
       if(this.SelVariant.routeNr!='')
       {
            var prevsel = document.getElementById('selVeh');
            if(prevsel!=null) {
                prevsel.src = prevsel.getAttribute('img1');;
                prevsel.removeAttribute('id');
                if(this.vehicleRemoved!=null)
                    this.vehicleRemoved(this.SelVariant.routeNr, this.SelVariant.trackT, this.SelVariant.vehType);
            }
       }
       
       //jeśli kliknięto na ten sam wariant
       if(this.SelVariant.routeNr==routeNr && this.SelVariant.trackT == trackT)
       {
            this.SelVariant.routeNr=='';  this.SelVariant.trackT = ''; this.SelVariant.vehType = '';
            if(this.vehicleDeselected!=null)
                    this.vehicleDeselected(this.SelVariant.routeNr, this.SelVariant.trackT, this.SelVariant.vehType);
            return;
       }
        
        this.SelVariant.routeNr = routeNr;this.SelVariant.trackT=trackT,this.SelVariant.vehType=vehType;
        el.id='selVeh';
        el.src =   el.getAttribute('img2');
        if(this.vehicleSelected!=null)
            this.vehicleSelected(routeNr,trackT,vehType);
}


MapContainer.prototype._clearFilter = function(){
    if(this.selVehType2!=null)
        this.selVehType2.selectedIndex=0;
    if(this._clearFilter!=null)
     this.clearFilter();
}


MapContainer.prototype._varSelected = function(el,routeNr,direc,trackT,vehType){
   
        TaStops.prototype.drawRoute(routeNr,trackT,Global.VT.getByGroup(vehType));
     
        if(this.variantSelected!=null)
            this.variantSelected(routeNr,trackT,Global.VT.getByGroup(vehType));

}