     }
     
     func segmentTab(sender: NSSegmentedControl){
-        selectModule(sender.selectedSegment)
+        selectModule(sender.labelForSegment(sender.selectedSegment)!)
     }
     
-    func selectModule(moduleIndex:Int){
-        if(moduleIndex == 2){
+    func selectModule(moduleName:String){
+        if(moduleName == TrainOrder){
             if orderQueryViewController == nil{
                 orderQueryViewController = OrderViewController()
             }
             self.window?.contentView = orderQueryViewController!.view
         }
-        else if(moduleIndex == 0){
+        else if(moduleName == TrainBook){
             if ticketQueryViewController == nil{
                 ticketQueryViewController = TicketQueryViewController()
             }

    var taskViewController:TaskViewController?
    
    var loginWindowController:LoginWindowController!
    
    override func windowDidLoad()
    {

//    	aWindow.bottomBarHeight = aWindow.titleBarHeight;
//	NSView *titleBarView = aWindow.titleBarView;
        
        selectModule(TrainBook)
        
        self.window?.recalculateKeyViewLoop()
        
