 
         // Mark the window's red close button if the are changes to save
         window.isDocumentEdited = needToSave
+    }
+
+    @IBAction func showBookmark(_ sender: Any) {
+
+        bookmark.isHidden = !bookmark.isHidden
+        bookmarkButtonButton.bookmarkState = !bookmarkButtonButton.bookmarkState
     }
 
     // MARK: Stats Tab Functions


    var statsTabImage: NSImageView? = nil

    // MARK: App Lifecycle Functions

    func applicationWillFinishLaunching(_ notification: Notification) {

        openPanel.allowedFileTypes = ["ffc"]
        openPanel.allowsMultipleSelection = false
        openPanel.beginSheetModal(for: window, completionHandler: { (response) in
            if response == NSApplication.ModalResponse.OK {
                let path:String = openPanel.urls[0].path
                _ = self.openFileHander(path)
            }
        })
    }

    func openFileHander(_ path: String) -> Bool {

        self.player = NSKeyedUnarchiver.unarchiveObject(withFile: path) as? FFPlayer

        if let zplayer = self.player {
            // Update the Citadel of Chaos magic spell matrix
            if zplayer.gamekind == kGameCitadel {
                self.creatureCopyField.stringValue = "\(zplayer.citadelSpellMatrix[0])"
                self.espField.stringValue = "\(zplayer.citadelSpellMatrix[1])"
                self.fireField.stringValue = "\(zplayer.citadelSpellMatrix[2])"
                self.illusionField.stringValue = "\(zplayer.citadelSpellMatrix[3])"
                self.levitationField.stringValue = "\(zplayer.citadelSpellMatrix[4])"
                self.luckField.stringValue = "\(zplayer.citadelSpellMatrix[5])"
                self.shieldingField.stringValue = "\(zplayer.citadelSpellMatrix[6])"
                self.skillField.stringValue = "\(zplayer.citadelSpellMatrix[7])"
                self.staminaField.stringValue = "\(zplayer.citadelSpellMatrix[8])"
                self.strengthField.stringValue = "\(zplayer.citadelSpellMatrix[9])"
                self.weaknessField.stringValue = "\(zplayer.citadelSpellMatrix[10])"
            }

            // Update the Temple of Terror magic spell readout
            if zplayer.gamekind == kGameTempleTerror {
                self.spellOnePopup.selectItem(at: zplayer.templeSpellMatrix[0])
                self.spellTwoPopup.selectItem(at: zplayer.templeSpellMatrix[1])
                self.spellThreePopup.selectItem(at: zplayer.templeSpellMatrix[2])
                self.spellFourPopup.selectItem(at: zplayer.templeSpellMatrix[3])
            }

            // Handle tab hiding/unhiding
            if zplayer.gamekind == kGameTempleTerror || zplayer.gamekind == kGameCitadel {
                // Add back the Magic tab if necessary
                if !self.tabs.tabViewItems.contains(self.magicTabItem) {
                    self.tabs.insertTabViewItem(self.heldTabs["magicTabItem"]!, at: 2)
                }
            } else {
                // Remove the Magic tab
                self.heldTabs["magicTabItem"] = self.magicTabItem!
                if self.tabs.tabViewItems.contains(self.magicTabItem) { self.tabs.removeTabViewItem(self.magicTabItem) }
            }

            // Handle game-specific stats boxes
            self.hellBox.isHidden = zplayer.gamekind == kGameHouseHell ? false : true
            self.citadelBox.isHidden = zplayer.gamekind == kGameCitadel ? false : true

            // Handle game-specific images
            if self.statsTabImage != nil {
                self.statsTabImage?.removeFromSuperview()
                self.statsTabImage = nil
            }

            if zplayer.gamekind == kGameHouseHell {
                let image: NSImageView = NSImageView.init(frame: NSMakeRect(8, 14, 146, 102))
                image.image = NSImage.init(named: NSImage.Name("hoh"))
                self.statsTabView.addSubview(image)
                self.statsTabImage = image
            }

            if zplayer.gamekind == kGameCitadel {
                let image: NSImageView = NSImageView.init(frame: NSMakeRect(161, 14, 258, 102))
                image.image = NSImage.init(named: NSImage.Name("coc"))
                self.statsTabView.addSubview(image)
                self.statsTabImage = image
            }

            // Update the modifiers
            self.testLuckMod.selectItem(at: zplayer.modMatrix[0])
            self.testSkillMod.selectItem(at: zplayer.modMatrix[1])
            self.playerMod.selectItem(at: zplayer.modMatrix[2])
            self.monsterMod.selectItem(at: zplayer.modMatrix[3])

            self.savePath = path

            self.window.title = zplayer.gameName
            self.gameInProgress = true
            self.updateStats()

            if zplayer.gamekind == kGamePortPeril {
                self.setPortPerilGameMenu()
            } else {
                self.gameMenu.isHidden = true
                self.gameMenu.isEnabled = false
            }

            if zplayer.bookmark != -1 {
                self.bookmark.place = zplayer.bookmark
                self.bookmark.needsDisplay = true
                self.bookmark.isHidden = false
                self.bookmarkButtonButton.bookmarkState = true
            }

            return true
        } else {
            return false
        }
    }

    @IBAction func closeCharacter(_ sender: Any) {
