                 i = i + 1
             weekInfo
 
+        getWeekNumber: (currentMonth, currentDate, currentYear) =>
+            self = @
+            weekNum = 1
+            weekNums = []
+            weekInfo = self.getDatesInWeek currentMonth, currentDate, currentYear
+
+            $.each self.months, (key, value) ->
+                numberDays = self.getDaysInMonth key, currentYear
+                firstDay = self.getDayOfWeek key, 1, currentYear
+                dayShift = if firstDay is self.daysPerWeek then 0 else firstDay
+                numberWeeks = self.getWeeksInMonth currentMonth, currentYear
+                week = 1
+                if $.isNumeric numberWeeks
+                    until week > numberWeeks
+                        if week is 1 and firstDay isnt 0
+                            weekNum = weekNum
+                        else
+                            weekNum = weekNum + 1
+                        week = week + 1
+                        if currentMonth is key
+                            weekNums.push weekNum
+            weekNumber = weekNums[weekInfo.weekNum]
+
         createEvent: (newEvent) =>
             id = @events.length
             obj =

            if eventDates.length > 0
                $.each eventDates, (key, date) ->
                    # add css classes here
                    self.addCalendarEvent events, date

        highlightWeekends: =>
            self = @
            calendarInner = self.calendar.find "div.#{@calendarInnerClass}"
            weeks = calendarInner.find '.drm-week'
            weekends = [
                $.inArray('Sunday', self.days)
                $.inArray('Saturday', self.days)
            ]

            $.each weeks, ->
                that = $ @
                $.each weekends, (key, value) ->
                    weekend = that.find(".#{self.classes.date}[data-day=#{value}]").not ".#{self.classes.muted}, .#{self.classes.today}, .#{self.classes.holiday}"
                    weekend.addClass self.classes.weekend

        highlightCurrentDay: =>
            calendarInner = @calendar.find "div.#{@calendarInnerClass}"
            month = calendarInner.data 'month'
            year = calendarInner.data 'year'

            if month is @currentMonth and year is @currentYear
                calendarInner.find(".drm-date[data-date=#{@currentDate}]").addClass @classes.today

        addWeekNumbers: =>
            self = @
            calendarInner = self.calendar.find "div.#{@calendarInnerClass}"
            month = calendarInner.data 'month'
            year = calendarInner.data 'year'
            weekNum = 1
            weeks = calendarInner.find '.drm-week'
            weekNums = []

            $.each self.months, (key, value) ->
                firstDay = self.getDayOfWeek key, 1, year
                dayShift = if firstDay is self.daysPerWeek then 0 else firstDay
                numberWeeks = self.getWeeksInMonth month, year
                week = 1
                if $.isNumeric numberWeeks
                    until week > numberWeeks
                        if week is 1 and firstDay isnt 0
                            weekNum = weekNum
                        else
                            weekNum = weekNum + 1
                        week = week + 1

                        if month is key
                            weekNums.push weekNum

            if self.view is 'month'
                $.each weekNums, (key, value) ->
                    week = weeks.eq key
                    if value % 2 is 0 then week.addClass('even-week') else week.addClass('odd-week')
                    week.attr 'data-week', value
            else if self.view is 'week'
                weekNum = weekNums[0] + weeks.data('month-week-num')
                if weekNum % 2 is 0 then weeks.addClass('even-week') else weeks.addClass('odd-week')
                weeks.attr 'data-week', weekNum

        getWeekNumber: (currentMonth, currentDate, currentYear) =>
            self = @
            weekNum = 1
            weekNums = []
            weekInfo = self.getDatesInWeek currentMonth, currentDate, currentYear

            $.each self.months, (key, value) ->
                numberDays = self.getDaysInMonth key, currentYear
                firstDay = self.getDayOfWeek key, 1, currentYear
                dayShift = if firstDay is self.daysPerWeek then 0 else firstDay
                numberWeeks = self.getWeeksInMonth currentMonth, currentYear
                week = 1
                if $.isNumeric numberWeeks
                    until week > numberWeeks
                        if week is 1 and firstDay isnt 0
                            weekNum = weekNum
                        else
                            weekNum = weekNum + 1
                        week = week + 1
                        if currentMonth is key
                            weekNums.push weekNum
            weekNumber = weekNums[weekInfo.weekNum]

        changeCalendarView: (view) =>
            calendar = $ ".#{@calendarInnerClass}"

            currentMonth = calendar.data 'month'
            currentYear = calendar.data 'year'
            currentDate = if currentMonth is @currentMonth then @currentDate else 1

            @view = view
            @changeCalendar currentMonth, currentDate, currentYear

        advanceDate: (direction) =>
            calendarInner = @calendar.find "div.#{@calendarInnerClass}"

                eventDates.push parseInt(events.eventDate, 10)
                eventDates

            _addCalendarEvent = (events, dates) ->
                # create event html

                if self.view is 'month'
                    calendarItem = calendarInner.find ".drm-date[data-date=#{dates}]"
                else if !events.time?
                    calendarItem = calendarInner.find ".drm-date[data-date=#{dates}][data-hour='All Day Event']"
                else
                    # find hour td element
                    re = new RegExp '^0?','gi'
                    re2 = new RegExp ':[0-9]{2}', 'gi'
                    hour = events.time.replace re, ''
                    hour = hour.replace re2, ''
                    calendarItem = calendarInner.find ".drm-date[data-date=#{dates}][data-hour=#{hour}]"

                eventList = calendarItem.find "ul.#{self.eventClass}"
                length = eventList.length

                eventContent = 
                    if events.time?
                        "<span class='drm-time'>#{events.time}: </span><span class='drm-event'>#{events.name}</span>"
                    else
                        "<span class='drm-event drm-all-day-event'>#{events.name}</span>"

                eventHtml = $ '<a></a>',
                    href: '#'
                    'data-event': events.id
                    html: eventContent

                if length is 0
                    eventList = $ '<ul></ul>',
                        class: self.eventClass

                    eventList.appendTo calendarItem
                
                item = $ '<li></li>',
                    html: eventHtml
                
                item.appendTo eventList

                if events.type is 'holiday' then eventList.find("a:contains(#{events.name})").addClass self.classes.holiday

            if events.recurrance is 'yearly' and currentMonth is month
                _addYearlyEvents events, eventDates
            else if events.recurrance is 'monthly'
