             
         } else if roomList[myIndex].tolvEtt! == "Opptatt" {
             
-            
             prntRef.updateChildValues(["tolvEtt": "Ledig"])
             
             



class RoomViewController: UIViewController, UITableViewDelegate, UITableViewDataSource{

    var index = 0

    
    var ref = FIRDatabase.database().reference()
    
    let prntRef  = FIRDatabase.database().reference().child("list").child(roomList[myIndex].name!)

    @IBOutlet weak var tableTime: UITableView!


      @IBOutlet weak var navigationBar: UINavigationBar!
    
    // Data model: These strings will be the data for the table view cells
   
  let time: [String] = ["10 - 11                                       " + roomList[myIndex].tiElleve!,
                        
                        "11 - 12                                       " + roomList[myIndex].elleveTolv!,
                        
                        "12 - 13                                       " + roomList[myIndex].tolvEtt!,
                        
                        "13 - 14                                       " + roomList[myIndex].ettTo!,
                        
                        "14 - 15                                       " + roomList[myIndex].toTre!,
                        
                        "15 - 16                                       " + roomList[myIndex].treFire!]
                          
    
    
 

    // cell reuse id (cells that scroll out of view can be reused)
    let cellReuseIdentifier = "cell"
    

        
        // set the text from the data model
        cell.textLabel?.text = self.time[indexPath.row]
        
        
        
        return cell
    }
    
    
    func createAlertUnbook(title: String, message: String) {
        
        let alertUnbook = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.alert)
        
        
        alertUnbook.addAction(UIAlertAction(title: "Avbestill", style: UIAlertActionStyle.default, handler: { (action) in
            alertUnbook.dismiss(animated: true, completion: nil)
            
            if self.index == 0 {
                
                self.confirmtiElleve()
            }
                
            else if self.index == 1 {
                self.confirmelleveTolv()
                
            }
                
            else if self.index == 2 {
                self.confirmTolvEtt()
                
            }
                
            else if self.index == 3 {
                self.confirmEttTo()
                
                
            }
                
            else if self.index == 4 {
                self.confirmToTre()
                
            }
                
            else if self.index == 5 {
                self.confirmTreFire()
                
            }
            
            
            
            
            
        }))
        
        alertUnbook.addAction(UIAlertAction(title: "Avbryt", style: UIAlertActionStyle.destructive, handler: { (action) in
            alertUnbook.dismiss(animated: true, completion: nil)
            
            
            
        }))
        self.present(alertUnbook, animated: true, completion: nil)
        
        
        
    }
    
    
    
    func createAlert(title: String, message: String) {
        
