﻿// JScript File
if(typeof(Global)=='undefined')
Global={};
if(typeof(Global.lang)=='undefined')
Global.lang={
                wsz_poj:"Wszystkie pojazdy",
                autobus:"Autobusy",
                trojbus:"Trolejbusy"
            }
 //czy odświeżać listę lini w prawym panelu aplikacji klienckiej
 Global.refreshRoutesInSidebar = false;
 Global.VT = {
            enabled:false,
            types:[
                    {
                        name: Global.lang.wsz_poj,
                        ids : [''],
                        vehIcon: 'img/allveh/dbus.png',
                        vehShineIcon:'img/allveh/dbus_shine.png',
                        vehGrayIcon:'img/allveh/dbus_gray.png',
                        vehArrows: ['img/allveh/arrow1.png','img/bus/arrow2.png','img/bus/arrow3.png','img/bus/arrow4.png','img/bus/arrow5.png','img/bus/arrow6.png','img/bus/arrow7.png','img/bus/arrow8.png'],
                        stopIcon:  'img/allveh/mm_20_blue.png',
                        stopShineIcon:  'img/allveh/mm_20_blue_shine.png',
                        stopClickedIcon:'img/allveh/mm_20_blue_shine.png',
                        
                        infoIcon:'img/allveh/circ.png',
                        infoHoverIcon:'img/allveh/circ2.png',
                        labelColor:'#00F',
                        routeColor:'#344ff3',
                        panelLabelColor:'#344ff3'    
                    },
                    {
                        name: Global.lang.autobus ,
                        ids : ['1'],
                        vehIcon: 'img/bus/dbus.png',
                        vehShineIcon:'img/bus/dbus_shine.png',
                        vehGrayIcon:'img/bus/dbus_gray.png',
                        vehArrows: ['img/bus/arrow1.png','img/bus/arrow2.png','img/bus/arrow3.png','img/bus/arrow4.png','img/bus/arrow5.png','img/bus/arrow6.png','img/bus/arrow7.png','img/bus/arrow8.png'],
                        stopIcon:  'img/bus/mm_20_blue.png',
                        stopShineIcon:  'img/bus/mm_20_blue_shine.png',
                        stopClickedIcon:'img/bus/mm_20_blue_shine.png',

                        infoIcon:'img/bus/circ.png',
                        infoHoverIcon:'img/bus/circ2.png',
                        labelColor:'#344ff3',
                        routeColor:'#344ff3',
                        panelLabelColor:'#344ff3'    
                    },
                    {
                        name: Global.lang.trojbus ,
                        ids : ['2'],
                        vehIcon: 'img/tbus/dbus.png',
                        vehGrayIcon:'img/tbus/dbus_gray.png',
                        vehShineIcon:'img/tbus/dbus_shine.png',
                        vehArrows: ['img/tbus/arrow1.png','img/tbus/arrow2.png','img/tbus/arrow3.png','img/tbus/arrow4.png','img/tbus/arrow5.png','img/tbus/arrow6.png','img/tbus/arrow7.png','img/tbus/arrow8.png'],
                        stopIcon:  'img/tbus/mm_20_blue.png',
                        stopShineIcon:  'img/tbus/mm_20_blue_shine.png',
                        stopClickedIcon:'img/tbus/mm_20_blue_shine.png',
                        infoIcon:'img/tbus/circ.png',
                        infoHoverIcon:'img/tbus/circ2.png',
                        labelColor:'#931414',
                        routeColor:'#ff1414',
                        panelLabelColor:'#931414'    
                    }
            ],
            init:function(){
                //init języka (jest to obiekt globalny, tworzony na początku, a język mógł być wczytany potem)
                this.types[0].name= Global.lang.wsz_poj;
                this.types[1].name= Global.lang.autobus;
                this.types[2].name= Global.lang.trojbus;
            },
            get:function(strId){
                if(!this.enabled)  return this.types[1];
               // alert(strId);
                for(var i=0;i<this.types.length;++i){
                    var ids=this.types[i].ids;
                    for(var j=0;j<ids.length;++j)
                        if(ids[j]==strId) return this.types[i];
                }
                //jeśli nie znaleiono to zwroc pierwszy
                return this.types[0];
            },
            
            //zwraca grupe poojazdu, jeśli kilka typów (np maly autobus, duży autobus) tworzą jedną grupe
            getByGroup:function(strGroupIds){
            
            if(!this.enabled)return this.types[1];
            if(strGroupIds =='') return this.types[0];
            
                for(var i=0;i<this.types.length;++i){
                    if(strGroupIds==this.types[i].ids.join(','))
                        return this.types[i];
                }
                return this.types[0];
            }
    }
