 
     self.view.endEditing(true)
 
-    //get the appdelegate and store it in a variable
     let appDelegate:AppDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
-
-    //get the storyboard an store it in a variable
     let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
 
 

    let rightViewController = mainStoryboard.instantiateViewControllerWithIdentifier("rightView") as! RightViewController


    //send the logged in user in the ViewController
    centerViewController.currentUser = currentUser

    //Set the left, right and center views as the rootviewcontroller for the navigation controller (one rootviewcontroller at a time)

    //Set the left view as the rootview for the navigation controller and keep it in a variable
    let leftSideNav = UINavigationController(rootViewController: leftViewController)
    leftSideNav.setNavigationBarHidden(true, animated: false)

    //Set the center view as the rootview for the navigation controller and keep it in a variable
    let centerNav = UINavigationController(rootViewController: centerViewController)

    //Set the right view as the rootview for the navigation controller and keep it in a variable
    let rightNav = UINavigationController(rootViewController: rightViewController)

    //Create the MMDrawerController and keep it in a variable named center container
    let centerContainer:MMDrawerController = MMDrawerController(centerViewController: centerNav, leftDrawerViewController: leftSideNav,rightDrawerViewController:rightNav)


    //Open and Close gestures for the center container

    //Set the open gesture for the center container
    centerContainer.openDrawerGestureModeMask = MMOpenDrawerGestureMode.PanningCenterView;

    //Setting the width of th right view
    //centerContainer.setMaximumRightDrawerWidth(appDelegate.window!.frame.width, animated: true, completion: nil)
    //Set the close gesture for the center container
    centerContainer.closeDrawerGestureModeMask = MMCloseDrawerGestureMode.PanningCenterView;




    //Set the centerContainer in the appDelegate.swift as the center container
    appDelegate.centerContainer = centerContainer

    //Set the rootViewController as the center container
    appDelegate.window!.rootViewController = appDelegate.centerContainer


    appDelegate.window!.makeKeyAndVisible()

    //    self.navigationController?.pushViewController(listViewController, animated: true)
  }

  func handleFailedAuth(error: NSError) {

  func validateFields(){
    //Check if username is empty
    
    if(userNameTextField.text == nil || userNameTextField.text!.isEmpty){

      //if empty change username textfield border color to red
      userNameTextField.layer.borderColor = UIColor.redColor().CGColor
      userNameTextField.layer.borderWidth = 1.0

      let popoverVC = storyboard?.instantiateViewControllerWithIdentifier("loginPopover")
      popoverVC!.modalPresentationStyle = .Popover
      popoverVC!.preferredContentSize = CGSizeMake(250, 50)


