private void DrawFlightWindow(int id)
        {
            if (GUI.Button(new Rect(flightWindowRect.width - 28, 2, 25, 16), "X"))
            {
                needToShowFlight = false;
            }


            List <LaunchEvent> launches = EventProcessor.Instance.launches.GetRange(0, EventProcessor.Instance.launches.Count);

            /*if (reverseFlights)
            *       launches.Reverse();*/
            LaunchEvent launch = launches[flightIdToShow];

            if (!(launch.IsMissionFinished() || launch.GetLastEvent() is EndFlightEvent))
            {
                if (GUI.Button(new Rect(5, flightWindowRect.height - 22, 100, 20), "Finish mission"))
                {
                    EventProcessor.Instance.OnFinishMission(launch);
                }
            }
            Rect     captionRect = new Rect(0, 2, flightWindowRect.width, 16);
            string   txt         = "Flight №" + launch.posInTable + " - " + launch.shipName;
            GUIStyle currentStyle;

            if (FlightGlobals.ActiveVessel != null && FlightGlobals.ActiveVessel.id.ToString() == launch.shipID)
            {
                currentStyle = activeStyle;
            }
            else if (launch.IsDestroyed())
            {
                currentStyle = destroyedStyle;
            }
            else if (launch.GetEndDate() != -1)
            {
                currentStyle = endedStyle;
            }
            else
            {
                currentStyle = proceedingStyle;
            }
            currentStyle.fontStyle = FontStyle.Bold;
            currentStyle.alignment = TextAnchor.MiddleCenter;
            GUI.Label(captionRect, txt, currentStyle);
            currentStyle.fontStyle = FontStyle.Normal;
            currentStyle.alignment = TextAnchor.MiddleLeft;



            GUILayout.BeginHorizontal();
            GUILayout.BeginVertical(GUILayout.Width(100));
            GUILayout.Label("Vessel", boldtext);
            GUILayout.Label("Launch date", boldtext);
            GUILayout.Label("Launch mass", boldtext);
            GUILayout.Label("Cost", boldtext);
            hintContent.text    = "Close Orbit/SOI masses";
            hintContent.tooltip = "Masses";
            GUILayout.Label(hintContent, boldtext);
            GUILayout.Label("Docked", boldtext);
            GUILayout.Label("EVAs", boldtext);
            GUILayout.Label("Max speed", boldtext);
            GUILayout.Label("Max Gee", boldtext);
            hintContent.text    = "Landings";
            hintContent.tooltip = "Biomes";
            GUILayout.Label(hintContent, boldtext);
            GUILayout.Label("End date", boldtext);
            GUILayout.Label("Duration", boldtext);
            GUILayout.Label("Final mass", boldtext);
            hintContent.text    = "Science points";
            hintContent.tooltip = "Science points";
            GUILayout.Label(hintContent, boldtext);
            GUILayout.EndVertical();

            GUILayout.BeginVertical(GUILayout.Width(400));
            GUILayout.Label(launch.shipName);
            GUILayout.Label(Utils.TicksToDate(launch.time));
            GUILayout.Label(Utils.CorrectNumber(launch.launchMass.ToString(), 3));
            GUILayout.Label(Utils.CorrectNumber(launch.launchCost.ToString()));
            float  massOnOrbit     = launch.GetMassOnOrbit();
            string massOnOrbitText = "-";

            if (massOnOrbit > 0)
            {
                massOnOrbitText = massOnOrbit.ToString();
            }
            hintContent.text    = Utils.CorrectNumber(massOnOrbitText);
            hintContent.tooltip = "Masses";
            GUILayout.Label(hintContent);
            GUILayout.Label(launch.GetDockings().ToString());
            GUILayout.Label(launch.GetEvas().ToString());
            GUILayout.Label(Utils.CorrectNumber(launch.maxSpeed.ToString()) + "m/s");
            GUILayout.Label(Utils.CorrectNumber(launch.maxGee.ToString()) + " G");
            hintContent.text    = launch.GetLandingsCount().ToString();
            hintContent.tooltip = "Biomes";
            GUILayout.Label(hintContent);

            long endDate = launch.GetEndDate();

            if (endDate != -1)
            {
                GUILayout.Label(Utils.TicksToDate(endDate));
                GUILayout.Label(Utils.TicksToTotalTime(launch.GetTotalFlightTime()));
            }
            else
            {
                GUILayout.Label("-");
                GUILayout.Label(Utils.TicksToTotalTime(launch.GetTotalFlightTime()));
            }
            GUILayout.Label(Utils.CorrectNumber(launch.GetFinalMass().ToString(), 3));
            float  sciencePoints     = launch.GetSciencePoints();
            string sciencePointsText = "-";

            if (sciencePoints > 0)
            {
                sciencePointsText = Utils.CorrectNumber(sciencePoints.ToString());
            }
            hintContent.text    = sciencePointsText;
            hintContent.tooltip = "Science points";
            GUILayout.Label(sciencePointsText);
            GUILayout.EndVertical();

            GUILayout.BeginVertical();
            GUILayout.Box("SOI changes (dates, SOI names)");
            scrollViewVector1 = GUILayout.BeginScrollView(scrollViewVector1, GUILayout.Height((flightWindowRect.height - 130) / 3));
            List <FlightEvent> sois = launch.GetSOIChanges().ToArray().ToList <FlightEvent>();

            sois.AddRange(launch.GetLandings());
            sois.Sort();
            foreach (FlightEvent record in sois)
            {
                if (record is SOIChangeEvent)
                {
                    GUILayout.Label(Utils.TicksToDate(record.time) + " \t " + (record as SOIChangeEvent).soiName.ToString());
                }
                else
                {
                    GUILayout.Label(Utils.TicksToDate(record.time) + " \t Land:" + (record as LandingEvent).mainBodyName.ToString()
                                    + ":" + (record as LandingEvent).biome.ToString());
                }
            }
            GUILayout.EndScrollView();
            GUILayout.Box("Initial crew");
            scrollViewVector2 = GUILayout.BeginScrollView(scrollViewVector2, GUILayout.Height((flightWindowRect.height - 130) / 3));
            foreach (string crewMember in launch.crewMembers)
            {
                GUILayout.Label(crewMember);
            }
            GUILayout.EndScrollView();
            GUILayout.Box("Final crew");
            scrollViewVector3 = GUILayout.BeginScrollView(scrollViewVector3, GUILayout.Height((flightWindowRect.height - 130) / 3));
            foreach (string crewMember in launch.GetFinalCrew())
            {
                GUILayout.Label(crewMember);
            }
            GUILayout.EndScrollView();

            GUILayout.EndVertical();
            GUILayout.BeginVertical();
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();

            ProcessPopup();
            GUI.DragWindow(new Rect(0, 0, 10000, 20));
        }