function HomeCtrl($scope, $http, $location, $route) {  
    alarmReview();
    
    //print or not button for answer
    if( localStorage.btnAnswerStatus == 2 ){
      $( '.wp.of_put_in_practice' ).removeClass('small');
      $( '.wp.of_put_in_practice' ).removeClass('notVisible');
    }
    else if ( localStorage.btnAnswerStatus == 1 ){
      $( '.wp.of_put_in_practice' ).addClass('small');
      $( '.wp.of_put_in_practice' ).removeClass('notVisible');
    }
    else if ( localStorage.btnAnswerStatus == 0 ){
      $( '.wp.of_put_in_practice' ).removeClass('small');
      $( '.wp.of_put_in_practice' ).addClass('notVisible');
    }
  
    if( localStorage.btnDailyStatus == 1 ){
      $( '.div_btn_home.get_daily' ).addClass('alert');
    }
    else if ( localStorage.btnDailyStatus == 0 ){
      $( '.div_btn_home.get_daily' ).removeClass('alert');
    }
    
    if( parseInt(localStorage.counterReviewAlarm) <= 0 ){
      $( '.wp_counter_review' ).css('display', 'none');
      localStorage.counterReviewAlarm = 0;
    }
    else{
      $scope.counterReview = localStorage.counterReviewAlarm;
      $( '.wp_counter_review' ).css('display', 'block');
    }

    $scope.closeAlertAnswer = function() {
      localStorage.btnAnswerStatus = 1;
    }

    $scope.tapAnswer = function() {
      localStorage.btnAnswerStatus = 0;
      localStorage.isAnswer = 1;
      window.location = '#/answer';
    }

    $scope.tapDaily = function() {
      localStorage.btnDailyStatus = 0;
      window.location = '#/daily';
    }

    $scope.tapReview = function() {
      localStorage.isAnswer = 0;
      localStorage.counterReviewAlarm = parseInt(localStorage.counterReviewAlarm)-1;
      window.location = '#/answer';
    }

    var points = getPoints();

	  var element_points_passed = $('.points_passed');
      if( points.new == true){
      	 $scope.points = points;
      
      }else{
      	$scope.points = points;
      }
     
      $scope.turnOff = function(){
        openPopUpLogOut('Logout', 'Are you sure that you want to logout? If you press "logout", Daily Expression will be closed and the notifications will be desactivated. If you only want to close the window app, press "only close".');
      }
      $scope.close = function(){
        window.close();
      }
      $scope.logout = function(){
        upDateData();
      }

      $scope.goToSupport = function(){
        overflowActive();
        window.location = '#/support';
      }

      $scope.demo = function() {
        removeAlarmByType('daily');
        removeAlarmByType('answer');
        randomMomentRegister();
        openPopUp2('Demo activada', 'En 5 min. sonará la alarma de "daily" y en 10 la de "answer". Recuerda, si ya has obtenido una expresión hoy será la misma. El botón es para que el jurado de los premios app pueda evaluarla mejor. Se retirará.');
      }
      
    $scope.time = moment().format('h:mm');
    $scope.seconds = moment().format('ss');

    setInterval(
      function(){
        $scope.time = moment().format('h:mm');
        $scope.seconds = moment().format('ss');
        $scope.$apply();
      }, 1000
    );
  
  
}

