           classString += ' selected'
         else if scope.mgEnd? and scope.mgEnd.getTime() is dayObj.getTime()
           classString += ' selected'
-        #else if scope.mgStart? and scope.mgEnd? and !startSelected and dayObj > scope.mgStart and dayObj < scope.mgEnd
         else if scope.mgStart? and scope.mgEnd? and dayObj > scope.mgStart and dayObj < scope.mgEnd
           classString = 'between-selected'
         else if scope.mgOptions.today?

      isVisible: (date, day) ->
        new Date(date.getFullYear(), date.getMonth(), day).getMonth() is date.getMonth()
      isDisabled: (currentDate) ->
#        if scope.mgStart and scope.mgEnd and scope.mgButtonName is 'checkout'
#          mindate = new Date scope.mgStart
#          mindate.setDate mindate.getDate() + 1
#        else
#          mindate = scope.restrictions.mindate
        mindate = scope.restrictions.mindate
        if scope.mgOptions.limitNights? and startSelected
          maxdate = new Date scope.mgStart.getFullYear(), scope.mgStart.getMonth(), scope.mgStart.getDate() + scope.mgOptions.limitNights

          maxdate = scope.restrictions.maxdate
        (mindate? and currentDate < mindate) or (maxdate? and currentDate > maxdate)
      isToday: (day) ->
        day.toDateString() == Calendar.getToday().toDateString()
      isStart: (day) ->
        scope.mgStart? and scope.mgStart.getTime() is day.getTime()
